forked from mirrors/nixpkgs
Merge pull request #40973 from NixOS/revert-40929-cross-ghc-for-master
Revert "ghc, haskell infra: #40642 direct to master"
This commit is contained in:
commit
83baf1e977
|
@ -24,10 +24,6 @@
|
|||
, # Whether to build dynamic libs for the standard library (on the target
|
||||
# platform). Static libs are always built.
|
||||
enableShared ? true
|
||||
|
||||
, # What flavour to build. An empty string indicates no
|
||||
# specific flavour and falls back to ghc default values.
|
||||
ghcFlavour ? stdenv.lib.optionalString (targetPlatform != hostPlatform) "perf-cross"
|
||||
}:
|
||||
|
||||
assert !enableIntegerSimple -> gmp != null;
|
||||
|
@ -46,14 +42,11 @@ let
|
|||
};
|
||||
|
||||
buildMK = ''
|
||||
BuildFlavour = ${ghcFlavour}
|
||||
ifneq \"\$(BuildFlavour)\" \"\"
|
||||
include mk/flavours/\$(BuildFlavour).mk
|
||||
endif
|
||||
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 ''
|
||||
|
@ -75,6 +68,7 @@ let
|
|||
targetCC = builtins.head toolsForTarget;
|
||||
|
||||
in
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
version = "7.10.3";
|
||||
name = "${targetPrefix}ghc-${version}";
|
||||
|
@ -93,8 +87,6 @@ stdenv.mkDerivation rec {
|
|||
./relocation.patch
|
||||
];
|
||||
|
||||
postPatch = "patchShebangs .";
|
||||
|
||||
# GHC is a bit confused on its cross terminology.
|
||||
preConfigure = ''
|
||||
for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do
|
||||
|
@ -111,7 +103,6 @@ stdenv.mkDerivation rec {
|
|||
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) ''
|
||||
|
@ -144,8 +135,7 @@ stdenv.mkDerivation rec {
|
|||
crossConfig = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
perl libxml2 libxslt docbook_xsl docbook_xml_dtd_45 docbook_xml_dtd_42
|
||||
ghc hscolour
|
||||
ghc perl libxml2 libxslt docbook_xsl docbook_xml_dtd_45 docbook_xml_dtd_42 hscolour
|
||||
];
|
||||
|
||||
# For building runtime libs
|
||||
|
|
|
@ -23,10 +23,6 @@
|
|||
, # Whether to build dynamic libs for the standard library (on the target
|
||||
# platform). Static libs are always built.
|
||||
enableShared ? true
|
||||
|
||||
, # What flavour to build. An empty string indicates no
|
||||
# specific flavour and falls back to ghc default values.
|
||||
ghcFlavour ? stdenv.lib.optionalString (targetPlatform != hostPlatform) "perf-cross"
|
||||
}:
|
||||
|
||||
assert !enableIntegerSimple -> gmp != null;
|
||||
|
@ -40,14 +36,11 @@ let
|
|||
"${targetPlatform.config}-";
|
||||
|
||||
buildMK = ''
|
||||
BuildFlavour = ${ghcFlavour}
|
||||
ifneq \"\$(BuildFlavour)\" \"\"
|
||||
include mk/flavours/\$(BuildFlavour).mk
|
||||
endif
|
||||
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 ''
|
||||
|
@ -94,8 +87,6 @@ stdenv.mkDerivation rec {
|
|||
++ stdenv.lib.optional stdenv.isDarwin ./ghc-8.0.2-no-cpp-warnings.patch
|
||||
++ stdenv.lib.optional stdenv.isDarwin ./backport-dylib-command-size-limit.patch;
|
||||
|
||||
postPatch = "patchShebangs .";
|
||||
|
||||
# GHC is a bit confused on its cross terminology.
|
||||
preConfigure = ''
|
||||
for env in $(env | grep '^TARGET_' | sed -E 's|\+?=.*||'); do
|
||||
|
@ -112,7 +103,6 @@ stdenv.mkDerivation rec {
|
|||
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) ''
|
||||
|
@ -144,10 +134,7 @@ stdenv.mkDerivation rec {
|
|||
# masss-rebuild.
|
||||
crossConfig = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
perl sphinx
|
||||
ghc hscolour
|
||||
];
|
||||
nativeBuildInputs = [ ghc perl hscolour sphinx ];
|
||||
|
||||
# For building runtime libs
|
||||
depsBuildTarget = toolsForTarget;
|
||||
|
@ -167,7 +154,7 @@ stdenv.mkDerivation rec {
|
|||
# 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/*
|
||||
paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"}
|
||||
|
||||
# Install the bash completion file.
|
||||
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
|
||||
|
|
|
@ -23,11 +23,10 @@
|
|||
|
||||
, # Whether to build dynamic libs for the standard library (on the target
|
||||
# platform). Static libs are always built.
|
||||
enableShared ? true
|
||||
|
||||
, # What flavour to build. An empty string indicates no
|
||||
# specific flavour and falls back to ghc default values.
|
||||
ghcFlavour ? stdenv.lib.optionalString (targetPlatform != hostPlatform) "perf-cross"
|
||||
enableShared ?
|
||||
!(targetPlatform.isDarwin
|
||||
# On iOS, dynamic linking is not supported
|
||||
&& (targetPlatform.isAarch64 || targetPlatform.isAarch32))
|
||||
, # Whether to backport https://phabricator.haskell.org/D4388 for
|
||||
# deterministic profiling symbol names, at the cost of a slightly
|
||||
# non-standard GHC API
|
||||
|
@ -45,14 +44,11 @@ let
|
|||
"${targetPlatform.config}-";
|
||||
|
||||
buildMK = ''
|
||||
BuildFlavour = ${ghcFlavour}
|
||||
ifneq \"\$(BuildFlavour)\" \"\"
|
||||
include mk/flavours/\$(BuildFlavour).mk
|
||||
endif
|
||||
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
|
||||
|
@ -157,10 +153,7 @@ stdenv.mkDerivation rec {
|
|||
# masss-rebuild.
|
||||
crossConfig = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
autoconf autoreconfHook automake perl python3 sphinx
|
||||
ghc alex happy hscolour
|
||||
];
|
||||
nativeBuildInputs = [ alex autoconf autoreconfHook automake ghc happy hscolour perl python3 sphinx ];
|
||||
|
||||
# For building runtime libs
|
||||
depsBuildTarget = toolsForTarget;
|
||||
|
@ -182,7 +175,7 @@ stdenv.mkDerivation rec {
|
|||
# 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/*
|
||||
paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"}
|
||||
|
||||
# Install the bash completion file.
|
||||
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
# build-tools
|
||||
, bootPkgs, alex, happy
|
||||
, autoconf, automake, coreutils, fetchurl, fetchpatch, perl, python3, m4
|
||||
, autoconf, automake, coreutils, fetchurl, fetchpatch, perl, python3
|
||||
|
||||
, libffi, libiconv ? null, ncurses
|
||||
|
||||
|
@ -15,21 +15,16 @@
|
|||
|
||||
, # 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
|
||||
enableIntegerSimple ? false, gmp ? null, m4
|
||||
|
||||
, # 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.isWindows && !targetPlatform.useAndroidPrebuilt
|
||||
enableShared ? !targetPlatform.useAndroidPrebuilt
|
||||
|
||||
, # Whetherto build terminfo.
|
||||
enableTerminfo ? !targetPlatform.isWindows
|
||||
|
||||
, # What flavour to build. An empty string indicates no
|
||||
# specific flavour and falls back to ghc default values.
|
||||
ghcFlavour ? stdenv.lib.optionalString (targetPlatform != hostPlatform) "perf-cross"
|
||||
, version ? "8.4.2"
|
||||
}:
|
||||
|
||||
assert !enableIntegerSimple -> gmp != null;
|
||||
|
@ -43,14 +38,11 @@ let
|
|||
"${targetPlatform.config}-";
|
||||
|
||||
buildMK = ''
|
||||
BuildFlavour = ${ghcFlavour}
|
||||
ifneq \"\$(BuildFlavour)\" \"\"
|
||||
include mk/flavours/\$(BuildFlavour).mk
|
||||
endif
|
||||
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
|
||||
|
@ -63,9 +55,9 @@ let
|
|||
'';
|
||||
|
||||
# Splicer will pull out correct variations
|
||||
libDeps = platform: stdenv.lib.optional enableTerminfo [ ncurses ]
|
||||
libDeps = platform: [ ncurses ]
|
||||
++ stdenv.lib.optional (!enableIntegerSimple) gmp
|
||||
++ stdenv.lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv;
|
||||
++ stdenv.lib.optional (platform.libc != "glibc") libiconv;
|
||||
|
||||
toolsForTarget =
|
||||
if hostPlatform == buildPlatform then
|
||||
|
@ -77,7 +69,7 @@ let
|
|||
|
||||
in
|
||||
stdenv.mkDerivation rec {
|
||||
version = "8.4.2";
|
||||
inherit version;
|
||||
name = "${targetPrefix}ghc-${version}";
|
||||
|
||||
src = fetchurl {
|
||||
|
@ -134,7 +126,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.libc != "glibc" && !targetPlatform.isWindows) [
|
||||
] ++ 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"
|
||||
|
@ -152,10 +144,7 @@ stdenv.mkDerivation rec {
|
|||
# masss-rebuild.
|
||||
crossConfig = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
perl autoconf automake m4 python3
|
||||
ghc alex happy
|
||||
];
|
||||
nativeBuildInputs = [ ghc perl autoconf automake m4 happy alex python3 ];
|
||||
|
||||
# For building runtime libs
|
||||
depsBuildTarget = toolsForTarget;
|
||||
|
@ -177,7 +166,7 @@ stdenv.mkDerivation rec {
|
|||
# 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/*
|
||||
paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"}
|
||||
|
||||
# Install the bash completion file.
|
||||
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
# build-tools
|
||||
, bootPkgs, alex, happy
|
||||
, autoconf, automake, coreutils, fetchgit, perl, python3, m4
|
||||
, autoconf, automake, coreutils, fetchgit, perl, python3
|
||||
|
||||
, libffi, libiconv ? null, ncurses
|
||||
|
||||
|
@ -22,15 +22,9 @@
|
|||
|
||||
, # Whether to build dynamic libs for the standard library (on the target
|
||||
# platform). Static libs are always built.
|
||||
enableShared ? !targetPlatform.isWindows && !targetPlatform.useAndroidPrebuilt
|
||||
|
||||
, # Whetherto build terminfo.
|
||||
enableTerminfo ? !targetPlatform.isWindows
|
||||
enableShared ? !targetPlatform.useAndroidPrebuilt
|
||||
|
||||
, version ? "8.5.20180118"
|
||||
, # What flavour to build. An empty string indicates no
|
||||
# specific flavour and falls back to ghc default values.
|
||||
ghcFlavour ? stdenv.lib.optionalString (targetPlatform != hostPlatform) "perf-cross"
|
||||
}:
|
||||
|
||||
assert !enableIntegerSimple -> gmp != null;
|
||||
|
@ -44,14 +38,11 @@ let
|
|||
"${targetPlatform.config}-";
|
||||
|
||||
buildMK = ''
|
||||
BuildFlavour = ${ghcFlavour}
|
||||
ifneq \"\$(BuildFlavour)\" \"\"
|
||||
include mk/flavours/\$(BuildFlavour).mk
|
||||
endif
|
||||
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
|
||||
|
@ -64,9 +55,9 @@ let
|
|||
'';
|
||||
|
||||
# Splicer will pull out correct variations
|
||||
libDeps = platform: stdenv.lib.optional enableTerminfo [ ncurses ]
|
||||
libDeps = platform: [ ncurses ]
|
||||
++ stdenv.lib.optional (!enableIntegerSimple) gmp
|
||||
++ stdenv.lib.optional (platform.libc != "glibc" && !targetPlatform.isWindows) libiconv;
|
||||
++ stdenv.lib.optional (platform.libc != "glibc") libiconv;
|
||||
|
||||
toolsForTarget =
|
||||
if hostPlatform == buildPlatform then
|
||||
|
@ -132,7 +123,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.libc != "glibc" && !targetPlatform.isWindows) [
|
||||
] ++ 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"
|
||||
|
@ -150,10 +141,7 @@ stdenv.mkDerivation rec {
|
|||
# masss-rebuild.
|
||||
crossConfig = true;
|
||||
|
||||
nativeBuildInputs = [
|
||||
perl autoconf automake m4 python3
|
||||
ghc alex happy
|
||||
];
|
||||
nativeBuildInputs = [ ghc perl autoconf automake happy alex python3 ];
|
||||
|
||||
# For building runtime libs
|
||||
depsBuildTarget = toolsForTarget;
|
||||
|
@ -175,7 +163,7 @@ stdenv.mkDerivation rec {
|
|||
# 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/*
|
||||
paxmark m $out/lib/${name}/bin/${if targetPlatform != hostPlatform then "ghc" else "{ghc,haddock}"}
|
||||
|
||||
# Install the bash completion file.
|
||||
install -D -m 444 utils/completion/ghc.bash $out/share/bash-completion/completions/${targetPrefix}ghc
|
||||
|
|
|
@ -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 "") + ''
|
||||
|
|
|
@ -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,18 @@ 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 ++
|
||||
otherBuildInputs = setupHaskellDepends ++ extraLibraries ++ librarySystemDepends ++ executableSystemDepends ++
|
||||
optionals (allPkgconfigDepends != []) allPkgconfigDepends ++
|
||||
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 +190,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 +230,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 +282,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 +310,7 @@ stdenv.mkDerivation ({
|
|||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
${setupCommand} build ${buildTarget}${crossCabalFlagsString}${buildFlagsString}
|
||||
${setupCommand} build ${buildTarget}${crossCabalFlagsString}
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
Loading…
Reference in a new issue