Skip to content

Commit 8f2754f

Browse files
committed
Fix hadrian strip patch
1 parent b139433 commit 8f2754f

File tree

2 files changed

+58
-2
lines changed

2 files changed

+58
-2
lines changed

overlays/bootstrap.nix

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,9 @@ 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.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))
228+
++ onMusl (onAarch64 (fromUntil "9.4" "9.8" ./patches/ghc/ghc-9.6-hadrian-strip-cmd.patch))
229+
++ onMusl (onAarch64 (fromUntil "9.8" "9.10" ./patches/ghc/ghc-9.8-hadrian-strip-cmd.patch))
230+
++ onMusl (onAarch64 (fromUntil "9.10" "9.12" ./patches/ghc/ghc-9.10-hadrian-strip-cmd.patch))
230231
++ on32bit (fromUntil "9.0" "9.4" ./patches/ghc/ghc-9.6-32bit-cmm.patch)
231232
++ onAndroid (fromUntil "9.6.3" "9.10" ./patches/ghc/ghc-9.6-iog.patch)
232233
++ 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 e8e6076f9a..e748ca514d 100644
3+
--- a/hadrian/cfg/system.config.in
4+
+++ b/hadrian/cfg/system.config.in
5+
@@ -13,6 +13,7 @@ cc = @CC@
6+
happy = @HappyCmd@
7+
make = @MakeCmd@
8+
objdump = @ObjdumpCmd@
9+
+strip = @StripCmd@
10+
sphinx-build = @SPHINXBUILD@
11+
system-ghc = @WithGhc@
12+
system-ghc-pkg = @GhcPkgCmd@
13+
diff --git a/hadrian/src/Oracles/Setting.hs b/hadrian/src/Oracles/Setting.hs
14+
index b20b023173..881c122885 100644
15+
--- a/hadrian/src/Oracles/Setting.hs
16+
+++ b/hadrian/src/Oracles/Setting.hs
17+
@@ -69,6 +69,7 @@ data Setting = CursesIncludeDir
18+
| ProjectPatchLevel
19+
| ProjectPatchLevel1
20+
| ProjectPatchLevel2
21+
+ | Strip
22+
| SystemGhc
23+
| TargetPlatformFull
24+
| BourneShell
25+
@@ -125,6 +126,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+
TargetPlatformFull -> "target-platform-full"
32+
BourneShell -> "bourne-shell"
33+
diff --git a/hadrian/src/Settings/Builders/Cabal.hs b/hadrian/src/Settings/Builders/Cabal.hs
34+
index 3e83bb5634..241f8a51ef 100644
35+
--- a/hadrian/src/Settings/Builders/Cabal.hs
36+
+++ b/hadrian/src/Settings/Builders/Cabal.hs
37+
@@ -84,15 +84,11 @@ cabalSetupArgs = builder (Cabal Setup) ? do
38+
commonCabalArgs :: Stage -> Args
39+
commonCabalArgs stage = do
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)