mingw-w64 libc: Multiple outputs and parallel builds

Also deduplicate more of the GCC derivations.
This commit is contained in:
John Ericson 2019-11-11 00:08:45 -05:00
parent 06c5e811e6
commit 999ef20129
11 changed files with 89 additions and 145 deletions

View File

@ -251,24 +251,13 @@ stdenv.mkDerivation ({
++ optionals javaAwtGtk [ gmp mpfr ] ++ optionals javaAwtGtk [ gmp mpfr ]
)); ));
EXTRA_TARGET_FLAGS = optionals inherit
(targetPlatform != hostPlatform && libcCross != null) (import ../common/extra-target-flags.nix {
([ inherit stdenv crossStageStatic libcCross;
"-idirafter ${getDev libcCross}${libcCross.incdir or "/include"}" })
] ++ optionals (! crossStageStatic) [ EXTRA_TARGET_FLAGS
"-B${libcCross.out}${libcCross.libdir or "/lib"}" EXTRA_TARGET_LDFLAGS
]); ;
EXTRA_TARGET_LDFLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-Wl,-L${libcCross.out}${libcCross.libdir or "/lib"}"
] ++ (if crossStageStatic then [
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
] else [
"-Wl,-rpath,${libcCross.out}${libcCross.libdir or "/lib"}"
"-Wl,-rpath-link,${libcCross.out}${libcCross.libdir or "/lib"}"
]));
passthru = { passthru = {
inherit langC langCC langObjC langObjCpp langFortran langGo version; inherit langC langCC langObjC langObjCpp langFortran langGo version;

View File

@ -257,24 +257,13 @@ stdenv.mkDerivation ({
++ optionals javaAwtGtk [ gmp mpfr ] ++ optionals javaAwtGtk [ gmp mpfr ]
)); ));
EXTRA_TARGET_FLAGS = optionals inherit
(targetPlatform != hostPlatform && libcCross != null) (import ../common/extra-target-flags.nix {
([ inherit stdenv crossStageStatic libcCross;
"-idirafter ${getDev libcCross}${libcCross.incdir or "/include"}" })
] ++ optionals (! crossStageStatic) [ EXTRA_TARGET_FLAGS
"-B${libcCross.out}${libcCross.libdir or "/lib"}" EXTRA_TARGET_LDFLAGS
]); ;
EXTRA_TARGET_LDFLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-Wl,-L${libcCross.out}${libcCross.libdir or "/lib"}"
] ++ (if crossStageStatic then [
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
] else [
"-Wl,-rpath,${libcCross.out}${libcCross.libdir or "/lib"}"
"-Wl,-rpath-link,${libcCross.out}${libcCross.libdir or "/lib"}"
]));
passthru = { passthru = {
inherit langC langCC langObjC langObjCpp langFortran langGo version; inherit langC langCC langObjC langObjCpp langFortran langGo version;

View File

@ -264,24 +264,13 @@ stdenv.mkDerivation ({
++ optionals javaAwtGtk [ gmp mpfr ] ++ optionals javaAwtGtk [ gmp mpfr ]
)); ));
EXTRA_TARGET_FLAGS = optionals inherit
(targetPlatform != hostPlatform && libcCross != null) (import ../common/extra-target-flags.nix {
([ inherit stdenv crossStageStatic libcCross;
"-idirafter ${getDev libcCross}${libcCross.incdir or "/include"}" })
] ++ optionals (! crossStageStatic) [ EXTRA_TARGET_FLAGS
"-B${libcCross.out}${libcCross.libdir or "/lib"}" EXTRA_TARGET_LDFLAGS
]); ;
EXTRA_TARGET_LDFLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-Wl,-L${libcCross.out}${libcCross.libdir or "/lib"}"
] ++ (if crossStageStatic then [
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
] else [
"-Wl,-rpath,${libcCross.out}${libcCross.libdir or "/lib"}"
"-Wl,-rpath-link,${libcCross.out}${libcCross.libdir or "/lib"}"
]));
passthru = { passthru = {
inherit langC langCC langObjC langObjCpp langFortran langGo version; inherit langC langCC langObjC langObjCpp langFortran langGo version;

View File

@ -266,24 +266,13 @@ stdenv.mkDerivation ({
++ optionals javaAwtGtk [ gmp mpfr ] ++ optionals javaAwtGtk [ gmp mpfr ]
)); ));
EXTRA_TARGET_FLAGS = optionals inherit
(targetPlatform != hostPlatform && libcCross != null) (import ../common/extra-target-flags.nix {
([ inherit stdenv crossStageStatic libcCross;
"-idirafter ${getDev libcCross}${libcCross.incdir or "/include"}" })
] ++ optionals (! crossStageStatic) [ EXTRA_TARGET_FLAGS
"-B${libcCross.out}${libcCross.libdir or "/lib"}" EXTRA_TARGET_LDFLAGS
]); ;
EXTRA_TARGET_LDFLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-Wl,-L${libcCross.out}${libcCross.libdir or "/lib"}"
] ++ (if crossStageStatic then [
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
] else [
"-Wl,-rpath,${libcCross.out}${libcCross.libdir or "/lib"}"
"-Wl,-rpath-link,${libcCross.out}${libcCross.libdir or "/lib"}"
]));
passthru = { passthru = {
inherit langC langCC langObjC langObjCpp langFortran langGo version; inherit langC langCC langObjC langObjCpp langFortran langGo version;

View File

@ -230,24 +230,13 @@ stdenv.mkDerivation ({
LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath (optional (zlib != null) zlib)); LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath (optional (zlib != null) zlib));
EXTRA_TARGET_FLAGS = optionals inherit
(targetPlatform != hostPlatform && libcCross != null) (import ../common/extra-target-flags.nix {
([ inherit stdenv crossStageStatic libcCross;
"-idirafter ${getDev libcCross}${libcCross.incdir or "/include"}" })
] ++ optionals (! crossStageStatic) [ EXTRA_TARGET_FLAGS
"-B${libcCross.out}${libcCross.libdir or "/lib"}" EXTRA_TARGET_LDFLAGS
]); ;
EXTRA_TARGET_LDFLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-Wl,-L${libcCross.out}${libcCross.libdir or "/lib"}"
] ++ (if crossStageStatic then [
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
] else [
"-Wl,-rpath,${libcCross.out}${libcCross.libdir or "/lib"}"
"-Wl,-rpath-link,${libcCross.out}${libcCross.libdir or "/lib"}"
]));
passthru = { passthru = {
inherit langC langCC langObjC langObjCpp langFortran langGo version; inherit langC langCC langObjC langObjCpp langFortran langGo version;

View File

@ -212,24 +212,13 @@ stdenv.mkDerivation ({
LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath (optional (zlib != null) zlib)); LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath (optional (zlib != null) zlib));
EXTRA_TARGET_FLAGS = optionals inherit
(targetPlatform != hostPlatform && libcCross != null) (import ../common/extra-target-flags.nix {
([ inherit stdenv crossStageStatic libcCross;
"-idirafter ${getDev libcCross}${libcCross.incdir or "/include"}" })
] ++ optionals (! crossStageStatic) [ EXTRA_TARGET_FLAGS
"-B${libcCross.out}${libcCross.libdir or "/lib"}" EXTRA_TARGET_LDFLAGS
]); ;
EXTRA_TARGET_LDFLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-Wl,-L${libcCross.out}${libcCross.libdir or "/lib"}"
] ++ (if crossStageStatic then [
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
] else [
"-Wl,-rpath,${libcCross.out}${libcCross.libdir or "/lib"}"
"-Wl,-rpath-link,${libcCross.out}${libcCross.libdir or "/lib"}"
]));
passthru = { passthru = {
inherit langC langCC langObjC langObjCpp langFortran langGo version; inherit langC langCC langObjC langObjCpp langFortran langGo version;

View File

@ -211,24 +211,13 @@ stdenv.mkDerivation ({
LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath (optional (zlib != null) zlib)); LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath (optional (zlib != null) zlib));
EXTRA_TARGET_FLAGS = optionals inherit
(targetPlatform != hostPlatform && libcCross != null) (import ../common/extra-target-flags.nix {
([ inherit stdenv crossStageStatic libcCross;
"-idirafter ${getDev libcCross}${libcCross.incdir or "/include"}" })
] ++ optionals (! crossStageStatic) [ EXTRA_TARGET_FLAGS
"-B${libcCross.out}${libcCross.libdir or "/lib"}" EXTRA_TARGET_LDFLAGS
]); ;
EXTRA_TARGET_LDFLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-Wl,-L${libcCross.out}${libcCross.libdir or "/lib"}"
] ++ (if crossStageStatic then [
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
] else [
"-Wl,-rpath,${libcCross.out}${libcCross.libdir or "/lib"}"
"-Wl,-rpath-link,${libcCross.out}${libcCross.libdir or "/lib"}"
]));
passthru = { passthru = {
inherit langC langCC langObjC langObjCpp langFortran langGo version; inherit langC langCC langObjC langObjCpp langFortran langGo version;

View File

@ -49,7 +49,7 @@ let
"--disable-decimal-float" # requires libc "--disable-decimal-float" # requires libc
"--disable-libmpx" # requires libc "--disable-libmpx" # requires libc
] ++ lib.optionals crossMingw [ ] ++ lib.optionals crossMingw [
"--with-headers=${libcCross}/include" "--with-headers=${lib.getDev libcCross}/include"
"--with-gcc" "--with-gcc"
"--with-gnu-as" "--with-gnu-as"
"--with-gnu-ld" "--with-gnu-ld"

View File

@ -0,0 +1,28 @@
{ stdenv, crossStageStatic, libcCross }:
let
inherit (stdenv) lib hostPlatform targetPlatform;
in
{
EXTRA_TARGET_FLAGS = let
mkFlags = dep: lib.optionals (targetPlatform != hostPlatform && dep != null) ([
"-idirafter ${lib.getDev dep}${dep.incdir or "/include"}"
] ++ stdenv.lib.optionals (! crossStageStatic) [
"-B${lib.getLib dep}${dep.libdir or "/lib"}"
]);
in mkFlags libcCross
;
EXTRA_TARGET_LDFLAGS = let
mkFlags = dep: lib.optionals (targetPlatform != hostPlatform && dep != null) ([
"-Wl,-L${lib.getLib dep}${dep.libdir or "/lib"}"
] ++ (if crossStageStatic then [
"-B${lib.getLib dep}${dep.libdir or "/lib"}"
] else [
"-Wl,-rpath,${lib.getLib dep}${dep.libdir or "/lib"}"
"-Wl,-rpath-link,${lib.getLib dep}${dep.libdir or "/lib"}"
]));
in mkFlags libcCross
;
}

View File

@ -184,24 +184,13 @@ stdenv.mkDerivation ({
LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath (optional (zlib != null) zlib)); LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath (optional (zlib != null) zlib));
EXTRA_TARGET_FLAGS = optionals inherit
(targetPlatform != hostPlatform && libcCross != null) (import ../common/extra-target-flags.nix {
([ inherit stdenv crossStageStatic libcCross;
"-idirafter ${getDev libcCross}${libcCross.incdir or "/include"}" })
] ++ optionals (! crossStageStatic) [ EXTRA_TARGET_FLAGS
"-B${libcCross.out}${libcCross.libdir or "/lib"}" EXTRA_TARGET_LDFLAGS
]); ;
EXTRA_TARGET_LDFLAGS = optionals
(targetPlatform != hostPlatform && libcCross != null)
([
"-Wl,-L${libcCross.out}${libcCross.libdir or "/lib"}"
] ++ (if crossStageStatic then [
"-B${libcCross.out}${libcCross.libdir or "/lib"}"
] else [
"-Wl,-rpath,${libcCross.out}${libcCross.libdir or "/lib"}"
"-Wl,-rpath-link,${libcCross.out}${libcCross.libdir or "/lib"}"
]));
passthru = { passthru = {
inherit langC langCC langObjC langObjCpp langFortran langGo version; inherit langC langCC langObjC langObjCpp langFortran langGo version;

View File

@ -11,11 +11,15 @@ in stdenv.mkDerivation {
sha256 = "00zq3z1hbzd5yzmskskjg79xrzwsqx7ihyprfaxy4hb897vf29sm"; sha256 = "00zq3z1hbzd5yzmskskjg79xrzwsqx7ihyprfaxy4hb897vf29sm";
}; };
outputs = [ "out" "dev" ];
configureFlags = [ configureFlags = [
"--enable-idl" "--enable-idl"
"--enable-secure-api" "--enable-secure-api"
]; ];
enableParallelBuilding = true;
buildInputs = [ windows.mingw_w64_headers ]; buildInputs = [ windows.mingw_w64_headers ];
dontStrip = true; dontStrip = true;
hardeningDisable = [ "stackprotector" "fortify" ]; hardeningDisable = [ "stackprotector" "fortify" ];