haskell: extend generic builder to support upcoming format change from cabal2nix

This commit is contained in:
Peter Simons 2015-06-17 16:40:21 +02:00
parent 5e4f1adc8a
commit 6cd9a820ad

View File

@ -6,9 +6,9 @@
, version, revision ? null , version, revision ? null
, sha256 ? null , sha256 ? null
, src ? fetchurl { url = "mirror://hackage/${pname}-${version}.tar.gz"; inherit sha256; } , src ? fetchurl { url = "mirror://hackage/${pname}-${version}.tar.gz"; inherit sha256; }
, buildDepends ? [] , buildDepends ? [], libraryHaskellDepends ? [], executableHaskellDepends ? []
, buildTarget ? "" , buildTarget ? ""
, buildTools ? [] , buildTools ? [], libraryToolDepends ? [], executableToolDepends ? [], testToolDepends ? []
, configureFlags ? [] , configureFlags ? []
, description ? "" , description ? ""
, doCheck ? stdenv.lib.versionOlder "7.4" ghc.version , doCheck ? stdenv.lib.versionOlder "7.4" ghc.version
@ -19,7 +19,7 @@
, enableSharedLibraries ? ((ghc.isGhcjs or false) || stdenv.lib.versionOlder "7.7" ghc.version) , enableSharedLibraries ? ((ghc.isGhcjs or false) || stdenv.lib.versionOlder "7.7" ghc.version)
, enableSplitObjs ? !stdenv.isDarwin # http://hackage.haskell.org/trac/ghc/ticket/4013 , enableSplitObjs ? !stdenv.isDarwin # http://hackage.haskell.org/trac/ghc/ticket/4013
, enableStaticLibraries ? true , enableStaticLibraries ? true
, extraLibraries ? [] , extraLibraries ? [], librarySystemDepends ? [], executableSystemDepends ? []
, homepage ? "http://hackage.haskell.org/package/${pname}" , homepage ? "http://hackage.haskell.org/package/${pname}"
, hydraPlatforms ? ghc.meta.hydraPlatforms or ghc.meta.platforms , hydraPlatforms ? ghc.meta.hydraPlatforms or ghc.meta.platforms
, hyperlinkSource ? true , hyperlinkSource ? true
@ -29,9 +29,9 @@
, maintainers ? [] , maintainers ? []
, doHaddock ? true , doHaddock ? true
, passthru ? {} , passthru ? {}
, pkgconfigDepends ? [] , pkgconfigDepends ? [], libraryPkgconfigDepends ? [], executablePkgconfigDepends ? [], testPkgconfigDepends ? []
, platforms ? ghc.meta.platforms , platforms ? ghc.meta.platforms
, testDepends ? [] , testDepends ? [], testHaskellDepends ? [], testSystemDepends ? []
, testTarget ? "" , testTarget ? ""
, broken ? false , broken ? false
, preUnpack ? "", postUnpack ? "" , preUnpack ? "", postUnpack ? ""
@ -84,7 +84,7 @@ let
(optionalString (enableSharedExecutables && stdenv.isLinux) "--ghc-option=-optl=-Wl,-rpath=$out/lib/${ghc.name}/${pname}-${version}") (optionalString (enableSharedExecutables && stdenv.isLinux) "--ghc-option=-optl=-Wl,-rpath=$out/lib/${ghc.name}/${pname}-${version}")
(optionalString (enableSharedExecutables && stdenv.isDarwin) "--ghc-option=-optl=-Wl,-headerpad_max_install_names") (optionalString (enableSharedExecutables && stdenv.isDarwin) "--ghc-option=-optl=-Wl,-headerpad_max_install_names")
(optionalString enableParallelBuilding "--ghc-option=-j$NIX_BUILD_CORES") (optionalString enableParallelBuilding "--ghc-option=-j$NIX_BUILD_CORES")
(optionalString (useCpphs) "--with-cpphs=${cpphs}/bin/cpphs --ghc-options=-cpp --ghc-options=-pgmP${cpphs}/bin/cpphs --ghc-options=-optP--cpp") (optionalString useCpphs "--with-cpphs=${cpphs}/bin/cpphs --ghc-options=-cpp --ghc-options=-pgmP${cpphs}/bin/cpphs --ghc-options=-optP--cpp")
(enableFeature enableSplitObjs "split-objs") (enableFeature enableSplitObjs "split-objs")
(enableFeature enableLibraryProfiling "library-profiling") (enableFeature enableLibraryProfiling "library-profiling")
(enableFeature enableSharedLibraries "shared") (enableFeature enableSharedLibraries "shared")
@ -105,11 +105,11 @@ let
isHaskellPkg = x: (x ? pname) && (x ? version) && (x ? env); isHaskellPkg = x: (x ? pname) && (x ? version) && (x ? env);
isSystemPkg = x: !isHaskellPkg x; isSystemPkg = x: !isHaskellPkg x;
propagatedBuildInputs = buildDepends; propagatedBuildInputs = buildDepends ++ libraryHaskellDepends ++ executableHaskellDepends;
otherBuildInputs = extraLibraries ++ otherBuildInputs = extraLibraries ++ librarySystemDepends ++ executableSystemDepends ++
buildTools ++ buildTools ++ libraryToolDepends ++ executableToolDepends ++
optionals (pkgconfigDepends != []) ([pkgconfig] ++ pkgconfigDepends) ++ optionals (pkgconfigDepends != []) ([pkgconfig] ++ pkgconfigDepends ++ libraryPkgconfigDepends ++ executablePkgconfigDepends) ++
optionals doCheck testDepends; optionals doCheck (testDepends ++ testHaskellDepends ++ testSystemDepends);
allBuildInputs = propagatedBuildInputs ++ otherBuildInputs; allBuildInputs = propagatedBuildInputs ++ otherBuildInputs;
haskellBuildInputs = stdenv.lib.filter isHaskellPkg allBuildInputs; haskellBuildInputs = stdenv.lib.filter isHaskellPkg allBuildInputs;