git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #26881 from obsidiansystems/cross-hashbreak

Make hash-breaking cleanups avoided in #26007

commitc53449ce57f26de17532f0dea727b58db68b337e authorJohn Ericson <Ericson2314@yahoo.com> dateFri 30 Jun 2017, 10:12 (9 years ago) parentd61c22395c8277
18 files changed+84−75
pkgs/applications/audio/mpg123/default.nix+2−2 pkgs/applications/editors/ed/default.nix+7−1 pkgs/development/compilers/rust/rustc.nix+1−2 pkgs/development/libraries/glew/1.10.nix+2−2 pkgs/development/libraries/glew/default.nix+2−2 pkgs/development/libraries/libelf/default.nix+2−3 pkgs/development/libraries/libelf/cross-ar.patch → pkgs/development/libraries/libelf/dont-hardcode-ar.patch pkgs/development/libraries/zlib/default.nix+27−31 pkgs/development/tools/misc/binutils/default.nix+10−2 pkgs/development/tools/misc/gdb/default.nix+3−2 pkgs/os-specific/darwin/binutils/default.nix+9−4 pkgs/os-specific/darwin/cctools/port.nix+9−6 pkgs/os-specific/linux/busybox/default.nix+1−5 pkgs/tools/archivers/unzip/default.nix+2−3 pkgs/tools/archivers/unzip/cross-cc.patch → pkgs/tools/archivers/unzip/dont-hardcode-cc.patch+3−1 pkgs/tools/misc/coreutils/default.nix+3−3 pkgs/tools/system/ddrescue/default.nix−5 pkgs/tools/text/gnupatch/default.nix+1−1
pkgs/applications/audio/mpg123/default.nix+2−2
@@ -1,6 +1,6 @@
11{ stdenv
22, fetchurl, alsaLib
3−, buildPlatform, hostPlatform
3+, hostPlatform
44}:
55
66stdenv.mkDerivation rec {
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
1313
1414 buildInputs = stdenv.lib.optional (!stdenv.isDarwin) alsaLib;
1515
16− ${if buildPlatform != hostPlatform then "configureFlags" else null} =
16+ configureFlags =
1717 stdenv.lib.optional (hostPlatform ? mpg123) "--with-cpu=${hostPlatform.mpg123.cpu}";
1818
1919 meta = {
pkgs/applications/editors/ed/default.nix+7−1
@@ -32,7 +32,13 @@ stdenv.mkDerivation rec {
3232 */
3333 doCheck = !(hostPlatform.isDarwin || hostPlatform != buildPlatform);
3434
35− configureFlags = if hostPlatform == buildPlatform then null else [
35+ # TODO(@Ericson2314): Use placeholder to make this a configure flag once Nix
36+ # 1.12 is released.
37+ preConfigure = ''
38+ export DESTDIR=$out
39+ '';
40+
41+ configureFlags = [
3642 "--exec-prefix=${stdenv.cc.prefix}"
3743 "CC=${stdenv.cc.prefix}cc"
3844 ];
pkgs/development/compilers/rust/rustc.nix+1−2
@@ -138,8 +138,7 @@ stdenv.mkDerivation {
138138
139139 inherit doCheck;
140140
141− ${if buildPlatform == hostPlatform then "dontSetConfigureCross" else null} = true;
142− ${if buildPlatform != hostPlatform then "configurePlatforms" else null} = [];
141+ configurePlatforms = [];
143142
144143 # https://github.com/NixOS/nixpkgs/pull/21742#issuecomment-272305764
145144 # https://github.com/rust-lang/rust/issues/30181
pkgs/development/libraries/glew/1.10.nix+2−2
@@ -38,8 +38,8 @@ stdenv.mkDerivation rec {
3838 cp -r README.txt LICENSE.txt doc $out/share/doc/glew
3939 '';
4040
41− makeFlags = if hostPlatform == buildPlatform then null else [
42− "SYSTEM=${if hostPlatform.isMinGW then "mingw" else hostPlatform.parsed.kernel}"
41+ makeFlags = [
42+ "SYSTEM=${if hostPlatform.isMinGW then "mingw" else hostPlatform.parsed.kernel.name}"
4343 ];
4444
4545 meta = with stdenv.lib; {
pkgs/development/libraries/glew/default.nix+2−2
@@ -39,8 +39,8 @@ stdenv.mkDerivation rec {
3939 rm $out/lib/*.a
4040 '';
4141
42− makeFlags = if hostPlatform == buildPlatform then null else [
43− "SYSTEM=${if hostPlatform.isMinGW then "mingw" else hostPlatform.parsed.kernel}"
42+ makeFlags = [
43+ "SYSTEM=${if hostPlatform.isMinGW then "mingw" else hostPlatform.parsed.kernel.name}"
4444 ];
4545
4646 meta = with stdenv.lib; {
pkgs/development/libraries/libelf/default.nix+2−3
@@ -11,9 +11,8 @@ stdenv.mkDerivation rec {
1111 sha256 = "0vf7s9dwk2xkmhb79aigqm0x0yfbw1j0b9ksm51207qwr179n6jr";
1212 };
1313
14− # TODO(@Ericson2314) Make unconditional next hash break
15− patches = if hostPlatform == buildPlatform then null else [
16− ./cross-ar.patch
14+ patches = [
15+ ./dont-hardcode-ar.patch
1716 ];
1817
1918 doCheck = true;
pkgs/development/libraries/libelf/cross-ar.patch → pkgs/development/libraries/libelf/dont-hardcode-ar.patchrenamed

The content is the same.

pkgs/development/libraries/zlib/default.nix+27−31
@@ -4,10 +4,9 @@
44, static ? false
55}:
66
7−let version = "1.2.11"; in
8−
97stdenv.mkDerivation rec {
108 name = "zlib-${version}";
9+ version = "1.2.11";
1110
1211 src = fetchurl {
1312 urls =
@@ -19,7 +18,7 @@ stdenv.mkDerivation rec {
1918
2019 patches = stdenv.lib.optional hostPlatform.isCygwin ./disable-cygwin-widechar.patch;
2120
22− postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
21+ postPatch = stdenv.lib.optionalString hostPlatform.isDarwin ''
2322 substituteInPlace configure \
2423 --replace '/usr/bin/libtool' 'ar' \
2524 --replace 'AR="libtool"' 'AR="ar"' \
@@ -30,14 +29,6 @@ stdenv.mkDerivation rec {
3029 setOutputFlags = false;
3130 outputDoc = "dev"; # single tiny man3 page
3231
33− # TODO(@Dridus) CC set by cc-wrapper setup-hook, so just empty out the preConfigure script when cross building, but leave the old incorrect script when not
34− # cross building to avoid hash breakage. Once hash breakage is acceptable, remove preConfigure entirely.
35− preConfigure = stdenv.lib.optionalString (hostPlatform == buildPlatform) ''
36− if test -n "$crossConfig"; then
37− export CC=$crossConfig-gcc
38− fi
39− '';
40−
4132 # FIXME needs gcc 4.9 in bootstrap tools
4233 hardeningDisable = [ "stackprotector" ];
4334
@@ -49,36 +40,41 @@ stdenv.mkDerivation rec {
4940 # jww (2015-01-06): Sometimes this library install as a .so, even on
5041 # Darwin; others time it installs as a .dylib. I haven't yet figured out
5142 # what causes this difference.
52− + stdenv.lib.optionalString stdenv.isDarwin ''
43+ + stdenv.lib.optionalString hostPlatform.isDarwin ''
5344 for file in $out/lib/*.so* $out/lib/*.dylib* ; do
5445 install_name_tool -id "$file" $file
5546 done
47+ ''
48+ # Non-typical naming confuses libtool which then refuses to use zlib's DLL
49+ # in some cases, e.g. when compiling libpng.
50+ + stdenv.lib.optionalString (hostPlatform.libc == "msvcrt") ''
51+ ln -s zlib1.dll $out/bin/libz.dll
5652 '';
5753
5854 # As zlib takes part in the stdenv building, we don't want references
5955 # to the bootstrap-tools libgcc (as uses to happen on arm/mips)
60− NIX_CFLAGS_COMPILE = stdenv.lib.optionalString (!stdenv.isDarwin) "-static-libgcc";
56+ NIX_CFLAGS_COMPILE = stdenv.lib.optionalString (!hostPlatform.isDarwin) "-static-libgcc";
6157
62− crossAttrs = {
63− dontStrip = static;
64− configurePlatforms = [];
65− } // stdenv.lib.optionalAttrs (hostPlatform.libc == "msvcrt") {
66− installFlags = [
67− "BINARY_PATH=$(out)/bin"
68− "INCLUDE_PATH=$(dev)/include"
69− "LIBRARY_PATH=$(out)/lib"
70− ];
71− makeFlags = [
72− "-f" "win32/Makefile.gcc"
73− "PREFIX=${stdenv.cc.prefix}"
74− ] ++ stdenv.lib.optional (!static) "SHARED_MODE=1";
58+ dontStrip = hostPlatform != buildPlatform && static;
59+ configurePlatforms = [];
7560
76− # Non-typical naming confuses libtool which then refuses to use zlib's DLL
77− # in some cases, e.g. when compiling libpng.
78− postInstall = postInstall + "ln -s zlib1.dll $out/bin/libz.dll";
79− };
61+ installFlags = stdenv.lib.optionals (hostPlatform.libc == "msvcrt") [
62+ "BINARY_PATH=$(out)/bin"
63+ "INCLUDE_PATH=$(dev)/include"
64+ "LIBRARY_PATH=$(out)/lib"
65+ ];
8066
81− passthru.version = version;
67+ makeFlags = [
68+ "PREFIX=${stdenv.cc.prefix}"
69+ ] ++ stdenv.lib.optionals (hostPlatform.libc == "msvcrt") [
70+ "-f" "win32/Makefile.gcc"
71+ ] ++ stdenv.lib.optionals (!static) [
72+ "SHARED_MODE=1"
73+ ];
74+
75+ passthru = {
76+ inherit version;
77+ };
8278
8379 meta = with stdenv.lib; {
8480 description = "Lossless data-compression library";
pkgs/development/tools/misc/binutils/default.nix+10−2
@@ -8,10 +8,13 @@ let
88 version = "2.28";
99 basename = "binutils-${version}";
1010 inherit (stdenv.lib) optional optionals optionalString;
11+ # The prefix prepended to binary names to allow multiple binuntils on the
12+ # PATH to both be usable.
13+ prefix = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-";
1114in
1215
1316stdenv.mkDerivation rec {
14− name = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-" + basename;
17+ name = prefix + basename;
1518
1619 src = fetchurl {
1720 url = "mirror://gnu/binutils/${basename}.tar.bz2";
@@ -78,15 +81,20 @@ stdenv.mkDerivation rec {
7881 then "-Wno-string-plus-int -Wno-deprecated-declarations"
7982 else "-static-libgcc";
8083
84+ # TODO(@Ericson2314): Always pass "--target" and always prefix.
85+ configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target";
8186 configureFlags =
8287 [ "--enable-shared" "--enable-deterministic-archives" "--disable-werror" ]
8388 ++ optional (stdenv.system == "mips64el-linux") "--enable-fix-loongson2f-nop"
84− ++ optional (targetPlatform != hostPlatform) "--target=${targetPlatform.config}" # TODO: make this unconditional
8589 ++ optionals gold [ "--enable-gold" "--enable-plugins" ]
8690 ++ optional (stdenv.system == "i686-linux") "--enable-targets=x86_64-linux-gnu";
8791
8892 enableParallelBuilding = true;
8993
94+ passthru = {
95+ inherit prefix;
96+ };
97+
9098 meta = with stdenv.lib; {
9199 description = "Tools for manipulating binaries (linker, assembler, etc.)";
92100 longDescription = ''
pkgs/development/tools/misc/gdb/default.nix+3−2
@@ -48,6 +48,9 @@ stdenv.mkDerivation rec {
4848
4949 NIX_CFLAGS_COMPILE = "-Wno-format-nonliteral";
5050
51+ # TODO(@Ericson2314): Always pass "--target" and always prefix.
52+ configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target";
53+
5154 configureFlags = with stdenv.lib; [
5255 "--with-gmp=${gmp.dev}" "--with-mpfr=${mpfr.dev}" "--with-system-readline"
5356 "--with-system-zlib" "--with-expat" "--with-libexpat-prefix=${expat.dev}"
@@ -55,8 +58,6 @@ stdenv.mkDerivation rec {
5558 # TODO(@Ericson2314): make this conditional on whether host platform is NixOS
5659 "--with-separate-debug-dir=/run/current-system/sw/lib/debug"
5760 ++ stdenv.lib.optional (!pythonSupport) "--without-python"
58− # TODO(@Ericson2314): This should be done in stdenv, not per-package
59− ++ stdenv.lib.optional (targetPlatform != hostPlatform) "--target=${targetPlatform.config}"
6061 ++ stdenv.lib.optional multitarget "--enable-targets=all";
6162
6263 postInstall =
pkgs/os-specific/darwin/binutils/default.nix+9−4
@@ -2,11 +2,12 @@
22, hostPlatform, targetPlatform
33}:
44
5−let
6− prefix = stdenv.lib.optionalString
7− (targetPlatform != hostPlatform)
8− "${targetPlatform.config}-";
5+# Make sure both underlying packages claim to have prepended their binaries
6+# with the same prefix.
7+assert binutils-raw.prefix == cctools.prefix;
98
9+let
10+ inherit (binutils-raw) prefix;
1011 cmds = [
1112 "ar" "ranlib" "as" "dsymutil" "install_name_tool"
1213 "ld" "strip" "otool" "lipo" "nm" "strings" "size"
@@ -50,4 +51,8 @@ stdenv.mkDerivation {
5051
5152 ln -s ${cctools}/libexec $out/libexec
5253 '';
54+
55+ passthru = {
56+ inherit prefix;
57+ };
5358}
pkgs/os-specific/darwin/cctools/port.nix+9−6
@@ -1,10 +1,12 @@
11{ stdenv, fetchFromGitHub, makeWrapper, autoconf, automake, libtool_2
22, llvm, libcxx, libcxxabi, clang, libuuid
33, libobjc ? null, maloader ? null, xctoolchain ? null
4−, buildPlatform, hostPlatform, targetPlatform
4+, hostPlatform, targetPlatform
55}:
66
77let
8+ # The prefix prepended to binary names to allow multiple binuntils on the
9+ # PATH to both be usable.
810 prefix = stdenv.lib.optionalString
911 (targetPlatform != hostPlatform)
1012 "${targetPlatform.config}-";
@@ -38,13 +40,10 @@ let
3840
3941 enableParallelBuilding = true;
4042
43+ # TODO(@Ericson2314): Always pass "--target" and always prefix.
44+ configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target";
4145 configureFlags = stdenv.lib.optionals (!stdenv.isDarwin) [
4246 "CXXFLAGS=-I${libcxx}/include/c++/v1"
43− ] ++ stdenv.lib.optionals (targetPlatform != buildPlatform) [
44− # TODO make unconditional next hash break
45− "--build=${buildPlatform.config}"
46− "--host=${hostPlatform.config}"
47− "--target=${targetPlatform.config}"
4847 ];
4948
5049 postPatch = ''
@@ -104,6 +103,10 @@ let
104103 done
105104 '';
106105
106+ passthru = {
107+ inherit prefix;
108+ };
109+
107110 meta = {
108111 homepage = "http://www.opensource.apple.com/source/cctools/";
109112 description = "Mac OS X Compiler Tools (cross-platform port)";
pkgs/os-specific/linux/busybox/default.nix+1−5
@@ -63,7 +63,7 @@ stdenv.mkDerivation rec {
6363 CONFIG_DEFAULT_SETFONT_DIR "/etc/kbd"
6464
6565 ${extraConfig}
66− $extraCrossConfig
66+ CONFIG_CROSS_COMPILER_PREFIX "${stdenv.cc.prefix}"
6767 EOF
6868
6969 make oldconfig
@@ -79,10 +79,6 @@ stdenv.mkDerivation rec {
7979
8080 buildInputs = lib.optionals (enableStatic && !useMusl) [ stdenv.cc.libc stdenv.cc.libc.static ];
8181
82− extraCrossConfig = if hostPlatform == buildPlatform then null else ''
83− CONFIG_CROSS_COMPILER_PREFIX "${stdenv.cc.prefix}"
84− '';
85−
8682 enableParallelBuilding = true;
8783
8884 meta = with stdenv.lib; {
pkgs/tools/archivers/unzip/default.nix+2−3
@@ -1,7 +1,6 @@
11{ stdenv, fetchurl
22, bzip2
33, enableNLS ? false, libnatspec
4−, buildPlatform, hostPlatform
54}:
65
76stdenv.mkDerivation {
@@ -23,13 +22,13 @@ stdenv.mkDerivation {
2322 ./CVE-2015-7697.diff
2423 ./CVE-2014-9913.patch
2524 ./CVE-2016-9844.patch
25+ ./dont-hardcode-cc.patch
2626 ] ++ stdenv.lib.optional enableNLS
2727 (fetchurl {
2828 url = "http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/app-arch/unzip/files/unzip-6.0-natspec.patch?revision=1.1";
2929 name = "unzip-6.0-natspec.patch";
3030 sha256 = "67ab260ae6adf8e7c5eda2d1d7846929b43562943ec4aff629bd7018954058b1";
31− })
32− ++ stdenv.lib.optional (hostPlatform != buildPlatform) ./cross-cc.patch;
31+ });
3332
3433 nativeBuildInputs = [ bzip2 ];
3534 buildInputs = [ bzip2 ] ++ stdenv.lib.optional enableNLS libnatspec;
pkgs/tools/archivers/unzip/cross-cc.patch → pkgs/tools/archivers/unzip/dont-hardcode-cc.patchrenamed+3−1
@@ -1,12 +1,14 @@
11--- a/unix/Makefile
22+++ b/unix/Makefile
3−@@ -42,9 +42,7 @@
3+@@ -42,9 +42,9 @@
44 # such as -DDOSWILD).
55
66 # UnZip flags
77-CC = cc# try using "gcc" target rather than changing this (CC and LD
8++CC ?= cc# try using "gcc" target rather than changing this (CC and LD
89 LD = $(CC)# must match, else "unresolved symbol: ___main" is possible)
910-AS = as
11++AS ?= as
1012 LOC = $(D_USE_BZ2) $(LOCAL_UNZIP)
1113 AF = $(LOC)
1214 CFLAGS = -O
pkgs/tools/misc/coreutils/default.nix+3−3
@@ -70,7 +70,7 @@ stdenv.mkDerivation rec {
7070 && builtins.storeDir == "/nix/store";
7171
7272 # Prevents attempts of running 'help2man' on cross-built binaries.
73− ${if hostPlatform == buildPlatform then null else "PERL"} = "missing";
73+ PERL = if hostPlatform == buildPlatform then null else "missing";
7474
7575 # Saw random failures like ‘help2man: can't get '--help' info from
7676 # man/sha512sum.td/sha512sum’.
@@ -83,11 +83,11 @@ stdenv.mkDerivation rec {
8383
8484 # Works around a bug with 8.26:
8585 # Makefile:3440: *** Recursive variable 'INSTALL' references itself (eventually). Stop.
86− ${if hostPlatform == buildPlatform then null else "preInstall"} = ''
86+ preInstall = optionalString (hostPlatform != buildPlatform) ''
8787 sed -i Makefile -e 's|^INSTALL =.*|INSTALL = ${buildPackages.coreutils}/bin/install -c|'
8888 '';
8989
90− ${if hostPlatform == buildPlatform then null else "postInstall"} = ''
90+ postInstall = optionalString (hostPlatform != buildPlatform) ''
9191 rm $out/share/man/man1/*
9292 cp ${buildPackages.coreutils}/share/man/man1/* $out/share/man/man1
9393 '';
pkgs/tools/system/ddrescue/default.nix−5
@@ -17,11 +17,6 @@ stdenv.mkDerivation rec {
1717
1818 doCheck = hostPlatform == buildPlatform;
1919
20− ${if hostPlatform != buildPlatform then "crossPlatforms" else null} = [ ];
21− ${if hostPlatform != buildPlatform then "configureFlags" else null} = [
22− "CXX=${stdenv.cc.prefix}c++"
23− ];
24−
2520 meta = with stdenv.lib; {
2621 description = "GNU ddrescue, a data recovery tool";
2722
pkgs/tools/text/gnupatch/default.nix+1−1
@@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
1313
1414 buildInputs = stdenv.lib.optional doCheck ed;
1515
16− configureFlags = if hostPlatform == buildPlatform then null else [
16+ configureFlags = stdenv.lib.optionals (hostPlatform != buildPlatform) [
1717 "ac_cv_func_strnlen_working=yes"
1818 ];
1919