summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc Kleine-Budde <mkl@pengutronix.de>2013-02-05 15:43:50 +0100
committerMarc Kleine-Budde <mkl@pengutronix.de>2013-02-05 18:54:14 +0100
commit722b44bef47d9de96fcda9865541a1d45b342bc4 (patch)
tree828739106cb93f44f403d65b1871a255923c076a
parent6589e9cbee7a09c882667d1534eb13963b7d23dc (diff)
downloadptxdist-722b44bef47d9de96fcda9865541a1d45b342bc4.tar.gz
ptxdist-722b44bef47d9de96fcda9865541a1d45b342bc4.tar.xz
ptxd_make_00-init: setup PTXDIST_HOST_<FLAG> variables
...they will be used by the compiler wrapper in a later patch. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
-rw-r--r--scripts/lib/ptxd_make_00-init.sh78
1 files changed, 77 insertions, 1 deletions
diff --git a/scripts/lib/ptxd_make_00-init.sh b/scripts/lib/ptxd_make_00-init.sh
index 730254559..3f9467de0 100644
--- a/scripts/lib/ptxd_make_00-init.sh
+++ b/scripts/lib/ptxd_make_00-init.sh
@@ -152,6 +152,22 @@ ptxd_init_ptxdist_path_sysroot() {
#
+# get host sysroot
+#
+# out:
+# PTXDIST_PATH_SYSROOT_HOST sysroot
+# PTXDIST_PATH_SYSROOT_HOST_PREFIX prefixes (/) of sysroot
+#
+ptxd_init_ptxdist_path_sysroot_host() {
+ local sysroot="$(ptxd_get_ptxconf PTXCONF_SYSROOT_HOST)"
+
+ export \
+ PTXDIST_PATH_SYSROOT_HOST="${sysroot}" \
+ PTXDIST_PATH_SYSROOT_HOST_PREFIX="${sysroot}"
+}
+
+
+#
# fixup collectionconfig when using another platform
#
# out:
@@ -275,6 +291,64 @@ ptxd_init_cross_env() {
IFS="${orig_IFS}"
}
+#
+# setup compiler and pkgconfig environment
+#
+# in:
+# ${PTXDIST_PATH_SYSROOT_HOST}
+#
+#
+# out:
+# PTXDIST_HOST_CPPFLAGS CPPFLAGS for host packages
+# PTXDIST_HOST_LDFLAGS LDFLAGS for host packages
+# PTXDIST_HOST_ENV_PKG_CONFIG PKG_CONFIG_* environemnt for host pkg-config
+#
+ptxd_init_host_env() {
+ ######## CPPFLAGS, LDFLAGS ########
+ local orig_IFS="${IFS}"
+ IFS=":"
+ local -a prefix
+ prefix=( ${PTXDIST_PATH_SYSROOT_HOST_PREFIX} )
+ IFS="${orig_IFS}"
+
+ local -a lib_dir
+ lib_dir=lib
+
+ # add "-isystem <DIR>/include"
+ local -a cppflags
+ cppflags=( "${prefix[@]/%//include}" )
+ cppflags=( "${cppflags[@]/#/-isystem }" )
+
+ # add "-L<DIR>/lib -Wl,-rpath-link -Wl,<DIR>"
+ local -a ldflags
+ ldflags=( "${prefix[@]/%//${lib_dir}}" )
+ ldflags=( \
+ "${ldflags[@]/#/-L}" \
+ "${ldflags[@]/#/-Wl,-rpath -Wl,}" \
+ "-Wl,-rpath" "-Wl,/this/is/a/long/path/to/make/host/tools/relocateable/with/chrpath/when/using/dev/packages"
+ )
+
+ export \
+ PTXDIST_HOST_CPPFLAGS="${cppflags[*]}" \
+ PTXDIST_HOST_LDFLAGS="${ldflags[*]}"
+
+ ######## PKG_CONFIG_LIBDIR, PKG_CONFIG_PATH ########
+
+ #
+ # PKG_CONFIG_LIBDIR contains the default pkg-config search
+ # directories.
+ #
+
+ # add <DIR>/lib/pkgconfig and <DIR>/share/pkgconfig
+ local -a pkg_libdir
+ pkg_libdir=( "${prefix[@]/%//${lib_dir}/pkgconfig}" "${prefix[@]/%//share/pkgconfig}" )
+
+ IFS=":"
+ PTXDIST_HOST_ENV_PKG_CONFIG="PKG_CONFIG_PATH='' PKG_CONFIG_LIBDIR='${pkg_libdir[*]}'"
+ export PTXDIST_HOST_ENV_PKG_CONFIG
+ IFS="${orig_IFS}"
+}
+
ptxd_init_devpkg()
{
local prefix
@@ -317,12 +391,14 @@ ptxd_make_init() {
fi &&
ptxd_init_ptxdist_path_sysroot &&
+ ptxd_init_ptxdist_path_sysroot_host &&
ptxd_init_devpkg &&
if [ -n "${PTXDIST_BASE_PLATFORMDIR}" ]; then
ptxd_init_collectionconfig
fi &&
- ptxd_init_cross_env
+ ptxd_init_cross_env &&
+ ptxd_init_host_env
}
ptxd_make_init