Skip to content

Commit b139433

Browse files
committed
Fix hadrian strip patch
1 parent 6c31610 commit b139433

File tree

2 files changed

+57
-1
lines changed

2 files changed

+57
-1
lines changed

overlays/bootstrap.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,8 @@ in {
225225
++ onAndroid (onAarch32 (until "9.2" ./patches/ghc/ghc-8.10.7-bionic-libc.patch))
226226
++ onAndroid (onAarch32 (until "9.2" ./patches/ghc/ghc-8.10.7-cross-dont-build-stage2-tools.patch))
227227
++ onAndroid (fromUntil "9.0" "9.8"./patches/ghc/ghc-9.6-hadrian-android.patch)
228-
++ onMusl (onAarch64 (fromUntil "9.0" "9.8" ./patches/ghc/ghc-9.6-hadrian-strip-cmd.patch))
228+
++ onMusl (onAarch64 (fromUntil "9.4" "9.8" ./patches/ghc/ghc-9.6-hadrian-strip-cmd.patch))
229+
++ onMusl (onAarch64 (fromUntil "9.8" "9.12" ./patches/ghc/ghc-9.8-hadrian-strip-cmd.patch))
229230
++ on32bit (fromUntil "9.0" "9.4" ./patches/ghc/ghc-9.6-32bit-cmm.patch)
230231
++ onAndroid (fromUntil "9.6.3" "9.10" ./patches/ghc/ghc-9.6-iog.patch)
231232
++ onAndroid (fromUntil "9.6" "9.9" ./patches/ghc/ghc-9.6-debug-secno.patch)
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
diff --git a/hadrian/cfg/system.config.in b/hadrian/cfg/system.config.in
2+
index 4912673869..85b5c58c2a 100644
3+
--- a/hadrian/cfg/system.config.in
4+
+++ b/hadrian/cfg/system.config.in
5+
@@ -18,6 +18,7 @@ merge-objects = @MergeObjsCmd@
6+
system-merge-objects = @LD_STAGE0@
7+
objdump = @ObjdumpCmd@
8+
ranlib = @REAL_RANLIB_CMD@
9+
+strip = @StripCmd@
10+
sphinx-build = @SPHINXBUILD@
11+
system-ar = @AR_STAGE0@
12+
system-cc = @CC_STAGE0@
13+
diff --git a/hadrian/src/Oracles/Setting.hs b/hadrian/src/Oracles/Setting.hs
14+
index a0f639d325..55f9a2f902 100644
15+
--- a/hadrian/src/Oracles/Setting.hs
16+
+++ b/hadrian/src/Oracles/Setting.hs
17+
@@ -73,6 +73,7 @@ data Setting = BuildArch
18+
| ProjectPatchLevel
19+
| ProjectPatchLevel1
20+
| ProjectPatchLevel2
21+
+ | Strip
22+
| SystemGhc
23+
| TargetArch
24+
| TargetOs
25+
@@ -176,6 +177,7 @@ setting key = lookupSystemConfig $ case key of
26+
ProjectPatchLevel -> "project-patch-level"
27+
ProjectPatchLevel1 -> "project-patch-level1"
28+
ProjectPatchLevel2 -> "project-patch-level2"
29+
+ Strip -> "strip"
30+
SystemGhc -> "system-ghc"
31+
TargetArch -> "target-arch"
32+
TargetArmVersion -> "target-arm-version"
33+
diff --git a/hadrian/src/Settings/Builders/Cabal.hs b/hadrian/src/Settings/Builders/Cabal.hs
34+
index 75eb78ccd8..6904c973d4 100644
35+
--- a/hadrian/src/Settings/Builders/Cabal.hs
36+
+++ b/hadrian/src/Settings/Builders/Cabal.hs
37+
@@ -85,15 +85,11 @@ commonCabalArgs :: Stage -> Args
38+
commonCabalArgs stage = do
39+
verbosity <- expr getVerbosity
40+
pkg <- getPackage
41+
+ strip <- getSetting Strip
42+
package_id <- expr $ pkgUnitId stage pkg
43+
let prefix = "${pkgroot}" ++ (if windowsHost then "" else "/..")
44+
- mconcat [ -- Don't strip libraries when cross compiling.
45+
- -- TODO: We need to set @--with-strip=(stripCmdPath :: Action FilePath)@,
46+
- -- and if it's @:@ disable stripping as well. As it is now, I believe
47+
- -- we might have issues with stripping on Windows, as I can't see a
48+
- -- consumer of 'stripCmdPath'.
49+
- -- TODO: See https://github.com/snowleopard/hadrian/issues/549.
50+
- flag CrossCompiling ? pure [ "--disable-executable-stripping"
51+
+ mconcat [ notStage0 ? strip /= "" ? pure [ "--with-strip=" ++ strip ]
52+
+ , flag CrossCompiling ? pure [ "--disable-executable-stripping"
53+
, "--disable-library-stripping" ]
54+
-- We don't want to strip the debug RTS
55+
, S.package rts ? pure [ "--disable-executable-stripping"

0 commit comments

Comments
 (0)