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.
This commit is contained in:
Lars-Dominik Braun 2023-01-29 18:50:10 +01:00
parent 8a4ee0c113
commit dc3e22f4d5
No known key found for this signature in database
GPG Key ID: F663943E08D8092A
1 changed files with 6 additions and 2 deletions

View File

@ -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.