about summary refs log tree commit diff
path: root/pkgs/development/haskell-modules
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2018-05-23 09:40:37 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2018-05-23 09:40:37 -0400
commit18742471aff29270453a540f84d543137ee9d44e (patch)
treed21863fd81db3722e8cac52b52be3dd1c429cf21 /pkgs/development/haskell-modules
parent2e831da76da0a51557975a55dc8a18ebf3401bfb (diff)
parentbbcaf78350d87c4657b1a2451132535467a454eb (diff)
downloadnixlib-18742471aff29270453a540f84d543137ee9d44e.tar
nixlib-18742471aff29270453a540f84d543137ee9d44e.tar.gz
nixlib-18742471aff29270453a540f84d543137ee9d44e.tar.bz2
nixlib-18742471aff29270453a540f84d543137ee9d44e.tar.lz
nixlib-18742471aff29270453a540f84d543137ee9d44e.tar.xz
nixlib-18742471aff29270453a540f84d543137ee9d44e.tar.zst
nixlib-18742471aff29270453a540f84d543137ee9d44e.zip
Merge remote-tracking branch 'upstream/master' into staging
Use newer vagrant from master
Diffstat (limited to 'pkgs/development/haskell-modules')
-rw-r--r--pkgs/development/haskell-modules/configuration-ghc-8.4.x.nix2
-rw-r--r--pkgs/development/haskell-modules/configuration-nix.nix2
-rw-r--r--pkgs/development/haskell-modules/generic-builder.nix74
-rw-r--r--pkgs/development/haskell-modules/lib.nix2
-rw-r--r--pkgs/development/haskell-modules/patches/lambdabot-core-ghc-8.4.x-fix.patch15
5 files changed, 38 insertions, 57 deletions
diff --git a/pkgs/development/haskell-modules/configuration-ghc-8.4.x.nix b/pkgs/development/haskell-modules/configuration-ghc-8.4.x.nix
index 83d97c64b48b..0adaa5f274c3 100644
--- a/pkgs/development/haskell-modules/configuration-ghc-8.4.x.nix
+++ b/pkgs/development/haskell-modules/configuration-ghc-8.4.x.nix
@@ -448,4 +448,6 @@ self: super: {
     sha256 = "1bpsqq80h6nxm04wddgcgyzn0fjfsmhccmqb211jqswv5209znx8";
   });
 
+  lambdabot-core = appendPatch super.lambdabot-core ./patches/lambdabot-core-ghc-8.4.x-fix.patch;
+
 }
