Skip to content

Commit 35121df

Browse files
hamishmackCopilot
andauthored
Fix TH code in checks for android cross compilation (#2414)
* Fix TH code in checks for android cross compilation * Update builder/comp-builder.nix Co-authored-by: Copilot <[email protected]> * Update lib/check.nix Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
1 parent f9cadec commit 35121df

File tree

3 files changed

+138
-7
lines changed

3 files changed

+138
-7
lines changed

builder/comp-builder.nix

Lines changed: 135 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
{ pkgs, stdenv, buildPackages, pkgsBuildBuild, ghc, llvmPackages, lib, gobject-introspection ? null, haskellLib, makeConfigFiles, haddockBuilder, ghcForComponent, hsPkgs, compiler, runCommand, libffi, gmp, windows, zlib, ncurses, nodejs, nonReinstallablePkgs }@defaults:
2-
lib.makeOverridable (
3-
let self =
42
{ componentId
53
, component
64
, package
@@ -92,7 +90,76 @@ let self =
9290
# LLVM
9391
, useLLVM ? ghc.useLLVM or false
9492
, smallAddressSpace ? false
95-
93+
}:
94+
# makeOverridable is called here after all the `? DEFAULT` arguments
95+
# will have been applied. This makes sure that `c.override (oldAttrs: {...})`
96+
# includes these `DEFAULT` values in `oldAttrs`. This is important
97+
# so that overrides can modify the existing values instead of replacing them.
98+
lib.makeOverridable (
99+
let self =
100+
{ componentId
101+
, component
102+
, package
103+
, name
104+
, setup
105+
, src
106+
, flags
107+
, cabalFile
108+
, cabal-generator
109+
, patches
110+
, preUnpack
111+
, configureFlags
112+
, prePatch
113+
, postPatch
114+
, preConfigure
115+
, postConfigure
116+
, setupBuildFlags
117+
, preBuild
118+
, postBuild
119+
, preCheck
120+
, postCheck
121+
, setupInstallFlags
122+
, preInstall
123+
, postInstall
124+
, preHaddock
125+
, postHaddock
126+
, shellHook
127+
, configureAllComponents
128+
, allComponent
129+
, build-tools
130+
, pkgconfig
131+
, platforms
132+
, frameworks
133+
, dontPatchELF
134+
, dontStrip
135+
, dontUpdateAutotoolsGnuConfigScripts
136+
, hardeningDisable
137+
, enableStatic
138+
, enableShared
139+
, enableExecutableDynamic
140+
, enableDeadCodeElimination
141+
, writeHieFiles
142+
, ghcOptions
143+
, contentAddressed
144+
, doHaddock
145+
, doHoogle
146+
, hyperlinkSource
147+
, quickjump
148+
, keepConfigFiles
149+
, keepGhc
150+
, keepSource
151+
, setupHaddockFlags
152+
, enableLibraryProfiling
153+
, enableProfiling
154+
, profilingDetail
155+
, doCoverage
156+
, enableSeparateDataOutput
157+
, enableLibraryForGhci
158+
, enableDebugRTS
159+
, enableDWARF
160+
, enableTSanRTS
161+
, useLLVM
162+
, smallAddressSpace
96163
}@drvArgs:
97164

98165
let
@@ -719,4 +786,68 @@ let
719786
// lib.optionalAttrs (hardeningDisable != [] || stdenv.hostPlatform.isMusl) {
720787
hardeningDisable = hardeningDisable ++ lib.optional stdenv.hostPlatform.isMusl "pie";
721788
});
722-
in drv; in self)
789+
in drv; in self) {
790+
inherit componentId
791+
component
792+
package
793+
name
794+
setup
795+
src
796+
flags
797+
cabalFile
798+
cabal-generator
799+
patches
800+
preUnpack
801+
configureFlags
802+
prePatch
803+
postPatch
804+
preConfigure
805+
postConfigure
806+
setupBuildFlags
807+
preBuild
808+
postBuild
809+
preCheck
810+
postCheck
811+
setupInstallFlags
812+
preInstall
813+
postInstall
814+
preHaddock
815+
postHaddock
816+
shellHook
817+
configureAllComponents
818+
allComponent
819+
build-tools
820+
pkgconfig
821+
platforms
822+
frameworks
823+
dontPatchELF
824+
dontStrip
825+
dontUpdateAutotoolsGnuConfigScripts
826+
hardeningDisable
827+
enableStatic
828+
enableShared
829+
enableExecutableDynamic
830+
enableDeadCodeElimination
831+
writeHieFiles
832+
ghcOptions
833+
contentAddressed
834+
doHaddock
835+
doHoogle
836+
hyperlinkSource
837+
quickjump
838+
keepConfigFiles
839+
keepGhc
840+
keepSource
841+
setupHaddockFlags
842+
enableLibraryProfiling
843+
enableProfiling
844+
profilingDetail
845+
doCoverage
846+
enableSeparateDataOutput
847+
enableLibraryForGhci
848+
enableDebugRTS
849+
enableDWARF
850+
enableTSanRTS
851+
useLLVM
852+
smallAddressSpace;
853+
}

lib/check.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ let self = drvOrig:
33

44
let
55
# Work around problem running dynamicially linked Android executables with qemu.
6-
drv = drvOrig.override (lib.optionalAttrs stdenv.hostPlatform.isAndroid { setupBuildFlags = ["--ghc-option=-optl-static" ]; });
6+
drv = drvOrig.override (oldAttrs: lib.optionalAttrs stdenv.hostPlatform.isAndroid { setupBuildFlags = (oldAttrs.setupBuildFlags or []) ++ ["--ghc-option=-optl-static"]; });
77

88
component = drv.config;
99

test/th-dlls/default.nix

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ in recurseIntoAttrs {
4343
};
4444

4545
build = packages.th-dlls.components.library;
46-
just-template-haskell = packages.th-dlls.components.exes.just-template-haskell;
46+
just-template-haskell = haskellLib.check packages.th-dlls.components.exes.just-template-haskell;
4747
build-ei = packages-ei.th-dlls.components.library;
48-
just-template-haskell-ei = packages-ei.th-dlls.components.exes.just-template-haskell;
48+
just-template-haskell-ei = haskellLib.check packages-ei.th-dlls.components.exes.just-template-haskell;
4949
} // optionalAttrs
5050
(!(builtins.elem compiler-nix-name ["ghc984" "ghc9122" "ghc9122llvm" "ghc91320250523"] && stdenv.buildPlatform.isx86_64 && stdenv.hostPlatform.isAarch64
5151
# The dependency on `math-functions` somehow breaks GHC 9.6.7 musl profiled builds (only with the external interpreter though)

0 commit comments

Comments
 (0)