mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-21 22:43:01 +00:00
haskellPackages.mkDerivation: remove version checks for unsupported GHC
Most of the version checks for GHC can be removed, because they target versions which are not part of nixpkgs anymore.
This commit is contained in:
parent
7d25d060eb
commit
eb56edbce0
@ -27,10 +27,10 @@ in
|
||||
, buildFlags ? []
|
||||
, haddockFlags ? []
|
||||
, description ? null
|
||||
, doCheck ? !isCross && lib.versionOlder "7.4" ghc.version
|
||||
, doCheck ? !isCross
|
||||
, doBenchmark ? false
|
||||
, doHoogle ? true
|
||||
, doHaddockQuickjump ? doHoogle && lib.versionAtLeast ghc.version "8.6"
|
||||
, doHaddockQuickjump ? doHoogle
|
||||
, doInstallIntermediates ? false
|
||||
, editedCabalFile ? null
|
||||
, enableLibraryProfiling ? !(ghc.isGhcjs or false)
|
||||
@ -41,7 +41,7 @@ in
|
||||
, enableSharedLibraries ? !stdenv.hostPlatform.isStatic && (ghc.enableShared or false)
|
||||
, enableDeadCodeElimination ? (!stdenv.isDarwin) # TODO: use -dead_strip for darwin
|
||||
, enableStaticLibraries ? !(stdenv.hostPlatform.isWindows or stdenv.hostPlatform.isWasm)
|
||||
, enableHsc2hsViaAsm ? stdenv.hostPlatform.isWindows && lib.versionAtLeast ghc.version "8.4"
|
||||
, enableHsc2hsViaAsm ? stdenv.hostPlatform.isWindows
|
||||
, extraLibraries ? [], librarySystemDepends ? [], executableSystemDepends ? []
|
||||
# On macOS, statically linking against system frameworks is not supported;
|
||||
# see https://developer.apple.com/library/content/qa/qa1118/_index.html
|
||||
@ -125,23 +125,17 @@ assert stdenv.hostPlatform.isWasm -> enableStaticLibraries == false;
|
||||
|
||||
let
|
||||
|
||||
inherit (lib) optional optionals optionalString versionOlder versionAtLeast
|
||||
inherit (lib) optional optionals optionalString versionAtLeast
|
||||
concatStringsSep enableFeature optionalAttrs;
|
||||
|
||||
isGhcjs = ghc.isGhcjs or false;
|
||||
isHaLVM = ghc.isHaLVM or false;
|
||||
packageDbFlag = if isGhcjs || isHaLVM || versionOlder "7.6" ghc.version
|
||||
then "package-db"
|
||||
else "package-conf";
|
||||
|
||||
# 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";
|
||||
|
||||
# the target dir for haddock documentation
|
||||
docdir = docoutput: docoutput + "/share/doc/" + pname + "-" + version;
|
||||
@ -233,19 +227,19 @@ let
|
||||
(optionalString (enableSharedExecutables && stdenv.isDarwin) "--ghc-option=-optl=-Wl,-headerpad_max_install_names")
|
||||
(optionalString enableParallelBuilding "--ghc-options=${parallelBuildingFlags}")
|
||||
(optionalString useCpphs "--with-cpphs=${cpphs}/bin/cpphs --ghc-options=-cpp --ghc-options=-pgmP${cpphs}/bin/cpphs --ghc-options=-optP--cpp")
|
||||
(enableFeature (enableDeadCodeElimination && !stdenv.hostPlatform.isAarch32 && !stdenv.hostPlatform.isAarch64 && (versionAtLeast "8.0.1" ghc.version)) "split-objs")
|
||||
(enableFeature false "split-objs")
|
||||
(enableFeature enableLibraryProfiling "library-profiling")
|
||||
(optionalString ((enableExecutableProfiling || enableLibraryProfiling) && versionOlder "8" ghc.version) "--profiling-detail=${profilingDetail}")
|
||||
(enableFeature enableExecutableProfiling (if versionOlder ghc.version "8" then "executable-profiling" else "profiling"))
|
||||
(optionalString (enableExecutableProfiling || enableLibraryProfiling) "--profiling-detail=${profilingDetail}")
|
||||
(enableFeature enableExecutableProfiling "profiling")
|
||||
(enableFeature enableSharedLibraries "shared")
|
||||
(optionalString (versionAtLeast ghc.version "7.10") (enableFeature doCoverage "coverage"))
|
||||
(optionalString (versionOlder "8.4" ghc.version) (enableFeature enableStaticLibraries "static"))
|
||||
(optionalString (isGhcjs || versionOlder "7.4" ghc.version) (enableFeature enableSharedExecutables "executable-dynamic"))
|
||||
(optionalString (isGhcjs || versionOlder "7" ghc.version) (enableFeature doCheck "tests"))
|
||||
(enableFeature doCoverage "coverage")
|
||||
(enableFeature enableStaticLibraries "static")
|
||||
(enableFeature enableSharedExecutables "executable-dynamic")
|
||||
(enableFeature doCheck "tests")
|
||||
(enableFeature doBenchmark "benchmarks")
|
||||
"--enable-library-vanilla" # TODO: Should this be configurable?
|
||||
(enableFeature enableLibraryForGhci "library-for-ghci")
|
||||
] ++ optionals (enableDeadCodeElimination && (lib.versionOlder "8.0.1" ghc.version)) [
|
||||
] ++ optionals (enableDeadCodeElimination) [
|
||||
"--ghc-option=-split-sections"
|
||||
] ++ optionals dontStrip [
|
||||
"--disable-library-stripping"
|
||||
@ -264,7 +258,7 @@ let
|
||||
postPhases = optional doInstallIntermediates "installIntermediatesPhase";
|
||||
|
||||
setupCompileFlags = [
|
||||
(optionalString (!coreSetup) "-${nativePackageDbFlag}=$setupPackageConfDir")
|
||||
(optionalString (!coreSetup) "-package-db=$setupPackageConfDir")
|
||||
(optionalString enableParallelBuilding parallelBuildingFlags)
|
||||
"-threaded" # https://github.com/haskell/cabal/issues/2398
|
||||
"-rtsopts" # allow us to pass RTS flags to the generated Setup executable
|
||||
@ -433,7 +427,7 @@ stdenv.mkDerivation ({
|
||||
for p in "''${pkgsBuildBuild[@]}" "''${pkgsBuildHost[@]}" "''${pkgsBuildTarget[@]}"; do
|
||||
${buildPkgDb nativeGhc "$setupPackageConfDir"}
|
||||
done
|
||||
${nativeGhcCommand}-pkg --${nativePackageDbFlag}="$setupPackageConfDir" recache
|
||||
${nativeGhcCommand}-pkg --package-db="$setupPackageConfDir" recache
|
||||
''
|
||||
# For normal components
|
||||
+ ''
|
||||
@ -445,12 +439,9 @@ stdenv.mkDerivation ({
|
||||
if [ -d "$p/lib" ]; then
|
||||
configureFlags+=" --extra-lib-dirs=$p/lib"
|
||||
fi
|
||||
''
|
||||
# It is not clear why --extra-framework-dirs does work fine on Linux
|
||||
+ optionalString (!stdenv.buildPlatform.isDarwin || versionAtLeast nativeGhc.version "8.0") ''
|
||||
if [[ -d "$p/Library/Frameworks" ]]; then
|
||||
configureFlags+=" --extra-framework-dirs=$p/Library/Frameworks"
|
||||
fi
|
||||
if [[ -d "$p/Library/Frameworks" ]]; then
|
||||
configureFlags+=" --extra-framework-dirs=$p/Library/Frameworks"
|
||||
fi
|
||||
'' + ''
|
||||
done
|
||||
''
|
||||
@ -490,7 +481,7 @@ stdenv.mkDerivation ({
|
||||
sed -i "s,dynamic-library-dirs: .*,dynamic-library-dirs: $dynamicLinksDir," "$f"
|
||||
done
|
||||
'') + ''
|
||||
${ghcCommand}-pkg --${packageDbFlag}="$packageConfDir" recache
|
||||
${ghcCommand}-pkg --package-db="$packageConfDir" recache
|
||||
|
||||
runHook postSetupCompilerEnvironment
|
||||
'';
|
||||
@ -622,11 +613,7 @@ stdenv.mkDerivation ({
|
||||
done
|
||||
''}
|
||||
${optionalString doCoverage "mkdir -p $out/share && cp -r dist/hpc $out/share"}
|
||||
${optionalString (enableSharedExecutables && isExecutable && !isGhcjs && stdenv.isDarwin && lib.versionOlder ghc.version "7.10") ''
|
||||
for exe in "${binDir}/"* ; do
|
||||
install_name_tool -add_rpath "$out/${ghcLibdir}/${pname}-${version}" "$exe"
|
||||
done
|
||||
''}
|
||||
|
||||
|
||||
${optionalString enableSeparateDocOutput ''
|
||||
for x in ${docdir "$doc"}"/html/src/"*.html; do
|
||||
|
@ -398,7 +398,7 @@ rec {
|
||||
|
||||
# Some information about which phases should be run.
|
||||
controlPhases = ghc: let inherit (ghcInfo ghc) isCross; in
|
||||
{ doCheck ? !isCross && (lib.versionOlder "7.4" ghc.version)
|
||||
{ doCheck ? !isCross
|
||||
, doBenchmark ? false
|
||||
, ...
|
||||
}: { inherit doCheck doBenchmark; };
|
||||
|
@ -47,8 +47,6 @@ let
|
||||
|
||||
isGhcjs = ghc.isGhcjs or false;
|
||||
isHaLVM = ghc.isHaLVM or false;
|
||||
ghc761OrLater = isGhcjs || isHaLVM || lib.versionOlder "7.6.1" ghc.version;
|
||||
packageDBFlag = if ghc761OrLater then "--global-package-db" else "--global-conf";
|
||||
ghcCommand' = if isGhcjs then "ghcjs" else "ghc";
|
||||
ghcCommand = "${ghc.targetPrefix}${ghcCommand'}";
|
||||
ghcCommandCaps= lib.toUpper ghcCommand';
|
||||
@ -122,7 +120,7 @@ symlinkJoin {
|
||||
for prg in ${ghcCommand}-pkg ${ghcCommand}-pkg-${ghc.version}; do
|
||||
if [[ -x "${ghc}/bin/$prg" ]]; then
|
||||
rm -f $out/bin/$prg
|
||||
makeWrapper ${ghc}/bin/$prg $out/bin/$prg --add-flags "${packageDBFlag}=${packageCfgDir}"
|
||||
makeWrapper ${ghc}/bin/$prg $out/bin/$prg --add-flags "--global-package-db=${packageCfgDir}"
|
||||
fi
|
||||
done
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user