aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2023-01-29 18:50:10 +0100
committerLars-Dominik Braun <lars@6xq.net>2023-02-26 10:26:16 +0100
commitdc3e22f4d5d7aa94fef9e380a3d2c0d71143ced9 (patch)
tree64b26ec3deffac60657d85f79d9823caf99c29c3
parent8a4ee0c113d33be376afd701d6cd1b94821f2cd2 (diff)
downloadguix-dc3e22f4d5d7aa94fef9e380a3d2c0d71143ced9.tar
guix-dc3e22f4d5d7aa94fef9e380a3d2c0d71143ced9.tar.gz
build: haskell-build-system: Build static executables by default.
This is the only way to get reasonably small binaries that don’t pull in a ton of ghc-* packages. * guix/build/haskell-build-system.scm (configure): Explicitly add --enable-static and --disable-executable-dynamic, as well as -split-sections to configure flags.
-rw-r--r--guix/build/haskell-build-system.scm8
1 files changed, 6 insertions, 2 deletions
diff --git a/guix/build/haskell-build-system.scm b/guix/build/haskell-build-system.scm
index d77f55da19..0e94cf59a5 100644
--- a/guix/build/haskell-build-system.scm
+++ b/guix/build/haskell-build-system.scm
@@ -99,10 +99,14 @@ and parameters ~s~%"
,@(if tests?
'("--enable-tests")
'())
- ;; Build and link with shared libraries
+ ;; Build static and shared libraries.
"--enable-shared"
- "--enable-executable-dynamic"
+ "--enable-static"
+ ;; Link executables statically by default.
+ "--disable-executable-dynamic"
"--ghc-option=-fPIC"
+ ;; Ensure static libraries can be used with -Wl,--gc-sections for size.
+ "--ghc-option=-split-sections"
,@configure-flags)))
;; Cabal errors if GHC_PACKAGE_PATH is set during 'configure', so unset
;; and restore it.