Merge commit '198dceccbe5414a5fd72ca83624c0cc715db1aad' into gcc-simplify-flags

This commit is contained in:
John Ericson
2017-12-05 16:55:11 -05:00
62 changed files with 560 additions and 929 deletions

View File

@@ -326,7 +326,7 @@ stdenv.mkDerivation ({
CC_FOR_TARGET = "${targetPlatform.config}-gcc";
CXX_FOR_TARGET = "${targetPlatform.config}-g++";
# If we are making a cross compiler, cross != null
NIX_CC_CROSS = if targetPlatform == hostPlatform then "${stdenv.ccCross}" else "";
NIX_CC_CROSS = optionalString (targetPlatform == hostPlatform) builtins.toString stdenv.cc;
dontStrip = true;
};

View File

@@ -403,7 +403,7 @@ stdenv.mkDerivation ({
CC_FOR_TARGET = "${targetPlatform.config}-gcc";
CXX_FOR_TARGET = "${targetPlatform.config}-g++";
# If we are making a cross compiler, cross != null
NIX_CC_CROSS = if targetPlatform == hostPlatform then "${stdenv.ccCross}" else "";
NIX_CC_CROSS = optionalString (targetPlatform == hostPlatform) builtins.toString stdenv.cc;
dontStrip = true;
buildFlags = "";
};

View File

@@ -409,7 +409,7 @@ stdenv.mkDerivation ({
CC_FOR_TARGET = "${targetPlatform.config}-gcc";
CXX_FOR_TARGET = "${targetPlatform.config}-g++";
# If we are making a cross compiler, cross != null
NIX_CC_CROSS = if targetPlatform == hostPlatform then "${stdenv.ccCross}" else "";
NIX_CC_CROSS = optionalString (targetPlatform == hostPlatform) builtins.toString stdenv.cc;
dontStrip = true;
buildFlags = "";
};

View File

@@ -35,6 +35,7 @@
, cloog # unused; just for compat with gcc4, as we override the parameter on some places
, darwin ? null
, buildPlatform, hostPlatform, targetPlatform
, buildPackages
}:
assert langJava -> zip != null && unzip != null
@@ -294,6 +295,7 @@ stdenv.mkDerivation ({
++ (optionals langJava [ boehmgc zip unzip ])
++ (optionals javaAwtGtk ([ gtk2 libart_lgpl ] ++ xlibs))
++ (optionals (targetPlatform != hostPlatform) [binutils])
++ (optionals (buildPlatform != hostPlatform) [buildPackages.stdenv.cc])
++ (optionals langAda [gnatboot])
++ (optionals langVhdl [gnat])
@@ -371,7 +373,11 @@ stdenv.mkDerivation ({
${if targetPlatform == hostPlatform then platformFlags else ""}
" + optionalString
(hostPlatform != buildPlatform)
(platformFlags + " --target=${targetPlatform.config}");
(platformFlags + ''
--build=${buildPlatform.config}
--host=${hostPlatform.config}
--target=${targetPlatform.config}
'');
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
@@ -424,7 +430,7 @@ stdenv.mkDerivation ({
CC_FOR_TARGET = "${targetPlatform.config}-gcc";
CXX_FOR_TARGET = "${targetPlatform.config}-g++";
# If we are making a cross compiler, cross != null
NIX_CC_CROSS = if targetPlatform == hostPlatform then "${stdenv.ccCross}" else "";
NIX_CC_CROSS = optionalString (targetPlatform == hostPlatform) builtins.toString stdenv.cc;
dontStrip = true;
buildFlags = "";
};

View File

@@ -406,7 +406,7 @@ stdenv.mkDerivation ({
CC_FOR_TARGET = "${targetPlatform.config}-gcc";
CXX_FOR_TARGET = "${targetPlatform.config}-g++";
# If we are making a cross compiler, cross != null
NIX_CC_CROSS = if targetPlatform == hostPlatform then "${stdenv.ccCross}" else "";
NIX_CC_CROSS = optionalString (targetPlatform == hostPlatform) builtins.toString stdenv.cc;
dontStrip = true;
buildFlags = "";
};

View File

@@ -407,7 +407,7 @@ stdenv.mkDerivation ({
CC_FOR_TARGET = "${targetPlatform.config}-gcc";
CXX_FOR_TARGET = "${targetPlatform.config}-g++";
# If we are making a cross compiler, cross != null
NIX_CC_CROSS = if targetPlatform == hostPlatform then "${stdenv.ccCross}" else "";
NIX_CC_CROSS = optionalString (targetPlatform == hostPlatform) builtins.toString stdenv.cc;
dontStrip = true;
buildFlags = "";
};

View File

@@ -101,26 +101,26 @@ in stdenv.mkDerivation (rec {
'';
configureFlags = [
"CC=${stdenv.ccCross}/bin/${cross.config}-cc"
"LD=${stdenv.binutils}/bin/${cross.config}-ld"
"AR=${stdenv.binutils}/bin/${cross.config}-ar"
"NM=${stdenv.binutils}/bin/${cross.config}-nm"
"RANLIB=${stdenv.binutils}/bin/${cross.config}-ranlib"
"CC=${stdenv.cc}/bin/${cross.config}-cc"
"LD=${stdenv.cc}/bin/${cross.config}-ld"
"AR=${stdenv.cc}/bin/${cross.config}-ar"
"NM=${stdenv.cc}/bin/${cross.config}-nm"
"RANLIB=${stdenv.cc}/bin/${cross.config}-ranlib"
"--target=${cross.config}"
"--enable-bootstrap-with-devel-snapshot"
] ++
# fix for iOS: https://www.reddit.com/r/haskell/comments/4ttdz1/building_an_osxi386_to_iosarm64_cross_compiler/d5qvd67/
lib.optional (cross.config or null == "aarch64-apple-darwin14") "--disable-large-address-space";
buildInputs = commonBuildInputs ++ [ stdenv.ccCross stdenv.binutils ];
buildInputs = commonBuildInputs;
dontSetConfigureCross = true;
configurePlatforms = [];
passthru = {
inherit bootPkgs cross;
cc = "${stdenv.ccCross}/bin/${cross.config}-cc";
cc = "${stdenv.cc}/bin/${cross.config}-cc";
ld = "${stdenv.binutils}/bin/${cross.config}-ld";
ld = "${stdenv.cc}/bin/${cross.config}-ld";
};
})

View File

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

View File

@@ -446,7 +446,7 @@ stdenv.mkDerivation rec {
fi
'';
in {
dontSetConfigureCross = true;
configurePlatforms = [];
configureFlags = configureFlags ++ [
"--cross-prefix=${stdenv.cross.config}-"
"--enable-cross-compile"

View File

@@ -187,7 +187,7 @@ stdenv.mkDerivation rec {
fi
'';
in {
dontSetConfigureCross = true;
configurePlatforms = [];
configureFlags = configureFlags ++ [
"--cross-prefix=${stdenv.cross.config}-"
"--enable-cross-compile"

View File

@@ -105,7 +105,7 @@ let
installCheckTarget = "check"; # tests need to be run *after* installation
crossAttrs = {
dontSetConfigureCross = true;
configurePlatforms = [];
configureFlags = configureFlags ++ [
"--cross-prefix=${stdenv.cross.config}-"
"--enable-cross-compile"

View File

@@ -0,0 +1,11 @@
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -27,7 +27,7 @@ installdirs = $(libdir) $(includedir) $(includedir)/libelf
CC = @CC@
LD = @LD@
-AR = ar
+AR ?= ar
MV = mv -f
RM = rm -f
LN_S = @LN_S@

View File

@@ -1,4 +1,7 @@
{ fetchurl, stdenv, gettext, glibc }:
{ stdenv, fetchurl
, gettext, glibc
, buildPlatform, hostPlatform
}:
stdenv.mkDerivation rec {
name = "libelf-0.8.13";
@@ -8,20 +11,20 @@ stdenv.mkDerivation rec {
sha256 = "0vf7s9dwk2xkmhb79aigqm0x0yfbw1j0b9ksm51207qwr179n6jr";
};
# TODO(@Ericson2314) Make unconditional next hash break
patches = if hostPlatform == buildPlatform then null else [
./cross-ar.patch
];
doCheck = true;
# FIXME needs gcc 4.9 in bootstrap tools
hardeningDisable = [ "stackprotector" ];
# For cross-compiling, native glibc is needed for the "gencat" program.
crossAttrs = {
nativeBuildInputs = [ gettext glibc ];
};
# Libelf's custom NLS macros fail to determine the catalog file extension on
# Darwin, so disable NLS for now.
# FIXME: Eventually make Gettext a build input on all platforms.
configureFlags = stdenv.lib.optional stdenv.isDarwin "--disable-nls";
configureFlags = stdenv.lib.optional hostPlatform.isDarwin "--disable-nls";
nativeBuildInputs = [ gettext ];

View File

@@ -1,4 +1,8 @@
{ fetchurl, stdenv, gmp, mpfr }:
{ stdenv, fetchurl
, gmp, mpfr
, buildPlatform, hostPlatform
}:
let
version = "1.0.3";
in
@@ -14,7 +18,7 @@ stdenv.mkDerivation rec {
CFLAGS = "-I${gmp.dev}/include";
doCheck = true;
doCheck = hostPlatform == buildPlatform;
# FIXME needs gcc 4.9 in bootstrap tools
hardeningDisable = [ "stackprotector" ];

View File

@@ -1,4 +1,6 @@
{ fetchurl, stdenv }:
{ stdenv, fetchurl
, buildPlatform, hostPlatform
}:
stdenv.mkDerivation rec {
name = "libsigsegv-2.11";
@@ -8,7 +10,7 @@ stdenv.mkDerivation rec {
sha256 = "063swdvq7mbmc1clv0rnh20grwln1zfc2qnm0sa1hivcxyr2wz6x";
};
doCheck = true;
doCheck = hostPlatform == buildPlatform;
meta = {
homepage = http://www.gnu.org/software/libsigsegv/;

View File

@@ -148,7 +148,7 @@ stdenv.mkDerivation rec {
isCygwin = stdenv.cross.libc == "msvcrt";
isDarwin = stdenv.cross.libc == "libSystem";
in {
dontSetConfigureCross = true;
configurePlatforms = [];
configureFlags = configureFlags ++ [
#"--extra-cflags="
#"--extra-cxxflags="

View File

@@ -156,7 +156,7 @@ stdenv.mkDerivation rec {
isCygwin = stdenv.cross.libc == "msvcrt";
isDarwin = stdenv.cross.libc == "libSystem";
in {
dontSetConfigureCross = true;
configurePlatforms = [];
configureFlags = configureFlags ++ [
#"--extra-cflags="
#"--prefix="

View File

@@ -1,4 +1,6 @@
{ stdenv, fetchurl, gmp }:
{ stdenv, fetchurl, gmp
, buildPlatform, hostPlatform
}:
stdenv.mkDerivation rec {
name = "mpfr-3.1.3";
@@ -19,10 +21,10 @@ stdenv.mkDerivation rec {
hardeningDisable = [ "stackprotector" ];
configureFlags =
stdenv.lib.optional stdenv.isSunOS "--disable-thread-safe" ++
stdenv.lib.optional stdenv.is64bit "--with-pic";
stdenv.lib.optional hostPlatform.isSunOS "--disable-thread-safe" ++
stdenv.lib.optional hostPlatform.is64bit "--with-pic";
doCheck = true;
doCheck = hostPlatform == buildPlatform;
enableParallelBuilding = true;

View File

@@ -1,5 +1,7 @@
{ stdenv, fetchurl
, windows ? null, variant ? null, pcre
, pcre, windows ? null
, buildPlatform, hostPlatform
, variant ? null
}:
with stdenv.lib;
@@ -31,7 +33,9 @@ in stdenv.mkDerivation rec {
patches = [ ./CVE-2017-7186.patch ];
doCheck = with stdenv; !(isCygwin || isFreeBSD);
buildInputs = optional (hostPlatform.libc == "msvcrt") windows.mingw_w64_pthreads;
doCheck = !(with hostPlatform; isCygwin || isFreeBSD) && hostPlatform == buildPlatform;
# XXX: test failure on Cygwin
# we are running out of stack on both freeBSDs on Hydra
@@ -42,10 +46,6 @@ in stdenv.mkDerivation rec {
ln -sf -t "$out/lib/" '${pcre.out}'/lib/libpcre{,posix}.{so.*.*.*,*dylib}
'';
crossAttrs = optionalAttrs (stdenv.cross.libc == "msvcrt") {
buildInputs = [ windows.mingw_w64_pthreads.crossDrv ];
};
meta = {
homepage = "http://www.pcre.org/";
description = "A library for Perl Compatible Regular Expressions";

View File

@@ -1,5 +1,7 @@
{ stdenv, fetchurl, cmake, zlib, freetype, libjpeg, libtiff, fontconfig
, gcc5, openssl, libpng, lua5, pkgconfig, libidn, expat }:
, openssl, libpng, lua5, pkgconfig, libidn, expat
, gcc5 # TODO(@Dridus) remove this at next hash break
}:
stdenv.mkDerivation rec {
name = "podofo-0.9.5";
@@ -11,18 +13,12 @@ stdenv.mkDerivation rec {
propagatedBuildInputs = [ zlib freetype libjpeg libtiff fontconfig openssl libpng libidn expat ];
# Does Linux really need gcc5? Darwin doesn't seem to...
# TODO(@Dridus) remove the ++ ghc5 at next hash break
nativeBuildInputs = [ cmake pkgconfig ] ++ stdenv.lib.optional stdenv.isLinux gcc5;
# Does Linux really need libc here? Darwin doesn't seem to...
# TODO(@Dridus) remove the ++ libc at next hash break
buildInputs = [ lua5 ] ++ stdenv.lib.optional stdenv.isLinux stdenv.cc.libc;
crossAttrs = {
propagatedBuildInputs = [ zlib.crossDrv freetype.crossDrv libjpeg.crossDrv
libtiff.crossDrv fontconfig.crossDrv openssl.crossDrv libpng.crossDrv
lua5.crossDrv stdenv.ccCross.libc ];
};
cmakeFlags = "-DPODOFO_BUILD_SHARED=ON -DPODOFO_BUILD_STATIC=OFF";
meta = {

View File

@@ -209,7 +209,7 @@ stdenv.mkDerivation rec {
postInstall = ''
cp bin/qmake* $out/bin
'';
dontSetConfigureCross = true;
configurePlatforms = [];
dontStrip = true;
} // optionalAttrs isMingw {
propagatedBuildInputs = [ ];

View File

@@ -1,4 +1,8 @@
{ stdenv, fetchurl, static ? false }:
{ stdenv
, fetchurl
, buildPlatform, hostPlatform
, static ? false
}:
let version = "1.2.11"; in
@@ -24,7 +28,9 @@ stdenv.mkDerivation rec {
setOutputFlags = false;
outputDoc = "dev"; # single tiny man3 page
preConfigure = ''
# 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
@@ -53,7 +59,7 @@ stdenv.mkDerivation rec {
crossAttrs = {
dontStrip = static;
dontSetConfigureCross = true;
configurePlatforms = [];
} // stdenv.lib.optionalAttrs (stdenv.cross.libc == "msvcrt") {
installFlags = [
"BINARY_PATH=$(out)/bin"

View File

@@ -50,7 +50,8 @@ stdenv.mkDerivation rec {
++ [ "info" ]
++ optional (targetPlatform == hostPlatform) "dev";
nativeBuildInputs = [ bison ];
nativeBuildInputs = [ bison ]
++ optional (hostPlatform != buildPlatform) buildPackages.stdenv.cc;
buildInputs = [ zlib ];
inherit noSysDirs;