summary refs log tree commit diff
diff options
context:
space:
mode:
authorsternenseemann <sternenseemann@systemli.org>2022-04-18 22:21:21 +0200
committersternenseemann <sternenseemann@systemli.org>2022-04-22 14:25:53 +0200
commitd331463a2c7ed1fc9d2fe4b16c94df76a609a8b7 (patch)
tree30d71fe5f00ef3331c57533239565805eae8d596
parent4d528f22b8b3e6ca4212453aedb13c099a92ae77 (diff)
downloadnixpkgs-d331463a2c7ed1fc9d2fe4b16c94df76a609a8b7.tar
nixpkgs-d331463a2c7ed1fc9d2fe4b16c94df76a609a8b7.tar.gz
nixpkgs-d331463a2c7ed1fc9d2fe4b16c94df76a609a8b7.tar.bz2
nixpkgs-d331463a2c7ed1fc9d2fe4b16c94df76a609a8b7.tar.lz
nixpkgs-d331463a2c7ed1fc9d2fe4b16c94df76a609a8b7.tar.xz
nixpkgs-d331463a2c7ed1fc9d2fe4b16c94df76a609a8b7.tar.zst
nixpkgs-d331463a2c7ed1fc9d2fe4b16c94df76a609a8b7.zip
haskell.compiler: fix binary GHCs with store paths containing "xxx"
At some point in hadrian's installation Makefile used for e.g. alpine
bindists 'xxx' is used as a placeholder for three spaces and later
substituted back. This breaks if the store path itself contains 'xxx'.
We adapt an upstream patch which will be part of 9.4 (and presumably
9.0.3 and 9.2.3) as a workaround for this issue for 8.10.2 and 8.10.7
which are the binary GHCs in nixpkgs affected.
-rw-r--r--pkgs/development/compilers/ghc/8.10.2-binary.nix14
-rw-r--r--pkgs/development/compilers/ghc/8.10.7-binary.nix14
2 files changed, 28 insertions, 0 deletions
diff --git a/pkgs/development/compilers/ghc/8.10.2-binary.nix b/pkgs/development/compilers/ghc/8.10.2-binary.nix
index a29a5b0b5ab..10ee40f710c 100644
--- a/pkgs/development/compilers/ghc/8.10.2-binary.nix
+++ b/pkgs/development/compilers/ghc/8.10.2-binary.nix
@@ -272,6 +272,20 @@ stdenv.mkDerivation rec {
     lib.optionalString stdenv.isLinux ''
       find . -type f -executable -exec patchelf \
           --interpreter ${stdenv.cc.bintools.dynamicLinker} {} \;
+    '' +
+    # The hadrian install Makefile uses 'xxx' as a temporary placeholder in path
+    # substitution. Which can break the build if the store path / prefix happens
+    # to contain this string. This will be fixed with 9.4 bindists.
+    # https://gitlab.haskell.org/ghc/ghc/-/issues/21402
+    ''
+      # Detect hadrian Makefile by checking for the target that has the problem
+      if grep '^update_package_db' ghc-${version}*/Makefile > /dev/null; then
+        echo Hadrian bindist, applying workaround for xxx path substitution.
+        # based on https://gitlab.haskell.org/ghc/ghc/-/commit/dd5fecb0e2990b192d92f4dfd7519ecb33164fad.patch
+        substituteInPlace ghc-${version}*/Makefile --replace 'xxx' '\0xxx\0'
+      else
+        echo Not a hadrian bindist, not applying xxx path workaround.
+      fi
     '';
 
   # fix for `configure: error: Your linker is affected by binutils #16177`
diff --git a/pkgs/development/compilers/ghc/8.10.7-binary.nix b/pkgs/development/compilers/ghc/8.10.7-binary.nix
index bf3ace0240c..94ad5a78a0a 100644
--- a/pkgs/development/compilers/ghc/8.10.7-binary.nix
+++ b/pkgs/development/compilers/ghc/8.10.7-binary.nix
@@ -270,6 +270,20 @@ stdenv.mkDerivation rec {
     lib.optionalString stdenv.isLinux ''
       find . -type f -executable -exec patchelf \
           --interpreter ${stdenv.cc.bintools.dynamicLinker} {} \;
+    '' +
+    # The hadrian install Makefile uses 'xxx' as a temporary placeholder in path
+    # substitution. Which can break the build if the store path / prefix happens
+    # to contain this string. This will be fixed with 9.4 bindists.
+    # https://gitlab.haskell.org/ghc/ghc/-/issues/21402
+    ''
+      # Detect hadrian Makefile by checking for the target that has the problem
+      if grep '^update_package_db' ghc-${version}*/Makefile > /dev/null; then
+        echo Hadrian bindist, applying workaround for xxx path substitution.
+        # based on https://gitlab.haskell.org/ghc/ghc/-/commit/dd5fecb0e2990b192d92f4dfd7519ecb33164fad.patch
+        substituteInPlace ghc-${version}*/Makefile --replace 'xxx' '\0xxx\0'
+      else
+        echo Not a hadrian bindist, not applying xxx path workaround.
+      fi
     '';
 
   # fix for `configure: error: Your linker is affected by binutils #16177`