Skip to content

Commit 7476b46

Browse files
committed
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.
1 parent 06d6cf6 commit 7476b46

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

contrib/guix/libexec/build.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ store_path() {
5454
# Set environment variables to point the NATIVE toolchain to the right
5555
# includes/libs
5656
NATIVE_GCC="$(store_path gcc-toolchain)"
57+
NATIVE_GCC_STATIC="$(store_path gcc-toolchain static)"
5758

5859
unset LIBRARY_PATH
5960
unset CPATH
@@ -62,7 +63,7 @@ unset CPLUS_INCLUDE_PATH
6263
unset OBJC_INCLUDE_PATH
6364
unset OBJCPLUS_INCLUDE_PATH
6465

65-
export LIBRARY_PATH="${NATIVE_GCC}/lib:${NATIVE_GCC}/lib64"
66+
export LIBRARY_PATH="${NATIVE_GCC}/lib:${NATIVE_GCC}/lib64:${NATIVE_GCC_STATIC}/lib:${NATIVE_GCC_STATIC}/lib64"
6667
export C_INCLUDE_PATH="${NATIVE_GCC}/include"
6768
export CPLUS_INCLUDE_PATH="${NATIVE_GCC}/include/c++:${NATIVE_GCC}/include"
6869
export OBJC_INCLUDE_PATH="${NATIVE_GCC}/include"
@@ -76,8 +77,9 @@ case "$HOST" in
7677
*darwin*)
7778
# When targeting darwin, zlib is required by native_libdmg-hfsplus.
7879
zlib_store_path=$(store_path "zlib")
80+
zlib_static_store_path=$(store_path "zlib" static)
7981

80-
prepend_to_search_env_var LIBRARY_PATH "${zlib_store_path}/lib"
82+
prepend_to_search_env_var LIBRARY_PATH "${zlib_static_store_path}/lib:${zlib_store_path}/lib"
8183
prepend_to_search_env_var C_INCLUDE_PATH "${zlib_store_path}/include"
8284
prepend_to_search_env_var CPLUS_INCLUDE_PATH "${zlib_store_path}/include"
8385
prepend_to_search_env_var OBJC_INCLUDE_PATH "${zlib_store_path}/include"

contrib/guix/manifest.scm

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ chain for " target " development."))
214214
gzip
215215
xz
216216
zlib
217+
(list zlib "static")
217218
;; Build tools
218219
gnu-make
219220
libtool
@@ -227,7 +228,8 @@ chain for " target " development."))
227228
;; Git
228229
git
229230
;; Native gcc 7 toolchain
230-
gcc-toolchain-7)
231+
gcc-toolchain-7
232+
(list gcc-toolchain-7 "static"))
231233
(let ((target (getenv "HOST")))
232234
(cond ((string-suffix? "-mingw32" target)
233235
;; Windows

depends/packages/native_libdmg-hfsplus.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ define $(package)_preprocess_cmds
1212
endef
1313

1414
define $(package)_config_cmds
15-
$($(package)_cmake) -DCMAKE_C_FLAGS="$$($(1)_cflags) -Wl,--build-id=none" -DCMAKE_SKIP_RPATH="ON" ..
15+
$($(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" ..
1616
endef
1717

1818
define $(package)_build_cmds

0 commit comments

Comments
 (0)