diff options
author | Carl Dong <contact@carldong.me> | 2021-03-23 12:59:59 -0400 |
---|---|---|
committer | Carl Dong <contact@carldong.me> | 2021-04-05 11:00:39 -0400 |
commit | 7476b46f1893a4858616d2a8456a7c43238851ed (patch) | |
tree | e6de72becabe6936d1ec4576b0acb67efae7ebed | |
parent | 06d6cf6784421290e6235fe8684d5e08ed6f1b62 (diff) | |
download | bitcoin-7476b46f1893a4858616d2a8456a7c43238851ed.tar.xz |
guix: Build dmg as a static binary
This relatively easy change eliminates all runtime dependencies (except
for the kernel) for dmg, which is the only native build tool that gets
put in our output tarballs.
This allows much more flexibility when constructing the codesigning
environment, and is much more robust.
-rw-r--r-- | contrib/guix/libexec/build.sh | 6 | ||||
-rw-r--r-- | contrib/guix/manifest.scm | 4 | ||||
-rw-r--r-- | depends/packages/native_libdmg-hfsplus.mk | 2 |
3 files changed, 8 insertions, 4 deletions
diff --git a/contrib/guix/libexec/build.sh b/contrib/guix/libexec/build.sh index 4a6b7792a9..4239c3d475 100644 --- a/contrib/guix/libexec/build.sh +++ b/contrib/guix/libexec/build.sh @@ -54,6 +54,7 @@ store_path() { # Set environment variables to point the NATIVE toolchain to the right # includes/libs NATIVE_GCC="$(store_path gcc-toolchain)" +NATIVE_GCC_STATIC="$(store_path gcc-toolchain static)" unset LIBRARY_PATH unset CPATH @@ -62,7 +63,7 @@ unset CPLUS_INCLUDE_PATH unset OBJC_INCLUDE_PATH unset OBJCPLUS_INCLUDE_PATH -export LIBRARY_PATH="${NATIVE_GCC}/lib:${NATIVE_GCC}/lib64" +export LIBRARY_PATH="${NATIVE_GCC}/lib:${NATIVE_GCC}/lib64:${NATIVE_GCC_STATIC}/lib:${NATIVE_GCC_STATIC}/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" @@ -76,8 +77,9 @@ case "$HOST" in *darwin*) # When targeting darwin, zlib is required by native_libdmg-hfsplus. zlib_store_path=$(store_path "zlib") + zlib_static_store_path=$(store_path "zlib" static) - prepend_to_search_env_var LIBRARY_PATH "${zlib_store_path}/lib" + prepend_to_search_env_var LIBRARY_PATH "${zlib_static_store_path}/lib:${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" diff --git a/contrib/guix/manifest.scm b/contrib/guix/manifest.scm index 3fc3f4d404..910a9dd6f6 100644 --- a/contrib/guix/manifest.scm +++ b/contrib/guix/manifest.scm @@ -214,6 +214,7 @@ chain for " target " development.")) gzip xz zlib + (list zlib "static") ;; Build tools gnu-make libtool @@ -227,7 +228,8 @@ chain for " target " development.")) ;; Git git ;; Native gcc 7 toolchain - gcc-toolchain-7) + gcc-toolchain-7 + (list gcc-toolchain-7 "static")) (let ((target (getenv "HOST"))) (cond ((string-suffix? "-mingw32" target) ;; Windows diff --git a/depends/packages/native_libdmg-hfsplus.mk b/depends/packages/native_libdmg-hfsplus.mk index f9d4b0797f..c7c8adef41 100644 --- a/depends/packages/native_libdmg-hfsplus.mk +++ b/depends/packages/native_libdmg-hfsplus.mk @@ -12,7 +12,7 @@ define $(package)_preprocess_cmds endef define $(package)_config_cmds - $($(package)_cmake) -DCMAKE_C_FLAGS="$$($(1)_cflags) -Wl,--build-id=none" -DCMAKE_SKIP_RPATH="ON" .. + $($(package)_cmake) -DCMAKE_C_FLAGS="$$($(1)_cflags) -Wl,--build-id=none" -DCMAKE_SKIP_RPATH="ON" -DCMAKE_EXE_LINKER_FLAGS="-static" -DCMAKE_FIND_LIBRARY_SUFFIXES=".a" .. endef define $(package)_build_cmds |