ghc: Clean up, and add passthru.prefix, in preparation for cross

No hashes should be changed.
This commit is contained in:
John Ericson 2017-09-10 15:36:48 -04:00
parent bf7b521500
commit 63bf7d002c
16 changed files with 231 additions and 102 deletions

View File

@ -1,24 +1,29 @@
{stdenv, lib, fetchurl, perl, libedit, ncurses5, gmp}: { stdenv
, fetchurl, perl
, libedit, ncurses5, gmp
}:
# Prebuilt only does native
assert stdenv.targetPlatform == stdenv.hostPlatform;
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
version = "6.10.2"; version = "6.10.2";
name = "ghc-${version}-binary"; name = "ghc-${version}-binary";
src = src = {
if stdenv.system == "i686-linux" then "i686-linux" = fetchurl {
fetchurl {
# This binary requires libedit.so.0 (rather than libedit.so.2). # This binary requires libedit.so.0 (rather than libedit.so.2).
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-unknown-linux.tar.bz2"; url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-unknown-linux.tar.bz2";
sha256 = "1fw0zr2qshlpk8s0d16k27zcv5263nqdg2xds5ymw8ff6qz9rz9b"; sha256 = "1fw0zr2qshlpk8s0d16k27zcv5263nqdg2xds5ymw8ff6qz9rz9b";
} };
else if stdenv.system == "x86_64-linux" then "x86_64-linux" = fetchurl {
fetchurl {
# Idem. # Idem.
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-unknown-linux.tar.bz2"; url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-unknown-linux.tar.bz2";
sha256 = "1rd2j7lmcfsm2rdfb5g6q0l8dz3sxadk5m3d2f69d4a6g4p4h7jj"; sha256 = "1rd2j7lmcfsm2rdfb5g6q0l8dz3sxadk5m3d2f69d4a6g4p4h7jj";
} };
else throw "cannot bootstrap GHC on this platform"; }.${stdenv.hostPlatform.system}
or (throw "cannot bootstrap GHC on this platform");
buildInputs = [perl]; buildInputs = [perl];
@ -37,17 +42,17 @@ stdenv.mkDerivation rec {
'' + '' +
# On Linux, use patchelf to modify the executables so that they can # On Linux, use patchelf to modify the executables so that they can
# find editline/gmp. # find editline/gmp.
(if stdenv.isLinux then '' stdenv.lib.optionalString stdenv.hostPlatform.isLinux ''
find . -type f -perm -0100 \ find . -type f -perm -0100 \
-exec patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \ -exec patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath "${lib.makeLibraryPath [ libedit ncurses5 gmp ]}" {} \; --set-rpath "${lib.makeLibraryPath [ libedit ncurses5 gmp ]}" {} \;
for prog in ld ar gcc strip ranlib; do for prog in ld ar gcc strip ranlib; do
find . -name "setup-config" -exec sed -i "s@/usr/bin/$prog@$(type -p $prog)@g" {} \; find . -name "setup-config" -exec sed -i "s@/usr/bin/$prog@$(type -p $prog)@g" {} \;
done done
'' else ""); '';
configurePhase = '' configurePhase = ''
./configure --prefix=$out --with-gmp-libraries=${lib.getLib gmp}/lib --with-gmp-includes=${lib.getDev gmp}/include ./configure --prefix=$out --with-gmp-libraries=${stdenv.lib.getLib gmp}/lib --with-gmp-includes=${stdenv.lib.getDev gmp}/include
''; '';
# Stripping combined with patchelf breaks the executables (they die # Stripping combined with patchelf breaks the executables (they die
@ -62,7 +67,7 @@ stdenv.mkDerivation rec {
# and create some wrapper scripts that set DYLD_FRAMEWORK_PATH so # and create some wrapper scripts that set DYLD_FRAMEWORK_PATH so
# that the executables work with no special setup. # that the executables work with no special setup.
postInstall = postInstall =
(if stdenv.isDarwin then stdenv.lib.optionalString stdenv.hostPlatform.isDarwin
'' ''
mkdir -p $out/frameworks/GMP.framework/Versions/A mkdir -p $out/frameworks/GMP.framework/Versions/A
ln -s ${gmp.out}/lib/libgmp.dylib $out/frameworks/GMP.framework/GMP ln -s ${gmp.out}/lib/libgmp.dylib $out/frameworks/GMP.framework/GMP
@ -79,7 +84,7 @@ stdenv.mkDerivation rec {
echo \"DYLD_FRAMEWORK_PATH=$out/frameworks exec $out/bin-orig/$i -framework-path $out/frameworks \\\"\\$@\\\"\" >> $out/bin/$i echo \"DYLD_FRAMEWORK_PATH=$out/frameworks exec $out/bin-orig/$i -framework-path $out/frameworks \\\"\\$@\\\"\" >> $out/bin/$i
chmod +x $out/bin/$i chmod +x $out/bin/$i
done done
'' else "") ''
+ +
'' ''
# bah, the passing gmp doesn't work, so let's add it to the final package.conf in a quick but dirty way # bah, the passing gmp doesn't work, so let's add it to the final package.conf in a quick but dirty way

View File

@ -1,5 +1,8 @@
{stdenv, fetchurl, libedit, ghc, perl, gmp, ncurses}: {stdenv, fetchurl, libedit, ghc, perl, gmp, ncurses}:
# TODO(@Ericson2314): Cross compilation support
assert stdenv.targetPlatform == stdenv.hostPlatform;
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
version = "6.10.4"; version = "6.10.4";
@ -22,6 +25,8 @@ stdenv.mkDerivation rec {
NIX_CFLAGS_COMPILE = "-fomit-frame-pointer"; NIX_CFLAGS_COMPILE = "-fomit-frame-pointer";
passthru = { prefix = ""; };
meta = { meta = {
homepage = http://haskell.org/ghc; homepage = http://haskell.org/ghc;
description = "The Glasgow Haskell Compiler"; description = "The Glasgow Haskell Compiler";

View File

@ -1,5 +1,8 @@
{stdenv, fetchurl, ghc, perl, gmp, ncurses}: {stdenv, fetchurl, ghc, perl, gmp, ncurses}:
# TODO(@Ericson2314): Cross compilation support
assert stdenv.targetPlatform == stdenv.hostPlatform;
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
version = "6.12.3"; version = "6.12.3";
@ -33,6 +36,8 @@ stdenv.mkDerivation rec {
# that in turn causes GHCi to abort # that in turn causes GHCi to abort
stripDebugFlags=["-S" "--keep-file-symbols"]; stripDebugFlags=["-S" "--keep-file-symbols"];
passthru = { prefix = ""; };
meta = { meta = {
homepage = http://haskell.org/ghc; homepage = http://haskell.org/ghc;
description = "The Glasgow Haskell Compiler"; description = "The Glasgow Haskell Compiler";

View File

@ -1,32 +1,35 @@
{stdenv, fetchurl, perl, ncurses5, gmp, libiconv}: { stdenv
, fetchurl, perl
, ncurses5, gmp, libiconv
}:
# Prebuilt only does native
assert stdenv.targetPlatform == stdenv.hostPlatform;
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
version = "7.0.4"; version = "7.0.4";
name = "ghc-${version}-binary"; name = "ghc-${version}-binary";
src = src = {
if stdenv.system == "i686-linux" then "i686-linux" = fetchurl {
fetchurl {
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-unknown-linux.tar.bz2"; url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-unknown-linux.tar.bz2";
sha256 = "0mfnihiyjl06f5w1yrjp36sw9g67g2ymg5sdl0g23h1pab99jx63"; sha256 = "0mfnihiyjl06f5w1yrjp36sw9g67g2ymg5sdl0g23h1pab99jx63";
} };
else if stdenv.system == "x86_64-linux" then "x86_64-linux" = fetchurl {
fetchurl {
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-unknown-linux.tar.bz2"; url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-unknown-linux.tar.bz2";
sha256 = "0mc4rhqcxz427wq4zgffmnn0d2yjqvy6af4x9mha283p1gdj5q99"; sha256 = "0mc4rhqcxz427wq4zgffmnn0d2yjqvy6af4x9mha283p1gdj5q99";
} };
else if stdenv.system == "i686-darwin" then "i686-darwin" = fetchurl {
fetchurl {
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-apple-darwin.tar.bz2"; url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-apple-darwin.tar.bz2";
sha256 = "0qj45hslrrr8zfks8m1jcb3awwx9rh35ndnpfmb0gwb6j7azq5n3"; sha256 = "0qj45hslrrr8zfks8m1jcb3awwx9rh35ndnpfmb0gwb6j7azq5n3";
} };
else if stdenv.system == "x86_64-darwin" then "x86_64-darwin" = fetchurl {
fetchurl {
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-apple-darwin.tar.bz2"; url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-apple-darwin.tar.bz2";
sha256 = "1m2ml88p1swf4dnv2vq8hz4drcp46n3ahpfi05wh01ajkf8hnn3l"; sha256 = "1m2ml88p1swf4dnv2vq8hz4drcp46n3ahpfi05wh01ajkf8hnn3l";
} };
else throw "cannot bootstrap GHC on this platform"; }.${stdenv.hostPlatform.system}
or (throw "cannot bootstrap GHC on this platform");
buildInputs = [perl]; buildInputs = [perl];

View File

@ -1,5 +1,8 @@
{ stdenv, fetchurl, ghc, perl, gmp, ncurses, libiconv }: { stdenv, fetchurl, ghc, perl, gmp, ncurses, libiconv }:
# TODO(@Ericson2314): Cross compilation support
assert stdenv.targetPlatform == stdenv.hostPlatform;
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
version = "7.0.4"; version = "7.0.4";
name = "ghc-${version}"; name = "ghc-${version}";
@ -42,6 +45,8 @@ stdenv.mkDerivation rec {
# that in turn causes GHCi to abort # that in turn causes GHCi to abort
stripDebugFlags=["-S" "--keep-file-symbols"]; stripDebugFlags=["-S" "--keep-file-symbols"];
passthru = { prefix = ""; };
meta = { meta = {
homepage = http://haskell.org/ghc; homepage = http://haskell.org/ghc;
description = "The Glasgow Haskell Compiler"; description = "The Glasgow Haskell Compiler";

View File

@ -1,14 +1,28 @@
{ stdenv, fetchurl, fetchpatch, bootPkgs, perl, ncurses, libiconv, binutils, coreutils { stdenv, __targetPackages
, libxml2, libxslt, docbook_xsl, docbook_xml_dtd_45, docbook_xml_dtd_42, hscolour , buildPlatform, hostPlatform, targetPlatform
# If enabled GHC will be build with the GPL-free but slower integer-simple # build-tools
, bootPkgs, hscolour
, binutils, coreutils, fetchurl, fetchpatch, perl
, docbook_xsl, docbook_xml_dtd_45, docbook_xml_dtd_42, libxml2, libxslt
, ncurses, libiconv
, # If enabled GHC will be build with the GPL-free but slower integer-simple
# library instead of the faster but GPLed integer-gmp library. # library instead of the faster but GPLed integer-gmp library.
, enableIntegerSimple ? false, gmp enableIntegerSimple ? false, gmp ? null
}: }:
assert !enableIntegerSimple -> gmp != null;
let let
inherit (bootPkgs) ghc; inherit (bootPkgs) ghc;
# TODO(@Ericson2314) Make unconditional
prefix = stdenv.lib.optionalString
(targetPlatform != hostPlatform)
"${targetPlatform.config}-";
buildMK = '' buildMK = ''
libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-includes="${ncurses.dev}/include" libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-includes="${ncurses.dev}/include"
libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-libraries="${ncurses.out}/lib" libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-libraries="${ncurses.out}/lib"
@ -27,7 +41,7 @@ in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
version = "7.10.2"; version = "7.10.2";
name = "ghc-${version}"; name = "${prefix}ghc-${version}";
src = fetchurl { src = fetchurl {
url = "https://downloads.haskell.org/~ghc/7.10.2/${name}-src.tar.xz"; url = "https://downloads.haskell.org/~ghc/7.10.2/${name}-src.tar.xz";
@ -64,7 +78,7 @@ stdenv.mkDerivation rec {
postInstall = '' postInstall = ''
# Install the bash completion file. # Install the bash completion file.
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/ghc install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${prefix}ghc
# Patch scripts to include "readelf" and "cat" in $PATH. # Patch scripts to include "readelf" and "cat" in $PATH.
for i in "$out/bin/"*; do for i in "$out/bin/"*; do
@ -75,7 +89,7 @@ stdenv.mkDerivation rec {
''; '';
passthru = { passthru = {
inherit bootPkgs; inherit bootPkgs prefix;
}; };
meta = { meta = {

View File

@ -1,14 +1,28 @@
{ stdenv, fetchurl, fetchpatch, bootPkgs, perl, ncurses, libiconv, binutils, coreutils { stdenv, __targetPackages
, libxml2, libxslt, docbook_xsl, docbook_xml_dtd_45, docbook_xml_dtd_42, hscolour , buildPlatform, hostPlatform, targetPlatform
# If enabled GHC will be build with the GPL-free but slower integer-simple # build-tools
, bootPkgs, hscolour
, binutils, coreutils, fetchurl, fetchpatch, perl
, docbook_xsl, docbook_xml_dtd_45, docbook_xml_dtd_42, libxml2, libxslt
, ncurses, libiconv
, # If enabled GHC will be build with the GPL-free but slower integer-simple
# library instead of the faster but GPLed integer-gmp library. # library instead of the faster but GPLed integer-gmp library.
, enableIntegerSimple ? false, gmp enableIntegerSimple ? false, gmp ? null
}: }:
assert !enableIntegerSimple -> gmp != null;
let let
inherit (bootPkgs) ghc; inherit (bootPkgs) ghc;
# TODO(@Ericson2314) Make unconditional
prefix = stdenv.lib.optionalString
(targetPlatform != hostPlatform)
"${targetPlatform.config}-";
docFixes = fetchurl { docFixes = fetchurl {
url = "https://downloads.haskell.org/~ghc/7.10.3/ghc-7.10.3a.patch"; url = "https://downloads.haskell.org/~ghc/7.10.3/ghc-7.10.3a.patch";
sha256 = "1j45z4kcd3w1rzm4hapap2xc16bbh942qnzzdbdjcwqznsccznf0"; sha256 = "1j45z4kcd3w1rzm4hapap2xc16bbh942qnzzdbdjcwqznsccznf0";
@ -18,7 +32,7 @@ in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
version = "7.10.3"; version = "7.10.3";
name = "ghc-${version}"; name = "${prefix}ghc-${version}";
src = fetchurl { src = fetchurl {
url = "https://downloads.haskell.org/~ghc/${version}/${name}-src.tar.xz"; url = "https://downloads.haskell.org/~ghc/${version}/${name}-src.tar.xz";
@ -62,7 +76,7 @@ stdenv.mkDerivation rec {
postInstall = '' postInstall = ''
# Install the bash completion file. # Install the bash completion file.
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/ghc install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${prefix}ghc
# Patch scripts to include "readelf" and "cat" in $PATH. # Patch scripts to include "readelf" and "cat" in $PATH.
for i in "$out/bin/"*; do for i in "$out/bin/"*; do
@ -73,7 +87,7 @@ stdenv.mkDerivation rec {
''; '';
passthru = { passthru = {
inherit bootPkgs; inherit bootPkgs prefix;
}; };
meta = { meta = {

View File

@ -2,9 +2,12 @@
# If enabled GHC will be build with the GPL-free but slower integer-simple # If enabled GHC will be build with the GPL-free but slower integer-simple
# library instead of the faster but GPLed integer-gmp library. # library instead of the faster but GPLed integer-gmp library.
, enableIntegerSimple ? false, gmp , enableIntegerSimple ? false, gmp ? null
}: }:
# TODO(@Ericson2314): Cross compilation support
assert stdenv.targetPlatform == stdenv.hostPlatform;
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
version = "7.2.2"; version = "7.2.2";
name = "ghc-${version}"; name = "ghc-${version}";
@ -51,6 +54,8 @@ stdenv.mkDerivation rec {
# that in turn causes GHCi to abort # that in turn causes GHCi to abort
stripDebugFlags=["-S" "--keep-file-symbols"]; stripDebugFlags=["-S" "--keep-file-symbols"];
passthru = { prefix = ""; };
meta = { meta = {
homepage = http://haskell.org/ghc; homepage = http://haskell.org/ghc;
description = "The Glasgow Haskell Compiler"; description = "The Glasgow Haskell Compiler";

View File

@ -1,32 +1,35 @@
{stdenv, fetchurl, perl, ncurses5, gmp, libiconv, makeWrapper}: { stdenv
, fetchurl, perl, makeWrapper
, ncurses5, gmp, libiconv
}:
# Prebuilt only does native
assert stdenv.targetPlatform == stdenv.hostPlatform;
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
version = "7.4.2"; version = "7.4.2";
name = "ghc-${version}-binary"; name = "ghc-${version}-binary";
src = src = {
if stdenv.system == "i686-linux" then "i686-linux" = fetchurl {
fetchurl {
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-unknown-linux.tar.bz2"; url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-unknown-linux.tar.bz2";
sha256 = "0gny7knhss0w0d9r6jm1gghrcb8kqjvj94bb7hxf9syrk4fxlcxi"; sha256 = "0gny7knhss0w0d9r6jm1gghrcb8kqjvj94bb7hxf9syrk4fxlcxi";
} };
else if stdenv.system == "x86_64-linux" then "x86_64-linux" = fetchurl {
fetchurl {
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-unknown-linux.tar.bz2"; url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-unknown-linux.tar.bz2";
sha256 = "043jabd0lh6n1zlqhysngbpvlsdznsa2mmsj08jyqgahw9sjb5ns"; sha256 = "043jabd0lh6n1zlqhysngbpvlsdznsa2mmsj08jyqgahw9sjb5ns";
} };
else if stdenv.system == "i686-darwin" then "i686-darwin" = fetchurl {
fetchurl {
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-apple-darwin.tar.bz2"; url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-i386-apple-darwin.tar.bz2";
sha256 = "1vrbs3pzki37hzym1f1nh07lrqh066z3ypvm81fwlikfsvk4djc0"; sha256 = "1vrbs3pzki37hzym1f1nh07lrqh066z3ypvm81fwlikfsvk4djc0";
} };
else if stdenv.system == "x86_64-darwin" then "x86_64-darwin" = fetchurl {
fetchurl {
url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-apple-darwin.tar.bz2"; url = "http://haskell.org/ghc/dist/${version}/ghc-${version}-x86_64-apple-darwin.tar.bz2";
sha256 = "1imzqc0slpg0r6p40n5a9m18cbcm0m86z8dgyhfxcckksw54mzwf"; sha256 = "1imzqc0slpg0r6p40n5a9m18cbcm0m86z8dgyhfxcckksw54mzwf";
} };
else throw "cannot bootstrap GHC on this platform"; }.${stdenv.hostPlatform.system}
or (throw "cannot bootstrap GHC on this platform");
buildInputs = [perl]; buildInputs = [perl];

View File

@ -1,10 +1,14 @@
{ stdenv, fetchurl, ghc, perl, ncurses, libiconv { stdenv, fetchurl, ghc, perl, ncurses, libiconv
# If enabled GHC will be build with the GPL-free but slower integer-simple , # If enabled GHC will be build with the GPL-free but slower integer-simple
# library instead of the faster but GPLed integer-gmp library. # library instead of the faster but GPLed integer-gmp library.
, enableIntegerSimple ? false, gmp enableIntegerSimple ? false, gmp ? null
}: }:
# TODO(@Ericson2314): Cross compilation support
assert stdenv.targetPlatform == stdenv.hostPlatform;
assert !enableIntegerSimple -> gmp != null;
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
version = "7.4.2"; version = "7.4.2";
@ -52,6 +56,8 @@ stdenv.mkDerivation rec {
# that in turn causes GHCi to abort # that in turn causes GHCi to abort
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols"; stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols";
passthru = { prefix = ""; };
meta = { meta = {
homepage = http://haskell.org/ghc; homepage = http://haskell.org/ghc;
description = "The Glasgow Haskell Compiler"; description = "The Glasgow Haskell Compiler";

View File

@ -1,10 +1,14 @@
{ stdenv, fetchurl, ghc, perl, ncurses, binutils, libiconv { stdenv, fetchurl, ghc, perl, ncurses, binutils, libiconv
# If enabled GHC will be build with the GPL-free but slower integer-simple , # If enabled GHC will be build with the GPL-free but slower integer-simple
# library instead of the faster but GPLed integer-gmp library. # library instead of the faster but GPLed integer-gmp library.
, enableIntegerSimple ? false, gmp enableIntegerSimple ? false, gmp ? null
}: }:
# TODO(@Ericson2314): Cross compilation support
assert stdenv.targetPlatform == stdenv.hostPlatform;
assert !enableIntegerSimple -> gmp != null;
let let
# The "-Wa,--noexecstack" options might be needed only with GNU ld (as opposed # The "-Wa,--noexecstack" options might be needed only with GNU ld (as opposed
# to the gold linker). It prevents binaries' stacks from being marked as # to the gold linker). It prevents binaries' stacks from being marked as
@ -78,6 +82,8 @@ in stdenv.mkDerivation rec {
# that in turn causes GHCi to abort # that in turn causes GHCi to abort
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols"; stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols";
passthru = { prefix = ""; };
meta = { meta = {
homepage = http://haskell.org/ghc; homepage = http://haskell.org/ghc;
description = "The Glasgow Haskell Compiler"; description = "The Glasgow Haskell Compiler";

View File

@ -1,10 +1,14 @@
{ stdenv, fetchurl, ghc, perl, ncurses, libiconv { stdenv, fetchurl, ghc, perl, ncurses, libiconv
# If enabled GHC will be build with the GPL-free but slower integer-simple , # If enabled GHC will be build with the GPL-free but slower integer-simple
# library instead of the faster but GPLed integer-gmp library. # library instead of the faster but GPLed integer-gmp library.
, enableIntegerSimple ? false, gmp enableIntegerSimple ? false, gmp ? null
}: }:
# TODO(@Ericson2314): Cross compilation support
assert stdenv.targetPlatform == stdenv.hostPlatform;
assert !enableIntegerSimple -> gmp != null;
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
version = "7.8.3"; version = "7.8.3";
name = "ghc-${version}"; name = "ghc-${version}";
@ -49,6 +53,8 @@ stdenv.mkDerivation rec {
# that in turn causes GHCi to abort # that in turn causes GHCi to abort
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols"; stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols";
passthru = { prefix = ""; };
meta = { meta = {
homepage = http://haskell.org/ghc; homepage = http://haskell.org/ghc;
description = "The Glasgow Haskell Compiler"; description = "The Glasgow Haskell Compiler";

View File

@ -1,10 +1,14 @@
{ stdenv, fetchurl, ghc, perl, ncurses, libiconv { stdenv, fetchurl, ghc, perl, ncurses, libiconv
# If enabled GHC will be build with the GPL-free but slower integer-simple , # If enabled GHC will be build with the GPL-free but slower integer-simple
# library instead of the faster but GPLed integer-gmp library. # library instead of the faster but GPLed integer-gmp library.
, enableIntegerSimple ? false, gmp enableIntegerSimple ? false, gmp ? null
}: }:
# TODO(@Ericson2314): Cross compilation support
assert stdenv.targetPlatform == stdenv.hostPlatform;
assert !enableIntegerSimple -> gmp != null;
stdenv.mkDerivation (rec { stdenv.mkDerivation (rec {
version = "7.8.4"; version = "7.8.4";
name = "ghc-${version}"; name = "ghc-${version}";
@ -49,6 +53,8 @@ stdenv.mkDerivation (rec {
# that in turn causes GHCi to abort # that in turn causes GHCi to abort
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols"; stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols";
passthru = { prefix = ""; };
meta = { meta = {
homepage = http://haskell.org/ghc; homepage = http://haskell.org/ghc;
description = "The Glasgow Haskell Compiler"; description = "The Glasgow Haskell Compiler";

View File

@ -1,18 +1,30 @@
{ stdenv, lib, fetchurl, fetchpatch, bootPkgs, perl, ncurses, libiconv, binutils, coreutils { stdenv, __targetPackages
, hscolour, patchutils, sphinx , buildPlatform, hostPlatform, targetPlatform
# If enabled GHC will be build with the GPL-free but slower integer-simple # build-tools
, bootPkgs, hscolour
, binutils, coreutils, fetchurl, fetchpatch, patchutils, perl, sphinx
, libiconv, ncurses
, # If enabled GHC will be build with the GPL-free but slower integer-simple
# library instead of the faster but GPLed integer-gmp library. # library instead of the faster but GPLed integer-gmp library.
, enableIntegerSimple ? false, gmp enableIntegerSimple ? false, gmp ? null
, cross ? null
}: }:
assert !enableIntegerSimple -> gmp != null;
let let
inherit (bootPkgs) ghc; inherit (bootPkgs) ghc;
# TODO(@Ericson2314) Make unconditional
prefix = stdenv.lib.optionalString
(targetPlatform != hostPlatform)
"${targetPlatform.config}-";
in in
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
version = "8.0.2"; version = "8.0.2";
name = "ghc-${version}"; name = "${prefix}ghc-${version}";
src = fetchurl { src = fetchurl {
url = "https://downloads.haskell.org/~ghc/8.0.2/${name}-src.tar.xz"; url = "https://downloads.haskell.org/~ghc/8.0.2/${name}-src.tar.xz";
@ -47,19 +59,20 @@ stdenv.mkDerivation rec {
"--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib" "--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib"
] ++ stdenv.lib.optional stdenv.isDarwin [ ] ++ stdenv.lib.optional stdenv.isDarwin [
"--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib" "--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib"
] ++ ] ++ stdenv.lib.optionals (targetPlatform.isDarwin && targetPlatform.isAarch64) [
# fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/ # fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
lib.optional (cross.config or null == "aarch64-apple-darwin14") "--disable-large-address-space"; "--disable-large-address-space"
];
# required, because otherwise all symbols from HSffi.o are stripped, and # required, because otherwise all symbols from HSffi.o are stripped, and
# that in turn causes GHCi to abort # that in turn causes GHCi to abort
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols"; stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols";
postInstall = '' postInstall = ''
paxmark m $out/lib/${name}/bin/{ghc,haddock} paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"}
# Install the bash completion file. # Install the bash completion file.
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/ghc install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${prefix}ghc
# Patch scripts to include "readelf" and "cat" in $PATH. # Patch scripts to include "readelf" and "cat" in $PATH.
for i in "$out/bin/"*; do for i in "$out/bin/"*; do
@ -70,7 +83,7 @@ stdenv.mkDerivation rec {
''; '';
passthru = { passthru = {
inherit bootPkgs; inherit bootPkgs prefix;
}; };
meta = { meta = {

View File

@ -1,16 +1,30 @@
{ stdenv, lib, fetchurl, bootPkgs, perl, ncurses, libiconv, binutils, coreutils { stdenv, __targetPackages
, autoconf, automake, happy, alex, python3, sphinx, hscolour , buildPlatform, hostPlatform, targetPlatform
, buildPlatform, targetPlatform , selfPkgs, cross ? null , selfPkgs, cross ? null
# If enabled GHC will be build with the GPL-free but slower integer-simple # build-tools
, bootPkgs, alex, happy, hscolour
, autoconf, automake, binutils, coreutils, fetchurl, perl, python3, sphinx
, libiconv ? null, ncurses
, # If enabled, GHC will be build with the GPL-free but slower integer-simple
# library instead of the faster but GPLed integer-gmp library. # library instead of the faster but GPLed integer-gmp library.
, enableIntegerSimple ? false, gmp enableIntegerSimple ? false, gmp ? null
}: }:
assert !enableIntegerSimple -> gmp != null;
let let
inherit (bootPkgs) ghc; inherit (bootPkgs) ghc;
version = "8.2.1"; version = "8.2.1";
# TODO(@Ericson2314) Make unconditional
prefix = stdenv.lib.optionalString
(targetPlatform != hostPlatform)
"${targetPlatform.config}-";
commonBuildInputs = [ alex autoconf automake ghc happy hscolour perl python3 sphinx ]; commonBuildInputs = [ alex autoconf automake ghc happy hscolour perl python3 sphinx ];
commonPreConfigure = '' commonPreConfigure = ''
sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure
@ -21,9 +35,10 @@ let
'' + stdenv.lib.optionalString enableIntegerSimple '' '' + stdenv.lib.optionalString enableIntegerSimple ''
echo "INTEGER_LIBRARY=integer-simple" > mk/build.mk echo "INTEGER_LIBRARY=integer-simple" > mk/build.mk
''; '';
in stdenv.mkDerivation (rec { in
stdenv.mkDerivation (rec {
inherit version; inherit version;
name = "ghc-${version}"; name = "${prefix}ghc-${version}";
src = fetchurl { src = fetchurl {
url = "https://downloads.haskell.org/~ghc/${version}/${name}-src.tar.xz"; url = "https://downloads.haskell.org/~ghc/${version}/${name}-src.tar.xz";
@ -52,15 +67,17 @@ in stdenv.mkDerivation (rec {
# required, because otherwise all symbols from HSffi.o are stripped, and # required, because otherwise all symbols from HSffi.o are stripped, and
# that in turn causes GHCi to abort # that in turn causes GHCi to abort
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols"; stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
checkTarget = "test"; checkTarget = "test";
# zsh and other shells are smart about `{ghc}` but bash isn't, and doesn't
# treat that as a unary `{x,y,z,..}` repetition.
postInstall = '' postInstall = ''
paxmark m $out/lib/${name}/bin/{ghc,haddock} paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"}
# Install the bash completion file. # Install the bash completion file.
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/ghc install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${prefix}ghc
# Patch scripts to include "readelf" and "cat" in $PATH. # Patch scripts to include "readelf" and "cat" in $PATH.
for i in "$out/bin/"*; do for i in "$out/bin/"*; do
@ -73,7 +90,7 @@ in stdenv.mkDerivation (rec {
outputs = [ "out" "doc" ]; outputs = [ "out" "doc" ];
passthru = { passthru = {
inherit bootPkgs; inherit bootPkgs prefix;
} // stdenv.lib.optionalAttrs (targetPlatform != buildPlatform) { } // stdenv.lib.optionalAttrs (targetPlatform != buildPlatform) {
crossCompiler = selfPkgs.ghc.override { crossCompiler = selfPkgs.ghc.override {
cross = targetPlatform; cross = targetPlatform;
@ -105,7 +122,7 @@ in stdenv.mkDerivation (rec {
"--enable-bootstrap-with-devel-snapshot" "--enable-bootstrap-with-devel-snapshot"
] ++ ] ++
# fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/ # fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
lib.optional (cross.config or null == "aarch64-apple-darwin14") "--disable-large-address-space"; stdenv.lib.optional (cross.config or null == "aarch64-apple-darwin14") "--disable-large-address-space";
buildInputs = commonBuildInputs ++ [ stdenv.ccCross stdenv.binutils ]; buildInputs = commonBuildInputs ++ [ stdenv.ccCross stdenv.binutils ];

View File

@ -1,20 +1,33 @@
{ stdenv, lib, fetchgit, bootPkgs, perl, ncurses, libiconv, binutils, coreutils { stdenv, __targetPackages
, autoconf, automake, happy, alex, python3, buildPlatform, targetPlatform , buildPlatform, hostPlatform, targetPlatform
, selfPkgs, cross ? null , selfPkgs, cross ? null
# If enabled GHC will be build with the GPL-free but slower integer-simple # build-tools
, bootPkgs, alex, happy
, autoconf, automake, binutils, coreutils, fetchgit, perl, python3
, libiconv ? null, ncurses
, # If enabled, GHC will be build with the GPL-free but slower integer-simple
# library instead of the faster but GPLed integer-gmp library. # library instead of the faster but GPLed integer-gmp library.
, enableIntegerSimple ? false, gmp enableIntegerSimple ? false, gmp ? null
, version ? "8.3.20170808" , version ? "8.3.20170808"
}: }:
assert !enableIntegerSimple -> gmp != null;
let let
inherit (bootPkgs) ghc; inherit (bootPkgs) ghc;
commonBuildInputs = [ ghc perl autoconf automake happy alex python3 ];
rev = "14457cf6a50f708eecece8f286f08687791d51f7"; rev = "14457cf6a50f708eecece8f286f08687791d51f7";
# TODO(@Ericson2314) Make unconditional
prefix = stdenv.lib.optionalString
(targetPlatform != hostPlatform)
"${targetPlatform.config}-";
commonBuildInputs = [ ghc perl autoconf automake happy alex python3 ];
commonPreConfigure = '' commonPreConfigure = ''
echo ${version} >VERSION echo ${version} >VERSION
echo ${rev} >GIT_COMMIT_ID echo ${rev} >GIT_COMMIT_ID
@ -27,7 +40,8 @@ let
'' + stdenv.lib.optionalString enableIntegerSimple '' '' + stdenv.lib.optionalString enableIntegerSimple ''
echo "INTEGER_LIBRARY=integer-simple" > mk/build.mk echo "INTEGER_LIBRARY=integer-simple" > mk/build.mk
''; '';
in stdenv.mkDerivation (rec { in
stdenv.mkDerivation (rec {
inherit version rev; inherit version rev;
name = "ghc-${version}"; name = "ghc-${version}";
@ -57,15 +71,17 @@ in stdenv.mkDerivation (rec {
# required, because otherwise all symbols from HSffi.o are stripped, and # required, because otherwise all symbols from HSffi.o are stripped, and
# that in turn causes GHCi to abort # that in turn causes GHCi to abort
stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols"; stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols";
checkTarget = "test"; checkTarget = "test";
# zsh and other shells are smart about `{ghc}` but bash isn't, and doesn't
# treat that as a unary `{x,y,z,..}` repetition.
postInstall = '' postInstall = ''
paxmark m $out/lib/${name}/bin/{ghc,haddock} paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"}
# Install the bash completion file. # Install the bash completion file.
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/ghc install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${prefix}ghc
# Patch scripts to include "readelf" and "cat" in $PATH. # Patch scripts to include "readelf" and "cat" in $PATH.
for i in "$out/bin/"*; do for i in "$out/bin/"*; do
@ -78,7 +94,7 @@ in stdenv.mkDerivation (rec {
outputs = [ "out" "doc" ]; outputs = [ "out" "doc" ];
passthru = { passthru = {
inherit bootPkgs; inherit bootPkgs prefix;
} // stdenv.lib.optionalAttrs (targetPlatform != buildPlatform) { } // stdenv.lib.optionalAttrs (targetPlatform != buildPlatform) {
crossCompiler = selfPkgs.ghc.override { crossCompiler = selfPkgs.ghc.override {
cross = targetPlatform; cross = targetPlatform;
@ -110,7 +126,7 @@ in stdenv.mkDerivation (rec {
"--enable-bootstrap-with-devel-snapshot" "--enable-bootstrap-with-devel-snapshot"
] ++ ] ++
# fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/ # fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
lib.optional (cross.config or null == "aarch64-apple-darwin14") "--disable-large-address-space"; stdenv.lib.optional (cross.config or null == "aarch64-apple-darwin14") "--disable-large-address-space";
buildInputs = commonBuildInputs; buildInputs = commonBuildInputs;