root / trunk / util / pkg-config.sh

Revision 199, 1.3 kB (checked in by saurik, 8 months ago)

Drastic, sweeping modifications to support iPhone 1.2.0/2.0.

  • Property svn:executable set to *
Line 
1#!/bin/bash
2
3#echo 1>&2
4#echo ::: "$@" 1>&2
5
6declare -a args
7declare -a pkgs
8unset dbpf
9
10while [[ $# -ne 0 ]]; do case "$1" in
11    (--atleast-pkgconfig-version)
12        exec pkg-config "$1" "$2"
13    ;;
14
15    (--cflags|--libs|--variable=*)
16        dbpf=
17        args[${#args[@]}]=$1
18    ;;
19
20    (--errors-to-stdout|--exists|--modversion|--print-errors|--short-errors|--uninstalled)
21        args[${#args[@]}]=$1
22    ;;
23
24    (--atleast-version|--exact-version|--max-version)
25        args[${#args[@]}]=$1
26        args[${#args[@]}]=$2
27        shift
28    ;;
29
30    (--*)
31        echo "unknown pkg-config option $1" 1>&2
32        exit 1
33    ;;
34
35    (*)
36        pkgs[${#pkgs[@]}]=$1
37    ;;
38esac; shift; done
39
40if [[ ${dbpf+@} ]]; then
41    source "${PKG_BASE}/folders.sh"
42fi
43
44outs=
45for pkg in "${pkgs[@]}"; do
46    args_=("${args[@]}")
47
48    if [[ ${dbpf+@} ]]; then
49        dest=$(for dep in $(find -L "${PKG_DATA}"/_metadata -name '*.dep' | cut -d '/' -f -); do
50            DEP_NAME=$(basename "${dep}" .dep)
51            DEP_DEST=$(PKG_DEST_ "${DEP_NAME}")
52
53            find "${DEP_DEST}" -name "${pkg}.pc" -printf "${DEP_DEST}\n"
54        done) && args_=(--define-variable=prefix="${dest}/usr" "${args_[@]}")
55    fi
56
57    #echo @@@ pkg-config "${args_[@]}" "${pkg}" 1>&2
58    out=$(pkg-config "${args_[@]}" "${pkg}") || exit $?
59    #echo "=== ${out}" 1>&2
60    outs+=\ ${out}
61done
62
63echo "${out#\ }"
Note: See TracBrowser for help on using the browser.