about summary refs log tree commit diff
path: root/pkgs/development/compilers
diff options
context:
space:
mode:
authorWill Dietz <github@wdtz.org>2018-07-11 09:38:28 -0500
committerGitHub <noreply@github.com>2018-07-11 09:38:28 -0500
commitbe0a056fcb9789c5be5c97b92f42378be0abcb07 (patch)
treebd395cde6658360167f824f9e0d96afd1ae2ab80 /pkgs/development/compilers
parent5f59d13f8c1ac25ee964439bbec081167f05edf4 (diff)
parent773ae700b75174bb11146e5f588a22c4c54b73af (diff)
downloadnixlib-be0a056fcb9789c5be5c97b92f42378be0abcb07.tar
nixlib-be0a056fcb9789c5be5c97b92f42378be0abcb07.tar.gz
nixlib-be0a056fcb9789c5be5c97b92f42378be0abcb07.tar.bz2
nixlib-be0a056fcb9789c5be5c97b92f42378be0abcb07.tar.lz
nixlib-be0a056fcb9789c5be5c97b92f42378be0abcb07.tar.xz
nixlib-be0a056fcb9789c5be5c97b92f42378be0abcb07.tar.zst
nixlib-be0a056fcb9789c5be5c97b92f42378be0abcb07.zip
Merge pull request #43306 from dtzWill/fix/ghc-musl-targets
ghc{843,861}: add musl variants of "llvm-targets"
Diffstat (limited to 'pkgs/development/compilers')
-rw-r--r--pkgs/development/compilers/ghc/8.4.3.nix16
-rw-r--r--pkgs/development/compilers/ghc/8.6.1.nix16
2 files changed, 32 insertions, 0 deletions
diff --git a/pkgs/development/compilers/ghc/8.4.3.nix b/pkgs/development/compilers/ghc/8.4.3.nix
index 0f5a43d57eda..12e01a159a21 100644
--- a/pkgs/development/compilers/ghc/8.4.3.nix
+++ b/pkgs/development/compilers/ghc/8.4.3.nix
@@ -124,6 +124,22 @@ stdenv.mkDerivation (rec {
     export NIX_LDFLAGS+=" -no_dtrace_dof"
   '' + stdenv.lib.optionalString targetPlatform.useAndroidPrebuilt ''
     sed -i -e '5i ,("armv7a-unknown-linux-androideabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "cortex-a8", ""))' llvm-targets
+  '' + stdenv.lib.optionalString targetPlatform.isMusl ''
+      echo "patching llvm-targets for musl targets..."
+      echo "Cloning these existing '*-linux-gnu*' targets:"
+      grep linux-gnu llvm-targets | sed 's/^/  /'
+      echo "(go go gadget sed)"
+      sed -i 's,\(^.*linux-\)gnu\(.*\)$,\0\n\1musl\2,' llvm-targets
+      echo "llvm-targets now contains these '*-linux-musl*' targets:"
+      grep linux-musl llvm-targets | sed 's/^/  /'
+
+      echo "And now patching to preserve '-musleabi' as done with '-gnueabi'"
+      # (aclocal.m4 is actual source, but patch configure as well since we don't re-gen)
+      for x in configure aclocal.m4; do
+        substituteInPlace $x \
+          --replace '*-android*|*-gnueabi*)' \
+                    '*-android*|*-gnueabi*|*-musleabi*)'
+      done
   '';
 
   # TODO(@Ericson2314): Always pass "--target" and always prefix.
diff --git a/pkgs/development/compilers/ghc/8.6.1.nix b/pkgs/development/compilers/ghc/8.6.1.nix
index 89dcec348433..9627e87f8bde 100644
--- a/pkgs/development/compilers/ghc/8.6.1.nix
+++ b/pkgs/development/compilers/ghc/8.6.1.nix
@@ -116,6 +116,22 @@ stdenv.mkDerivation (rec {
     export NIX_LDFLAGS+=" -no_dtrace_dof"
   '' + stdenv.lib.optionalString targetPlatform.useAndroidPrebuilt ''
     sed -i -e '5i ,("armv7a-unknown-linux-androideabi", ("e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64", "cortex-a8", ""))' llvm-targets
+  '' + stdenv.lib.optionalString targetPlatform.isMusl ''
+      echo "patching llvm-targets for musl targets..."
+      echo "Cloning these existing '*-linux-gnu*' targets:"
+      grep linux-gnu llvm-targets | sed 's/^/  /'
+      echo "(go go gadget sed)"
+      sed -i 's,\(^.*linux-\)gnu\(.*\)$,\0\n\1musl\2,' llvm-targets
+      echo "llvm-targets now contains these '*-linux-musl*' targets:"
+      grep linux-musl llvm-targets | sed 's/^/  /'
+
+      echo "And now patching to preserve '-musleabi' as done with '-gnueabi'"
+      # (aclocal.m4 is actual source, but patch configure as well since we don't re-gen)
+      for x in configure aclocal.m4; do
+        substituteInPlace $x \
+          --replace '*-android*|*-gnueabi*)' \
+                    '*-android*|*-gnueabi*|*-musleabi*)'
+      done
   '';
 
   # TODO(@Ericson2314): Always pass "--target" and always prefix.