mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-10-18 03:04:32 +03:00
Merge master into staging-next
This commit is contained in:
commit
81dc6fc8da
@ -11,12 +11,12 @@
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "famistudio";
|
||||
version = "4.1.1";
|
||||
version = "4.1.2";
|
||||
|
||||
src = fetchzip {
|
||||
url = "https://github.com/BleuBleu/FamiStudio/releases/download/${version}/FamiStudio${lib.strings.concatStrings (lib.splitVersion version)}-LinuxAMD64.zip";
|
||||
stripRoot = false;
|
||||
hash = "sha256-fRNjboCfymBhr7Eg5ENnO1fchX0oTdeaJJ0SC3BKTVI=";
|
||||
hash = "sha256-zETivzQBkKOhsZryiwv3dDeXPO8CKWFfjERdPJXbj5U=";
|
||||
};
|
||||
|
||||
strictDeps = true;
|
||||
|
@ -16,13 +16,13 @@
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "mympd";
|
||||
version = "10.3.3";
|
||||
version = "11.0.3";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "jcorporation";
|
||||
repo = "myMPD";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-LqIaRFAXB3XMidC1Dypax/ucayot/IJPAvPwzHQeH9k=";
|
||||
sha256 = "sha256-pDM9igAX1iUi/yC8/Jqobaixkw6klEVcd0sAn0Ufdjk=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
@ -45,18 +45,17 @@ stdenv.mkDerivation rec {
|
||||
];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DENABLE_LUA=ON"
|
||||
# Otherwise, it tries to parse $out/etc/mympd.conf on startup.
|
||||
"-DCMAKE_INSTALL_SYSCONFDIR=/etc"
|
||||
# similarly here
|
||||
"-DCMAKE_INSTALL_LOCALSTATEDIR=/var/lib/mympd"
|
||||
];
|
||||
hardeningDisable = [
|
||||
# See https://github.com/jcorporation/myMPD/issues/315
|
||||
"strictoverflow"
|
||||
# causes redefinition of _FORTIFY_SOURCE
|
||||
"fortify3"
|
||||
];
|
||||
# 5 tests out of 23 fail, probably due to the sandbox...
|
||||
doCheck = false;
|
||||
|
||||
meta = {
|
||||
homepage = "https://jcorporation.github.io/myMPD";
|
||||
|
@ -19,13 +19,13 @@ let
|
||||
in
|
||||
pythonPackages.buildPythonApplication rec {
|
||||
pname = "picard";
|
||||
version = "2.9";
|
||||
version = "2.9.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "metabrainz";
|
||||
repo = "picard";
|
||||
rev = "refs/tags/release-${version}";
|
||||
hash = "sha256-ultpLz4u2wBxoL4YbNeZ4Z4NEXBvqpxJ8mzFeGQTt4A=";
|
||||
hash = "sha256-KCLva8pc+hyz+3MkPsghXrDYGVqP0aeffG9hOYJzI+Q=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
|
@ -10,16 +10,16 @@
|
||||
}:
|
||||
rustPlatform.buildRustPackage rec {
|
||||
pname = "snarkos";
|
||||
version = "2.1.4";
|
||||
version = "2.1.6";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "AleoHQ";
|
||||
repo = "snarkOS";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-zZbFK5CVmJ0vCeVhUFw1j//1uzqJVs56Jy1LY7E1mFE=";
|
||||
sha256 = "sha256-S79u9jAtYHsCFwvhNTRKrQL/CUBrzt8twx4mzwNtxhs=";
|
||||
};
|
||||
|
||||
cargoHash = "sha256-AxGHWFCyaq8ZDIT8mvO7bhezVshnZeOdgcHHAouFFL4=";
|
||||
cargoHash = "sha256-cDyViA3TuUoQsU9OnEF3UDgwQhPhgg4mTcqDy2VIA9c=";
|
||||
|
||||
# buildAndTestSubdir = "cli";
|
||||
|
||||
|
@ -11,10 +11,10 @@ buildGoModule rec {
|
||||
owner = "mingrammer";
|
||||
repo = pname;
|
||||
rev = "v${version}";
|
||||
sha256 = "09brjr3h4qnhlidxlki1by5anahxy16ai078zm4k7ryl579amzdw";
|
||||
hash = "sha256-vP2q0inU5zNJ/eiAqEzwHSqril8hTtpbpNBiAkeWeSU=";
|
||||
};
|
||||
|
||||
vendorSha256 = null;
|
||||
vendorHash = null;
|
||||
|
||||
subPackages = [ "." ];
|
||||
|
||||
|
@ -2,11 +2,11 @@
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "calcurse";
|
||||
version = "4.8.0";
|
||||
version = "4.8.1";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://calcurse.org/files/${pname}-${version}.tar.gz";
|
||||
sha256 = "sha256-SKc2ZmzEtrUwEtc7OqcBUsGLQebHtIB/qw8WjWRa4yw=";
|
||||
hash = "sha256-2GuzcBT9abjYPMuQSsl5xrjd9Z7j28gPWidFJeTVgwo=";
|
||||
};
|
||||
|
||||
buildInputs = [ ncurses gettext python3 python3Packages.wrapPython ];
|
||||
@ -31,5 +31,6 @@ stdenv.mkDerivation rec {
|
||||
changelog = "https://git.calcurse.org/calcurse.git/plain/CHANGES.md?h=v${version}";
|
||||
license = licenses.bsd2;
|
||||
platforms = platforms.unix;
|
||||
maintainers = [ maintainers.matthiasbeyer ];
|
||||
};
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
python3.pkgs.buildPythonApplication rec {
|
||||
pname = "flexget";
|
||||
version = "3.9.1";
|
||||
version = "3.9.3";
|
||||
format = "pyproject";
|
||||
|
||||
# Fetch from GitHub in order to use `requirements.in`
|
||||
@ -14,7 +14,7 @@ python3.pkgs.buildPythonApplication rec {
|
||||
owner = "Flexget";
|
||||
repo = "Flexget";
|
||||
rev = "refs/tags/v${version}";
|
||||
hash = "sha256-XXmqDZJ5rjoBarhIYlzC2O9jf97SWJiILWLsHDgM78Q=";
|
||||
hash = "sha256-IP6rVOrhIWrEWqrA0BCthAbCD2pRNnDzvY7bP4ANTCc=";
|
||||
};
|
||||
|
||||
postPatch = ''
|
||||
|
@ -21,14 +21,14 @@
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "wpsoffice";
|
||||
version = "11.1.0.11698";
|
||||
version = "11.1.0.11704";
|
||||
|
||||
src = if useChineseVersion then fetchurl {
|
||||
url = "https://wps-linux-personal.wpscdn.cn/wps/download/ep/Linux2019/${lib.last (lib.splitString "." version)}/wps-office_${version}_amd64.deb";
|
||||
sha256 = "sha256-m7BOE2IF2m75mV/4X3HY9UJcidL0S0biqkidddp4LbQ=";
|
||||
hash = "sha256-ffLSon9FpQZDQ1uapchBUkVaHOXs+H/6kHJLNiWqwiE=";
|
||||
} else fetchurl {
|
||||
url = "https://wdl1.pcfg.cache.wpscdn.com/wpsdl/wpsoffice/download/linux/${lib.last (lib.splitString "." version)}/wps-office_${version}.XA_amd64.deb";
|
||||
sha256 = "sha256-spqxQK/xTE8yFPmGbSbrDY1vSxkan2kwAWpCWIExhgs=";
|
||||
hash = "sha256-nxpMEWKiNjjEUoVJkhpvjnCuWBCCGjPk+sUlKz+KjMI=";
|
||||
};
|
||||
|
||||
unpackCmd = "dpkg -x $src .";
|
||||
|
@ -9,13 +9,13 @@
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "last";
|
||||
version = "1460";
|
||||
version = "1471";
|
||||
|
||||
src = fetchFromGitLab {
|
||||
owner = "mcfrith";
|
||||
repo = "last";
|
||||
rev = "refs/tags/${version}";
|
||||
hash = "sha256-9Er15zsq9Xrw66M8QOmARC1S/O5NvmpdUvOZUGc92P0=";
|
||||
hash = "sha256-HQ2C7SFfJS6TOJZUm6szhu+hMm41BnH8A7DZE5yh9fM=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
|
@ -1,4 +1,4 @@
|
||||
{lib, nimPackages, fetchFromGitHub, pcre}:
|
||||
{ lib, nimPackages, fetchFromGitHub, docopt, hts, pcre }:
|
||||
|
||||
nimPackages.buildNimPackage rec {
|
||||
pname = "mosdepth";
|
||||
@ -12,7 +12,8 @@ nimPackages.buildNimPackage rec {
|
||||
sha256 = "sha256-7uteYTCbAaXedPqk0WtHpqTfUWH/+rRW8aSlFixkEko=";
|
||||
};
|
||||
|
||||
buildInputs = with nimPackages; [ docopt hts-nim pcre ];
|
||||
buildInputs = [ docopt hts pcre ];
|
||||
nimFlags = hts.nimFlags ++ [ "--threads:off" ];
|
||||
|
||||
meta = with lib; {
|
||||
description = "fast BAM/CRAM depth calculation for WGS, exome, or targeted sequencing";
|
||||
|
25
pkgs/applications/version-management/git-bars/default.nix
Normal file
25
pkgs/applications/version-management/git-bars/default.nix
Normal file
@ -0,0 +1,25 @@
|
||||
{ stdenv, lib, fetchFromGitHub, python3Packages, git }:
|
||||
|
||||
python3Packages.buildPythonApplication {
|
||||
pname = "git-bars";
|
||||
version = "unstable-2023-08-08";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "knadh";
|
||||
repo = "git-bars";
|
||||
rev = "f15fbc15345d9ef021e5a9b278e352bb532dcee8";
|
||||
hash = "sha256-jHP6LqhUQv6hh97tSXAdOruWdtp2FXM6ANlpWoA+fHQ=";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = [
|
||||
git
|
||||
python3Packages.setuptools
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/knadh/git-bars";
|
||||
description = "A utility for visualising git commit activity as bars on the terminal";
|
||||
license = licenses.mit;
|
||||
maintainers = [ maintainers.matthiasbeyer ];
|
||||
};
|
||||
}
|
@ -2,11 +2,11 @@
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "freetube";
|
||||
version = "0.18.0";
|
||||
version = "0.19.0";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/FreeTubeApp/FreeTube/releases/download/v${version}-beta/freetube_${version}_amd64.AppImage";
|
||||
sha256 = "sha256-7IxmlkExM8Q1yyq44ajZ6on4EMPyGt23QmzmBZmofts=";
|
||||
sha256 = "0yr5k9s3r4yvcx85bzwn6y4m03964ljnmhz7nf068zj87m9q8rcc";
|
||||
};
|
||||
|
||||
appimageContents = appimageTools.extractType2 {
|
||||
|
@ -3,11 +3,11 @@
|
||||
buildKodiAddon rec {
|
||||
pname = "arteplussept";
|
||||
namespace = "plugin.video.arteplussept";
|
||||
version = "1.1.10";
|
||||
version = "1.4.0";
|
||||
|
||||
src = fetchzip {
|
||||
url = "https://mirrors.kodi.tv/addons/nexus/${namespace}/${namespace}-${version}.zip";
|
||||
hash = "sha256-EDpoeS9FnFsn6jvg6EFKr089YixKipLi9yzxdi7YUmA=";
|
||||
hash = "sha256-m7DHQVg0pcLGCHTdecCTGfanUWhuPMHdllbg+47hxEI=";
|
||||
};
|
||||
|
||||
propagatedBuildInputs = [
|
||||
|
@ -0,0 +1,31 @@
|
||||
{ lib, rel, buildKodiBinaryAddon, fetchFromGitHub, libretro, nestopia }:
|
||||
|
||||
buildKodiBinaryAddon rec {
|
||||
pname = "libretro-nestopia";
|
||||
namespace = "game.libretro.nestopia";
|
||||
version = "1.52.0.41";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "kodi-game";
|
||||
repo = "game.libretro.nestopia";
|
||||
rev = "${version}-${rel}";
|
||||
sha256 = "sha256-DmBO+HcfIBcz7p16dND09iwXWeObtU/doo/mJ0IZGGg=";
|
||||
};
|
||||
|
||||
extraCMakeFlags = [
|
||||
"-DNESTOPIA_LIB=${nestopia}/lib/retroarch/cores/nestopia_libretro.so"
|
||||
];
|
||||
|
||||
extraBuildInputs = [ nestopia ];
|
||||
propagatedBuildInputs = [
|
||||
libretro
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/kodi-game/game.libretro.nestopia";
|
||||
description = "Nintendo - NES / Famicom (Nestopia UE) GameClient for Kodi";
|
||||
platforms = platforms.all;
|
||||
license = licenses.gpl2Only;
|
||||
maintainers = teams.kodi.members;
|
||||
};
|
||||
}
|
@ -2,11 +2,11 @@
|
||||
buildKodiAddon rec {
|
||||
pname = "myconnpy";
|
||||
namespace = "script.module.myconnpy";
|
||||
version = "8.0.18+matrix.1";
|
||||
version = "8.0.33";
|
||||
|
||||
src = fetchzip {
|
||||
url = "https://mirrors.kodi.tv/addons/nexus/${namespace}/${namespace}-${version}.zip";
|
||||
sha256 = "sha256-E1S1EThukF3noU4LC6MDQseRQhSsZr/9qnPSxH/Do7M=";
|
||||
sha256 = "sha256-NlLMq9RAdWu8rVsMc0FDe1HmQiVp5T7iBXbIH7HB5bI=";
|
||||
};
|
||||
|
||||
passthru = {
|
||||
|
@ -6,13 +6,13 @@
|
||||
buildKodiBinaryAddon rec {
|
||||
pname = "pvr-iptvsimple";
|
||||
namespace = "pvr.iptvsimple";
|
||||
version = "20.10.1";
|
||||
version = "20.11.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "kodi-pvr";
|
||||
repo = "pvr.iptvsimple";
|
||||
rev = "${version}-${rel}";
|
||||
sha256 = "sha256-3bE6x1d3IMXN5miBAeb+1qRBbx8Ni386iEhSwT0znR8=";
|
||||
sha256 = "sha256-58Dma0UtD6Uy4zu4aQT2FY0emLiQpA4RChhnneMzFZI=";
|
||||
};
|
||||
|
||||
extraBuildInputs = [
|
||||
|
@ -22,13 +22,13 @@
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "deepin-terminal";
|
||||
version = "6.0.5";
|
||||
version = "6.0.6";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "linuxdeepin";
|
||||
repo = pname;
|
||||
rev = version;
|
||||
sha256 = "sha256-pRTdvR3hyiJVpi38Ex58X74ns+rSWuytsOXemvdW1Rk=";
|
||||
hash = "sha256-LzCbh+BErgh7Ojbw314oHB8QvyS6UeJkDUkNngzVm+A=";
|
||||
};
|
||||
|
||||
cmakeFlags = [ "-DVERSION=${version}" ];
|
||||
|
@ -1,296 +0,0 @@
|
||||
{ lib, 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
|
||||
, reproducibleBuild ? true
|
||||
, profiledCompiler ? false
|
||||
, langJit ? false
|
||||
, staticCompiler ? false
|
||||
, enableShared ? stdenv.targetPlatform.hasSharedLibraries
|
||||
, enableLTO ? stdenv.hostPlatform.hasSharedLibraries
|
||||
, texinfo ? null
|
||||
, perl ? null # optional, for texi2pod (then pod2man)
|
||||
, gmp, mpfr, libmpc, gettext, which, patchelf, binutils
|
||||
, isl ? null # optional, for the Graphite optimization framework.
|
||||
, zlib ? null
|
||||
, gnat-bootstrap ? null
|
||||
, enableMultilib ? false
|
||||
, enablePlugin ? stdenv.hostPlatform == stdenv.buildPlatform # Whether to support user-supplied plug-ins
|
||||
, name ? "gcc"
|
||||
, libcCross ? null
|
||||
, threadsCross ? null # for MinGW
|
||||
, withoutTargetLibc ? false
|
||||
, gnused ? null
|
||||
, cloog ? null # unused; just for compat with gcc4, as we override the parameter on some places
|
||||
, buildPackages
|
||||
, libxcrypt
|
||||
, callPackage
|
||||
}:
|
||||
|
||||
# Make sure we get GNU sed.
|
||||
assert stdenv.buildPlatform.isDarwin -> gnused != null;
|
||||
|
||||
# The go frontend is written in c++
|
||||
assert langGo -> langCC;
|
||||
assert langAda -> gnat-bootstrap != null;
|
||||
|
||||
# threadsCross is just for MinGW
|
||||
assert threadsCross != {} -> stdenv.targetPlatform.isWindows;
|
||||
|
||||
# profiledCompiler builds inject non-determinism in one of the compilation stages.
|
||||
# If turned on, we can't provide reproducible builds anymore
|
||||
assert reproducibleBuild -> profiledCompiler == false;
|
||||
|
||||
with lib;
|
||||
with builtins;
|
||||
|
||||
let majorVersion = "10";
|
||||
version = "${majorVersion}.5.0";
|
||||
|
||||
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
|
||||
|
||||
patches = [
|
||||
# Fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80431
|
||||
../fix-bug-80431.patch
|
||||
] ++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
|
||||
++ optional noSysDirs ../no-sys-dirs.patch
|
||||
++ optional noSysDirs ../no-sys-dirs-riscv.patch
|
||||
/* ++ optional (hostPlatform != buildPlatform) (fetchpatch { # XXX: Refine when this should be applied
|
||||
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
|
||||
|
||||
# Obtain latest patch with ../update-mcfgthread-patches.sh
|
||||
++ optional (!withoutTargetLibc && targetPlatform.isMinGW && threadsCross.model == "mcf") ./Added-mcf-thread-model-support-from-mcfgthread.patch
|
||||
|
||||
++ optional (buildPlatform.system == "aarch64-darwin" && targetPlatform != buildPlatform) (fetchpatch {
|
||||
url = "https://raw.githubusercontent.com/richard-vd/musl-cross-make/5e9e87f06fc3220e102c29d3413fbbffa456fcd6/patches/gcc-${version}/0008-darwin-aarch64-self-host-driver.patch";
|
||||
sha256 = "sha256-XtykrPd5h/tsnjY1wGjzSOJ+AyyNLsfnjuOZ5Ryq9vA=";
|
||||
});
|
||||
|
||||
/* Cross-gcc settings (build == host != target) */
|
||||
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
|
||||
stageNameAddon = if withoutTargetLibc 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
|
||||
withoutTargetLibc
|
||||
enableLTO
|
||||
enableMultilib
|
||||
enablePlugin
|
||||
enableShared
|
||||
fetchpatch
|
||||
fetchurl
|
||||
gettext
|
||||
gmp
|
||||
gnat-bootstrap
|
||||
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
|
||||
|
||||
lib.pipe ((callFile ../common/builder.nix {}) ({
|
||||
pname = "${crossNameAddon}${name}";
|
||||
inherit version;
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://gcc/releases/gcc-${version}/gcc-${version}.tar.xz";
|
||||
hash = "sha256-JRCVQ/30bzl8NHtdi3osflaUpaUczkucbh6opxyjB8E=";
|
||||
};
|
||||
|
||||
inherit patches;
|
||||
|
||||
outputs = [ "out" "man" "info" ] ++ lib.optional (!langJit) "lib";
|
||||
setOutputFlags = false;
|
||||
NIX_NO_SELF_RPATH = true;
|
||||
|
||||
libc_dev = stdenv.cc.libc_dev;
|
||||
|
||||
hardeningDisable = [ "format" "pie" ];
|
||||
|
||||
postPatch = ''
|
||||
configureScripts=$(find . -name configure)
|
||||
for configureScript in $configureScripts; do
|
||||
patchShebangs $configureScript
|
||||
done
|
||||
''
|
||||
# This should kill all the stdinc frameworks that gcc and friends like to
|
||||
# insert into default search paths.
|
||||
+ lib.optionalString hostPlatform.isDarwin ''
|
||||
substituteInPlace gcc/config/darwin-c.c \
|
||||
--replace 'if (stdinc)' 'if (0)'
|
||||
|
||||
substituteInPlace libgcc/config/t-slibgcc-darwin \
|
||||
--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 ''${!outputLib}/lib/\\\$soname"
|
||||
''
|
||||
+ (
|
||||
lib.optionalString (targetPlatform != hostPlatform || stdenv.cc.libc != null)
|
||||
# On NixOS, use the right path to the dynamic linker instead of
|
||||
# `/lib/ld*.so'.
|
||||
(let
|
||||
libc = if libcCross != null then libcCross else stdenv.cc.libc;
|
||||
in
|
||||
(
|
||||
'' echo "fixing the \`GLIBC_DYNAMIC_LINKER', \`UCLIBC_DYNAMIC_LINKER', and \`MUSL_DYNAMIC_LINKER' macros..."
|
||||
for header in "gcc/config/"*-gnu.h "gcc/config/"*"/"*.h
|
||||
do
|
||||
grep -q _DYNAMIC_LINKER "$header" || continue
|
||||
echo " fixing \`$header'..."
|
||||
sed -i "$header" \
|
||||
-e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc.out}\3"|g' \
|
||||
-e 's|define[[:blank:]]*MUSL_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define MUSL_DYNAMIC_LINKER\1 "${libc.out}\2"|g'
|
||||
done
|
||||
''
|
||||
+ lib.optionalString (targetPlatform.libc == "musl")
|
||||
''
|
||||
sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR'
|
||||
''
|
||||
))
|
||||
)
|
||||
+ lib.optionalString targetPlatform.isAvr ''
|
||||
makeFlagsArray+=(
|
||||
'-s' # workaround for hitting hydra log limit
|
||||
'LIMITS_H_TEST=false'
|
||||
)
|
||||
'';
|
||||
|
||||
inherit noSysDirs staticCompiler withoutTargetLibc
|
||||
libcCross crossMingw;
|
||||
|
||||
inherit (callFile ../common/dependencies.nix { })
|
||||
depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget;
|
||||
|
||||
NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm";
|
||||
|
||||
preConfigure = (callFile ../common/pre-configure.nix { }) + ''
|
||||
ln -sf ${libxcrypt}/include/crypt.h libsanitizer/sanitizer_common/crypt.h
|
||||
'';
|
||||
|
||||
dontDisableStatic = true;
|
||||
|
||||
configurePlatforms = [ "build" "host" "target" ];
|
||||
|
||||
configureFlags = callFile ../common/configure-flags.nix { };
|
||||
|
||||
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
|
||||
|
||||
buildFlags = optional
|
||||
(targetPlatform == hostPlatform && hostPlatform == buildPlatform)
|
||||
(if profiledCompiler then "profiledbootstrap" else "bootstrap");
|
||||
|
||||
# https://gcc.gnu.org/PR109898
|
||||
enableParallelInstalling = false;
|
||||
|
||||
inherit (callFile ../common/strip-attributes.nix { })
|
||||
stripDebugList
|
||||
stripDebugListTarget
|
||||
preFixup;
|
||||
|
||||
# https://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
|
||||
${if hostPlatform.system == "x86_64-solaris" then "CC" else null} = "gcc -m64";
|
||||
|
||||
# Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the
|
||||
# library headers and binaries, regarless of the language being compiled.
|
||||
#
|
||||
# Likewise, the LTO code doesn't find zlib.
|
||||
#
|
||||
# Cross-compiling, we need gcc not to read ./specs in order to build the g++
|
||||
# compiler (after the specs for the cross-gcc are created). Having
|
||||
# LIBRARY_PATH= makes gcc read the specs from ., and the build breaks.
|
||||
|
||||
CPATH = optionals (targetPlatform == hostPlatform) (makeSearchPathOutput "dev" "include" ([]
|
||||
++ optional (zlib != null) zlib
|
||||
));
|
||||
|
||||
LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath (optional (zlib != null) zlib));
|
||||
|
||||
inherit (callFile ../common/extra-target-flags.nix { })
|
||||
EXTRA_FLAGS_FOR_TARGET
|
||||
EXTRA_LDFLAGS_FOR_TARGET
|
||||
;
|
||||
|
||||
passthru = {
|
||||
inherit langC langCC langObjC langObjCpp langAda langFortran langGo langD version;
|
||||
isGNU = true;
|
||||
hardeningUnsupportedFlags = [ "fortify3" ];
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
inherit enableMultilib enableShared;
|
||||
|
||||
meta = {
|
||||
inherit (callFile ../common/meta.nix { })
|
||||
homepage
|
||||
license
|
||||
description
|
||||
longDescription
|
||||
platforms
|
||||
maintainers
|
||||
;
|
||||
badPlatforms = [ "aarch64-darwin" ];
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
|
||||
))
|
||||
[
|
||||
(callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc enableShared; })
|
||||
]
|
@ -1,311 +0,0 @@
|
||||
{ lib, 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
|
||||
, reproducibleBuild ? true
|
||||
, profiledCompiler ? false
|
||||
, langJit ? false
|
||||
, staticCompiler ? false
|
||||
, enableShared ? stdenv.targetPlatform.hasSharedLibraries
|
||||
, enableLTO ? stdenv.hostPlatform.hasSharedLibraries
|
||||
, texinfo ? null
|
||||
, perl ? null # optional, for texi2pod (then pod2man)
|
||||
, gmp, mpfr, libmpc, gettext, which, patchelf, binutils
|
||||
, isl ? null # optional, for the Graphite optimization framework.
|
||||
, zlib ? null
|
||||
, gnat-bootstrap ? null
|
||||
, enableMultilib ? false
|
||||
, enablePlugin ? stdenv.hostPlatform == stdenv.buildPlatform # Whether to support user-supplied plug-ins
|
||||
, name ? "gcc"
|
||||
, libcCross ? null
|
||||
, threadsCross ? null # for MinGW
|
||||
, withoutTargetLibc ? false
|
||||
, gnused ? null
|
||||
, cloog # unused; just for compat with gcc4, as we override the parameter on some places
|
||||
, buildPackages
|
||||
, libxcrypt
|
||||
, disableGdbPlugin ? !enablePlugin
|
||||
, nukeReferences
|
||||
, callPackage
|
||||
}:
|
||||
|
||||
# Make sure we get GNU sed.
|
||||
assert stdenv.buildPlatform.isDarwin -> gnused != null;
|
||||
|
||||
# The go frontend is written in c++
|
||||
assert langGo -> langCC;
|
||||
assert langAda -> gnat-bootstrap != null;
|
||||
|
||||
# threadsCross is just for MinGW
|
||||
assert threadsCross != {} -> stdenv.targetPlatform.isWindows;
|
||||
|
||||
# profiledCompiler builds inject non-determinism in one of the compilation stages.
|
||||
# If turned on, we can't provide reproducible builds anymore
|
||||
assert reproducibleBuild -> profiledCompiler == false;
|
||||
|
||||
with lib;
|
||||
with builtins;
|
||||
|
||||
let majorVersion = "11";
|
||||
version = "${majorVersion}.4.0";
|
||||
disableBootstrap = !stdenv.hostPlatform.isDarwin;
|
||||
|
||||
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
|
||||
|
||||
patches = [
|
||||
# Fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80431
|
||||
../fix-bug-80431.patch
|
||||
] ++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
|
||||
++ optional noSysDirs ../no-sys-dirs.patch
|
||||
++ optional (noSysDirs && hostPlatform.isRiscV) ../no-sys-dirs-riscv.patch
|
||||
/* ++ optional (hostPlatform != buildPlatform) (fetchpatch { # XXX: Refine when this should be applied
|
||||
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-11.patch
|
||||
++ optional langD ../libphobos.patch
|
||||
++ optional langFortran ../gfortran-driving.patch
|
||||
++ optional (targetPlatform.libc == "musl" && targetPlatform.isPower) ../ppc-musl.patch
|
||||
|
||||
++ optionals stdenv.isDarwin [
|
||||
(fetchpatch {
|
||||
# There are no upstream release tags in https://github.com/iains/gcc-11-branch.
|
||||
# ff4bf32 is the commit from https://github.com/gcc-mirror/gcc/releases/tag/releases%2Fgcc-11.4.0
|
||||
url = "https://github.com/iains/gcc-11-branch/compare/ff4bf326d03e750a8d4905ea49425fe7d15a04b8..gcc-11.4-darwin-r0.diff";
|
||||
hash = "sha256-6prPgR2eGVJs7vKd6iM1eZsEPCD1ShzLns2Z+29vlt4=";
|
||||
})
|
||||
]
|
||||
# https://github.com/osx-cross/homebrew-avr/issues/280#issuecomment-1272381808
|
||||
++ optional (stdenv.isDarwin && targetPlatform.isAvr) ./avr-gcc-11.3-darwin.patch
|
||||
|
||||
# Obtain latest patch with ../update-mcfgthread-patches.sh
|
||||
++ optional (!withoutTargetLibc && targetPlatform.isMinGW && threadsCross.model == "mcf") ./Added-mcf-thread-model-support-from-mcfgthread.patch
|
||||
|
||||
# openjdk build fails without this on -march=opteron; is upstream in gcc12
|
||||
++ [ ./gcc-issue-103910.patch ];
|
||||
|
||||
/* Cross-gcc settings (build == host != target) */
|
||||
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
|
||||
stageNameAddon = if withoutTargetLibc 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 gcc11.cc.override)" | jq '.[]' --raw-output'
|
||||
inherit
|
||||
binutils
|
||||
buildPackages
|
||||
cloog
|
||||
withoutTargetLibc
|
||||
enableLTO
|
||||
enableMultilib
|
||||
enablePlugin
|
||||
disableGdbPlugin
|
||||
enableShared
|
||||
disableBootstrap
|
||||
fetchpatch
|
||||
fetchurl
|
||||
gettext
|
||||
gmp
|
||||
gnat-bootstrap
|
||||
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
|
||||
|
||||
lib.pipe ((callFile ../common/builder.nix {}) ({
|
||||
pname = "${crossNameAddon}${name}";
|
||||
inherit version;
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://gcc/releases/gcc-${version}/gcc-${version}.tar.xz";
|
||||
hash = "sha256-Py2yIrAH6KSiPNW6VnJu8I6LHx6yBV7nLBQCzqc6jdk=";
|
||||
};
|
||||
|
||||
inherit patches;
|
||||
|
||||
outputs = [ "out" "man" "info" ] ++ lib.optional (!langJit) "lib";
|
||||
setOutputFlags = false;
|
||||
NIX_NO_SELF_RPATH = true;
|
||||
|
||||
libc_dev = stdenv.cc.libc_dev;
|
||||
|
||||
hardeningDisable = [ "format" "pie" ]
|
||||
++ optional langAda "fortify3";
|
||||
|
||||
postPatch = ''
|
||||
configureScripts=$(find . -name configure)
|
||||
for configureScript in $configureScripts; do
|
||||
patchShebangs $configureScript
|
||||
done
|
||||
''
|
||||
# This should kill all the stdinc frameworks that gcc and friends like to
|
||||
# insert into default search paths.
|
||||
+ lib.optionalString hostPlatform.isDarwin ''
|
||||
substituteInPlace gcc/config/darwin-c.c \
|
||||
--replace 'if (stdinc)' 'if (0)'
|
||||
|
||||
substituteInPlace libgcc/config/t-slibgcc-darwin \
|
||||
--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 ''${!outputLib}/lib/\\\$soname"
|
||||
''
|
||||
+ (
|
||||
lib.optionalString (targetPlatform != hostPlatform || stdenv.cc.libc != null)
|
||||
# On NixOS, use the right path to the dynamic linker instead of
|
||||
# `/lib/ld*.so'.
|
||||
(let
|
||||
libc = if libcCross != null then libcCross else stdenv.cc.libc;
|
||||
in
|
||||
(
|
||||
'' echo "fixing the \`GLIBC_DYNAMIC_LINKER', \`UCLIBC_DYNAMIC_LINKER', and \`MUSL_DYNAMIC_LINKER' macros..."
|
||||
for header in "gcc/config/"*-gnu.h "gcc/config/"*"/"*.h
|
||||
do
|
||||
grep -q _DYNAMIC_LINKER "$header" || continue
|
||||
echo " fixing \`$header'..."
|
||||
sed -i "$header" \
|
||||
-e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc.out}\3"|g' \
|
||||
-e 's|define[[:blank:]]*MUSL_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define MUSL_DYNAMIC_LINKER\1 "${libc.out}\2"|g'
|
||||
done
|
||||
''
|
||||
+ lib.optionalString (targetPlatform.libc == "musl")
|
||||
''
|
||||
sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR'
|
||||
''
|
||||
))
|
||||
)
|
||||
+ lib.optionalString targetPlatform.isAvr ''
|
||||
makeFlagsArray+=(
|
||||
'-s' # workaround for hitting hydra log limit
|
||||
'LIMITS_H_TEST=false'
|
||||
)
|
||||
'';
|
||||
|
||||
inherit noSysDirs staticCompiler withoutTargetLibc
|
||||
libcCross crossMingw;
|
||||
|
||||
inherit (callFile ../common/dependencies.nix { })
|
||||
depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget;
|
||||
|
||||
NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm";
|
||||
|
||||
preConfigure = (callFile ../common/pre-configure.nix { }) + ''
|
||||
ln -sf ${libxcrypt}/include/crypt.h libsanitizer/sanitizer_common/crypt.h
|
||||
'';
|
||||
|
||||
dontDisableStatic = true;
|
||||
|
||||
configurePlatforms = [ "build" "host" "target" ];
|
||||
|
||||
configureFlags = callFile ../common/configure-flags.nix { };
|
||||
|
||||
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
|
||||
|
||||
buildFlags =
|
||||
let target = lib.optionalString (profiledCompiler) "profiled"
|
||||
+ lib.optionalString (targetPlatform == hostPlatform && hostPlatform == buildPlatform && !disableBootstrap) "bootstrap";
|
||||
in lib.optional (target != "") target;
|
||||
|
||||
# https://gcc.gnu.org/PR109898
|
||||
enableParallelInstalling = false;
|
||||
|
||||
inherit (callFile ../common/strip-attributes.nix { })
|
||||
stripDebugList
|
||||
stripDebugListTarget
|
||||
preFixup;
|
||||
|
||||
# https://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
|
||||
${if hostPlatform.system == "x86_64-solaris" then "CC" else null} = "gcc -m64";
|
||||
|
||||
# Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the
|
||||
# library headers and binaries, regarless of the language being compiled.
|
||||
#
|
||||
# Likewise, the LTO code doesn't find zlib.
|
||||
#
|
||||
# Cross-compiling, we need gcc not to read ./specs in order to build the g++
|
||||
# compiler (after the specs for the cross-gcc are created). Having
|
||||
# LIBRARY_PATH= makes gcc read the specs from ., and the build breaks.
|
||||
|
||||
CPATH = optionals (targetPlatform == hostPlatform) (makeSearchPathOutput "dev" "include" ([]
|
||||
++ optional (zlib != null) zlib
|
||||
));
|
||||
|
||||
LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath (optional (zlib != null) zlib));
|
||||
|
||||
inherit (callFile ../common/extra-target-flags.nix { })
|
||||
EXTRA_FLAGS_FOR_TARGET
|
||||
EXTRA_LDFLAGS_FOR_TARGET
|
||||
;
|
||||
|
||||
passthru = {
|
||||
inherit langC langCC langObjC langObjCpp langAda langFortran langGo langD version;
|
||||
isGNU = true;
|
||||
hardeningUnsupportedFlags = [ "fortify3" ];
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
inherit enableShared enableMultilib;
|
||||
|
||||
meta = {
|
||||
inherit (callFile ../common/meta.nix { })
|
||||
homepage
|
||||
license
|
||||
description
|
||||
longDescription
|
||||
platforms
|
||||
maintainers
|
||||
;
|
||||
};
|
||||
}
|
||||
|
||||
// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
|
||||
))
|
||||
[
|
||||
(callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc enableShared; })
|
||||
(callPackage ../common/checksum.nix { inherit langC langCC; })
|
||||
]
|
@ -1,357 +0,0 @@
|
||||
{ lib, 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
|
||||
, reproducibleBuild ? true
|
||||
, profiledCompiler ? false
|
||||
, langJit ? false
|
||||
, staticCompiler ? false
|
||||
, enableShared ? stdenv.targetPlatform.hasSharedLibraries
|
||||
, enableLTO ? stdenv.hostPlatform.hasSharedLibraries
|
||||
, texinfo ? null
|
||||
, perl ? null # optional, for texi2pod (then pod2man)
|
||||
, gmp, mpfr, libmpc, gettext, which, patchelf, binutils
|
||||
, isl ? null # optional, for the Graphite optimization framework.
|
||||
, zlib ? null
|
||||
, libucontext ? null
|
||||
, gnat-bootstrap ? null
|
||||
, enableMultilib ? false
|
||||
, enablePlugin ? stdenv.hostPlatform == stdenv.buildPlatform # Whether to support user-supplied plug-ins
|
||||
, name ? "gcc"
|
||||
, libcCross ? null
|
||||
, threadsCross ? null # for MinGW
|
||||
, withoutTargetLibc ? false
|
||||
, gnused ? null
|
||||
, cloog # unused; just for compat with gcc4, as we override the parameter on some places
|
||||
, buildPackages
|
||||
, libxcrypt
|
||||
, disableGdbPlugin ? !enablePlugin
|
||||
, nukeReferences
|
||||
, callPackage
|
||||
}:
|
||||
|
||||
# Make sure we get GNU sed.
|
||||
assert stdenv.buildPlatform.isDarwin -> gnused != null;
|
||||
|
||||
# The go frontend is written in c++
|
||||
assert langGo -> langCC;
|
||||
assert langAda -> gnat-bootstrap != null;
|
||||
|
||||
# TODO: fixup D bootstapping, probably by using gdc11 (and maybe other changes).
|
||||
# error: GDC is required to build d
|
||||
assert !langD;
|
||||
|
||||
# threadsCross is just for MinGW
|
||||
assert threadsCross != {} -> stdenv.targetPlatform.isWindows;
|
||||
|
||||
# profiledCompiler builds inject non-determinism in one of the compilation stages.
|
||||
# If turned on, we can't provide reproducible builds anymore
|
||||
assert reproducibleBuild -> profiledCompiler == false;
|
||||
|
||||
with lib;
|
||||
with builtins;
|
||||
|
||||
let majorVersion = "12";
|
||||
version = "${majorVersion}.3.0";
|
||||
disableBootstrap = !stdenv.hostPlatform.isDarwin && !profiledCompiler;
|
||||
|
||||
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
|
||||
|
||||
patches =
|
||||
optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
|
||||
++ optional noSysDirs ../gcc-12-no-sys-dirs.patch
|
||||
++ optional noSysDirs ../no-sys-dirs-riscv.patch
|
||||
++ [
|
||||
../gnat-cflags-11.patch
|
||||
../gcc-12-gfortran-driving.patch
|
||||
../ppc-musl.patch
|
||||
|
||||
# backport ICE fix on ccache code
|
||||
./lambda-ICE-PR109241.patch
|
||||
]
|
||||
# We only apply this patch when building a native toolchain for aarch64-darwin, as it breaks building
|
||||
# a foreign one: https://github.com/iains/gcc-12-branch/issues/18
|
||||
++ optionals (stdenv.isDarwin && stdenv.isAarch64 && buildPlatform == hostPlatform && hostPlatform == targetPlatform) [
|
||||
(fetchurl {
|
||||
name = "gcc-12-darwin-aarch64-support.patch";
|
||||
url = "https://raw.githubusercontent.com/Homebrew/formula-patches/f1188b90d610e2ed170b22512ff7435ba5c891e2/gcc/gcc-12.3.0.diff";
|
||||
sha256 = "sha256-naL5ZNiurqfDBiPSU8PTbTmLqj25B+vjjiqc4fAFgYs=";
|
||||
})
|
||||
] ++ optional langD ../libphobos.patch
|
||||
|
||||
# backport fixes to build gccgo with musl libc
|
||||
++ optionals (langGo && stdenv.hostPlatform.isMusl) [
|
||||
(fetchpatch {
|
||||
excludes = [ "gcc/go/gofrontend/MERGE" ];
|
||||
url = "https://github.com/gcc-mirror/gcc/commit/cf79b1117bd177d3d4c6ed24b6fa243c3628ac2d.diff";
|
||||
hash = "sha256-mS5ZiYi5D8CpGXrWg3tXlbhp4o86ew1imCTwaHLfl+I=";
|
||||
})
|
||||
(fetchpatch {
|
||||
excludes = [ "gcc/go/gofrontend/MERGE" ];
|
||||
url = "https://github.com/gcc-mirror/gcc/commit/7f195a2270910a6ed08bd76e3a16b0a6503f9faf.diff";
|
||||
hash = "sha256-Ze/cFM0dQofKH00PWPDoklXUlwWhwA1nyTuiDAZ6FKo=";
|
||||
})
|
||||
(fetchpatch {
|
||||
excludes = [ "gcc/go/gofrontend/MERGE" ];
|
||||
url = "https://github.com/gcc-mirror/gcc/commit/762fd5e5547e464e25b4bee435db6df4eda0de90.diff";
|
||||
hash = "sha256-o28upwTcHAnHG2Iq0OewzwSBEhHs+XpBGdIfZdT81pk=";
|
||||
})
|
||||
(fetchpatch {
|
||||
excludes = [ "gcc/go/gofrontend/MERGE" ];
|
||||
url = "https://github.com/gcc-mirror/gcc/commit/e73d9fcafbd07bc3714fbaf8a82db71d50015c92.diff";
|
||||
hash = "sha256-1SjYCVHLEUihdON2TOC3Z2ufM+jf2vH0LvYtZL+c1Fo=";
|
||||
})
|
||||
(fetchpatch {
|
||||
excludes = [ "gcc/go/gofrontend/MERGE" ];
|
||||
url = "https://github.com/gcc-mirror/gcc/commit/b6c6a3d64f2e4e9347733290aca3c75898c44b2e.diff";
|
||||
hash = "sha256-RycJ3YCHd3MXtYFjxP0zY2Wuw7/C4bWoBAQtTKJZPOQ=";
|
||||
})
|
||||
(fetchpatch {
|
||||
excludes = [ "gcc/go/gofrontend/MERGE" ];
|
||||
url = "https://github.com/gcc-mirror/gcc/commit/2b1a604a9b28fbf4f382060bebd04adb83acc2f9.diff";
|
||||
hash = "sha256-WiBQG0Xbk75rHk+AMDvsbrm+dc7lDH0EONJXSdEeMGE=";
|
||||
})
|
||||
(fetchpatch {
|
||||
url = "https://github.com/gcc-mirror/gcc/commit/c86b726c048eddc1be320c0bf64a897658bee13d.diff";
|
||||
hash = "sha256-QSIlqDB6JRQhbj/c3ejlmbfWz9l9FurdSWxpwDebnlI=";
|
||||
})
|
||||
]
|
||||
|
||||
# Fix detection of bootstrap compiler Ada support (cctools as) on Nix Darwin
|
||||
++ optional (stdenv.isDarwin && langAda) ../ada-cctools-as-detection-configure.patch
|
||||
|
||||
# Use absolute path in GNAT dylib install names on Darwin
|
||||
++ optional (stdenv.isDarwin && langAda) ../gnat-darwin-dylib-install-name.patch
|
||||
|
||||
# Obtain latest patch with ../update-mcfgthread-patches.sh
|
||||
++ optional (!withoutTargetLibc && targetPlatform.isMinGW && threadsCross.model == "mcf") ./Added-mcf-thread-model-support-from-mcfgthread.patch;
|
||||
|
||||
/* Cross-gcc settings (build == host != target) */
|
||||
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
|
||||
stageNameAddon = if withoutTargetLibc 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 gcc12.cc.override)" | jq '.[]' --raw-output'
|
||||
inherit
|
||||
binutils
|
||||
buildPackages
|
||||
cloog
|
||||
withoutTargetLibc
|
||||
disableBootstrap
|
||||
disableGdbPlugin
|
||||
enableLTO
|
||||
enableMultilib
|
||||
enablePlugin
|
||||
enableShared
|
||||
fetchpatch
|
||||
fetchurl
|
||||
gettext
|
||||
gmp
|
||||
gnat-bootstrap
|
||||
gnused
|
||||
isl
|
||||
langAda
|
||||
langC
|
||||
langCC
|
||||
langD
|
||||
langFortran
|
||||
langGo
|
||||
langJit
|
||||
langObjC
|
||||
langObjCpp
|
||||
lib
|
||||
libcCross
|
||||
libmpc
|
||||
libucontext
|
||||
libxcrypt
|
||||
mpfr
|
||||
name
|
||||
noSysDirs
|
||||
nukeReferences
|
||||
patchelf
|
||||
perl
|
||||
profiledCompiler
|
||||
reproducibleBuild
|
||||
staticCompiler
|
||||
stdenv
|
||||
targetPackages
|
||||
texinfo
|
||||
threadsCross
|
||||
which
|
||||
zip
|
||||
zlib
|
||||
;
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
lib.pipe ((callFile ../common/builder.nix {}) ({
|
||||
pname = "${crossNameAddon}${name}";
|
||||
inherit version;
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://gcc/releases/gcc-${version}/gcc-${version}.tar.xz";
|
||||
sha256 = "sha256-lJpdT5nnhkIak7Uysi/6tVeN5zITaZdbka7Jet/ajDs=";
|
||||
};
|
||||
|
||||
inherit patches;
|
||||
|
||||
outputs = [ "out" "man" "info" ] ++ lib.optional (!langJit) "lib";
|
||||
setOutputFlags = false;
|
||||
NIX_NO_SELF_RPATH = true;
|
||||
|
||||
libc_dev = stdenv.cc.libc_dev;
|
||||
|
||||
hardeningDisable = [ "format" "pie" ];
|
||||
|
||||
postPatch = ''
|
||||
configureScripts=$(find . -name configure)
|
||||
for configureScript in $configureScripts; do
|
||||
patchShebangs $configureScript
|
||||
done
|
||||
''
|
||||
# This should kill all the stdinc frameworks that gcc and friends like to
|
||||
# insert into default search paths.
|
||||
+ lib.optionalString hostPlatform.isDarwin ''
|
||||
substituteInPlace gcc/config/darwin-c.cc \
|
||||
--replace 'if (stdinc)' 'if (0)'
|
||||
|
||||
substituteInPlace libgcc/config/t-slibgcc-darwin \
|
||||
--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 ''${!outputLib}/lib/\\\$soname"
|
||||
''
|
||||
+ (
|
||||
lib.optionalString (targetPlatform != hostPlatform || stdenv.cc.libc != null)
|
||||
# On NixOS, use the right path to the dynamic linker instead of
|
||||
# `/lib/ld*.so'.
|
||||
(let
|
||||
libc = if libcCross != null then libcCross else stdenv.cc.libc;
|
||||
in
|
||||
(
|
||||
'' echo "fixing the \`GLIBC_DYNAMIC_LINKER', \`UCLIBC_DYNAMIC_LINKER', and \`MUSL_DYNAMIC_LINKER' macros..."
|
||||
for header in "gcc/config/"*-gnu.h "gcc/config/"*"/"*.h
|
||||
do
|
||||
grep -q _DYNAMIC_LINKER "$header" || continue
|
||||
echo " fixing \`$header'..."
|
||||
sed -i "$header" \
|
||||
-e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc.out}\3"|g' \
|
||||
-e 's|define[[:blank:]]*MUSL_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define MUSL_DYNAMIC_LINKER\1 "${libc.out}\2"|g'
|
||||
done
|
||||
''
|
||||
+ lib.optionalString (targetPlatform.libc == "musl")
|
||||
''
|
||||
sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR'
|
||||
''
|
||||
)
|
||||
))
|
||||
+ lib.optionalString targetPlatform.isAvr ''
|
||||
makeFlagsArray+=(
|
||||
'-s' # workaround for hitting hydra log limit
|
||||
'LIMITS_H_TEST=false'
|
||||
)
|
||||
'';
|
||||
|
||||
inherit noSysDirs staticCompiler withoutTargetLibc
|
||||
libcCross crossMingw;
|
||||
|
||||
inherit (callFile ../common/dependencies.nix { }) depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget;
|
||||
|
||||
NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm";
|
||||
|
||||
|
||||
preConfigure = (callFile ../common/pre-configure.nix { }) + ''
|
||||
ln -sf ${libxcrypt}/include/crypt.h libsanitizer/sanitizer_common/crypt.h
|
||||
'';
|
||||
|
||||
dontDisableStatic = true;
|
||||
|
||||
configurePlatforms = [ "build" "host" "target" ];
|
||||
|
||||
configureFlags = callFile ../common/configure-flags.nix { };
|
||||
|
||||
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
|
||||
|
||||
buildFlags =
|
||||
# we do not yet have Nix-driven profiling
|
||||
assert profiledCompiler -> !disableBootstrap;
|
||||
let target =
|
||||
lib.optionalString (profiledCompiler) "profiled" +
|
||||
lib.optionalString (targetPlatform == hostPlatform && hostPlatform == buildPlatform && !disableBootstrap) "bootstrap";
|
||||
in lib.optional (target != "") target;
|
||||
|
||||
# https://gcc.gnu.org/PR109898
|
||||
enableParallelInstalling = false;
|
||||
|
||||
inherit (callFile ../common/strip-attributes.nix { })
|
||||
stripDebugList
|
||||
stripDebugListTarget
|
||||
preFixup;
|
||||
|
||||
# https://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
|
||||
${if hostPlatform.system == "x86_64-solaris" then "CC" else null} = "gcc -m64";
|
||||
|
||||
# Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the
|
||||
# library headers and binaries, regarless of the language being compiled.
|
||||
#
|
||||
# Likewise, the LTO code doesn't find zlib.
|
||||
#
|
||||
# Cross-compiling, we need gcc not to read ./specs in order to build the g++
|
||||
# compiler (after the specs for the cross-gcc are created). Having
|
||||
# LIBRARY_PATH= makes gcc read the specs from ., and the build breaks.
|
||||
|
||||
CPATH = optionals (targetPlatform == hostPlatform) (makeSearchPathOutput "dev" "include" ([]
|
||||
++ optional (zlib != null) zlib
|
||||
));
|
||||
|
||||
LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath (optional (zlib != null) zlib));
|
||||
|
||||
inherit (callFile ../common/extra-target-flags.nix { })
|
||||
EXTRA_FLAGS_FOR_TARGET
|
||||
EXTRA_LDFLAGS_FOR_TARGET
|
||||
;
|
||||
|
||||
passthru = {
|
||||
inherit langC langCC langObjC langObjCpp langAda langFortran langGo langD version;
|
||||
isGNU = true;
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
inherit enableShared enableMultilib;
|
||||
|
||||
meta = {
|
||||
inherit (callFile ../common/meta.nix { })
|
||||
homepage
|
||||
license
|
||||
description
|
||||
longDescription
|
||||
platforms
|
||||
maintainers
|
||||
;
|
||||
};
|
||||
}
|
||||
|
||||
// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
|
||||
))
|
||||
[
|
||||
(callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc enableShared; })
|
||||
(callPackage ../common/checksum.nix { inherit langC langCC; })
|
||||
]
|
||||
|
@ -1,351 +0,0 @@
|
||||
{ lib, 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
|
||||
, reproducibleBuild ? true
|
||||
, profiledCompiler ? false
|
||||
, langJit ? false
|
||||
, staticCompiler ? false
|
||||
, enableShared ? stdenv.targetPlatform.hasSharedLibraries
|
||||
, enableLTO ? stdenv.hostPlatform.hasSharedLibraries
|
||||
, texinfo ? null
|
||||
, perl ? null # optional, for texi2pod (then pod2man)
|
||||
, gmp, mpfr, libmpc, gettext, which, patchelf, binutils
|
||||
, isl ? null # optional, for the Graphite optimization framework.
|
||||
, zlib ? null
|
||||
, libucontext ? null
|
||||
, gnat-bootstrap ? null
|
||||
, enableMultilib ? false
|
||||
, enablePlugin ? stdenv.hostPlatform == stdenv.buildPlatform # Whether to support user-supplied plug-ins
|
||||
, name ? "gcc"
|
||||
, libcCross ? null
|
||||
, threadsCross ? null # for MinGW
|
||||
, withoutTargetLibc ? false
|
||||
, gnused ? null
|
||||
, cloog # unused; just for compat with gcc4, as we override the parameter on some places
|
||||
, buildPackages
|
||||
, libxcrypt
|
||||
, disableGdbPlugin ? !enablePlugin
|
||||
, nukeReferences
|
||||
, callPackage
|
||||
}:
|
||||
|
||||
# Make sure we get GNU sed.
|
||||
assert stdenv.buildPlatform.isDarwin -> gnused != null;
|
||||
|
||||
# The go frontend is written in c++
|
||||
assert langGo -> langCC;
|
||||
assert langAda -> gnat-bootstrap != null;
|
||||
|
||||
# TODO: fixup D bootstapping, probably by using gdc11 (and maybe other changes).
|
||||
# error: GDC is required to build d
|
||||
assert !langD;
|
||||
|
||||
# threadsCross is just for MinGW
|
||||
assert threadsCross != {} -> stdenv.targetPlatform.isWindows;
|
||||
|
||||
# profiledCompiler builds inject non-determinism in one of the compilation stages.
|
||||
# If turned on, we can't provide reproducible builds anymore
|
||||
assert reproducibleBuild -> profiledCompiler == false;
|
||||
|
||||
with lib;
|
||||
with builtins;
|
||||
|
||||
let majorVersion = "13";
|
||||
version = "${majorVersion}.2.0";
|
||||
disableBootstrap = !stdenv.hostPlatform.isDarwin && !profiledCompiler;
|
||||
|
||||
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
|
||||
|
||||
patches =
|
||||
optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
|
||||
++ optional noSysDirs ../gcc-12-no-sys-dirs.patch
|
||||
++ optional noSysDirs ./no-sys-dirs-riscv.patch
|
||||
++ [
|
||||
../gnat-cflags-11.patch
|
||||
../gcc-12-gfortran-driving.patch
|
||||
../ppc-musl.patch
|
||||
]
|
||||
# We only apply this patch when building a native toolchain for aarch64-darwin, as it breaks building
|
||||
# a foreign one: https://github.com/iains/gcc-12-branch/issues/18
|
||||
++ optional (stdenv.isDarwin && stdenv.isAarch64 && buildPlatform == hostPlatform && hostPlatform == targetPlatform) (fetchpatch {
|
||||
name = "gcc-13-darwin-aarch64-support.patch";
|
||||
url = "https://raw.githubusercontent.com/Homebrew/formula-patches/3c5cbc8e9cf444a1967786af48e430588e1eb481/gcc/gcc-13.2.0.diff";
|
||||
sha256 = "sha256-Y5r3U3dwAFG6+b0TNCFd18PNxYu2+W/5zDbZ5cHvv+U=";
|
||||
})
|
||||
++ optional langD ../libphobos.patch
|
||||
|
||||
# backport fixes to build gccgo with musl libc
|
||||
++ optionals (langGo && stdenv.hostPlatform.isMusl) [
|
||||
(fetchpatch {
|
||||
excludes = [ "gcc/go/gofrontend/MERGE" ];
|
||||
url = "https://github.com/gcc-mirror/gcc/commit/cf79b1117bd177d3d4c6ed24b6fa243c3628ac2d.diff";
|
||||
hash = "sha256-mS5ZiYi5D8CpGXrWg3tXlbhp4o86ew1imCTwaHLfl+I=";
|
||||
})
|
||||
(fetchpatch {
|
||||
excludes = [ "gcc/go/gofrontend/MERGE" ];
|
||||
url = "https://github.com/gcc-mirror/gcc/commit/7f195a2270910a6ed08bd76e3a16b0a6503f9faf.diff";
|
||||
hash = "sha256-Ze/cFM0dQofKH00PWPDoklXUlwWhwA1nyTuiDAZ6FKo=";
|
||||
})
|
||||
(fetchpatch {
|
||||
excludes = [ "gcc/go/gofrontend/MERGE" ];
|
||||
url = "https://github.com/gcc-mirror/gcc/commit/762fd5e5547e464e25b4bee435db6df4eda0de90.diff";
|
||||
hash = "sha256-o28upwTcHAnHG2Iq0OewzwSBEhHs+XpBGdIfZdT81pk=";
|
||||
})
|
||||
(fetchpatch {
|
||||
excludes = [ "gcc/go/gofrontend/MERGE" ];
|
||||
url = "https://github.com/gcc-mirror/gcc/commit/e73d9fcafbd07bc3714fbaf8a82db71d50015c92.diff";
|
||||
hash = "sha256-1SjYCVHLEUihdON2TOC3Z2ufM+jf2vH0LvYtZL+c1Fo=";
|
||||
})
|
||||
(fetchpatch {
|
||||
excludes = [ "gcc/go/gofrontend/MERGE" ];
|
||||
url = "https://github.com/gcc-mirror/gcc/commit/b6c6a3d64f2e4e9347733290aca3c75898c44b2e.diff";
|
||||
hash = "sha256-RycJ3YCHd3MXtYFjxP0zY2Wuw7/C4bWoBAQtTKJZPOQ=";
|
||||
})
|
||||
(fetchpatch {
|
||||
excludes = [ "gcc/go/gofrontend/MERGE" ];
|
||||
url = "https://github.com/gcc-mirror/gcc/commit/2b1a604a9b28fbf4f382060bebd04adb83acc2f9.diff";
|
||||
hash = "sha256-WiBQG0Xbk75rHk+AMDvsbrm+dc7lDH0EONJXSdEeMGE=";
|
||||
})
|
||||
(fetchpatch {
|
||||
url = "https://github.com/gcc-mirror/gcc/commit/c86b726c048eddc1be320c0bf64a897658bee13d.diff";
|
||||
hash = "sha256-QSIlqDB6JRQhbj/c3ejlmbfWz9l9FurdSWxpwDebnlI=";
|
||||
})
|
||||
]
|
||||
|
||||
# Fix detection of bootstrap compiler Ada support (cctools as) on Nix Darwin
|
||||
++ optional (stdenv.isDarwin && langAda) ../ada-cctools-as-detection-configure.patch
|
||||
|
||||
# Use absolute path in GNAT dylib install names on Darwin
|
||||
++ optional (stdenv.isDarwin && langAda) ../gnat-darwin-dylib-install-name.patch
|
||||
;
|
||||
|
||||
/* Cross-gcc settings (build == host != target) */
|
||||
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
|
||||
stageNameAddon = if withoutTargetLibc 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 gcc13.cc.override)" | jq '.[]' --raw-output'
|
||||
inherit
|
||||
binutils
|
||||
buildPackages
|
||||
cloog
|
||||
withoutTargetLibc
|
||||
disableBootstrap
|
||||
disableGdbPlugin
|
||||
enableLTO
|
||||
enableMultilib
|
||||
enablePlugin
|
||||
enableShared
|
||||
fetchpatch
|
||||
fetchurl
|
||||
gettext
|
||||
gmp
|
||||
gnat-bootstrap
|
||||
gnused
|
||||
isl
|
||||
langAda
|
||||
langC
|
||||
langCC
|
||||
langD
|
||||
langFortran
|
||||
langGo
|
||||
langJit
|
||||
langObjC
|
||||
langObjCpp
|
||||
lib
|
||||
libcCross
|
||||
libmpc
|
||||
libucontext
|
||||
libxcrypt
|
||||
mpfr
|
||||
name
|
||||
noSysDirs
|
||||
nukeReferences
|
||||
patchelf
|
||||
perl
|
||||
profiledCompiler
|
||||
reproducibleBuild
|
||||
staticCompiler
|
||||
stdenv
|
||||
targetPackages
|
||||
texinfo
|
||||
threadsCross
|
||||
which
|
||||
zip
|
||||
zlib
|
||||
;
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
lib.pipe ((callFile ../common/builder.nix {}) ({
|
||||
pname = "${crossNameAddon}${name}";
|
||||
inherit version;
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://gcc/releases/gcc-${version}/gcc-${version}.tar.xz";
|
||||
hash = "sha256-4nXnZEKmBnNBon8Exca4PYYTFEAEwEE1KIY9xrXHQ9o=";
|
||||
};
|
||||
|
||||
inherit patches;
|
||||
|
||||
outputs = [ "out" "man" "info" ] ++ lib.optional (!langJit) "lib";
|
||||
setOutputFlags = false;
|
||||
NIX_NO_SELF_RPATH = true;
|
||||
|
||||
libc_dev = stdenv.cc.libc_dev;
|
||||
|
||||
hardeningDisable = [ "format" "pie" ];
|
||||
|
||||
postPatch = ''
|
||||
configureScripts=$(find . -name configure)
|
||||
for configureScript in $configureScripts; do
|
||||
patchShebangs $configureScript
|
||||
done
|
||||
''
|
||||
# This should kill all the stdinc frameworks that gcc and friends like to
|
||||
# insert into default search paths.
|
||||
+ lib.optionalString hostPlatform.isDarwin ''
|
||||
substituteInPlace gcc/config/darwin-c.cc \
|
||||
--replace 'if (stdinc)' 'if (0)'
|
||||
|
||||
substituteInPlace libgcc/config/t-slibgcc-darwin \
|
||||
--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 ''${!outputLib}/lib/\\\$soname"
|
||||
''
|
||||
+ (
|
||||
lib.optionalString (targetPlatform != hostPlatform || stdenv.cc.libc != null)
|
||||
# On NixOS, use the right path to the dynamic linker instead of
|
||||
# `/lib/ld*.so'.
|
||||
(let
|
||||
libc = if libcCross != null then libcCross else stdenv.cc.libc;
|
||||
in
|
||||
(
|
||||
'' echo "fixing the \`GLIBC_DYNAMIC_LINKER', \`UCLIBC_DYNAMIC_LINKER', and \`MUSL_DYNAMIC_LINKER' macros..."
|
||||
for header in "gcc/config/"*-gnu.h "gcc/config/"*"/"*.h
|
||||
do
|
||||
grep -q _DYNAMIC_LINKER "$header" || continue
|
||||
echo " fixing \`$header'..."
|
||||
sed -i "$header" \
|
||||
-e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc.out}\3"|g' \
|
||||
-e 's|define[[:blank:]]*MUSL_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define MUSL_DYNAMIC_LINKER\1 "${libc.out}\2"|g'
|
||||
done
|
||||
''
|
||||
+ lib.optionalString (targetPlatform.libc == "musl")
|
||||
''
|
||||
sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR'
|
||||
''
|
||||
)
|
||||
))
|
||||
+ lib.optionalString targetPlatform.isAvr ''
|
||||
makeFlagsArray+=(
|
||||
'-s' # workaround for hitting hydra log limit
|
||||
'LIMITS_H_TEST=false'
|
||||
)
|
||||
'';
|
||||
|
||||
inherit noSysDirs staticCompiler withoutTargetLibc
|
||||
libcCross crossMingw;
|
||||
|
||||
inherit (callFile ../common/dependencies.nix { }) depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget;
|
||||
|
||||
NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm";
|
||||
|
||||
|
||||
preConfigure = (callFile ../common/pre-configure.nix { }) + ''
|
||||
ln -sf ${libxcrypt}/include/crypt.h libsanitizer/sanitizer_common/crypt.h
|
||||
'';
|
||||
|
||||
dontDisableStatic = true;
|
||||
|
||||
configurePlatforms = [ "build" "host" "target" ];
|
||||
|
||||
configureFlags = callFile ../common/configure-flags.nix { };
|
||||
|
||||
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
|
||||
|
||||
buildFlags =
|
||||
# we do not yet have Nix-driven profiling
|
||||
assert profiledCompiler -> !disableBootstrap;
|
||||
let target =
|
||||
lib.optionalString (profiledCompiler) "profiled" +
|
||||
lib.optionalString (targetPlatform == hostPlatform && hostPlatform == buildPlatform && !disableBootstrap) "bootstrap";
|
||||
in lib.optional (target != "") target;
|
||||
|
||||
inherit (callFile ../common/strip-attributes.nix { })
|
||||
stripDebugList
|
||||
stripDebugListTarget
|
||||
preFixup;
|
||||
|
||||
# https://gcc.gnu.org/PR109898
|
||||
enableParallelInstalling = false;
|
||||
|
||||
# https://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
|
||||
${if hostPlatform.system == "x86_64-solaris" then "CC" else null} = "gcc -m64";
|
||||
|
||||
# Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the
|
||||
# library headers and binaries, regarless of the language being compiled.
|
||||
#
|
||||
# Likewise, the LTO code doesn't find zlib.
|
||||
#
|
||||
# Cross-compiling, we need gcc not to read ./specs in order to build the g++
|
||||
# compiler (after the specs for the cross-gcc are created). Having
|
||||
# LIBRARY_PATH= makes gcc read the specs from ., and the build breaks.
|
||||
|
||||
CPATH = optionals (targetPlatform == hostPlatform) (makeSearchPathOutput "dev" "include" ([]
|
||||
++ optional (zlib != null) zlib
|
||||
));
|
||||
|
||||
LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath (optional (zlib != null) zlib));
|
||||
|
||||
inherit (callFile ../common/extra-target-flags.nix { })
|
||||
EXTRA_FLAGS_FOR_TARGET
|
||||
EXTRA_LDFLAGS_FOR_TARGET
|
||||
;
|
||||
|
||||
passthru = {
|
||||
inherit langC langCC langObjC langObjCpp langAda langFortran langGo langD version;
|
||||
isGNU = true;
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
inherit enableShared enableMultilib;
|
||||
|
||||
meta = {
|
||||
inherit (callFile ../common/meta.nix { })
|
||||
homepage
|
||||
license
|
||||
description
|
||||
longDescription
|
||||
platforms
|
||||
maintainers
|
||||
;
|
||||
};
|
||||
}
|
||||
|
||||
// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
|
||||
))
|
||||
[
|
||||
(callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc enableShared; })
|
||||
(callPackage ../common/checksum.nix { inherit langC langCC; })
|
||||
]
|
||||
|
@ -1,325 +0,0 @@
|
||||
{ lib, stdenv, targetPackages, fetchurl, fetchpatch, noSysDirs
|
||||
, langC ? true, langCC ? true, langFortran ? false
|
||||
, langObjC ? stdenv.targetPlatform.isDarwin
|
||||
, langObjCpp ? stdenv.targetPlatform.isDarwin
|
||||
, langJava ? false
|
||||
, langGo ? false
|
||||
, reproducibleBuild ? true
|
||||
, profiledCompiler ? false
|
||||
, langJit ? false
|
||||
, staticCompiler ? false
|
||||
, enableShared ? stdenv.targetPlatform.hasSharedLibraries
|
||||
, enableLTO ? stdenv.hostPlatform.hasSharedLibraries
|
||||
, texinfo ? null
|
||||
, perl ? null # optional, for texi2pod (then pod2man); required for Java
|
||||
, gmp, mpfr, libmpc, gettext, which, patchelf, binutils
|
||||
, cloog ? null, isl ? null # optional, for the Graphite optimization framework.
|
||||
, zlib ? null, boehmgc ? null
|
||||
, zip ? null, unzip ? null, pkg-config ? null
|
||||
, gtk2 ? null, libart_lgpl ? null
|
||||
, libX11 ? null, libXt ? null, libSM ? null, libICE ? null, libXtst ? null
|
||||
, libXrender ? null, xorgproto ? null
|
||||
, libXrandr ? null, libXi ? null
|
||||
, x11Support ? langJava
|
||||
, enableMultilib ? false
|
||||
, enablePlugin ? stdenv.hostPlatform == stdenv.buildPlatform # Whether to support user-supplied plug-ins
|
||||
, name ? "gcc"
|
||||
, libcCross ? null
|
||||
, threadsCross ? null # for MinGW
|
||||
, withoutTargetLibc ? false
|
||||
, gnused ? null
|
||||
, buildPackages
|
||||
, callPackage
|
||||
}:
|
||||
|
||||
assert langJava -> zip != null && unzip != null
|
||||
&& zlib != null && boehmgc != null
|
||||
&& perl != null; # for `--enable-java-home'
|
||||
|
||||
# We enable the isl cloog backend.
|
||||
assert cloog != null -> isl != null;
|
||||
|
||||
# Make sure we get GNU sed.
|
||||
assert stdenv.buildPlatform.isDarwin -> gnused != null;
|
||||
|
||||
# The go frontend is written in c++
|
||||
assert langGo -> langCC;
|
||||
|
||||
# threadsCross is just for MinGW
|
||||
assert threadsCross != {} -> stdenv.targetPlatform.isWindows;
|
||||
|
||||
# profiledCompiler builds inject non-determinism in one of the compilation stages.
|
||||
# If turned on, we can't provide reproducible builds anymore
|
||||
assert reproducibleBuild -> profiledCompiler == false;
|
||||
|
||||
with lib;
|
||||
with builtins;
|
||||
|
||||
let majorVersion = "4";
|
||||
version = "${majorVersion}.8.5";
|
||||
|
||||
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
|
||||
|
||||
patches = [ ../parallel-bconfig.patch ]
|
||||
++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
|
||||
++ optional noSysDirs ../no-sys-dirs.patch
|
||||
++ optional langFortran ../gfortran-driving.patch
|
||||
++ optional hostPlatform.isDarwin ../gfortran-darwin-NXConstStr.patch
|
||||
++ [(fetchpatch {
|
||||
name = "libc_name_p.diff"; # needed to build with gcc6
|
||||
url = "https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=ec1cc0263f1";
|
||||
sha256 = "01jd7pdarh54ki498g6sz64ijl9a1l5f9v8q2696aaxalvh2vwzl";
|
||||
excludes = [ "gcc/cp/ChangeLog" ];
|
||||
})]
|
||||
++ [ # glibc-2.26
|
||||
../struct-ucontext-4.8.patch
|
||||
../sigsegv-not-declared.patch
|
||||
../res_state-not-declared.patch
|
||||
# gcc-11 compatibility
|
||||
(fetchpatch {
|
||||
name = "gcc4-char-reload.patch";
|
||||
url = "https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=d57c99458933a21fdf94f508191f145ad8d5ec58";
|
||||
includes = [ "gcc/reload.h" ];
|
||||
sha256 = "sha256-66AMP7/ajunGKAN5WJz/yPn42URZ2KN51yPrFdsxEuM=";
|
||||
})
|
||||
];
|
||||
|
||||
javaEcj = fetchurl {
|
||||
# The `$(top_srcdir)/ecj.jar' file is automatically picked up at
|
||||
# `configure' time.
|
||||
|
||||
# XXX: Eventually we might want to take it from upstream.
|
||||
url = "ftp://sourceware.org/pub/java/ecj-4.3.jar";
|
||||
sha256 = "0jz7hvc0s6iydmhgh5h2m15yza7p2rlss2vkif30vm9y77m97qcx";
|
||||
};
|
||||
|
||||
# Antlr (optional) allows the Java `gjdoc' tool to be built. We want a
|
||||
# binary distribution here to allow the whole chain to be bootstrapped.
|
||||
javaAntlr = fetchurl {
|
||||
url = "https://www.antlr.org/download/antlr-4.4-complete.jar";
|
||||
sha256 = "02lda2imivsvsis8rnzmbrbp8rh1kb8vmq4i67pqhkwz7lf8y6dz";
|
||||
};
|
||||
|
||||
xlibs = [
|
||||
libX11 libXt libSM libICE libXtst libXrender libXrandr libXi
|
||||
xorgproto
|
||||
];
|
||||
|
||||
javaAwtGtk = langJava && x11Support;
|
||||
|
||||
/* Cross-gcc settings (build == host != target) */
|
||||
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
|
||||
stageNameAddon = if withoutTargetLibc then "stage-static" else "stage-final";
|
||||
crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-";
|
||||
|
||||
callFile = lib.callPackageWith {
|
||||
# lets
|
||||
inherit
|
||||
majorVersion
|
||||
version
|
||||
buildPlatform
|
||||
hostPlatform
|
||||
targetPlatform
|
||||
patches
|
||||
javaEcj
|
||||
javaAntlr
|
||||
xlibs
|
||||
javaAwtGtk
|
||||
crossMingw
|
||||
stageNameAddon
|
||||
crossNameAddon
|
||||
;
|
||||
# inherit generated with 'nix eval --json --impure --expr "with import ./. {}; lib.attrNames (lib.functionArgs gcc48.cc.override)" | jq '.[]' --raw-output'
|
||||
inherit
|
||||
binutils
|
||||
boehmgc
|
||||
buildPackages
|
||||
cloog
|
||||
withoutTargetLibc
|
||||
enableLTO
|
||||
enableMultilib
|
||||
enablePlugin
|
||||
enableShared
|
||||
fetchpatch
|
||||
fetchurl
|
||||
gettext
|
||||
gmp
|
||||
gnused
|
||||
gtk2
|
||||
isl
|
||||
langC
|
||||
langCC
|
||||
langFortran
|
||||
langGo
|
||||
langJava
|
||||
langJit
|
||||
langObjC
|
||||
langObjCpp
|
||||
lib
|
||||
libICE
|
||||
libSM
|
||||
libX11
|
||||
libXi
|
||||
libXrandr
|
||||
libXrender
|
||||
libXt
|
||||
libXtst
|
||||
libart_lgpl
|
||||
libcCross threadsCross
|
||||
libmpc
|
||||
mpfr
|
||||
name
|
||||
noSysDirs
|
||||
patchelf
|
||||
perl
|
||||
pkg-config
|
||||
profiledCompiler
|
||||
reproducibleBuild
|
||||
staticCompiler
|
||||
stdenv
|
||||
targetPackages
|
||||
texinfo
|
||||
unzip
|
||||
which
|
||||
x11Support
|
||||
xorgproto
|
||||
zip
|
||||
zlib
|
||||
;
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
# We need all these X libraries when building AWT with GTK.
|
||||
assert x11Support -> (filter (x: x == null) ([ gtk2 libart_lgpl ] ++ xlibs)) == [];
|
||||
|
||||
lib.pipe ((callFile ../common/builder.nix {}) ({
|
||||
pname = "${crossNameAddon}${name}";
|
||||
inherit version;
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.bz2";
|
||||
sha256 = "08yggr18v373a1ihj0rg2vd6psnic42b518xcgp3r9k81xz1xyr2";
|
||||
};
|
||||
|
||||
inherit patches;
|
||||
|
||||
hardeningDisable = [ "format" "pie" ];
|
||||
|
||||
outputs = [ "out" "lib" "man" "info" ];
|
||||
setOutputFlags = false;
|
||||
NIX_NO_SELF_RPATH = true;
|
||||
|
||||
libc_dev = stdenv.cc.libc_dev;
|
||||
|
||||
postPatch =
|
||||
if targetPlatform != hostPlatform || stdenv.cc.libc != null then
|
||||
# On NixOS, use the right path to the dynamic linker instead of
|
||||
# `/lib/ld*.so'.
|
||||
let
|
||||
libc = if libcCross != null then libcCross else stdenv.cc.libc;
|
||||
in
|
||||
'' echo "fixing the \`GLIBC_DYNAMIC_LINKER' and \`UCLIBC_DYNAMIC_LINKER' macros..."
|
||||
for header in "gcc/config/"*-gnu.h "gcc/config/"*"/"*.h
|
||||
do
|
||||
grep -q LIBC_DYNAMIC_LINKER "$header" || continue
|
||||
echo " fixing \`$header'..."
|
||||
sed -i "$header" \
|
||||
-e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc.out}\3"|g'
|
||||
done
|
||||
''
|
||||
else null;
|
||||
|
||||
inherit noSysDirs staticCompiler langJava withoutTargetLibc
|
||||
libcCross crossMingw;
|
||||
|
||||
inherit (callFile ../common/dependencies.nix { })
|
||||
depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget;
|
||||
|
||||
preConfigure = callFile ../common/pre-configure.nix { };
|
||||
|
||||
dontDisableStatic = true;
|
||||
|
||||
configurePlatforms = [ "build" "host" "target" ];
|
||||
|
||||
configureFlags = callFile ../common/configure-flags.nix { };
|
||||
|
||||
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
|
||||
|
||||
buildFlags = optional
|
||||
(targetPlatform == hostPlatform && hostPlatform == buildPlatform)
|
||||
(if profiledCompiler then "profiledbootstrap" else "bootstrap");
|
||||
|
||||
inherit (callFile ../common/strip-attributes.nix { })
|
||||
stripDebugList
|
||||
stripDebugListTarget
|
||||
preFixup;
|
||||
|
||||
# https://gcc.gnu.org/PR109898
|
||||
enableParallelInstalling = false;
|
||||
|
||||
doCheck = false; # requires a lot of tools, causes a dependency cycle for stdenv
|
||||
|
||||
# https://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
|
||||
${if hostPlatform.system == "x86_64-solaris" then "CC" else null} = "gcc -m64";
|
||||
|
||||
# Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the
|
||||
# library headers and binaries, regarless of the language being compiled.
|
||||
#
|
||||
# Note: When building the Java AWT GTK peer, the build system doesn't honor
|
||||
# `--with-gmp' et al., e.g., when building
|
||||
# `libjava/classpath/native/jni/java-math/gnu_java_math_GMP.c', so we just add
|
||||
# them to $CPATH and $LIBRARY_PATH in this case.
|
||||
#
|
||||
# Likewise, the LTO code doesn't find zlib.
|
||||
#
|
||||
# Cross-compiling, we need gcc not to read ./specs in order to build the g++
|
||||
# compiler (after the specs for the cross-gcc are created). Having
|
||||
# LIBRARY_PATH= makes gcc read the specs from ., and the build breaks.
|
||||
|
||||
CPATH = optionals (targetPlatform == hostPlatform) (makeSearchPathOutput "dev" "include" ([]
|
||||
++ optional (zlib != null) zlib
|
||||
++ optional langJava boehmgc
|
||||
++ optionals javaAwtGtk xlibs
|
||||
++ optionals javaAwtGtk [ gmp mpfr ]
|
||||
));
|
||||
|
||||
LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath ([]
|
||||
++ optional (zlib != null) zlib
|
||||
++ optional langJava boehmgc
|
||||
++ optionals javaAwtGtk xlibs
|
||||
++ optionals javaAwtGtk [ gmp mpfr ]
|
||||
));
|
||||
|
||||
inherit (callFile ../common/extra-target-flags.nix { })
|
||||
EXTRA_FLAGS_FOR_TARGET
|
||||
EXTRA_LDFLAGS_FOR_TARGET
|
||||
;
|
||||
|
||||
passthru = {
|
||||
inherit langC langCC langObjC langObjCpp langFortran langGo version;
|
||||
isGNU = true;
|
||||
hardeningUnsupportedFlags = [ "stackprotector" "fortify3" ];
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
inherit enableShared enableMultilib;
|
||||
|
||||
meta = {
|
||||
inherit (callFile ../common/meta.nix { })
|
||||
homepage
|
||||
license
|
||||
description
|
||||
longDescription
|
||||
platforms
|
||||
maintainers
|
||||
;
|
||||
badPlatforms = lib.platforms.darwin;
|
||||
};
|
||||
}
|
||||
|
||||
// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
|
||||
))
|
||||
[
|
||||
(callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc enableShared; })
|
||||
]
|
@ -1,352 +0,0 @@
|
||||
{ lib, stdenv, targetPackages, fetchurl, fetchpatch, noSysDirs
|
||||
, langC ? true, langCC ? true, langFortran ? false
|
||||
, langObjC ? stdenv.targetPlatform.isDarwin
|
||||
, langObjCpp ? stdenv.targetPlatform.isDarwin
|
||||
, langJava ? false
|
||||
, langGo ? false
|
||||
, reproducibleBuild ? true
|
||||
, profiledCompiler ? false
|
||||
, langJit ? false
|
||||
, staticCompiler ? false
|
||||
, enableShared ? stdenv.targetPlatform.hasSharedLibraries
|
||||
, enableLTO ? stdenv.hostPlatform.hasSharedLibraries
|
||||
, texinfo ? null
|
||||
, perl ? null # optional, for texi2pod (then pod2man); required for Java
|
||||
, gmp, mpfr, libmpc, gettext, which, patchelf, binutils
|
||||
, cloog ? null, isl ? null # optional, for the Graphite optimization framework.
|
||||
, zlib ? null, boehmgc ? null
|
||||
, zip ? null, unzip ? null, pkg-config ? null
|
||||
, gtk2 ? null, libart_lgpl ? null
|
||||
, libX11 ? null, libXt ? null, libSM ? null, libICE ? null, libXtst ? null
|
||||
, libXrender ? null, xorgproto ? null
|
||||
, libXrandr ? null, libXi ? null
|
||||
, x11Support ? langJava
|
||||
, enableMultilib ? false
|
||||
, enablePlugin ? stdenv.hostPlatform == stdenv.buildPlatform # Whether to support user-supplied plug-ins
|
||||
, name ? "gcc"
|
||||
, libcCross ? null
|
||||
, threadsCross ? null # for MinGW
|
||||
, withoutTargetLibc ? false
|
||||
, gnused ? null
|
||||
, buildPackages
|
||||
, callPackage
|
||||
}:
|
||||
|
||||
assert langJava -> zip != null && unzip != null
|
||||
&& zlib != null && boehmgc != null
|
||||
&& perl != null; # for `--enable-java-home'
|
||||
|
||||
# We enable the isl cloog backend.
|
||||
assert cloog != null -> isl != null;
|
||||
|
||||
# Make sure we get GNU sed.
|
||||
assert stdenv.buildPlatform.isDarwin -> gnused != null;
|
||||
|
||||
# The go frontend is written in c++
|
||||
assert langGo -> langCC;
|
||||
|
||||
# threadsCross is just for MinGW
|
||||
assert threadsCross != {} -> stdenv.targetPlatform.isWindows;
|
||||
|
||||
# profiledCompiler builds inject non-determinism in one of the compilation stages.
|
||||
# If turned on, we can't provide reproducible builds anymore
|
||||
assert reproducibleBuild -> profiledCompiler == false;
|
||||
|
||||
with lib;
|
||||
with builtins;
|
||||
|
||||
let majorVersion = "4";
|
||||
version = "${majorVersion}.9.4";
|
||||
|
||||
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
|
||||
|
||||
patches =
|
||||
[ ../9/fix-struct-redefinition-on-glibc-2.36.patch ../use-source-date-epoch.patch
|
||||
../parallel-bconfig.patch ./parallel-strsignal.patch
|
||||
./libsanitizer.patch
|
||||
(fetchpatch {
|
||||
name = "avoid-ustat-glibc-2.28.patch";
|
||||
url = "https://gitweb.gentoo.org/proj/gcc-patches.git/plain/4.9.4/gentoo/100_all_avoid-ustat-glibc-2.28.patch?id=55fcb515620a8f7d3bb77eba938aa0fcf0d67c96";
|
||||
sha256 = "0b32sb4psv5lq0ij9fwhi1b4pjbwdjnv24nqprsk14dsc6xmi1g0";
|
||||
})
|
||||
]
|
||||
++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
|
||||
++ optional noSysDirs ../no-sys-dirs.patch
|
||||
++ optional langFortran ../gfortran-driving.patch
|
||||
++ [ ../struct-ucontext.patch ../struct-sigaltstack-4.9.patch ] # glibc-2.26
|
||||
# Retpoline patches pulled from the branch hjl/indirect/gcc-4_9-branch (by H.J. Lu, the author of GCC upstream retpoline commits)
|
||||
++ builtins.map ({commit, sha256}: fetchpatch {url = "https://github.com/hjl-tools/gcc/commit/${commit}.patch"; inherit sha256;})
|
||||
[{ commit = "e623d21608e96ecd6b65f0d06312117d20488a38"; sha256 = "1ix8i4d2r3ygbv7npmsdj790rhxqrnfwcqzv48b090r9c3ij8ay3"; }
|
||||
{ commit = "2015a09e332309f12de1dadfe179afa6a29368b8"; sha256 = "0xcfs0cbb63llj2gbcdrvxim79ax4k4aswn0a3yjavxsj71s1n91"; }
|
||||
{ commit = "6b11591f4494f705e8746e7d58b7f423191f4e92"; sha256 = "0aydyhsm2ig0khgbp27am7vq7liyqrq6kfhfi2ki0ij0ab1hfbga"; }
|
||||
{ commit = "203c7d9c3e9cb0f88816b481ef8e7e87b3ecc373"; sha256 = "0wqn16y7wy5kg8ngfcni5qdwfphl01axczibbk49bxclwnzvldqa"; }
|
||||
{ commit = "f039c6f284b2c9ce97c8353d6034978795c4872e"; sha256 = "13fkgdb17lpyxfksz1zanxhgpsm0jrss9w61nbl7an4im22hz7ci"; }
|
||||
{ commit = "ed42606bdab1c5d9e5ad828cd6fe1a0557f193b7"; sha256 = "0gdnn8v3p03imj3qga2mzdhpgbmjcklkxdl97jvz5xia2ikzknxm"; }
|
||||
{ commit = "5278e062ef292fd2fbf987d25389785f4c5c0f99"; sha256 = "0j81x758wf8v7j4rx5wc1cy7yhkvhlhv3wmnarwakxiwsspq0vrs"; }
|
||||
{ commit = "76f1ffbbb6cd9f6ecde6c82cd16e20a27242e890"; sha256 = "1py56y6gp7fjf4f8bbsfwh5bs1gnmlqda1ycsmnwlzfm0cshdp0c"; }
|
||||
{ commit = "4ca48b2b688b135c0390f54ea9077ef10aedd52c"; sha256 = "15r019pzr3k0lpgyvdc92c8fayw8b5lrzncna4bqmamcsdz7vsaw"; }
|
||||
{ commit = "98c7bf9ddc80db965d69d61521b1c7a1cec32d9a"; sha256 = "1d7pfdv1q23nf0wadw7jbp6d6r7pnzjpbyxgbdfv7j1vr9l1bp60"; }
|
||||
{ commit = "3dc76b53ad896494ca62550a7a752fecbca3f7a2"; sha256 = "0jvdzfpvfdmklfcjwqblwq1i22iqis7ljpvm7adra5d7zf2xk7xz"; }
|
||||
{ commit = "1e961ed49b18e176c7457f53df2433421387c23b"; sha256 = "04dnqqs4qsvz4g8cq6db5id41kzys7hzhcaycwmc9rpqygs2ajwz"; }
|
||||
{ commit = "e137c72d099f9b3b47f4cc718aa11eab14df1a9c"; sha256 = "1ms0dmz74yf6kwgjfs4d2fhj8y6mcp2n184r3jk44wx2xc24vgb2"; }]
|
||||
|
||||
++ [
|
||||
../libsanitizer-no-cyclades-9.patch
|
||||
# gcc-11 compatibility
|
||||
(fetchpatch {
|
||||
name = "gcc4-char-reload.patch";
|
||||
url = "https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=d57c99458933a21fdf94f508191f145ad8d5ec58";
|
||||
includes = [ "gcc/reload.h" ];
|
||||
sha256 = "sha256-66AMP7/ajunGKAN5WJz/yPn42URZ2KN51yPrFdsxEuM=";
|
||||
})
|
||||
];
|
||||
|
||||
javaEcj = fetchurl {
|
||||
# The `$(top_srcdir)/ecj.jar' file is automatically picked up at
|
||||
# `configure' time.
|
||||
|
||||
# XXX: Eventually we might want to take it from upstream.
|
||||
url = "ftp://sourceware.org/pub/java/ecj-4.3.jar";
|
||||
sha256 = "0jz7hvc0s6iydmhgh5h2m15yza7p2rlss2vkif30vm9y77m97qcx";
|
||||
};
|
||||
|
||||
# Antlr (optional) allows the Java `gjdoc' tool to be built. We want a
|
||||
# binary distribution here to allow the whole chain to be bootstrapped.
|
||||
javaAntlr = fetchurl {
|
||||
url = "https://www.antlr.org/download/antlr-4.4-complete.jar";
|
||||
sha256 = "02lda2imivsvsis8rnzmbrbp8rh1kb8vmq4i67pqhkwz7lf8y6dz";
|
||||
};
|
||||
|
||||
xlibs = [
|
||||
libX11 libXt libSM libICE libXtst libXrender libXrandr libXi
|
||||
xorgproto
|
||||
];
|
||||
|
||||
javaAwtGtk = langJava && x11Support;
|
||||
|
||||
/* Cross-gcc settings (build == host != target) */
|
||||
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
|
||||
stageNameAddon = if withoutTargetLibc then "stage-static" else "stage-final";
|
||||
crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-";
|
||||
|
||||
callFile = lib.callPackageWith {
|
||||
# lets
|
||||
inherit
|
||||
majorVersion
|
||||
version
|
||||
buildPlatform
|
||||
hostPlatform
|
||||
targetPlatform
|
||||
patches
|
||||
javaEcj
|
||||
javaAntlr
|
||||
xlibs
|
||||
javaAwtGtk
|
||||
crossMingw
|
||||
stageNameAddon
|
||||
crossNameAddon
|
||||
;
|
||||
# inherit generated with 'nix eval --json --impure --expr "with import ./. {}; lib.attrNames (lib.functionArgs gcc49.cc.override)" | jq '.[]' --raw-output'
|
||||
inherit
|
||||
binutils
|
||||
boehmgc
|
||||
buildPackages
|
||||
cloog
|
||||
withoutTargetLibc
|
||||
enableLTO
|
||||
enableMultilib
|
||||
enablePlugin
|
||||
enableShared
|
||||
fetchpatch
|
||||
fetchurl
|
||||
gettext
|
||||
gmp
|
||||
gnused
|
||||
gtk2
|
||||
isl
|
||||
langC
|
||||
langCC
|
||||
langFortran
|
||||
langGo
|
||||
langJava
|
||||
langJit
|
||||
langObjC
|
||||
langObjCpp
|
||||
lib
|
||||
libICE
|
||||
libSM
|
||||
libX11
|
||||
libXi
|
||||
libXrandr
|
||||
libXrender
|
||||
libXt
|
||||
libXtst
|
||||
libart_lgpl
|
||||
libcCross threadsCross
|
||||
libmpc
|
||||
mpfr
|
||||
name
|
||||
noSysDirs
|
||||
patchelf
|
||||
perl
|
||||
pkg-config
|
||||
profiledCompiler
|
||||
reproducibleBuild
|
||||
staticCompiler
|
||||
stdenv
|
||||
targetPackages
|
||||
texinfo
|
||||
unzip
|
||||
which
|
||||
x11Support
|
||||
xorgproto
|
||||
zip
|
||||
zlib
|
||||
;
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
# We need all these X libraries when building AWT with GTK.
|
||||
assert x11Support -> (filter (x: x == null) ([ gtk2 libart_lgpl ] ++ xlibs)) == [];
|
||||
|
||||
lib.pipe ((callFile ../common/builder.nix {}) ({
|
||||
pname = "${crossNameAddon}${name}";
|
||||
inherit version;
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.bz2";
|
||||
sha256 = "14l06m7nvcvb0igkbip58x59w3nq6315k6jcz3wr9ch1rn9d44bc";
|
||||
};
|
||||
|
||||
inherit patches;
|
||||
|
||||
hardeningDisable = [ "format" "pie" ];
|
||||
|
||||
# When targeting darwin, libgcc_ext.10.{4,5}.dylib are created as
|
||||
# MH_DYLIB_STUB files, which install_name_tool can't change, so we
|
||||
# get a cycle between $out and $lib.
|
||||
outputs = if langJava || langGo || targetPlatform.isDarwin then ["out" "man" "info"]
|
||||
else [ "out" "lib" "man" "info" ];
|
||||
setOutputFlags = false;
|
||||
NIX_NO_SELF_RPATH = true;
|
||||
|
||||
libc_dev = stdenv.cc.libc_dev;
|
||||
|
||||
postPatch =
|
||||
if targetPlatform != hostPlatform || stdenv.cc.libc != null then
|
||||
# On NixOS, use the right path to the dynamic linker instead of
|
||||
# `/lib/ld*.so'.
|
||||
let
|
||||
libc = if libcCross != null then libcCross else stdenv.cc.libc;
|
||||
in
|
||||
'' echo "fixing the \`GLIBC_DYNAMIC_LINKER' and \`UCLIBC_DYNAMIC_LINKER' macros..."
|
||||
for header in "gcc/config/"*-gnu.h "gcc/config/"*"/"*.h
|
||||
do
|
||||
grep -q LIBC_DYNAMIC_LINKER "$header" || continue
|
||||
echo " fixing \`$header'..."
|
||||
sed -i "$header" \
|
||||
-e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc.out}\3"|g'
|
||||
done
|
||||
''
|
||||
else null;
|
||||
|
||||
inherit noSysDirs staticCompiler langJava withoutTargetLibc
|
||||
libcCross crossMingw;
|
||||
|
||||
inherit (callFile ../common/dependencies.nix { })
|
||||
depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget;
|
||||
|
||||
preConfigure = callFile ../common/pre-configure.nix { };
|
||||
|
||||
dontDisableStatic = true;
|
||||
|
||||
configurePlatforms = [ "build" "host" "target" ];
|
||||
|
||||
configureFlags = callFile ../common/configure-flags.nix { };
|
||||
|
||||
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
|
||||
|
||||
buildFlags = optional
|
||||
(targetPlatform == hostPlatform && hostPlatform == buildPlatform)
|
||||
(if profiledCompiler then "profiledbootstrap" else "bootstrap");
|
||||
|
||||
# https://gcc.gnu.org/PR109898
|
||||
enableParallelInstalling = false;
|
||||
|
||||
inherit (callFile ../common/strip-attributes.nix { })
|
||||
stripDebugList
|
||||
stripDebugListTarget
|
||||
preFixup;
|
||||
|
||||
doCheck = false; # requires a lot of tools, causes a dependency cycle for stdenv
|
||||
|
||||
# https://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
|
||||
${if hostPlatform.system == "x86_64-solaris" then "CC" else null} = "gcc -m64";
|
||||
|
||||
# Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the
|
||||
# library headers and binaries, regarless of the language being compiled.
|
||||
#
|
||||
# Note: When building the Java AWT GTK peer, the build system doesn't honor
|
||||
# `--with-gmp' et al., e.g., when building
|
||||
# `libjava/classpath/native/jni/java-math/gnu_java_math_GMP.c', so we just add
|
||||
# them to $CPATH and $LIBRARY_PATH in this case.
|
||||
#
|
||||
# Likewise, the LTO code doesn't find zlib.
|
||||
#
|
||||
# Cross-compiling, we need gcc not to read ./specs in order to build the g++
|
||||
# compiler (after the specs for the cross-gcc are created). Having
|
||||
# LIBRARY_PATH= makes gcc read the specs from ., and the build breaks.
|
||||
|
||||
CPATH = optionals (targetPlatform == hostPlatform) (makeSearchPathOutput "dev" "include" ([]
|
||||
++ optional (zlib != null) zlib
|
||||
++ optional langJava boehmgc
|
||||
++ optionals javaAwtGtk xlibs
|
||||
++ optionals javaAwtGtk [ gmp mpfr ]
|
||||
));
|
||||
|
||||
LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath ([]
|
||||
++ optional (zlib != null) zlib
|
||||
++ optional langJava boehmgc
|
||||
++ optionals javaAwtGtk xlibs
|
||||
++ optionals javaAwtGtk [ gmp mpfr ]
|
||||
));
|
||||
|
||||
inherit (callFile ../common/extra-target-flags.nix { })
|
||||
EXTRA_FLAGS_FOR_TARGET
|
||||
EXTRA_LDFLAGS_FOR_TARGET
|
||||
;
|
||||
|
||||
passthru = {
|
||||
inherit langC langCC langObjC langObjCpp langFortran langGo version;
|
||||
isGNU = true;
|
||||
hardeningUnsupportedFlags = [ "fortify3" ];
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
inherit enableShared enableMultilib;
|
||||
|
||||
meta = {
|
||||
inherit (callFile ../common/meta.nix { })
|
||||
homepage
|
||||
license
|
||||
description
|
||||
longDescription
|
||||
platforms
|
||||
maintainers
|
||||
;
|
||||
badPlatforms = [ "aarch64-darwin" ];
|
||||
};
|
||||
}
|
||||
|
||||
// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
|
||||
|
||||
// optionalAttrs (langJava) {
|
||||
postFixup = ''
|
||||
target="$(echo "$out/libexec/gcc"/*/*/ecj*)"
|
||||
patchelf --set-rpath "$(patchelf --print-rpath "$target"):$out/lib" "$target"
|
||||
'';}
|
||||
))
|
||||
[
|
||||
(callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc enableShared; })
|
||||
]
|
@ -1,370 +0,0 @@
|
||||
{ lib, stdenv, targetPackages, fetchurl, fetchpatch, fetchFromGitHub, noSysDirs
|
||||
, langC ? true, langCC ? true, langFortran ? false
|
||||
, langAda ? false
|
||||
, langObjC ? stdenv.targetPlatform.isDarwin
|
||||
, langObjCpp ? stdenv.targetPlatform.isDarwin
|
||||
, langJava ? false
|
||||
, langGo ? false
|
||||
, reproducibleBuild ? true
|
||||
, profiledCompiler ? false
|
||||
, langJit ? false
|
||||
, staticCompiler ? false
|
||||
, enableShared ? stdenv.targetPlatform.hasSharedLibraries
|
||||
, enableLTO ? stdenv.hostPlatform.hasSharedLibraries
|
||||
, texinfo ? null
|
||||
, flex
|
||||
, perl ? null # optional, for texi2pod (then pod2man); required for Java
|
||||
, gmp, mpfr, libmpc, gettext, which, patchelf, binutils
|
||||
, isl ? null # optional, for the Graphite optimization framework.
|
||||
, zlib ? null, boehmgc ? null
|
||||
, gnat-bootstrap ? null
|
||||
, zip ? null, unzip ? null, pkg-config ? null
|
||||
, gtk2 ? null, libart_lgpl ? null
|
||||
, libX11 ? null, libXt ? null, libSM ? null, libICE ? null, libXtst ? null
|
||||
, libXrender ? null, xorgproto ? null
|
||||
, libXrandr ? null, libXi ? null
|
||||
, x11Support ? langJava
|
||||
, enableMultilib ? false
|
||||
, enablePlugin ? stdenv.hostPlatform == stdenv.buildPlatform # Whether to support user-supplied plug-ins
|
||||
, name ? "gcc"
|
||||
, libcCross ? null
|
||||
, threadsCross ? null # for MinGW
|
||||
, withoutTargetLibc ? false
|
||||
, gnused ? null
|
||||
, cloog ? null # unused; just for compat with gcc4, as we override the parameter on some places
|
||||
, buildPackages
|
||||
, callPackage
|
||||
}:
|
||||
|
||||
assert langJava -> zip != null && unzip != null
|
||||
&& zlib != null && boehmgc != null
|
||||
&& perl != null; # for `--enable-java-home'
|
||||
|
||||
# Make sure we get GNU sed.
|
||||
assert stdenv.buildPlatform.isDarwin -> gnused != null;
|
||||
|
||||
# The go frontend is written in c++
|
||||
assert langGo -> langCC;
|
||||
|
||||
assert langAda -> gnat-bootstrap != null;
|
||||
|
||||
# threadsCross is just for MinGW
|
||||
assert threadsCross != {} -> stdenv.targetPlatform.isWindows;
|
||||
|
||||
# profiledCompiler builds inject non-determinism in one of the compilation stages.
|
||||
# If turned on, we can't provide reproducible builds anymore
|
||||
assert reproducibleBuild -> profiledCompiler == false;
|
||||
|
||||
with lib;
|
||||
with builtins;
|
||||
|
||||
let majorVersion = "6";
|
||||
version = "${majorVersion}.5.0";
|
||||
|
||||
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
|
||||
|
||||
patches = [ ../9/fix-struct-redefinition-on-glibc-2.36.patch ]
|
||||
++ optionals (!stdenv.targetPlatform.isRedox) [
|
||||
../use-source-date-epoch.patch ./0001-Fix-build-for-glibc-2.31.patch
|
||||
|
||||
# Fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80431
|
||||
../fix-bug-80431.patch
|
||||
] ++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
|
||||
++ optional noSysDirs ../no-sys-dirs.patch
|
||||
++ optional langAda ../gnat-cflags.patch
|
||||
++ optional langAda ./gnat-glibc234.patch
|
||||
++ optional langFortran ../gfortran-driving.patch
|
||||
++ optional (targetPlatform.libc == "musl") ../libgomp-dont-force-initial-exec.patch
|
||||
++ optional langGo ./gogcc-workaround-glibc-2.36.patch
|
||||
|
||||
# Obtain latest patch with ../update-mcfgthread-patches.sh
|
||||
++ optional (!withoutTargetLibc && targetPlatform.isMinGW && threadsCross.model == "mcf") ./Added-mcf-thread-model-support-from-mcfgthread.patch
|
||||
++ optional (targetPlatform.libc == "musl" && targetPlatform.isx86_32) (fetchpatch {
|
||||
url = "https://git.alpinelinux.org/aports/plain/main/gcc/gcc-6.1-musl-libssp.patch?id=5e4b96e23871ee28ef593b439f8c07ca7c7eb5bb";
|
||||
sha256 = "1jf1ciz4gr49lwyh8knfhw6l5gvfkwzjy90m7qiwkcbsf4a3fqn2";
|
||||
})
|
||||
|
||||
++ [ ../libsanitizer-no-cyclades-9.patch ];
|
||||
|
||||
javaEcj = fetchurl {
|
||||
# The `$(top_srcdir)/ecj.jar' file is automatically picked up at
|
||||
# `configure' time.
|
||||
|
||||
# XXX: Eventually we might want to take it from upstream.
|
||||
url = "ftp://sourceware.org/pub/java/ecj-4.3.jar";
|
||||
sha256 = "0jz7hvc0s6iydmhgh5h2m15yza7p2rlss2vkif30vm9y77m97qcx";
|
||||
};
|
||||
|
||||
# Antlr (optional) allows the Java `gjdoc' tool to be built. We want a
|
||||
# binary distribution here to allow the whole chain to be bootstrapped.
|
||||
javaAntlr = fetchurl {
|
||||
url = "https://www.antlr.org/download/antlr-4.4-complete.jar";
|
||||
sha256 = "02lda2imivsvsis8rnzmbrbp8rh1kb8vmq4i67pqhkwz7lf8y6dz";
|
||||
};
|
||||
|
||||
xlibs = [
|
||||
libX11 libXt libSM libICE libXtst libXrender libXrandr libXi
|
||||
xorgproto
|
||||
];
|
||||
|
||||
javaAwtGtk = langJava && x11Support;
|
||||
|
||||
/* Cross-gcc settings (build == host != target) */
|
||||
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
|
||||
stageNameAddon = if withoutTargetLibc then "stage-static" else "stage-final";
|
||||
crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-";
|
||||
|
||||
callFile = lib.callPackageWith {
|
||||
# lets
|
||||
inherit
|
||||
majorVersion
|
||||
version
|
||||
buildPlatform
|
||||
hostPlatform
|
||||
targetPlatform
|
||||
patches
|
||||
javaEcj
|
||||
javaAntlr
|
||||
xlibs
|
||||
javaAwtGtk
|
||||
crossMingw
|
||||
stageNameAddon
|
||||
crossNameAddon
|
||||
;
|
||||
# inherit generated with 'nix eval --json --impure --expr "with import ./. {}; lib.attrNames (lib.functionArgs gcc6.cc.override)" | jq '.[]' --raw-output'
|
||||
inherit
|
||||
binutils
|
||||
boehmgc
|
||||
buildPackages
|
||||
cloog
|
||||
withoutTargetLibc
|
||||
enableLTO
|
||||
enableMultilib
|
||||
enablePlugin
|
||||
enableShared
|
||||
fetchFromGitHub
|
||||
fetchpatch
|
||||
fetchurl
|
||||
flex
|
||||
gettext
|
||||
gmp
|
||||
gnat-bootstrap
|
||||
gnused
|
||||
gtk2
|
||||
isl
|
||||
langAda
|
||||
langC
|
||||
langCC
|
||||
langFortran
|
||||
langGo
|
||||
langJava
|
||||
langJit
|
||||
langObjC
|
||||
langObjCpp
|
||||
lib
|
||||
libICE
|
||||
libSM
|
||||
libX11
|
||||
libXi
|
||||
libXrandr
|
||||
libXrender
|
||||
libXt
|
||||
libXtst
|
||||
libart_lgpl
|
||||
libcCross
|
||||
libmpc
|
||||
mpfr
|
||||
name
|
||||
noSysDirs
|
||||
patchelf
|
||||
perl
|
||||
pkg-config
|
||||
profiledCompiler
|
||||
reproducibleBuild
|
||||
staticCompiler
|
||||
stdenv
|
||||
targetPackages
|
||||
texinfo
|
||||
threadsCross
|
||||
unzip
|
||||
which
|
||||
x11Support
|
||||
xorgproto
|
||||
zip
|
||||
zlib
|
||||
;
|
||||
};
|
||||
in
|
||||
|
||||
# We need all these X libraries when building AWT with GTK.
|
||||
assert x11Support -> (filter (x: x == null) ([ gtk2 libart_lgpl ] ++ xlibs)) == [];
|
||||
|
||||
lib.pipe ((callFile ../common/builder.nix {}) ({
|
||||
pname = "${crossNameAddon}${name}";
|
||||
inherit version;
|
||||
|
||||
src = if stdenv.targetPlatform.isVc4 then fetchFromGitHub {
|
||||
owner = "itszor";
|
||||
repo = "gcc-vc4";
|
||||
rev = "e90ff43f9671c760cf0d1dd62f569a0fb9bf8918";
|
||||
sha256 = "0gxf66hwqk26h8f853sybphqa5ca0cva2kmrw5jsiv6139g0qnp8";
|
||||
} else if stdenv.targetPlatform.isRedox then fetchFromGitHub {
|
||||
owner = "redox-os";
|
||||
repo = "gcc";
|
||||
rev = "f360ac095028d286fc6dde4d02daed48f59813fa"; # `redox` branch
|
||||
sha256 = "1an96h8l58pppyh3qqv90g8hgcfd9hj7igvh2gigmkxbrx94khfl";
|
||||
} else fetchurl {
|
||||
url = "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.xz";
|
||||
sha256 = "0i89fksfp6wr1xg9l8296aslcymv2idn60ip31wr9s4pwin7kwby";
|
||||
};
|
||||
|
||||
inherit patches;
|
||||
|
||||
outputs = if langJava || langGo || langJit then ["out" "man" "info"]
|
||||
else [ "out" "lib" "man" "info" ];
|
||||
setOutputFlags = false;
|
||||
NIX_NO_SELF_RPATH = true;
|
||||
|
||||
libc_dev = stdenv.cc.libc_dev;
|
||||
|
||||
hardeningDisable = [ "format" "pie" ];
|
||||
|
||||
postPatch =
|
||||
# This should kill all the stdinc frameworks that gcc and friends like to
|
||||
# insert into default search paths.
|
||||
lib.optionalString hostPlatform.isDarwin ''
|
||||
substituteInPlace gcc/config/darwin-c.c \
|
||||
--replace 'if (stdinc)' 'if (0)'
|
||||
|
||||
substituteInPlace libgcc/config/t-slibgcc-darwin \
|
||||
--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 ''${!outputLib}/lib/\\\$soname"
|
||||
''
|
||||
+ (
|
||||
lib.optionalString (targetPlatform != hostPlatform || stdenv.cc.libc != null)
|
||||
# On NixOS, use the right path to the dynamic linker instead of
|
||||
# `/lib/ld*.so'.
|
||||
(let
|
||||
libc = if libcCross != null then libcCross else stdenv.cc.libc;
|
||||
in
|
||||
(
|
||||
'' echo "fixing the \`GLIBC_DYNAMIC_LINKER', \`UCLIBC_DYNAMIC_LINKER', and \`MUSL_DYNAMIC_LINKER' macros..."
|
||||
for header in "gcc/config/"*-gnu.h "gcc/config/"*"/"*.h
|
||||
do
|
||||
grep -q _DYNAMIC_LINKER "$header" || continue
|
||||
echo " fixing \`$header'..."
|
||||
sed -i "$header" \
|
||||
-e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc.out}\3"|g' \
|
||||
-e 's|define[[:blank:]]*MUSL_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define MUSL_DYNAMIC_LINKER\1 "${libc.out}\2"|g'
|
||||
done
|
||||
''
|
||||
+ lib.optionalString (targetPlatform.libc == "musl")
|
||||
''
|
||||
sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR'
|
||||
''
|
||||
))
|
||||
);
|
||||
|
||||
inherit noSysDirs staticCompiler langJava withoutTargetLibc
|
||||
libcCross crossMingw;
|
||||
|
||||
inherit (callFile ../common/dependencies.nix { })
|
||||
depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget;
|
||||
|
||||
NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm";
|
||||
|
||||
preConfigure = callFile ../common/pre-configure.nix { };
|
||||
|
||||
dontDisableStatic = true;
|
||||
|
||||
configurePlatforms = [ "build" "host" "target" ];
|
||||
|
||||
configureFlags = callFile ../common/configure-flags.nix { };
|
||||
|
||||
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
|
||||
|
||||
buildFlags = optional
|
||||
(targetPlatform == hostPlatform && hostPlatform == buildPlatform)
|
||||
(if profiledCompiler then "profiledbootstrap" else "bootstrap");
|
||||
|
||||
# https://gcc.gnu.org/PR109898
|
||||
enableParallelInstalling = false;
|
||||
|
||||
inherit (callFile ../common/strip-attributes.nix { })
|
||||
stripDebugList
|
||||
stripDebugListTarget
|
||||
preFixup;
|
||||
|
||||
doCheck = false; # requires a lot of tools, causes a dependency cycle for stdenv
|
||||
|
||||
# https://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
|
||||
${if hostPlatform.system == "x86_64-solaris" then "CC" else null} = "gcc -m64";
|
||||
|
||||
# Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the
|
||||
# library headers and binaries, regarless of the language being compiled.
|
||||
#
|
||||
# Note: When building the Java AWT GTK peer, the build system doesn't honor
|
||||
# `--with-gmp' et al., e.g., when building
|
||||
# `libjava/classpath/native/jni/java-math/gnu_java_math_GMP.c', so we just add
|
||||
# them to $CPATH and $LIBRARY_PATH in this case.
|
||||
#
|
||||
# Likewise, the LTO code doesn't find zlib.
|
||||
#
|
||||
# Cross-compiling, we need gcc not to read ./specs in order to build the g++
|
||||
# compiler (after the specs for the cross-gcc are created). Having
|
||||
# LIBRARY_PATH= makes gcc read the specs from ., and the build breaks.
|
||||
|
||||
CPATH = optionals (targetPlatform == hostPlatform) (makeSearchPathOutput "dev" "include" ([]
|
||||
++ optional (zlib != null) zlib
|
||||
++ optional langJava boehmgc
|
||||
++ optionals javaAwtGtk xlibs
|
||||
++ optionals javaAwtGtk [ gmp mpfr ]
|
||||
));
|
||||
|
||||
LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath ([]
|
||||
++ optional (zlib != null) zlib
|
||||
++ optional langJava boehmgc
|
||||
++ optionals javaAwtGtk xlibs
|
||||
++ optionals javaAwtGtk [ gmp mpfr ]
|
||||
));
|
||||
|
||||
inherit (callFile ../common/extra-target-flags.nix { })
|
||||
EXTRA_FLAGS_FOR_TARGET
|
||||
EXTRA_LDFLAGS_FOR_TARGET
|
||||
;
|
||||
|
||||
passthru = {
|
||||
inherit langC langCC langObjC langObjCpp langFortran langAda langGo version;
|
||||
isGNU = true;
|
||||
hardeningUnsupportedFlags = [ "fortify3" ];
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
inherit enableShared enableMultilib;
|
||||
|
||||
meta = {
|
||||
inherit (callFile ../common/meta.nix { })
|
||||
homepage
|
||||
license
|
||||
description
|
||||
longDescription
|
||||
platforms
|
||||
maintainers
|
||||
;
|
||||
badPlatforms = [ "aarch64-darwin" ];
|
||||
};
|
||||
}
|
||||
|
||||
// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
|
||||
|
||||
// optionalAttrs (langJava && !stdenv.hostPlatform.isDarwin) {
|
||||
postFixup = ''
|
||||
target="$(echo "$out/libexec/gcc"/*/*/ecj*)"
|
||||
patchelf --set-rpath "$(patchelf --print-rpath "$target"):$out/lib" "$target"
|
||||
'';}
|
||||
))
|
||||
[
|
||||
(callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc enableShared; })
|
||||
]
|
@ -1,304 +0,0 @@
|
||||
{ lib, stdenv, targetPackages, fetchurl, fetchpatch, noSysDirs
|
||||
, langC ? true, langCC ? true, langFortran ? false
|
||||
, langObjC ? stdenv.targetPlatform.isDarwin
|
||||
, langObjCpp ? stdenv.targetPlatform.isDarwin
|
||||
, langGo ? false
|
||||
, reproducibleBuild ? true
|
||||
, profiledCompiler ? false
|
||||
, langJit ? false
|
||||
, staticCompiler ? false
|
||||
, enableShared ? stdenv.targetPlatform.hasSharedLibraries
|
||||
, enableLTO ? stdenv.hostPlatform.hasSharedLibraries
|
||||
, texinfo ? null
|
||||
, perl ? null # optional, for texi2pod (then pod2man)
|
||||
, gmp, mpfr, libmpc, gettext, which, patchelf, binutils
|
||||
, isl ? null # optional, for the Graphite optimization framework.
|
||||
, zlib ? null
|
||||
, enableMultilib ? false
|
||||
, enablePlugin ? stdenv.hostPlatform == stdenv.buildPlatform # Whether to support user-supplied plug-ins
|
||||
, name ? "gcc"
|
||||
, libcCross ? null
|
||||
, threadsCross ? null # for MinGW
|
||||
, withoutTargetLibc ? false
|
||||
, gnused ? null
|
||||
, cloog ? null # unused; just for compat with gcc4, as we override the parameter on some places
|
||||
, buildPackages
|
||||
, callPackage
|
||||
}:
|
||||
|
||||
# Make sure we get GNU sed.
|
||||
assert stdenv.buildPlatform.isDarwin -> gnused != null;
|
||||
|
||||
# The go frontend is written in c++
|
||||
assert langGo -> langCC;
|
||||
|
||||
# threadsCross is just for MinGW
|
||||
assert threadsCross != {} -> stdenv.targetPlatform.isWindows;
|
||||
|
||||
# profiledCompiler builds inject non-determinism in one of the compilation stages.
|
||||
# If turned on, we can't provide reproducible builds anymore
|
||||
assert reproducibleBuild -> profiledCompiler == false;
|
||||
|
||||
with lib;
|
||||
with builtins;
|
||||
|
||||
let majorVersion = "7";
|
||||
version = "${majorVersion}.5.0";
|
||||
|
||||
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
|
||||
|
||||
patches =
|
||||
[ # https://gcc.gnu.org/ml/gcc-patches/2018-02/msg00633.html
|
||||
./riscv-pthread-reentrant.patch
|
||||
# https://gcc.gnu.org/ml/gcc-patches/2018-03/msg00297.html
|
||||
./riscv-no-relax.patch
|
||||
# Fix for asan w/glibc-2.34. Although there's no upstream backport to v7,
|
||||
# the patch from gcc 8 seems to work perfectly fine.
|
||||
./gcc8-asan-glibc-2.34.patch
|
||||
|
||||
./0001-Fix-build-for-glibc-2.31.patch
|
||||
|
||||
# Fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80431
|
||||
../fix-bug-80431.patch
|
||||
|
||||
../9/fix-struct-redefinition-on-glibc-2.36.patch
|
||||
]
|
||||
++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
|
||||
++ optionals targetPlatform.isNetBSD [
|
||||
../libstdc++-netbsd-ctypes.patch
|
||||
]
|
||||
++ optional noSysDirs ../no-sys-dirs.patch
|
||||
++ optional (hostPlatform != buildPlatform) (fetchpatch { # XXX: Refine when this should be applied
|
||||
url = "https://git.busybox.net/buildroot/plain/package/gcc/7.1.0/0900-remove-selftests.patch?id=11271540bfe6adafbc133caf6b5b902a816f5f02";
|
||||
sha256 = "0mrvxsdwip2p3l17dscpc1x8vhdsciqw1z5q9i6p5g9yg1cqnmgs";
|
||||
})
|
||||
++ optional langFortran ../gfortran-driving.patch
|
||||
++ optional (targetPlatform.libc == "musl" && targetPlatform.isPower) ../ppc-musl.patch
|
||||
++ optional (targetPlatform.libc == "musl" && targetPlatform.isx86_32) (fetchpatch {
|
||||
url = "https://git.alpinelinux.org/aports/plain/main/gcc/gcc-6.1-musl-libssp.patch?id=5e4b96e23871ee28ef593b439f8c07ca7c7eb5bb";
|
||||
sha256 = "1jf1ciz4gr49lwyh8knfhw6l5gvfkwzjy90m7qiwkcbsf4a3fqn2";
|
||||
})
|
||||
++ optional (targetPlatform.libc == "musl") ../libgomp-dont-force-initial-exec.patch
|
||||
|
||||
# Obtain latest patch with ../update-mcfgthread-patches.sh
|
||||
++ optional (!withoutTargetLibc && targetPlatform.isMinGW && threadsCross.model == "mcf") ./Added-mcf-thread-model-support-from-mcfgthread.patch
|
||||
|
||||
++ [ ../libsanitizer-no-cyclades-9.patch ];
|
||||
|
||||
/* Cross-gcc settings (build == host != target) */
|
||||
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
|
||||
stageNameAddon = if withoutTargetLibc 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 gcc7.cc.override)" | jq '.[]' --raw-output'
|
||||
inherit
|
||||
binutils
|
||||
buildPackages
|
||||
cloog
|
||||
withoutTargetLibc
|
||||
enableLTO
|
||||
enableMultilib
|
||||
enablePlugin
|
||||
enableShared
|
||||
fetchpatch
|
||||
fetchurl
|
||||
gettext
|
||||
gmp
|
||||
gnused
|
||||
isl
|
||||
langC
|
||||
langCC
|
||||
langFortran
|
||||
langGo
|
||||
langJit
|
||||
langObjC
|
||||
langObjCpp
|
||||
lib
|
||||
libcCross
|
||||
libmpc
|
||||
mpfr
|
||||
name
|
||||
noSysDirs
|
||||
patchelf
|
||||
perl
|
||||
profiledCompiler
|
||||
reproducibleBuild
|
||||
staticCompiler
|
||||
stdenv
|
||||
targetPackages
|
||||
texinfo
|
||||
threadsCross
|
||||
which
|
||||
zip
|
||||
zlib
|
||||
;
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
lib.pipe ((callFile ../common/builder.nix {}) ({
|
||||
pname = "${crossNameAddon}${name}";
|
||||
inherit version;
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://gcc/releases/gcc-${version}/gcc-${version}.tar.xz";
|
||||
sha256 = "0qg6kqc5l72hpnj4vr6l0p69qav0rh4anlkk3y55540zy3klc6dq";
|
||||
};
|
||||
|
||||
inherit patches;
|
||||
|
||||
outputs = [ "out" "man" "info" ] ++ lib.optional (!langJit) "lib";
|
||||
setOutputFlags = false;
|
||||
NIX_NO_SELF_RPATH = true;
|
||||
|
||||
libc_dev = stdenv.cc.libc_dev;
|
||||
|
||||
hardeningDisable = [ "format" "pie" ];
|
||||
|
||||
postPatch = ''
|
||||
configureScripts=$(find . -name configure)
|
||||
for configureScript in $configureScripts; do
|
||||
patchShebangs $configureScript
|
||||
done
|
||||
''
|
||||
# This should kill all the stdinc frameworks that gcc and friends like to
|
||||
# insert into default search paths.
|
||||
+ lib.optionalString hostPlatform.isDarwin ''
|
||||
substituteInPlace gcc/config/darwin-c.c \
|
||||
--replace 'if (stdinc)' 'if (0)'
|
||||
|
||||
substituteInPlace libgcc/config/t-slibgcc-darwin \
|
||||
--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 ''${!outputLib}/lib/\\\$soname"
|
||||
''
|
||||
+ (
|
||||
lib.optionalString (targetPlatform != hostPlatform || stdenv.cc.libc != null)
|
||||
# On NixOS, use the right path to the dynamic linker instead of
|
||||
# `/lib/ld*.so'.
|
||||
(let
|
||||
libc = if libcCross != null then libcCross else stdenv.cc.libc;
|
||||
in
|
||||
(
|
||||
'' echo "fixing the \`GLIBC_DYNAMIC_LINKER', \`UCLIBC_DYNAMIC_LINKER', and \`MUSL_DYNAMIC_LINKER' macros..."
|
||||
for header in "gcc/config/"*-gnu.h "gcc/config/"*"/"*.h
|
||||
do
|
||||
grep -q _DYNAMIC_LINKER "$header" || continue
|
||||
echo " fixing \`$header'..."
|
||||
sed -i "$header" \
|
||||
-e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc.out}\3"|g' \
|
||||
-e 's|define[[:blank:]]*MUSL_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define MUSL_DYNAMIC_LINKER\1 "${libc.out}\2"|g'
|
||||
done
|
||||
''
|
||||
+ lib.optionalString (targetPlatform.libc == "musl")
|
||||
''
|
||||
sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR'
|
||||
''
|
||||
))
|
||||
)
|
||||
+ lib.optionalString targetPlatform.isAvr ''
|
||||
makeFlagsArray+=(
|
||||
'LIMITS_H_TEST=false'
|
||||
)
|
||||
'';
|
||||
|
||||
inherit noSysDirs staticCompiler withoutTargetLibc
|
||||
libcCross crossMingw;
|
||||
|
||||
inherit (callFile ../common/dependencies.nix { })
|
||||
depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget;
|
||||
|
||||
env.NIX_CFLAGS_COMPILE = lib.optionalString (stdenv.cc.isClang && langFortran) "-Wno-unused-command-line-argument";
|
||||
NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm";
|
||||
|
||||
preConfigure = callFile ../common/pre-configure.nix { };
|
||||
|
||||
dontDisableStatic = true;
|
||||
|
||||
configurePlatforms = [ "build" "host" "target" ];
|
||||
|
||||
configureFlags = (callFile ../common/configure-flags.nix { })
|
||||
++ optional (targetPlatform.isAarch64) "--enable-fix-cortex-a53-843419"
|
||||
++ optional targetPlatform.isNetBSD "--disable-libcilkrts"
|
||||
;
|
||||
|
||||
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
|
||||
|
||||
buildFlags = optional
|
||||
(targetPlatform == hostPlatform && hostPlatform == buildPlatform)
|
||||
(if profiledCompiler then "profiledbootstrap" else "bootstrap");
|
||||
|
||||
# https://gcc.gnu.org/PR109898
|
||||
enableParallelInstalling = false;
|
||||
|
||||
inherit (callFile ../common/strip-attributes.nix { })
|
||||
stripDebugList
|
||||
stripDebugListTarget
|
||||
preFixup;
|
||||
|
||||
doCheck = false; # requires a lot of tools, causes a dependency cycle for stdenv
|
||||
|
||||
# https://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
|
||||
${if hostPlatform.system == "x86_64-solaris" then "CC" else null} = "gcc -m64";
|
||||
|
||||
# Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the
|
||||
# library headers and binaries, regarless of the language being compiled.
|
||||
#
|
||||
# Likewise, the LTO code doesn't find zlib.
|
||||
#
|
||||
# Cross-compiling, we need gcc not to read ./specs in order to build the g++
|
||||
# compiler (after the specs for the cross-gcc are created). Having
|
||||
# LIBRARY_PATH= makes gcc read the specs from ., and the build breaks.
|
||||
|
||||
CPATH = optionals (targetPlatform == hostPlatform) (makeSearchPathOutput "dev" "include" ([]
|
||||
++ optional (zlib != null) zlib
|
||||
));
|
||||
|
||||
LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath (optional (zlib != null) zlib));
|
||||
|
||||
inherit (callFile ../common/extra-target-flags.nix { })
|
||||
EXTRA_FLAGS_FOR_TARGET
|
||||
EXTRA_LDFLAGS_FOR_TARGET
|
||||
;
|
||||
|
||||
passthru = {
|
||||
inherit langC langCC langObjC langObjCpp langFortran langGo version;
|
||||
isGNU = true;
|
||||
hardeningUnsupportedFlags = [ "fortify3" ];
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
inherit enableShared enableMultilib;
|
||||
|
||||
meta = {
|
||||
inherit (callFile ../common/meta.nix { })
|
||||
homepage
|
||||
license
|
||||
description
|
||||
longDescription
|
||||
platforms
|
||||
maintainers
|
||||
;
|
||||
badPlatforms = [ "aarch64-darwin" ];
|
||||
};
|
||||
}
|
||||
|
||||
// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
|
||||
))
|
||||
[
|
||||
(callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc enableShared; })
|
||||
]
|
@ -1,279 +0,0 @@
|
||||
{ lib, stdenv, targetPackages, fetchurl, fetchpatch, noSysDirs
|
||||
, langC ? true, langCC ? true, langFortran ? false
|
||||
, langObjC ? stdenv.targetPlatform.isDarwin
|
||||
, langObjCpp ? stdenv.targetPlatform.isDarwin
|
||||
, langGo ? false
|
||||
, reproducibleBuild ? true
|
||||
, profiledCompiler ? false
|
||||
, langJit ? false
|
||||
, staticCompiler ? false
|
||||
, enableShared ? stdenv.targetPlatform.hasSharedLibraries
|
||||
, enableLTO ? stdenv.hostPlatform.hasSharedLibraries
|
||||
, texinfo ? null
|
||||
, perl ? null # optional, for texi2pod (then pod2man)
|
||||
, gmp, mpfr, libmpc, gettext, which, patchelf, binutils
|
||||
, isl ? null # optional, for the Graphite optimization framework.
|
||||
, zlib ? null
|
||||
, enableMultilib ? false
|
||||
, enablePlugin ? stdenv.hostPlatform == stdenv.buildPlatform # Whether to support user-supplied plug-ins
|
||||
, name ? "gcc"
|
||||
, libcCross ? null
|
||||
, threadsCross ? null # for MinGW
|
||||
, withoutTargetLibc ? false
|
||||
, gnused ? null
|
||||
, cloog ? null # unused; just for compat with gcc4, as we override the parameter on some places
|
||||
, buildPackages
|
||||
, callPackage
|
||||
}:
|
||||
|
||||
# Make sure we get GNU sed.
|
||||
assert stdenv.buildPlatform.isDarwin -> gnused != null;
|
||||
|
||||
# The go frontend is written in c++
|
||||
assert langGo -> langCC;
|
||||
|
||||
# threadsCross is just for MinGW
|
||||
assert threadsCross != {} -> stdenv.targetPlatform.isWindows;
|
||||
|
||||
# profiledCompiler builds inject non-determinism in one of the compilation stages.
|
||||
# If turned on, we can't provide reproducible builds anymore
|
||||
assert reproducibleBuild -> profiledCompiler == false;
|
||||
|
||||
with lib;
|
||||
with builtins;
|
||||
|
||||
let majorVersion = "8";
|
||||
version = "${majorVersion}.5.0";
|
||||
|
||||
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
|
||||
|
||||
patches = [
|
||||
# Fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80431
|
||||
../fix-bug-80431.patch
|
||||
../9/fix-struct-redefinition-on-glibc-2.36.patch
|
||||
] ++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
|
||||
++ optional targetPlatform.isNetBSD ../libstdc++-netbsd-ctypes.patch
|
||||
++ optional noSysDirs ../no-sys-dirs.patch
|
||||
/* ++ optional (hostPlatform != buildPlatform) (fetchpatch { # XXX: Refine when this should be applied
|
||||
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 langFortran ../gfortran-driving.patch
|
||||
++ optional (targetPlatform.libc == "musl" && targetPlatform.isPower) ../ppc-musl.patch
|
||||
++ optional (targetPlatform.libc == "musl") ../libgomp-dont-force-initial-exec.patch
|
||||
|
||||
# Obtain latest patch with ../update-mcfgthread-patches.sh
|
||||
++ optional (!withoutTargetLibc && targetPlatform.isMinGW && threadsCross.model == "mcf") ./Added-mcf-thread-model-support-from-mcfgthread.patch
|
||||
++ [ ../libsanitizer-no-cyclades-9.patch ];
|
||||
|
||||
/* Cross-gcc settings (build == host != target) */
|
||||
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
|
||||
stageNameAddon = if withoutTargetLibc 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 gcc8.cc.override)" | jq '.[]' --raw-output'
|
||||
inherit
|
||||
binutils
|
||||
buildPackages
|
||||
cloog
|
||||
withoutTargetLibc
|
||||
enableLTO
|
||||
enableMultilib
|
||||
enablePlugin
|
||||
enableShared
|
||||
fetchpatch
|
||||
fetchurl
|
||||
gettext
|
||||
gmp
|
||||
gnused
|
||||
isl
|
||||
langC
|
||||
langCC
|
||||
langFortran
|
||||
langGo
|
||||
langJit
|
||||
langObjC
|
||||
langObjCpp
|
||||
lib
|
||||
libcCross
|
||||
libmpc
|
||||
mpfr
|
||||
name
|
||||
noSysDirs
|
||||
patchelf
|
||||
perl
|
||||
profiledCompiler
|
||||
reproducibleBuild
|
||||
staticCompiler
|
||||
stdenv
|
||||
targetPackages
|
||||
texinfo
|
||||
threadsCross
|
||||
which
|
||||
zip
|
||||
zlib
|
||||
;
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
lib.pipe ((callFile ../common/builder.nix {}) ({
|
||||
pname = "${crossNameAddon}${name}";
|
||||
inherit version;
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://gcc/releases/gcc-${version}/gcc-${version}.tar.xz";
|
||||
sha256 = "0l7d4m9jx124xsk6xardchgy2k5j5l2b15q322k31f0va4d8826k";
|
||||
};
|
||||
|
||||
inherit patches;
|
||||
|
||||
outputs = [ "out" "man" "info" ] ++ lib.optional (!langJit) "lib";
|
||||
setOutputFlags = false;
|
||||
NIX_NO_SELF_RPATH = true;
|
||||
|
||||
libc_dev = stdenv.cc.libc_dev;
|
||||
|
||||
hardeningDisable = [ "format" "pie" ];
|
||||
|
||||
postPatch = ''
|
||||
configureScripts=$(find . -name configure)
|
||||
for configureScript in $configureScripts; do
|
||||
patchShebangs $configureScript
|
||||
done
|
||||
''
|
||||
# This should kill all the stdinc frameworks that gcc and friends like to
|
||||
# insert into default search paths.
|
||||
+ lib.optionalString hostPlatform.isDarwin ''
|
||||
substituteInPlace gcc/config/darwin-c.c \
|
||||
--replace 'if (stdinc)' 'if (0)'
|
||||
|
||||
substituteInPlace libgcc/config/t-slibgcc-darwin \
|
||||
--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 ''${!outputLib}/lib/\\\$soname"
|
||||
''
|
||||
+ (
|
||||
lib.optionalString (targetPlatform != hostPlatform || stdenv.cc.libc != null)
|
||||
# On NixOS, use the right path to the dynamic linker instead of
|
||||
# `/lib/ld*.so'.
|
||||
(let
|
||||
libc = if libcCross != null then libcCross else stdenv.cc.libc;
|
||||
in
|
||||
(
|
||||
'' echo "fixing the \`GLIBC_DYNAMIC_LINKER', \`UCLIBC_DYNAMIC_LINKER', and \`MUSL_DYNAMIC_LINKER' macros..."
|
||||
for header in "gcc/config/"*-gnu.h "gcc/config/"*"/"*.h
|
||||
do
|
||||
grep -q _DYNAMIC_LINKER "$header" || continue
|
||||
echo " fixing \`$header'..."
|
||||
sed -i "$header" \
|
||||
-e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc.out}\3"|g' \
|
||||
-e 's|define[[:blank:]]*MUSL_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define MUSL_DYNAMIC_LINKER\1 "${libc.out}\2"|g'
|
||||
done
|
||||
''
|
||||
+ lib.optionalString (targetPlatform.libc == "musl")
|
||||
''
|
||||
sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR'
|
||||
''
|
||||
))
|
||||
)
|
||||
+ lib.optionalString targetPlatform.isAvr ''
|
||||
makeFlagsArray+=(
|
||||
'LIMITS_H_TEST=false'
|
||||
)
|
||||
'';
|
||||
|
||||
inherit noSysDirs staticCompiler withoutTargetLibc
|
||||
libcCross crossMingw;
|
||||
|
||||
inherit (callFile ../common/dependencies.nix { })
|
||||
depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget;
|
||||
|
||||
NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm";
|
||||
|
||||
preConfigure = callFile ../common/pre-configure.nix { };
|
||||
|
||||
dontDisableStatic = true;
|
||||
|
||||
configurePlatforms = [ "build" "host" "target" ];
|
||||
|
||||
configureFlags = callFile ../common/configure-flags.nix { };
|
||||
|
||||
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
|
||||
|
||||
buildFlags = optional
|
||||
(targetPlatform == hostPlatform && hostPlatform == buildPlatform)
|
||||
(if profiledCompiler then "profiledbootstrap" else "bootstrap");
|
||||
|
||||
# https://gcc.gnu.org/PR109898
|
||||
enableParallelInstalling = false;
|
||||
|
||||
inherit (callFile ../common/strip-attributes.nix { })
|
||||
stripDebugList
|
||||
stripDebugListTarget
|
||||
preFixup;
|
||||
|
||||
# https://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
|
||||
${if hostPlatform.system == "x86_64-solaris" then "CC" else null} = "gcc -m64";
|
||||
|
||||
# Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the
|
||||
# library headers and binaries, regarless of the language being compiled.
|
||||
#
|
||||
# Likewise, the LTO code doesn't find zlib.
|
||||
#
|
||||
# Cross-compiling, we need gcc not to read ./specs in order to build the g++
|
||||
# compiler (after the specs for the cross-gcc are created). Having
|
||||
# LIBRARY_PATH= makes gcc read the specs from ., and the build breaks.
|
||||
|
||||
CPATH = optionals (targetPlatform == hostPlatform) (makeSearchPathOutput "dev" "include" ([]
|
||||
++ optional (zlib != null) zlib
|
||||
));
|
||||
|
||||
LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath (optional (zlib != null) zlib));
|
||||
|
||||
inherit (callFile ../common/extra-target-flags.nix { })
|
||||
EXTRA_FLAGS_FOR_TARGET
|
||||
EXTRA_LDFLAGS_FOR_TARGET
|
||||
;
|
||||
|
||||
passthru = {
|
||||
inherit langC langCC langObjC langObjCpp langFortran langGo version;
|
||||
isGNU = true;
|
||||
hardeningUnsupportedFlags = [ "fortify3" ];
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
inherit enableShared enableMultilib;
|
||||
|
||||
meta = {
|
||||
inherit (callFile ../common/meta.nix { })
|
||||
homepage
|
||||
license
|
||||
description
|
||||
longDescription
|
||||
platforms
|
||||
maintainers
|
||||
;
|
||||
badPlatforms = [ "aarch64-darwin" ];
|
||||
};
|
||||
}
|
||||
|
||||
// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
|
||||
))
|
||||
[
|
||||
(callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc enableShared; })
|
||||
]
|
@ -1,294 +0,0 @@
|
||||
{ lib, 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
|
||||
, reproducibleBuild ? true
|
||||
, profiledCompiler ? false
|
||||
, langJit ? false
|
||||
, staticCompiler ? false
|
||||
, enableShared ? stdenv.targetPlatform.hasSharedLibraries
|
||||
, enableLTO ? stdenv.hostPlatform.hasSharedLibraries
|
||||
, texinfo ? null
|
||||
, perl ? null # optional, for texi2pod (then pod2man)
|
||||
, gmp, mpfr, libmpc, gettext, which, patchelf, binutils
|
||||
, isl ? null # optional, for the Graphite optimization framework.
|
||||
, zlib ? null
|
||||
, gnat-bootstrap ? null
|
||||
, enableMultilib ? false
|
||||
, enablePlugin ? stdenv.hostPlatform == stdenv.buildPlatform # Whether to support user-supplied plug-ins
|
||||
, name ? "gcc"
|
||||
, libcCross ? null
|
||||
, threadsCross ? null # for MinGW
|
||||
, withoutTargetLibc ? false
|
||||
, gnused ? null
|
||||
, cloog # unused; just for compat with gcc4, as we override the parameter on some places
|
||||
, buildPackages
|
||||
, callPackage
|
||||
}:
|
||||
|
||||
# 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.
|
||||
|
||||
# Make sure we get GNU sed.
|
||||
assert stdenv.buildPlatform.isDarwin -> gnused != null;
|
||||
|
||||
# The go frontend is written in c++
|
||||
assert langGo -> langCC;
|
||||
assert langAda -> gnat-bootstrap != null;
|
||||
|
||||
# threadsCross is just for MinGW
|
||||
assert threadsCross != {} -> stdenv.targetPlatform.isWindows;
|
||||
|
||||
# profiledCompiler builds inject non-determinism in one of the compilation stages.
|
||||
# If turned on, we can't provide reproducible builds anymore
|
||||
assert reproducibleBuild -> profiledCompiler == false;
|
||||
|
||||
with lib;
|
||||
with builtins;
|
||||
|
||||
let majorVersion = "9";
|
||||
version = "${majorVersion}.5.0";
|
||||
|
||||
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
|
||||
|
||||
patches = [
|
||||
./fix-struct-redefinition-on-glibc-2.36.patch
|
||||
# Fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80431
|
||||
../fix-bug-80431.patch
|
||||
] ++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
|
||||
++ optional targetPlatform.isNetBSD ../libstdc++-netbsd-ctypes.patch
|
||||
++ optional noSysDirs ../no-sys-dirs.patch
|
||||
++ optional (noSysDirs && hostPlatform.isRiscV) ../no-sys-dirs-riscv-gcc9.patch
|
||||
/* ++ optional (hostPlatform != buildPlatform) (fetchpatch { # XXX: Refine when this should be applied
|
||||
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
|
||||
|
||||
# Obtain latest patch with ../update-mcfgthread-patches.sh
|
||||
++ optional (!withoutTargetLibc && targetPlatform.isMinGW && threadsCross.model == "mcf") ./Added-mcf-thread-model-support-from-mcfgthread.patch
|
||||
;
|
||||
|
||||
/* Cross-gcc settings (build == host != target) */
|
||||
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
|
||||
stageNameAddon = if withoutTargetLibc 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 gcc9.cc.override)" | jq '.[]' --raw-output'
|
||||
inherit
|
||||
binutils
|
||||
buildPackages
|
||||
cloog
|
||||
withoutTargetLibc
|
||||
enableLTO
|
||||
enableMultilib
|
||||
enablePlugin
|
||||
enableShared
|
||||
fetchpatch
|
||||
fetchurl
|
||||
gettext
|
||||
gmp
|
||||
gnat-bootstrap
|
||||
gnused
|
||||
isl
|
||||
langAda
|
||||
langC
|
||||
langCC
|
||||
langD
|
||||
langFortran
|
||||
langGo
|
||||
langJit
|
||||
langObjC
|
||||
langObjCpp
|
||||
lib
|
||||
libcCross
|
||||
libmpc
|
||||
mpfr
|
||||
name
|
||||
noSysDirs
|
||||
patchelf
|
||||
perl
|
||||
profiledCompiler
|
||||
reproducibleBuild
|
||||
staticCompiler
|
||||
stdenv
|
||||
targetPackages
|
||||
texinfo
|
||||
threadsCross
|
||||
which
|
||||
zip
|
||||
zlib
|
||||
;
|
||||
};
|
||||
|
||||
in
|
||||
|
||||
lib.pipe ((callFile ../common/builder.nix {}) ({
|
||||
pname = "${crossNameAddon}${name}";
|
||||
inherit version;
|
||||
|
||||
src = fetchurl {
|
||||
url = "mirror://gcc/releases/gcc-${version}/gcc-${version}.tar.xz";
|
||||
sha256 = "13ygjmd938m0wmy946pxdhz9i1wq7z4w10l6pvidak0xxxj9yxi7";
|
||||
};
|
||||
|
||||
inherit patches;
|
||||
|
||||
outputs = [ "out" "man" "info" ] ++ lib.optional (!langJit) "lib";
|
||||
setOutputFlags = false;
|
||||
NIX_NO_SELF_RPATH = true;
|
||||
|
||||
libc_dev = stdenv.cc.libc_dev;
|
||||
|
||||
hardeningDisable = [ "format" "pie" ];
|
||||
|
||||
postPatch = ''
|
||||
configureScripts=$(find . -name configure)
|
||||
for configureScript in $configureScripts; do
|
||||
patchShebangs $configureScript
|
||||
done
|
||||
''
|
||||
# This should kill all the stdinc frameworks that gcc and friends like to
|
||||
# insert into default search paths.
|
||||
+ lib.optionalString hostPlatform.isDarwin ''
|
||||
substituteInPlace gcc/config/darwin-c.c \
|
||||
--replace 'if (stdinc)' 'if (0)'
|
||||
|
||||
substituteInPlace libgcc/config/t-slibgcc-darwin \
|
||||
--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 ''${!outputLib}/lib/\\\$soname"
|
||||
''
|
||||
+ (
|
||||
lib.optionalString (targetPlatform != hostPlatform || stdenv.cc.libc != null)
|
||||
# On NixOS, use the right path to the dynamic linker instead of
|
||||
# `/lib/ld*.so'.
|
||||
(let
|
||||
libc = if libcCross != null then libcCross else stdenv.cc.libc;
|
||||
in
|
||||
(
|
||||
'' echo "fixing the \`GLIBC_DYNAMIC_LINKER', \`UCLIBC_DYNAMIC_LINKER', and \`MUSL_DYNAMIC_LINKER' macros..."
|
||||
for header in "gcc/config/"*-gnu.h "gcc/config/"*"/"*.h
|
||||
do
|
||||
grep -q _DYNAMIC_LINKER "$header" || continue
|
||||
echo " fixing \`$header'..."
|
||||
sed -i "$header" \
|
||||
-e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc.out}\3"|g' \
|
||||
-e 's|define[[:blank:]]*MUSL_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define MUSL_DYNAMIC_LINKER\1 "${libc.out}\2"|g'
|
||||
done
|
||||
''
|
||||
+ lib.optionalString (targetPlatform.libc == "musl")
|
||||
''
|
||||
sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR'
|
||||
''
|
||||
))
|
||||
)
|
||||
+ lib.optionalString targetPlatform.isAvr ''
|
||||
makeFlagsArray+=(
|
||||
'LIMITS_H_TEST=false'
|
||||
)
|
||||
'';
|
||||
|
||||
inherit noSysDirs staticCompiler withoutTargetLibc
|
||||
libcCross crossMingw;
|
||||
|
||||
inherit (callFile ../common/dependencies.nix { })
|
||||
depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget;
|
||||
|
||||
NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm";
|
||||
|
||||
preConfigure = callFile ../common/pre-configure.nix { };
|
||||
|
||||
dontDisableStatic = true;
|
||||
|
||||
configurePlatforms = [ "build" "host" "target" ];
|
||||
|
||||
configureFlags = callFile ../common/configure-flags.nix { };
|
||||
|
||||
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
|
||||
|
||||
buildFlags = optional
|
||||
(targetPlatform == hostPlatform && hostPlatform == buildPlatform)
|
||||
(if profiledCompiler then "profiledbootstrap" else "bootstrap");
|
||||
|
||||
# https://gcc.gnu.org/PR109898
|
||||
enableParallelInstalling = false;
|
||||
|
||||
inherit (callFile ../common/strip-attributes.nix { })
|
||||
stripDebugList
|
||||
stripDebugListTarget
|
||||
preFixup;
|
||||
|
||||
# https://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
|
||||
${if hostPlatform.system == "x86_64-solaris" then "CC" else null} = "gcc -m64";
|
||||
|
||||
# Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the
|
||||
# library headers and binaries, regarless of the language being compiled.
|
||||
#
|
||||
# Likewise, the LTO code doesn't find zlib.
|
||||
#
|
||||
# Cross-compiling, we need gcc not to read ./specs in order to build the g++
|
||||
# compiler (after the specs for the cross-gcc are created). Having
|
||||
# LIBRARY_PATH= makes gcc read the specs from ., and the build breaks.
|
||||
|
||||
CPATH = optionals (targetPlatform == hostPlatform) (makeSearchPathOutput "dev" "include" ([]
|
||||
++ optional (zlib != null) zlib
|
||||
));
|
||||
|
||||
LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath (optional (zlib != null) zlib));
|
||||
|
||||
inherit (callFile ../common/extra-target-flags.nix { })
|
||||
EXTRA_FLAGS_FOR_TARGET
|
||||
EXTRA_LDFLAGS_FOR_TARGET
|
||||
;
|
||||
|
||||
passthru = {
|
||||
inherit langC langCC langObjC langObjCpp langAda langFortran langGo langD version;
|
||||
isGNU = true;
|
||||
hardeningUnsupportedFlags = [ "fortify3" ];
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
inherit enableShared enableMultilib;
|
||||
|
||||
meta = {
|
||||
inherit (callFile ../common/meta.nix { })
|
||||
homepage
|
||||
license
|
||||
description
|
||||
longDescription
|
||||
platforms
|
||||
maintainers
|
||||
;
|
||||
badPlatforms = [ "aarch64-darwin" ];
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
// optionalAttrs (enableMultilib) { dontMoveLib64 = true; }
|
||||
)
|
||||
) [
|
||||
(callPackage ../common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc enableShared; })
|
||||
]
|
457
pkgs/development/compilers/gcc/default.nix
Normal file
457
pkgs/development/compilers/gcc/default.nix
Normal file
@ -0,0 +1,457 @@
|
||||
{ lib, 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
|
||||
, reproducibleBuild ? true
|
||||
, profiledCompiler ? false
|
||||
, langJit ? false
|
||||
, staticCompiler ? false
|
||||
, enableShared ? stdenv.targetPlatform.hasSharedLibraries
|
||||
, enableLTO ? stdenv.hostPlatform.hasSharedLibraries
|
||||
, texinfo ? null
|
||||
, perl ? null # optional, for texi2pod (then pod2man)
|
||||
, gmp, mpfr, libmpc, gettext, which, patchelf, binutils
|
||||
, isl ? null # optional, for the Graphite optimization framework.
|
||||
, zlib ? null
|
||||
, libucontext ? null
|
||||
, gnat-bootstrap ? null
|
||||
, enableMultilib ? false
|
||||
, enablePlugin ? stdenv.hostPlatform == stdenv.buildPlatform # Whether to support user-supplied plug-ins
|
||||
, name ? "gcc"
|
||||
, libcCross ? null
|
||||
, threadsCross ? null # for MinGW
|
||||
, withoutTargetLibc ? false
|
||||
, gnused ? null
|
||||
, cloog # unused; just for compat with gcc4, as we override the parameter on some places
|
||||
, buildPackages
|
||||
, libxcrypt
|
||||
, disableGdbPlugin ? !enablePlugin
|
||||
, nukeReferences
|
||||
, callPackage
|
||||
, majorMinorVersion
|
||||
|
||||
# only for gcc<=6.x
|
||||
, langJava ? false
|
||||
, flex
|
||||
, boehmgc ? null
|
||||
, zip ? null, unzip ? null, pkg-config ? null
|
||||
, gtk2 ? null, libart_lgpl ? null
|
||||
, libX11 ? null, libXt ? null, libSM ? null, libICE ? null, libXtst ? null
|
||||
, libXrender ? null, xorgproto ? null
|
||||
, libXrandr ? null, libXi ? null
|
||||
, x11Support ? langJava
|
||||
}:
|
||||
|
||||
let
|
||||
version = {
|
||||
"13" = "13.2.0";
|
||||
"12" = "12.3.0";
|
||||
"11" = "11.4.0";
|
||||
"10" = "10.5.0";
|
||||
"9" = "9.5.0";
|
||||
"8" = "8.5.0";
|
||||
"7" = "7.5.0";
|
||||
"6" = "6.5.0";
|
||||
"4.9"= "4.9.4";
|
||||
"4.8"= "4.8.5";
|
||||
}."${majorMinorVersion}";
|
||||
|
||||
majorVersion = lib.versions.major version;
|
||||
atLeast13 = lib.versionAtLeast version "13";
|
||||
atLeast12 = lib.versionAtLeast version "12";
|
||||
atLeast11 = lib.versionAtLeast version "11";
|
||||
atLeast10 = lib.versionAtLeast version "10";
|
||||
atLeast9 = lib.versionAtLeast version "9";
|
||||
atLeast8 = lib.versionAtLeast version "8";
|
||||
atLeast7 = lib.versionAtLeast version "7";
|
||||
atLeast6 = lib.versionAtLeast version "6";
|
||||
atLeast49 = lib.versionAtLeast version "4.9";
|
||||
is13 = majorVersion == "13";
|
||||
is12 = majorVersion == "12";
|
||||
is11 = majorVersion == "11";
|
||||
is10 = majorVersion == "10";
|
||||
is9 = majorVersion == "9";
|
||||
is8 = majorVersion == "8";
|
||||
is7 = majorVersion == "7";
|
||||
is6 = majorVersion == "6";
|
||||
is49 = majorVersion == "4" && lib.versions.minor version == "9";
|
||||
is48 = majorVersion == "4" && lib.versions.minor version == "8";
|
||||
in
|
||||
|
||||
# We enable the isl cloog backend.
|
||||
assert !atLeast6 -> (cloog != null -> isl != null);
|
||||
|
||||
assert langJava -> !atLeast7 && zip != null && unzip != null && zlib != null && boehmgc != null && perl != null; # for `--enable-java-home'
|
||||
|
||||
# Make sure we get GNU sed.
|
||||
assert stdenv.buildPlatform.isDarwin -> gnused != null;
|
||||
|
||||
# The go frontend is written in c++
|
||||
assert langGo -> langCC;
|
||||
assert (atLeast6 && !is7 && !is8) -> (langAda -> gnat-bootstrap != null);
|
||||
|
||||
# TODO: fixup D bootstapping, probably by using gdc11 (and maybe other changes).
|
||||
# error: GDC is required to build d
|
||||
assert atLeast12 -> !langD;
|
||||
|
||||
# threadsCross is just for MinGW
|
||||
assert threadsCross != {} -> stdenv.targetPlatform.isWindows;
|
||||
|
||||
# profiledCompiler builds inject non-determinism in one of the compilation stages.
|
||||
# If turned on, we can't provide reproducible builds anymore
|
||||
assert reproducibleBuild -> profiledCompiler == false;
|
||||
|
||||
with lib;
|
||||
with builtins;
|
||||
|
||||
let inherit version;
|
||||
disableBootstrap = atLeast11 && !stdenv.hostPlatform.isDarwin && (atLeast12 -> !profiledCompiler);
|
||||
|
||||
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
|
||||
|
||||
patches = callFile ./patches {};
|
||||
|
||||
/* Cross-gcc settings (build == host != target) */
|
||||
crossMingw = targetPlatform != hostPlatform && targetPlatform.libc == "msvcrt";
|
||||
stageNameAddon = if withoutTargetLibc then "stage-static" else "stage-final";
|
||||
crossNameAddon = optionalString (targetPlatform != hostPlatform) "${targetPlatform.config}-${stageNameAddon}-";
|
||||
|
||||
javaAwtGtk = langJava && x11Support;
|
||||
xlibs = [
|
||||
libX11 libXt libSM libICE libXtst libXrender libXrandr libXi
|
||||
xorgproto
|
||||
];
|
||||
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 gcc${majorVersion}.cc.override)" | jq '.[]' --raw-output'
|
||||
inherit
|
||||
binutils
|
||||
buildPackages
|
||||
cloog
|
||||
withoutTargetLibc
|
||||
disableBootstrap
|
||||
disableGdbPlugin
|
||||
enableLTO
|
||||
enableMultilib
|
||||
enablePlugin
|
||||
enableShared
|
||||
fetchpatch
|
||||
fetchurl
|
||||
gettext
|
||||
gmp
|
||||
gnat-bootstrap
|
||||
gnused
|
||||
isl
|
||||
langAda
|
||||
langC
|
||||
langCC
|
||||
langD
|
||||
langFortran
|
||||
langGo
|
||||
langJit
|
||||
langObjC
|
||||
langObjCpp
|
||||
lib
|
||||
libcCross
|
||||
libmpc
|
||||
libucontext
|
||||
libxcrypt
|
||||
mpfr
|
||||
name
|
||||
noSysDirs
|
||||
nukeReferences
|
||||
patchelf
|
||||
perl
|
||||
profiledCompiler
|
||||
reproducibleBuild
|
||||
staticCompiler
|
||||
stdenv
|
||||
targetPackages
|
||||
texinfo
|
||||
threadsCross
|
||||
which
|
||||
zip
|
||||
zlib
|
||||
;
|
||||
} // lib.optionalAttrs (!atLeast7) {
|
||||
inherit
|
||||
boehmgc
|
||||
flex
|
||||
gnat-bootstrap
|
||||
gtk2
|
||||
langAda
|
||||
langJava
|
||||
libICE
|
||||
libSM
|
||||
libX11
|
||||
libXi
|
||||
libXrandr
|
||||
libXrender
|
||||
libXt
|
||||
libXtst
|
||||
libart_lgpl
|
||||
pkg-config
|
||||
unzip
|
||||
x11Support
|
||||
xorgproto
|
||||
javaAwtGtk
|
||||
xlibs
|
||||
;
|
||||
javaEcj = fetchurl {
|
||||
# The `$(top_srcdir)/ecj.jar' file is automatically picked up at
|
||||
# `configure' time.
|
||||
|
||||
# XXX: Eventually we might want to take it from upstream.
|
||||
url = "ftp://sourceware.org/pub/java/ecj-4.3.jar";
|
||||
sha256 = "0jz7hvc0s6iydmhgh5h2m15yza7p2rlss2vkif30vm9y77m97qcx";
|
||||
};
|
||||
|
||||
# Antlr (optional) allows the Java `gjdoc' tool to be built. We want a
|
||||
# binary distribution here to allow the whole chain to be bootstrapped.
|
||||
javaAntlr = fetchurl {
|
||||
url = "https://www.antlr.org/download/antlr-4.4-complete.jar";
|
||||
sha256 = "02lda2imivsvsis8rnzmbrbp8rh1kb8vmq4i67pqhkwz7lf8y6dz";
|
||||
};
|
||||
});
|
||||
|
||||
in
|
||||
|
||||
# We need all these X libraries when building AWT with GTK.
|
||||
assert !atLeast7 -> (x11Support -> (filter (x: x == null) ([ gtk2 libart_lgpl ] ++ xlibs)) == []);
|
||||
|
||||
lib.pipe ((callFile ./common/builder.nix {}) ({
|
||||
pname = "${crossNameAddon}${name}";
|
||||
inherit version;
|
||||
|
||||
src = if is6 && stdenv.targetPlatform.isVc4 then fetchFromGitHub {
|
||||
owner = "itszor";
|
||||
repo = "gcc-vc4";
|
||||
rev = "e90ff43f9671c760cf0d1dd62f569a0fb9bf8918";
|
||||
sha256 = "0gxf66hwqk26h8f853sybphqa5ca0cva2kmrw5jsiv6139g0qnp8";
|
||||
} else if is6 && stdenv.targetPlatform.isRedox then fetchFromGitHub {
|
||||
owner = "redox-os";
|
||||
repo = "gcc";
|
||||
rev = "f360ac095028d286fc6dde4d02daed48f59813fa"; # `redox` branch
|
||||
sha256 = "1an96h8l58pppyh3qqv90g8hgcfd9hj7igvh2gigmkxbrx94khfl";
|
||||
} else fetchurl {
|
||||
url = if atLeast7
|
||||
then "mirror://gcc/releases/gcc-${version}/gcc-${version}.tar.xz"
|
||||
else if atLeast6
|
||||
then "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.xz"
|
||||
else "mirror://gnu/gcc/gcc-${version}/gcc-${version}.tar.bz2";
|
||||
${if is10 || is11 || is13 then "hash" else "sha256"} = {
|
||||
"13.2.0" = "sha256-4nXnZEKmBnNBon8Exca4PYYTFEAEwEE1KIY9xrXHQ9o=";
|
||||
"12.3.0" = "sha256-lJpdT5nnhkIak7Uysi/6tVeN5zITaZdbka7Jet/ajDs=";
|
||||
"11.4.0" = "sha256-Py2yIrAH6KSiPNW6VnJu8I6LHx6yBV7nLBQCzqc6jdk=";
|
||||
"10.5.0" = "sha256-JRCVQ/30bzl8NHtdi3osflaUpaUczkucbh6opxyjB8E=";
|
||||
"9.5.0" = "13ygjmd938m0wmy946pxdhz9i1wq7z4w10l6pvidak0xxxj9yxi7";
|
||||
"8.5.0" = "0l7d4m9jx124xsk6xardchgy2k5j5l2b15q322k31f0va4d8826k";
|
||||
"7.5.0" = "0qg6kqc5l72hpnj4vr6l0p69qav0rh4anlkk3y55540zy3klc6dq";
|
||||
"6.5.0" = "0i89fksfp6wr1xg9l8296aslcymv2idn60ip31wr9s4pwin7kwby";
|
||||
"4.9.4" = "14l06m7nvcvb0igkbip58x59w3nq6315k6jcz3wr9ch1rn9d44bc";
|
||||
"4.8.5" = "08yggr18v373a1ihj0rg2vd6psnic42b518xcgp3r9k81xz1xyr2";
|
||||
}."${version}";
|
||||
};
|
||||
|
||||
inherit patches;
|
||||
|
||||
outputs =
|
||||
if atLeast7
|
||||
then [ "out" "man" "info" ] ++ lib.optional (!langJit) "lib"
|
||||
else if atLeast49 && (langJava || langGo || (if atLeast6 then langJit else targetPlatform.isDarwin)) then ["out" "man" "info"]
|
||||
else [ "out" "lib" "man" "info" ];
|
||||
|
||||
setOutputFlags = false;
|
||||
NIX_NO_SELF_RPATH = true;
|
||||
|
||||
libc_dev = stdenv.cc.libc_dev;
|
||||
|
||||
hardeningDisable = [ "format" "pie" ]
|
||||
++ lib.optionals (is11 && langAda) [ "fortify3" ];
|
||||
|
||||
postPatch = lib.optionalString atLeast7 ''
|
||||
configureScripts=$(find . -name configure)
|
||||
for configureScript in $configureScripts; do
|
||||
patchShebangs $configureScript
|
||||
done
|
||||
''
|
||||
# This should kill all the stdinc frameworks that gcc and friends like to
|
||||
# insert into default search paths.
|
||||
+ lib.optionalString (atLeast6 && hostPlatform.isDarwin) ''
|
||||
substituteInPlace gcc/config/darwin-c.c${lib.optionalString atLeast12 "c"} \
|
||||
--replace 'if (stdinc)' 'if (0)'
|
||||
|
||||
substituteInPlace libgcc/config/t-slibgcc-darwin \
|
||||
--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 ''${!outputLib}/lib/\\\$soname"
|
||||
''
|
||||
+ (
|
||||
lib.optionalString (targetPlatform != hostPlatform || stdenv.cc.libc != null)
|
||||
# On NixOS, use the right path to the dynamic linker instead of
|
||||
# `/lib/ld*.so'.
|
||||
(let
|
||||
libc = if libcCross != null then libcCross else stdenv.cc.libc;
|
||||
in
|
||||
(
|
||||
'' echo "fixing the \`GLIBC_DYNAMIC_LINKER'${lib.optionalString atLeast6 ", \\`UCLIBC_DYNAMIC_LINKER',"} and \`${if atLeast6 then "MUSL" else "UCLIBC"}_DYNAMIC_LINKER' macros..."
|
||||
for header in "gcc/config/"*-gnu.h "gcc/config/"*"/"*.h
|
||||
do
|
||||
grep -q ${lib.optionalString (!atLeast6) "LIBC"}_DYNAMIC_LINKER "$header" || continue
|
||||
echo " fixing \`$header'..."
|
||||
sed -i "$header" \
|
||||
-e 's|define[[:blank:]]*\([UCG]\+\)LIBC_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define \1LIBC_DYNAMIC_LINKER\2 "${libc.out}\3"|g'${lib.optionalString atLeast6 " \\"}
|
||||
'' + lib.optionalString atLeast6 ''
|
||||
${""} -e 's|define[[:blank:]]*MUSL_DYNAMIC_LINKER\([0-9]*\)[[:blank:]]"\([^\"]\+\)"$|define MUSL_DYNAMIC_LINKER\1 "${libc.out}\2"|g'
|
||||
'' + ''
|
||||
${""} done
|
||||
'' + lib.optionalString (atLeast6 && targetPlatform.libc == "musl") ''
|
||||
sed -i gcc/config/linux.h -e '1i#undef LOCAL_INCLUDE_DIR'
|
||||
''
|
||||
)
|
||||
))
|
||||
+ lib.optionalString (atLeast7 && targetPlatform.isAvr) (''
|
||||
makeFlagsArray+=(
|
||||
'' + (lib.optionalString atLeast10 ''
|
||||
'-s' # workaround for hitting hydra log limit
|
||||
'') + ''
|
||||
'LIMITS_H_TEST=false'
|
||||
)
|
||||
'');
|
||||
|
||||
inherit noSysDirs staticCompiler withoutTargetLibc
|
||||
libcCross crossMingw;
|
||||
|
||||
inherit (callFile ./common/dependencies.nix { }) depsBuildBuild nativeBuildInputs depsBuildTarget buildInputs depsTargetTarget;
|
||||
|
||||
preConfigure = (callFile ./common/pre-configure.nix { }) + lib.optionalString atLeast10 ''
|
||||
ln -sf ${libxcrypt}/include/crypt.h libsanitizer/sanitizer_common/crypt.h
|
||||
'';
|
||||
|
||||
dontDisableStatic = true;
|
||||
|
||||
configurePlatforms = [ "build" "host" "target" ];
|
||||
|
||||
configureFlags = (callFile ./common/configure-flags.nix { })
|
||||
++ optional (is7 && targetPlatform.isAarch64) "--enable-fix-cortex-a53-843419"
|
||||
++ optional (is7 && targetPlatform.isNetBSD) "--disable-libcilkrts";
|
||||
|
||||
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
|
||||
|
||||
buildFlags =
|
||||
# we do not yet have Nix-driven profiling
|
||||
assert atLeast12 -> (profiledCompiler -> !disableBootstrap);
|
||||
if atLeast11
|
||||
then let target =
|
||||
lib.optionalString (profiledCompiler) "profiled" +
|
||||
lib.optionalString (targetPlatform == hostPlatform && hostPlatform == buildPlatform && !disableBootstrap) "bootstrap";
|
||||
in lib.optional (target != "") target
|
||||
else
|
||||
optional
|
||||
(targetPlatform == hostPlatform && hostPlatform == buildPlatform)
|
||||
(if profiledCompiler then "profiledbootstrap" else "bootstrap");
|
||||
|
||||
inherit (callFile ./common/strip-attributes.nix { })
|
||||
stripDebugList
|
||||
stripDebugListTarget
|
||||
preFixup;
|
||||
|
||||
# https://gcc.gnu.org/PR109898
|
||||
enableParallelInstalling = false;
|
||||
|
||||
# https://gcc.gnu.org/install/specific.html#x86-64-x-solaris210
|
||||
${if hostPlatform.system == "x86_64-solaris" then "CC" else null} = "gcc -m64";
|
||||
|
||||
# Setting $CPATH and $LIBRARY_PATH to make sure both `gcc' and `xgcc' find the
|
||||
# library headers and binaries, regarless of the language being compiled.
|
||||
#
|
||||
# Note: When building the Java AWT GTK peer, the build system doesn't honor
|
||||
# `--with-gmp' et al., e.g., when building
|
||||
# `libjava/classpath/native/jni/java-math/gnu_java_math_GMP.c', so we just add
|
||||
# them to $CPATH and $LIBRARY_PATH in this case.
|
||||
#
|
||||
# Likewise, the LTO code doesn't find zlib.
|
||||
#
|
||||
# Cross-compiling, we need gcc not to read ./specs in order to build the g++
|
||||
# compiler (after the specs for the cross-gcc are created). Having
|
||||
# LIBRARY_PATH= makes gcc read the specs from ., and the build breaks.
|
||||
|
||||
CPATH = optionals (targetPlatform == hostPlatform) (makeSearchPathOutput "dev" "include" ([]
|
||||
++ optional (zlib != null) zlib
|
||||
++ optional langJava boehmgc
|
||||
++ optionals javaAwtGtk xlibs
|
||||
++ optionals javaAwtGtk [ gmp mpfr ]
|
||||
));
|
||||
|
||||
LIBRARY_PATH = optionals (targetPlatform == hostPlatform) (makeLibraryPath (
|
||||
optional (zlib != null) zlib
|
||||
++ optional langJava boehmgc
|
||||
++ optionals javaAwtGtk xlibs
|
||||
++ optionals javaAwtGtk [ gmp mpfr ]
|
||||
));
|
||||
|
||||
inherit (callFile ./common/extra-target-flags.nix { })
|
||||
EXTRA_FLAGS_FOR_TARGET
|
||||
EXTRA_LDFLAGS_FOR_TARGET
|
||||
;
|
||||
|
||||
passthru = {
|
||||
inherit langC langCC langObjC langObjCpp langAda langFortran langGo langD version;
|
||||
isGNU = true;
|
||||
} // lib.optionalAttrs (!atLeast12) {
|
||||
hardeningUnsupportedFlags = lib.optionals is48 [ "stackprotector" ] ++ [ "fortify3" ];
|
||||
};
|
||||
|
||||
enableParallelBuilding = true;
|
||||
inherit enableShared enableMultilib;
|
||||
|
||||
meta = {
|
||||
inherit (callFile ./common/meta.nix { })
|
||||
homepage
|
||||
license
|
||||
description
|
||||
longDescription
|
||||
platforms
|
||||
maintainers
|
||||
;
|
||||
} // lib.optionalAttrs (!atLeast11) {
|
||||
badPlatforms = if !is49 then [ "aarch64-darwin" ] else lib.platforms.darwin;
|
||||
};
|
||||
} // optionalAttrs is7 {
|
||||
env.NIX_CFLAGS_COMPILE = lib.optionalString (stdenv.cc.isClang && langFortran) "-Wno-unused-command-line-argument";
|
||||
} // optionalAttrs (!atLeast7) {
|
||||
env.langJava = langJava;
|
||||
} // optionalAttrs atLeast6 {
|
||||
NIX_LDFLAGS = lib.optionalString hostPlatform.isSunOS "-lm";
|
||||
} // optionalAttrs (!atLeast8) {
|
||||
doCheck = false; # requires a lot of tools, causes a dependency cycle for stdenv
|
||||
} // optionalAttrs enableMultilib {
|
||||
dontMoveLib64 = true;
|
||||
} // optionalAttrs (((is49 && !stdenv.hostPlatform.isDarwin) || is6) && langJava) {
|
||||
postFixup = ''
|
||||
target="$(echo "$out/libexec/gcc"/*/*/ecj*)"
|
||||
patchelf --set-rpath "$(patchelf --print-rpath "$target"):$out/lib" "$target"
|
||||
'';
|
||||
}
|
||||
))
|
||||
([
|
||||
(callPackage ./common/libgcc.nix { inherit version langC langCC langJit targetPlatform hostPlatform withoutTargetLibc enableShared; })
|
||||
] ++ optionals atLeast11 [
|
||||
(callPackage ./common/checksum.nix { inherit langC langCC; })
|
||||
])
|
||||
|
245
pkgs/development/compilers/gcc/patches/default.nix
Normal file
245
pkgs/development/compilers/gcc/patches/default.nix
Normal file
@ -0,0 +1,245 @@
|
||||
{ lib, stdenv
|
||||
, langC
|
||||
, langAda
|
||||
, langObjC
|
||||
, langObjCpp
|
||||
, langD
|
||||
, langFortran
|
||||
, langGo
|
||||
, reproducibleBuild
|
||||
, profiledCompiler
|
||||
, langJit
|
||||
, staticCompiler
|
||||
, enableShared
|
||||
, enableLTO
|
||||
, version
|
||||
, fetchpatch
|
||||
, majorVersion
|
||||
, targetPlatform
|
||||
, hostPlatform
|
||||
, noSysDirs
|
||||
, buildPlatform
|
||||
, fetchurl
|
||||
, withoutTargetLibc
|
||||
, threadsCross
|
||||
}:
|
||||
|
||||
let
|
||||
atLeast13 = lib.versionAtLeast version "13";
|
||||
atLeast12 = lib.versionAtLeast version "12";
|
||||
atLeast11 = lib.versionAtLeast version "11";
|
||||
atLeast10 = lib.versionAtLeast version "10";
|
||||
atLeast9 = lib.versionAtLeast version "9";
|
||||
atLeast8 = lib.versionAtLeast version "8";
|
||||
atLeast7 = lib.versionAtLeast version "7";
|
||||
atLeast6 = lib.versionAtLeast version "6";
|
||||
atLeast49 = lib.versionAtLeast version "4.9";
|
||||
is13 = majorVersion == "13";
|
||||
is12 = majorVersion == "12";
|
||||
is11 = majorVersion == "11";
|
||||
is10 = majorVersion == "10";
|
||||
is9 = majorVersion == "9";
|
||||
is8 = majorVersion == "8";
|
||||
is7 = majorVersion == "7";
|
||||
is6 = majorVersion == "6";
|
||||
is49 = majorVersion == "4" && lib.versions.minor version == "9";
|
||||
is48 = majorVersion == "4" && lib.versions.minor version == "8";
|
||||
inherit (lib) optionals optional;
|
||||
in
|
||||
|
||||
optionals (is49 || is6) [
|
||||
./9/fix-struct-redefinition-on-glibc-2.36.patch
|
||||
] ++ optionals (is49 || (is6 && !stdenv.targetPlatform.isRedox)) [
|
||||
./use-source-date-epoch.patch
|
||||
] ++ optionals (is6 && !stdenv.targetPlatform.isRedox) [
|
||||
./6/0001-Fix-build-for-glibc-2.31.patch
|
||||
] ++ optionals (!atLeast6) [
|
||||
./parallel-bconfig.patch
|
||||
] ++ optionals (is49) [
|
||||
(./. + "/${lib.versions.major version}.${lib.versions.minor version}/parallel-strsignal.patch")
|
||||
(./. + "/${lib.versions.major version}.${lib.versions.minor version}/libsanitizer.patch")
|
||||
(fetchpatch {
|
||||
name = "avoid-ustat-glibc-2.28.patch";
|
||||
url = "https://gitweb.gentoo.org/proj/gcc-patches.git/plain/4.9.4/gentoo/100_all_avoid-ustat-glibc-2.28.patch?id=55fcb515620a8f7d3bb77eba938aa0fcf0d67c96";
|
||||
sha256 = "0b32sb4psv5lq0ij9fwhi1b4pjbwdjnv24nqprsk14dsc6xmi1g0";
|
||||
})
|
||||
] ++ optionals (is7) [
|
||||
# https://gcc.gnu.org/ml/gcc-patches/2018-02/msg00633.html
|
||||
(./. + "/${majorVersion}/riscv-pthread-reentrant.patch")
|
||||
# https://gcc.gnu.org/ml/gcc-patches/2018-03/msg00297.html
|
||||
(./. + "/${majorVersion}/riscv-no-relax.patch")
|
||||
# Fix for asan w/glibc-2.34. Although there's no upstream backport to v7,
|
||||
# the patch from gcc 8 seems to work perfectly fine.
|
||||
(./. + "/${majorVersion}/gcc8-asan-glibc-2.34.patch")
|
||||
(./. + "/${majorVersion}/0001-Fix-build-for-glibc-2.31.patch")
|
||||
] ++ optional (majorVersion == "9") ./9/fix-struct-redefinition-on-glibc-2.36.patch
|
||||
++ optional (atLeast6 && !atLeast12) ./fix-bug-80431.patch
|
||||
++ optional (is7 || is8) ./9/fix-struct-redefinition-on-glibc-2.36.patch
|
||||
++ optional (targetPlatform != hostPlatform) ./libstdc++-target.patch
|
||||
++ optional (atLeast7 && !atLeast10 && targetPlatform.isNetBSD) ./libstdc++-netbsd-ctypes.patch
|
||||
++ optional (noSysDirs) (if atLeast12 then ./gcc-12-no-sys-dirs.patch else ./no-sys-dirs.patch)
|
||||
++ optionals (is6 && langAda) [
|
||||
./gnat-cflags.patch
|
||||
./6/gnat-glibc234.patch
|
||||
] ++ optional (noSysDirs && atLeast10 && !atLeast13 && (is10 || (!atLeast12 -> hostPlatform.isRiscV))) ./no-sys-dirs-riscv.patch
|
||||
++ optional (noSysDirs && is13) ./13/no-sys-dirs-riscv.patch
|
||||
++ optional (noSysDirs && is9 && hostPlatform.isRiscV) ./no-sys-dirs-riscv-gcc9.patch
|
||||
++ optionals (langAda || atLeast12) [
|
||||
./gnat-cflags-11.patch
|
||||
] ++ optionals (langAda && (is9 || is10)) [
|
||||
./gnat-cflags.patch
|
||||
] ++ optionals atLeast12 [
|
||||
./gcc-12-gfortran-driving.patch
|
||||
./ppc-musl.patch
|
||||
] ++ optionals is12 [
|
||||
# backport ICE fix on ccache code
|
||||
./12/lambda-ICE-PR109241.patch
|
||||
]
|
||||
# We only apply this patch when building a native toolchain for aarch64-darwin, as it breaks building
|
||||
# a foreign one: https://github.com/iains/gcc-12-branch/issues/18
|
||||
++ optionals (stdenv.isDarwin && stdenv.isAarch64 && buildPlatform == hostPlatform && hostPlatform == targetPlatform) ({
|
||||
"13" = [ (fetchpatch {
|
||||
name = "gcc-13-darwin-aarch64-support.patch";
|
||||
url = "https://raw.githubusercontent.com/Homebrew/formula-patches/3c5cbc8e9cf444a1967786af48e430588e1eb481/gcc/gcc-13.2.0.diff";
|
||||
sha256 = "sha256-Y5r3U3dwAFG6+b0TNCFd18PNxYu2+W/5zDbZ5cHvv+U=";
|
||||
}) ];
|
||||
"12" = [ (fetchurl {
|
||||
name = "gcc-12-darwin-aarch64-support.patch";
|
||||
url = "https://raw.githubusercontent.com/Homebrew/formula-patches/f1188b90d610e2ed170b22512ff7435ba5c891e2/gcc/gcc-12.3.0.diff";
|
||||
sha256 = "sha256-naL5ZNiurqfDBiPSU8PTbTmLqj25B+vjjiqc4fAFgYs=";
|
||||
}) ];
|
||||
}."${majorVersion}" or [])
|
||||
++ optional (atLeast9 && langD) ./libphobos.patch
|
||||
++ optional (is7 && hostPlatform != buildPlatform) (fetchpatch { # XXX: Refine when this should be applied
|
||||
url = "https://git.busybox.net/buildroot/plain/package/gcc/7.1.0/0900-remove-selftests.patch?id=11271540bfe6adafbc133caf6b5b902a816f5f02";
|
||||
sha256 = "0mrvxsdwip2p3l17dscpc1x8vhdsciqw1z5q9i6p5g9yg1cqnmgs";
|
||||
})
|
||||
++ optional (!atLeast12 && langFortran) ./gfortran-driving.patch
|
||||
++ optional (!atLeast49 && hostPlatform.isDarwin) ./gfortran-darwin-NXConstStr.patch
|
||||
++ optionals (is49) [
|
||||
# glibc-2.26
|
||||
./struct-ucontext.patch
|
||||
./struct-sigaltstack-4.9.patch
|
||||
]
|
||||
# TODO: deduplicate this with copy above -- leaving duplicated for now in order to avoid changing eval results by reordering
|
||||
++ optional (atLeast7 && !atLeast12 && targetPlatform.libc == "musl" && targetPlatform.isPower) ./ppc-musl.patch
|
||||
++ optional ((is6 || is7) && targetPlatform.libc == "musl" && targetPlatform.isx86_32) (fetchpatch {
|
||||
url = "https://git.alpinelinux.org/aports/plain/main/gcc/gcc-6.1-musl-libssp.patch?id=5e4b96e23871ee28ef593b439f8c07ca7c7eb5bb";
|
||||
sha256 = "1jf1ciz4gr49lwyh8knfhw6l5gvfkwzjy90m7qiwkcbsf4a3fqn2";
|
||||
})
|
||||
++ optional ((is6 || is7 || is8) && !atLeast9 && targetPlatform.libc == "musl") ./libgomp-dont-force-initial-exec.patch
|
||||
++ optional (is6 && langGo) ./gogcc-workaround-glibc-2.36.patch
|
||||
# TODO: deduplicate this with copy above -- leaving duplicated for now in order to avoid changing eval results by reordering
|
||||
++ optionals (is11 && stdenv.isDarwin) [
|
||||
(fetchpatch {
|
||||
# There are no upstream release tags in https://github.com/iains/gcc-11-branch.
|
||||
# ff4bf32 is the commit from https://github.com/gcc-mirror/gcc/releases/tag/releases%2Fgcc-11.4.0
|
||||
url = "https://github.com/iains/gcc-11-branch/compare/ff4bf326d03e750a8d4905ea49425fe7d15a04b8..gcc-11.4-darwin-r0.diff";
|
||||
hash = "sha256-6prPgR2eGVJs7vKd6iM1eZsEPCD1ShzLns2Z+29vlt4=";
|
||||
})
|
||||
]
|
||||
# https://github.com/osx-cross/homebrew-avr/issues/280#issuecomment-1272381808
|
||||
++ optional (is11 && stdenv.isDarwin && targetPlatform.isAvr) ./avr-gcc-11.3-darwin.patch
|
||||
|
||||
# backport fixes to build gccgo with musl libc
|
||||
++ optionals (atLeast12 && langGo && stdenv.hostPlatform.isMusl) [
|
||||
(fetchpatch {
|
||||
excludes = [ "gcc/go/gofrontend/MERGE" ];
|
||||
url = "https://github.com/gcc-mirror/gcc/commit/cf79b1117bd177d3d4c6ed24b6fa243c3628ac2d.diff";
|
||||
hash = "sha256-mS5ZiYi5D8CpGXrWg3tXlbhp4o86ew1imCTwaHLfl+I=";
|
||||
})
|
||||
(fetchpatch {
|
||||
excludes = [ "gcc/go/gofrontend/MERGE" ];
|
||||
url = "https://github.com/gcc-mirror/gcc/commit/7f195a2270910a6ed08bd76e3a16b0a6503f9faf.diff";
|
||||
hash = "sha256-Ze/cFM0dQofKH00PWPDoklXUlwWhwA1nyTuiDAZ6FKo=";
|
||||
})
|
||||
(fetchpatch {
|
||||
excludes = [ "gcc/go/gofrontend/MERGE" ];
|
||||
url = "https://github.com/gcc-mirror/gcc/commit/762fd5e5547e464e25b4bee435db6df4eda0de90.diff";
|
||||
hash = "sha256-o28upwTcHAnHG2Iq0OewzwSBEhHs+XpBGdIfZdT81pk=";
|
||||
})
|
||||
(fetchpatch {
|
||||
excludes = [ "gcc/go/gofrontend/MERGE" ];
|
||||
url = "https://github.com/gcc-mirror/gcc/commit/e73d9fcafbd07bc3714fbaf8a82db71d50015c92.diff";
|
||||
hash = "sha256-1SjYCVHLEUihdON2TOC3Z2ufM+jf2vH0LvYtZL+c1Fo=";
|
||||
})
|
||||
(fetchpatch {
|
||||
excludes = [ "gcc/go/gofrontend/MERGE" ];
|
||||
url = "https://github.com/gcc-mirror/gcc/commit/b6c6a3d64f2e4e9347733290aca3c75898c44b2e.diff";
|
||||
hash = "sha256-RycJ3YCHd3MXtYFjxP0zY2Wuw7/C4bWoBAQtTKJZPOQ=";
|
||||
})
|
||||
(fetchpatch {
|
||||
excludes = [ "gcc/go/gofrontend/MERGE" ];
|
||||
url = "https://github.com/gcc-mirror/gcc/commit/2b1a604a9b28fbf4f382060bebd04adb83acc2f9.diff";
|
||||
hash = "sha256-WiBQG0Xbk75rHk+AMDvsbrm+dc7lDH0EONJXSdEeMGE=";
|
||||
})
|
||||
(fetchpatch {
|
||||
url = "https://github.com/gcc-mirror/gcc/commit/c86b726c048eddc1be320c0bf64a897658bee13d.diff";
|
||||
hash = "sha256-QSIlqDB6JRQhbj/c3ejlmbfWz9l9FurdSWxpwDebnlI=";
|
||||
})
|
||||
]
|
||||
|
||||
# Fix detection of bootstrap compiler Ada support (cctools as) on Nix Darwin
|
||||
++ optional (atLeast12 && stdenv.isDarwin && langAda) ./ada-cctools-as-detection-configure.patch
|
||||
|
||||
# Use absolute path in GNAT dylib install names on Darwin
|
||||
++ optional (atLeast12 && stdenv.isDarwin && langAda) ./gnat-darwin-dylib-install-name.patch
|
||||
|
||||
# Obtain latest patch with ../update-mcfgthread-patches.sh
|
||||
++ optional (atLeast6 && !atLeast13 && !withoutTargetLibc && targetPlatform.isMinGW && threadsCross.model == "mcf")
|
||||
(./. + "/${majorVersion}/Added-mcf-thread-model-support-from-mcfgthread.patch")
|
||||
|
||||
# Retpoline patches pulled from the branch hjl/indirect/gcc-4_9-branch (by H.J. Lu, the author of GCC upstream retpoline commits)
|
||||
++ optionals is49
|
||||
(builtins.map ({commit, sha256}: fetchpatch {url = "https://github.com/hjl-tools/gcc/commit/${commit}.patch"; inherit sha256;})
|
||||
[{ commit = "e623d21608e96ecd6b65f0d06312117d20488a38"; sha256 = "1ix8i4d2r3ygbv7npmsdj790rhxqrnfwcqzv48b090r9c3ij8ay3"; }
|
||||
{ commit = "2015a09e332309f12de1dadfe179afa6a29368b8"; sha256 = "0xcfs0cbb63llj2gbcdrvxim79ax4k4aswn0a3yjavxsj71s1n91"; }
|
||||
{ commit = "6b11591f4494f705e8746e7d58b7f423191f4e92"; sha256 = "0aydyhsm2ig0khgbp27am7vq7liyqrq6kfhfi2ki0ij0ab1hfbga"; }
|
||||
{ commit = "203c7d9c3e9cb0f88816b481ef8e7e87b3ecc373"; sha256 = "0wqn16y7wy5kg8ngfcni5qdwfphl01axczibbk49bxclwnzvldqa"; }
|
||||
{ commit = "f039c6f284b2c9ce97c8353d6034978795c4872e"; sha256 = "13fkgdb17lpyxfksz1zanxhgpsm0jrss9w61nbl7an4im22hz7ci"; }
|
||||
{ commit = "ed42606bdab1c5d9e5ad828cd6fe1a0557f193b7"; sha256 = "0gdnn8v3p03imj3qga2mzdhpgbmjcklkxdl97jvz5xia2ikzknxm"; }
|
||||
{ commit = "5278e062ef292fd2fbf987d25389785f4c5c0f99"; sha256 = "0j81x758wf8v7j4rx5wc1cy7yhkvhlhv3wmnarwakxiwsspq0vrs"; }
|
||||
{ commit = "76f1ffbbb6cd9f6ecde6c82cd16e20a27242e890"; sha256 = "1py56y6gp7fjf4f8bbsfwh5bs1gnmlqda1ycsmnwlzfm0cshdp0c"; }
|
||||
{ commit = "4ca48b2b688b135c0390f54ea9077ef10aedd52c"; sha256 = "15r019pzr3k0lpgyvdc92c8fayw8b5lrzncna4bqmamcsdz7vsaw"; }
|
||||
{ commit = "98c7bf9ddc80db965d69d61521b1c7a1cec32d9a"; sha256 = "1d7pfdv1q23nf0wadw7jbp6d6r7pnzjpbyxgbdfv7j1vr9l1bp60"; }
|
||||
{ commit = "3dc76b53ad896494ca62550a7a752fecbca3f7a2"; sha256 = "0jvdzfpvfdmklfcjwqblwq1i22iqis7ljpvm7adra5d7zf2xk7xz"; }
|
||||
{ commit = "1e961ed49b18e176c7457f53df2433421387c23b"; sha256 = "04dnqqs4qsvz4g8cq6db5id41kzys7hzhcaycwmc9rpqygs2ajwz"; }
|
||||
{ commit = "e137c72d099f9b3b47f4cc718aa11eab14df1a9c"; sha256 = "1ms0dmz74yf6kwgjfs4d2fhj8y6mcp2n184r3jk44wx2xc24vgb2"; }])
|
||||
|
||||
++ optional (atLeast49 && !atLeast9) ./libsanitizer-no-cyclades-9.patch
|
||||
++ optional (is49 && !atLeast6) [
|
||||
# gcc-11 compatibility
|
||||
(fetchpatch {
|
||||
name = "gcc4-char-reload.patch";
|
||||
url = "https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=d57c99458933a21fdf94f508191f145ad8d5ec58";
|
||||
includes = [ "gcc/reload.h" ];
|
||||
sha256 = "sha256-66AMP7/ajunGKAN5WJz/yPn42URZ2KN51yPrFdsxEuM=";
|
||||
})
|
||||
]
|
||||
|
||||
# openjdk build fails without this on -march=opteron; is upstream in gcc12
|
||||
++ optionals (is11) [ ./11/gcc-issue-103910.patch ]
|
||||
|
||||
++ optional (is10 && buildPlatform.system == "aarch64-darwin" && targetPlatform != buildPlatform) (fetchpatch {
|
||||
url = "https://raw.githubusercontent.com/richard-vd/musl-cross-make/5e9e87f06fc3220e102c29d3413fbbffa456fcd6/patches/gcc-${version}/0008-darwin-aarch64-self-host-driver.patch";
|
||||
sha256 = "sha256-XtykrPd5h/tsnjY1wGjzSOJ+AyyNLsfnjuOZ5Ryq9vA=";
|
||||
})
|
||||
++ lib.optionals is48 [
|
||||
(fetchpatch {
|
||||
name = "libc_name_p.diff"; # needed to build with gcc6
|
||||
url = "https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=ec1cc0263f1";
|
||||
sha256 = "01jd7pdarh54ki498g6sz64ijl9a1l5f9v8q2696aaxalvh2vwzl";
|
||||
excludes = [ "gcc/cp/ChangeLog" ];
|
||||
})
|
||||
# glibc-2.26
|
||||
./struct-ucontext-4.8.patch
|
||||
./sigsegv-not-declared.patch
|
||||
./res_state-not-declared.patch
|
||||
# gcc-11 compatibility
|
||||
(fetchpatch {
|
||||
name = "gcc4-char-reload.patch";
|
||||
url = "https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff_plain;h=d57c99458933a21fdf94f508191f145ad8d5ec58";
|
||||
includes = [ "gcc/reload.h" ];
|
||||
sha256 = "sha256-66AMP7/ajunGKAN5WJz/yPn42URZ2KN51yPrFdsxEuM=";
|
||||
})
|
||||
]
|
@ -157,7 +157,7 @@ stdenv.mkDerivation rec {
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
mkdir -p $GOROOT_FINAL
|
||||
cp -a bin pkg src lib misc api doc $GOROOT_FINAL
|
||||
cp -a bin pkg src lib misc api doc go.env $GOROOT_FINAL
|
||||
mkdir -p $out/bin
|
||||
ln -s $GOROOT_FINAL/bin/* $out/bin
|
||||
runHook postInstall
|
||||
|
@ -2,8 +2,8 @@
|
||||
# https://nim-lang.org/docs/nimc.html
|
||||
|
||||
{ lib, callPackage, buildPackages, stdenv, fetchurl, fetchgit, fetchFromGitHub
|
||||
, makeWrapper, openssl, pcre, readline, boehmgc, sqlite, nim-unwrapped
|
||||
, nimble-unwrapped, Security }:
|
||||
, makeWrapper, openssl, pcre, readline, boehmgc, sqlite, Security, nim-unwrapped
|
||||
, nim-unwrapped-2, nimble-unwrapped, nim }:
|
||||
|
||||
let
|
||||
parseCpu = platform:
|
||||
@ -72,25 +72,15 @@ let
|
||||
nimHost = parsePlatform stdenv.hostPlatform;
|
||||
nimTarget = parsePlatform stdenv.targetPlatform;
|
||||
|
||||
bootstrapCompiler = stdenv.mkDerivation {
|
||||
pname = "nim-bootstrap";
|
||||
inherit (nim-unwrapped) version src preBuild;
|
||||
enableParallelBuilding = true;
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
install -Dt $out/bin bin/nim
|
||||
runHook postInstall
|
||||
'';
|
||||
};
|
||||
in {
|
||||
|
||||
nim-unwrapped = stdenv.mkDerivation rec {
|
||||
nim-unwrapped = stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "nim-unwrapped";
|
||||
version = "1.6.14";
|
||||
strictDeps = true;
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://nim-lang.org/download/nim-${version}.tar.xz";
|
||||
url = "https://nim-lang.org/download/nim-${finalAttrs.version}.tar.xz";
|
||||
hash = "sha256-0HDS8oriQA33/kpJ7OufRc1TmQaxB0gYVqCveo+oLck=";
|
||||
};
|
||||
|
||||
@ -108,7 +98,18 @@ in {
|
||||
# Mangle store paths of modules to prevent runtime dependence.
|
||||
] ++ lib.optional (!stdenv.hostPlatform.isWindows) ./toLocation.patch;
|
||||
|
||||
configurePhase = ''
|
||||
configurePhase = let
|
||||
bootstrapCompiler = stdenv.mkDerivation {
|
||||
pname = "nim-bootstrap";
|
||||
inherit (finalAttrs) version src preBuild;
|
||||
enableParallelBuilding = true;
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
install -Dt $out/bin bin/nim
|
||||
runHook postInstall
|
||||
'';
|
||||
};
|
||||
in ''
|
||||
runHook preConfigure
|
||||
cp ${bootstrapCompiler}/bin/nim bin/
|
||||
echo 'define:nixbuild' >> config/nim.cfg
|
||||
@ -154,7 +155,25 @@ in {
|
||||
mainProgram = "nim";
|
||||
maintainers = with maintainers; [ ehmry ];
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
nim-unwrapped-2 = nim-unwrapped.overrideAttrs (finalAttrs: rec {
|
||||
version = "2.0.0";
|
||||
src = fetchurl {
|
||||
url = "https://nim-lang.org/download/nim-${version}.tar.xz";
|
||||
hash = "sha256-vWEB2EADb7eOk6ad9s8/n9DCHNdUtpX/hKO0rdjtCvc=";
|
||||
};
|
||||
patches = [
|
||||
./NIM_CONFIG_DIR.patch
|
||||
# Override compiler configuration via an environmental variable
|
||||
|
||||
./nixbuild.patch
|
||||
# Load libraries at runtime by absolute path
|
||||
|
||||
./extra-mangling.patch
|
||||
# Mangle store paths of modules to prevent runtime dependence.
|
||||
];
|
||||
});
|
||||
|
||||
nimble-unwrapped = stdenv.mkDerivation rec {
|
||||
pname = "nimble-unwrapped";
|
||||
@ -169,8 +188,7 @@ in {
|
||||
};
|
||||
|
||||
depsBuildBuild = [ nim-unwrapped ];
|
||||
buildInputs = [ openssl ]
|
||||
++ lib.optional stdenv.isDarwin Security;
|
||||
buildInputs = [ openssl ] ++ lib.optional stdenv.isDarwin Security;
|
||||
|
||||
nimFlags = [ "--cpu:${nimHost.cpu}" "--os:${nimHost.os}" "-d:release" ];
|
||||
|
||||
@ -194,147 +212,157 @@ in {
|
||||
mainProgram = "nimble";
|
||||
};
|
||||
};
|
||||
} // (let
|
||||
wrapNim = { nim', nimble', patches }:
|
||||
let
|
||||
targetPlatformConfig = stdenv.targetPlatform.config;
|
||||
self = stdenv.mkDerivation (finalAttrs: {
|
||||
name = "${targetPlatformConfig}-nim-wrapper-${nim'.version}";
|
||||
inherit (nim') version;
|
||||
preferLocalBuild = true;
|
||||
strictDeps = true;
|
||||
|
||||
nim = let
|
||||
nim' = buildPackages.nim-unwrapped;
|
||||
nimble' = buildPackages.nimble-unwrapped;
|
||||
inherit (stdenv) targetPlatform;
|
||||
self = stdenv.mkDerivation {
|
||||
name = "${targetPlatform.config}-nim-wrapper-${nim'.version}";
|
||||
inherit (nim') version;
|
||||
preferLocalBuild = true;
|
||||
strictDeps = true;
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
|
||||
nativeBuildInputs = [ makeWrapper ];
|
||||
# Needed for any nim package that uses the standard library's
|
||||
# 'std/sysrand' module.
|
||||
depsTargetTargetPropagated = lib.optional stdenv.isDarwin Security;
|
||||
|
||||
# Needed for any nim package that uses the standard library's
|
||||
# 'std/sysrand' module.
|
||||
depsTargetTargetPropagated = lib.optional stdenv.isDarwin Security;
|
||||
inherit patches;
|
||||
|
||||
patches = [
|
||||
./nim.cfg.patch
|
||||
# Remove configurations that clash with ours
|
||||
];
|
||||
|
||||
unpackPhase = ''
|
||||
runHook preUnpack
|
||||
tar xf ${nim'.src} nim-$version/config
|
||||
cd nim-$version
|
||||
runHook postUnpack
|
||||
'';
|
||||
|
||||
dontConfigure = true;
|
||||
|
||||
buildPhase =
|
||||
# Configure the Nim compiler to use $CC and $CXX as backends
|
||||
# The compiler is configured by two configuration files, each with
|
||||
# a different DSL. The order of evaluation matters and that order
|
||||
# is not documented, so duplicate the configuration across both files.
|
||||
''
|
||||
runHook preBuild
|
||||
cat >> config/config.nims << WTF
|
||||
|
||||
switch("os", "${nimTarget.os}")
|
||||
switch("cpu", "${nimTarget.cpu}")
|
||||
switch("define", "nixbuild")
|
||||
|
||||
# Configure the compiler using the $CC set by Nix at build time
|
||||
import strutils
|
||||
let cc = getEnv"CC"
|
||||
if cc.contains("gcc"):
|
||||
switch("cc", "gcc")
|
||||
elif cc.contains("clang"):
|
||||
switch("cc", "clang")
|
||||
WTF
|
||||
|
||||
mv config/nim.cfg config/nim.cfg.old
|
||||
cat > config/nim.cfg << WTF
|
||||
os = "${nimTarget.os}"
|
||||
cpu = "${nimTarget.cpu}"
|
||||
define:"nixbuild"
|
||||
WTF
|
||||
|
||||
cat >> config/nim.cfg < config/nim.cfg.old
|
||||
rm config/nim.cfg.old
|
||||
|
||||
cat >> config/nim.cfg << WTF
|
||||
|
||||
clang.cpp.exe %= "\$CXX"
|
||||
clang.cpp.linkerexe %= "\$CXX"
|
||||
clang.exe %= "\$CC"
|
||||
clang.linkerexe %= "\$CC"
|
||||
gcc.cpp.exe %= "\$CXX"
|
||||
gcc.cpp.linkerexe %= "\$CXX"
|
||||
gcc.exe %= "\$CC"
|
||||
gcc.linkerexe %= "\$CC"
|
||||
WTF
|
||||
|
||||
runHook postBuild
|
||||
unpackPhase = ''
|
||||
runHook preUnpack
|
||||
tar xf ${nim'.src} nim-$version/config
|
||||
cd nim-$version
|
||||
runHook postUnpack
|
||||
'';
|
||||
|
||||
wrapperArgs = lib.optionals (!(stdenv.isDarwin && stdenv.isAarch64)) [
|
||||
"--prefix PATH : ${lib.makeBinPath [ buildPackages.gdb ]}:${
|
||||
placeholder "out"
|
||||
}/bin"
|
||||
# Used by nim-gdb
|
||||
dontConfigure = true;
|
||||
|
||||
"--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ openssl pcre ]}"
|
||||
# These libraries may be referred to by the standard library.
|
||||
# This is broken for cross-compilation because the package
|
||||
# set will be shifted back by nativeBuildInputs.
|
||||
buildPhase =
|
||||
# Configure the Nim compiler to use $CC and $CXX as backends
|
||||
# The compiler is configured by two configuration files, each with
|
||||
# a different DSL. The order of evaluation matters and that order
|
||||
# is not documented, so duplicate the configuration across both files.
|
||||
''
|
||||
runHook preBuild
|
||||
cat >> config/config.nims << WTF
|
||||
|
||||
"--set NIM_CONFIG_PATH ${placeholder "out"}/etc/nim"
|
||||
# Use the custom configuration
|
||||
];
|
||||
switch("os", "${nimTarget.os}")
|
||||
switch("cpu", "${nimTarget.cpu}")
|
||||
switch("define", "nixbuild")
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
# Configure the compiler using the $CC set by Nix at build time
|
||||
import strutils
|
||||
let cc = getEnv"CC"
|
||||
if cc.contains("gcc"):
|
||||
switch("cc", "gcc")
|
||||
elif cc.contains("clang"):
|
||||
switch("cc", "clang")
|
||||
WTF
|
||||
|
||||
mkdir -p $out/bin $out/etc
|
||||
mv config/nim.cfg config/nim.cfg.old
|
||||
cat > config/nim.cfg << WTF
|
||||
os = "${nimTarget.os}"
|
||||
cpu = "${nimTarget.cpu}"
|
||||
define:"nixbuild"
|
||||
WTF
|
||||
|
||||
cp -r config $out/etc/nim
|
||||
cat >> config/nim.cfg < config/nim.cfg.old
|
||||
rm config/nim.cfg.old
|
||||
|
||||
cat >> config/nim.cfg << WTF
|
||||
|
||||
clang.cpp.exe %= "\$CXX"
|
||||
clang.cpp.linkerexe %= "\$CXX"
|
||||
clang.exe %= "\$CC"
|
||||
clang.linkerexe %= "\$CC"
|
||||
gcc.cpp.exe %= "\$CXX"
|
||||
gcc.cpp.linkerexe %= "\$CXX"
|
||||
gcc.exe %= "\$CC"
|
||||
gcc.linkerexe %= "\$CC"
|
||||
WTF
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
wrapperArgs = lib.optionals (!(stdenv.isDarwin && stdenv.isAarch64)) [
|
||||
"--prefix PATH : ${lib.makeBinPath [ buildPackages.gdb ]}:${
|
||||
placeholder "out"
|
||||
}/bin"
|
||||
# Used by nim-gdb
|
||||
|
||||
"--prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [ openssl pcre ]}"
|
||||
# These libraries may be referred to by the standard library.
|
||||
# This is broken for cross-compilation because the package
|
||||
# set will be shifted back by nativeBuildInputs.
|
||||
|
||||
"--set NIM_CONFIG_PATH ${placeholder "out"}/etc/nim"
|
||||
# Use the custom configuration
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/bin $out/etc
|
||||
|
||||
cp -r config $out/etc/nim
|
||||
|
||||
for binpath in ${nim'}/bin/nim?*; do
|
||||
local binname=`basename $binpath`
|
||||
makeWrapper \
|
||||
$binpath $out/bin/${targetPlatformConfig}-$binname \
|
||||
$wrapperArgs
|
||||
ln -s $out/bin/${targetPlatformConfig}-$binname $out/bin/$binname
|
||||
done
|
||||
|
||||
for binpath in ${nim'}/bin/nim?*; do
|
||||
local binname=`basename $binpath`
|
||||
makeWrapper \
|
||||
$binpath $out/bin/${targetPlatform.config}-$binname \
|
||||
${nim'}/nim/bin/nim $out/bin/${targetPlatformConfig}-nim \
|
||||
--set-default CC $(command -v $CC) \
|
||||
--set-default CXX $(command -v $CXX) \
|
||||
$wrapperArgs
|
||||
ln -s $out/bin/${targetPlatform.config}-$binname $out/bin/$binname
|
||||
done
|
||||
ln -s $out/bin/${targetPlatformConfig}-nim $out/bin/nim
|
||||
|
||||
makeWrapper \
|
||||
${nim'}/nim/bin/nim $out/bin/${targetPlatform.config}-nim \
|
||||
--set-default CC $(command -v $CC) \
|
||||
--set-default CXX $(command -v $CXX) \
|
||||
$wrapperArgs
|
||||
ln -s $out/bin/${targetPlatform.config}-nim $out/bin/nim
|
||||
makeWrapper \
|
||||
${nim'}/bin/testament $out/bin/${targetPlatformConfig}-testament \
|
||||
$wrapperArgs
|
||||
ln -s $out/bin/${targetPlatformConfig}-testament $out/bin/testament
|
||||
|
||||
makeWrapper \
|
||||
${nim'}/bin/testament $out/bin/${targetPlatform.config}-testament \
|
||||
$wrapperArgs
|
||||
ln -s $out/bin/${targetPlatform.config}-testament $out/bin/testament
|
||||
'' + lib.strings.optionalString (nimble' != null) ''
|
||||
makeWrapper \
|
||||
${nimble'}/bin/nimble $out/bin/${targetPlatformConfig}-nimble \
|
||||
--suffix PATH : $out/bin
|
||||
ln -s $out/bin/${targetPlatformConfig}-nimble $out/bin/nimble
|
||||
|
||||
makeWrapper \
|
||||
${nimble'}/bin/nimble $out/bin/${targetPlatform.config}-nimble \
|
||||
--suffix PATH : $out/bin
|
||||
ln -s $out/bin/${targetPlatform.config}-nimble $out/bin/nimble
|
||||
'' + ''
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
passthru = {
|
||||
nim = nim';
|
||||
nimble = nimble';
|
||||
};
|
||||
|
||||
passthru = {
|
||||
nim = nim';
|
||||
nimble = nimble';
|
||||
};
|
||||
|
||||
meta = nim'.meta // {
|
||||
description = nim'.meta.description
|
||||
+ " (${targetPlatform.config} wrapper)";
|
||||
platforms = with lib.platforms; unix ++ genode;
|
||||
};
|
||||
meta = nim'.meta // {
|
||||
description = nim'.meta.description
|
||||
+ " (${targetPlatformConfig} wrapper)";
|
||||
platforms = with lib.platforms; unix ++ genode;
|
||||
};
|
||||
});
|
||||
in self // {
|
||||
pkgs = callPackage ../../../top-level/nim-packages.nix { nim = self; };
|
||||
};
|
||||
in self // {
|
||||
pkgs = callPackage ../../../top-level/nim-packages.nix { nim = self; };
|
||||
in {
|
||||
|
||||
nim = wrapNim {
|
||||
nim' = buildPackages.nim-unwrapped;
|
||||
nimble' = buildPackages.nimble-unwrapped;
|
||||
patches = [ ./nim.cfg.patch ];
|
||||
};
|
||||
|
||||
}
|
||||
nim2 = wrapNim {
|
||||
nim' = buildPackages.nim-unwrapped-2;
|
||||
nimble' = null;
|
||||
patches = [ ./nim2.cfg.patch ];
|
||||
};
|
||||
})
|
||||
|
41
pkgs/development/compilers/nim/nim2.cfg.patch
Normal file
41
pkgs/development/compilers/nim/nim2.cfg.patch
Normal file
@ -0,0 +1,41 @@
|
||||
diff --git a/config/nim.cfg b/config/nim.cfg
|
||||
index 1470de780..8a12f741a 100644
|
||||
--- a/config/nim.cfg
|
||||
+++ b/config/nim.cfg
|
||||
@@ -9,8 +9,6 @@
|
||||
# Environment variables can be accessed like so:
|
||||
# gcc.path %= "$CC_PATH"
|
||||
|
||||
-cc = gcc
|
||||
-
|
||||
# additional options always passed to the compiler:
|
||||
--parallel_build: "0" # 0 to auto-detect number of processors
|
||||
|
||||
@@ -22,27 +20,6 @@ cc = gcc
|
||||
|
||||
threads:on
|
||||
|
||||
-# Examples of how to setup a cross-compiler:
|
||||
-# Nim can target architectures and OSes different than the local host
|
||||
-# Syntax: <arch>.<os>.gcc.exe = "<compiler executable>"
|
||||
-# <arch>.<os>.gcc.linkerexe = "<linker executable>"
|
||||
-
|
||||
-# ARM e.g. Raspberry Pi 2: gcc-arm-linux-gnueabihf package on Debian/Ubuntu
|
||||
-arm.linux.gcc.exe = "arm-linux-gnueabihf-gcc"
|
||||
-arm.linux.gcc.linkerexe = "arm-linux-gnueabihf-gcc"
|
||||
-# ARM64/aarch64 e.g. Raspberry Pi 3: gcc-aarch64-linux-gnu package on Debian/Ubuntu
|
||||
-arm64.linux.gcc.exe = "aarch64-linux-gnu-gcc"
|
||||
-arm64.linux.gcc.linkerexe = "aarch64-linux-gnu-gcc"
|
||||
-# RISC-V: gcc-riscv64-linux-gnu package on Debian/Ubuntu
|
||||
-riscv32.linux.gcc.exe = "riscv64-linux-gnu-gcc"
|
||||
-riscv32.linux.gcc.linkerexe = "riscv64-linux-gnu-gcc"
|
||||
-riscv64.linux.gcc.exe = "riscv64-linux-gnu-gcc"
|
||||
-riscv64.linux.gcc.linkerexe = "riscv64-linux-gnu-gcc"
|
||||
-
|
||||
-# For OpenWRT, you will also need to adjust PATH to point to your toolchain.
|
||||
-mips.linux.gcc.exe = "mips-openwrt-linux-gcc"
|
||||
-mips.linux.gcc.linkerexe = "mips-openwrt-linux-gcc"
|
||||
-
|
||||
|
||||
path="$lib/deprecated/core"
|
||||
path="$lib/deprecated/pure"
|
39
pkgs/development/compilers/zig/shell-completions.nix
Normal file
39
pkgs/development/compilers/zig/shell-completions.nix
Normal file
@ -0,0 +1,39 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, installShellFiles
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "zig-shell-completions";
|
||||
version = "unstable-2023-08-17";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "ziglang";
|
||||
repo = "shell-completions";
|
||||
rev = "de9f83166d792cce6a0524e63d2755952dd9872c";
|
||||
hash = "sha256-92n41/AWbHYkXiBtbWw+hXZKJCE7KW9igd8cLSBQfHo=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ installShellFiles ];
|
||||
|
||||
dontConfigure = true;
|
||||
dontBuild = true;
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
installShellCompletion --bash --name zig.bash _zig.bash
|
||||
installShellCompletion --zsh --name _zig _zig
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://github.com/ziglang/shell-completions";
|
||||
description = "Shell completions for the Zig compiler";
|
||||
license = licenses.mit;
|
||||
maintainers = with maintainers; [ aaronjheng ];
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
@ -10,13 +10,13 @@
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "ftxui";
|
||||
version = "4.1.1";
|
||||
version = "5.0.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "ArthurSonzogni";
|
||||
repo = "ftxui";
|
||||
rev = "v${version}";
|
||||
sha256 = "sha256-qFgCLV7sgGxlL18sThqpl+vyXL68GXcbYqMG7mXhsB4=";
|
||||
sha256 = "sha256-IF6G4wwQDksjK8nJxxAnxuCw2z2qvggCmRJ2rbg00+E=";
|
||||
};
|
||||
|
||||
strictDeps = true;
|
||||
|
30
pkgs/development/libraries/libz/default.nix
Normal file
30
pkgs/development/libraries/libz/default.nix
Normal file
@ -0,0 +1,30 @@
|
||||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitLab
|
||||
, unstableGitUpdater
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "libz";
|
||||
version = "unstable-2018-03-31";
|
||||
|
||||
src = fetchFromGitLab {
|
||||
owner = "sortix";
|
||||
repo = "libz";
|
||||
rev = "752c1630421502d6c837506d810f7918ac8cdd27";
|
||||
hash = "sha256-AQuZ0BOl1iP5Nub+tVwctlE2tfJe4Sq/KDGkjwBbsV4=";
|
||||
};
|
||||
|
||||
outputs = [ "out" "dev" ];
|
||||
outputDoc = "dev"; # single tiny man3 page
|
||||
|
||||
passthru.updateScript = unstableGitUpdater { };
|
||||
|
||||
meta = {
|
||||
homepage = "https://sortix.org/libz/";
|
||||
description = "A clean fork of zlib";
|
||||
license = [ lib.licenses.zlib ];
|
||||
maintainers = with lib.maintainers; [ AndersonTorres ];
|
||||
platforms = lib.platforms.unix;
|
||||
};
|
||||
})
|
@ -2,11 +2,11 @@
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "htslib";
|
||||
version = "1.17";
|
||||
version = "1.18";
|
||||
|
||||
src = fetchurl {
|
||||
url = "https://github.com/samtools/htslib/releases/download/${version}/${pname}-${version}.tar.bz2";
|
||||
sha256 = "sha256-djd5KIxA8HZG7HrZi5bDeMc5Fx0WKtmDmIaHg7chg58";
|
||||
sha256 = "sha256-8atTpZOiMgob+t9O+RXa54QAbFtckiyKgXTXUwqa8Y8=";
|
||||
};
|
||||
|
||||
# perl is only used during the check phase.
|
||||
|
@ -46,7 +46,7 @@ let
|
||||
};
|
||||
in {
|
||||
wt4 = generic {
|
||||
version = "4.9.1";
|
||||
sha256 = "sha256-Qm0qqYB/CLVHUgKE9N83MgAWQ2YFdumrB0i84qYNto8=";
|
||||
version = "4.10.0";
|
||||
sha256 = "sha256-05WZnyUIwXwJA24mQi5ATCqRZ6PE/tiw2/MO1qYHRsY=";
|
||||
};
|
||||
}
|
||||
|
@ -3,6 +3,6 @@
|
||||
fetchFromGitHub {
|
||||
owner = "krux02";
|
||||
repo = "ast-pattern-matching";
|
||||
rev = "87f7d163421af5a4f5e5cb6da7b93278e6897e96";
|
||||
sha256 = "19mb5bb6riia8380p5dpc3q0vwgrj958dd6p7vw8vkvwiqrzg6zq";
|
||||
rev = "eb8b99d595517fd5d41ccc954edb896267f2db78";
|
||||
hash = "sha256-wPIiFr8OfXM7Hyh5o2aQXnlgkqLf0FennN6zzVTGgY4=";
|
||||
}
|
||||
|
@ -1,7 +1,18 @@
|
||||
{ fetchNimble }:
|
||||
{ lib, buildNimPackage, fetchFromGitHub }:
|
||||
|
||||
fetchNimble {
|
||||
buildNimPackage (final: prev: {
|
||||
pname = "chroma";
|
||||
version = "0.2.5";
|
||||
hash = "sha256-6lNHpO2aMorgkaPfo6kRcOs9r5R6T/kislVmkeoulw8=";
|
||||
}
|
||||
version = "0.2.7";
|
||||
src = fetchFromGitHub {
|
||||
owner = "treeform";
|
||||
repo = "chroma";
|
||||
rev = final.version;
|
||||
hash = "sha256-QSl8n60HO56kJ4BKKe/FjUC/cRNxqL2L56FqPwhmJl4=";
|
||||
};
|
||||
meta = final.src.meta // {
|
||||
description = "Everything you want to do with colors";
|
||||
homepage = "https://github.com/treeform/chroma";
|
||||
license = [ lib.licenses.mit ];
|
||||
maintainers = with lib.maintainers; [ ehmry ];
|
||||
};
|
||||
})
|
||||
|
19
pkgs/development/nim-packages/db_connector/default.nix
Normal file
19
pkgs/development/nim-packages/db_connector/default.nix
Normal file
@ -0,0 +1,19 @@
|
||||
{ lib, buildNimPackage, fetchFromGitHub }:
|
||||
|
||||
buildNimPackage (final: prev: {
|
||||
pname = "db_connector";
|
||||
version = "unstable-2023-02-23";
|
||||
src = fetchFromGitHub {
|
||||
owner = "nim-lang";
|
||||
repo = "db_connector";
|
||||
rev = "e65693709dd042bc723c8f1d46cc528701f1c479";
|
||||
hash = "sha256-g5X51VbES8OxR5m9WexK70Yo6S2PnroKLabj1cUu1P0=";
|
||||
};
|
||||
doCheck = false; # tests only worked in the Nim sources
|
||||
meta = final.src.meta // {
|
||||
description = "Unified db connector in Nim";
|
||||
homepage = "https://github.com/nim-lang/db_connector";
|
||||
license = [ lib.licenses.mit ];
|
||||
maintainers = with lib.maintainers; [ ehmry ];
|
||||
};
|
||||
})
|
@ -1,13 +0,0 @@
|
||||
if [ -e .attrs.sh ]; then source .attrs.sh; fi
|
||||
source $stdenv/setup
|
||||
export HOME=$NIX_BUILD_TOP
|
||||
|
||||
nimble --accept --noSSLCheck develop "${pkgname}@${version}"
|
||||
# TODO: bring in the certificates for Nimble to verify the fetch of
|
||||
# the package list.
|
||||
|
||||
pkgdir=${NIX_BUILD_TOP}/${pkgname}
|
||||
|
||||
find "$pkgdir" -name .git -print0 | xargs -0 rm -rf
|
||||
|
||||
cp -a "$pkgdir" "$out"
|
@ -1,20 +0,0 @@
|
||||
{ lib, makeOverridable, stdenv, gitMinimal, nim, cacert }:
|
||||
|
||||
makeOverridable (
|
||||
|
||||
{ pname, version, hash ? lib.fakeHash,
|
||||
|
||||
meta ? { }, passthru ? { }, preferLocalBuild ? true }:
|
||||
stdenv.mkDerivation {
|
||||
inherit version meta passthru preferLocalBuild;
|
||||
pname = pname + "-src";
|
||||
pkgname = pname;
|
||||
builder = ./builder.sh;
|
||||
nativeBuildInputs = [ gitMinimal nim ];
|
||||
outputHash = hash;
|
||||
outputHashAlgo = null;
|
||||
outputHashMode = "recursive";
|
||||
impureEnvVars = lib.fetchers.proxyImpureEnvVars
|
||||
++ [ "GIT_PROXY_COMMAND" "SOCKS_SERVER" ];
|
||||
GIT_SSL_CAINFO = "${cacert}/etc/ssl/certs/ca-bundle.crt";
|
||||
})
|
@ -1,21 +1,21 @@
|
||||
{ lib, buildNimPackage, fetchFromGitHub }:
|
||||
|
||||
buildNimPackage rec {
|
||||
buildNimPackage (final: prev: {
|
||||
pname = "flatty";
|
||||
version = "0.3.4";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "treeform";
|
||||
repo = pname;
|
||||
rev = version;
|
||||
repo = "flatty";
|
||||
rev = final.version;
|
||||
hash = "sha256-ZmhjehmEJHm5qNlsGQvyYLajUdwhWt1+AtRppRrNtgA=";
|
||||
};
|
||||
|
||||
doCheck = false; # tests fail with Nim-2.0.0
|
||||
|
||||
meta = with lib;
|
||||
src.meta // {
|
||||
description = "Tools and serializer for plain flat binary files";
|
||||
license = [ licenses.mit ];
|
||||
maintainers = [ maintainers.ehmry ];
|
||||
};
|
||||
}
|
||||
meta = final.src.meta // {
|
||||
description = "Tools and serializer for plain flat binary files";
|
||||
license = [ lib.licenses.mit ];
|
||||
maintainers = [ lib.maintainers.ehmry ];
|
||||
};
|
||||
})
|
||||
|
@ -1,14 +0,0 @@
|
||||
{ buildNimPackage, fetchFromGitHub, htslib }:
|
||||
|
||||
buildNimPackage rec {
|
||||
pname = "hts-nim";
|
||||
version = "0.3.4";
|
||||
src = fetchFromGitHub {
|
||||
owner = "brentp";
|
||||
repo = pname;
|
||||
rev = "v${version}";
|
||||
sha256 = "0670phk1bq3l9j2zaa8i5wcpc5dyfrc0l2a6c21g0l2mmdczffa7";
|
||||
};
|
||||
propagatedBuildInputs = [ htslib ];
|
||||
doCheck = false;
|
||||
}
|
21
pkgs/development/nim-packages/hts/default.nix
Normal file
21
pkgs/development/nim-packages/hts/default.nix
Normal file
@ -0,0 +1,21 @@
|
||||
{ lib, buildNimPackage, fetchFromGitHub, htslib }:
|
||||
|
||||
buildNimPackage (final: prev: {
|
||||
pname = "hts";
|
||||
version = "0.3.23";
|
||||
src = fetchFromGitHub {
|
||||
owner = "brentp";
|
||||
repo = "hts-nim";
|
||||
rev = "v${final.version}";
|
||||
hash = "sha256-o27yOtzW4hk8dpicqjW4D8zxqXHdxcz+e84PyK+yBq8=";
|
||||
};
|
||||
propagatedBuildInputs = [ htslib ];
|
||||
nimFlags = [ "--mm:refc" ];
|
||||
doCheck = false;
|
||||
meta = final.src.meta // {
|
||||
description = "Nim wrapper for htslib for parsing genomics data files";
|
||||
homepage = "https://brentp.github.io/hts-nim/";
|
||||
license = [ lib.licenses.mit ];
|
||||
maintainers = with lib.maintainers; [ ehmry ];
|
||||
};
|
||||
})
|
@ -150,7 +150,7 @@ proc checkPhase*() =
|
||||
proc before(idx: int) =
|
||||
echo "check job ", idx, ": ", cmds[idx]
|
||||
for path in walkPattern("tests/t*.nim"):
|
||||
cmds.add("nim r $#" % [path])
|
||||
cmds.add("nim r $# $#" % [getenv("nimFlags"), path])
|
||||
let err = execProcesses(
|
||||
cmds, n = 1,
|
||||
beforeRunEvent = before)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user