Skip to content

Commit 821ad3b

Browse files
committed
Add preBuild to set CFLAGS
1 parent f1309bb commit 821ad3b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

compiler/ghc/default.nix

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ stdenv.mkDerivation (rec {
781781
dontStrip = true;
782782
dontPatchELF = true;
783783
noAuditTmpdir = true;
784-
} // lib.optionalAttrs (stdenv.buildPlatform.isDarwin || stdenv.targetPlatform.isWindows) {
784+
} // {
785785
# ghc install on macOS wants to run `xattr -r -c`
786786
# The macOS version fails because it wants python 2.
787787
# The nix version of xattr does not support those args.
@@ -805,6 +805,11 @@ stdenv.mkDerivation (rec {
805805
if [[ -f rts/win32/ThrIOManager.c ]]; then
806806
substituteInPlace rts/win32/ThrIOManager.c --replace rts\\OSThreads.h rts/OSThreads.h
807807
fi
808+
''
809+
+ lib.optionalString (targetPlatform.isAndroid && targetPlatform.isAarch32) ''
810+
export NIX_CFLAGS_COMPILE_${
811+
lib.replaceStrings ["-" "."] ["_" "_"] stdenv.targetPlatform.config
812+
}+=" -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16"
808813
'';
809814
# Same hack as 'preBuild'
810815
preInstall = lib.optionalString stdenv.buildPlatform.isDarwin ''
@@ -827,6 +832,7 @@ stdenv.mkDerivation (rec {
827832
'cross-compiling = NO'
828833
'';
829834
buildPhase = ''
835+
runHook preBuild
830836
${hadrian}/bin/hadrian ${hadrianArgs}
831837
'' + lib.optionalString (installStage1 && !stdenv.targetPlatform.isGhcjs && builtins.compareVersions ghc-version "9.8" < 0) ''
832838
${hadrian}/bin/hadrian ${hadrianArgs} stage1:lib:libiserv
@@ -841,6 +847,8 @@ stdenv.mkDerivation (rec {
841847
mv $exe ${targetPrefix}$exe
842848
done
843849
popd
850+
'' + ''
851+
runHook postBuild
844852
'';
845853

846854
# Hadrian's installation only works for native compilers, and is broken for cross compilers.

0 commit comments

Comments
 (0)