Skip to content

Commit

Permalink
Merge pull request NixOS#215751 from Artturin/gccaddcallfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Artturin committed Feb 12, 2023
2 parents 85bba00 + 6986717 commit 8d4db5e
Show file tree
Hide file tree
Showing 12 changed files with 741 additions and 718 deletions.
156 changes: 77 additions & 79 deletions pkgs/development/compilers/gcc/10/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
, threadsCross ? null # for MinGW
, crossStageStatic ? false
, gnused ? null
, cloog # unused; just for compat with gcc4, as we override the parameter on some places
, cloog ? null # unused; just for compat with gcc4, as we override the parameter on some places
, buildPackages
, libxcrypt
}:
Expand Down Expand Up @@ -83,6 +83,67 @@ let majorVersion = "10";
stageNameAddon = if crossStageStatic then "stage-static" else "stage-final";
crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-";

callFile = lib.callPackageWith {
# lets
inherit
majorVersion
version
buildPlatform
hostPlatform
targetPlatform
patches
crossMingw
stageNameAddon
crossNameAddon
;
# inherit generated with 'nix eval --json --impure --expr "with import ./. {}; lib.attrNames (lib.functionArgs gcc10.cc.override)" | jq '.[]' --raw-output'
inherit
binutils
buildPackages
cloog
crossStageStatic
enableLTO
enableMultilib
enablePlugin
enableShared
fetchpatch
fetchurl
gettext
gmp
gnatboot
gnused
isl
langAda
langC
langCC
langD
langFortran
langGo
langJit
langObjC
langObjCpp
lib
libcCross
libmpc
libxcrypt
mpfr
name
noSysDirs
patchelf
perl
profiledCompiler
reproducibleBuild
staticCompiler
stdenv
targetPackages
texinfo
threadsCross
which
zip
zlib
;
};

in

stdenv.mkDerivation ({
Expand Down Expand Up @@ -158,72 +219,20 @@ stdenv.mkDerivation ({
inherit noSysDirs staticCompiler crossStageStatic
libcCross crossMingw;

inherit (import ../common/dependencies.nix {
inherit
lib
stdenv
buildPackages
targetPackages
crossStageStatic
threadsCross
langAda
libxcrypt
gnatboot
version
texinfo
which
gettext
gnused
patchelf
gmp
mpfr
libmpc
isl
zlib
zip
perl
;
}) depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget;
inherit (callFile ../common/dependencies.nix { })
depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget;

NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm -ldl";

preConfigure = (import ../common/pre-configure.nix {
inherit lib;
inherit version targetPlatform hostPlatform buildPlatform gnatboot langAda langGo langJit crossStageStatic enableMultilib;
}) + ''
preConfigure = (callFile ../common/pre-configure.nix { }) + ''
ln -sf ${libxcrypt}/include/crypt.h libsanitizer/sanitizer_common/crypt.h
'';

dontDisableStatic = true;

configurePlatforms = [ "build" "host" "target" ];

configureFlags = import ../common/configure-flags.nix {
inherit
lib
stdenv
targetPackages
crossStageStatic libcCross threadsCross
version

binutils gmp mpfr libmpc isl

enableLTO
enableMultilib
enablePlugin
enableShared

langC
langD
langCC
langFortran
langAda
langGo
langObjC
langObjCpp
langJit
;
};
configureFlags = callFile ../common/configure-flags.nix { };

targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
targetPlatformConfig = targetPlatform.config;
Expand All @@ -232,8 +241,7 @@ stdenv.mkDerivation ({
(targetPlatform == hostPlatform && hostPlatform == buildPlatform)
(if profiledCompiler then "profiledbootstrap" else "bootstrap");

inherit
(import ../common/strip-attributes.nix { inherit lib stdenv langJit; })
inherit (callFile ../common/strip-attributes.nix { })
stripDebugList
stripDebugListTarget
preFixup;
Expand All @@ -256,10 +264,7 @@ stdenv.mkDerivation ({

LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath (optional (zlib != null) zlib));

inherit
(import ../common/extra-target-flags.nix {
inherit lib stdenv crossStageStatic langD libcCross threadsCross;
})
inherit (callFile ../common/extra-target-flags.nix { })
EXTRA_FLAGS_FOR_TARGET
EXTRA_LDFLAGS_FOR_TARGET
;
Expand All @@ -273,24 +278,17 @@ stdenv.mkDerivation ({
inherit enableMultilib enableShared;

meta = {
homepage = "https://gcc.gnu.org/";
license = lib.licenses.gpl3Plus; # runtime support libraries are typically LGPLv3+
description = "GNU Compiler Collection, version ${version}";

longDescription = ''
The GNU Compiler Collection includes compiler front ends for C, C++,
Objective-C, Fortran, OpenMP for C/C++/Fortran, and Ada, as well as
libraries for these languages (libstdc++, libgomp,...).
GCC development is a part of the GNU Project, aiming to improve the
compiler used in the GNU system including the GNU/Linux variant.
'';

maintainers = lib.teams.gcc.members;

platforms = lib.platforms.unix;
inherit (callFile ../common/meta.nix { })
homepage
license
description
longDescription
platforms
maintainers
;
badPlatforms = [ "aarch64-darwin" ];
};

}

// optionalAttrs (targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt" && crossStageStatic) {
Expand Down
Loading

0 comments on commit 8d4db5e

Please sign in to comment.