From 9be118223b641f85233805deabbe1fd52e927bad Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 14 May 2018 20:31:27 -0400 Subject: [PATCH 1/3] misc mingw: Get rid of crossConfig and clean up Style of dual implementation and headers derivations is take from bb7067f882bf3c53ea68780a8ec0a7117f563253. --- pkgs/os-specific/windows/mingwrt/common.nix | 12 +++++++ pkgs/os-specific/windows/mingwrt/default.nix | 32 +++--------------- pkgs/os-specific/windows/mingwrt/headers.nix | 17 ++++++++++ pkgs/os-specific/windows/w32api/common.nix | 14 ++++++++ pkgs/os-specific/windows/w32api/default.nix | 34 +++----------------- pkgs/os-specific/windows/w32api/headers.nix | 17 ++++++++++ pkgs/top-level/all-packages.nix | 18 +++-------- 7 files changed, 73 insertions(+), 71 deletions(-) create mode 100644 pkgs/os-specific/windows/mingwrt/common.nix create mode 100644 pkgs/os-specific/windows/mingwrt/headers.nix create mode 100644 pkgs/os-specific/windows/w32api/common.nix create mode 100644 pkgs/os-specific/windows/w32api/headers.nix diff --git a/pkgs/os-specific/windows/mingwrt/common.nix b/pkgs/os-specific/windows/mingwrt/common.nix new file mode 100644 index 000000000000..7dc2ae56aa84 --- /dev/null +++ b/pkgs/os-specific/windows/mingwrt/common.nix @@ -0,0 +1,12 @@ +{ lib, fetchurl }: + +rec { + name = "mingwrt-3.20"; + + src = fetchurl { + url = "mirror://sourceforge/mingw/MinGW/Base/mingw-rt/${name}-mingw32-src.tar.gz"; + sha256 = "02pydg1m8y35nxb4k34nlb5c341y2waq76z42mgdzlcf661r91pi"; + }; + + meta.platforms = [ lib.systems.inspect.isMinGW ]; +} diff --git a/pkgs/os-specific/windows/mingwrt/default.nix b/pkgs/os-specific/windows/mingwrt/default.nix index 98461d690d92..3429f7564ade 100644 --- a/pkgs/os-specific/windows/mingwrt/default.nix +++ b/pkgs/os-specific/windows/mingwrt/default.nix @@ -1,29 +1,7 @@ -{stdenv, fetchurl, binutils ? null, gccCross ? null, onlyHeaders ? false}: - -let - name = "mingwrt-3.20"; -in -stdenv.mkDerivation (rec { - inherit name; - - src = fetchurl { - url = "mirror://sourceforge/mingw/MinGW/Base/mingw-rt/${name}-mingw32-src.tar.gz"; - sha256 = "02pydg1m8y35nxb4k34nlb5c341y2waq76z42mgdzlcf661r91pi"; - }; - -} // -(if onlyHeaders then { - name = name + "-headers"; - phases = [ "unpackPhase" "installPhase" ]; - installPhase = '' - mkdir -p $out - cp -R include $out - ''; -} else { - buildInputs = [ gccCross binutils ]; - - crossConfig = gccCross.crossConfig; +{ stdenv, callPackage }: +stdenv.mkDerivation { + inherit (callPackage ./common.nix {}) name src meta; dontStrip = true; -}) -) + hardeningDisable = [ "stackprotector" "fortify" ]; +} diff --git a/pkgs/os-specific/windows/mingwrt/headers.nix b/pkgs/os-specific/windows/mingwrt/headers.nix new file mode 100644 index 000000000000..51180af0fc73 --- /dev/null +++ b/pkgs/os-specific/windows/mingwrt/headers.nix @@ -0,0 +1,17 @@ +{ stdenvNoCC, callPackage }: + +let + inherit (callPackage ./common.nix {}) name src meta; + +in stdenvNoCC.mkDerivation { + name = name + "-headers"; + + inherit src meta; + + phases = [ "unpackPhase" "installPhase" ]; + + installPhase = '' + mkdir -p $out + cp -R include $out + ''; +} diff --git a/pkgs/os-specific/windows/w32api/common.nix b/pkgs/os-specific/windows/w32api/common.nix new file mode 100644 index 000000000000..273ae2c8df4b --- /dev/null +++ b/pkgs/os-specific/windows/w32api/common.nix @@ -0,0 +1,14 @@ +{ fetchurl, xz }: + +rec { + name = "w32api-3.17-2"; + + src = fetchurl { + url = "mirror://sourceforge/mingw/MinGW/Base/w32api/w32api-3.17/${name}-mingw32-src.tar.lzma"; + sha256 = "09rhnl6zikmdyb960im55jck0rdy5z9nlg3akx68ixn7khf3j8wb"; + }; + + nativeBuildInputs = [ xz ]; + + meta.platforms = [ lib.systems.inspect.isMinGW ]; +} diff --git a/pkgs/os-specific/windows/w32api/default.nix b/pkgs/os-specific/windows/w32api/default.nix index 3443fff9668d..51b88201998c 100644 --- a/pkgs/os-specific/windows/w32api/default.nix +++ b/pkgs/os-specific/windows/w32api/default.nix @@ -1,32 +1,6 @@ -{ stdenv, fetchurl, xz, binutils ? null -, gccCross ? null, onlyHeaders ? false }: - -let - name = "w32api-3.17-2"; -in -stdenv.mkDerivation ({ - inherit name; - - src = fetchurl { - url = "mirror://sourceforge/mingw/MinGW/Base/w32api/w32api-3.17/${name}-mingw32-src.tar.lzma"; - sha256 = "09rhnl6zikmdyb960im55jck0rdy5z9nlg3akx68ixn7khf3j8wb"; - }; - - nativeBuildInputs = [ xz ]; - -} // -(if onlyHeaders then { - name = name + "-headers"; - phases = [ "unpackPhase" "installPhase" ]; - installPhase = '' - mkdir -p $out - cp -R include $out - ''; -} else { - buildInputs = [ gccCross binutils ]; - - crossConfig = gccCross.crossConfig; +{ stdenv, callPackage }: +stdenv.mkDerivation { + inherit (callPackage ./common.nix {}) name src nativeBuildInputs meta; dontStrip = true; -}) -) +} diff --git a/pkgs/os-specific/windows/w32api/headers.nix b/pkgs/os-specific/windows/w32api/headers.nix new file mode 100644 index 000000000000..3083118bb366 --- /dev/null +++ b/pkgs/os-specific/windows/w32api/headers.nix @@ -0,0 +1,17 @@ +{ stdenvNoCC, callPackage }: + +let + inherit (callPackage ./common.nix {}) name src meta; + +in stdenvNoCC.mkDerivation { + name = name + "-headers"; + + inherit src nativeBuildInputs meta; + + phases = [ "unpackPhase" "installPhase" ]; + + installPhase = '' + mkdir -p $out + cp -R include $out + ''; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d18e51772cea..65d1dc9dbb01 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13868,23 +13868,13 @@ with pkgs; jom = callPackage ../os-specific/windows/jom { }; - w32api = callPackage ../os-specific/windows/w32api { - gccCross = gccCrossStageStatic; - binutils = binutils; - }; + w32api = callPackage ../os-specific/windows/w32api { }; - w32api_headers = w32api.override { - onlyHeaders = true; - }; + w32api_headers = callPackage ../os-specific/windows/w32api/headers { }; - mingw_runtime = callPackage ../os-specific/windows/mingwrt { - gccCross = gccCrossMingw2; - binutils = binutils; - }; + mingw_runtime = callPackage ../os-specific/windows/mingwrt { }; - mingw_runtime_headers = mingw_runtime.override { - onlyHeaders = true; - }; + mingw_runtime_headers = callPackage ../os-specific/windows/mingwrt/headers.nix { }; mingw_headers1 = buildEnv { name = "mingw-headers-1"; From 84868b8b06e54f0d1a9eb3140ed80b4d697f35d3 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 14 May 2018 20:33:54 -0400 Subject: [PATCH 2/3] misc hurd stuff: Get rid of crossConfig This stuff is horribly bit-rotted anyways, but I'm getting rid of crossConfig so it must be changed. --- pkgs/os-specific/gnu/hurd/default.nix | 29 +++++++-------------- pkgs/os-specific/gnu/libpthread/default.nix | 2 -- 2 files changed, 10 insertions(+), 21 deletions(-) diff --git a/pkgs/os-specific/gnu/hurd/default.nix b/pkgs/os-specific/gnu/hurd/default.nix index 5eccee62468d..ae1c504fd19e 100644 --- a/pkgs/os-specific/gnu/hurd/default.nix +++ b/pkgs/os-specific/gnu/hurd/default.nix @@ -75,25 +75,16 @@ stdenv.mkDerivation ({ // -(if !headersOnly && buildTarget != null - then assert installTarget != null; { - # Use the default `buildPhase' and `installPhase' so that the usual hooks - # can still be used. - buildFlags = buildTarget; - installTargets = installTarget; - } - else {}) +stdenv.lib.optionalAttrs (!headersOnly && buildTarget != null) { + # Use the default `buildPhase' and `installPhase' so that the usual hooks + # can still be used. + buildFlags = buildTarget; + installTargets = assert installTarget != null; installTarget; +} // -(if headersOnly - then { dontBuild = true; installPhase = "make install-headers"; } - else (if (cross != null) - then { - crossConfig = cross.config; - - # The `configure' script wants to build executables so tell it where - # to find `crt1.o' et al. - LDFLAGS = "-B${glibcCross}/lib"; - } - else { }))) +stdenv.lib.optionalAttrs headersOnly { + dontBuild = true; + installPhase = "make install-headers"; +}) diff --git a/pkgs/os-specific/gnu/libpthread/default.nix b/pkgs/os-specific/gnu/libpthread/default.nix index 294a1548582b..a2e1081a1e8d 100644 --- a/pkgs/os-specific/gnu/libpthread/default.nix +++ b/pkgs/os-specific/gnu/libpthread/default.nix @@ -55,8 +55,6 @@ stdenv.mkDerivation ({ (if cross != null then { - crossConfig = cross.config; - # Tell gcc where to find `crt1.o' et al. This is specified in two # different ways: one for gcc as run from `configure', and one for linking # libpthread.so (by default `libtool --mode=link' swallows `-B', hence From 29b62e07d66c6ee14c8b9a3428e413fc4dc1c223 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 14 May 2018 22:28:37 -0400 Subject: [PATCH 3/3] pam: Remove crossAttrs It turns out none of this stuff is needed. The docs aren't evenly built properly anyways so the build trivially succeeds either way, due to what looks like upstream misunderstanding automake. If I try to build the docs manually in a cross shell (before and after this change), there's a make rule error such that some HTML files aren't even attempted to be built and then a copy fails. Even if this was all fixed, these been a good number of cross fixes upstream getting them to use CC_FOR_BUILD and other good stuff, so I doubt such hacks would be needed. Progress towards #40531 and #33302. --- pkgs/os-specific/linux/pam/default.nix | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/pkgs/os-specific/linux/pam/default.nix b/pkgs/os-specific/linux/pam/default.nix index 5f92dfcc8390..e2d34abb70cc 100644 --- a/pkgs/os-specific/linux/pam/default.nix +++ b/pkgs/os-specific/linux/pam/default.nix @@ -33,21 +33,6 @@ stdenv.mkDerivation rec { enableParallelBuilding = true; - crossAttrs = { - propagatedBuildInputs = [ flex.crossDrv cracklib.crossDrv ]; - preConfigure = preConfigure + '' - $crossConfig-ar x ${flex.crossDrv}/lib/libfl.a - mv libyywrap.o libyywrap-target.o - ar x ${flex}/lib/libfl.a - mv libyywrap.o libyywrap-host.o - export LDFLAGS="$LDFLAGS $PWD/libyywrap-target.o" - sed -e 's/@CC@/gcc/' -i doc/specs/Makefile.in - ''; - postConfigure = '' - sed -e "s@ $PWD/libyywrap-target.o@ $PWD/libyywrap-host.o@" -i doc/specs/Makefile - ''; - }; - postInstall = '' mv -v $out/sbin/unix_chkpwd{,.orig} ln -sv /run/wrappers/bin/unix_chkpwd $out/sbin/unix_chkpwd