From e6d3a4e7d1e2262c0b28dac67538d253cc4e719e Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sat, 23 Jan 2016 15:32:58 -0800 Subject: [PATCH 1/4] ghcjs: Remove wrapper, which seems long unused --- pkgs/development/compilers/ghcjs/wrapper.nix | 77 -------------------- 1 file changed, 77 deletions(-) delete mode 100644 pkgs/development/compilers/ghcjs/wrapper.nix diff --git a/pkgs/development/compilers/ghcjs/wrapper.nix b/pkgs/development/compilers/ghcjs/wrapper.nix deleted file mode 100644 index 751b7d9a7de..00000000000 --- a/pkgs/development/compilers/ghcjs/wrapper.nix +++ /dev/null @@ -1,77 +0,0 @@ -{ stdenv, ghc, makeWrapper, coreutils, writeScript }: -let - ghcjs = ghc; - packageDBFlag = "-package-db"; - - GHCGetPackages = writeScript "ghc-get-packages.sh" '' - #! ${stdenv.shell} - # Usage: - # $1: version of GHC - # $2: invocation path of GHC - # $3: prefix - version="$1" - if test -z "$3"; then - prefix="${packageDBFlag} " - else - prefix="$3" - fi - PATH="$PATH:$2" - IFS=":" - for p in $PATH; do - for i in "$p/../share/ghcjs/$system-${ghcjs.version}-${ghcjs.ghc.version}"{,/lib,/ghcjs}"/package.conf.d" "$p/../lib/ghcjs-${ghc.version}_ghc-${ghc.ghc.version}/package.conf.d" ; do - # output takes place here - test -f $i/package.cache && echo -n " $prefix$i" - done - done - ''; - - GHCPackages = writeScript "ghc-packages.sh" '' - #! ${stdenv.shell} -e - declare -A GHC_PACKAGES_HASH # using bash4 hashs to get uniq paths - - for arg in $(${GHCGetPackages} ${ghcjs.version} "$(dirname $0)"); do # Why is ghc.version passed in from here instead of captured in the other script directly? - case "$arg" in - ${packageDBFlag}) ;; - *) - CANONICALIZED="$(${coreutils}/bin/readlink -f -- "$arg")" - GHC_PACKAGES_HASH["$CANONICALIZED"]= ;; - esac - done - - for path in ''${!GHC_PACKAGES_HASH[@]}; do - echo -n "$path:" - done - ''; -in -stdenv.mkDerivation { - name = "ghcjs-ghc${ghcjs.ghc.version}-${ghcjs.version}-wrapper"; - - buildInputs = [makeWrapper]; - propagatedBuildInputs = [ghcjs]; - - unpackPhase = "true"; - installPhase = '' - runHook preInstall - - mkdir -p $out/bin - for prg in ghcjs ; do - makeWrapper $ghc/bin/$prg $out/bin/$prg --add-flags "\$(${GHCGetPackages} ${ghcjs.version} \"\$(dirname \$0)\")" - done - for prg in ghcjs-pkg ; do - makeWrapper $ghc/bin/$prg $out/bin/$prg --add-flags "\$(${GHCGetPackages} ${ghcjs.version} \"\$(dirname \$0)\" -${packageDBFlag}=)" - done - - mkdir -p $out/nix-support - ln -s $out/nix-support/propagated-build-inputs $out/nix-support/propagated-user-env-packages - - mkdir -p $out/share/doc - ln -s $ghc/lib $out/lib - ln -s $ghc/share/doc/ghc $out/share/doc/ghc-${ghcjs.version} - - runHook postInstall - ''; - - ghc = ghcjs; - inherit GHCGetPackages GHCPackages; - inherit (ghcjs) meta version; -} From 114cd6765d9a1dc405af223294657b9e765a6f3d Mon Sep 17 00:00:00 2001 From: John Ericson Date: Sun, 21 Feb 2016 10:15:04 -0800 Subject: [PATCH 2/4] haskell: Expose the package set used to build each GHC, where possible Tested to not change hashes --- pkgs/development/compilers/ghc/7.10.2.nix | 7 ++++- pkgs/development/compilers/ghc/7.10.3.nix | 7 ++++- pkgs/development/compilers/ghc/8.0.1.nix | 10 +++++++- pkgs/development/compilers/ghc/head.nix | 11 ++++++-- pkgs/development/compilers/ghc/nokinds.nix | 7 ++++- pkgs/development/compilers/ghcjs/default.nix | 10 +++++--- pkgs/top-level/haskell-packages.nix | 27 ++++++++++++-------- 7 files changed, 59 insertions(+), 20 deletions(-) diff --git a/pkgs/development/compilers/ghc/7.10.2.nix b/pkgs/development/compilers/ghc/7.10.2.nix index 73fcd788c74..87490842b3b 100644 --- a/pkgs/development/compilers/ghc/7.10.2.nix +++ b/pkgs/development/compilers/ghc/7.10.2.nix @@ -1,8 +1,9 @@ -{ stdenv, fetchurl, fetchpatch, ghc, perl, gmp, ncurses, libiconv, binutils, coreutils +{ stdenv, fetchurl, fetchpatch, bootPkgs, perl, gmp, ncurses, libiconv, binutils, coreutils , libxml2, libxslt, docbook_xsl, docbook_xml_dtd_45, docbook_xml_dtd_42, hscolour }: let + inherit (bootPkgs) ghc; buildMK = '' libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-libraries="${gmp}/lib" @@ -60,6 +61,10 @@ stdenv.mkDerivation rec { done ''; + passthru = { + inherit bootPkgs; + }; + meta = { homepage = "http://haskell.org/ghc"; description = "The Glasgow Haskell Compiler"; diff --git a/pkgs/development/compilers/ghc/7.10.3.nix b/pkgs/development/compilers/ghc/7.10.3.nix index 88d1bec4d42..53ba058def4 100644 --- a/pkgs/development/compilers/ghc/7.10.3.nix +++ b/pkgs/development/compilers/ghc/7.10.3.nix @@ -1,8 +1,9 @@ -{ stdenv, fetchurl, fetchpatch, ghc, perl, gmp, ncurses, libiconv, binutils, coreutils +{ stdenv, fetchurl, fetchpatch, bootPkgs, perl, gmp, ncurses, libiconv, binutils, coreutils , libxml2, libxslt, docbook_xsl, docbook_xml_dtd_45, docbook_xml_dtd_42, hscolour }: let + inherit (bootPkgs) ghc; docFixes = fetchurl { url = "https://downloads.haskell.org/~ghc/7.10.3/ghc-7.10.3a.patch"; @@ -61,6 +62,10 @@ stdenv.mkDerivation rec { done ''; + passthru = { + inherit bootPkgs; + }; + meta = { homepage = "http://haskell.org/ghc"; description = "The Glasgow Haskell Compiler"; diff --git a/pkgs/development/compilers/ghc/8.0.1.nix b/pkgs/development/compilers/ghc/8.0.1.nix index d24ad4106ee..00482d013c2 100644 --- a/pkgs/development/compilers/ghc/8.0.1.nix +++ b/pkgs/development/compilers/ghc/8.0.1.nix @@ -1,7 +1,11 @@ -{ stdenv, fetchurl, fetchpatch, ghc, perl, gmp, ncurses, libiconv, binutils, coreutils +{ stdenv, fetchurl, fetchpatch, bootPkgs, perl, gmp, ncurses, libiconv, binutils, coreutils , hscolour }: +let + inherit (bootPkgs) ghc; + +in stdenv.mkDerivation rec { version = "8.0.0.20160204"; name = "ghc-${version}"; @@ -51,6 +55,10 @@ stdenv.mkDerivation rec { done ''; + passthru = { + inherit bootPkgs; + }; + meta = { homepage = "http://haskell.org/ghc"; description = "The Glasgow Haskell Compiler"; diff --git a/pkgs/development/compilers/ghc/head.nix b/pkgs/development/compilers/ghc/head.nix index 9b360b609e4..18e22f0100b 100644 --- a/pkgs/development/compilers/ghc/head.nix +++ b/pkgs/development/compilers/ghc/head.nix @@ -1,8 +1,11 @@ -{ stdenv, fetchgit, ghc, perl, gmp, ncurses, libiconv, binutils, coreutils +{ stdenv, fetchgit, bootPkgs, perl, gmp, ncurses, libiconv, binutils, coreutils , autoconf, automake, happy, alex }: -stdenv.mkDerivation rec { +let + inherit (bootPkgs) ghc; + +in stdenv.mkDerivation rec { version = "7.11.20151216"; name = "ghc-${version}"; rev = "28638dfe79e915f33d75a1b22c5adce9e2b62b97"; @@ -62,6 +65,10 @@ stdenv.mkDerivation rec { done ''; + passthru = { + inherit bootPkgs; + }; + meta = { homepage = "http://haskell.org/ghc"; description = "The Glasgow Haskell Compiler"; diff --git a/pkgs/development/compilers/ghc/nokinds.nix b/pkgs/development/compilers/ghc/nokinds.nix index 6334759496f..acaef9c5ab1 100644 --- a/pkgs/development/compilers/ghc/nokinds.nix +++ b/pkgs/development/compilers/ghc/nokinds.nix @@ -1,6 +1,7 @@ -{ stdenv, fetchgit, ghc, perl, gmp, ncurses, libiconv, autoconf, automake, happy, alex }: +{ stdenv, fetchgit, bootPkgs, perl, gmp, ncurses, libiconv, autoconf, automake, happy, alex }: let + inherit (bootPkgs) ghc; buildMK = '' libraries/integer-gmp_CONFIGURE_OPTS += --configure-option=--with-gmp-libraries="${gmp}/lib" @@ -66,6 +67,10 @@ stdenv.mkDerivation rec { # that in turn causes GHCi to abort stripDebugFlags = [ "-S" ] ++ stdenv.lib.optional (!stdenv.isDarwin) "--keep-file-symbols"; + passthru = { + inherit bootPkgs; + }; + meta = { homepage = "http://haskell.org/ghc"; description = "The dependently-typed 'nokinds' branch of the Glasgow Haskell Compiler by Richard Eisenberg"; diff --git a/pkgs/development/compilers/ghcjs/default.nix b/pkgs/development/compilers/ghcjs/default.nix index 81a8c90b53a..3aca5f23919 100644 --- a/pkgs/development/compilers/ghcjs/default.nix +++ b/pkgs/development/compilers/ghcjs/default.nix @@ -20,7 +20,7 @@ , ghcjs-prim , regex-posix -, ghc, gmp +, bootPkgs, gmp , jailbreak-cabal , runCommand @@ -41,8 +41,11 @@ , ghcjsBoot ? import ./ghcjs-boot.nix { inherit fetchgit runCommand; } , shims ? import ./shims.nix { inherit fetchFromGitHub; } }: -let version = "0.2.0"; in -mkDerivation (rec { +let + inherit (bootPkgs) ghc; + version = "0.2.0"; + +in mkDerivation (rec { pname = "ghcjs"; inherit version; src = fetchFromGitHub { @@ -114,6 +117,7 @@ mkDerivation (rec { --with-gmp-libraries ${gmp}/lib ''; passthru = { + inherit bootPkgs; isGhcjs = true; nativeGhc = ghc; inherit nodejs ghcjsBoot; diff --git a/pkgs/top-level/haskell-packages.nix b/pkgs/top-level/haskell-packages.nix index 2d0151dc542..2eadcbeefef 100644 --- a/pkgs/top-level/haskell-packages.nix +++ b/pkgs/top-level/haskell-packages.nix @@ -34,24 +34,29 @@ rec { ghc784 = callPackage ../development/compilers/ghc/7.8.4.nix { ghc = compiler.ghc742Binary; }; - ghc7102 = callPackage ../development/compilers/ghc/7.10.2.nix { - ghc = compiler.ghc784; inherit (packages.ghc784) hscolour; + ghc7102 = callPackage ../development/compilers/ghc/7.10.2.nix rec { + bootPkgs = packages.ghc784; + inherit (bootPkgs) hscolour; }; - ghc7103 = callPackage ../development/compilers/ghc/7.10.3.nix { - ghc = compiler.ghc784; inherit (packages.ghc784) hscolour; + ghc7103 = callPackage ../development/compilers/ghc/7.10.3.nix rec { + bootPkgs = packages.ghc784; + inherit (bootPkgs) hscolour; }; - ghc801 = callPackage ../development/compilers/ghc/8.0.1.nix { - ghc = compiler.ghc7103; inherit (packages.ghc7103) hscolour; + ghc801 = callPackage ../development/compilers/ghc/8.0.1.nix rec { + bootPkgs = packages.ghc7103; + inherit (bootPkgs) hscolour; }; - ghcHEAD = callPackage ../development/compilers/ghc/head.nix { - inherit (packages.ghc784) ghc alex happy; + ghcHEAD = callPackage ../development/compilers/ghc/head.nix rec { + bootPkgs = packages.ghc784; + inherit (bootPkgs) alex happy; }; - ghcNokinds = callPackage ../development/compilers/ghc/nokinds.nix { - inherit (packages.ghc784) ghc alex happy; + ghcNokinds = callPackage ../development/compilers/ghc/nokinds.nix rec { + bootPkgs = packages.ghc784; + inherit (bootPkgs) alex happy; }; ghcjs = packages.ghc7103.callPackage ../development/compilers/ghcjs { - ghc = compiler.ghc7103; + bootPkgs = packages.ghc7103; }; jhc = callPackage ../development/compilers/jhc { From 51b66ed4d918a795af55ae50de05fd0cb4b19a38 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 19 Feb 2016 08:40:33 -0800 Subject: [PATCH 3/4] haskell: Add notion of cross compiler and define nativeGhc with it Tested to not change hashes --- pkgs/development/compilers/ghcjs/default.nix | 2 +- pkgs/development/haskell-modules/generic-builder.nix | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pkgs/development/compilers/ghcjs/default.nix b/pkgs/development/compilers/ghcjs/default.nix index 3aca5f23919..722c3eab10a 100644 --- a/pkgs/development/compilers/ghcjs/default.nix +++ b/pkgs/development/compilers/ghcjs/default.nix @@ -118,8 +118,8 @@ in mkDerivation (rec { ''; passthru = { inherit bootPkgs; + isCross = true; isGhcjs = true; - nativeGhc = ghc; inherit nodejs ghcjsBoot; }; diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index b871b7d73fa..50efcc27fe6 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -56,8 +56,9 @@ let inherit (stdenv.lib) optional optionals optionalString versionOlder concatStringsSep enableFeature optionalAttrs toUpper; + isCross = ghc.isCross or false; isGhcjs = ghc.isGhcjs or false; - nativeGhc = if isGhcjs then ghc.nativeGhc else ghc; + nativeGhc = if isCross then ghc.bootPkgs.ghc else ghc; newCabalFileUrl = "http://hackage.haskell.org/package/${pname}-${version}/revision/${revision}.cabal"; newCabalFile = fetchurl { @@ -97,7 +98,7 @@ let (optionalString (isGhcjs || versionOlder "7.4" ghc.version) (enableFeature enableSharedExecutables "executable-dynamic")) (optionalString (isGhcjs || versionOlder "7" ghc.version) (enableFeature doCheck "tests")) ] ++ optionals isGhcjs [ - "--with-hsc2hs=${ghc.nativeGhc}/bin/hsc2hs" + "--with-hsc2hs=${nativeGhc}/bin/hsc2hs" "--ghcjs" ]; From f13eede7e58d06a64bae410602ada6626af39991 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Fri, 19 Feb 2016 08:45:45 -0800 Subject: [PATCH 4/4] haskell: Tiny refactor in generic-builder. No hashes/interfaces changed. --- .../development/haskell-modules/generic-builder.nix | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index 50efcc27fe6..8b54a19c2b5 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -58,7 +58,15 @@ let isCross = ghc.isCross or false; isGhcjs = ghc.isGhcjs or false; + packageDbFlag = if isGhcjs || versionOlder "7.6" ghc.version + then "package-db" + else "package-conf"; + nativeGhc = if isCross then ghc.bootPkgs.ghc else ghc; + nativeIsCross = nativeGhc.isCross or false; + nativePackageDbFlag = if versionOlder "7.6" nativeGhc.version + then "package-db" + else "package-conf"; newCabalFileUrl = "http://hackage.haskell.org/package/${pname}-${version}/revision/${revision}.cabal"; newCabalFile = fetchurl { @@ -72,9 +80,6 @@ let main = defaultMain ''; - ghc76xOrLater = isGhcjs || stdenv.lib.versionOlder "7.6" ghc.version; - packageDbFlag = if ghc76xOrLater then "package-db" else "package-conf"; - hasActiveLibrary = isLibrary && (enableStaticLibraries || enableSharedLibraries || enableLibraryProfiling); # We cannot enable -j parallelism for libraries because GHC is far more @@ -126,7 +131,7 @@ let ghcEnv = ghc.withPackages (p: haskellBuildInputs); - setupBuilder = if isGhcjs then "${nativeGhc}/bin/ghc" else ghcCommand; + setupBuilder = if isCross then "${nativeGhc}/bin/ghc" else ghcCommand; setupCommand = "./Setup"; ghcCommand = if isGhcjs then "ghcjs" else "ghc"; ghcCommandCaps = toUpper ghcCommand;