haskell: allow separate bin output, disable by default
This commit is contained in:
parent
dcf40f7c24
commit
bd06834d5e
@ -73,6 +73,7 @@ in
|
|||||||
, coreSetup ? false # Use only core packages to build Setup.hs.
|
, coreSetup ? false # Use only core packages to build Setup.hs.
|
||||||
, useCpphs ? false
|
, useCpphs ? false
|
||||||
, hardeningDisable ? stdenv.lib.optional (ghc.isHaLVM or false) "all"
|
, hardeningDisable ? stdenv.lib.optional (ghc.isHaLVM or false) "all"
|
||||||
|
, enableSeparateBinOutput ? false
|
||||||
, enableSeparateDataOutput ? false
|
, enableSeparateDataOutput ? false
|
||||||
, enableSeparateDocOutput ? doHaddock
|
, enableSeparateDocOutput ? doHaddock
|
||||||
, # Don't fail at configure time if there are multiple versions of the
|
, # Don't fail at configure time if there are multiple versions of the
|
||||||
@ -111,6 +112,8 @@ let
|
|||||||
# the target dir for haddock documentation
|
# the target dir for haddock documentation
|
||||||
docdir = docoutput: docoutput + "/share/doc/" + pname + "-" + version;
|
docdir = docoutput: docoutput + "/share/doc/" + pname + "-" + version;
|
||||||
|
|
||||||
|
binDir = if enableSeparateBinOutput then "$bin/bin" else "$out/bin";
|
||||||
|
|
||||||
newCabalFileUrl = "http://hackage.haskell.org/package/${pname}-${version}/revision/${revision}.cabal";
|
newCabalFileUrl = "http://hackage.haskell.org/package/${pname}-${version}/revision/${revision}.cabal";
|
||||||
newCabalFile = fetchurl {
|
newCabalFile = fetchurl {
|
||||||
url = newCabalFileUrl;
|
url = newCabalFileUrl;
|
||||||
@ -143,7 +146,10 @@ let
|
|||||||
buildFlagsString = optionalString (buildFlags != []) (" " + concatStringsSep " " buildFlags);
|
buildFlagsString = optionalString (buildFlags != []) (" " + concatStringsSep " " buildFlags);
|
||||||
|
|
||||||
defaultConfigureFlags = [
|
defaultConfigureFlags = [
|
||||||
"--verbose" "--prefix=$out" "--libdir=\\$prefix/lib/\\$compiler" "--libsubdir=\\$abi/\\$libname"
|
"--verbose"
|
||||||
|
"--prefix=$out"
|
||||||
|
"--libdir=\\$prefix/lib/\\$compiler"
|
||||||
|
"--libsubdir=\\$abi/\\$libname"
|
||||||
(optionalString enableSeparateDataOutput "--datadir=$data/share/${ghc.name}")
|
(optionalString enableSeparateDataOutput "--datadir=$data/share/${ghc.name}")
|
||||||
(optionalString enableSeparateDocOutput "--docdir=${docdir "$doc"}")
|
(optionalString enableSeparateDocOutput "--docdir=${docdir "$doc"}")
|
||||||
"--with-gcc=$CC" # Clang won't work without that extra information.
|
"--with-gcc=$CC" # Clang won't work without that extra information.
|
||||||
@ -173,7 +179,8 @@ let
|
|||||||
"--ghcjs"
|
"--ghcjs"
|
||||||
] ++ optionals isCross ([
|
] ++ optionals isCross ([
|
||||||
"--configure-option=--host=${stdenv.hostPlatform.config}"
|
"--configure-option=--host=${stdenv.hostPlatform.config}"
|
||||||
] ++ crossCabalFlags);
|
] ++ crossCabalFlags
|
||||||
|
) ++ optionals enableSeparateBinOutput ["--bindir=${binDir}"];
|
||||||
|
|
||||||
setupCompileFlags = [
|
setupCompileFlags = [
|
||||||
(optionalString (!coreSetup) "-${nativePackageDbFlag}=$setupPackageConfDir")
|
(optionalString (!coreSetup) "-${nativePackageDbFlag}=$setupPackageConfDir")
|
||||||
@ -233,7 +240,10 @@ assert allPkgconfigDepends != [] -> pkgconfig != null;
|
|||||||
stdenv.mkDerivation ({
|
stdenv.mkDerivation ({
|
||||||
name = "${pname}-${version}";
|
name = "${pname}-${version}";
|
||||||
|
|
||||||
outputs = [ "out" ] ++ (optional enableSeparateDataOutput "data") ++ (optional enableSeparateDocOutput "doc");
|
outputs = [ "out" ]
|
||||||
|
++ (optional enableSeparateDataOutput "data")
|
||||||
|
++ (optional enableSeparateDocOutput "doc")
|
||||||
|
++ (optional enableSeparateBinOutput "bin");
|
||||||
setOutputFlags = false;
|
setOutputFlags = false;
|
||||||
|
|
||||||
pos = builtins.unsafeGetAttrPos "pname" args;
|
pos = builtins.unsafeGetAttrPos "pname" args;
|
||||||
@ -414,7 +424,7 @@ stdenv.mkDerivation ({
|
|||||||
find $packageConfDir -maxdepth 0 -empty -delete;
|
find $packageConfDir -maxdepth 0 -empty -delete;
|
||||||
''}
|
''}
|
||||||
${optionalString isGhcjs ''
|
${optionalString isGhcjs ''
|
||||||
for exeDir in "$out/bin/"*.jsexe; do
|
for exeDir in "${binDir}/"*.jsexe; do
|
||||||
exe="''${exeDir%.jsexe}"
|
exe="''${exeDir%.jsexe}"
|
||||||
printWords '#!${nodejs}/bin/node' > "$exe"
|
printWords '#!${nodejs}/bin/node' > "$exe"
|
||||||
echo >> "$exe"
|
echo >> "$exe"
|
||||||
@ -424,7 +434,7 @@ stdenv.mkDerivation ({
|
|||||||
''}
|
''}
|
||||||
${optionalString doCoverage "mkdir -p $out/share && cp -r dist/hpc $out/share"}
|
${optionalString doCoverage "mkdir -p $out/share && cp -r dist/hpc $out/share"}
|
||||||
${optionalString (enableSharedExecutables && isExecutable && !isGhcjs && stdenv.isDarwin && stdenv.lib.versionOlder ghc.version "7.10") ''
|
${optionalString (enableSharedExecutables && isExecutable && !isGhcjs && stdenv.isDarwin && stdenv.lib.versionOlder ghc.version "7.10") ''
|
||||||
for exe in "$out/bin/"* ; do
|
for exe in "${binDir}/"* ; do
|
||||||
install_name_tool -add_rpath "$out/lib/ghc-${ghc.version}/${pname}-${version}" "$exe"
|
install_name_tool -add_rpath "$out/lib/ghc-${ghc.version}/${pname}-${version}" "$exe"
|
||||||
done
|
done
|
||||||
''}
|
''}
|
||||||
|
@ -181,6 +181,8 @@ rec {
|
|||||||
enableStaticLibraries = drv: overrideCabal drv (drv: { enableStaticLibraries = true; });
|
enableStaticLibraries = drv: overrideCabal drv (drv: { enableStaticLibraries = true; });
|
||||||
disableStaticLibraries = drv: overrideCabal drv (drv: { enableStaticLibraries = false; });
|
disableStaticLibraries = drv: overrideCabal drv (drv: { enableStaticLibraries = false; });
|
||||||
|
|
||||||
|
enableSeparateBinOutput = drv: overrideCabal drv (drv: { enableSeparateBinOutput = true; });
|
||||||
|
|
||||||
appendPatch = drv: x: appendPatches drv [x];
|
appendPatch = drv: x: appendPatches drv [x];
|
||||||
appendPatches = drv: xs: overrideCabal drv (drv: { patches = (drv.patches or []) ++ xs; });
|
appendPatches = drv: xs: overrideCabal drv (drv: { patches = (drv.patches or []) ++ xs; });
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user