From a9ac31c299743960d4670e0e28d07777a6e87230 Mon Sep 17 00:00:00 2001 From: Divam Date: Wed, 5 Aug 2020 14:51:06 +0900 Subject: [PATCH 1/3] Set the STRIP_CMD to ':' for dontStrip (as mentioned in mk/build.mk.sample) --- pkgs/development/compilers/ghc/8.10.1.nix | 8 ++++++-- pkgs/development/compilers/ghc/8.8.2.nix | 8 ++++++-- pkgs/development/compilers/ghc/8.8.3.nix | 8 ++++++-- pkgs/development/compilers/ghc/8.8.4.nix | 8 ++++++-- pkgs/development/compilers/ghc/head.nix | 8 ++++++-- 5 files changed, 30 insertions(+), 10 deletions(-) diff --git a/pkgs/development/compilers/ghc/8.10.1.nix b/pkgs/development/compilers/ghc/8.10.1.nix index 9da80fa5c20..77fac7e1a4e 100644 --- a/pkgs/development/compilers/ghc/8.10.1.nix +++ b/pkgs/development/compilers/ghc/8.10.1.nix @@ -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 (!enableProfiliedLibs) '' 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}" @@ -211,6 +213,8 @@ stdenv.mkDerivation (rec { hardeningDisable = [ "format" ] ++ stdenv.lib.optional stdenv.targetPlatform.isMusl "pie"; + dontStrip = false; + postInstall = '' # Install the bash completion file. install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc diff --git a/pkgs/development/compilers/ghc/8.8.2.nix b/pkgs/development/compilers/ghc/8.8.2.nix index 305226b3407..7470290a6bd 100644 --- a/pkgs/development/compilers/ghc/8.8.2.nix +++ b/pkgs/development/compilers/ghc/8.8.2.nix @@ -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}" @@ -206,6 +208,8 @@ stdenv.mkDerivation (rec { hardeningDisable = [ "format" ] ++ stdenv.lib.optional stdenv.targetPlatform.isMusl "pie"; + dontStrip = false; + postInstall = '' # Install the bash completion file. install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc diff --git a/pkgs/development/compilers/ghc/8.8.3.nix b/pkgs/development/compilers/ghc/8.8.3.nix index c22327efce3..fcfaba330be 100644 --- a/pkgs/development/compilers/ghc/8.8.3.nix +++ b/pkgs/development/compilers/ghc/8.8.3.nix @@ -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 (!enableProfiliedLibs) '' 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}" @@ -211,6 +213,8 @@ stdenv.mkDerivation (rec { hardeningDisable = [ "format" ] ++ stdenv.lib.optional stdenv.targetPlatform.isMusl "pie"; + dontStrip = false; + postInstall = '' # Install the bash completion file. install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc diff --git a/pkgs/development/compilers/ghc/8.8.4.nix b/pkgs/development/compilers/ghc/8.8.4.nix index 515ff2d646b..71c4cab3204 100644 --- a/pkgs/development/compilers/ghc/8.8.4.nix +++ b/pkgs/development/compilers/ghc/8.8.4.nix @@ -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 (!enableProfiliedLibs) '' 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}" @@ -211,6 +213,8 @@ stdenv.mkDerivation (rec { hardeningDisable = [ "format" ] ++ stdenv.lib.optional stdenv.targetPlatform.isMusl "pie"; + dontStrip = false; + postInstall = '' # Install the bash completion file. install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc diff --git a/pkgs/development/compilers/ghc/head.nix b/pkgs/development/compilers/ghc/head.nix index a15ef7f7dbf..0fca12d087c 100644 --- a/pkgs/development/compilers/ghc/head.nix +++ b/pkgs/development/compilers/ghc/head.nix @@ -58,7 +58,7 @@ let (targetPlatform != hostPlatform) "${targetPlatform.config}-"; - buildMK = '' + buildMK = dontStrip: '' BuildFlavour = ${ghcFlavour} ifneq \"\$(BuildFlavour)\" \"\" include mk/flavours/\$(BuildFlavour).mk @@ -71,6 +71,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 @@ -132,7 +134,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 @@ -222,6 +224,8 @@ stdenv.mkDerivation (rec { hardeningDisable = [ "format" ] ++ stdenv.lib.optional stdenv.targetPlatform.isMusl "pie"; + dontStrip = false; + postInstall = '' # Install the bash completion file. install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc From 95a5a19658e30b77cd140ebe0c5fbb100f603b3e Mon Sep 17 00:00:00 2001 From: Divam Date: Wed, 5 Aug 2020 20:17:14 +0900 Subject: [PATCH 2/3] Enable dontStrip for wasm --- pkgs/development/compilers/ghc/8.10.1.nix | 7 +++---- pkgs/development/compilers/ghc/8.8.2.nix | 7 +++---- pkgs/development/compilers/ghc/8.8.3.nix | 7 +++---- pkgs/development/compilers/ghc/8.8.4.nix | 7 +++---- pkgs/development/compilers/ghc/head.nix | 7 +++---- 5 files changed, 15 insertions(+), 20 deletions(-) diff --git a/pkgs/development/compilers/ghc/8.10.1.nix b/pkgs/development/compilers/ghc/8.10.1.nix index 77fac7e1a4e..e175b6cdf0c 100644 --- a/pkgs/development/compilers/ghc/8.10.1.nix +++ b/pkgs/development/compilers/ghc/8.10.1.nix @@ -213,8 +213,6 @@ stdenv.mkDerivation (rec { hardeningDisable = [ "format" ] ++ stdenv.lib.optional stdenv.targetPlatform.isMusl "pie"; - dontStrip = false; - postInstall = '' # Install the bash completion file. install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc @@ -244,8 +242,9 @@ stdenv.mkDerivation (rec { inherit (ghc.meta) license platforms; }; -} // stdenv.lib.optionalAttrs targetPlatform.useAndroidPrebuilt { - dontStrip = true; + dontStrip = (targetPlatform.useAndroidPrebuilt || targetPlatform.isWasm); + +} // stdenv.lib.optionalAttrs targetPlatform.useAndroidPrebuilt{ dontPatchELF = true; noAuditTmpdir = true; }) diff --git a/pkgs/development/compilers/ghc/8.8.2.nix b/pkgs/development/compilers/ghc/8.8.2.nix index 7470290a6bd..6f515d52bbc 100644 --- a/pkgs/development/compilers/ghc/8.8.2.nix +++ b/pkgs/development/compilers/ghc/8.8.2.nix @@ -208,8 +208,6 @@ stdenv.mkDerivation (rec { hardeningDisable = [ "format" ] ++ stdenv.lib.optional stdenv.targetPlatform.isMusl "pie"; - dontStrip = false; - postInstall = '' # Install the bash completion file. install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc @@ -239,8 +237,9 @@ stdenv.mkDerivation (rec { inherit (ghc.meta) license platforms; }; -} // stdenv.lib.optionalAttrs targetPlatform.useAndroidPrebuilt { - dontStrip = true; + dontStrip = (targetPlatform.useAndroidPrebuilt || targetPlatform.isWasm); + +} // stdenv.lib.optionalAttrs targetPlatform.useAndroidPrebuilt{ dontPatchELF = true; noAuditTmpdir = true; }) diff --git a/pkgs/development/compilers/ghc/8.8.3.nix b/pkgs/development/compilers/ghc/8.8.3.nix index fcfaba330be..ff2a50544e3 100644 --- a/pkgs/development/compilers/ghc/8.8.3.nix +++ b/pkgs/development/compilers/ghc/8.8.3.nix @@ -213,8 +213,6 @@ stdenv.mkDerivation (rec { hardeningDisable = [ "format" ] ++ stdenv.lib.optional stdenv.targetPlatform.isMusl "pie"; - dontStrip = false; - postInstall = '' # Install the bash completion file. install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc @@ -244,8 +242,9 @@ stdenv.mkDerivation (rec { inherit (ghc.meta) license platforms; }; -} // stdenv.lib.optionalAttrs targetPlatform.useAndroidPrebuilt { - dontStrip = true; + dontStrip = (targetPlatform.useAndroidPrebuilt || targetPlatform.isWasm); + +} // stdenv.lib.optionalAttrs targetPlatform.useAndroidPrebuilt{ dontPatchELF = true; noAuditTmpdir = true; }) diff --git a/pkgs/development/compilers/ghc/8.8.4.nix b/pkgs/development/compilers/ghc/8.8.4.nix index 71c4cab3204..c55a10f9961 100644 --- a/pkgs/development/compilers/ghc/8.8.4.nix +++ b/pkgs/development/compilers/ghc/8.8.4.nix @@ -213,8 +213,6 @@ stdenv.mkDerivation (rec { hardeningDisable = [ "format" ] ++ stdenv.lib.optional stdenv.targetPlatform.isMusl "pie"; - dontStrip = false; - postInstall = '' # Install the bash completion file. install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc @@ -244,8 +242,9 @@ stdenv.mkDerivation (rec { inherit (ghc.meta) license platforms; }; -} // stdenv.lib.optionalAttrs targetPlatform.useAndroidPrebuilt { - dontStrip = true; + dontStrip = (targetPlatform.useAndroidPrebuilt || targetPlatform.isWasm); + +} // stdenv.lib.optionalAttrs targetPlatform.useAndroidPrebuilt{ dontPatchELF = true; noAuditTmpdir = true; }) diff --git a/pkgs/development/compilers/ghc/head.nix b/pkgs/development/compilers/ghc/head.nix index 0fca12d087c..40706f4744e 100644 --- a/pkgs/development/compilers/ghc/head.nix +++ b/pkgs/development/compilers/ghc/head.nix @@ -224,8 +224,6 @@ stdenv.mkDerivation (rec { hardeningDisable = [ "format" ] ++ stdenv.lib.optional stdenv.targetPlatform.isMusl "pie"; - dontStrip = false; - postInstall = '' # Install the bash completion file. install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc @@ -255,8 +253,9 @@ stdenv.mkDerivation (rec { inherit (ghc.meta) license platforms; }; -} // stdenv.lib.optionalAttrs targetPlatform.useAndroidPrebuilt { - dontStrip = true; + dontStrip = (targetPlatform.useAndroidPrebuilt || targetPlatform.isWasm); + +} // stdenv.lib.optionalAttrs targetPlatform.useAndroidPrebuilt{ dontPatchELF = true; noAuditTmpdir = true; }) From fee55e2bb1e9f471bc8342a13ca062c710d39f41 Mon Sep 17 00:00:00 2001 From: Divam Date: Sun, 5 Jul 2020 21:27:40 +0900 Subject: [PATCH 3/3] Disable static lib for Haskell wasm libs --- pkgs/development/haskell-modules/generic-builder.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index 20fa2c84062..770c66d4c85 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -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