summaryrefslogtreecommitdiff
path: root/util/pkg-config.sh
diff options
context:
space:
mode:
authorJay Freeman <saurik@saurik.com>2008-04-06 10:28:29 +0000
committerJay Freeman <saurik@saurik.com>2008-04-06 10:28:29 +0000
commitd699a01fabaa04a1aad60f6ca5777f82ee24839a (patch)
tree1eb62bad23b14a0877c5b9171f2a5f9358c8d592 /util/pkg-config.sh
parent8a49e427447f40fdd43fc4b5f513b166dd639e2a (diff)
Drastic, sweeping modifications to support iPhone 1.2.0/2.0.
git-svn-id: http://svn.telesphoreo.org/trunk@199 514c082c-b64e-11dc-b46d-3d985efe055d
Diffstat (limited to 'util/pkg-config.sh')
-rwxr-xr-xutil/pkg-config.sh64
1 files changed, 62 insertions, 2 deletions
diff --git a/util/pkg-config.sh b/util/pkg-config.sh
index d9e64d22d..22d2815b3 100755
--- a/util/pkg-config.sh
+++ b/util/pkg-config.sh
@@ -1,3 +1,63 @@
#!/bin/bash
-echo "$@" | grep -- --atleast >/dev/null && exit 0
-exec pkg-config "$@"
+
+#echo 1>&2
+#echo ::: "$@" 1>&2
+
+declare -a args
+declare -a pkgs
+unset dbpf
+
+while [[ $# -ne 0 ]]; do case "$1" in
+ (--atleast-pkgconfig-version)
+ exec pkg-config "$1" "$2"
+ ;;
+
+ (--cflags|--libs|--variable=*)
+ dbpf=
+ args[${#args[@]}]=$1
+ ;;
+
+ (--errors-to-stdout|--exists|--modversion|--print-errors|--short-errors|--uninstalled)
+ args[${#args[@]}]=$1
+ ;;
+
+ (--atleast-version|--exact-version|--max-version)
+ args[${#args[@]}]=$1
+ args[${#args[@]}]=$2
+ shift
+ ;;
+
+ (--*)
+ echo "unknown pkg-config option $1" 1>&2
+ exit 1
+ ;;
+
+ (*)
+ pkgs[${#pkgs[@]}]=$1
+ ;;
+esac; shift; done
+
+if [[ ${dbpf+@} ]]; then
+ source "${PKG_BASE}/folders.sh"
+fi
+
+outs=
+for pkg in "${pkgs[@]}"; do
+ args_=("${args[@]}")
+
+ if [[ ${dbpf+@} ]]; then
+ dest=$(for dep in $(find -L "${PKG_DATA}"/_metadata -name '*.dep' | cut -d '/' -f -); do
+ DEP_NAME=$(basename "${dep}" .dep)
+ DEP_DEST=$(PKG_DEST_ "${DEP_NAME}")
+
+ find "${DEP_DEST}" -name "${pkg}.pc" -printf "${DEP_DEST}\n"
+ done) && args_=(--define-variable=prefix="${dest}/usr" "${args_[@]}")
+ fi
+
+ #echo @@@ pkg-config "${args_[@]}" "${pkg}" 1>&2
+ out=$(pkg-config "${args_[@]}" "${pkg}") || exit $?
+ #echo "=== ${out}" 1>&2
+ outs+=\ ${out}
+done
+
+echo "${out#\ }"