Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Insulate #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion linux/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ in
inherit (prevStage)
ccWrapperStdenv
binutils coreutils gnugrep gettext
perl patchelf linuxHeaders gnum4 bison libidn2 libunistring libxcrypt;
perl patchelf linuxHeaders gnum4 bison libidn2 libunistring;
# We build a special copy of libgmp which doesn't use libstdc++, because
# xgcc++'s libstdc++ references the bootstrap-files (which is what
# compiles xgcc++).
Expand Down
10 changes: 6 additions & 4 deletions os-specific/linux/kernel-headers/default.nix
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{ stdenvNoCC, lib, buildPackages, fetchurl, perl, elf-header
{ stdenvNoCC, lib, buildPackages, fetchurl, perl
# only on Android
, bison
, flex
, bison ? null
, flex ? null
, rsync ? null

, writeTextFile
}:

assert stdenvNoCC.hostPlatform.isAndroid -> rsync != null;
assert stdenvNoCC.hostPlatform.isAndroid -> flex != null;
assert stdenvNoCC.hostPlatform.isAndroid -> bison != null;

let

Expand Down Expand Up @@ -51,7 +53,7 @@ let
depsBuildBuild = [ buildPackages.stdenv.cc ];
# `elf-header` is null when libc provides `elf.h`.
nativeBuildInputs = [
perl elf-header
perl
] ++ lib.optionals stdenvNoCC.hostPlatform.isAndroid [
bison flex rsync
] ++ lib.optionals (stdenvNoCC.buildPlatform.isDarwin &&
Expand Down
29 changes: 15 additions & 14 deletions pkgs/binutils/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ let
in

{ stdenv
, autoreconfHook
, autoconf269, automake, libtool
#, autoreconfHook
#, autoconf269, automake, libtool
, bison
, buildPackages
, fetchFromGitHub
# , fetchFromGitHub
, fetchurl
, flex
# , flex
, gettext
, lib
, noSysDirs
Expand Down Expand Up @@ -40,12 +40,12 @@ let
url = "mirror://gnu/binutils/binutils-${version}.tar.bz2";
hash = "sha256-qlSFDr2lBkxyzU7C2bBWwpQlKZFIY1DZqXqypt/frxI=";
};
vc4-none = fetchFromGitHub {
owner = "itszor";
repo = "binutils-vc4";
rev = "708acc851880dbeda1dd18aca4fd0a95b2573b36";
sha256 = "1kdrz6fki55lm15rwwamn74fnqpy0zlafsida2zymk76n3656c63";
};
#vc4-none = fetchFromGitHub {
# owner = "itszor";
# repo = "binutils-vc4";
# rev = "708acc851880dbeda1dd18aca4fd0a95b2573b36";
# sha256 = "1kdrz6fki55lm15rwwamn74fnqpy0zlafsida2zymk76n3656c63";
#};
};

#INFO: The targetPrefix prepended to binary names to allow multiple binuntils
Expand All @@ -57,7 +57,8 @@ stdenv.mkDerivation (finalAttrs: {
pname = targetPrefix + "binutils";
inherit version;

src = srcs.${targetPlatform.system} or srcs.normal;
#src = srcs.${targetPlatform.system} or srcs.normal;
src = srcs.normal;

# WARN: this package is used for bootstrapping fetchurl, and thus cannot use
# fetchpatch! All mutable patches (generated by GitHub or cgit) that are
Expand Down Expand Up @@ -117,9 +118,9 @@ stdenv.mkDerivation (finalAttrs: {
bison
perl
]
++ lib.optionals targetPlatform.isiOS [ autoreconfHook ]
++ lib.optionals buildPlatform.isDarwin [ autoconf269 automake gettext libtool ]
++ lib.optionals targetPlatform.isVc4 [ flex ]
#++ lib.optionals targetPlatform.isiOS [ autoreconfHook ]
#++ lib.optionals buildPlatform.isDarwin [ autoconf269 automake gettext libtool ]
#++ lib.optionals targetPlatform.isVc4 [ flex ]
;

buildInputs = [ zlib gettext ] ++ lib.optionals buildPlatform.isDarwin [ CoreServices ];
Expand Down
92 changes: 45 additions & 47 deletions pkgs/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,20 @@ final: prev: with final; {
};

binutils-unwrapped = callPackage ./binutils {
autoreconfHook = autoreconfHook269;
# TODO: darwin support
#autoreconfHook = autoreconfHook269;
# inherit (darwin.apple_sdk.frameworks) CoreServices;
# FHS sys dirs presumably only have stuff for the build platform
noSysDirs = (stdenv.targetPlatform != stdenv.hostPlatform) || noSysDirs;
};

binutils-unwrapped-all-targets = callPackage ../development/tools/misc/binutils {
autoreconfHook = if targetPlatform.isiOS then autoreconfHook269 else autoreconfHook;
inherit (darwin.apple_sdk.frameworks) CoreServices;
# FHS sys dirs presumably only have stuff for the build platform
noSysDirs = (stdenv.targetPlatform != stdenv.hostPlatform) || noSysDirs;
withAllTargets = true;
};
#
# binutils-unwrapped-all-targets = callPackage ../development/tools/misc/binutils {
# autoreconfHook = if targetPlatform.isiOS then autoreconfHook269 else autoreconfHook;
# inherit (darwin.apple_sdk.frameworks) CoreServices;
# # FHS sys dirs presumably only have stuff for the build platform
# noSysDirs = (stdenv.targetPlatform != stdenv.hostPlatform) || noSysDirs;
# withAllTargets = true;
# };
binutils = wrapBintoolsWith {
bintools = binutils-unwrapped;
};
Expand Down Expand Up @@ -103,7 +103,7 @@ final: prev: with final; {
};


lndir = callPackage ./lndir { };
# lndir = callPackage ./lndir { };

acl = callPackage ./acl { };

Expand All @@ -114,7 +114,7 @@ final: prev: with final; {
autoconf269 = callPackage ./autoconf/269.nix { };

automake = callPackage ./automake { };

#
autoreconfHook = callPackage (
{ makeSetupHook, autoconf, automake, gettext, libtool }:
makeSetupHook {
Expand Down Expand Up @@ -143,24 +143,20 @@ final: prev: with final; {

diffutils = callPackage ./diffutils { };

# Provided by libc on Operating Systems that use the Extensible Linker Format.
elf-header = if stdenv.hostPlatform.isElf then null else
throw "Non-elf builds are not supported yet in this stdenv repo";

expand-response-params = callPackage ../build-support/expand-response-params { };

expat = callPackage ./expat { };

fetchFromGitHub = callPackage ../build-support/fetchgithub { };

fetchpatch = callPackage ../build-support/fetchpath { };
# expat = callPackage ./expat { };
#
# fetchFromGitHub = callPackage ../build-support/fetchgithub { };
#
fetchpatch = callPackage ../build-support/fetchpatch { };

file = callPackage ./file { };

findutils = callPackage ./findutils { };

flex = callPackage ./flex { };

# flex = callPackage ./flex { };
#
gawk = callPackage ./gawk { };

gnupatch = callPackage ./gnupatch { };
Expand All @@ -170,18 +166,18 @@ final: prev: with final; {

gcc_latest = gcc14;

db = db5;
db5 = db53;
db53 = callPackage ./db/db-5.3.nix { };
# db = db5;
# db5 = db53;
# db53 = callPackage ./db/db-5.3.nix { };

# TODO: don't use a top-level defined attr to define this
default-gcc-version =
default-gcc-version =
if (with stdenv.targetPlatform; isVc4 || libc == "relibc") then 6
else 13;
gcc = pkgs.${"gcc${toString default-gcc-version}"};
gccFun = callPackage ./gcc;
gcc-unwrapped = gcc.cc;

#
gccStdenv = if stdenv.cc.isGNU
then stdenv
else stdenv.override {
Expand Down Expand Up @@ -241,8 +237,6 @@ final: prev: with final; {
isl_0_20 = callPackage ./isl/0.20.0.nix { };
isl_0_24 = callPackage ./isl/0.24.0.nix { };



# We can choose:
libcCrossChooser = name:
# libc is hackily often used from the previous stage. This `or`
Expand Down Expand Up @@ -273,11 +267,11 @@ final: prev: with final; {

libcCross = assert stdenv.targetPlatform != stdenv.buildPlatform; libcCrossChooser stdenv.targetPlatform.libc;

libffi = callPackage ./libffi { };
libffi_3_3 = callPackage ./libffi/3.3.nix { };
libffiBoot = libffi.override {
doCheck = false;
};
# libffi = callPackage ./libffi { };
# libffi_3_3 = callPackage ./libffi/3.3.nix { };
# libffiBoot = libffi.override {
# doCheck = false;
# };

libgcc = stdenv.cc.cc.libgcc or null;

Expand Down Expand Up @@ -328,16 +322,18 @@ final: prev: with final; {

libunistring = callPackage ./libunistring { };

# Needed by GCC for address sanitizer
libxcrypt = callPackage ./libxcrypt { };

inherit (callPackages ../os-specific/linux/kernel-headers { inherit (pkgsBuildBuild) elf-header; })
# TODO: stdenv: make cleaner
inherit (callPackages ../os-specific/linux/kernel-headers { })
linuxHeaders makeLinuxHeaders;

nix-update-script = lib.error "nix-update-script is not supported yet";
# nix-update-script = lib.error "nix-update-script is not supported yet";

nukeReferences = callPackage ../build-support/nuke-references { };

makeWrapper = makeShellWrapper;
makeWrapper = makeShellWrapper;

makeShellWrapper = makeSetupHook {
name = "make-shell-wrapper-hook";
Expand All @@ -351,40 +347,42 @@ final: prev: with final; {
};
} ../build-support/setup-hooks/make-wrapper.sh;

mpdecimal = callPackage ./mpdecimal { };
# mpdecimal = callPackage ./mpdecimal { };

mpfr = callPackage ./mpfr { };

minizip = callPackage ./minizip { };

#
# minizip = callPackage ./minizip { };
#
patch = gnupatch;

patchelf = callPackage ./patchelf { };

pcre2 = callPackage ./pcre2 { };

# TODO: stdenv expose only one version
perlInterpreters = callPackage ./perl { };
perl = perlInterpreters.perl538;

pkg-config = callPackage ./pkg-config { };

pythonInterpreters = callPackage ./python { };
inherit (pythonInterpreters) python3Minimal;

# For the purpose of the stdenv repo
#
# # For the purpose of the stdenv repo
python3 = python3Minimal;

#
readline = readline_8_2;
readline_7_0 = callPackage ./readline/7.0.nix { };
# readline_7_0 = callPackage ./readline/7.0.nix { };
readline_8_2 = callPackage ./readline/8.2.nix { };

runtimeShell = "${runtimeShellPackage}${runtimeShellPackage.shellPath}";
runtimeShellPackage = bash;

# TODO: stdenv: make this minimal for just stdenv
# TODO: stdenv: make this minimal for just stdenv
# testers = callPackage ../build-support/testers { };
testers = null;

# TODO: stdenv: make this minimal for just stdenv
texinfoVersions = callPackage ./texinfo/packages.nix { };
texinfo = texinfoVersions.texinfo7;

Expand All @@ -396,7 +394,7 @@ final: prev: with final; {
package = targetPackages.windows.mcfgthreads or windows.mcfgthreads;
};


# Needed by mpfr
updateAutotoolsGnuConfigScriptsHook = makeSetupHook {
name = "update-autotools-gnu-config-scripts-hook";
substitutions = { gnu_config = gnu-config; };
Expand Down
45 changes: 31 additions & 14 deletions pkgs/gcc/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
{ lib, stdenv, targetPackages, fetchurl, fetchpatch, fetchFromGitHub, noSysDirs
{ lib, stdenv, targetPackages, fetchurl, fetchpatch
#, fetchFromGitHub
, noSysDirs
, langC ? true, langCC ? true, langFortran ? false
, langAda ? false
, langObjC ? stdenv.targetPlatform.isDarwin
Expand All @@ -15,7 +17,13 @@
, enableLTO ? stdenv.hostPlatform.hasSharedLibraries
, texinfo ? null
, perl ? null # optional, for texi2pod (then pod2man)
, gmp, mpfr, libmpc, gettext, which, patchelf, binutils
, gmp
, mpfr ? null
, libmpc
, gettext
, which
, patchelf
, binutils
, isl ? null # optional, for the Graphite optimization framework.
, zlib ? null
, libucontext ? null
Expand All @@ -42,7 +50,7 @@

# only for gcc<=6.x
, langJava ? false
, flex
, flex ? null
, boehmgc ? null
, zip ? null, unzip ? null, pkg-config ? null
, gtk2 ? null, libart_lgpl ? null
Expand Down Expand Up @@ -261,17 +269,26 @@ 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 {
# 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"} =
# gccVersions.srcHashForVersion version;
# };
src = fetchurl {
url = if atLeast7
then "mirror://gcc/releases/gcc-${version}/gcc-${version}.tar.xz"
else if atLeast6
Expand Down
Loading