Merge pull request #46857 from obsidiansystems/darwin-to-linux-prep

misc pkgs: various cross fixes in preparation for darwin->linux
This commit is contained in:
John Ericson 2018-09-18 16:52:30 -04:00 committed by GitHub
commit 35378f0141
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 44 additions and 37 deletions

View File

@ -116,6 +116,7 @@ let version = "4.8.5";
"--enable-sjlj-exceptions" "--enable-sjlj-exceptions"
"--enable-threads=win32" "--enable-threads=win32"
"--disable-win32-registry" "--disable-win32-registry"
"--disable-libmpx" # requires libc
] else if crossStageStatic then [ ] else if crossStageStatic then [
"--disable-libssp" "--disable-libssp"
"--disable-nls" "--disable-nls"
@ -124,8 +125,9 @@ let version = "4.8.5";
"--disable-libgomp" "--disable-libgomp"
"--disable-libquadmath" "--disable-libquadmath"
"--disable-shared" "--disable-shared"
"--disable-libatomic" # libatomic requires libc "--disable-libatomic" # requires libc
"--disable-decimal-float" # libdecnumber requires libc "--disable-decimal-float" # requires libc
"--disable-libmpx" # requires libc
] else [ ] else [
(if crossDarwin then "--with-sysroot=${getLib libcCross}/share/sysroot" (if crossDarwin then "--with-sysroot=${getLib libcCross}/share/sysroot"
else "--with-headers=${getDev libcCross}/include") else "--with-headers=${getDev libcCross}/include")

View File

@ -121,6 +121,7 @@ let version = "4.9.4";
"--enable-sjlj-exceptions" "--enable-sjlj-exceptions"
"--enable-threads=win32" "--enable-threads=win32"
"--disable-win32-registry" "--disable-win32-registry"
"--disable-libmpx" # requires libc
] else if crossStageStatic then [ ] else if crossStageStatic then [
"--disable-libssp" "--disable-libssp"
"--disable-nls" "--disable-nls"
@ -129,8 +130,9 @@ let version = "4.9.4";
"--disable-libgomp" "--disable-libgomp"
"--disable-libquadmath" "--disable-libquadmath"
"--disable-shared" "--disable-shared"
"--disable-libatomic" # libatomic requires libc "--disable-libatomic" # requires libc
"--disable-decimal-float" # libdecnumber requires libc "--disable-decimal-float" # requires libc
"--disable-libmpx" # requires libc
] else [ ] else [
(if crossDarwin then "--with-sysroot=${getLib libcCross}/share/sysroot" (if crossDarwin then "--with-sysroot=${getLib libcCross}/share/sysroot"
else "--with-headers=${getDev libcCross}/include") else "--with-headers=${getDev libcCross}/include")

View File

@ -107,6 +107,7 @@ let version = "5.5.0";
"--enable-sjlj-exceptions" "--enable-sjlj-exceptions"
"--enable-threads=win32" "--enable-threads=win32"
"--disable-win32-registry" "--disable-win32-registry"
"--disable-libmpx" # requires libc
] else if crossStageStatic then [ ] else if crossStageStatic then [
"--disable-libssp" "--disable-libssp"
"--disable-nls" "--disable-nls"
@ -115,8 +116,9 @@ let version = "5.5.0";
"--disable-libgomp" "--disable-libgomp"
"--disable-libquadmath" "--disable-libquadmath"
"--disable-shared" "--disable-shared"
"--disable-libatomic" # libatomic requires libc "--disable-libatomic" # requires libc
"--disable-decimal-float" # libdecnumber requires libc "--disable-decimal-float" # requires libc
"--disable-libmpx" # requires libc
] else [ ] else [
(if crossDarwin then "--with-sysroot=${getLib libcCross}/share/sysroot" (if crossDarwin then "--with-sysroot=${getLib libcCross}/share/sysroot"
else "--with-headers=${getDev libcCross}/include") else "--with-headers=${getDev libcCross}/include")

View File

@ -105,6 +105,7 @@ let version = "6.4.0";
"--enable-sjlj-exceptions" "--enable-sjlj-exceptions"
"--enable-threads=win32" "--enable-threads=win32"
"--disable-win32-registry" "--disable-win32-registry"
"--disable-libmpx" # requires libc
] else if crossStageStatic then [ ] else if crossStageStatic then [
"--disable-libssp" "--disable-libssp"
"--disable-nls" "--disable-nls"
@ -113,11 +114,9 @@ let version = "6.4.0";
"--disable-libgomp" "--disable-libgomp"
"--disable-libquadmath" "--disable-libquadmath"
"--disable-shared" "--disable-shared"
"--disable-libatomic" # libatomic requires libc "--disable-libatomic" # requires libc
"--disable-decimal-float" # libdecnumber requires libc "--disable-decimal-float" # requires libc
# maybe only needed on musl, PATH_MAX "--disable-libmpx" # requires libc
# https://github.com/richfelker/musl-cross-make/blob/0867cdf300618d1e3e87a0a939fa4427207ad9d7/litecross/Makefile#L62
"--disable-libmpx"
] else [ ] else [
(if crossDarwin then "--with-sysroot=${getLib libcCross}/share/sysroot" (if crossDarwin then "--with-sysroot=${getLib libcCross}/share/sysroot"
else "--with-headers=${getDev libcCross}/include") else "--with-headers=${getDev libcCross}/include")

View File

@ -77,6 +77,7 @@ let version = "7.3.0";
"--enable-sjlj-exceptions" "--enable-sjlj-exceptions"
"--enable-threads=win32" "--enable-threads=win32"
"--disable-win32-registry" "--disable-win32-registry"
"--disable-libmpx" # requires libc
] else if crossStageStatic then [ ] else if crossStageStatic then [
"--disable-libssp" "--disable-libssp"
"--disable-nls" "--disable-nls"
@ -85,11 +86,9 @@ let version = "7.3.0";
"--disable-libgomp" "--disable-libgomp"
"--disable-libquadmath" "--disable-libquadmath"
"--disable-shared" "--disable-shared"
"--disable-libatomic" # libatomic requires libc "--disable-libatomic" # requires libc
"--disable-decimal-float" # libdecnumber requires libc "--disable-decimal-float" # requires libc
# maybe only needed on musl, PATH_MAX "--disable-libmpx" # requires libc
# https://github.com/richfelker/musl-cross-make/blob/0867cdf300618d1e3e87a0a939fa4427207ad9d7/litecross/Makefile#L62
"--disable-libmpx"
] else [ ] else [
(if crossDarwin then "--with-sysroot=${getLib libcCross}/share/sysroot" (if crossDarwin then "--with-sysroot=${getLib libcCross}/share/sysroot"
else "--with-headers=${getDev libcCross}/include") else "--with-headers=${getDev libcCross}/include")

View File

@ -72,6 +72,7 @@ let version = "8.2.0";
"--enable-sjlj-exceptions" "--enable-sjlj-exceptions"
"--enable-threads=win32" "--enable-threads=win32"
"--disable-win32-registry" "--disable-win32-registry"
"--disable-libmpx" # requires libc
] else if crossStageStatic then [ ] else if crossStageStatic then [
"--disable-libssp" "--disable-libssp"
"--disable-nls" "--disable-nls"
@ -80,11 +81,9 @@ let version = "8.2.0";
"--disable-libgomp" "--disable-libgomp"
"--disable-libquadmath" "--disable-libquadmath"
"--disable-shared" "--disable-shared"
"--disable-libatomic" # libatomic requires libc "--disable-libatomic" # requires libc
"--disable-decimal-float" # libdecnumber requires libc "--disable-decimal-float" # requires libc
# maybe only needed on musl, PATH_MAX "--disable-libmpx" # requires libc
# https://github.com/richfelker/musl-cross-make/blob/0867cdf300618d1e3e87a0a939fa4427207ad9d7/litecross/Makefile#L62
"--disable-libmpx"
] else [ ] else [
(if crossDarwin then "--with-sysroot=${getLib libcCross}/share/sysroot" (if crossDarwin then "--with-sysroot=${getLib libcCross}/share/sysroot"
else "--with-headers=${getDev libcCross}/include") else "--with-headers=${getDev libcCross}/include")

View File

@ -69,6 +69,7 @@ let version = "7-20170409";
"--enable-sjlj-exceptions" "--enable-sjlj-exceptions"
"--enable-threads=win32" "--enable-threads=win32"
"--disable-win32-registry" "--disable-win32-registry"
"--disable-libmpx" # requires libc
] else if crossStageStatic then [ ] else if crossStageStatic then [
"--disable-libssp" "--disable-libssp"
"--disable-nls" "--disable-nls"
@ -77,8 +78,9 @@ let version = "7-20170409";
"--disable-libgomp" "--disable-libgomp"
"--disable-libquadmath" "--disable-libquadmath"
"--disable-shared" "--disable-shared"
"--disable-libatomic" # libatomic requires libc "--disable-libatomic" # requires libc
"--disable-decimal-float" # libdecnumber requires libc "--disable-decimal-float" # requires libc
"--disable-libmpx" # requires libc
] else [ ] else [
(if crossDarwin then "--with-sysroot=${getLib libcCross}/share/sysroot" (if crossDarwin then "--with-sysroot=${getLib libcCross}/share/sysroot"
else "--with-headers=${getDev libcCross}/include") else "--with-headers=${getDev libcCross}/include")

View File

@ -94,8 +94,7 @@ callPackage ./common.nix { inherit stdenv; } {
mv $bin/bin/getconf_ $bin/bin/getconf mv $bin/bin/getconf_ $bin/bin/getconf
''; '';
# Hack to get around eval issue. separateDebugInfo = true;
separateDebugInfo = !stdenv.isDarwin;
meta.description = "The GNU C Library"; meta.description = "The GNU C Library";
} }