diff --git a/pkgs/development/haskell-modules/configuration-nix.nix b/pkgs/development/haskell-modules/configuration-nix.nix
index 2f1eb1ad97a8..469b249010fa 100644
--- a/pkgs/development/haskell-modules/configuration-nix.nix
+++ b/pkgs/development/haskell-modules/configuration-nix.nix
@@ -128,7 +128,7 @@ self: super: builtins.intersectAttrs super {
 
   # Prevents needing to add security_tool as a build tool to all of x509-system's
   # dependencies.
-  x509-system = if pkgs.stdenv.targetPlatform.isDarwin && !pkgs.stdenv.cc.nativeLibc
+  x509-system = if pkgs.stdenv.isDarwin && !pkgs.stdenv.cc.nativeLibc
     then let inherit (pkgs.darwin) security_tool;
       in pkgs.lib.overrideDerivation (addBuildDepend super.x509-system security_tool) (drv: {
         postPatch = (drv.postPatch or "") + ''
diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix
index 5054106959f7..32e7734dd0bd 100644
--- a/pkgs/development/haskell-modules/generic-builder.nix
+++ b/pkgs/development/haskell-modules/generic-builder.nix
@@ -19,7 +19,6 @@ in
 , buildTarget ? ""
 , buildTools ? [], libraryToolDepends ? [], executableToolDepends ? [], testToolDepends ? [], benchmarkToolDepends ? []
 , configureFlags ? []
-, buildFlags ? []
 , description ? ""
 , doCheck ? !isCross && stdenv.lib.versionOlder "7.4" ghc.version
 , doBenchmark ? false
@@ -32,7 +31,7 @@ in
 , enableSharedExecutables ? false
 , enableSharedLibraries ? ((ghc.isGhcjs or false) || stdenv.lib.versionOlder "7.7" ghc.version)
 , enableDeadCodeElimination ? (!stdenv.isDarwin)  # TODO: use -dead_strip for darwin
-, enableStaticLibraries ? !hostPlatform.isWindows
+, enableStaticLibraries ? true
 , enableHsc2hsViaAsm ? hostPlatform.isWindows && stdenv.lib.versionAtLeast ghc.version "8.4"
 , extraLibraries ? [], librarySystemDepends ? [], executableSystemDepends ? []
 , homepage ? "http://hackage.haskell.org/package/${pname}"
@@ -69,10 +68,6 @@ in
 
 assert editedCabalFile != null -> revision != null;
 
-# --enable-static does not work on windows. This is a bug in GHC.
-# --enable-static will pass -staticlib to ghc, which only works for mach-o and elf.
-assert hostPlatform.isWindows -> enableStaticLibraries == false;
-
 let
 
   inherit (stdenv.lib) optional optionals optionalString versionOlder versionAtLeast
@@ -131,8 +126,6 @@ let
   crossCabalFlagsString =
     stdenv.lib.optionalString isCross (" " + stdenv.lib.concatStringsSep " " crossCabalFlags);
 
-  buildFlagsString = optionalString (buildFlags != []) (" " + concatStringsSep " " buildFlags);
-
   defaultConfigureFlags = [
     "--verbose" "--prefix=$out" "--libdir=\\$prefix/lib/\\$compiler" "--libsubdir=\\$pkgid"
     (optionalString enableSeparateDataOutput "--datadir=$data/share/${ghc.name}")
@@ -176,22 +169,22 @@ let
                         optionals doCheck testPkgconfigDepends ++ optionals doBenchmark benchmarkPkgconfigDepends;
 
   nativeBuildInputs = [ ghc nativeGhc removeReferencesTo ] ++ optional (allPkgconfigDepends != []) pkgconfig ++
-                      setupHaskellDepends ++
                       buildTools ++ libraryToolDepends ++ executableToolDepends;
   propagatedBuildInputs = buildDepends ++ libraryHaskellDepends ++ executableHaskellDepends;
   otherBuildInputs = extraLibraries ++ librarySystemDepends ++ executableSystemDepends ++
                      allPkgconfigDepends ++
+=======
+  otherBuildInputs = setupHaskellDepends ++ extraLibraries ++ librarySystemDepends ++ executableSystemDepends ++
+                     optionals (allPkgconfigDepends != []) allPkgconfigDepends ++
+>>>>>>> upstream/master
                      optionals doCheck (testDepends ++ testHaskellDepends ++ testSystemDepends ++ testToolDepends) ++
                      optionals doBenchmark (benchmarkDepends ++ benchmarkHaskellDepends ++ benchmarkSystemDepends ++ benchmarkToolDepends);
-
   allBuildInputs = propagatedBuildInputs ++ otherBuildInputs;
 
   haskellBuildInputs = stdenv.lib.filter isHaskellPkg allBuildInputs;
   systemBuildInputs = stdenv.lib.filter isSystemPkg allBuildInputs;
 
-  # When not cross compiling, also include Setup.hs dependencies.
-  ghcEnv = ghc.withPackages (p:
-    haskellBuildInputs ++ stdenv.lib.optional (!isCross) setupHaskellDepends);
+  ghcEnv = ghc.withPackages (p: haskellBuildInputs);
 
   setupCommand = "./Setup";
 
@@ -201,22 +194,6 @@ let
 
   nativeGhcCommand = "${nativeGhc.targetPrefix}ghc";
 
-  buildPkgDb = ghcName: ''
-    if [ -d "$p/lib/${ghcName}/package.conf.d" ]; then
-      cp -f "$p/lib/${ghcName}/package.conf.d/"*.conf $packageConfDir/
-      continue
-    fi
-    if [ -d "$p/include" ]; then
-      configureFlags+=" --extra-include-dirs=$p/include"
-    fi
-    if [ -d "$p/lib" ]; then
-      configureFlags+=" --extra-lib-dirs=$p/lib"
-    fi
-    if [[ -d "$p/Library/Frameworks" ]]; then
-      configureFlags+=" --extra-framework-dirs=$p/Library/Frameworks"
-    fi
-  '';
-
 in
 
 assert allPkgconfigDepends != [] -> pkgconfig != null;
@@ -257,37 +234,30 @@ stdenv.mkDerivation ({
     echo "Build with ${ghc}."
     ${optionalString (hasActiveLibrary && hyperlinkSource) "export PATH=${hscolour}/bin:$PATH"}
 
-  '' + (optionalString (setupHaskellDepends != []) ''
-    setupPackageConfDir="$TMPDIR/setup-package.conf.d"
-    mkdir -p $setupPackageConfDir
-  '') + ''
     packageConfDir="$TMPDIR/package.conf.d"
     mkdir -p $packageConfDir
 
     setupCompileFlags="${concatStringsSep " " setupCompileFlags}"
     configureFlags="${concatStringsSep " " defaultConfigureFlags} $configureFlags"
-  ''
-  # We build the Setup.hs on the *build* machine, and as such should only add
-  # dependencies for the build machine.
-  #
-  # pkgs* arrays defined in stdenv/setup.hs
-  + (optionalString (setupHaskellDepends != []) ''
-    for p in "''${pkgsBuildBuild[@]}" "''${pkgsBuildHost[@]}" "''${pkgsBuildTarget[@]}"; do
-      ${buildPkgDb nativeGhc.name}
-    done
-    ${nativeGhcCommand}-pkg --${nativePackageDbFlag}="$setupPackageConfDir" recache
-  '')
 
-    # For normal components
-  + ''
+    # host.*Pkgs defined in stdenv/setup.hs
     for p in "''${pkgsHostHost[@]}" "''${pkgsHostTarget[@]}"; do
-      ${buildPkgDb ghc.name}
+      if [ -d "$p/lib/${ghc.name}/package.conf.d" ]; then
+        cp -f "$p/lib/${ghc.name}/package.conf.d/"*.conf $packageConfDir/
+        continue
+      fi
+      if [ -d "$p/include" ]; then
+        configureFlags+=" --extra-include-dirs=$p/include"
+      fi
+      if [ -d "$p/lib" ]; then
+        configureFlags+=" --extra-lib-dirs=$p/lib"
+      fi
     done
   ''
   # only use the links hack if we're actually building dylibs. otherwise, the
   # "dynamic-library-dirs" point to nonexistent paths, and the ln command becomes
   # "ln -s $out/lib/links", which tries to recreate the links dir and fails
-  + (optionalString (stdenv.isDarwin && (enableSharedLibraries || enableSharedExecutables)) ''
+  + (optionalString (stdenv.isDarwin && enableSharedLibraries) ''
     # Work around a limit in the macOS Sierra linker on the number of paths
     # referenced by any one dynamic library:
     #
@@ -316,11 +286,7 @@ stdenv.mkDerivation ({
     done
 
     echo setupCompileFlags: $setupCompileFlags
-    ${optionalString (setupHaskellDepends != [])
-       ''
-       echo GHC_PACKAGE_PATH="$setupPackageConfDir:"
-       GHC_PACKAGE_PATH="$setupPackageConfDir:" ''
-    }${nativeGhcCommand} $setupCompileFlags --make -o Setup -odir $TMPDIR -hidir $TMPDIR $i
+    ${nativeGhcCommand} $setupCompileFlags --make -o Setup -odir $TMPDIR -hidir $TMPDIR $i
 
     runHook postCompileBuildDriver
   '';
@@ -348,7 +314,7 @@ stdenv.mkDerivation ({
 
   buildPhase = ''
     runHook preBuild
-    ${setupCommand} build ${buildTarget}${crossCabalFlagsString}${buildFlagsString}
+    ${setupCommand} build ${buildTarget}${crossCabalFlagsString}
     runHook postBuild
   '';
 
diff --git a/pkgs/development/haskell-modules/lib.nix b/pkgs/development/haskell-modules/lib.nix
index fb1302f60ea5..55e45bd6559d 100644
--- a/pkgs/development/haskell-modules/lib.nix
+++ b/pkgs/development/haskell-modules/lib.nix
@@ -131,8 +131,6 @@ rec {
    */
   appendConfigureFlag = drv: x: overrideCabal drv (drv: { configureFlags = (drv.configureFlags or []) ++ [x]; });
 
-  appendBuildFlag = drv: x: overrideCabal drv (drv: { buildFlags = (drv.buildFlags or []) ++ [x]; });
-  appendBuildFlags = drv: xs: overrideCabal drv (drv: { buildFlags = (drv.buildFlags or []) ++ xs; });
   /* removeConfigureFlag drv x is a Haskell package like drv, but with
      all cabal configure arguments that are equal to x removed.
 
diff --git a/pkgs/development/haskell-modules/patches/lambdabot-core-ghc-8.4.x-fix.patch b/pkgs/development/haskell-modules/patches/lambdabot-core-ghc-8.4.x-fix.patch
new file mode 100644
index 000000000000..9b7b7cfb8f96
--- /dev/null
+++ b/pkgs/development/haskell-modules/patches/lambdabot-core-ghc-8.4.x-fix.patch
@@ -0,0 +1,15 @@
+index 60e134c..246d8ca 100644
+--- lambdabot-core/src/Lambdabot/Config.hs
++++ lambdabot-core/src/Lambdabot/Config.hs
+@@ -29,9 +29,9 @@ import Data.Typeable
+ import Data.Generics (everywhere, mkT)
+ import Language.Haskell.TH
+ 
+-data Config t where Config :: (Typeable1 k, GCompare k) => !(k t) -> t -> (t -> t -> t) -> Config t
++data Config t where Config :: (Typeable k, GCompare k) => !(k t) -> t -> (t -> t -> t) -> Config t
+ 
+-cast1 :: (Typeable1 f, Typeable1 g) => f a -> Maybe (g a)
++cast1 :: (Typeable f, Typeable g) => f a -> Maybe (g a)
+ cast1 = fmap runIdentity . gcast1 . Identity
+ 
+ instance GEq Config where