about summary refs log tree commit diff
path: root/pkgs/development/compilers/ghc
diff options
context:
space:
mode:
authorWill Dietz <w@wdtz.org>2019-03-17 04:53:19 -0500
committerWill Dietz <w@wdtz.org>2019-03-17 05:23:11 -0500
commit9a10434f4d1265dd93ff7ae78bc8f97418efc7ff (patch)
tree930be5f1f497b834c017f831e3ed1f4c665dbf99 /pkgs/development/compilers/ghc
parent83d56298aaa4ae14b758d829b5a0354ec8b5abcf (diff)
downloadnixlib-9a10434f4d1265dd93ff7ae78bc8f97418efc7ff.tar
nixlib-9a10434f4d1265dd93ff7ae78bc8f97418efc7ff.tar.gz
nixlib-9a10434f4d1265dd93ff7ae78bc8f97418efc7ff.tar.bz2
nixlib-9a10434f4d1265dd93ff7ae78bc8f97418efc7ff.tar.lz
nixlib-9a10434f4d1265dd93ff7ae78bc8f97418efc7ff.tar.xz
nixlib-9a10434f4d1265dd93ff7ae78bc8f97418efc7ff.tar.zst
nixlib-9a10434f4d1265dd93ff7ae78bc8f97418efc7ff.zip
ghc{822,863}Binary: fix to work w/musl again, __strdup -> strdup
Diffstat (limited to 'pkgs/development/compilers/ghc')
-rw-r--r--pkgs/development/compilers/ghc/8.2.2-binary.nix9
-rw-r--r--pkgs/development/compilers/ghc/8.6.3-binary.nix9
2 files changed, 18 insertions, 0 deletions
diff --git a/pkgs/development/compilers/ghc/8.2.2-binary.nix b/pkgs/development/compilers/ghc/8.2.2-binary.nix
index 678245d3e437..d9c44cb47e79 100644
--- a/pkgs/development/compilers/ghc/8.2.2-binary.nix
+++ b/pkgs/development/compilers/ghc/8.2.2-binary.nix
@@ -107,6 +107,15 @@ stdenv.mkDerivation rec {
 
       sed -i "s|/usr/bin/perl|perl\x00        |" ghc-${version}/ghc/stage2/build/tmp/ghc-stage2
       sed -i "s|/usr/bin/gcc|gcc\x00        |" ghc-${version}/ghc/stage2/build/tmp/ghc-stage2
+    '' +
+    # We're kludging a glibc bindist into working with non-glibc...
+    # Here we patch up the use of `__strdup` (part of glibc binary ABI)
+    # to instead use `strdup` since musl doesn't provide __strdup
+    # (`__strdup` is defined to be an alias of `strdup` anyway[1]).
+    # [1] http://refspecs.linuxbase.org/LSB_4.0.0/LSB-Core-generic/LSB-Core-generic/baselib---strdup-1.html
+    # Use objcopy magic to make the change:
+    stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
+      find ./ghc-${version}/rts -name "libHSrts*.a" -exec objcopy --redefine-sym __strdup=strdup {} \;
     '';
 
   configurePlatforms = [ ];
diff --git a/pkgs/development/compilers/ghc/8.6.3-binary.nix b/pkgs/development/compilers/ghc/8.6.3-binary.nix
index cde67183ef49..907eded2094a 100644
--- a/pkgs/development/compilers/ghc/8.6.3-binary.nix
+++ b/pkgs/development/compilers/ghc/8.6.3-binary.nix
@@ -99,6 +99,15 @@ stdenv.mkDerivation rec {
 
       sed -i "s|/usr/bin/perl|perl\x00        |" ghc-${version}/ghc/stage2/build/tmp/ghc-stage2
       sed -i "s|/usr/bin/gcc|gcc\x00        |" ghc-${version}/ghc/stage2/build/tmp/ghc-stage2
+    '' +
+    # We're kludging a glibc bindist into working with non-glibc...
+    # Here we patch up the use of `__strdup` (part of glibc binary ABI)
+    # to instead use `strdup` since musl doesn't provide __strdup
+    # (`__strdup` is defined to be an alias of `strdup` anyway[1]).
+    # [1] http://refspecs.linuxbase.org/LSB_4.0.0/LSB-Core-generic/LSB-Core-generic/baselib---strdup-1.html
+    # Use objcopy magic to make the change:
+    stdenv.lib.optionalString stdenv.hostPlatform.isMusl ''
+      find ./ghc-${version}/rts -name "libHSrts*.a" -exec objcopy --redefine-sym __strdup=strdup {} \;
     '';
 
   configurePlatforms = [ ];