View File

@ -53,12 +53,15 @@ in lib.init bootStages ++ [
else buildPackages.gcc; else buildPackages.gcc;
extraNativeBuildInputs = old.extraNativeBuildInputs extraNativeBuildInputs = old.extraNativeBuildInputs
++ lib.optionals
(hostPlatform.isLinux && !buildPlatform.isLinux)
[ buildPackages.patchelf buildPackages.paxctl ]
++ lib.optional
(let f = p: !p.isx86 || p.libc == "musl"; in f hostPlatform && !(f buildPlatform))
buildPackages.updateAutotoolsGnuConfigScriptsHook
# without proper `file` command, libtool sometimes fails # without proper `file` command, libtool sometimes fails
# to recognize 64-bit DLLs # to recognize 64-bit DLLs
++ lib.optional (hostPlatform.config == "x86_64-w64-mingw32") buildPackages.file ++ lib.optional (hostPlatform.config == "x86_64-w64-mingw32") buildPackages.file
++ lib.optional
(hostPlatform.isAarch64 || hostPlatform.isMips || hostPlatform.libc == "musl")
buildPackages.updateAutotoolsGnuConfigScriptsHook
; ;
}); });
}) })

View File

@ -83,9 +83,7 @@ rec {
doCheck' = doCheck && stdenv.hostPlatform == stdenv.buildPlatform; doCheck' = doCheck && stdenv.hostPlatform == stdenv.buildPlatform;
doInstallCheck' = doInstallCheck && stdenv.hostPlatform == stdenv.buildPlatform; doInstallCheck' = doInstallCheck && stdenv.hostPlatform == stdenv.buildPlatform;
outputs' = outputs' = outputs ++ lib.optional separateDebugInfo "debug";
outputs ++
(if separateDebugInfo then assert stdenv.hostPlatform.isLinux; [ "debug" ] else []);
fixedOutputDrv = attrs ? outputHash; fixedOutputDrv = attrs ? outputHash;
noNonNativeDeps = builtins.length (depsBuildTarget ++ depsBuildTargetPropagated noNonNativeDeps = builtins.length (depsBuildTarget ++ depsBuildTargetPropagated
@ -176,7 +174,7 @@ rec {
// { // {
# A hack to make `nix-env -qa` and `nix search` ignore broken packages. # A hack to make `nix-env -qa` and `nix search` ignore broken packages.
# TODO(@oxij): remove this assert when something like NixOS/nix#1771 gets merged into nix. # TODO(@oxij): remove this assert when something like NixOS/nix#1771 gets merged into nix.
name = assert validity.handled; name + lib.optionalString name = assert validity.handled && (separateDebugInfo -> stdenv.hostPlatform.isLinux); name + lib.optionalString
# Fixed-output derivations like source tarballs shouldn't get a host # Fixed-output derivations like source tarballs shouldn't get a host
# suffix. But we have some weird ones with run-time deps that are # suffix. But we have some weird ones with run-time deps that are
# just used for their side-affects. Those might as well since the # just used for their side-affects. Those might as well since the

View File

@ -251,7 +251,8 @@ in
}; };
extraNativeBuildInputs = [ prevStage.patchelf prevStage.paxctl ] ++ extraNativeBuildInputs = [ prevStage.patchelf prevStage.paxctl ] ++
# Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64. # Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64.
lib.optional (!localSystem.isx86) prevStage.updateAutotoolsGnuConfigScriptsHook; lib.optional (!localSystem.isx86 || localSystem.libc == "musl")
prevStage.updateAutotoolsGnuConfigScriptsHook;
}) })
@ -292,7 +293,8 @@ in
}; };
extraNativeBuildInputs = [ prevStage.patchelf prevStage.xz ] ++ extraNativeBuildInputs = [ prevStage.patchelf prevStage.xz ] ++
# Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64. # Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64.
lib.optional (!localSystem.isx86) prevStage.updateAutotoolsGnuConfigScriptsHook; lib.optional (!localSystem.isx86 || localSystem.libc == "musl")
prevStage.updateAutotoolsGnuConfigScriptsHook;
}) })
# Construct the final stdenv. It uses the Glibc and GCC, and adds # Construct the final stdenv. It uses the Glibc and GCC, and adds
@ -324,7 +326,8 @@ in
extraNativeBuildInputs = [ prevStage.patchelf prevStage.paxctl ] ++ extraNativeBuildInputs = [ prevStage.patchelf prevStage.paxctl ] ++
# Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64. # Many tarballs come with obsolete config.sub/config.guess that don't recognize aarch64.
lib.optional (!localSystem.isx86) prevStage.updateAutotoolsGnuConfigScriptsHook; lib.optional (!localSystem.isx86 || localSystem.libc == "musl")
prevStage.updateAutotoolsGnuConfigScriptsHook;
cc = prevStage.gcc; cc = prevStage.gcc;
@ -357,7 +360,7 @@ in
++ [ /*propagated from .dev*/ linuxHeaders ++ [ /*propagated from .dev*/ linuxHeaders
binutils gcc gcc.cc gcc.cc.lib gcc.expand-response-params binutils gcc gcc.cc gcc.cc.lib gcc.expand-response-params
] ]
++ lib.optionals (!localSystem.isx86) ++ lib.optionals (!localSystem.isx86 || localSystem.libc == "musl")
[ prevStage.updateAutotoolsGnuConfigScriptsHook prevStage.gnu-config ]; [ prevStage.updateAutotoolsGnuConfigScriptsHook prevStage.gnu-config ];
overrides = self: super: { overrides = self: super: {

View File

@ -6509,7 +6509,6 @@ with pkgs;
libcCross1 = libcCross1 =
if stdenv.targetPlatform.libc == "msvcrt" then targetPackages.windows.mingw_w64_headers if stdenv.targetPlatform.libc == "msvcrt" then targetPackages.windows.mingw_w64_headers
else if stdenv.targetPlatform.libc == "libSystem" then darwin.xcode else if stdenv.targetPlatform.libc == "libSystem" then darwin.xcode
else if stdenv.targetPlatform.libc == "musl" then musl
else null; else null;
binutils1 = wrapBintoolsWith { binutils1 = wrapBintoolsWith {
bintools = binutils-unwrapped; bintools = binutils-unwrapped;