1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-30 01:20:40 +00:00

Merge pull request #26881 from obsidiansystems/cross-hashbreak

Make hash-breaking cleanups avoided in #26007
This commit is contained in:
John Ericson 2017-06-30 10:12:05 -04:00 committed by GitHub
commit c53449ce57
18 changed files with 84 additions and 75 deletions

View file

@ -1,6 +1,6 @@
{ stdenv
, fetchurl, alsaLib
, buildPlatform, hostPlatform
, hostPlatform
}:
stdenv.mkDerivation rec {
@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
buildInputs = stdenv.lib.optional (!stdenv.isDarwin) alsaLib;
${if buildPlatform != hostPlatform then "configureFlags" else null} =
configureFlags =
stdenv.lib.optional (hostPlatform ? mpg123) "--with-cpu=${hostPlatform.mpg123.cpu}";
meta = {

View file

@ -32,7 +32,13 @@ stdenv.mkDerivation rec {
*/
doCheck = !(hostPlatform.isDarwin || hostPlatform != buildPlatform);
configureFlags = if hostPlatform == buildPlatform then null else [
# TODO(@Ericson2314): Use placeholder to make this a configure flag once Nix
# 1.12 is released.
preConfigure = ''
export DESTDIR=$out
'';
configureFlags = [
"--exec-prefix=${stdenv.cc.prefix}"
"CC=${stdenv.cc.prefix}cc"
];

View file

@ -138,8 +138,7 @@ stdenv.mkDerivation {
inherit doCheck;
${if buildPlatform == hostPlatform then "dontSetConfigureCross" else null} = true;
${if buildPlatform != hostPlatform then "configurePlatforms" else null} = [];
configurePlatforms = [];
# https://github.com/NixOS/nixpkgs/pull/21742#issuecomment-272305764
# https://github.com/rust-lang/rust/issues/30181

View file

@ -38,8 +38,8 @@ stdenv.mkDerivation rec {
cp -r README.txt LICENSE.txt doc $out/share/doc/glew
'';
makeFlags = if hostPlatform == buildPlatform then null else [
"SYSTEM=${if hostPlatform.isMinGW then "mingw" else hostPlatform.parsed.kernel}"
makeFlags = [
"SYSTEM=${if hostPlatform.isMinGW then "mingw" else hostPlatform.parsed.kernel.name}"
];
meta = with stdenv.lib; {

View file

@ -39,8 +39,8 @@ stdenv.mkDerivation rec {
rm $out/lib/*.a
'';
makeFlags = if hostPlatform == buildPlatform then null else [
"SYSTEM=${if hostPlatform.isMinGW then "mingw" else hostPlatform.parsed.kernel}"
makeFlags = [
"SYSTEM=${if hostPlatform.isMinGW then "mingw" else hostPlatform.parsed.kernel.name}"
];
meta = with stdenv.lib; {

View file

@ -11,9 +11,8 @@ stdenv.mkDerivation rec {
sha256 = "0vf7s9dwk2xkmhb79aigqm0x0yfbw1j0b9ksm51207qwr179n6jr";
};
# TODO(@Ericson2314) Make unconditional next hash break
patches = if hostPlatform == buildPlatform then null else [
./cross-ar.patch
patches = [
./dont-hardcode-ar.patch
];
doCheck = true;

View file

@ -4,10 +4,9 @@
, static ? false
}:
let version = "1.2.11"; in
stdenv.mkDerivation rec {
name = "zlib-${version}";
version = "1.2.11";
src = fetchurl {
urls =
@ -19,7 +18,7 @@ stdenv.mkDerivation rec {
patches = stdenv.lib.optional hostPlatform.isCygwin ./disable-cygwin-widechar.patch;
postPatch = stdenv.lib.optionalString stdenv.isDarwin ''
postPatch = stdenv.lib.optionalString hostPlatform.isDarwin ''
substituteInPlace configure \
--replace '/usr/bin/libtool' 'ar' \
--replace 'AR="libtool"' 'AR="ar"' \
@ -30,14 +29,6 @@ stdenv.mkDerivation rec {
setOutputFlags = false;
outputDoc = "dev"; # single tiny man3 page
# 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
# cross building to avoid hash breakage. Once hash breakage is acceptable, remove preConfigure entirely.
preConfigure = stdenv.lib.optionalString (hostPlatform == buildPlatform) ''
if test -n "$crossConfig"; then
export CC=$crossConfig-gcc
fi
'';
# FIXME needs gcc 4.9 in bootstrap tools
hardeningDisable = [ "stackprotector" ];
@ -49,37 +40,42 @@ stdenv.mkDerivation rec {
# jww (2015-01-06): Sometimes this library install as a .so, even on
# Darwin; others time it installs as a .dylib. I haven't yet figured out
# what causes this difference.
+ stdenv.lib.optionalString stdenv.isDarwin ''
+ stdenv.lib.optionalString hostPlatform.isDarwin ''
for file in $out/lib/*.so* $out/lib/*.dylib* ; do
install_name_tool -id "$file" $file
done
''
# Non-typical naming confuses libtool which then refuses to use zlib's DLL
# in some cases, e.g. when compiling libpng.
+ stdenv.lib.optionalString (hostPlatform.libc == "msvcrt") ''
ln -s zlib1.dll $out/bin/libz.dll
'';
# As zlib takes part in the stdenv building, we don't want references
# to the bootstrap-tools libgcc (as uses to happen on arm/mips)
NIX_CFLAGS_COMPILE = stdenv.lib.optionalString (!stdenv.isDarwin) "-static-libgcc";
NIX_CFLAGS_COMPILE = stdenv.lib.optionalString (!hostPlatform.isDarwin) "-static-libgcc";
crossAttrs = {
dontStrip = static;
configurePlatforms = [];
} // stdenv.lib.optionalAttrs (hostPlatform.libc == "msvcrt") {
installFlags = [
"BINARY_PATH=$(out)/bin"
"INCLUDE_PATH=$(dev)/include"
"LIBRARY_PATH=$(out)/lib"
];
makeFlags = [
"-f" "win32/Makefile.gcc"
"PREFIX=${stdenv.cc.prefix}"
] ++ stdenv.lib.optional (!static) "SHARED_MODE=1";
dontStrip = hostPlatform != buildPlatform && static;
configurePlatforms = [];
# Non-typical naming confuses libtool which then refuses to use zlib's DLL
# in some cases, e.g. when compiling libpng.
postInstall = postInstall + "ln -s zlib1.dll $out/bin/libz.dll";
installFlags = stdenv.lib.optionals (hostPlatform.libc == "msvcrt") [
"BINARY_PATH=$(out)/bin"
"INCLUDE_PATH=$(dev)/include"
"LIBRARY_PATH=$(out)/lib"
];
makeFlags = [
"PREFIX=${stdenv.cc.prefix}"
] ++ stdenv.lib.optionals (hostPlatform.libc == "msvcrt") [
"-f" "win32/Makefile.gcc"
] ++ stdenv.lib.optionals (!static) [
"SHARED_MODE=1"
];
passthru = {
inherit version;
};
passthru.version = version;
meta = with stdenv.lib; {
description = "Lossless data-compression library";
license = licenses.zlib;

View file

@ -8,10 +8,13 @@ let
version = "2.28";
basename = "binutils-${version}";
inherit (stdenv.lib) optional optionals optionalString;
# The prefix prepended to binary names to allow multiple binuntils on the
# PATH to both be usable.
prefix = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-";
in
stdenv.mkDerivation rec {
name = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-" + basename;
name = prefix + basename;
src = fetchurl {
url = "mirror://gnu/binutils/${basename}.tar.bz2";
@ -78,15 +81,20 @@ stdenv.mkDerivation rec {
then "-Wno-string-plus-int -Wno-deprecated-declarations"
else "-static-libgcc";
# TODO(@Ericson2314): Always pass "--target" and always prefix.
configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target";
configureFlags =
[ "--enable-shared" "--enable-deterministic-archives" "--disable-werror" ]
++ optional (stdenv.system == "mips64el-linux") "--enable-fix-loongson2f-nop"
++ optional (targetPlatform != hostPlatform) "--target=${targetPlatform.config}" # TODO: make this unconditional
++ optionals gold [ "--enable-gold" "--enable-plugins" ]
++ optional (stdenv.system == "i686-linux") "--enable-targets=x86_64-linux-gnu";
enableParallelBuilding = true;
passthru = {
inherit prefix;
};
meta = with stdenv.lib; {
description = "Tools for manipulating binaries (linker, assembler, etc.)";
longDescription = ''

View file

@ -48,6 +48,9 @@ stdenv.mkDerivation rec {
NIX_CFLAGS_COMPILE = "-Wno-format-nonliteral";
# TODO(@Ericson2314): Always pass "--target" and always prefix.
configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target";
configureFlags = with stdenv.lib; [
"--with-gmp=${gmp.dev}" "--with-mpfr=${mpfr.dev}" "--with-system-readline"
"--with-system-zlib" "--with-expat" "--with-libexpat-prefix=${expat.dev}"
@ -55,8 +58,6 @@ stdenv.mkDerivation rec {
# TODO(@Ericson2314): make this conditional on whether host platform is NixOS
"--with-separate-debug-dir=/run/current-system/sw/lib/debug"
++ stdenv.lib.optional (!pythonSupport) "--without-python"
# TODO(@Ericson2314): This should be done in stdenv, not per-package
++ stdenv.lib.optional (targetPlatform != hostPlatform) "--target=${targetPlatform.config}"
++ stdenv.lib.optional multitarget "--enable-targets=all";
postInstall =

View file

@ -2,11 +2,12 @@
, hostPlatform, targetPlatform
}:
let
prefix = stdenv.lib.optionalString
(targetPlatform != hostPlatform)
"${targetPlatform.config}-";
# Make sure both underlying packages claim to have prepended their binaries
# with the same prefix.
assert binutils-raw.prefix == cctools.prefix;
let
inherit (binutils-raw) prefix;
cmds = [
"ar" "ranlib" "as" "dsymutil" "install_name_tool"
"ld" "strip" "otool" "lipo" "nm" "strings" "size"
@ -50,4 +51,8 @@ stdenv.mkDerivation {
ln -s ${cctools}/libexec $out/libexec
'';
passthru = {
inherit prefix;
};
}

View file

@ -1,10 +1,12 @@
{ stdenv, fetchFromGitHub, makeWrapper, autoconf, automake, libtool_2
, llvm, libcxx, libcxxabi, clang, libuuid
, libobjc ? null, maloader ? null, xctoolchain ? null
, buildPlatform, hostPlatform, targetPlatform
, hostPlatform, targetPlatform
}:
let
# The prefix prepended to binary names to allow multiple binuntils on the
# PATH to both be usable.
prefix = stdenv.lib.optionalString
(targetPlatform != hostPlatform)
"${targetPlatform.config}-";
@ -38,13 +40,10 @@ let
enableParallelBuilding = true;
# TODO(@Ericson2314): Always pass "--target" and always prefix.
configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (targetPlatform != hostPlatform) "target";
configureFlags = stdenv.lib.optionals (!stdenv.isDarwin) [
"CXXFLAGS=-I${libcxx}/include/c++/v1"
] ++ stdenv.lib.optionals (targetPlatform != buildPlatform) [
# TODO make unconditional next hash break
"--build=${buildPlatform.config}"
"--host=${hostPlatform.config}"
"--target=${targetPlatform.config}"
];
postPatch = ''
@ -104,6 +103,10 @@ let
done
'';
passthru = {
inherit prefix;
};
meta = {
homepage = "http://www.opensource.apple.com/source/cctools/";
description = "Mac OS X Compiler Tools (cross-platform port)";

View file

@ -63,7 +63,7 @@ stdenv.mkDerivation rec {
CONFIG_DEFAULT_SETFONT_DIR "/etc/kbd"
${extraConfig}
$extraCrossConfig
CONFIG_CROSS_COMPILER_PREFIX "${stdenv.cc.prefix}"
EOF
make oldconfig
@ -79,10 +79,6 @@ stdenv.mkDerivation rec {
buildInputs = lib.optionals (enableStatic && !useMusl) [ stdenv.cc.libc stdenv.cc.libc.static ];
extraCrossConfig = if hostPlatform == buildPlatform then null else ''
CONFIG_CROSS_COMPILER_PREFIX "${stdenv.cc.prefix}"
'';
enableParallelBuilding = true;
meta = with stdenv.lib; {

View file

@ -1,7 +1,6 @@
{ stdenv, fetchurl
, bzip2
, enableNLS ? false, libnatspec
, buildPlatform, hostPlatform
}:
stdenv.mkDerivation {
@ -23,13 +22,13 @@ stdenv.mkDerivation {
./CVE-2015-7697.diff
./CVE-2014-9913.patch
./CVE-2016-9844.patch
./dont-hardcode-cc.patch
] ++ stdenv.lib.optional enableNLS
(fetchurl {
url = "http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/app-arch/unzip/files/unzip-6.0-natspec.patch?revision=1.1";
name = "unzip-6.0-natspec.patch";
sha256 = "67ab260ae6adf8e7c5eda2d1d7846929b43562943ec4aff629bd7018954058b1";
})
++ stdenv.lib.optional (hostPlatform != buildPlatform) ./cross-cc.patch;
});
nativeBuildInputs = [ bzip2 ];
buildInputs = [ bzip2 ] ++ stdenv.lib.optional enableNLS libnatspec;

View file

@ -1,12 +1,14 @@
--- a/unix/Makefile
+++ b/unix/Makefile
@@ -42,9 +42,7 @@
@@ -42,9 +42,9 @@
# such as -DDOSWILD).
# UnZip flags
-CC = cc# try using "gcc" target rather than changing this (CC and LD
+CC ?= cc# try using "gcc" target rather than changing this (CC and LD
LD = $(CC)# must match, else "unresolved symbol: ___main" is possible)
-AS = as
+AS ?= as
LOC = $(D_USE_BZ2) $(LOCAL_UNZIP)
AF = $(LOC)
CFLAGS = -O

View file

@ -70,7 +70,7 @@ stdenv.mkDerivation rec {
&& builtins.storeDir == "/nix/store";
# Prevents attempts of running 'help2man' on cross-built binaries.
${if hostPlatform == buildPlatform then null else "PERL"} = "missing";
PERL = if hostPlatform == buildPlatform then null else "missing";
# Saw random failures like help2man: can't get '--help' info from
# man/sha512sum.td/sha512sum.
@ -83,11 +83,11 @@ stdenv.mkDerivation rec {
# Works around a bug with 8.26:
# Makefile:3440: *** Recursive variable 'INSTALL' references itself (eventually). Stop.
${if hostPlatform == buildPlatform then null else "preInstall"} = ''
preInstall = optionalString (hostPlatform != buildPlatform) ''
sed -i Makefile -e 's|^INSTALL =.*|INSTALL = ${buildPackages.coreutils}/bin/install -c|'
'';
${if hostPlatform == buildPlatform then null else "postInstall"} = ''
postInstall = optionalString (hostPlatform != buildPlatform) ''
rm $out/share/man/man1/*
cp ${buildPackages.coreutils}/share/man/man1/* $out/share/man/man1
'';

View file

@ -17,11 +17,6 @@ stdenv.mkDerivation rec {
doCheck = hostPlatform == buildPlatform;
${if hostPlatform != buildPlatform then "crossPlatforms" else null} = [ ];
${if hostPlatform != buildPlatform then "configureFlags" else null} = [
"CXX=${stdenv.cc.prefix}c++"
];
meta = with stdenv.lib; {
description = "GNU ddrescue, a data recovery tool";

View file

@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
buildInputs = stdenv.lib.optional doCheck ed;
configureFlags = if hostPlatform == buildPlatform then null else [
configureFlags = stdenv.lib.optionals (hostPlatform != buildPlatform) [
"ac_cv_func_strnlen_working=yes"
];