Merge remote-tracking branch 'origin/master' into gcc-cross
This commit is contained in:
@@ -1,9 +1,12 @@
|
||||
{ stdenv, targetPackages, fetchurl, fetchpatch, noSysDirs
|
||||
, langC ? true, langCC ? true, langFortran ? false
|
||||
, langAda ? false
|
||||
, langObjC ? stdenv.targetPlatform.isDarwin
|
||||
, langObjCpp ? stdenv.targetPlatform.isDarwin
|
||||
, langD ? false
|
||||
, langGo ? false
|
||||
, profiledCompiler ? false
|
||||
, langJit ? false
|
||||
, staticCompiler ? false
|
||||
, enableShared ? true
|
||||
, enableLTO ? true
|
||||
@@ -13,6 +16,7 @@
|
||||
, libelf # optional, for link-time optimizations (LTO)
|
||||
, isl ? null # optional, for the Graphite optimization framework.
|
||||
, zlib ? null
|
||||
, gnatboot ? null
|
||||
, enableMultilib ? false
|
||||
, enablePlugin ? stdenv.hostPlatform == stdenv.buildPlatform # Whether to support user-supplied plug-ins
|
||||
, name ? "gcc"
|
||||
@@ -27,6 +31,11 @@
|
||||
, buildPackages
|
||||
}:
|
||||
|
||||
# Note: this package is used for bootstrapping fetchurl, and thus
|
||||
# cannot use fetchpatch! All mutable patches (generated by GitHub or
|
||||
# cgit) that are needed here should be included directly in Nixpkgs as
|
||||
# files.
|
||||
|
||||
# LTO needs libelf and zlib.
|
||||
assert libelf != null -> zlib != null;
|
||||
|
||||
@@ -35,6 +44,7 @@ assert stdenv.hostPlatform.isDarwin -> gnused != null;
|
||||
|
||||
# The go frontend is written in c++
|
||||
assert langGo -> langCC;
|
||||
assert langAda -> gnatboot != null;
|
||||
|
||||
# threadsCross is just for MinGW
|
||||
assert threadsCross != null -> stdenv.targetPlatform.isWindows;
|
||||
@@ -43,7 +53,7 @@ with stdenv.lib;
|
||||
with builtins;
|
||||
|
||||
let majorVersion = "9";
|
||||
version = "${majorVersion}.2.0";
|
||||
version = "${majorVersion}.3.0";
|
||||
|
||||
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
|
||||
|
||||
@@ -54,6 +64,8 @@ let majorVersion = "9";
|
||||
url = "https://git.busybox.net/buildroot/plain/package/gcc/${version}/0900-remove-selftests.patch?id=11271540bfe6adafbc133caf6b5b902a816f5f02";
|
||||
sha256 = ""; # TODO: uncomment and check hash when available.
|
||||
}) */
|
||||
++ optional langAda ../gnat-cflags.patch
|
||||
++ optional langD ../libphobos.patch
|
||||
++ optional langFortran ../gfortran-driving.patch
|
||||
++ optional (targetPlatform.libc == "musl" && targetPlatform.isPower) ../ppc-musl.patch
|
||||
++ optional (!crossStageStatic && targetPlatform.isMinGW) (fetchpatch {
|
||||
@@ -76,12 +88,12 @@ stdenv.mkDerivation ({
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://gcc/releases/gcc-${version}/gcc-${version}.tar.xz";
|
||||
sha256 = "01mj3yk7z49i49168hg2cg7qs4bsccrrnv7pjmbdlf8j2a7z0vpa";
|
||||
sha256 = "1la2yy27ziasyf0jvzk58y1i5b5bq2h176qil550bxhifs39gqbi";
|
||||
};
|
||||
|
||||
inherit patches;
|
||||
|
||||
outputs = [ "out" "lib" "man" "info" ];
|
||||
outputs = [ "out" "man" "info" ] ++ stdenv.lib.optional (!langJit) "lib";
|
||||
setOutputFlags = false;
|
||||
NIX_NO_SELF_RPATH = true;
|
||||
|
||||
@@ -96,10 +108,10 @@ stdenv.mkDerivation ({
|
||||
--replace 'if (stdinc)' 'if (0)'
|
||||
|
||||
substituteInPlace libgcc/config/t-slibgcc-darwin \
|
||||
--replace "-install_name @shlib_slibdir@/\$(SHLIB_INSTALL_NAME)" "-install_name $lib/lib/\$(SHLIB_INSTALL_NAME)"
|
||||
--replace "-install_name @shlib_slibdir@/\$(SHLIB_INSTALL_NAME)" "-install_name ''${!outputLib}/lib/\$(SHLIB_INSTALL_NAME)"
|
||||
|
||||
substituteInPlace libgfortran/configure \
|
||||
--replace "-install_name \\\$rpath/\\\$soname" "-install_name $lib/lib/\\\$soname"
|
||||
--replace "-install_name \\\$rpath/\\\$soname" "-install_name ''${!outputLib}/lib/\\\$soname"
|
||||
'';
|
||||
|
||||
postPatch = ''
|
||||
@@ -132,10 +144,10 @@ stdenv.mkDerivation ({
|
||||
)
|
||||
else "")
|
||||
+ stdenv.lib.optionalString targetPlatform.isAvr ''
|
||||
makeFlagsArray+=(
|
||||
'LIMITS_H_TEST=false'
|
||||
)
|
||||
'';
|
||||
makeFlagsArray+=(
|
||||
'LIMITS_H_TEST=false'
|
||||
)
|
||||
'';
|
||||
|
||||
inherit noSysDirs staticCompiler crossStageStatic
|
||||
libcCross crossMingw;
|
||||
@@ -163,6 +175,7 @@ stdenv.mkDerivation ({
|
||||
# The builder relies on GNU sed (for instance, Darwin's `sed' fails with
|
||||
# "-i may not be used with stdin"), and `stdenvNative' doesn't provide it.
|
||||
++ (optional hostPlatform.isDarwin gnused)
|
||||
++ (optional langAda gnatboot)
|
||||
;
|
||||
|
||||
depsTargetTarget = optional (!crossStageStatic && threadsCross != null) threadsCross;
|
||||
@@ -171,7 +184,7 @@ stdenv.mkDerivation ({
|
||||
|
||||
preConfigure = import ../common/pre-configure.nix {
|
||||
inherit (stdenv) lib;
|
||||
inherit version hostPlatform langGo;
|
||||
inherit version hostPlatform gnatboot langAda langGo;
|
||||
};
|
||||
|
||||
dontDisableStatic = true;
|
||||
@@ -194,11 +207,14 @@ stdenv.mkDerivation ({
|
||||
enableShared
|
||||
|
||||
langC
|
||||
langD
|
||||
langCC
|
||||
langFortran
|
||||
langAda
|
||||
langGo
|
||||
langObjC
|
||||
langObjCpp
|
||||
langJit
|
||||
;
|
||||
};
|
||||
|
||||
@@ -232,14 +248,14 @@ stdenv.mkDerivation ({
|
||||
|
||||
inherit
|
||||
(import ../common/extra-target-flags.nix {
|
||||
inherit stdenv crossStageStatic libcCross threadsCross;
|
||||
inherit stdenv crossStageStatic langD libcCross threadsCross;
|
||||
})
|
||||
EXTRA_TARGET_FLAGS
|
||||
EXTRA_TARGET_LDFLAGS
|
||||
EXTRA_FLAGS_FOR_TARGET
|
||||
EXTRA_LDFLAGS_FOR_TARGET
|
||||
;
|
||||
|
||||
passthru = {
|
||||
inherit langC langCC langObjC langObjCpp langFortran langGo version;
|
||||
inherit langC langCC langObjC langObjCpp langAda langFortran langGo langD version;
|
||||
isGNU = true;
|
||||
};
|
||||
|
||||
@@ -248,14 +264,8 @@ stdenv.mkDerivation ({
|
||||
|
||||
inherit (stdenv) is64bit;
|
||||
|
||||
# In this particular combination it stopped creating lib output at all.
|
||||
# TODO: perhaps find a better fix? (ideally understand what's going on)
|
||||
postFixup = if crossStageStatic && targetPlatform.isMusl && targetPlatform.is32bit
|
||||
then ''mkdir "$lib"''
|
||||
else null;
|
||||
|
||||
meta = {
|
||||
homepage = https://gcc.gnu.org/;
|
||||
homepage = "https://gcc.gnu.org/";
|
||||
license = stdenv.lib.licenses.gpl3Plus; # runtime support libraries are typically LGPLv3+
|
||||
description = "GNU Compiler Collection, version ${version}"
|
||||
+ (if stripped then "" else " (with debugging info)");
|
||||
|
||||
Reference in New Issue
Block a user