aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2008-06-22 13:41:47 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2008-06-22 13:41:47 -0700
commitfea0d8585c4583cab3f8413c58a201dba1993320 (patch)
tree2b0074bff6669363cc0946176877bfe4ddee9f3a /wrappers/cross-pkg-config
downloadcrossdev-fea0d8585c4583cab3f8413c58a201dba1993320.tar.gz
crossdev-fea0d8585c4583cab3f8413c58a201dba1993320.tar.bz2
crossdev-fea0d8585c4583cab3f8413c58a201dba1993320.zip
Initial commit to crossdev repo.
Diffstat (limited to 'wrappers/cross-pkg-config')
-rwxr-xr-xwrappers/cross-pkg-config52
1 files changed, 52 insertions, 0 deletions
diff --git a/wrappers/cross-pkg-config b/wrappers/cross-pkg-config
new file mode 100755
index 0000000..ea70b6f
--- /dev/null
+++ b/wrappers/cross-pkg-config
@@ -0,0 +1,52 @@
+#!/bin/sh
+# Copyright 2008 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: $
+
+# -solar
+# Also uses vapier's code from uclinux-dist
+
+if [[ "x$ROOT" == "x" ]]; then
+ exit 1
+fi
+
+# Helper functions. So very helpful.
+#
+msg_to_stderr() { echo "cross-pkg-config: $*" 1>&2 ; }
+warn() { msg_to_stderr "warning: $*" ; }
+error() {
+ msg_to_stderr "error: $*"
+ exit 1
+}
+
+
+SYSROOT="$ROOT"
+export PKG_CONFIG_LIBDIR="${SYSROOT}/usr/lib/pkgconfig"
+unset PKG_CONFIG_PATH PKG_CONFIG_ALLOW_SYSTEM_CFLAGS PKG_CONFIG_ALLOW_SYSTEM_LIBS
+#export PKG_CONFIG_DEBUG_SPEW="yes" #enable for debug
+
+#
+# Sanity check the output to catch common errors that do not
+# cause failures until much later on.
+#
+output=$(pkg-config "$@")
+ret=$?
+case " ${output} " in
+ *" -L/usr/lib "*|*" -L/usr/local/lib "*|\
+ *" -L /usr/lib "*|*" -L /usr/local/lib "*|\
+ *" -L/usr/lib64 "*|*" -L/usr/local/lib64 "*|\
+ *" -L /usr/lib64 "*|*" -L /usr/local/lib64 "*)
+ warn "### falling down so here is a dump state ######"
+ pkg-config --debug "$@" 1>&2
+ warn "### end of dump ###############################"
+ error "host -L paths detected: ${output}"
+ ;;
+ *" -I/usr/include"*|*" -I/usr/local/include"*)
+ warn "### falling down so here is a dump state ######"
+ pkg-config --debug "$@" 1>&2
+ warn "### end of dump ###############################"
+ error "host -I paths detected: ${output}"
+ ;;
+esac
+[ -n "${output}" ] && echo "${output}"
+exit ${ret}