3
0
Fork 0
forked from mirrors/nixpkgs

ghc: drop unused binary compiler version 8.2.2

This commit is contained in:
Peter Simons 2021-03-12 21:10:19 +01:00
parent cb4346597f
commit 0886f5bad8
3 changed files with 0 additions and 297 deletions

View file

@ -1,191 +0,0 @@
{ lib, stdenv, substituteAll
, fetchurl, perl, gcc, llvm
, ncurses5, gmp, glibc, libiconv
, llvmPackages
}:
# Prebuilt only does native
assert stdenv.targetPlatform == stdenv.hostPlatform;
let
useLLVM = !stdenv.targetPlatform.isx86;
libPath = lib.makeLibraryPath ([
ncurses5 gmp
] ++ lib.optional (stdenv.hostPlatform.isDarwin) libiconv);
libEnvVar = lib.optionalString stdenv.hostPlatform.isDarwin "DY"
+ "LD_LIBRARY_PATH";
glibcDynLinker = assert stdenv.isLinux;
if stdenv.hostPlatform.libc == "glibc" then
# Could be stdenv.cc.bintools.dynamicLinker, keeping as-is to avoid rebuild.
''"$(cat $NIX_CC/nix-support/dynamic-linker)"''
else
"${lib.getLib glibc}/lib/ld-linux*";
in
stdenv.mkDerivation rec {
version = "8.2.2";
name = "ghc-${version}-binary";
src = fetchurl ({
i686-linux = {
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-deb8-linux.tar.xz";
sha256 = "08w2ik55dp3n95qikmrflc91lsiq01xp53ki3jlhnbj8fqnxfrwy";
};
x86_64-linux = {
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-deb8-linux.tar.xz";
sha256 = "0ahv26304pqi3dm7i78si4pxwvg5f5dc2jwsfgvcrhcx5g30bqj8";
};
armv7l-linux = {
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-armv7-deb8-linux.tar.xz";
sha256 = "1jmv8qmnh5bn324fivbwdcaj55kvw7cb2zq9pafmlmv3qwwx7s46";
};
aarch64-linux = {
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-aarch64-deb8-linux.tar.xz";
sha256 = "1k2amylcp1ad67c75h1pqf7czf9m0zj1i7hdc45ghjklnfq9hrk7";
};
x86_64-darwin = {
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-apple-darwin.tar.xz";
sha256 = "09swx71gh5habzbx55shz2xykgr96xkcy09nzinnm4z0yxicy3zr";
};
}.${stdenv.hostPlatform.system}
or (throw "cannot bootstrap GHC on this platform"));
nativeBuildInputs = [ perl ];
propagatedBuildInputs = lib.optionals useLLVM [ llvmPackages.llvm ];
# Cannot patchelf beforehand due to relative RPATHs that anticipate
# the final install location/
${libEnvVar} = libPath;
postUnpack =
# GHC has dtrace probes, which causes ld to try to open /usr/lib/libdtrace.dylib
# during linking
lib.optionalString stdenv.isDarwin ''
export NIX_LDFLAGS+=" -no_dtrace_dof"
# not enough room in the object files for the full path to libiconv :(
for exe in $(find . -type f -executable); do
isScript $exe && continue
ln -fs ${libiconv}/lib/libiconv.dylib $(dirname $exe)/libiconv.dylib
install_name_tool -change /usr/lib/libiconv.2.dylib @executable_path/libiconv.dylib -change /usr/local/lib/gcc/6/libgcc_s.1.dylib ${gcc.cc.lib}/lib/libgcc_s.1.dylib $exe
done
'' +
# Some scripts used during the build need to have their shebangs patched
''
patchShebangs ghc-${version}/utils/
patchShebangs ghc-${version}/configure
'' +
# Strip is harmful, see also below. It's important that this happens
# first. The GHC Cabal build system makes use of strip by default and
# has hardcoded paths to /usr/bin/strip in many places. We replace
# those below, making them point to our dummy script.
''
mkdir "$TMP/bin"
for i in strip; do
echo '#! ${stdenv.shell}' > "$TMP/bin/$i"
chmod +x "$TMP/bin/$i"
done
PATH="$TMP/bin:$PATH"
'' +
# We have to patch the GMP paths for the integer-gmp package.
''
find . -name integer-gmp.buildinfo \
-exec sed -i "s@extra-lib-dirs: @extra-lib-dirs: ${gmp.out}/lib@" {} \;
'' + lib.optionalString stdenv.isDarwin ''
find . -name base.buildinfo \
-exec sed -i "s@extra-lib-dirs: @extra-lib-dirs: ${libiconv}/lib@" {} \;
'' +
# Rename needed libraries and binaries, fix interpreter
lib.optionalString stdenv.isLinux ''
find . -type f -perm -0100 -exec patchelf \
--replace-needed libncurses${lib.optionalString stdenv.is64bit "w"}.so.5 libncurses.so \
--replace-needed libtinfo.so libtinfo.so.5 \
--interpreter ${glibcDynLinker} {} \;
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:
lib.optionalString stdenv.hostPlatform.isMusl ''
find ./ghc-${version}/rts -name "libHSrts*.a" -exec ''${OBJCOPY:-objcopy} --redefine-sym __strdup=strdup {} \;
'';
configurePlatforms = [ ];
configureFlags =
let
gcc-clang-wrapper = substituteAll {
inherit (stdenv) shell;
isExecutable = true;
src = ./gcc-clang-wrapper.sh;
};
in
[ "--with-gmp-libraries=${lib.getLib gmp}/lib"
"--with-gmp-includes=${lib.getDev gmp}/include"
] ++ lib.optional stdenv.isDarwin "--with-gcc=${gcc-clang-wrapper}"
++ lib.optional stdenv.hostPlatform.isMusl "--disable-ld-override";
# Stripping combined with patchelf breaks the executables (they die
# with a segfault or the kernel even refuses the execve). (NIXPKGS-85)
dontStrip = true;
# No building is necessary, but calling make without flags ironically
# calls install-strip ...
dontBuild = true;
# On Linux, use patchelf to modify the executables so that they can
# find editline/gmp.
preFixup = lib.optionalString stdenv.isLinux ''
for p in $(find "$out" -type f -executable); do
if isELF "$p"; then
echo "Patchelfing $p"
patchelf --set-rpath "${libPath}:$(patchelf --print-rpath $p)" $p
fi
done
'' + lib.optionalString stdenv.isDarwin ''
# not enough room in the object files for the full path to libiconv :(
for exe in $(find "$out" -type f -executable); do
isScript $exe && continue
ln -fs ${libiconv}/lib/libiconv.dylib $(dirname $exe)/libiconv.dylib
install_name_tool -change /usr/lib/libiconv.2.dylib @executable_path/libiconv.dylib -change /usr/local/lib/gcc/6/libgcc_s.1.dylib ${gcc.cc.lib}/lib/libgcc_s.1.dylib $exe
done
for file in $(find "$out" -name setup-config); do
substituteInPlace $file --replace /usr/bin/ranlib "$(type -P ranlib)"
done
'';
doInstallCheck = true;
installCheckPhase = ''
unset ${libEnvVar}
# Sanity check, can ghc create executables?
cd $TMP
mkdir test-ghc; cd test-ghc
cat > main.hs << EOF
{-# LANGUAGE TemplateHaskell #-}
module Main where
main = putStrLn \$([|"yes"|])
EOF
$out/bin/ghc --make main.hs || exit 1
echo compilation ok
[ $(./main) == "yes" ]
'';
passthru = {
targetPrefix = "";
enableShared = true;
};
meta.license = lib.licenses.bsd3;
meta.platforms = ["x86_64-linux" "i686-linux" "x86_64-darwin" "armv7l-linux" "aarch64-linux"];
}

View file

@ -1,97 +0,0 @@
{ pkgs, haskellLib }:
with haskellLib;
self: super: {
# Suitable LLVM version.
llvmPackages = pkgs.llvmPackages;
# Disable GHC 8.2.x core libraries.
array = null;
base = null;
binary = null;
bytestring = null;
Cabal = null;
containers = null;
deepseq = null;
directory = null;
filepath = null;
ghc-boot = null;
ghc-boot-th = null;
ghc-compact = null;
ghc-heap = null;
ghc-prim = null;
ghci = null;
haskeline = null;
hoopl = null;
hpc = null;
integer-gmp = null;
pretty = null;
process = null;
rts = null;
template-haskell = null;
terminfo = null;
time = null;
transformers = null;
unix = null;
xhtml = null;
# These are now core libraries in GHC 8.4.x.
mtl = self.mtl_2_2_2;
parsec = self.parsec_3_1_14_0;
stm = self.stm_2_5_0_0;
text = self.text_1_2_4_0;
# Needs Cabal 3.0.x.
jailbreak-cabal = super.jailbreak-cabal.override { Cabal = self.Cabal_3_2_1_0; };
# https://github.com/bmillwood/applicative-quoters/issues/6
applicative-quoters = appendPatch super.applicative-quoters (pkgs.fetchpatch {
url = "https://patch-diff.githubusercontent.com/raw/bmillwood/applicative-quoters/pull/7.patch";
sha256 = "026vv2k3ks73jngwifszv8l59clg88pcdr4mz0wr0gamivkfa1zy";
});
# https://github.com/nominolo/ghc-syb/issues/20
ghc-syb-utils = dontCheck super.ghc-syb-utils;
# Upstream failed to distribute the testsuite for 8.2
# https://github.com/alanz/ghc-exactprint/pull/60
ghc-exactprint = dontCheck super.ghc-exactprint;
# Reduction stack overflow; size = 38
# https://github.com/jystic/hadoop-tools/issues/31
hadoop-rpc =
let patch = pkgs.fetchpatch
{ url = "https://github.com/shlevy/hadoop-tools/commit/f03a46cd15ce3796932c3382e48bcbb04a6ee102.patch";
sha256 = "09ls54zy6gx84fmzwgvx18ssgm740cwq6ds70p0p125phi54agcp";
stripLen = 1;
};
in appendPatch super.hadoop-rpc patch;
# Custom Setup.hs breaks with Cabal 2
# https://github.com/NICTA/coordinate/pull/4
coordinate =
let patch = pkgs.fetchpatch
{ url = "https://github.com/NICTA/coordinate/pull/4.patch";
sha256 = "06sfxk5cyd8nqgjyb95jkihxxk8m6dw9m3mlv94sm2qwylj86gqy";
};
in appendPatch super.coordinate patch;
# https://github.com/purescript/purescript/issues/3189
purescript = doJailbreak (super.purescript);
# These packages need Cabal 2.2.x, which is not the default.
cabal2nix = super.cabal2nix.overrideScope (self: super: { Cabal = self.Cabal_2_2_0_1; });
cabal2spec = super.cabal2spec.overrideScope (self: super: { Cabal = self.Cabal_2_2_0_1; });
distribution-nixpkgs = super.distribution-nixpkgs.overrideScope (self: super: { Cabal = self.Cabal_2_2_0_1; });
stack = super.stack.overrideScope (self: super: { Cabal = self.Cabal_2_2_0_1; });
# Older GHC versions need these additional dependencies.
ListLike = addBuildDepend super.ListLike self.semigroups;
base-compat-batteries = addBuildDepend super.base-compat-batteries self.contravariant;
# ghc versions prior to 8.8.x needs additional dependency to compile successfully.
ghc-lib-parser-ex = addBuildDepend super.ghc-lib-parser-ex self.ghc-lib-parser;
}

View file

@ -3,7 +3,6 @@
let
# These are attributes in compiler and packages that don't support integer-simple.
integerSimpleExcludes = [
"ghc822Binary"
"ghc865Binary"
"ghc8102Binary"
"ghc8102BinaryMinimal"
@ -45,8 +44,6 @@ in {
compiler = {
ghc822Binary = callPackage ../development/compilers/ghc/8.2.2-binary.nix { };
ghc865Binary = callPackage ../development/compilers/ghc/8.6.5-binary.nix { };
ghc8102Binary = callPackage ../development/compilers/ghc/8.10.2-binary.nix {
@ -157,12 +154,6 @@ in {
# Always get compilers from `buildPackages`
packages = let bh = buildPackages.haskell; in {
ghc822Binary = callPackage ../development/haskell-modules {
buildHaskellPackages = bh.packages.ghc822Binary;
ghc = bh.compiler.ghc822Binary;
compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.2.x.nix { };
packageSetConfig = bootstrapPackageSet;
};
ghc865Binary = callPackage ../development/haskell-modules {
buildHaskellPackages = bh.packages.ghc865Binary;
ghc = bh.compiler.ghc865Binary;