aboutsummaryrefslogtreecommitdiff
path: root/contrib/guix
diff options
context:
space:
mode:
authorCarl Dong <contact@carldong.me>2021-03-17 13:07:40 -0400
committerCarl Dong <contact@carldong.me>2021-04-05 11:00:39 -0400
commitc1ae726a13ecfa5e7e9fdc3030a8110b8bb263f8 (patch)
tree6c8606544b5f1122082c819317ce0a3f0bbc7146 /contrib/guix
parent39741128d3775d198dbee34dc827353bfd18acd8 (diff)
guix: More thoroughly control native toolchain
Diffstat (limited to 'contrib/guix')
-rw-r--r--contrib/guix/libexec/build.sh26
1 files changed, 22 insertions, 4 deletions
diff --git a/contrib/guix/libexec/build.sh b/contrib/guix/libexec/build.sh
index bb83516f89..7d4609c17a 100644
--- a/contrib/guix/libexec/build.sh
+++ b/contrib/guix/libexec/build.sh
@@ -54,16 +54,34 @@ store_path() {
# Set environment variables to point the NATIVE toolchain to the right
# includes/libs
NATIVE_GCC="$(store_path gcc-toolchain)"
-export LIBRARY_PATH="${NATIVE_GCC}/lib:${NATIVE_GCC}/lib64"
-export CPATH="${NATIVE_GCC}/include"
+
+unset LIBRARY_PATH
+unset CPATH
unset C_INCLUDE_PATH
unset CPLUS_INCLUDE_PATH
+unset OBJC_INCLUDE_PATH
+unset OBJCPLUS_INCLUDE_PATH
+
+export LIBRARY_PATH="${NATIVE_GCC}/lib:${NATIVE_GCC}/lib64"
+export C_INCLUDE_PATH="${NATIVE_GCC}/include"
+export CPLUS_INCLUDE_PATH="${NATIVE_GCC}/include/c++:${NATIVE_GCC}/include"
+export OBJC_INCLUDE_PATH="${NATIVE_GCC}/include"
+export OBJCPLUS_INCLUDE_PATH="${NATIVE_GCC}/include/c++:${NATIVE_GCC}/include"
+
+prepend_to_search_env_var() {
+ export "${1}=${2}${!1:+:}${!1}"
+}
+
case "$HOST" in
*darwin*)
# When targeting darwin, zlib is required by native_libdmg-hfsplus.
zlib_store_path=$(store_path "zlib")
- export LIBRARY_PATH="${zlib_store_path}/lib:${LIBRARY_PATH}"
- export CPATH="${zlib_store_path}/include:${CPATH}"
+
+ prepend_to_search_env_var LIBRARY_PATH "${zlib_store_path}/lib"
+ prepend_to_search_env_var C_INCLUDE_PATH "${zlib_store_path}/include"
+ prepend_to_search_env_var CPLUS_INCLUDE_PATH "${zlib_store_path}/include"
+ prepend_to_search_env_var OBJC_INCLUDE_PATH "${zlib_store_path}/include"
+ prepend_to_search_env_var OBJCPLUS_INCLUDE_PATH "${zlib_store_path}/include"
esac
# Set environment variables to point the CROSS toolchain to the right