Skip to content

Commit c544438

Browse files
committed
Merge pull request #1654 from mitchty/static-flag
Add static flag to the stack executable
2 parents e0fb702 + cda4c09 commit c544438

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

stack.cabal

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ flag disable-git-info
4141
-- should otherwise be avoided
4242
-- see: https://github.com/commercialhaskell/stack/issues/1425
4343

44+
flag static
45+
manual: True
46+
default: False
47+
description: Pass -static/-pthread to ghc when linking the stack binary.
48+
-- Not intended for general use. Simply makes it easier to
49+
-- build a fully static binary on Linux platforms that enable it.
50+
4451
library
4552
hs-source-dirs: src/
4653
ghc-options: -Wall -fwarn-tabs -fwarn-incomplete-uni-patterns -fwarn-incomplete-record-updates
@@ -218,6 +225,8 @@ executable stack
218225
main-is: Main.hs
219226
ghc-options: -threaded -rtsopts -Wall -fwarn-tabs -fwarn-incomplete-uni-patterns -fwarn-incomplete-record-updates
220227
other-modules: Paths_stack
228+
if flag(static)
229+
ld-options: -static -pthread
221230

222231
build-depends: base >=4.7 && < 5
223232
, bytestring >= 0.10.4.0

0 commit comments

Comments
 (0)