summaryrefslogtreecommitdiff
path: root/helper.sh
blob: f67ea516846b3d3911b2a8f8f60974c18e126f5f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash

source "${PKG_BASE}/architect.sh"

export PKG_ROOT=$(xcrun -sdk iphoneos --show-sdk-path)
export PKG_CCPF=$("${PKG_TARG}-gcc" -v 2>&1 | grep -- --prefix | sed -e 's/.*--prefix=\([^ ]*\).*/\1/')

source "${PKG_BASE}/folders.sh"

if [[ ${PKG_NAME} != @(-|:*) ]]; then
    export PKG_MORE=$(PKG_MORE_ "${PKG_NAME}")
    export PKG_DATA=$(PKG_DATA_ "${PKG_NAME}")
    export PKG_WORK=$(PKG_WORK_ "${PKG_NAME}")
    export PKG_DEST=$(PKG_DEST_ "${PKG_NAME}")

    export PKG_STAT=${PKG_BASE}/stat/${PKG_ARCH}/${PKG_CFTARG}/${PKG_NAME}
    export PKG_DATA=$(echo "${PKG_BASE}"/data/"${PKG_NAME}"?(_))
    export PKG_RVSN=$(cat "${PKG_STAT}/dest-ver" 2>/dev/null)

    if [[ -e "${PKG_DATA}/_metadata/zlib" ]]; then
        export PKG_ZLIB=$(cat "${PKG_DATA}/_metadata/zlib")
    else
        export PKG_ZLIB=lzma
    fi

    if [[ -e "${PKG_DATA}/_metadata/version" ]]; then
        export PKG_VRSN=$(cat "${PKG_DATA}/_metadata/version")
    fi

    if [[ -e "${PKG_DATA}/_metadata/priority" ]]; then
        export PKG_PRIO=$(cat "${PKG_DATA}/_metadata/priority")
    fi

    if [[ ! -e ${PKG_DATA} ]]; then
        echo "unknown package: ${PKG_NAME}" 1>&2
        exit 1
    fi

    declare -a PKG_DEPS
    for dep in "${PKG_DATA}"/_metadata/*.dep; do
        PKG_DEPS[${#PKG_DEPS[@]}]=$(basename "${dep}" .dep)
    done
fi