diff options
Diffstat (limited to 'nixpkgs/pkgs/development/compilers/ghc/8.6.5-binary.nix')
-rw-r--r-- | nixpkgs/pkgs/development/compilers/ghc/8.6.5-binary.nix | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/nixpkgs/pkgs/development/compilers/ghc/8.6.5-binary.nix b/nixpkgs/pkgs/development/compilers/ghc/8.6.5-binary.nix index b1126fda7d26..22bfae79c0ce 100644 --- a/nixpkgs/pkgs/development/compilers/ghc/8.6.5-binary.nix +++ b/nixpkgs/pkgs/development/compilers/ghc/8.6.5-binary.nix @@ -2,6 +2,8 @@ , fetchurl, perl, gcc , ncurses5, ncurses6, gmp, glibc, libiconv , llvmPackages +, coreutils +, targetPackages }: # Prebuilt only does native @@ -30,6 +32,19 @@ let downloadsUrl = "https://downloads.haskell.org/ghc"; + runtimeDeps = [ + targetPackages.stdenv.cc + targetPackages.stdenv.cc.bintools + coreutils # for cat + ] + ++ lib.optionals useLLVM [ + (lib.getBin llvmPackages.llvm) + ] + # On darwin, we need unwrapped bintools as well (for otool) + ++ lib.optionals (stdenv.targetPlatform.linker == "cctools") [ + targetPackages.stdenv.cc.bintools.bintools + ]; + in stdenv.mkDerivation rec { @@ -62,7 +77,6 @@ stdenv.mkDerivation rec { 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/ @@ -130,6 +144,15 @@ stdenv.mkDerivation rec { # calls install-strip ... dontBuild = true; + # Patch scripts to include runtime dependencies in $PATH. + postInstall = '' + for i in "$out/bin/"*; do + test ! -h "$i" || continue + isScript "$i" || continue + sed -i -e '2i export PATH="${lib.makeBinPath runtimeDeps}:$PATH"' "$i" + done + ''; + # On Linux, use patchelf to modify the executables so that they can # find editline/gmp. postFixup = lib.optionalString stdenv.isLinux '' @@ -163,7 +186,6 @@ stdenv.mkDerivation rec { doInstallCheck = true; installCheckPhase = '' - unset ${libEnvVar} # Sanity check, can ghc create executables? cd $TMP mkdir test-ghc; cd test-ghc @@ -172,7 +194,7 @@ stdenv.mkDerivation rec { module Main where main = putStrLn \$([|"yes"|]) EOF - $out/bin/ghc --make main.hs || exit 1 + env -i $out/bin/ghc --make main.hs || exit 1 echo compilation ok [ $(./main) == "yes" ] ''; @@ -181,14 +203,15 @@ stdenv.mkDerivation rec { targetPrefix = ""; enableShared = true; + inherit llvmPackages; + # Our Cabal compiler name haskellCompilerName = "ghc-${version}"; }; meta = rec { license = lib.licenses.bsd3; - platforms = ["x86_64-linux" "aarch64-linux" "i686-linux" "x86_64-darwin"]; - hydraPlatforms = builtins.filter (p: p != "aarch64-linux") platforms; + platforms = ["x86_64-linux" "i686-linux" "x86_64-darwin"]; # build segfaults, use ghc8102Binary which has proper musl support instead broken = stdenv.hostPlatform.isMusl; maintainers = with lib.maintainers; [ |