Merge pull request #92168 from WebGHC/upstream-wasm-cross-nixpkgs-4
GHC / Haskell packages, wasm cross compilation support
This commit is contained in:
commit
d4d9ad66a0
@ -55,7 +55,7 @@ let
|
||||
(targetPlatform != hostPlatform)
|
||||
"${targetPlatform.config}-";
|
||||
|
||||
buildMK = ''
|
||||
buildMK = dontStrip: ''
|
||||
BuildFlavour = ${ghcFlavour}
|
||||
ifneq \"\$(BuildFlavour)\" \"\"
|
||||
include mk/flavours/\$(BuildFlavour).mk
|
||||
@ -68,6 +68,8 @@ let
|
||||
HADDOCK_DOCS = NO
|
||||
BUILD_SPHINX_HTML = NO
|
||||
BUILD_SPHINX_PDF = NO
|
||||
'' + stdenv.lib.optionalString dontStrip ''
|
||||
STRIP_CMD = :
|
||||
'' + stdenv.lib.optionalString (!enableProfiledLibs) ''
|
||||
GhcLibWays = "v dyn"
|
||||
'' + stdenv.lib.optionalString enableRelocatedStaticLibs ''
|
||||
@ -127,7 +129,7 @@ stdenv.mkDerivation (rec {
|
||||
export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf"
|
||||
export STRIP="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}strip"
|
||||
|
||||
echo -n "${buildMK}" > mk/build.mk
|
||||
echo -n "${buildMK dontStrip}" > mk/build.mk
|
||||
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
||||
'' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
|
||||
export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}"
|
||||
@ -240,8 +242,9 @@ stdenv.mkDerivation (rec {
|
||||
inherit (ghc.meta) license platforms;
|
||||
};
|
||||
|
||||
dontStrip = (targetPlatform.useAndroidPrebuilt || targetPlatform.isWasm);
|
||||
|
||||
} // stdenv.lib.optionalAttrs targetPlatform.useAndroidPrebuilt{
|
||||
dontStrip = true;
|
||||
dontPatchELF = true;
|
||||
noAuditTmpdir = true;
|
||||
})
|
||||
|
@ -52,7 +52,7 @@ let
|
||||
(targetPlatform != hostPlatform)
|
||||
"${targetPlatform.config}-";
|
||||
|
||||
buildMK = ''
|
||||
buildMK = dontStrip: ''
|
||||
BuildFlavour = ${ghcFlavour}
|
||||
ifneq \"\$(BuildFlavour)\" \"\"
|
||||
include mk/flavours/\$(BuildFlavour).mk
|
||||
@ -65,6 +65,8 @@ let
|
||||
HADDOCK_DOCS = NO
|
||||
BUILD_SPHINX_HTML = NO
|
||||
BUILD_SPHINX_PDF = NO
|
||||
'' + stdenv.lib.optionalString dontStrip ''
|
||||
STRIP_CMD = :
|
||||
'' + stdenv.lib.optionalString enableRelocatedStaticLibs ''
|
||||
GhcLibHcOpts += -fPIC
|
||||
GhcRtsHcOpts += -fPIC
|
||||
@ -122,7 +124,7 @@ stdenv.mkDerivation (rec {
|
||||
export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf"
|
||||
export STRIP="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}strip"
|
||||
|
||||
echo -n "${buildMK}" > mk/build.mk
|
||||
echo -n "${buildMK dontStrip}" > mk/build.mk
|
||||
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
||||
'' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
|
||||
export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}"
|
||||
@ -235,8 +237,9 @@ stdenv.mkDerivation (rec {
|
||||
inherit (ghc.meta) license platforms;
|
||||
};
|
||||
|
||||
dontStrip = (targetPlatform.useAndroidPrebuilt || targetPlatform.isWasm);
|
||||
|
||||
} // stdenv.lib.optionalAttrs targetPlatform.useAndroidPrebuilt{
|
||||
dontStrip = true;
|
||||
dontPatchELF = true;
|
||||
noAuditTmpdir = true;
|
||||
})
|
||||
|
@ -55,7 +55,7 @@ let
|
||||
(targetPlatform != hostPlatform)
|
||||
"${targetPlatform.config}-";
|
||||
|
||||
buildMK = ''
|
||||
buildMK = dontStrip: ''
|
||||
BuildFlavour = ${ghcFlavour}
|
||||
ifneq \"\$(BuildFlavour)\" \"\"
|
||||
include mk/flavours/\$(BuildFlavour).mk
|
||||
@ -68,6 +68,8 @@ let
|
||||
HADDOCK_DOCS = NO
|
||||
BUILD_SPHINX_HTML = NO
|
||||
BUILD_SPHINX_PDF = NO
|
||||
'' + stdenv.lib.optionalString dontStrip ''
|
||||
STRIP_CMD = :
|
||||
'' + stdenv.lib.optionalString (!enableProfiledLibs) ''
|
||||
GhcLibWays = "v dyn"
|
||||
'' + stdenv.lib.optionalString enableRelocatedStaticLibs ''
|
||||
@ -127,7 +129,7 @@ stdenv.mkDerivation (rec {
|
||||
export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf"
|
||||
export STRIP="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}strip"
|
||||
|
||||
echo -n "${buildMK}" > mk/build.mk
|
||||
echo -n "${buildMK dontStrip}" > mk/build.mk
|
||||
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
||||
'' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
|
||||
export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}"
|
||||
@ -240,8 +242,9 @@ stdenv.mkDerivation (rec {
|
||||
inherit (ghc.meta) license platforms;
|
||||
};
|
||||
|
||||
dontStrip = (targetPlatform.useAndroidPrebuilt || targetPlatform.isWasm);
|
||||
|
||||
} // stdenv.lib.optionalAttrs targetPlatform.useAndroidPrebuilt{
|
||||
dontStrip = true;
|
||||
dontPatchELF = true;
|
||||
noAuditTmpdir = true;
|
||||
})
|
||||
|
@ -55,7 +55,7 @@ let
|
||||
(targetPlatform != hostPlatform)
|
||||
"${targetPlatform.config}-";
|
||||
|
||||
buildMK = ''
|
||||
buildMK = dontStrip: ''
|
||||
BuildFlavour = ${ghcFlavour}
|
||||
ifneq \"\$(BuildFlavour)\" \"\"
|
||||
include mk/flavours/\$(BuildFlavour).mk
|
||||
@ -68,6 +68,8 @@ let
|
||||
HADDOCK_DOCS = NO
|
||||
BUILD_SPHINX_HTML = NO
|
||||
BUILD_SPHINX_PDF = NO
|
||||
'' + stdenv.lib.optionalString dontStrip ''
|
||||
STRIP_CMD = :
|
||||
'' + stdenv.lib.optionalString (!enableProfiledLibs) ''
|
||||
GhcLibWays = "v dyn"
|
||||
'' + stdenv.lib.optionalString enableRelocatedStaticLibs ''
|
||||
@ -127,7 +129,7 @@ stdenv.mkDerivation (rec {
|
||||
export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf"
|
||||
export STRIP="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}strip"
|
||||
|
||||
echo -n "${buildMK}" > mk/build.mk
|
||||
echo -n "${buildMK dontStrip}" > mk/build.mk
|
||||
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
|
||||
'' + stdenv.lib.optionalString (!stdenv.isDarwin) ''
|
||||
export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}"
|
||||
@ -240,8 +242,9 @@ stdenv.mkDerivation (rec {
|
||||
inherit (ghc.meta) license platforms;
|
||||
};
|
||||
|
||||
dontStrip = (targetPlatform.useAndroidPrebuilt || targetPlatform.isWasm);
|
||||
|
||||
} // stdenv.lib.optionalAttrs targetPlatform.useAndroidPrebuilt{
|
||||
dontStrip = true;
|
||||
dontPatchELF = true;
|
||||
noAuditTmpdir = true;
|
||||
})
|
||||
|
@ -61,7 +61,7 @@ let
|
||||
(targetPlatform != hostPlatform)
|
||||
"${targetPlatform.config}-";
|
||||
|
||||
buildMK = ''
|
||||
buildMK = dontStrip: ''
|
||||
BuildFlavour = ${ghcFlavour}
|
||||
ifneq \"\$(BuildFlavour)\" \"\"
|
||||
include mk/flavours/\$(BuildFlavour).mk
|
||||
@ -74,6 +74,8 @@ let
|
||||
HADDOCK_DOCS = NO
|
||||
BUILD_SPHINX_HTML = NO
|
||||
BUILD_SPHINX_PDF = NO
|
||||
'' + stdenv.lib.optionalString dontStrip ''
|
||||
STRIP_CMD = :
|
||||
'' + stdenv.lib.optionalString (!enableProfiledLibs) ''
|
||||
GhcLibWays = "v dyn"
|
||||
'' + stdenv.lib.optionalString enableRelocatedStaticLibs ''
|
||||
@ -137,7 +139,7 @@ stdenv.mkDerivation (rec {
|
||||
export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf"
|
||||
export STRIP="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}strip"
|
||||
|
||||
echo -n "${buildMK}" > mk/build.mk
|
||||
echo -n "${buildMK dontStrip}" > mk/build.mk
|
||||
echo ${version} > VERSION
|
||||
echo ${src.rev} > GIT_COMMIT_ID
|
||||
./boot
|
||||
@ -256,8 +258,9 @@ stdenv.mkDerivation (rec {
|
||||
inherit (ghc.meta) license platforms;
|
||||
};
|
||||
|
||||
dontStrip = (targetPlatform.useAndroidPrebuilt || targetPlatform.isWasm);
|
||||
|
||||
} // stdenv.lib.optionalAttrs targetPlatform.useAndroidPrebuilt{
|
||||
dontStrip = true;
|
||||
dontPatchELF = true;
|
||||
noAuditTmpdir = true;
|
||||
})
|
||||
|
@ -35,7 +35,7 @@ in
|
||||
, enableSharedExecutables ? false
|
||||
, enableSharedLibraries ? (ghc.enableShared or false)
|
||||
, enableDeadCodeElimination ? (!stdenv.isDarwin) # TODO: use -dead_strip for darwin
|
||||
, enableStaticLibraries ? !stdenv.hostPlatform.isWindows
|
||||
, enableStaticLibraries ? !(stdenv.hostPlatform.isWindows or stdenv.hostPlatform.isWasm)
|
||||
, enableHsc2hsViaAsm ? stdenv.hostPlatform.isWindows && stdenv.lib.versionAtLeast ghc.version "8.4"
|
||||
, extraLibraries ? [], librarySystemDepends ? [], executableSystemDepends ? []
|
||||
# On macOS, statically linking against system frameworks is not supported;
|
||||
@ -90,6 +90,7 @@ assert editedCabalFile != null -> revision != null;
|
||||
# --enable-static does not work on windows. This is a bug in GHC.
|
||||
# --enable-static will pass -staticlib to ghc, which only works for mach-o and elf.
|
||||
assert stdenv.hostPlatform.isWindows -> enableStaticLibraries == false;
|
||||
assert stdenv.hostPlatform.isWasm -> enableStaticLibraries == false;
|
||||
|
||||
let
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user