From a3252955d90e15362b9d0bcf297a588adc2b3a72 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Tue, 9 Jan 2018 18:58:25 +0000 Subject: [PATCH 01/18] ckb: fix missing modprobe dependency --- pkgs/tools/misc/ckb/ckb-modprobe.patch | 13 +++++++++++++ pkgs/tools/misc/ckb/default.nix | 7 ++++++- 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 pkgs/tools/misc/ckb/ckb-modprobe.patch diff --git a/pkgs/tools/misc/ckb/ckb-modprobe.patch b/pkgs/tools/misc/ckb/ckb-modprobe.patch new file mode 100644 index 00000000000..8024151159c --- /dev/null +++ b/pkgs/tools/misc/ckb/ckb-modprobe.patch @@ -0,0 +1,13 @@ +diff --git a/src/ckb-daemon/usb_linux.c b/src/ckb-daemon/usb_linux.c +index 8673f86..4714305 100644 +--- a/src/ckb-daemon/usb_linux.c ++++ b/src/ckb-daemon/usb_linux.c +@@ -440,7 +440,7 @@ static void udev_enum(){ + + int usbmain(){ + // Load the uinput module (if it's not loaded already) +- if(system("modprobe uinput") != 0) ++ if(system("@kmod@/bin/modprobe uinput") != 0) + ckb_warn("Failed to load uinput module\n"); + + // Create the udev object diff --git a/pkgs/tools/misc/ckb/default.nix b/pkgs/tools/misc/ckb/default.nix index a0dbc6fd4fe..6ea31f434f2 100644 --- a/pkgs/tools/misc/ckb/default.nix +++ b/pkgs/tools/misc/ckb/default.nix @@ -1,4 +1,4 @@ -{ stdenv, fetchFromGitHub, libudev, pkgconfig, qtbase, qmake, zlib }: +{ stdenv, fetchFromGitHub, substituteAll, libudev, pkgconfig, qtbase, qmake, zlib, kmod }: stdenv.mkDerivation rec { version = "0.2.8"; @@ -24,6 +24,11 @@ stdenv.mkDerivation rec { patches = [ ./ckb-animations-location.patch + (substituteAll { + name = "ckb-modprobe.patch"; + src = ./ckb-modprobe.patch; + inherit kmod; + }) ]; doCheck = false; From 5a6b6b4ac56f1731abfbc48c7506fecf628a84d7 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sun, 10 Sep 2017 18:29:27 -0400 Subject: [PATCH 02/18] ghc: Normalize derivations a bit before cross These changes will affect the final derivation --- pkgs/development/compilers/ghc/7.10.3.nix | 11 ++++++++--- pkgs/development/compilers/ghc/7.2.2.nix | 2 +- pkgs/development/compilers/ghc/7.4.2.nix | 4 ++-- pkgs/development/compilers/ghc/7.6.3.nix | 4 ++-- pkgs/development/compilers/ghc/7.8.4.nix | 4 ++-- pkgs/development/compilers/ghc/8.0.2.nix | 11 ++++++++--- pkgs/development/compilers/ghc/8.2.2.nix | 13 ++++++++----- pkgs/development/compilers/ghc/8.4.1.nix | 13 ++++++++----- pkgs/development/compilers/ghc/head.nix | 13 ++++++++----- 9 files changed, 47 insertions(+), 28 deletions(-) diff --git a/pkgs/development/compilers/ghc/7.10.3.nix b/pkgs/development/compilers/ghc/7.10.3.nix index 3fb70c31a7c..376b548b178 100644 --- a/pkgs/development/compilers/ghc/7.10.3.nix +++ b/pkgs/development/compilers/ghc/7.10.3.nix @@ -28,6 +28,12 @@ let sha256 = "1j45z4kcd3w1rzm4hapap2xc16bbh942qnzzdbdjcwqznsccznf0"; }; + buildMK = stdenv.lib.optionalString enableIntegerSimple '' + INTEGER_LIBRARY = integer-simple + '' + stdenv.lib.optionalString (targetPlatform != hostPlatform) '' + BuildFlavour = perf-cross + ''; + in stdenv.mkDerivation rec { @@ -51,13 +57,12 @@ stdenv.mkDerivation rec { outputs = [ "out" "doc" ]; preConfigure = '' + echo "${buildMK}" > mk/build.mk sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' - export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}" + export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}" '' + stdenv.lib.optionalString stdenv.isDarwin '' export NIX_LDFLAGS+=" -no_dtrace_dof" - '' + stdenv.lib.optionalString enableIntegerSimple '' - echo "INTEGER_LIBRARY=integer-simple" > mk/build.mk ''; configureFlags = [ diff --git a/pkgs/development/compilers/ghc/7.2.2.nix b/pkgs/development/compilers/ghc/7.2.2.nix index cb8470bcff1..7de33b7b5a5 100644 --- a/pkgs/development/compilers/ghc/7.2.2.nix +++ b/pkgs/development/compilers/ghc/7.2.2.nix @@ -31,7 +31,7 @@ stdenv.mkDerivation rec { libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-libraries="${libiconv}/lib" ''} '' + (if enableIntegerSimple then '' - INTEGER_LIBRARY=integer-simple + INTEGER_LIBRARY = integer-simple '' else '' libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-libraries="${gmp.out}/lib" libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-includes="${gmp.dev}/include" diff --git a/pkgs/development/compilers/ghc/7.4.2.nix b/pkgs/development/compilers/ghc/7.4.2.nix index 6f30b03efb9..5fb5dabd438 100644 --- a/pkgs/development/compilers/ghc/7.4.2.nix +++ b/pkgs/development/compilers/ghc/7.4.2.nix @@ -32,7 +32,7 @@ stdenv.mkDerivation rec { libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-libraries="${libiconv}/lib" ''} '' + (if enableIntegerSimple then '' - INTEGER_LIBRARY=integer-simple + INTEGER_LIBRARY = integer-simple '' else '' libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-libraries="${gmp.out}/lib" libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-includes="${gmp.dev}/include" @@ -42,7 +42,7 @@ stdenv.mkDerivation rec { echo "${buildMK}" > mk/build.mk sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' - export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}" + export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}" '' + stdenv.lib.optionalString stdenv.isDarwin '' find . -name '*.hs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|' find . -name '*.lhs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|' diff --git a/pkgs/development/compilers/ghc/7.6.3.nix b/pkgs/development/compilers/ghc/7.6.3.nix index 78202297686..181d3967fb2 100644 --- a/pkgs/development/compilers/ghc/7.6.3.nix +++ b/pkgs/development/compilers/ghc/7.6.3.nix @@ -43,7 +43,7 @@ in stdenv.mkDerivation rec { SRC_HC_OPTS += ${ghcFlags} SRC_CC_OPTS += ${cFlags} '' + (if enableIntegerSimple then '' - INTEGER_LIBRARY=integer-simple + INTEGER_LIBRARY = integer-simple '' else '' libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-libraries="${gmp.out}/lib" libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-includes="${gmp.dev}/include" @@ -58,7 +58,7 @@ in stdenv.mkDerivation rec { sed -i -e 's|"\$topdir"|"\$topdir" ${ghcFlags}|' ghc/ghc.wrapper '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' - export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}" + export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}" '' + stdenv.lib.optionalString stdenv.isDarwin '' find . -name '*.hs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|' find . -name '*.lhs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|' diff --git a/pkgs/development/compilers/ghc/7.8.4.nix b/pkgs/development/compilers/ghc/7.8.4.nix index b5e2ac256a7..67ab1423993 100644 --- a/pkgs/development/compilers/ghc/7.8.4.nix +++ b/pkgs/development/compilers/ghc/7.8.4.nix @@ -34,7 +34,7 @@ stdenv.mkDerivation (rec { libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-libraries="${libiconv}/lib" ''} '' + (if enableIntegerSimple then '' - INTEGER_LIBRARY=integer-simple + INTEGER_LIBRARY = integer-simple '' else '' libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-libraries="${gmp.out}/lib" libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-includes="${gmp.dev}/include" @@ -44,7 +44,7 @@ stdenv.mkDerivation (rec { echo "${buildMK}" > mk/build.mk sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' - export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}" + export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}" '' + stdenv.lib.optionalString stdenv.isDarwin '' export NIX_LDFLAGS+=" -no_dtrace_dof" ''; diff --git a/pkgs/development/compilers/ghc/8.0.2.nix b/pkgs/development/compilers/ghc/8.0.2.nix index bb706aa6bbc..51e60419025 100644 --- a/pkgs/development/compilers/ghc/8.0.2.nix +++ b/pkgs/development/compilers/ghc/8.0.2.nix @@ -21,6 +21,12 @@ let targetPrefix = stdenv.lib.optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-"; + + buildMK = stdenv.lib.optionalString enableIntegerSimple '' + INTEGER_LIBRARY = integer-simple + '' + stdenv.lib.optionalString (targetPlatform != hostPlatform) '' + BuildFlavour = perf-cross + ''; in stdenv.mkDerivation rec { version = "8.0.2"; @@ -42,13 +48,12 @@ stdenv.mkDerivation rec { outputs = [ "out" "man" "doc" ]; preConfigure = '' + echo "${buildMK}" > mk/build.mk sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' - export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}" + export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}" '' + stdenv.lib.optionalString stdenv.isDarwin '' export NIX_LDFLAGS+=" -no_dtrace_dof" - '' + stdenv.lib.optionalString enableIntegerSimple '' - echo "INTEGER_LIBRARY=integer-simple" > mk/build.mk ''; configureFlags = [ diff --git a/pkgs/development/compilers/ghc/8.2.2.nix b/pkgs/development/compilers/ghc/8.2.2.nix index 0e87ea68649..6eeff74160b 100644 --- a/pkgs/development/compilers/ghc/8.2.2.nix +++ b/pkgs/development/compilers/ghc/8.2.2.nix @@ -22,6 +22,12 @@ let targetPrefix = stdenv.lib.optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-"; + + buildMK = stdenv.lib.optionalString enableIntegerSimple '' + INTEGER_LIBRARY = integer-simple + '' + stdenv.lib.optionalString (targetPlatform != hostPlatform) '' + BuildFlavour = perf-cross + ''; in stdenv.mkDerivation (rec { version = "8.2.2"; @@ -35,15 +41,12 @@ stdenv.mkDerivation (rec { postPatch = "patchShebangs ."; preConfigure = '' + echo "${buildMK}" > mk/build.mk sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' - export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}" + export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}" '' + stdenv.lib.optionalString stdenv.isDarwin '' export NIX_LDFLAGS+=" -no_dtrace_dof" - '' + stdenv.lib.optionalString enableIntegerSimple '' - echo "INTEGER_LIBRARY=integer-simple" > mk/build.mk - '' + stdenv.lib.optionalString (targetPlatform != hostPlatform) '' - sed 's|#BuildFlavour = quick-cross|BuildFlavour = perf-cross|' mk/build.mk.sample > mk/build.mk ''; buildInputs = [ alex autoconf automake ghc happy hscolour perl python3 sphinx ] ++ stdenv.lib.optionals (targetPlatform.isArm || targetPlatform.isAarch64) [ llvm_39 ]; diff --git a/pkgs/development/compilers/ghc/8.4.1.nix b/pkgs/development/compilers/ghc/8.4.1.nix index b5db328a8a2..45e34a775ed 100644 --- a/pkgs/development/compilers/ghc/8.4.1.nix +++ b/pkgs/development/compilers/ghc/8.4.1.nix @@ -26,6 +26,12 @@ let targetPrefix = stdenv.lib.optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-"; + + buildMK = stdenv.lib.optionalString enableIntegerSimple '' + INTEGER_LIBRARY = integer-simple + '' + stdenv.lib.optionalString (targetPlatform != hostPlatform) '' + BuildFlavour = perf-cross + ''; in stdenv.mkDerivation (rec { inherit version rev; @@ -40,18 +46,15 @@ stdenv.mkDerivation (rec { postPatch = "patchShebangs ."; preConfigure = '' + echo "${buildMK}" > mk/build.mk echo ${version} >VERSION echo ${rev} >GIT_COMMIT_ID ./boot sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' - export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}" + export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}" '' + stdenv.lib.optionalString stdenv.isDarwin '' export NIX_LDFLAGS+=" -no_dtrace_dof" - '' + stdenv.lib.optionalString enableIntegerSimple '' - echo "INTEGER_LIBRARY=integer-simple" > mk/build.mk - '' + stdenv.lib.optionalString (targetPlatform != hostPlatform) '' - sed 's|#BuildFlavour = quick-cross|BuildFlavour = perf-cross|' mk/build.mk.sample > mk/build.mk ''; buildInputs = [ ghc perl autoconf automake happy alex python3 ]; diff --git a/pkgs/development/compilers/ghc/head.nix b/pkgs/development/compilers/ghc/head.nix index 9b4c932eb11..18a00202dc2 100644 --- a/pkgs/development/compilers/ghc/head.nix +++ b/pkgs/development/compilers/ghc/head.nix @@ -26,6 +26,12 @@ let targetPrefix = stdenv.lib.optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-"; + + buildMK = stdenv.lib.optionalString enableIntegerSimple '' + INTEGER_LIBRARY = integer-simple + '' + stdenv.lib.optionalString (targetPlatform != hostPlatform) '' + BuildFlavour = perf-cross + ''; in stdenv.mkDerivation (rec { inherit version rev; @@ -40,18 +46,15 @@ stdenv.mkDerivation (rec { postPatch = "patchShebangs ."; preConfigure = '' + echo "${buildMK}" > mk/build.mk echo ${version} >VERSION echo ${rev} >GIT_COMMIT_ID ./boot sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' - export NIX_LDFLAGS="$NIX_LDFLAGS -rpath $out/lib/ghc-${version}" + export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}" '' + stdenv.lib.optionalString stdenv.isDarwin '' export NIX_LDFLAGS+=" -no_dtrace_dof" - '' + stdenv.lib.optionalString enableIntegerSimple '' - echo "INTEGER_LIBRARY=integer-simple" > mk/build.mk - '' + stdenv.lib.optionalString (targetPlatform != hostPlatform) '' - sed 's|#BuildFlavour = quick-cross|BuildFlavour = perf-cross|' mk/build.mk.sample > mk/build.mk ''; buildInputs = [ ghc perl autoconf automake happy alex python3 ]; From 0eb3acaf386b15097c8b248c5a50bc7650ef8be9 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 18 Sep 2017 12:04:22 -0400 Subject: [PATCH 03/18] ghc: `echo -n` mk/build.mk to avoid extra line --- pkgs/development/compilers/ghc/6.12.3.nix | 2 +- pkgs/development/compilers/ghc/7.0.4.nix | 2 +- pkgs/development/compilers/ghc/7.10.3.nix | 2 +- pkgs/development/compilers/ghc/7.2.2.nix | 2 +- pkgs/development/compilers/ghc/7.4.2.nix | 2 +- pkgs/development/compilers/ghc/7.6.3.nix | 2 +- pkgs/development/compilers/ghc/7.8.4.nix | 2 +- pkgs/development/compilers/ghc/8.0.2.nix | 2 +- pkgs/development/compilers/ghc/8.2.2.nix | 2 +- pkgs/development/compilers/ghc/8.4.1.nix | 2 +- pkgs/development/compilers/ghc/head.nix | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/pkgs/development/compilers/ghc/6.12.3.nix b/pkgs/development/compilers/ghc/6.12.3.nix index 16d6d39e95f..499508a56f7 100644 --- a/pkgs/development/compilers/ghc/6.12.3.nix +++ b/pkgs/development/compilers/ghc/6.12.3.nix @@ -23,7 +23,7 @@ stdenv.mkDerivation rec { ''; preConfigure = '' - echo "${buildMK}" > mk/build.mk + echo -n "${buildMK}" > mk/build.mk ''; configureFlags = [ diff --git a/pkgs/development/compilers/ghc/7.0.4.nix b/pkgs/development/compilers/ghc/7.0.4.nix index 0f560313007..665622e075f 100644 --- a/pkgs/development/compilers/ghc/7.0.4.nix +++ b/pkgs/development/compilers/ghc/7.0.4.nix @@ -28,7 +28,7 @@ stdenv.mkDerivation rec { ''; preConfigure = '' - echo "${buildMK}" > mk/build.mk + echo -n "${buildMK}" > mk/build.mk sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure '' + stdenv.lib.optionalString stdenv.isDarwin '' find . -name '*.hs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|' diff --git a/pkgs/development/compilers/ghc/7.10.3.nix b/pkgs/development/compilers/ghc/7.10.3.nix index 376b548b178..9bf60dfca36 100644 --- a/pkgs/development/compilers/ghc/7.10.3.nix +++ b/pkgs/development/compilers/ghc/7.10.3.nix @@ -57,7 +57,7 @@ stdenv.mkDerivation rec { outputs = [ "out" "doc" ]; preConfigure = '' - echo "${buildMK}" > mk/build.mk + echo -n "${buildMK}" > mk/build.mk sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}" diff --git a/pkgs/development/compilers/ghc/7.2.2.nix b/pkgs/development/compilers/ghc/7.2.2.nix index 7de33b7b5a5..897b489aa85 100644 --- a/pkgs/development/compilers/ghc/7.2.2.nix +++ b/pkgs/development/compilers/ghc/7.2.2.nix @@ -38,7 +38,7 @@ stdenv.mkDerivation rec { ''); preConfigure = '' - echo "${buildMK}" > mk/build.mk + echo -n "${buildMK}" > mk/build.mk sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure '' + stdenv.lib.optionalString stdenv.isDarwin '' find . -name '*.hs' | xargs sed -i -e 's|ASSERT (|ASSERT(|' -e 's|ASSERT2 (|ASSERT2(|' -e 's|WARN (|WARN(|' diff --git a/pkgs/development/compilers/ghc/7.4.2.nix b/pkgs/development/compilers/ghc/7.4.2.nix index 5fb5dabd438..ebf48c2584d 100644 --- a/pkgs/development/compilers/ghc/7.4.2.nix +++ b/pkgs/development/compilers/ghc/7.4.2.nix @@ -39,7 +39,7 @@ stdenv.mkDerivation rec { ''); preConfigure = '' - echo "${buildMK}" > mk/build.mk + echo -n "${buildMK}" > mk/build.mk sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}" diff --git a/pkgs/development/compilers/ghc/7.6.3.nix b/pkgs/development/compilers/ghc/7.6.3.nix index 181d3967fb2..7bf7046ba76 100644 --- a/pkgs/development/compilers/ghc/7.6.3.nix +++ b/pkgs/development/compilers/ghc/7.6.3.nix @@ -50,7 +50,7 @@ in stdenv.mkDerivation rec { ''); preConfigure = '' - echo "${buildMK}" > mk/build.mk + echo -n "${buildMK}" > mk/build.mk sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure '' + stdenv.lib.optionalString stdenv.isLinux '' diff --git a/pkgs/development/compilers/ghc/7.8.4.nix b/pkgs/development/compilers/ghc/7.8.4.nix index 67ab1423993..c17958ce4ef 100644 --- a/pkgs/development/compilers/ghc/7.8.4.nix +++ b/pkgs/development/compilers/ghc/7.8.4.nix @@ -41,7 +41,7 @@ stdenv.mkDerivation (rec { ''); preConfigure = '' - echo "${buildMK}" > mk/build.mk + echo -n "${buildMK}" > mk/build.mk sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}" diff --git a/pkgs/development/compilers/ghc/8.0.2.nix b/pkgs/development/compilers/ghc/8.0.2.nix index 51e60419025..e3b168a8166 100644 --- a/pkgs/development/compilers/ghc/8.0.2.nix +++ b/pkgs/development/compilers/ghc/8.0.2.nix @@ -48,7 +48,7 @@ stdenv.mkDerivation rec { outputs = [ "out" "man" "doc" ]; preConfigure = '' - echo "${buildMK}" > mk/build.mk + echo -n "${buildMK}" > mk/build.mk sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}" diff --git a/pkgs/development/compilers/ghc/8.2.2.nix b/pkgs/development/compilers/ghc/8.2.2.nix index 6eeff74160b..934e05465c7 100644 --- a/pkgs/development/compilers/ghc/8.2.2.nix +++ b/pkgs/development/compilers/ghc/8.2.2.nix @@ -41,7 +41,7 @@ stdenv.mkDerivation (rec { postPatch = "patchShebangs ."; preConfigure = '' - echo "${buildMK}" > mk/build.mk + echo -n "${buildMK}" > mk/build.mk sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' export NIX_LDFLAGS+=" -rpath $out/lib/ghc-${version}" diff --git a/pkgs/development/compilers/ghc/8.4.1.nix b/pkgs/development/compilers/ghc/8.4.1.nix index 45e34a775ed..dd0be26da7c 100644 --- a/pkgs/development/compilers/ghc/8.4.1.nix +++ b/pkgs/development/compilers/ghc/8.4.1.nix @@ -46,7 +46,7 @@ stdenv.mkDerivation (rec { postPatch = "patchShebangs ."; preConfigure = '' - echo "${buildMK}" > mk/build.mk + echo -n "${buildMK}" > mk/build.mk echo ${version} >VERSION echo ${rev} >GIT_COMMIT_ID ./boot diff --git a/pkgs/development/compilers/ghc/head.nix b/pkgs/development/compilers/ghc/head.nix index 18a00202dc2..6fb199b1a57 100644 --- a/pkgs/development/compilers/ghc/head.nix +++ b/pkgs/development/compilers/ghc/head.nix @@ -46,7 +46,7 @@ stdenv.mkDerivation (rec { postPatch = "patchShebangs ."; preConfigure = '' - echo "${buildMK}" > mk/build.mk + echo -n "${buildMK}" > mk/build.mk echo ${version} >VERSION echo ${rev} >GIT_COMMIT_ID ./boot From 54ead73271bec25986836c91b1acb0afa7cdbbab Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 2 Feb 2017 11:44:11 -0500 Subject: [PATCH 04/18] generic-builder: Make GHC a proper dependency Rather than just sticking it on the PATH --- pkgs/development/haskell-modules/generic-builder.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index 5b2b23fc790..ad9eec61668 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -160,8 +160,8 @@ let allPkgconfigDepends = pkgconfigDepends ++ libraryPkgconfigDepends ++ executablePkgconfigDepends ++ optionals doCheck testPkgconfigDepends ++ optionals doBenchmark benchmarkPkgconfigDepends; - nativeBuildInputs = optional (allPkgconfigDepends != []) pkgconfig ++ - buildTools ++ libraryToolDepends ++ executableToolDepends ++ [ removeReferencesTo ]; + nativeBuildInputs = [ ghc removeReferencesTo ] ++ optional (allPkgconfigDepends != []) pkgconfig ++ + buildTools ++ libraryToolDepends ++ executableToolDepends; propagatedBuildInputs = buildDepends ++ libraryHaskellDepends ++ executableHaskellDepends; otherBuildInputs = setupHaskellDepends ++ extraLibraries ++ librarySystemDepends ++ executableSystemDepends ++ optionals (allPkgconfigDepends != []) allPkgconfigDepends ++ @@ -220,7 +220,6 @@ stdenv.mkDerivation ({ runHook preSetupCompilerEnvironment echo "Build with ${ghc}." - export PATH="${ghc}/bin:$PATH" ${optionalString (hasActiveLibrary && hyperlinkSource) "export PATH=${hscolour}/bin:$PATH"} packageConfDir="$TMPDIR/package.conf.d" @@ -276,6 +275,8 @@ stdenv.mkDerivation ({ runHook postCompileBuildDriver ''; + # Cabal takes flags like `--configure-option=--host=...` instead + configurePlatforms = []; inherit configureFlags; configurePhase = '' From bc16cfc009a32d4468151e23638f396bd5dc4c13 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 2 Feb 2017 11:44:11 -0500 Subject: [PATCH 05/18] ghc: Remove old cross work That way the next commit can apply a similar diff to each GHC. --- pkgs/development/compilers/ghc/8.2.2.nix | 30 +----------- pkgs/development/compilers/ghc/8.4.1.nix | 30 +----------- pkgs/development/compilers/ghc/head.nix | 30 +----------- pkgs/top-level/haskell-packages.nix | 59 ++++++++++-------------- 4 files changed, 31 insertions(+), 118 deletions(-) diff --git a/pkgs/development/compilers/ghc/8.2.2.nix b/pkgs/development/compilers/ghc/8.2.2.nix index 934e05465c7..10c0b46f8ff 100644 --- a/pkgs/development/compilers/ghc/8.2.2.nix +++ b/pkgs/development/compilers/ghc/8.2.2.nix @@ -1,6 +1,5 @@ { stdenv, targetPackages , buildPlatform, hostPlatform, targetPlatform -, selfPkgs, cross ? null # build-tools , bootPkgs, alex, happy, hscolour, llvm_39 @@ -29,7 +28,7 @@ let BuildFlavour = perf-cross ''; in -stdenv.mkDerivation (rec { +stdenv.mkDerivation rec { version = "8.2.2"; name = "${targetPrefix}ghc-${version}"; @@ -89,11 +88,6 @@ stdenv.mkDerivation (rec { passthru = { inherit bootPkgs targetPrefix; - } // stdenv.lib.optionalAttrs (targetPlatform != buildPlatform) { - crossCompiler = selfPkgs.ghc.override { - cross = targetPlatform; - bootPkgs = selfPkgs; - }; }; meta = { @@ -103,24 +97,4 @@ stdenv.mkDerivation (rec { inherit (ghc.meta) license platforms; }; -} // stdenv.lib.optionalAttrs (cross != null) { - configureFlags = [ - "CC=${stdenv.cc}/bin/${cross.config}-cc" - "LD=${stdenv.cc.bintools}/bin/${cross.config}-ld" - "AR=${stdenv.cc.bintools}/bin/${cross.config}-ar" - "NM=${stdenv.cc.bintools}/bin/${cross.config}-nm" - "RANLIB=${stdenv.cc.bintools}/bin/${cross.config}-ranlib" - "--target=${cross.config}" - "--enable-bootstrap-with-devel-snapshot" - ] ++ - # fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/ - stdenv.lib.optional (cross.config or null == "aarch64-apple-darwin14") "--disable-large-address-space"; - - configurePlatforms = []; - - passthru = { - inherit bootPkgs cross; - cc = "${stdenv.cc}/bin/${cross.config}-cc"; - ld = "${stdenv.cc}/bin/${cross.config}-ld"; - }; -}) +} diff --git a/pkgs/development/compilers/ghc/8.4.1.nix b/pkgs/development/compilers/ghc/8.4.1.nix index dd0be26da7c..498bba896ae 100644 --- a/pkgs/development/compilers/ghc/8.4.1.nix +++ b/pkgs/development/compilers/ghc/8.4.1.nix @@ -1,6 +1,5 @@ { stdenv, targetPackages , buildPlatform, hostPlatform, targetPlatform -, selfPkgs, cross ? null # build-tools , bootPkgs, alex, happy @@ -33,7 +32,7 @@ let BuildFlavour = perf-cross ''; in -stdenv.mkDerivation (rec { +stdenv.mkDerivation rec { inherit version rev; name = "${targetPrefix}ghc-${version}"; @@ -95,11 +94,6 @@ stdenv.mkDerivation (rec { passthru = { inherit bootPkgs targetPrefix; - } // stdenv.lib.optionalAttrs (targetPlatform != buildPlatform) { - crossCompiler = selfPkgs.ghc.override { - cross = targetPlatform; - bootPkgs = selfPkgs; - }; }; meta = { @@ -109,24 +103,4 @@ stdenv.mkDerivation (rec { inherit (ghc.meta) license platforms; }; -} // stdenv.lib.optionalAttrs (cross != null) { - configureFlags = [ - "CC=${stdenv.cc}/bin/${cross.config}-cc" - "LD=${stdenv.cc.bintools}/bin/${cross.config}-ld" - "AR=${stdenv.cc.bintools}/bin/${cross.config}-ar" - "NM=${stdenv.cc.bintools}/bin/${cross.config}-nm" - "RANLIB=${stdenv.cc.bintools}/bin/${cross.config}-ranlib" - "--target=${cross.config}" - "--enable-bootstrap-with-devel-snapshot" - ] ++ - # fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/ - stdenv.lib.optional (cross.config or null == "aarch64-apple-darwin14") "--disable-large-address-space"; - - configurePlatforms = []; - - passthru = { - inherit bootPkgs cross; - cc = "${stdenv.cc}/bin/${cross.config}-cc"; - ld = "${stdenv.cc}/bin/${cross.config}-ld"; - }; -}) +} diff --git a/pkgs/development/compilers/ghc/head.nix b/pkgs/development/compilers/ghc/head.nix index 6fb199b1a57..753c6bb5672 100644 --- a/pkgs/development/compilers/ghc/head.nix +++ b/pkgs/development/compilers/ghc/head.nix @@ -1,6 +1,5 @@ { stdenv, targetPackages , buildPlatform, hostPlatform, targetPlatform -, selfPkgs, cross ? null # build-tools , bootPkgs, alex, happy @@ -33,7 +32,7 @@ let BuildFlavour = perf-cross ''; in -stdenv.mkDerivation (rec { +stdenv.mkDerivation rec { inherit version rev; name = "${targetPrefix}ghc-${version}"; @@ -95,11 +94,6 @@ stdenv.mkDerivation (rec { passthru = { inherit bootPkgs targetPrefix; - } // stdenv.lib.optionalAttrs (targetPlatform != buildPlatform) { - crossCompiler = selfPkgs.ghc.override { - cross = targetPlatform; - bootPkgs = selfPkgs; - }; }; meta = { @@ -109,24 +103,4 @@ stdenv.mkDerivation (rec { inherit (ghc.meta) license platforms; }; -} // stdenv.lib.optionalAttrs (cross != null) { - configureFlags = [ - "CC=${stdenv.cc}/bin/${cross.config}-cc" - "LD=${stdenv.cc.bintools}/bin/${cross.config}-ld" - "AR=${stdenv.cc.bintools}/bin/${cross.config}-ar" - "NM=${stdenv.cc.bintools}/bin/${cross.config}-nm" - "RANLIB=${stdenv.cc.bintools}/bin/${cross.config}-ranlib" - "--target=${cross.config}" - "--enable-bootstrap-with-devel-snapshot" - ] ++ - # fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/ - stdenv.lib.optional (cross.config or null == "aarch64-apple-darwin14") "--disable-large-address-space"; - - configurePlatforms = []; - - passthru = { - inherit bootPkgs cross; - cc = "${stdenv.cc}/bin/${cross.config}-cc"; - ld = "${stdenv.cc}/bin/${cross.config}-ld"; - }; -}) +} diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index 8f035cfd575..aa0869cccc5 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -1,4 +1,7 @@ -{ pkgs, lib, newScope, stdenv, buildPlatform, targetPlatform, cabal-install }: +{ buildPackages, pkgs +, newScope, stdenv +, buildPlatform, targetPlatform +}: let # These are attributes in compiler and packages that don't support integer-simple. @@ -76,27 +79,22 @@ in rec { inherit (bootPkgs) hscolour alex happy; inherit buildPlatform targetPlatform; sphinx = pkgs.python3Packages.sphinx; - selfPkgs = packages.ghc822; }; ghc841 = callPackage ../development/compilers/ghc/8.4.1.nix rec { bootPkgs = packages.ghc821Binary; inherit (bootPkgs) alex happy; - inherit buildPlatform targetPlatform; - selfPkgs = packages.ghc841; }; ghcHEAD = callPackage ../development/compilers/ghc/head.nix rec { bootPkgs = packages.ghc821Binary; inherit (bootPkgs) alex happy; - inherit buildPlatform targetPlatform; - selfPkgs = packages.ghcHEAD; }; ghcjs = packages.ghc7103.callPackage ../development/compilers/ghcjs { bootPkgs = packages.ghc7103; - inherit cabal-install; + inherit (pkgs) cabal-install; }; ghcjsHEAD = packages.ghc802.callPackage ../development/compilers/ghcjs/head.nix { bootPkgs = packages.ghc802; - inherit cabal-install; + inherit (pkgs) cabal-install; }; ghcHaLVM240 = callPackage ../development/compilers/halvm/2.4.0.nix rec { bootPkgs = packages.ghc7103Binary; @@ -110,19 +108,17 @@ in rec { # The integer-simple attribute set contains all the GHC compilers # build with integer-simple instead of integer-gmp. - integer-simple = - let integerSimpleGhcNames = - pkgs.lib.filter (name: ! builtins.elem name integerSimpleExcludes) - (pkgs.lib.attrNames compiler); - integerSimpleGhcs = pkgs.lib.genAttrs integerSimpleGhcNames - (name: compiler."${name}".override { enableIntegerSimple = true; }); - in pkgs.recurseIntoAttrs (integerSimpleGhcs // { - ghcHEAD = integerSimpleGhcs.ghcHEAD.override { selfPkgs = packages.integer-simple.ghcHEAD; }; - }); - + integer-simple = let + integerSimpleGhcNames = pkgs.lib.filter + (name: ! builtins.elem name integerSimpleExcludes) + (pkgs.lib.attrNames compiler); + in pkgs.recurseIntoAttrs (pkgs.lib.genAttrs + integerSimpleGhcNames + (name: compiler."${name}".override { enableIntegerSimple = true; })); }; - packages = { + # Always get compilers from `buildPackages` + packages = let inherit (buildPackages.haskell) compiler; in { ghc7103 = callPackage ../development/haskell-modules { ghc = compiler.ghc7103; @@ -152,11 +148,6 @@ in rec { ghc = compiler.ghcHEAD; compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-head.nix { }; }; - # TODO Support for multiple variants here - ghcCross = callPackage ../development/haskell-modules { - ghc = compiler.ghcHEAD.crossCompiler; - compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-head.nix { }; - }; ghcjs = callPackage ../development/haskell-modules { ghc = compiler.ghcjs; compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-7.10.x.nix { }; @@ -174,16 +165,16 @@ in rec { # The integer-simple attribute set contains package sets for all the GHC compilers # using integer-simple instead of integer-gmp. - integer-simple = - let integerSimpleGhcNames = - pkgs.lib.filter (name: ! builtins.elem name integerSimpleExcludes) - (pkgs.lib.attrNames packages); - in pkgs.lib.genAttrs integerSimpleGhcNames (name: packages."${name}".override { - ghc = compiler.integer-simple."${name}"; - overrides = _self : _super : { - integer-simple = null; - integer-gmp = null; - }; + integer-simple = let + integerSimpleGhcNames = pkgs.lib.filter + (name: ! builtins.elem name integerSimpleExcludes) + (pkgs.lib.attrNames packages); + in pkgs.lib.genAttrs integerSimpleGhcNames (name: packages."${name}".override { + ghc = compiler.integer-simple."${name}"; + overrides = _self : _super : { + integer-simple = null; + integer-gmp = null; + }; }); }; From 398ac54593d1a1300f63d3a6d4869f66126b9e86 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 2 Feb 2017 11:44:11 -0500 Subject: [PATCH 06/18] ghc: Fix cross compilation to work with new system --- pkgs/development/compilers/ghc/7.10.3.nix | 88 +++++++++++++++++---- pkgs/development/compilers/ghc/7.8.4.nix | 60 +++++++++----- pkgs/development/compilers/ghc/8.0.2.nix | 87 +++++++++++++++++---- pkgs/development/compilers/ghc/8.2.2.nix | 95 +++++++++++++++++++---- pkgs/development/compilers/ghc/8.4.1.nix | 88 ++++++++++++++++++--- pkgs/development/compilers/ghc/head.nix | 88 ++++++++++++++++++--- pkgs/top-level/haskell-packages.nix | 10 +++ 7 files changed, 430 insertions(+), 86 deletions(-) diff --git a/pkgs/development/compilers/ghc/7.10.3.nix b/pkgs/development/compilers/ghc/7.10.3.nix index 9bf60dfca36..0d446baae82 100644 --- a/pkgs/development/compilers/ghc/7.10.3.nix +++ b/pkgs/development/compilers/ghc/7.10.3.nix @@ -2,15 +2,28 @@ , buildPlatform, hostPlatform, targetPlatform # build-tools -, bootPkgs, hscolour, llvm_35 +, bootPkgs, hscolour , coreutils, fetchurl, fetchpatch, perl , docbook_xsl, docbook_xml_dtd_45, docbook_xml_dtd_42, libxml2, libxslt -, libiconv ? null, ncurses +, libffi, libiconv ? null, ncurses + +, useLLVM ? !targetPlatform.isx86 +, # LLVM is conceptually a run-time-only depedendency, but for + # non-x86, we need LLVM to bootstrap later stages, so it becomes a + # build-time dependency too. + buildLlvmPackages, llvmPackages , # If enabled, GHC will be built with the GPL-free but slower integer-simple # library instead of the faster but GPLed integer-gmp library. enableIntegerSimple ? false, gmp ? null + +, # If enabled, use -fPIC when compiling static libs. + enableRelocatedStaticLibs ? targetPlatform != hostPlatform + +, # Whether to build dynamic libs for the standard library (on the target + # platform). Static libs are always built. + enableShared ? true }: assert !enableIntegerSimple -> gmp != null; @@ -28,12 +41,32 @@ let sha256 = "1j45z4kcd3w1rzm4hapap2xc16bbh942qnzzdbdjcwqznsccznf0"; }; - buildMK = stdenv.lib.optionalString enableIntegerSimple '' + buildMK = '' + DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"} + '' + stdenv.lib.optionalString enableIntegerSimple '' INTEGER_LIBRARY = integer-simple '' + stdenv.lib.optionalString (targetPlatform != hostPlatform) '' BuildFlavour = perf-cross + Stage1Only = YES + HADDOCK_DOCS = NO + '' + stdenv.lib.optionalString enableRelocatedStaticLibs '' + GhcLibHcOpts += -fPIC + GhcRtsHcOpts += -fPIC ''; + # Splicer will pull out correct variations + libDeps = platform: [ ncurses ] + ++ stdenv.lib.optional (!enableIntegerSimple) gmp + ++ stdenv.lib.optional (platform.libc == "libSystem") libiconv; + + toolsForTarget = + if hostPlatform == buildPlatform then + [ targetPackages.stdenv.cc ] ++ stdenv.lib.optional useLLVM llvmPackages.llvm + else assert targetPlatform == hostPlatform; # build != host == target + [ stdenv.cc ] ++ stdenv.lib.optional useLLVM buildLlvmPackages.llvm; + + targetCC = builtins.head toolsForTarget; + in stdenv.mkDerivation rec { @@ -45,17 +78,15 @@ stdenv.mkDerivation rec { sha256 = "1vsgmic8csczl62ciz51iv8nhrkm72lyhbz7p7id13y2w7fcx46g"; }; + enableParallelBuilding = true; + + outputs = [ "out" "doc" ]; + patches = [ docFixes ./relocation.patch ]; - buildInputs = [ ghc perl libxml2 libxslt docbook_xsl docbook_xml_dtd_45 docbook_xml_dtd_42 hscolour ] ++ stdenv.lib.optionals targetPlatform.isArm [ llvm_35 ]; - - enableParallelBuilding = true; - - outputs = [ "out" "doc" ]; - preConfigure = '' echo -n "${buildMK}" > mk/build.mk sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure @@ -65,16 +96,44 @@ stdenv.mkDerivation rec { export NIX_LDFLAGS+=" -no_dtrace_dof" ''; + # TODO(@Ericson2314): Always pass "--target" and always prefix. + configurePlatforms = [ "build" "host" ] + ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; + # `--with` flags for libraries needed for RTS linker configureFlags = [ - "--with-gcc=${stdenv.cc}/bin/cc" - "--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib" "--datadir=$doc/share/doc/ghc" - ] ++ stdenv.lib.optional (! enableIntegerSimple) [ + "--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib" + ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && ! enableIntegerSimple) [ "--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib" - ] ++ stdenv.lib.optional stdenv.isDarwin [ + ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.isDarwin) [ "--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib" + ] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [ + "--enable-bootstrap-with-devel-snapshot" + ] ++ 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/ + "--disable-large-address-space" ]; + # Hack to make sure we never to the relaxation `$PATH` and hooks support for + # compatability. This will be replaced with something clearer in a future + # masss-rebuild. + crossConfig = true; + + nativeBuildInputs = [ + ghc perl libxml2 libxslt docbook_xsl docbook_xml_dtd_45 docbook_xml_dtd_42 hscolour + ]; + + # For building runtime libs + depsBuildTarget = toolsForTarget; + + buildInputs = libDeps hostPlatform; + + propagatedBuildInputs = [ targetPackages.stdenv.cc ] + ++ stdenv.lib.optional useLLVM llvmPackages.llvm; + + depsTargetTarget = map stdenv.lib.getDev (libDeps targetPlatform); + depsTargetTargetPropagated = map (stdenv.lib.getOutput "out") (libDeps targetPlatform); + # required, because otherwise all symbols from HSffi.o are stripped, and # that in turn causes GHCi to abort stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols"; @@ -93,6 +152,8 @@ stdenv.mkDerivation rec { passthru = { inherit bootPkgs targetPrefix; + + inherit llvmPackages; }; meta = { @@ -101,4 +162,5 @@ stdenv.mkDerivation rec { maintainers = with stdenv.lib.maintainers; [ marcweber andres peti ]; inherit (ghc.meta) license platforms; }; + } diff --git a/pkgs/development/compilers/ghc/7.8.4.nix b/pkgs/development/compilers/ghc/7.8.4.nix index c17958ce4ef..c49f1026873 100644 --- a/pkgs/development/compilers/ghc/7.8.4.nix +++ b/pkgs/development/compilers/ghc/7.8.4.nix @@ -1,4 +1,7 @@ -{ stdenv, fetchurl, ghc, perl, ncurses, libiconv +{ stdenv, targetPackages + +, fetchurl, ghc, perl +, libffi, libiconv ? null, ncurses , # If enabled, GHC will be built with the GPL-free but slower integer-simple # library instead of the faster but GPLed integer-gmp library. @@ -9,22 +12,7 @@ assert stdenv.targetPlatform == stdenv.hostPlatform; assert !enableIntegerSimple -> gmp != null; -stdenv.mkDerivation (rec { - version = "7.8.4"; - name = "ghc-${version}"; - - src = fetchurl { - url = "https://downloads.haskell.org/~ghc/${version}/ghc-${version}-src.tar.xz"; - sha256 = "1i4254akbb4ym437rf469gc0m40bxm31blp6s1z1g15jmnacs6f3"; - }; - - patches = [ ./relocation.patch ]; - - buildInputs = [ ghc perl ncurses ] - ++ stdenv.lib.optional (!enableIntegerSimple) gmp; - - enableParallelBuilding = true; - +let buildMK = '' libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-includes="${ncurses.dev}/include" libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-libraries="${ncurses.out}/lib" @@ -40,6 +28,27 @@ stdenv.mkDerivation (rec { libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-includes="${gmp.dev}/include" ''); + # Splicer will pull out correct variations + libDeps = [ ncurses ] + ++ stdenv.lib.optional (!enableIntegerSimple) gmp + ++ stdenv.lib.optional (stdenv.hostPlatform.libc == "libSystem") libiconv; + +in + +stdenv.mkDerivation rec { + version = "7.8.4"; + name = "ghc-${version}"; + + src = fetchurl { + url = "http://www.haskell.org/ghc/dist/${version}/${name}-src.tar.xz"; + sha256 = "1i4254akbb4ym437rf469gc0m40bxm31blp6s1z1g15jmnacs6f3"; + }; + + enableParallelBuilding = true; + + patches = [ ./relocation.patch ] + ++ stdenv.lib.optional stdenv.isDarwin ./hpc-7.8.4.patch; + preConfigure = '' echo -n "${buildMK}" > mk/build.mk sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure @@ -49,6 +58,18 @@ stdenv.mkDerivation (rec { export NIX_LDFLAGS+=" -no_dtrace_dof" ''; + # TODO(@Ericson2314): Always pass "--target" and always prefix. + configurePlatforms = [ "build" "host" ]; + + nativeBuildInputs = [ ghc perl ]; + depsBuildTarget = [ targetPackages.stdenv.cc ]; + + buildInputs = libDeps; + propagatedBuildInputs = [ targetPackages.stdenv.cc ]; + + depsTargetTarget = map stdenv.lib.getDev libDeps; + depsTargetTargetPropagated = map (stdenv.lib.getOutput "out") libDeps; + # required, because otherwise all symbols from HSffi.o are stripped, and # that in turn causes GHCi to abort stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols"; @@ -62,7 +83,4 @@ stdenv.mkDerivation (rec { inherit (ghc.meta) license platforms; }; -} // stdenv.lib.optionalAttrs stdenv.isDarwin { - # https://ghc.haskell.org/trac/ghc/ticket/9762 - patches = [ ./hpc-7.8.4.patch ]; -}) +} diff --git a/pkgs/development/compilers/ghc/8.0.2.nix b/pkgs/development/compilers/ghc/8.0.2.nix index e3b168a8166..b1870908927 100644 --- a/pkgs/development/compilers/ghc/8.0.2.nix +++ b/pkgs/development/compilers/ghc/8.0.2.nix @@ -2,14 +2,27 @@ , buildPlatform, hostPlatform, targetPlatform # build-tools -, bootPkgs, hscolour, llvm_37 -, coreutils, fetchurl, fetchpatch, patchutils, perl, sphinx +, bootPkgs, hscolour +, coreutils, fetchurl, perl, sphinx -, libiconv ? null, ncurses +, libffi, libiconv ? null, ncurses + +, useLLVM ? !targetPlatform.isx86 +, # LLVM is conceptually a run-time-only depedendency, but for + # non-x86, we need LLVM to bootstrap later stages, so it becomes a + # build-time dependency too. + buildLlvmPackages, llvmPackages , # If enabled, GHC will be built with the GPL-free but slower integer-simple # library instead of the faster but GPLed integer-gmp library. enableIntegerSimple ? false, gmp ? null + +, # If enabled, use -fPIC when compiling static libs. + enableRelocatedStaticLibs ? targetPlatform != hostPlatform + +, # Whether to build dynamic libs for the standard library (on the target + # platform). Static libs are always built. + enableShared ? true }: assert !enableIntegerSimple -> gmp != null; @@ -22,11 +35,32 @@ let (targetPlatform != hostPlatform) "${targetPlatform.config}-"; - buildMK = stdenv.lib.optionalString enableIntegerSimple '' + buildMK = '' + DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"} + '' + stdenv.lib.optionalString enableIntegerSimple '' INTEGER_LIBRARY = integer-simple '' + stdenv.lib.optionalString (targetPlatform != hostPlatform) '' BuildFlavour = perf-cross + Stage1Only = YES + HADDOCK_DOCS = NO + '' + stdenv.lib.optionalString enableRelocatedStaticLibs '' + GhcLibHcOpts += -fPIC + GhcRtsHcOpts += -fPIC ''; + + # Splicer will pull out correct variations + libDeps = platform: [ ncurses ] + ++ stdenv.lib.optional (!enableIntegerSimple) gmp + ++ stdenv.lib.optional (platform.libc == "libSystem") libiconv; + + toolsForTarget = + if hostPlatform == buildPlatform then + [ targetPackages.stdenv.cc ] ++ stdenv.lib.optional useLLVM llvmPackages.llvm + else assert targetPlatform == hostPlatform; # build != host == target + [ stdenv.cc ] ++ stdenv.lib.optional useLLVM buildLlvmPackages.llvm; + + targetCC = builtins.head toolsForTarget; + in stdenv.mkDerivation rec { version = "8.0.2"; @@ -37,16 +71,14 @@ stdenv.mkDerivation rec { sha256 = "1c8qc4fhkycynk4g1f9hvk53dj6a1vvqi6bklqznns6hw59m8qhi"; }; - patches = [ ./ghc-gold-linker.patch ] - ++ stdenv.lib.optional stdenv.isLinux ./ghc-no-madv-free.patch - ++ stdenv.lib.optional stdenv.isDarwin ./ghc-8.0.2-no-cpp-warnings.patch; - - buildInputs = [ ghc perl hscolour sphinx ] ++ stdenv.lib.optionals (stdenv.isArm || stdenv.isAarch64) [ llvm_37 ]; - enableParallelBuilding = true; outputs = [ "out" "man" "doc" ]; + patches = [ ./ghc-gold-linker.patch ] + ++ stdenv.lib.optional stdenv.isLinux ./ghc-no-madv-free.patch + ++ stdenv.lib.optional stdenv.isDarwin ./ghc-8.0.2-no-cpp-warnings.patch; + preConfigure = '' echo -n "${buildMK}" > mk/build.mk sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure @@ -56,23 +88,48 @@ stdenv.mkDerivation rec { export NIX_LDFLAGS+=" -no_dtrace_dof" ''; + # TODO(@Ericson2314): Always pass "--target" and always prefix. + configurePlatforms = [ "build" "host" ] + ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; + # `--with` flags for libraries needed for RTS linker configureFlags = [ - "--with-gcc=${stdenv.cc}/bin/cc" - "--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib" "--datadir=$doc/share/doc/ghc" - ] ++ stdenv.lib.optional (! enableIntegerSimple) [ + "--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib" + ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && ! enableIntegerSimple) [ "--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib" - ] ++ stdenv.lib.optional stdenv.isDarwin [ + ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.isDarwin) [ "--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib" + ] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [ + "--enable-bootstrap-with-devel-snapshot" ] ++ 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/ "--disable-large-address-space" ]; + # Hack to make sure we never to the relaxation `$PATH` and hooks support for + # compatability. This will be replaced with something clearer in a future + # masss-rebuild. + crossConfig = true; + + nativeBuildInputs = [ ghc perl hscolour sphinx ]; + + # For building runtime libs + depsBuildTarget = toolsForTarget; + + buildInputs = libDeps hostPlatform; + + propagatedBuildInputs = [ targetPackages.stdenv.cc ] + ++ stdenv.lib.optional useLLVM llvmPackages.llvm; + + depsTargetTarget = map stdenv.lib.getDev (libDeps targetPlatform); + depsTargetTargetPropagated = map (stdenv.lib.getOutput "out") (libDeps targetPlatform); + # required, because otherwise all symbols from HSffi.o are stripped, and # that in turn causes GHCi to abort stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols"; + # 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 = '' paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"} @@ -89,6 +146,8 @@ stdenv.mkDerivation rec { passthru = { inherit bootPkgs targetPrefix; + + inherit llvmPackages; }; meta = { diff --git a/pkgs/development/compilers/ghc/8.2.2.nix b/pkgs/development/compilers/ghc/8.2.2.nix index 10c0b46f8ff..336d37bdb9f 100644 --- a/pkgs/development/compilers/ghc/8.2.2.nix +++ b/pkgs/development/compilers/ghc/8.2.2.nix @@ -2,14 +2,30 @@ , buildPlatform, hostPlatform, targetPlatform # build-tools -, bootPkgs, alex, happy, hscolour, llvm_39 +, bootPkgs, alex, happy, hscolour , autoconf, automake, coreutils, fetchurl, perl, python3, sphinx -, libiconv ? null, ncurses +, libffi, libiconv ? null, ncurses + +, useLLVM ? !targetPlatform.isx86 +, # LLVM is conceptually a run-time-only depedendency, but for + # non-x86, we need LLVM to bootstrap later stages, so it becomes a + # build-time dependency too. + buildLlvmPackages, llvmPackages , # If enabled, GHC will be built with the GPL-free but slower integer-simple # library instead of the faster but GPLed integer-gmp library. enableIntegerSimple ? false, gmp ? null + +, # If enabled, use -fPIC when compiling static libs. + enableRelocatedStaticLibs ? targetPlatform != hostPlatform + +, # Whether to build dynamic libs for the standard library (on the target + # platform). Static libs are always built. + enableShared ? + !(targetPlatform.isDarwin + # On iOS, dynamic linking is not supported + && (targetPlatform.isAarch64 || targetPlatform.isArm)) }: assert !enableIntegerSimple -> gmp != null; @@ -22,11 +38,34 @@ let (targetPlatform != hostPlatform) "${targetPlatform.config}-"; - buildMK = stdenv.lib.optionalString enableIntegerSimple '' + buildMK = '' + DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"} + '' + stdenv.lib.optionalString enableIntegerSimple '' INTEGER_LIBRARY = integer-simple '' + stdenv.lib.optionalString (targetPlatform != hostPlatform) '' BuildFlavour = perf-cross + Stage1Only = YES + HADDOCK_DOCS = NO + BUILD_SPHINX_HTML = NO + BUILD_SPHINX_PDF = NO + '' + stdenv.lib.optionalString enableRelocatedStaticLibs '' + GhcLibHcOpts += -fPIC + GhcRtsHcOpts += -fPIC ''; + + # Splicer will pull out correct variations + libDeps = platform: [ ncurses ] + ++ stdenv.lib.optional (!enableIntegerSimple) gmp + ++ stdenv.lib.optional (platform.libc == "libSystem") libiconv; + + toolsForTarget = + if hostPlatform == buildPlatform then + [ targetPackages.stdenv.cc ] ++ stdenv.lib.optional useLLVM llvmPackages.llvm + else assert targetPlatform == hostPlatform; # build != host == target + [ stdenv.cc ] ++ stdenv.lib.optional useLLVM buildLlvmPackages.llvm; + + targetCC = builtins.head toolsForTarget; + in stdenv.mkDerivation rec { version = "8.2.2"; @@ -37,6 +76,10 @@ stdenv.mkDerivation rec { sha256 = "1z05vkpaj54xdypmaml50hgsdpw29dhbs2r7magx0cm199iw73mv"; }; + enableParallelBuilding = true; + + outputs = [ "out" "doc" ]; + postPatch = "patchShebangs ."; preConfigure = '' @@ -48,28 +91,52 @@ stdenv.mkDerivation rec { export NIX_LDFLAGS+=" -no_dtrace_dof" ''; - buildInputs = [ alex autoconf automake ghc happy hscolour perl python3 sphinx ] ++ stdenv.lib.optionals (targetPlatform.isArm || targetPlatform.isAarch64) [ llvm_39 ]; - - enableParallelBuilding = true; - + # TODO(@Ericson2314): Always pass "--target" and always prefix. + configurePlatforms = [ "build" "host" ] + ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; + # `--with` flags for libraries needed for RTS linker configureFlags = [ - "CC=${stdenv.cc}/bin/cc" - "--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib" "--datadir=$doc/share/doc/ghc" - ] ++ stdenv.lib.optional (! enableIntegerSimple) [ + "--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib" + ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && ! enableIntegerSimple) [ "--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib" - ] ++ stdenv.lib.optional stdenv.isDarwin [ + ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.isDarwin) [ "--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib" - ] ++ stdenv.lib.optional stdenv.isArm [ + ] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [ + "--enable-bootstrap-with-devel-snapshot" + ] ++ 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/ + "--disable-large-address-space" + ] ++ stdenv.lib.optional targetPlatform.isArm [ "LD=${stdenv.cc}/bin/ld.gold" ]; + # Hack to make sure we never to the relaxation `$PATH` and hooks support for + # compatability. This will be replaced with something clearer in a future + # masss-rebuild. + crossConfig = true; + + nativeBuildInputs = [ alex autoconf automake ghc happy hscolour perl python3 sphinx ]; + + # For building runtime libs + depsBuildTarget = toolsForTarget; + + buildInputs = libDeps hostPlatform; + + propagatedBuildInputs = [ targetPackages.stdenv.cc ] + ++ stdenv.lib.optional useLLVM llvmPackages.llvm; + + depsTargetTarget = map stdenv.lib.getDev (libDeps targetPlatform); + depsTargetTargetPropagated = map (stdenv.lib.getOutput "out") (libDeps targetPlatform); + # required, because otherwise all symbols from HSffi.o are stripped, and # that in turn causes GHCi to abort stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols"; 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 = '' paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"} @@ -84,10 +151,10 @@ stdenv.mkDerivation rec { done ''; - outputs = [ "out" "doc" ]; - passthru = { inherit bootPkgs targetPrefix; + + inherit llvmPackages; }; meta = { diff --git a/pkgs/development/compilers/ghc/8.4.1.nix b/pkgs/development/compilers/ghc/8.4.1.nix index 498bba896ae..dc71139d218 100644 --- a/pkgs/development/compilers/ghc/8.4.1.nix +++ b/pkgs/development/compilers/ghc/8.4.1.nix @@ -5,12 +5,25 @@ , bootPkgs, alex, happy , autoconf, automake, coreutils, fetchgit, perl, python3 -, libiconv ? null, ncurses +, libffi, libiconv ? null, ncurses + +, useLLVM ? !targetPlatform.isx86 +, # LLVM is conceptually a run-time-only depedendency, but for + # non-x86, we need LLVM to bootstrap later stages, so it becomes a + # build-time dependency too. + buildLlvmPackages, llvmPackages , # If enabled, GHC will be built with the GPL-free but slower integer-simple # library instead of the faster but GPLed integer-gmp library. enableIntegerSimple ? false, gmp ? null +, # If enabled, use -fPIC when compiling static libs. + enableRelocatedStaticLibs ? targetPlatform != hostPlatform + +, # Whether to build dynamic libs for the standard library (on the target + # platform). Static libs are always built. + enableShared ? true + , version ? "8.4.20180115" }: @@ -26,11 +39,34 @@ let (targetPlatform != hostPlatform) "${targetPlatform.config}-"; - buildMK = stdenv.lib.optionalString enableIntegerSimple '' + buildMK = '' + DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"} + '' + stdenv.lib.optionalString enableIntegerSimple '' INTEGER_LIBRARY = integer-simple '' + stdenv.lib.optionalString (targetPlatform != hostPlatform) '' BuildFlavour = perf-cross + Stage1Only = YES + HADDOCK_DOCS = NO + BUILD_SPHINX_HTML = NO + BUILD_SPHINX_PDF = NO + '' + stdenv.lib.optionalString enableRelocatedStaticLibs '' + GhcLibHcOpts += -fPIC + GhcRtsHcOpts += -fPIC ''; + + # Splicer will pull out correct variations + libDeps = platform: [ ncurses ] + ++ stdenv.lib.optional (!enableIntegerSimple) gmp + ++ stdenv.lib.optional (platform.libc == "libSystem") libiconv; + + toolsForTarget = + if hostPlatform == buildPlatform then + [ targetPackages.stdenv.cc ] ++ stdenv.lib.optional useLLVM llvmPackages.llvm + else assert targetPlatform == hostPlatform; # build != host == target + [ stdenv.cc ] ++ stdenv.lib.optional useLLVM buildLlvmPackages.llvm; + + targetCC = builtins.head toolsForTarget; + in stdenv.mkDerivation rec { inherit version rev; @@ -42,6 +78,10 @@ stdenv.mkDerivation rec { sha256 = "06slymbsd7vsfp4hh40v7cxf7nmp0kvlni2wfq7ag5wlqh04slgs"; }; + enableParallelBuilding = true; + + outputs = [ "out" "doc" ]; + postPatch = "patchShebangs ."; preConfigure = '' @@ -56,26 +96,50 @@ stdenv.mkDerivation rec { export NIX_LDFLAGS+=" -no_dtrace_dof" ''; - buildInputs = [ ghc perl autoconf automake happy alex python3 ]; - - enableParallelBuilding = true; - + # TODO(@Ericson2314): Always pass "--target" and always prefix. + configurePlatforms = [ "build" "host" ] + ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; + # `--with` flags for libraries needed for RTS linker configureFlags = [ - "CC=${stdenv.cc}/bin/cc" - "--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib" "--datadir=$doc/share/doc/ghc" - ] ++ stdenv.lib.optional (! enableIntegerSimple) [ + "--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib" + ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && ! enableIntegerSimple) [ "--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib" - ] ++ stdenv.lib.optional stdenv.isDarwin [ + ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.isDarwin) [ "--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib" + ] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [ + "--enable-bootstrap-with-devel-snapshot" + ] ++ 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/ + "--disable-large-address-space" ]; + # Hack to make sure we never to the relaxation `$PATH` and hooks support for + # compatability. This will be replaced with something clearer in a future + # masss-rebuild. + crossConfig = true; + + nativeBuildInputs = [ ghc perl autoconf automake happy alex python3 ]; + + # For building runtime libs + depsBuildTarget = toolsForTarget; + + buildInputs = libDeps hostPlatform; + + propagatedBuildInputs = [ targetPackages.stdenv.cc ] + ++ stdenv.lib.optional useLLVM llvmPackages.llvm; + + depsTargetTarget = map stdenv.lib.getDev (libDeps targetPlatform); + depsTargetTargetPropagated = map (stdenv.lib.getOutput "out") (libDeps targetPlatform); + # required, because otherwise all symbols from HSffi.o are stripped, and # that in turn causes GHCi to abort stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols"; 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 = '' paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"} @@ -90,10 +154,10 @@ stdenv.mkDerivation rec { done ''; - outputs = [ "out" "doc" ]; - passthru = { inherit bootPkgs targetPrefix; + + inherit llvmPackages; }; meta = { diff --git a/pkgs/development/compilers/ghc/head.nix b/pkgs/development/compilers/ghc/head.nix index 753c6bb5672..466bccc18b3 100644 --- a/pkgs/development/compilers/ghc/head.nix +++ b/pkgs/development/compilers/ghc/head.nix @@ -5,12 +5,25 @@ , bootPkgs, alex, happy , autoconf, automake, coreutils, fetchgit, perl, python3 -, libiconv ? null, ncurses +, libffi, libiconv ? null, ncurses + +, useLLVM ? !targetPlatform.isx86 +, # LLVM is conceptually a run-time-only depedendency, but for + # non-x86, we need LLVM to bootstrap later stages, so it becomes a + # build-time dependency too. + buildLlvmPackages, llvmPackages , # If enabled, GHC will be built with the GPL-free but slower integer-simple # library instead of the faster but GPLed integer-gmp library. enableIntegerSimple ? false, gmp ? null +, # If enabled, use -fPIC when compiling static libs. + enableRelocatedStaticLibs ? targetPlatform != hostPlatform + +, # Whether to build dynamic libs for the standard library (on the target + # platform). Static libs are always built. + enableShared ? true + , version ? "8.5.20171209" }: @@ -26,11 +39,34 @@ let (targetPlatform != hostPlatform) "${targetPlatform.config}-"; - buildMK = stdenv.lib.optionalString enableIntegerSimple '' + buildMK = '' + DYNAMIC_GHC_PROGRAMS = ${if enableShared then "YES" else "NO"} + '' + stdenv.lib.optionalString enableIntegerSimple '' INTEGER_LIBRARY = integer-simple '' + stdenv.lib.optionalString (targetPlatform != hostPlatform) '' BuildFlavour = perf-cross + Stage1Only = YES + HADDOCK_DOCS = NO + BUILD_SPHINX_HTML = NO + BUILD_SPHINX_PDF = NO + '' + stdenv.lib.optionalString enableRelocatedStaticLibs '' + GhcLibHcOpts += -fPIC + GhcRtsHcOpts += -fPIC ''; + + # Splicer will pull out correct variations + libDeps = platform: [ ncurses ] + ++ stdenv.lib.optional (!enableIntegerSimple) gmp + ++ stdenv.lib.optional (platform.libc == "libSystem") libiconv; + + toolsForTarget = + if hostPlatform == buildPlatform then + [ targetPackages.stdenv.cc ] ++ stdenv.lib.optional useLLVM llvmPackages.llvm + else assert targetPlatform == hostPlatform; # build != host == target + [ stdenv.cc ] ++ stdenv.lib.optional useLLVM buildLlvmPackages.llvm; + + targetCC = builtins.head toolsForTarget; + in stdenv.mkDerivation rec { inherit version rev; @@ -42,6 +78,10 @@ stdenv.mkDerivation rec { sha256 = "19csad94sk0bw2nj97ppmnwh4c193jg0jmg5w2sx9rqm9ih4yg85"; }; + enableParallelBuilding = true; + + outputs = [ "out" "doc" ]; + postPatch = "patchShebangs ."; preConfigure = '' @@ -56,26 +96,50 @@ stdenv.mkDerivation rec { export NIX_LDFLAGS+=" -no_dtrace_dof" ''; - buildInputs = [ ghc perl autoconf automake happy alex python3 ]; - - enableParallelBuilding = true; - + # TODO(@Ericson2314): Always pass "--target" and always prefix. + configurePlatforms = [ "build" "host" ] + ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target"; + # `--with` flags for libraries needed for RTS linker configureFlags = [ - "CC=${stdenv.cc}/bin/cc" - "--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib" "--datadir=$doc/share/doc/ghc" - ] ++ stdenv.lib.optional (! enableIntegerSimple) [ + "--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib" + ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && ! enableIntegerSimple) [ "--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib" - ] ++ stdenv.lib.optional stdenv.isDarwin [ + ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.isDarwin) [ "--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib" + ] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [ + "--enable-bootstrap-with-devel-snapshot" + ] ++ 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/ + "--disable-large-address-space" ]; + # Hack to make sure we never to the relaxation `$PATH` and hooks support for + # compatability. This will be replaced with something clearer in a future + # masss-rebuild. + crossConfig = true; + + nativeBuildInputs = [ ghc perl autoconf automake happy alex python3 ]; + + # For building runtime libs + depsBuildTarget = toolsForTarget; + + buildInputs = libDeps hostPlatform; + + propagatedBuildInputs = [ targetPackages.stdenv.cc ] + ++ stdenv.lib.optional useLLVM llvmPackages.llvm; + + depsTargetTarget = map stdenv.lib.getDev (libDeps targetPlatform); + depsTargetTargetPropagated = map (stdenv.lib.getOutput "out") (libDeps targetPlatform); + # required, because otherwise all symbols from HSffi.o are stripped, and # that in turn causes GHCi to abort stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!targetPlatform.isDarwin) "--keep-file-symbols"; 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 = '' paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"} @@ -90,10 +154,10 @@ stdenv.mkDerivation rec { done ''; - outputs = [ "out" "doc" ]; - passthru = { inherit bootPkgs targetPrefix; + + inherit llvmPackages; }; meta = { diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index aa0869cccc5..bac386c48f4 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -68,25 +68,35 @@ in rec { ghc7103 = callPackage ../development/compilers/ghc/7.10.3.nix rec { bootPkgs = packages.ghc7103Binary; inherit (bootPkgs) hscolour; + buildLlvmPackages = buildPackages.llvmPackages_35; + llvmPackages = pkgs.llvmPackages_35; }; ghc802 = callPackage ../development/compilers/ghc/8.0.2.nix rec { bootPkgs = packages.ghc7103Binary; inherit (bootPkgs) hscolour; sphinx = pkgs.python27Packages.sphinx; + buildLlvmPackages = buildPackages.llvmPackages_37; + llvmPackages = pkgs.llvmPackages_37; }; ghc822 = callPackage ../development/compilers/ghc/8.2.2.nix rec { bootPkgs = packages.ghc821Binary; inherit (bootPkgs) hscolour alex happy; inherit buildPlatform targetPlatform; sphinx = pkgs.python3Packages.sphinx; + buildLlvmPackages = buildPackages.llvmPackages_39; + llvmPackages = pkgs.llvmPackages_39; }; ghc841 = callPackage ../development/compilers/ghc/8.4.1.nix rec { bootPkgs = packages.ghc821Binary; inherit (bootPkgs) alex happy; + buildLlvmPackages = buildPackages.llvmPackages_5; + llvmPackages = pkgs.llvmPackages_5; }; ghcHEAD = callPackage ../development/compilers/ghc/head.nix rec { bootPkgs = packages.ghc821Binary; inherit (bootPkgs) alex happy; + buildLlvmPackages = buildPackages.llvmPackages_5; + llvmPackages = pkgs.llvmPackages_5; }; ghcjs = packages.ghc7103.callPackage ../development/compilers/ghcjs { bootPkgs = packages.ghc7103; From e760de810824a92297387e629ba67bb22db2929a Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 18 Sep 2017 23:56:47 -0400 Subject: [PATCH 07/18] ghc: Predicate libiconv on not using glibc instead of Darwin --- pkgs/development/compilers/ghc/7.10.3.nix | 4 ++-- pkgs/development/compilers/ghc/7.8.4.nix | 4 ++-- pkgs/development/compilers/ghc/8.0.2.nix | 4 ++-- pkgs/development/compilers/ghc/8.2.2.nix | 4 ++-- pkgs/development/compilers/ghc/8.4.1.nix | 4 ++-- pkgs/development/compilers/ghc/head.nix | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pkgs/development/compilers/ghc/7.10.3.nix b/pkgs/development/compilers/ghc/7.10.3.nix index 0d446baae82..4a30d052fc7 100644 --- a/pkgs/development/compilers/ghc/7.10.3.nix +++ b/pkgs/development/compilers/ghc/7.10.3.nix @@ -57,7 +57,7 @@ let # Splicer will pull out correct variations libDeps = platform: [ ncurses ] ++ stdenv.lib.optional (!enableIntegerSimple) gmp - ++ stdenv.lib.optional (platform.libc == "libSystem") libiconv; + ++ stdenv.lib.optional (platform.libc != "glibc") libiconv; toolsForTarget = if hostPlatform == buildPlatform then @@ -105,7 +105,7 @@ stdenv.mkDerivation rec { "--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib" ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && ! enableIntegerSimple) [ "--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib" - ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.isDarwin) [ + ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.libc != "glibc") [ "--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib" ] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [ "--enable-bootstrap-with-devel-snapshot" diff --git a/pkgs/development/compilers/ghc/7.8.4.nix b/pkgs/development/compilers/ghc/7.8.4.nix index c49f1026873..eb7e7166765 100644 --- a/pkgs/development/compilers/ghc/7.8.4.nix +++ b/pkgs/development/compilers/ghc/7.8.4.nix @@ -17,7 +17,7 @@ let libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-includes="${ncurses.dev}/include" libraries/terminfo_CONFIGURE_OPTS += --configure-option=--with-curses-libraries="${ncurses.out}/lib" DYNAMIC_BY_DEFAULT = NO - ${stdenv.lib.optionalString stdenv.isDarwin '' + ${stdenv.lib.optionalString (stdenv.hostPlatform.libc != "glibc") '' libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-includes="${libiconv}/include" libraries/base_CONFIGURE_OPTS += --configure-option=--with-iconv-libraries="${libiconv}/lib" ''} @@ -31,7 +31,7 @@ let # Splicer will pull out correct variations libDeps = [ ncurses ] ++ stdenv.lib.optional (!enableIntegerSimple) gmp - ++ stdenv.lib.optional (stdenv.hostPlatform.libc == "libSystem") libiconv; + ++ stdenv.lib.optional (stdenv.hostPlatform.libc != "glibc") libiconv; in diff --git a/pkgs/development/compilers/ghc/8.0.2.nix b/pkgs/development/compilers/ghc/8.0.2.nix index b1870908927..d72b70b2e4a 100644 --- a/pkgs/development/compilers/ghc/8.0.2.nix +++ b/pkgs/development/compilers/ghc/8.0.2.nix @@ -51,7 +51,7 @@ let # Splicer will pull out correct variations libDeps = platform: [ ncurses ] ++ stdenv.lib.optional (!enableIntegerSimple) gmp - ++ stdenv.lib.optional (platform.libc == "libSystem") libiconv; + ++ stdenv.lib.optional (platform.libc != "glibc") libiconv; toolsForTarget = if hostPlatform == buildPlatform then @@ -97,7 +97,7 @@ stdenv.mkDerivation rec { "--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib" ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && ! enableIntegerSimple) [ "--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib" - ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.isDarwin) [ + ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.libc != "glibc") [ "--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib" ] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [ "--enable-bootstrap-with-devel-snapshot" diff --git a/pkgs/development/compilers/ghc/8.2.2.nix b/pkgs/development/compilers/ghc/8.2.2.nix index 336d37bdb9f..d81d8750807 100644 --- a/pkgs/development/compilers/ghc/8.2.2.nix +++ b/pkgs/development/compilers/ghc/8.2.2.nix @@ -56,7 +56,7 @@ let # Splicer will pull out correct variations libDeps = platform: [ ncurses ] ++ stdenv.lib.optional (!enableIntegerSimple) gmp - ++ stdenv.lib.optional (platform.libc == "libSystem") libiconv; + ++ stdenv.lib.optional (platform.libc != "glibc") libiconv; toolsForTarget = if hostPlatform == buildPlatform then @@ -100,7 +100,7 @@ stdenv.mkDerivation rec { "--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib" ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && ! enableIntegerSimple) [ "--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib" - ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.isDarwin) [ + ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.libc != "glibc") [ "--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib" ] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [ "--enable-bootstrap-with-devel-snapshot" diff --git a/pkgs/development/compilers/ghc/8.4.1.nix b/pkgs/development/compilers/ghc/8.4.1.nix index dc71139d218..b91faa9db62 100644 --- a/pkgs/development/compilers/ghc/8.4.1.nix +++ b/pkgs/development/compilers/ghc/8.4.1.nix @@ -57,7 +57,7 @@ let # Splicer will pull out correct variations libDeps = platform: [ ncurses ] ++ stdenv.lib.optional (!enableIntegerSimple) gmp - ++ stdenv.lib.optional (platform.libc == "libSystem") libiconv; + ++ stdenv.lib.optional (platform.libc != "glibc") libiconv; toolsForTarget = if hostPlatform == buildPlatform then @@ -105,7 +105,7 @@ stdenv.mkDerivation rec { "--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib" ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && ! enableIntegerSimple) [ "--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib" - ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.isDarwin) [ + ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.libc != "glibc") [ "--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib" ] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [ "--enable-bootstrap-with-devel-snapshot" diff --git a/pkgs/development/compilers/ghc/head.nix b/pkgs/development/compilers/ghc/head.nix index 466bccc18b3..bf23272156f 100644 --- a/pkgs/development/compilers/ghc/head.nix +++ b/pkgs/development/compilers/ghc/head.nix @@ -57,7 +57,7 @@ let # Splicer will pull out correct variations libDeps = platform: [ ncurses ] ++ stdenv.lib.optional (!enableIntegerSimple) gmp - ++ stdenv.lib.optional (platform.libc == "libSystem") libiconv; + ++ stdenv.lib.optional (platform.libc != "glibc") libiconv; toolsForTarget = if hostPlatform == buildPlatform then @@ -105,7 +105,7 @@ stdenv.mkDerivation rec { "--with-curses-includes=${ncurses.dev}/include" "--with-curses-libraries=${ncurses.out}/lib" ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && ! enableIntegerSimple) [ "--with-gmp-includes=${gmp.dev}/include" "--with-gmp-libraries=${gmp.out}/lib" - ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.isDarwin) [ + ] ++ stdenv.lib.optional (targetPlatform == hostPlatform && hostPlatform.libc != "glibc") [ "--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib" ] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [ "--enable-bootstrap-with-devel-snapshot" From bd0de2f1cb395e338e45cac562d8f86095fcdc1e Mon Sep 17 00:00:00 2001 From: Ryan Trinkle Date: Thu, 21 Sep 2017 18:25:46 -0400 Subject: [PATCH 08/18] ghc: Fix env vars and configure flags to be weird GHC currently handles this stuff in a quite non-standard way, basically taking prog var `FOO` to mean `FOO_FROM_TARGET`. It's because it (wrongly) thinks from stage 2's perspective. --- pkgs/development/compilers/ghc/7.10.3.nix | 15 +++++++++++++++ pkgs/development/compilers/ghc/8.0.2.nix | 15 +++++++++++++++ pkgs/development/compilers/ghc/8.2.2.nix | 16 ++++++++++++++++ pkgs/development/compilers/ghc/8.4.1.nix | 16 ++++++++++++++++ pkgs/development/compilers/ghc/head.nix | 16 ++++++++++++++++ 5 files changed, 78 insertions(+) diff --git a/pkgs/development/compilers/ghc/7.10.3.nix b/pkgs/development/compilers/ghc/7.10.3.nix index 4a30d052fc7..63f73c9c58f 100644 --- a/pkgs/development/compilers/ghc/7.10.3.nix +++ b/pkgs/development/compilers/ghc/7.10.3.nix @@ -87,7 +87,22 @@ stdenv.mkDerivation rec { ./relocation.patch ]; + # GHC is a bit confused on its cross terminology. preConfigure = '' + for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do + export "''${env#TARGET_}=''${!env}" + done + # GHC is a bit confused on its cross terminology, as these would normally be + # the *host* tools. + export CC="${targetCC}/bin/${targetCC.targetPrefix}cc" + export CXX="${targetCC}/bin/${targetCC.targetPrefix}cxx" + export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld" + export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as" + export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar" + export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm" + export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib" + export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf" + export STRIP="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}strip" echo -n "${buildMK}" > mk/build.mk sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' diff --git a/pkgs/development/compilers/ghc/8.0.2.nix b/pkgs/development/compilers/ghc/8.0.2.nix index d72b70b2e4a..36e2fd0d4c0 100644 --- a/pkgs/development/compilers/ghc/8.0.2.nix +++ b/pkgs/development/compilers/ghc/8.0.2.nix @@ -79,7 +79,22 @@ stdenv.mkDerivation rec { ++ stdenv.lib.optional stdenv.isLinux ./ghc-no-madv-free.patch ++ stdenv.lib.optional stdenv.isDarwin ./ghc-8.0.2-no-cpp-warnings.patch; + # GHC is a bit confused on its cross terminology. preConfigure = '' + for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do + export "''${env#TARGET_}=''${!env}" + done + # GHC is a bit confused on its cross terminology, as these would normally be + # the *host* tools. + export CC="${targetCC}/bin/${targetCC.targetPrefix}cc" + export CXX="${targetCC}/bin/${targetCC.targetPrefix}cxx" + export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld" + export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as" + export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar" + export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm" + export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib" + export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf" + export STRIP="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}strip" echo -n "${buildMK}" > mk/build.mk sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' diff --git a/pkgs/development/compilers/ghc/8.2.2.nix b/pkgs/development/compilers/ghc/8.2.2.nix index d81d8750807..22a8d142f41 100644 --- a/pkgs/development/compilers/ghc/8.2.2.nix +++ b/pkgs/development/compilers/ghc/8.2.2.nix @@ -82,7 +82,23 @@ stdenv.mkDerivation rec { postPatch = "patchShebangs ."; + # GHC is a bit confused on its cross terminology. preConfigure = '' + for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do + export "''${env#TARGET_}=''${!env}" + done + # GHC is a bit confused on its cross terminology, as these would normally be + # the *host* tools. + export CC="${targetCC}/bin/${targetCC.targetPrefix}cc" + export CXX="${targetCC}/bin/${targetCC.targetPrefix}cxx" + export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld" + export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as" + export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar" + export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm" + export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib" + export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf" + export STRIP="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}strip" + echo -n "${buildMK}" > mk/build.mk sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' diff --git a/pkgs/development/compilers/ghc/8.4.1.nix b/pkgs/development/compilers/ghc/8.4.1.nix index b91faa9db62..f994d1b1a66 100644 --- a/pkgs/development/compilers/ghc/8.4.1.nix +++ b/pkgs/development/compilers/ghc/8.4.1.nix @@ -84,7 +84,23 @@ stdenv.mkDerivation rec { postPatch = "patchShebangs ."; + # GHC is a bit confused on its cross terminology. preConfigure = '' + for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do + export "''${env#TARGET_}=''${!env}" + done + # GHC is a bit confused on its cross terminology, as these would normally be + # the *host* tools. + export CC="${targetCC}/bin/${targetCC.targetPrefix}cc" + export CXX="${targetCC}/bin/${targetCC.targetPrefix}cxx" + export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld" + export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as" + export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar" + export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm" + export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib" + export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf" + export STRIP="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}strip" + echo -n "${buildMK}" > mk/build.mk echo ${version} >VERSION echo ${rev} >GIT_COMMIT_ID diff --git a/pkgs/development/compilers/ghc/head.nix b/pkgs/development/compilers/ghc/head.nix index bf23272156f..e4fe62e6b27 100644 --- a/pkgs/development/compilers/ghc/head.nix +++ b/pkgs/development/compilers/ghc/head.nix @@ -84,7 +84,23 @@ stdenv.mkDerivation rec { postPatch = "patchShebangs ."; + # GHC is a bit confused on its cross terminology. preConfigure = '' + for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do + export "''${env#TARGET_}=''${!env}" + done + # GHC is a bit confused on its cross terminology, as these would normally be + # the *host* tools. + export CC="${targetCC}/bin/${targetCC.targetPrefix}cc" + export CXX="${targetCC}/bin/${targetCC.targetPrefix}cxx" + export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld" + export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as" + export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar" + export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm" + export RANLIB="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ranlib" + export READELF="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}readelf" + export STRIP="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}strip" + echo -n "${buildMK}" > mk/build.mk echo ${version} >VERSION echo ${rev} >GIT_COMMIT_ID From af03b7746a549c3cfbf5052d501dc382b805d8e3 Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Sun, 7 Jan 2018 11:05:53 -0500 Subject: [PATCH 09/18] ghc 8.2.2 & head: Work around ARM bugs in BFD ld by using gold --- pkgs/development/compilers/ghc/8.2.2.nix | 9 ++++++--- pkgs/development/compilers/ghc/8.4.1.nix | 7 ++++++- pkgs/development/compilers/ghc/head.nix | 7 ++++++- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/pkgs/development/compilers/ghc/8.2.2.nix b/pkgs/development/compilers/ghc/8.2.2.nix index 22a8d142f41..f4e2c557720 100644 --- a/pkgs/development/compilers/ghc/8.2.2.nix +++ b/pkgs/development/compilers/ghc/8.2.2.nix @@ -91,7 +91,8 @@ stdenv.mkDerivation rec { # the *host* tools. export CC="${targetCC}/bin/${targetCC.targetPrefix}cc" export CXX="${targetCC}/bin/${targetCC.targetPrefix}cxx" - export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld" + # Use gold to work around https://sourceware.org/bugzilla/show_bug.cgi?id=16177 + export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${stdenv.lib.optionalString targetPlatform.isArm ".gold"}" export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as" export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar" export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm" @@ -120,11 +121,13 @@ stdenv.mkDerivation rec { "--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib" ] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [ "--enable-bootstrap-with-devel-snapshot" + ] ++ stdenv.lib.optionals (targetPlatform.isArm) [ + "CFLAGS=-fuse-ld=gold" + "CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold" + "CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold" ] ++ 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/ "--disable-large-address-space" - ] ++ stdenv.lib.optional targetPlatform.isArm [ - "LD=${stdenv.cc}/bin/ld.gold" ]; # Hack to make sure we never to the relaxation `$PATH` and hooks support for diff --git a/pkgs/development/compilers/ghc/8.4.1.nix b/pkgs/development/compilers/ghc/8.4.1.nix index f994d1b1a66..6eafc90fa18 100644 --- a/pkgs/development/compilers/ghc/8.4.1.nix +++ b/pkgs/development/compilers/ghc/8.4.1.nix @@ -93,7 +93,8 @@ stdenv.mkDerivation rec { # the *host* tools. export CC="${targetCC}/bin/${targetCC.targetPrefix}cc" export CXX="${targetCC}/bin/${targetCC.targetPrefix}cxx" - export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld" + # Use gold to work around https://sourceware.org/bugzilla/show_bug.cgi?id=16177 + export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${stdenv.lib.optionalString targetPlatform.isArm ".gold"}" export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as" export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar" export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm" @@ -125,6 +126,10 @@ stdenv.mkDerivation rec { "--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib" ] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [ "--enable-bootstrap-with-devel-snapshot" + ] ++ stdenv.lib.optionals (targetPlatform.isArm) [ + "CFLAGS=-fuse-ld=gold" + "CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold" + "CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold" ] ++ 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/ "--disable-large-address-space" diff --git a/pkgs/development/compilers/ghc/head.nix b/pkgs/development/compilers/ghc/head.nix index e4fe62e6b27..3cda1b7b6e4 100644 --- a/pkgs/development/compilers/ghc/head.nix +++ b/pkgs/development/compilers/ghc/head.nix @@ -93,7 +93,8 @@ stdenv.mkDerivation rec { # the *host* tools. export CC="${targetCC}/bin/${targetCC.targetPrefix}cc" export CXX="${targetCC}/bin/${targetCC.targetPrefix}cxx" - export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld" + # Use gold to work around https://sourceware.org/bugzilla/show_bug.cgi?id=16177 + export LD="${targetCC.bintools}/bin/${targetCC.bintools.targetPrefix}ld${stdenv.lib.optionalString targetPlatform.isArm ".gold"}" export AS="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}as" export AR="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}ar" export NM="${targetCC.bintools.bintools}/bin/${targetCC.bintools.targetPrefix}nm" @@ -125,6 +126,10 @@ stdenv.mkDerivation rec { "--with-iconv-includes=${libiconv}/include" "--with-iconv-libraries=${libiconv}/lib" ] ++ stdenv.lib.optionals (targetPlatform != hostPlatform) [ "--enable-bootstrap-with-devel-snapshot" + ] ++ stdenv.lib.optionals (targetPlatform.isArm) [ + "CFLAGS=-fuse-ld=gold" + "CONF_GCC_LINKER_OPTS_STAGE1=-fuse-ld=gold" + "CONF_GCC_LINKER_OPTS_STAGE2=-fuse-ld=gold" ] ++ 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/ "--disable-large-address-space" From 60f45a2af12abb27d6c3c55d3685cf405b39c8ff Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 15 Sep 2017 15:13:37 -0400 Subject: [PATCH 10/18] ghc 8.0.2: Patch Cabal so --extra-*-dirs works right --- pkgs/development/compilers/ghc/8.0.2.nix | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/pkgs/development/compilers/ghc/8.0.2.nix b/pkgs/development/compilers/ghc/8.0.2.nix index 36e2fd0d4c0..1625d6d0ef0 100644 --- a/pkgs/development/compilers/ghc/8.0.2.nix +++ b/pkgs/development/compilers/ghc/8.0.2.nix @@ -3,7 +3,7 @@ # build-tools , bootPkgs, hscolour -, coreutils, fetchurl, perl, sphinx +, coreutils, fetchpatch, fetchurl, perl, sphinx , libffi, libiconv ? null, ncurses @@ -75,8 +75,15 @@ stdenv.mkDerivation rec { outputs = [ "out" "man" "doc" ]; - patches = [ ./ghc-gold-linker.patch ] - ++ stdenv.lib.optional stdenv.isLinux ./ghc-no-madv-free.patch + patches = [ + ./ghc-gold-linker.patch + (fetchpatch { # Unreleased 1.24.x commit + url = "https://github.com/haskell/cabal/commit/6394cb0b6eba91a8692a3d04b2b56935aed7cccd.patch"; + sha256 = "14xxjg0nb1j1pw0riac3v385ka92qhxxblfmwyvbghz7kry6axy0"; + stripLen = 1; + extraPrefix = "libraries/Cabal/"; + }) + ] ++ stdenv.lib.optional stdenv.isLinux ./ghc-no-madv-free.patch ++ stdenv.lib.optional stdenv.isDarwin ./ghc-8.0.2-no-cpp-warnings.patch; # GHC is a bit confused on its cross terminology. From 23c29ebc9041c2bfd91f3b680c68ad81430a3ee2 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 22 Sep 2017 12:24:35 -0400 Subject: [PATCH 11/18] ghc 8.2.2: Add bgamari's STRIP detection fix --- pkgs/development/compilers/ghc/8.2.2.nix | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/pkgs/development/compilers/ghc/8.2.2.nix b/pkgs/development/compilers/ghc/8.2.2.nix index f4e2c557720..105f80b4eff 100644 --- a/pkgs/development/compilers/ghc/8.2.2.nix +++ b/pkgs/development/compilers/ghc/8.2.2.nix @@ -3,7 +3,7 @@ # build-tools , bootPkgs, alex, happy, hscolour -, autoconf, automake, coreutils, fetchurl, perl, python3, sphinx +, autoconf, autoreconfHook, automake, coreutils, fetchurl, fetchpatch, perl, python3, sphinx , libffi, libiconv ? null, ncurses @@ -80,6 +80,13 @@ stdenv.mkDerivation rec { outputs = [ "out" "doc" ]; + patches = [ + (fetchpatch { # Fix STRIP to be substituted from configure + url = "https://git.haskell.org/ghc.git/commitdiff_plain/2fc8ce5f0c8c81771c26266ac0b150ca9b75c5f3"; + sha256 = "03253ci40np1v6k0wmi4aypj3nmj3rdyvb1k6rwqipb30nfc719f"; + }) + ]; + postPatch = "patchShebangs ."; # GHC is a bit confused on its cross terminology. @@ -135,7 +142,7 @@ stdenv.mkDerivation rec { # masss-rebuild. crossConfig = true; - nativeBuildInputs = [ alex autoconf automake ghc happy hscolour perl python3 sphinx ]; + nativeBuildInputs = [ alex autoconf autoreconfHook automake ghc happy hscolour perl python3 sphinx ]; # For building runtime libs depsBuildTarget = toolsForTarget; From a2516efb2638896df2f02e42b9f0978845db2e9f Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 18 Jan 2018 11:51:00 -0500 Subject: [PATCH 12/18] ghcHEAD: Bump version ghc-8.5.20180118 --- pkgs/development/compilers/ghc/head.nix | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/pkgs/development/compilers/ghc/head.nix b/pkgs/development/compilers/ghc/head.nix index 3cda1b7b6e4..9b40a0ebd6e 100644 --- a/pkgs/development/compilers/ghc/head.nix +++ b/pkgs/development/compilers/ghc/head.nix @@ -24,7 +24,7 @@ # platform). Static libs are always built. enableShared ? true -, version ? "8.5.20171209" +, version ? "8.5.20180118" }: assert !enableIntegerSimple -> gmp != null; @@ -32,8 +32,6 @@ assert !enableIntegerSimple -> gmp != null; let inherit (bootPkgs) ghc; - rev = "4335c07ca7e64624819b22644d7591853826bd75"; - # TODO(@Ericson2314) Make unconditional targetPrefix = stdenv.lib.optionalString (targetPlatform != hostPlatform) @@ -69,13 +67,14 @@ let in stdenv.mkDerivation rec { - inherit version rev; + inherit version; + inherit (src) rev; name = "${targetPrefix}ghc-${version}"; src = fetchgit { url = "git://git.haskell.org/ghc.git"; - inherit rev; - sha256 = "19csad94sk0bw2nj97ppmnwh4c193jg0jmg5w2sx9rqm9ih4yg85"; + rev = "e1d4140be4d2a1508015093b69e1ef53516e1eb6"; + sha256 = "1gdcr10dd968d40qgljdwx9vfkva3yrvjm9a4nis7whaaac3ag58"; }; enableParallelBuilding = true; @@ -104,7 +103,7 @@ stdenv.mkDerivation rec { echo -n "${buildMK}" > mk/build.mk echo ${version} >VERSION - echo ${rev} >GIT_COMMIT_ID + echo ${src.rev} >GIT_COMMIT_ID ./boot sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' From 8560c025bc995577c9f9399fe8f9e7c1db5cd75f Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 19 Jan 2018 11:17:46 -0500 Subject: [PATCH 13/18] ghc 8.4.1: Reformat to move rev into src --- pkgs/development/compilers/ghc/8.4.1.nix | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/pkgs/development/compilers/ghc/8.4.1.nix b/pkgs/development/compilers/ghc/8.4.1.nix index 6eafc90fa18..2fb5a0d404a 100644 --- a/pkgs/development/compilers/ghc/8.4.1.nix +++ b/pkgs/development/compilers/ghc/8.4.1.nix @@ -32,8 +32,6 @@ assert !enableIntegerSimple -> gmp != null; let inherit (bootPkgs) ghc; - rev = "3e3a096885c0fcd0703edbeffb4e47f5cbd8f4cc"; - # TODO(@Ericson2314) Make unconditional targetPrefix = stdenv.lib.optionalString (targetPlatform != hostPlatform) @@ -69,12 +67,13 @@ let in stdenv.mkDerivation rec { - inherit version rev; + inherit version; + inherit (src) rev; name = "${targetPrefix}ghc-${version}"; src = fetchgit { url = "git://git.haskell.org/ghc.git"; - inherit rev; + rev = "3e3a096885c0fcd0703edbeffb4e47f5cbd8f4cc"; sha256 = "06slymbsd7vsfp4hh40v7cxf7nmp0kvlni2wfq7ag5wlqh04slgs"; }; @@ -104,7 +103,7 @@ stdenv.mkDerivation rec { echo -n "${buildMK}" > mk/build.mk echo ${version} >VERSION - echo ${rev} >GIT_COMMIT_ID + echo ${src.rev} >GIT_COMMIT_ID ./boot sed -i -e 's|-isysroot /Developer/SDKs/MacOSX10.5.sdk||' configure '' + stdenv.lib.optionalString (!stdenv.isDarwin) '' From 81553124cf32e9d515da5f1c2f1b07e09886d8cf Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 4 Jan 2018 16:18:02 -0500 Subject: [PATCH 14/18] haskell infra: nativeGhc != ghc.bootPkgs.ghc There's no reason to wait for non-binary native to *build* cross ghc, but we want a nix-built GHC for Setup.hs or things won't work. --- pkgs/development/haskell-modules/default.nix | 3 +- .../haskell-modules/generic-builder.nix | 21 +++++----- .../haskell-modules/make-package-set.nix | 15 +++---- pkgs/top-level/haskell-packages.nix | 40 ++++++++++++------- 4 files changed, 47 insertions(+), 32 deletions(-) diff --git a/pkgs/development/haskell-modules/default.nix b/pkgs/development/haskell-modules/default.nix index 4db418a7775..d528230b77c 100644 --- a/pkgs/development/haskell-modules/default.nix +++ b/pkgs/development/haskell-modules/default.nix @@ -1,4 +1,5 @@ { pkgs, stdenv, lib, haskellLib, ghc, all-cabal-hashes +, buildHaskellPackages , compilerConfig ? (self: super: {}) , packageSetConfig ? (self: super: {}) , overrides ? (self: super: {}) @@ -14,7 +15,7 @@ let haskellPackages = pkgs.callPackage makePackageSet { package-set = initialPackages; - inherit stdenv haskellLib ghc extensible-self; + inherit stdenv haskellLib ghc buildHaskellPackages extensible-self; }; commonConfiguration = configurationCommon { inherit pkgs haskellLib; }; diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index ad9eec61668..eb66a6f8922 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -1,4 +1,4 @@ -{ stdenv, buildPackages, ghc +{ stdenv, buildPackages, buildHaskellPackages, ghc , jailbreak-cabal, hscolour, cpphs, nodejs , buildPlatform, hostPlatform }: @@ -81,7 +81,11 @@ let then "package-db" else "package-conf"; - nativeGhc = if isCross || isGhcjs then ghc.bootPkgs.ghc else ghc; + # GHC used for building Setup.hs + # + # Same as our GHC, unless we're cross, in which case it is native GHC with the + # same version, or ghcjs, in which case its the ghc used to build ghcjs. + nativeGhc = buildHaskellPackages.ghc; nativePackageDbFlag = if versionOlder "7.6" nativeGhc.version then "package-db" else "package-conf"; @@ -147,8 +151,7 @@ let ] ++ crossCabalFlags); setupCompileFlags = [ - (optionalString (!coreSetup) "-${packageDbFlag}=$packageConfDir") - (optionalString isGhcjs "-build-runner") + (optionalString (!coreSetup) "-${nativePackageDbFlag}=$packageConfDir") (optionalString (isGhcjs || isHaLVM || versionOlder "7.8" ghc.version) "-j$NIX_BUILD_CORES") # https://github.com/haskell/cabal/issues/2398 (optionalString (versionOlder "7.10" ghc.version && !isHaLVM) "-threaded") @@ -160,14 +163,12 @@ let allPkgconfigDepends = pkgconfigDepends ++ libraryPkgconfigDepends ++ executablePkgconfigDepends ++ optionals doCheck testPkgconfigDepends ++ optionals doBenchmark benchmarkPkgconfigDepends; - nativeBuildInputs = [ ghc removeReferencesTo ] ++ optional (allPkgconfigDepends != []) pkgconfig ++ + nativeBuildInputs = [ ghc nativeGhc removeReferencesTo ] ++ optional (allPkgconfigDepends != []) pkgconfig ++ buildTools ++ libraryToolDepends ++ executableToolDepends; propagatedBuildInputs = buildDepends ++ libraryHaskellDepends ++ executableHaskellDepends; otherBuildInputs = setupHaskellDepends ++ extraLibraries ++ librarySystemDepends ++ executableSystemDepends ++ optionals (allPkgconfigDepends != []) allPkgconfigDepends ++ optionals doCheck (testDepends ++ testHaskellDepends ++ testSystemDepends ++ testToolDepends) ++ - # ghcjs's hsc2hs calls out to the native hsc2hs - optional isGhcjs nativeGhc ++ optionals doBenchmark (benchmarkDepends ++ benchmarkHaskellDepends ++ benchmarkSystemDepends ++ benchmarkToolDepends); allBuildInputs = propagatedBuildInputs ++ otherBuildInputs; @@ -176,12 +177,14 @@ let ghcEnv = ghc.withPackages (p: haskellBuildInputs); - setupBuilder = if isCross then "${nativeGhc}/bin/ghc" else ghcCommand; setupCommand = "./Setup"; + ghcCommand' = if isGhcjs then "ghcjs" else "ghc"; ghcCommand = "${ghc.targetPrefix}${ghcCommand'}"; ghcCommandCaps= toUpper ghcCommand'; + nativeGhcCommand = "${nativeGhc.targetPrefix}ghc"; + in assert allPkgconfigDepends != [] -> pkgconfig != null; @@ -270,7 +273,7 @@ stdenv.mkDerivation ({ done echo setupCompileFlags: $setupCompileFlags - ${setupBuilder} $setupCompileFlags --make -o Setup -odir $TMPDIR -hidir $TMPDIR $i + ${nativeGhcCommand} $setupCompileFlags --make -o Setup -odir $TMPDIR -hidir $TMPDIR $i runHook postCompileBuildDriver ''; diff --git a/pkgs/development/haskell-modules/make-package-set.nix b/pkgs/development/haskell-modules/make-package-set.nix index dc4d3f82bde..21ab10e24a3 100644 --- a/pkgs/development/haskell-modules/make-package-set.nix +++ b/pkgs/development/haskell-modules/make-package-set.nix @@ -4,6 +4,10 @@ { # package-set used for build tools (all of nixpkgs) buildPackages +, # A haskell package set for Setup.hs, compiler plugins, and similar + # build-time uses. + buildHaskellPackages + , # package-set used for non-haskell dependencies (all of nixpkgs) pkgs @@ -18,8 +22,8 @@ , # compiler to use ghc -, # A function that takes `{ pkgs, stdenv, callPackage }` as the first arg and `self` - # as second, and returns a set of haskell packages +, # A function that takes `{ pkgs, stdenv, callPackage }` as the first arg and + # `self` as second, and returns a set of haskell packages package-set , # The final, fully overriden package set usable with the nixpkgs fixpoint @@ -36,15 +40,12 @@ let inherit (stdenv.lib) fix' extends makeOverridable; inherit (haskellLib) overrideCabal; - buildHaskellPackages = if hostPlatform != buildPlatform - then self.ghc.bootPkgs - else self; - mkDerivationImpl = pkgs.callPackage ./generic-builder.nix { inherit stdenv; nodejs = buildPackages.nodejs-slim; - inherit (buildHaskellPackages) jailbreak-cabal; + inherit buildHaskellPackages; inherit (self) ghc; + inherit (buildHaskellPackages) jailbreak-cabal; hscolour = overrideCabal buildHaskellPackages.hscolour (drv: { isLibrary = false; doHaddock = false; diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index bac386c48f4..9fb71df53fe 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -128,48 +128,58 @@ in rec { }; # Always get compilers from `buildPackages` - packages = let inherit (buildPackages.haskell) compiler; in { + packages = let bh = buildPackages.haskell; in { ghc7103 = callPackage ../development/haskell-modules { - ghc = compiler.ghc7103; + buildHaskellPackages = bh.packages.ghc7103; + ghc = bh.compiler.ghc7103; compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-7.10.x.nix { }; }; ghc7103Binary = callPackage ../development/haskell-modules { - ghc = compiler.ghc7103Binary; + buildHaskellPackages = bh.packages.ghc7103Binary; + ghc = bh.compiler.ghc7103Binary; compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-7.10.x.nix { }; }; ghc802 = callPackage ../development/haskell-modules { - ghc = compiler.ghc802; + buildHaskellPackages = bh.packages.ghc802; + ghc = bh.compiler.ghc802; compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.0.x.nix { }; }; - ghc822 = callPackage ../development/haskell-modules { - ghc = compiler.ghc822; + ghc821Binary = callPackage ../development/haskell-modules { + buildHaskellPackages = bh.packages.ghc821Binary; + ghc = bh.compiler.ghc821Binary; compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.2.x.nix { }; }; - ghc821Binary = callPackage ../development/haskell-modules { - ghc = compiler.ghc821Binary; + ghc822 = callPackage ../development/haskell-modules { + buildHaskellPackages = bh.packages.ghc822; + ghc = bh.compiler.ghc822; compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.2.x.nix { }; }; ghc841 = callPackage ../development/haskell-modules { - ghc = compiler.ghc841; + buildHaskellPackages = bh.packages.ghc841; + ghc = bh.compiler.ghc841; compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.4.x.nix { }; }; ghcHEAD = callPackage ../development/haskell-modules { - ghc = compiler.ghcHEAD; + buildHaskellPackages = bh.packages.ghcHEAD; + ghc = bh.compiler.ghcHEAD; compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-head.nix { }; }; - ghcjs = callPackage ../development/haskell-modules { - ghc = compiler.ghcjs; + ghcjs = callPackage ../development/haskell-modules rec { + buildHaskellPackages = ghc.bootPkgs; + ghc = bh.compiler.ghcjs; compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-7.10.x.nix { }; packageSetConfig = callPackage ../development/haskell-modules/configuration-ghcjs.nix { }; }; - ghcjsHEAD = callPackage ../development/haskell-modules { - ghc = compiler.ghcjsHEAD; + ghcjsHEAD = callPackage ../development/haskell-modules rec { + buildHaskellPackages = ghc.bootPkgs; + ghc = bh.compiler.ghcjsHEAD; compilerConfig = callPackage ../development/haskell-modules/configuration-ghc-8.0.x.nix { }; packageSetConfig = callPackage ../development/haskell-modules/configuration-ghcjs.nix { }; }; ghcHaLVM240 = callPackage ../development/haskell-modules { - ghc = compiler.ghcHaLVM240; + buildHaskellPackages = bh.packages.ghcHaLVM240; + ghc = bh.compiler.ghcHaLVM240; compilerConfig = callPackage ../development/haskell-modules/configuration-halvm-2.4.0.nix { }; }; From b612597c3d549b50f71f616f2acaa5a1ae0cfa52 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Thu, 4 Jan 2018 19:49:00 -0500 Subject: [PATCH 15/18] release-cross: Add a test for Haskell on Raspberry Pi and "Android" Hello World with ghcHEAD. ghc822 to come after some patches. Android will be turned into real Android...later. --- pkgs/top-level/release-cross.nix | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/pkgs/top-level/release-cross.nix b/pkgs/top-level/release-cross.nix index f6b2ecfb5db..69982330965 100644 --- a/pkgs/top-level/release-cross.nix +++ b/pkgs/top-level/release-cross.nix @@ -117,8 +117,15 @@ in patchelf = nativePlatforms; buildPackages.binutils = nativePlatforms; mpg123 = nativePlatforms; + haskell.packages.ghcHEAD.hello = nativePlatforms; + haskell.packages.ghc822.hello = nativePlatforms; }); + /* Linux on Aarch64 (TODO make android for real) */ + android = mapTestOnCross lib.systems.examples.aarch64-multiplatform (linuxCommon // { + haskell.packages.ghcHEAD.hello = nativePlatforms; + haskell.packages.ghc822.hello = nativePlatforms; + }); /* Cross-built bootstrap tools for every supported platform */ bootstrapTools = let From bf687907d749d79d199d706b4901fbae73bf9e9a Mon Sep 17 00:00:00 2001 From: Ben Gamari Date: Sun, 24 Dec 2017 12:31:37 -0500 Subject: [PATCH 16/18] haskell lib: Make Cabal compiler names explicit Cabal2nix expects a --compiler flag that contains a Cabal Compiler description. We used to use the compiler's derivation name for this, but this breaks when cross-compiling due to the target suffix. Instead we add an explicit haskellCompilerName attribute to Haskell compiler derivations. --- pkgs/development/compilers/ghc/6.10.2-binary.nix | 6 +++++- pkgs/development/compilers/ghc/6.10.4.nix | 7 ++++++- pkgs/development/compilers/ghc/6.12.3.nix | 7 ++++++- pkgs/development/compilers/ghc/7.0.4-binary.nix | 7 ++++++- pkgs/development/compilers/ghc/7.0.4.nix | 7 ++++++- pkgs/development/compilers/ghc/7.10.3.nix | 3 +++ pkgs/development/compilers/ghc/7.2.2.nix | 7 ++++++- pkgs/development/compilers/ghc/7.4.2-binary.nix | 7 ++++++- pkgs/development/compilers/ghc/7.4.2.nix | 7 ++++++- pkgs/development/compilers/ghc/7.6.3.nix | 7 ++++++- pkgs/development/compilers/ghc/7.8.4.nix | 7 ++++++- pkgs/development/compilers/ghc/8.0.2.nix | 3 +++ pkgs/development/compilers/ghc/8.2.2.nix | 3 +++ pkgs/development/compilers/ghc/8.4.1.nix | 3 +++ pkgs/development/compilers/ghc/head.nix | 3 +++ pkgs/development/haskell-modules/make-package-set.nix | 2 +- 16 files changed, 75 insertions(+), 11 deletions(-) diff --git a/pkgs/development/compilers/ghc/6.10.2-binary.nix b/pkgs/development/compilers/ghc/6.10.2-binary.nix index 03831f3b6b6..abf14808c58 100644 --- a/pkgs/development/compilers/ghc/6.10.2-binary.nix +++ b/pkgs/development/compilers/ghc/6.10.2-binary.nix @@ -96,7 +96,11 @@ stdenv.mkDerivation rec { [ $(./main) == "yes" ] ''; - passthru = { targetPrefix = ""; }; + passthru = { + targetPrefix = ""; + # Our Cabal compiler name + haskellCompilerName = "ghc"; + }; meta = { homepage = http://haskell.org/ghc; diff --git a/pkgs/development/compilers/ghc/6.10.4.nix b/pkgs/development/compilers/ghc/6.10.4.nix index 0308edbd56c..c29698c7e48 100644 --- a/pkgs/development/compilers/ghc/6.10.4.nix +++ b/pkgs/development/compilers/ghc/6.10.4.nix @@ -25,7 +25,12 @@ stdenv.mkDerivation rec { NIX_CFLAGS_COMPILE = "-fomit-frame-pointer"; - passthru = { targetPrefix = ""; }; + passthru = { + targetPrefix = ""; + + # Our Cabal compiler name + haskellCompilerName = "ghc"; + }; meta = { homepage = http://haskell.org/ghc; diff --git a/pkgs/development/compilers/ghc/6.12.3.nix b/pkgs/development/compilers/ghc/6.12.3.nix index 499508a56f7..d2cc4a2e9c3 100644 --- a/pkgs/development/compilers/ghc/6.12.3.nix +++ b/pkgs/development/compilers/ghc/6.12.3.nix @@ -36,7 +36,12 @@ stdenv.mkDerivation rec { # that in turn causes GHCi to abort stripDebugFlags=["-S" "--keep-file-symbols"]; - passthru = { targetPrefix = ""; }; + passthru = { + targetPrefix = ""; + + # Our Cabal compiler name + haskellCompilerName = "ghc"; + }; meta = { homepage = http://haskell.org/ghc; diff --git a/pkgs/development/compilers/ghc/7.0.4-binary.nix b/pkgs/development/compilers/ghc/7.0.4-binary.nix index d9b4ff16782..51dd24671bd 100644 --- a/pkgs/development/compilers/ghc/7.0.4-binary.nix +++ b/pkgs/development/compilers/ghc/7.0.4-binary.nix @@ -134,7 +134,12 @@ stdenv.mkDerivation rec { [ $(./main) == "yes" ] ''; - passthru = { targetPrefix = ""; }; + passthru = { + targetPrefix = ""; + + # Our Cabal compiler name + haskellCompilerName = "ghc"; + }; meta.license = stdenv.lib.licenses.bsd3; meta.platforms = ["x86_64-linux" "i686-linux" "x86_64-darwin"]; diff --git a/pkgs/development/compilers/ghc/7.0.4.nix b/pkgs/development/compilers/ghc/7.0.4.nix index 665622e075f..54323458d9b 100644 --- a/pkgs/development/compilers/ghc/7.0.4.nix +++ b/pkgs/development/compilers/ghc/7.0.4.nix @@ -45,7 +45,12 @@ stdenv.mkDerivation rec { # that in turn causes GHCi to abort stripDebugFlags=["-S" "--keep-file-symbols"]; - passthru = { targetPrefix = ""; }; + passthru = { + targetPrefix = ""; + + # Our Cabal compiler name + haskellCompilerName = "ghc"; + }; meta = { homepage = http://haskell.org/ghc; diff --git a/pkgs/development/compilers/ghc/7.10.3.nix b/pkgs/development/compilers/ghc/7.10.3.nix index 63f73c9c58f..c4780690f67 100644 --- a/pkgs/development/compilers/ghc/7.10.3.nix +++ b/pkgs/development/compilers/ghc/7.10.3.nix @@ -169,6 +169,9 @@ stdenv.mkDerivation rec { inherit bootPkgs targetPrefix; inherit llvmPackages; + + # Our Cabal compiler name + haskellCompilerName = "ghc"; }; meta = { diff --git a/pkgs/development/compilers/ghc/7.2.2.nix b/pkgs/development/compilers/ghc/7.2.2.nix index 897b489aa85..715f0320d50 100644 --- a/pkgs/development/compilers/ghc/7.2.2.nix +++ b/pkgs/development/compilers/ghc/7.2.2.nix @@ -55,7 +55,12 @@ stdenv.mkDerivation rec { # that in turn causes GHCi to abort stripDebugFlags=["-S" "--keep-file-symbols"]; - passthru = { targetPrefix = ""; }; + passthru = { + targetPprefix = ""; + + # Our Cabal compiler name + haskellCompilerName = "ghc"; + }; meta = { homepage = http://haskell.org/ghc; diff --git a/pkgs/development/compilers/ghc/7.4.2-binary.nix b/pkgs/development/compilers/ghc/7.4.2-binary.nix index 70c8797c264..4f00ef8fb75 100644 --- a/pkgs/development/compilers/ghc/7.4.2-binary.nix +++ b/pkgs/development/compilers/ghc/7.4.2-binary.nix @@ -136,7 +136,12 @@ stdenv.mkDerivation rec { [ $(./main) == "yes" ] ''; - passthru = { targetPrefix = ""; }; + passthru = { + targetPrefix = ""; + + # Our Cabal compiler name + haskellCompilerName = "ghc"; + }; meta.license = stdenv.lib.licenses.bsd3; meta.platforms = ["x86_64-linux" "i686-linux" "x86_64-darwin"]; diff --git a/pkgs/development/compilers/ghc/7.4.2.nix b/pkgs/development/compilers/ghc/7.4.2.nix index ebf48c2584d..7f636284c68 100644 --- a/pkgs/development/compilers/ghc/7.4.2.nix +++ b/pkgs/development/compilers/ghc/7.4.2.nix @@ -56,7 +56,12 @@ stdenv.mkDerivation rec { # that in turn causes GHCi to abort stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols"; - passthru = { targetPrefix = ""; }; + passthru = { + targetPrefix = ""; + + # Our Cabal compiler name + haskellCompilerName = "ghc"; + }; meta = { homepage = http://haskell.org/ghc; diff --git a/pkgs/development/compilers/ghc/7.6.3.nix b/pkgs/development/compilers/ghc/7.6.3.nix index 7bf7046ba76..481b8d90918 100644 --- a/pkgs/development/compilers/ghc/7.6.3.nix +++ b/pkgs/development/compilers/ghc/7.6.3.nix @@ -82,7 +82,12 @@ in stdenv.mkDerivation rec { # that in turn causes GHCi to abort stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols"; - passthru = { targetPrefix = ""; }; + passthru = { + targetPrefix = ""; + + # Our Cabal compiler name + haskellCompilerName = "ghc"; + }; meta = { homepage = http://haskell.org/ghc; diff --git a/pkgs/development/compilers/ghc/7.8.4.nix b/pkgs/development/compilers/ghc/7.8.4.nix index eb7e7166765..15f105946f5 100644 --- a/pkgs/development/compilers/ghc/7.8.4.nix +++ b/pkgs/development/compilers/ghc/7.8.4.nix @@ -74,7 +74,12 @@ stdenv.mkDerivation rec { # that in turn causes GHCi to abort stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols"; - passthru = { targetPrefix = ""; }; + passthru = { + targetPrefix = ""; + + # Our Cabal compiler name + haskellCompilerName = "ghc"; + }; meta = { homepage = http://haskell.org/ghc; diff --git a/pkgs/development/compilers/ghc/8.0.2.nix b/pkgs/development/compilers/ghc/8.0.2.nix index 1625d6d0ef0..011822994ed 100644 --- a/pkgs/development/compilers/ghc/8.0.2.nix +++ b/pkgs/development/compilers/ghc/8.0.2.nix @@ -170,6 +170,9 @@ stdenv.mkDerivation rec { inherit bootPkgs targetPrefix; inherit llvmPackages; + + # Our Cabal compiler name + haskellCompilerName = "ghc"; }; meta = { diff --git a/pkgs/development/compilers/ghc/8.2.2.nix b/pkgs/development/compilers/ghc/8.2.2.nix index 105f80b4eff..8b62bbffcc8 100644 --- a/pkgs/development/compilers/ghc/8.2.2.nix +++ b/pkgs/development/compilers/ghc/8.2.2.nix @@ -181,6 +181,9 @@ stdenv.mkDerivation rec { inherit bootPkgs targetPrefix; inherit llvmPackages; + + # Our Cabal compiler name + haskellCompilerName = "ghc"; }; meta = { diff --git a/pkgs/development/compilers/ghc/8.4.1.nix b/pkgs/development/compilers/ghc/8.4.1.nix index 2fb5a0d404a..88bcc3e148b 100644 --- a/pkgs/development/compilers/ghc/8.4.1.nix +++ b/pkgs/development/compilers/ghc/8.4.1.nix @@ -178,6 +178,9 @@ stdenv.mkDerivation rec { inherit bootPkgs targetPrefix; inherit llvmPackages; + + # Our Cabal compiler name + haskellCompilerName = "ghc"; }; meta = { diff --git a/pkgs/development/compilers/ghc/head.nix b/pkgs/development/compilers/ghc/head.nix index 9b40a0ebd6e..82cef10ce3b 100644 --- a/pkgs/development/compilers/ghc/head.nix +++ b/pkgs/development/compilers/ghc/head.nix @@ -178,6 +178,9 @@ stdenv.mkDerivation rec { inherit bootPkgs targetPrefix; inherit llvmPackages; + + # Our Cabal compiler name + haskellCompilerName = "ghc"; }; meta = { diff --git a/pkgs/development/haskell-modules/make-package-set.nix b/pkgs/development/haskell-modules/make-package-set.nix index 21ab10e24a3..e1b0f78b715 100644 --- a/pkgs/development/haskell-modules/make-package-set.nix +++ b/pkgs/development/haskell-modules/make-package-set.nix @@ -120,7 +120,7 @@ let installPhase = '' export HOME="$TMP" mkdir -p "$out" - cabal2nix --compiler=${self.ghc.name} --system=${stdenv.system} ${sha256Arg} "${src}" > "$out/default.nix" + cabal2nix --compiler=${ghc.haskellCompilerName} --system=${stdenv.system} ${sha256Arg} "${src}" > "$out/default.nix" ''; }; From 13739e6b9ea8df61e6e9d08639ceb77660cbda5a Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 22 Jan 2018 11:29:15 -0500 Subject: [PATCH 17/18] release-cross: Try building on Windows too --- pkgs/top-level/release-cross.nix | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/pkgs/top-level/release-cross.nix b/pkgs/top-level/release-cross.nix index 69982330965..8e1213f2344 100644 --- a/pkgs/top-level/release-cross.nix +++ b/pkgs/top-level/release-cross.nix @@ -21,6 +21,8 @@ let gnuCommon = lib.recursiveUpdate common { buildPackages.gcc = nativePlatforms; coreutils = nativePlatforms; + haskell.packages.ghcHEAD.hello = nativePlatforms; + haskell.packages.ghc822.hello = nativePlatforms; }; linuxCommon = lib.recursiveUpdate gnuCommon { @@ -117,14 +119,10 @@ in patchelf = nativePlatforms; buildPackages.binutils = nativePlatforms; mpg123 = nativePlatforms; - haskell.packages.ghcHEAD.hello = nativePlatforms; - haskell.packages.ghc822.hello = nativePlatforms; }); /* Linux on Aarch64 (TODO make android for real) */ android = mapTestOnCross lib.systems.examples.aarch64-multiplatform (linuxCommon // { - haskell.packages.ghcHEAD.hello = nativePlatforms; - haskell.packages.ghc822.hello = nativePlatforms; }); /* Cross-built bootstrap tools for every supported platform */ From cf3ada04a77c2b355cf285f4342c8cc29e2eed48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ertugrul=20S=C3=B6ylemez?= Date: Tue, 16 Jan 2018 17:14:37 +0100 Subject: [PATCH 18/18] perlPackages.MailPOP3Client: init at 2.19 --- pkgs/top-level/perl-packages.nix | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pkgs/top-level/perl-packages.nix b/pkgs/top-level/perl-packages.nix index 8687730b94e..ff74410ffbd 100644 --- a/pkgs/top-level/perl-packages.nix +++ b/pkgs/top-level/perl-packages.nix @@ -8402,6 +8402,18 @@ let self = _self // overrides; _self = with self; { buildInputs = [ParseRecDescent]; }; + MailPOP3Client = buildPerlPackage rec { + name = "Mail-POP3Client-2.19"; + src = fetchurl { + url = "mirror://cpan/authors/id/S/SD/SDOWD/${name}.tar.gz"; + sha256 = "1142d6247a93cb86b23ed8835553bb2d227ff8213ee2743e4155bb93f47acb59"; + }; + meta = { + description = "Perl 5 module to talk to a POP3 (RFC1939) server"; + license = with stdenv.lib.licenses; [ artistic1 gpl1Plus ]; + }; + }; + MailRFC822Address = buildPerlPackage { name = "Mail-RFC822-Address-0.3"; src = fetchurl {