Create native gcc
Some checks failed
buildbot/nix-eval Build done.

This commit is contained in:
Victor Fuentes 2024-10-29 11:43:51 -07:00
parent 866b8902c9
commit f17cba032e
Signed by: vlinkz
GPG key ID: 0A88B68D6A9ACAE0
26 changed files with 2413 additions and 538 deletions

View file

@ -12,27 +12,56 @@ in
inherit lib;
modules = import ./modules.nix;
packages = {
packages =
(builtins.listToAttrs (
builtins.concatMap
(name: [
{
name = "foundation-${name}";
value = config.packages.foundation.${name};
}
{
name = "cross-foundation-${name}-x86_64-linux";
value = config.packages.cross.x86_64-linux.foundation.${name};
}
{
name = "cross-tool-foundation-${name}-x86_64-linux";
value = config.packages.cross-tools.x86_64-linux.foundation.${name};
}
])
[
"binutils"
"bzip2"
"diffutils"
"findutils"
"gawk"
"gcc"
"glibc"
"gnugrep"
"gnumake"
"gnupatch"
"gnused"
"gnutar"
"gzip"
"linux-headers"
"xz"
]
))
// {
aux-a = config.packages.aux.a;
aux-b = config.packages.aux.b;
foundation-gcc = config.packages.foundation.gcc;
foundation-glibc = config.packages.foundation.glibc;
foundation-binutils = config.packages.foundation.binutils;
foundation-linux-headers = config.packages.foundation.linux-headers;
cross-tool-foundation-binutils-aarch64-linux =
config.packages.cross-tools.aarch64-linux.foundation.binutils;
cross-foundation-glibc-x86_64-linux = config.packages.cross.x86_64-linux.foundation.glibc;
cross-foundation-binutils-x86_64-linux = config.packages.cross.x86_64-linux.foundation.binutils;
cross-tool-foundation-gcc-newlib-aarch64-linux =
config.packages.cross-tools.aarch64-linux.foundation.gcc-newlib;
cross-tool-foundation-gcc-newlib-x86_64-linux = config.packages.cross-tools.x86_64-linux.foundation.gcc-newlib;
cross-tool-foundation-gcc-x86_64-linux = config.packages.cross-tools.x86_64-linux.foundation.gcc-cross;
cross-foundation-gcc-x86_64-linux = config.packages.cross.x86_64-linux.foundation.gcc-bootstrap;
cross-tool-foundation-binutils-riscv64-linux =
config.packages.cross-tools.riscv64-linux.foundation.binutils;
example-a = config.packages.foundation.gcc.versions.latest.extend {
platform = {
target = lib.modules.override 0 "x86_64-linux";
};
};
cross-tool-foundation-gcc-newlib-riscv64-linux =
config.packages.cross-tools.riscv64-linux.foundation.gcc-newlib;
};
};
};

View file

@ -211,15 +211,13 @@ in
path:
let
dependencies = lib.attrs.selectOrThrow path collected;
hooks = builtins.map
(
hooks = builtins.map (
dependency:
let
getHooks = dependency.hooks or (lib.fp.const { });
in
getHooks ctx
)
dependencies;
) dependencies;
in
hooks;
in

View file

@ -263,7 +263,8 @@ in
type = lib.types.function lib.types.raw;
internal = true;
writable = false;
default.value = module:
default.value =
module:
let
normalized =
if builtins.isList module then
@ -271,9 +272,11 @@ in
else if builtins.isFunction module || module ? config then
[ module ]
else
[{
[
{
config = module;
}];
}
];
modules = config.__modules__ ++ normalized;

View file

@ -4,7 +4,10 @@ let
doubles = lib.systems.doubles.all;
packages = builtins.removeAttrs config.packages [ "cross" "cross-tools" ];
packages = builtins.removeAttrs config.packages [
"cross"
"cross-tools"
];
in
{
includes = [
@ -64,8 +67,7 @@ in
config = {
packages.cross-tools = lib.attrs.generate doubles (
system:
builtins.mapAttrs
(
builtins.mapAttrs (
namespace:
builtins.mapAttrs (
name: alias:
@ -89,13 +91,11 @@ in
in
updated
)
)
packages
) packages
);
packages.cross = lib.attrs.generate doubles (
system:
builtins.mapAttrs
(
builtins.mapAttrs (
namespace:
builtins.mapAttrs (
name: alias:
@ -120,8 +120,7 @@ in
in
updated
)
)
packages
) packages
);
};
}

View file

@ -1,8 +1,8 @@
{ lib
, lib'
, config
, options
,
{
lib,
lib',
config,
options,
}:
let
inherit (config)
@ -46,7 +46,17 @@ in
];
};
pname = "binutils";
platform = lib.modules.override 1 {
build =
if
config.platform.target.double == "x86_64-linux" || config.platform.target.double == "i686-linux"
then
"i686-linux"
else
"x86_64-linux";
};
pname = "binutils-${config.platform.build.double}--${config.platform.host.double}--${config.platform.target.double}";
version = "2.41";
builder = builders.basic;
@ -54,26 +64,30 @@ in
deps = {
build = {
only = {
gcc = lib.modules.when (!isBootstrapped) (
if isCross then
packages.foundation.gcc-cross.versions.latest.extend
{
gcc = lib.modules.when (!isBootstrapped && !isCross) (packages.foundation.gcc.versions.latest);
binutils = lib.modules.when (!isBootstrapped && !isCross) (
packages.foundation.binutils.versions.latest
);
gnumake = lib.modules.when (!isBuildBootstrapped) packages.foundation.gnumake.versions.latest;
gnupatch = lib.modules.when (!isBuildBootstrapped) packages.foundation.gnupatch.versions.latest;
gnused = lib.modules.when (!isBuildBootstrapped) packages.foundation.gnused.versions.latest;
gnugrep = lib.modules.when (!isBuildBootstrapped) packages.foundation.gnugrep.versions.latest;
gawk = lib.modules.when (!isBuildBootstrapped) packages.foundation.gawk.versions.latest;
diffutils = lib.modules.when (!isBuildBootstrapped) packages.foundation.diffutils.versions.latest;
findutils = lib.modules.when (!isBuildBootstrapped) packages.foundation.findutils.versions.latest;
gnutar = lib.modules.when (!isBuildBootstrapped) packages.foundation.gnutar.versions.latest;
xz = lib.modules.when (!isBuildBootstrapped) packages.foundation.xz.versions.latest;
};
host = {
gcc = lib.modules.when isCross (
packages.foundation.gcc-cross.versions.latest.extend {
platform = lib.modules.override 0 {
inherit (config.platform) build target;
host = config.platform.build;
};
}
else
packages.foundation.gcc.versions.latest
);
glibc = lib.modules.when (isCross) (
packages.foundation.glibc.versions.latest.extend {
platform = lib.modules.override 0 {
inherit (config.platform) host target build;
};
}
);
binutils = lib.modules.when (isCross) (
binutils = lib.modules.when isCross (
packages.foundation.binutils.versions.latest.extend {
platform = lib.modules.override 0 {
inherit (config.platform) target build;
@ -87,10 +101,11 @@ in
env = {
PATH = lib.paths.bin (
lib.lists.when (isBootstrapped) [ foundation.stage2-gcc ]
++ [
lib.lists.when (isBootstrapped) [
foundation.stage2-gcc
foundation.stage2-binutils
]
++ (lib.lists.when (isBuildBootstrapped) [
foundation.stage2-gnumake
foundation.stage2-gnupatch
foundation.stage2-gnused
@ -100,11 +115,9 @@ in
foundation.stage2-findutils
foundation.stage2-gnutar
foundation.stage1-xz
]
])
);
} // (lib.attrs.when (isCross) {
LDFLAGS_FOR_TARGET = "-B${config.deps.build.only.glibc.package}/lib -L${config.deps.build.only.glibc.package}/lib -I${config.deps.build.only.glibc.package}/include";
});
};
phases =
let
@ -139,7 +152,6 @@ in
"--with-lib-path=:"
"--disable-multilib"
];
in
{

View file

@ -0,0 +1,119 @@
{ config, options }:
let
inherit (config)
lib
builders
# These are the upstream foundational packages exported from the Aux Foundation project.
foundation
packages
;
in
{
config.packages.foundation.bzip2 = {
versions = {
"latest" =
{ config, meta }:
{
options = {
src = lib.options.create {
type = lib.types.derivation;
description = "Source for the package.";
};
};
config =
let
isBuildBootstrapped = config.platform.build.double == "i686-linux";
isCross =
(config.platform.build.triple != config.platform.host.triple)
&& (config.platform.host.triple == config.platform.target.triple);
in
{
meta = {
platforms = [
"x86_64-linux"
"i686-linux"
];
};
platform = lib.modules.override 1 {
build =
if
config.platform.target.double == "x86_64-linux" || config.platform.target.double == "i686-linux"
then
"i686-linux"
else
"x86_64-linux";
};
pname = "bzip2";
version = "1.0.8";
builder = builders.basic;
deps = {
build = {
only = {
gcc = lib.modules.when (!isCross) packages.foundation.gcc.versions.latest;
binutils = lib.modules.when (!isCross) packages.foundation.binutils.versions.latest;
};
host = {
gcc = lib.modules.when (isCross) (
packages.foundation.gcc-cross.versions.latest.extend {
platform = lib.modules.override 0 {
inherit (config.platform) build target;
host = config.platform.build;
};
}
);
binutils = lib.modules.when (isCross) (
packages.foundation.binutils.versions.latest.extend {
platform = lib.modules.override 0 {
inherit (config.platform) target build;
host = config.platform.build;
};
}
);
};
};
};
env = {
PATH = lib.paths.bin (
lib.lists.when (isBuildBootstrapped) [
foundation.stage2-gnumake
foundation.stage2-gnutar
foundation.stage2-gzip
]
);
};
phases = {
unpack = ''
tar xf ${config.src}
cd bzip2-${config.version}
'';
build = ''
${lib.strings.when (isCross) ''
export PATH="$PATH:${config.deps.build.host.binutils.package}/${config.platform.target.triple}/bin"
''}
make -j $NIX_BUILD_CORES \
CC="$CC" \
bzip2 bzip2recover
'';
install = ''
make -j $NIX_BUILD_CORES install PREFIX=$out
'';
};
src = builtins.fetchurl {
url = "https://sourceware.org/pub/bzip2/bzip2-${config.version}.tar.gz";
sha256 = "0s92986cv0p692icqlw1j42y9nld8zd83qwhzbqd61p1dqbh6nmb";
};
};
};
};
};
}

View file

@ -5,12 +5,25 @@
options,
}:
{
# includes = lib.attrs.mapToList (key: value: ./${key}) (
# lib.attrs.filter (key: value: value == "directory") (builtins.readDir ./.)
# );
includes = [
./gcc
./binutils
./linux-headers
./bzip2
./diffutils
./findutils
./gawk
./gcc
./glibc
# ./xz
./gnugrep
./gnumake
./gnupatch
./gnused
./gnutar
./gzip
./linux-headers
./xz
];
config = {

View file

@ -0,0 +1,125 @@
{ config, options }:
let
inherit (config)
lib
mirrors
builders
# These are the upstream foundational packages exported from the Aux Foundation project.
foundation
packages
;
in
{
config.packages.foundation.diffutils = {
versions = {
"latest" =
{ config, meta }:
{
options = {
src = lib.options.create {
type = lib.types.derivation;
description = "Source for the package.";
};
};
config =
let
isBuildBootstrapped = config.platform.build.double == "i686-linux";
isCross =
(config.platform.build.triple != config.platform.host.triple)
&& (config.platform.host.triple == config.platform.target.triple);
in
{
meta = {
platforms = [
"x86_64-linux"
"i686-linux"
];
};
platform = lib.modules.override 1 {
build =
if
config.platform.target.double == "x86_64-linux" || config.platform.target.double == "i686-linux"
then
"i686-linux"
else
"x86_64-linux";
};
pname = "diffutils";
version = "3.10";
builder = builders.basic;
deps = {
build = {
only = {
gcc = lib.modules.when (!isCross) packages.foundation.gcc.versions.latest;
binutils = lib.modules.when (!isCross) packages.foundation.binutils.versions.latest;
};
host = {
gcc = lib.modules.when (isCross) (
packages.foundation.gcc-cross.versions.latest.extend {
platform = lib.modules.override 0 {
inherit (config.platform) build target;
host = config.platform.build;
};
}
);
binutils = lib.modules.when (isCross) (
packages.foundation.binutils.versions.latest.extend {
platform = lib.modules.override 0 {
inherit (config.platform) target build;
host = config.platform.build;
};
}
);
};
};
};
env = {
PATH = lib.paths.bin (
lib.lists.when (isBuildBootstrapped) [
foundation.stage2-gnumake
foundation.stage2-gnupatch
foundation.stage2-gnused
foundation.stage2-gnugrep
foundation.stage2-gawk
foundation.stage2-diffutils
foundation.stage2-findutils
foundation.stage2-gnutar
foundation.stage1-xz
]
);
};
phases = {
unpack = ''
tar xf ${config.src}
cd diffutils-${config.version}
'';
build = ''
bash ./configure \
--prefix=$out \
--build=${config.platform.build.triple} \
--host=${config.platform.host.triple}
make -j $NIX_BUILD_CORES
'';
install = ''
make -j $NIX_BUILD_CORES install
'';
};
src = builtins.fetchurl {
url = "${mirrors.gnu}/diffutils/diffutils-${config.version}.tar.xz";
sha256 = "kOXpPMck5OvhLt6A3xY0Bjx6hVaSaFkZv+YLVWyb0J4=";
};
};
};
};
};
}

View file

@ -0,0 +1,126 @@
{ config, options }:
let
inherit (config)
lib
mirrors
builders
# These are the upstream foundational packages exported from the Aux Foundation project.
foundation
packages
;
in
{
config.packages.foundation.findutils = {
versions = {
"latest" =
{ config, meta }:
{
options = {
src = lib.options.create {
type = lib.types.derivation;
description = "Source for the package.";
};
};
config =
let
isBuildBootstrapped = config.platform.build.double == "i686-linux";
isCross =
(config.platform.build.triple != config.platform.host.triple)
&& (config.platform.host.triple == config.platform.target.triple);
in
{
meta = {
platforms = [
"x86_64-linux"
"i686-linux"
];
};
platform = lib.modules.override 1 {
build =
if
config.platform.target.double == "x86_64-linux" || config.platform.target.double == "i686-linux"
then
"i686-linux"
else
"x86_64-linux";
};
pname = "findutils";
version = "4.9.0";
builder = builders.basic;
deps = {
build = {
only = {
gcc = lib.modules.when (!isCross) packages.foundation.gcc.versions.latest;
binutils = lib.modules.when (!isCross) packages.foundation.binutils.versions.latest;
};
host = {
gcc = lib.modules.when (isCross) (
packages.foundation.gcc-cross.versions.latest.extend {
platform = lib.modules.override 0 {
inherit (config.platform) build target;
host = config.platform.build;
};
}
);
binutils = lib.modules.when (isCross) (
packages.foundation.binutils.versions.latest.extend {
platform = lib.modules.override 0 {
inherit (config.platform) target build;
host = config.platform.build;
};
}
);
};
};
};
env = {
PATH = lib.paths.bin (
lib.lists.when (isBuildBootstrapped) [
foundation.stage2-gnumake
foundation.stage2-gnupatch
foundation.stage2-gnused
foundation.stage2-gnugrep
foundation.stage2-gawk
foundation.stage2-diffutils
foundation.stage2-findutils
foundation.stage2-gnutar
foundation.stage1-xz
]
);
};
phases = {
unpack = ''
tar xf ${config.src}
cd findutils-${config.version}
'';
build = ''
bash ./configure \
--prefix=$out \
--build=${config.platform.build.triple} \
--host=${config.platform.host.triple}
make -j $NIX_BUILD_CORES
'';
install = ''
make -j $NIX_BUILD_CORES install
rm $out/bin/updatedb
'';
};
src = builtins.fetchurl {
url = "${mirrors.gnu}/findutils/findutils-${config.version}.tar.xz";
sha256 = "or+4wJ1DZ3DtxZ9Q+kg+eFsWGjt7nVR1c8sIBl/UYv4=";
};
};
};
};
};
}

View file

@ -0,0 +1,126 @@
{ config, options }:
let
inherit (config)
lib
mirrors
builders
# These are the upstream foundational packages exported from the Aux Foundation project.
foundation
packages
;
in
{
config.packages.foundation.gawk = {
versions = {
"latest" =
{ config, meta }:
{
options = {
src = lib.options.create {
type = lib.types.derivation;
description = "Source for the package.";
};
};
config =
let
isBuildBootstrapped = config.platform.build.double == "i686-linux";
isCross =
(config.platform.build.triple != config.platform.host.triple)
&& (config.platform.host.triple == config.platform.target.triple);
in
{
meta = {
platforms = [
"x86_64-linux"
"i686-linux"
];
};
platform = lib.modules.override 1 {
build =
if
config.platform.target.double == "x86_64-linux" || config.platform.target.double == "i686-linux"
then
"i686-linux"
else
"x86_64-linux";
};
pname = "gawk";
version = "5.2.2";
builder = builders.basic;
deps = {
build = {
only = {
gcc = lib.modules.when (!isCross) packages.foundation.gcc.versions.latest;
binutils = lib.modules.when (!isCross) packages.foundation.binutils.versions.latest;
};
host = {
gcc = lib.modules.when (isCross) (
packages.foundation.gcc-cross.versions.latest.extend {
platform = lib.modules.override 0 {
inherit (config.platform) build target;
host = config.platform.build;
};
}
);
binutils = lib.modules.when (isCross) (
packages.foundation.binutils.versions.latest.extend {
platform = lib.modules.override 0 {
inherit (config.platform) target build;
host = config.platform.build;
};
}
);
};
};
};
env = {
PATH = lib.paths.bin (
lib.lists.when (isBuildBootstrapped) [
foundation.stage2-gnumake
foundation.stage2-gnupatch
foundation.stage2-gnused
foundation.stage2-gnugrep
foundation.stage2-gawk
foundation.stage2-diffutils
foundation.stage2-findutils
foundation.stage2-gnutar
foundation.stage2-gzip
]
);
};
phases = {
unpack = ''
tar xf ${config.src}
cd gawk-${config.version}
'';
build = ''
bash ./configure \
--prefix=$out \
--build=${config.platform.build.triple} \
--host=${config.platform.host.triple}
make -j $NIX_BUILD_CORES
'';
install = ''
make -j $NIX_BUILD_CORES install
rm $out/bin/gawkbug
'';
};
src = builtins.fetchurl {
url = "${mirrors.gnu}/gawk/gawk-${config.version}.tar.gz";
sha256 = "lFrvfM/xAfILIqEIArwAXplKsrjqPnJMwaGXxi9B9lA=";
};
};
};
};
};
}

View file

@ -8,44 +8,79 @@ in
{
config.packages.foundation.gcc-bootstrap = {
versions = {
"latest" = config.packages.foundation.gcc.versions.latest.extend
(
"latest" = config.packages.foundation.gcc-common.versions.latest.extend (
{ config }:
{
config = {
config =
let
isBuildBootstrapped = config.platform.build.double == "i686-linux";
bootstrapArch =
if
config.platform.target.double == "x86_64-linux" || config.platform.target.double == "i686-linux"
then
"i686-linux"
else
"x86_64-linux";
in
{
meta = {
platforms = lib.modules.override 0 [
"i686-linux"
];
};
platform = lib.modules.override 1 {
build = bootstrapArch;
};
pname =
lib.modules.override 0
"gcc-bootstrap-${config.platform.build.double}--${config.platform.host.double}--${config.platform.target.double}";
deps = {
build = {
build = {
only = {
binutils = lib.modules.when (!isBuildBootstrapped) packages.foundation.binutils.versions.latest;
gnumake = lib.modules.when (!isBuildBootstrapped) packages.foundation.gnumake.versions.latest;
gnused = lib.modules.when (!isBuildBootstrapped) packages.foundation.gnused.versions.latest;
gnugrep = lib.modules.when (!isBuildBootstrapped) packages.foundation.gnugrep.versions.latest;
gnupatch = lib.modules.when (!isBuildBootstrapped) packages.foundation.gnupatch.versions.latest;
gawk = lib.modules.when (!isBuildBootstrapped) packages.foundation.gawk.versions.latest;
diffutils = lib.modules.when (!isBuildBootstrapped) packages.foundation.diffutils.versions.latest;
findutils = lib.modules.when (!isBuildBootstrapped) packages.foundation.findutils.versions.latest;
gnutar = lib.modules.when (!isBuildBootstrapped) packages.foundation.gnutar.versions.latest;
gzip = lib.modules.when (!isBuildBootstrapped) packages.foundation.gzip.versions.latest;
bzip2 = lib.modules.when (!isBuildBootstrapped) packages.foundation.bzip2.versions.latest;
xz = lib.modules.when (!isBuildBootstrapped) packages.foundation.xz.versions.latest;
};
host = {
gcc = lib.modules.override 0 (
packages.foundation.gcc-cross.versions.latest.extend {
platform = lib.modules.override 0 {
build = "i686-linux";
target = config.platform.target;
host = "i686-linux";
inherit (config.platform) target;
build = bootstrapArch;
host = bootstrapArch;
};
}
);
binutils = lib.modules.override 0 (
packages.foundation.binutils.versions.latest.extend {
platform = lib.modules.override 0 {
build = "i686-linux";
target = config.platform.target;
host = config.platform.host;
inherit (config.platform) target host;
build = bootstrapArch;
};
}
);
};
};
host = {
host = {
glibc = lib.modules.override 0 (
packages.foundation.glibc.versions.latest.extend {
platform = lib.modules.override 0 {
build = "i686-linux";
target = config.platform.target;
host = config.platform.host;
inherit (config.platform) target host;
build = bootstrapArch;
};
}
);
@ -54,25 +89,52 @@ in
};
env = {
LIBRARY_PATH = lib.modules.override 0 "${config.deps.build.build.glibc.package}/lib";
CFLAGS_FOR_TARGET = "-Wl,-dynamic-linker -Wl,${config.deps.host.host.glibc.package}/lib/ld-linux-x86-64.so.2";
LIBRARY_PATH = lib.modules.override 0 "${config.deps.host.host.glibc.package}/lib";
LDFLAGS_FOR_TARGET =
lib.modules.override 0
"-L$(pwd)/${config.platform.target.triple}/libgcc -L${config.deps.build.build.glibc.package}/lib";
"-L$(pwd)/${config.platform.target.triple}/libgcc -L${config.deps.host.host.glibc.package}/lib";
};
hooks =
let
flags = [
"-Wl,-dynamic-linker"
"-Wl,${config.deps.host.host.glibc.package}/lib/ld-linux${
lib.strings.when (
(lib.systems.withBuildInfo config.platform.target).isx86
&& (lib.systems.withBuildInfo config.platform.target).is64bit
) "-x86-64"
}.so.2"
"-B${config.deps.host.host.glibc.package}/lib"
];
in
lib.modules.override 0 (ctx: {
"aux:gcc:env" = lib.dag.entry.between [ "unpack" ] [ "configure" ] ''
export CC='${config.package}/bin/gcc ${builtins.concatStringsSep " " flags}'
export CXX='${config.package}/bin/g++ ${builtins.concatStringsSep " " flags}'
export CC_FOR_TARGET=$CC
export CXX_FOR_TARGET=$CXX
export CC_FOR_BUILD=$CC
export CXX_FOR_BUILD=$CXX
alias gcc='$CC'
alias g++='$CXX'
'';
});
configureFlags = lib.modules.override 0 [
"--prefix=${builtins.placeholder "out"}"
# Pretend we're native even though we're not
"--build=${config.platform.target.triple}"
"--host=${config.platform.host.triple}"
"--target=${config.platform.target.triple}"
"--with-as=${config.deps.build.build.binutils.package}/bin/as"
"--with-ld=${config.deps.build.build.binutils.package}/bin/ld"
"--with-as=${config.deps.build.host.binutils.package}/bin/as"
"--with-ld=${config.deps.build.host.binutils.package}/bin/ld"
"--enable-languages=c,c++"
"--disable-bootstrap"
"--disable-libsanitizer"
"--disable-multilib"
"--with-native-system-header-dir=${config.deps.build.build.glibc.package}/include"
"--with-native-system-header-dir=${config.deps.host.host.glibc.package}/include"
"--with-gxx-include-dir=${placeholder "out"}/include/c++/${config.version}/"
"--with-build-sysroot=/"
];

View file

@ -0,0 +1,226 @@
{ config, options }:
let
inherit (config)
lib
mirrors
builders
# These are the upstream foundational packages exported from the Aux Foundation project.
foundation
;
in
{
config.packages.foundation.gcc-common = {
versions = {
"latest" =
{ config, meta }:
{
options = {
src = lib.options.create {
type = lib.types.derivation;
description = "Source for the package.";
};
cc = {
src = lib.options.create {
type = lib.types.derivation;
description = "The cc source for the package.";
};
};
gmp = {
src = lib.options.create {
type = lib.types.derivation;
description = "The gmp source for the package.";
};
version = lib.options.create {
type = lib.types.string;
description = "Version of gmp.";
};
};
mpfr = {
src = lib.options.create {
type = lib.types.derivation;
description = "The mpfr source for the package.";
};
version = lib.options.create {
type = lib.types.string;
description = "Version of mpfr.";
};
};
mpc = {
src = lib.options.create {
type = lib.types.derivation;
description = "The mpc source for the package.";
};
version = lib.options.create {
type = lib.types.string;
description = "Version of mpc.";
};
};
isl = {
src = lib.options.create {
type = lib.types.derivation;
description = "The isl source for the package.";
};
version = lib.options.create {
type = lib.types.string;
description = "Version of isl.";
};
};
configureFlags = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Flags to pass to the configure script.";
};
exports = lib.options.create {
type = lib.types.attrs.of lib.types.string;
description = "List of exports to add to the environment.";
};
};
config =
let
isBuildBootstrapped = config.platform.build.double == "i686-linux";
isHostBootstrapped = config.platform.host.double == "i686-linux";
isBootstrapped = isBuildBootstrapped && isHostBootstrapped;
in
{
meta = {
platforms = [
"x86_64-linux"
"i686-linux"
];
};
pname = "gcc-${config.platform.build.double}--${config.platform.host.double}--${config.platform.target.double}";
version = "13.2.0";
builder = builders.basic;
env =
{
PATH = lib.modules.when (isBuildBootstrapped) (
lib.paths.bin (
[
foundation.stage2-gnumake
foundation.stage2-gnused
foundation.stage2-gnugrep
foundation.stage2-gnupatch
foundation.stage2-gawk
foundation.stage2-diffutils
foundation.stage2-findutils
foundation.stage2-gnutar
foundation.stage2-gzip
foundation.stage2-bzip2
foundation.stage1-xz
]
++ (lib.lists.when (isBootstrapped) [
foundation.stage2-gcc
foundation.stage2-binutils
])
)
);
}
// lib.attrs.when (isBootstrapped) {
CC = "gcc -Wl,-dynamic-linker -Wl,${foundation.stage1-musl}/lib/libc.so";
CXX = "g++ -Wl,-dynamic-linker -Wl,${foundation.stage1-musl}/lib/libc.so";
};
phases =
let
patches = [
# Make binutils output deterministic by default.
./patches/libstdc++-target.patch
];
in
{
unpack = ''
# Unpack
tar xf ${config.src}
tar xf ${config.gmp.src}
tar xf ${config.mpfr.src}
tar xf ${config.mpc.src}
tar xf ${config.isl.src}
cd gcc-${config.version}
ln -s ../gmp-${config.gmp.version} gmp
ln -s ../mpfr-${config.mpfr.version} mpfr
ln -s ../mpc-${config.mpc.version} mpc
ln -s ../isl-${config.isl.version} isl
'';
patch = ''
${lib.strings.concatMapSep "\n" (file: "patch -Np1 -i ${file}") patches}
'';
configure = ''
# Configure
mkdir build
cd build
bash ../configure ${builtins.concatStringsSep " " config.configureFlags}
'';
build = ''
# Build
make -j $NIX_BUILD_CORES
'';
install = ''
# Install
${lib.strings.when ((lib.systems.withBuildInfo config.platform.host).is64bit) ''
mkdir -p $out/lib
ln -s lib $out/lib64
''}
make -j $NIX_BUILD_CORES install
'';
};
src = builtins.fetchurl {
url = "${mirrors.gnu}/gcc/gcc-${config.version}/gcc-${config.version}.tar.xz";
sha256 = "4nXnZEKmBnNBon8Exca4PYYTFEAEwEE1KIY9xrXHQ9o=";
};
gmp = {
version = "6.3.0";
src = builtins.fetchurl {
url = "${mirrors.gnu}/gmp/gmp-${config.gmp.version}.tar.xz";
sha256 = "o8K4AgG4nmhhb0rTC8Zq7kknw85Q4zkpyoGdXENTiJg=";
};
};
mpfr = {
version = "4.2.1";
src = builtins.fetchurl {
url = "${mirrors.gnu}/mpfr/mpfr-${config.mpfr.version}.tar.xz";
sha256 = "J3gHNTpnJpeJlpRa8T5Sgp46vXqaW3+yeTiU4Y8fy7I=";
};
};
mpc = {
version = "1.3.1";
src = builtins.fetchurl {
url = "${mirrors.gnu}/mpc/mpc-${config.mpc.version}.tar.gz";
sha256 = "q2QkkvXPiCt0qgy3MM1BCoHtzb7IlRg86TDnBsHHWbg=";
};
};
isl = {
version = "0.24";
src = builtins.fetchurl {
url = "https://gcc.gnu.org/pub/gcc/infrastructure/isl-${config.isl.version}.tar.bz2";
sha256 = "/PeN2WVsEOuM+fvV9ZoLawE4YgX+GTSzsoegoYmBRcA=";
};
};
};
};
};
};
}

View file

@ -9,16 +9,26 @@ in
{
config.packages.foundation.gcc-cross = {
versions = {
"latest" = config.packages.foundation.gcc.versions.latest.extend
(
"latest" = config.packages.foundation.gcc-common.versions.latest.extend (
{ config }:
{
config =
let
programPrefix = lib.strings.when
(
programPrefix = lib.strings.when (
config.platform.build.triple != config.platform.target.triple
) "${config.platform.target.triple}-";
isBuildBootstrapped = config.platform.build.double == "i686-linux";
isHostBootstrapped = config.platform.host.double == "i686-linux";
isBootstrapped = isBuildBootstrapped && isHostBootstrapped;
bootstrapArch =
if
config.platform.target.double == "x86_64-linux" || config.platform.target.double == "i686-linux"
then
"i686-linux"
else
"x86_64-linux";
in
{
meta = {
@ -27,14 +37,50 @@ in
];
};
pname =
lib.modules.override 0
"gcc-cross-${config.platform.build.double}--${config.platform.host.double}--${config.platform.target.double}";
deps = {
build = {
build = {
only = {
binutils = lib.modules.when (!isBuildBootstrapped) packages.foundation.binutils.versions.latest;
gnumake = lib.modules.when (!isBuildBootstrapped) packages.foundation.gnumake.versions.latest;
gnused = lib.modules.when (!isBuildBootstrapped) packages.foundation.gnused.versions.latest;
gnugrep = lib.modules.when (!isBuildBootstrapped) packages.foundation.gnugrep.versions.latest;
gnupatch = lib.modules.when (!isBuildBootstrapped) packages.foundation.gnupatch.versions.latest;
gawk = lib.modules.when (!isBuildBootstrapped) packages.foundation.gawk.versions.latest;
diffutils = lib.modules.when (!isBuildBootstrapped) packages.foundation.diffutils.versions.latest;
findutils = lib.modules.when (!isBuildBootstrapped) packages.foundation.findutils.versions.latest;
gnutar = lib.modules.when (!isBuildBootstrapped) packages.foundation.gnutar.versions.latest;
gzip = lib.modules.when (!isBuildBootstrapped) packages.foundation.gzip.versions.latest;
bzip2 = lib.modules.when (!isBuildBootstrapped) packages.foundation.bzip2.versions.latest;
xz = lib.modules.when (!isBuildBootstrapped) packages.foundation.xz.versions.latest;
};
host = {
gcc = (
lib.modules.when (!isBootstrapped) (
lib.modules.override 0 (
packages.foundation.gcc.versions.latest.extend {
platform = lib.modules.override 0 {
inherit (config.platform) build host;
target = bootstrapArch;
};
}
)
)
);
binutils = (
lib.modules.override 0 (
packages.foundation.binutils.versions.latest.extend {
platform = lib.modules.override 0 config.platform;
}
)
);
};
};
host = {
host = {
glibc = (
packages.foundation.glibc.versions.latest.extend {
platform = lib.modules.override 0 {
@ -43,42 +89,65 @@ in
};
}
);
linux-headers = (
packages.foundation.linux-headers.versions.latest.extend {
platform.target = lib.modules.override 0 config.platform.target;
}
);
};
};
};
env = {
# LIBRARY_PATH = lib.modules.override 0 "${foundation.stage1-musl}/lib";
CC = lib.modules.override 0 "gcc -Wl,-dynamic-linker -Wl,${foundation.stage1-musl}/lib/libc.so -idirafter ${foundation.stage1-musl}/include";
CXX = lib.modules.override 0 "g++ -Wl,-dynamic-linker -Wl,${foundation.stage1-musl}/lib/libc.so -idirafter ${foundation.stage1-musl}/include";
CC =
lib.modules.override 0
"gcc -Wl,-dynamic-linker -Wl,${foundation.stage1-musl}/lib/libc.so -idirafter ${foundation.stage1-musl}/include";
CXX =
lib.modules.override 0
"g++ -Wl,-dynamic-linker -Wl,${foundation.stage1-musl}/lib/libc.so -idirafter ${foundation.stage1-musl}/include";
CFLAGS_FOR_TARGET =
lib.modules.override 0
"-Wl,-dynamic-linker -Wl,${config.deps.build.build.glibc.package}/lib/ld-linux-x86-64.so.2 -B${config.deps.build.build.glibc.package}/lib";
"-Wl,-dynamic-linker -Wl,${config.deps.host.host.glibc.package}/lib/ld-linux-x86-64.so.2 -B${config.deps.host.host.glibc.package}/lib";
LDFLAGS_FOR_TARGET =
lib.modules.override 0
"-L$(pwd)/${config.platform.target.triple}/libgcc -L${config.deps.build.build.glibc.package}/lib";
"-L$(pwd)/${config.platform.target.triple}/libgcc -L${config.deps.host.host.glibc.package}/lib";
};
hooks =
let
flags = [
"-Wl,-dynamic-linker"
"-Wl,${config.deps.host.host.glibc.package}/lib/ld-linux${
lib.strings.when (
(lib.systems.withBuildInfo config.platform.target).isx86
&& (lib.systems.withBuildInfo config.platform.target).is64bit
) "-x86-64"
}.so.2"
"-B${config.deps.host.host.glibc.package}/lib"
];
in
lib.modules.override 0 (ctx: {
"aux:gcc:env" = lib.dag.entry.between [ "unpack" ] [ "configure" ] ''
export CC='${config.package}/bin/${programPrefix}gcc ${builtins.concatStringsSep " " flags}'
export CXX='${config.package}/bin/${programPrefix}g++ ${builtins.concatStringsSep " " flags}'
export CC_FOR_TARGET=$CC
export CXX_FOR_TARGET=$CXX
export CC_FOR_BUILD=$CC
export CXX_FOR_BUILD=$CXX
alias gcc='$CC'
alias g++='$CXX'
'';
});
configureFlags = lib.modules.override 0 [
"--prefix=${builtins.placeholder "out"}"
"--build=${config.platform.build.triple}"
"--host=${config.platform.host.triple}"
"--target=${config.platform.target.triple}"
"--with-as=${config.deps.build.build.binutils.package}/bin/${programPrefix}as"
"--with-ld=${config.deps.build.build.binutils.package}/bin/${programPrefix}ld"
"--with-as=${config.deps.build.host.binutils.package}/bin/${programPrefix}as"
"--with-ld=${config.deps.build.host.binutils.package}/bin/${programPrefix}ld"
"--enable-languages=c,c++"
"--disable-libsanitizer"
"--disable-lto"
"--disable-multilib"
"--with-headers=${config.deps.build.build.glibc.package}/include"
"--with-headers=${config.deps.host.host.glibc.package}/include"
"--with-build-sysroot=/"
# "--with-sysroot=${config.deps.build.build.glibc.package}"
"--with-native-system-header-dir=${config.deps.build.build.glibc.package}/include"
"--with-native-system-header-dir=${config.deps.host.host.glibc.package}/include"
];
phases.configure = lib.modules.override 0 ''
@ -90,9 +159,9 @@ in
# TODO(vlinkz) Hack to fix missing crti.o and crtn.o. Figure out how to properly find their paths.
mkdir gcc
ln -sv ${config.deps.build.build.glibc.package}/lib/{crti.o,crtn.o} gcc
ln -sv ${config.deps.host.host.glibc.package}/lib/{crti.o,crtn.o} gcc
mkdir -p x86_64-unknown-linux-gnu/libstdc++-v3/src
ln -sv ${config.deps.build.build.glibc.package}/lib/{crti.o,crtn.o} x86_64-unknown-linux-gnu/libstdc++-v3/src
ln -sv ${config.deps.host.host.glibc.package}/lib/{crti.o,crtn.o} x86_64-unknown-linux-gnu/libstdc++-v3/src
bash ../configure ${builtins.concatStringsSep " " config.configureFlags}
'';

View file

@ -2,10 +2,7 @@
let
inherit (config)
lib
mirrors
builders
# These are the upstream foundational packages exported from the Aux Foundation project.
foundation
packages
;
@ -15,186 +12,180 @@ in
./newlib.nix
./cross.nix
./bootstrap.nix
./common.nix
];
config.packages.foundation.gcc = {
versions = {
"latest" =
"latest" = config.packages.foundation.gcc-common.versions.latest.extend (
{ config, meta }:
{
options = {
src = lib.options.create {
type = lib.types.derivation;
description = "Source for the package.";
};
cc = {
src = lib.options.create {
type = lib.types.derivation;
description = "The cc source for the package.";
};
};
gmp = {
src = lib.options.create {
type = lib.types.derivation;
description = "The gmp source for the package.";
};
version = lib.options.create {
type = lib.types.string;
description = "Version of gmp.";
};
};
mpfr = {
src = lib.options.create {
type = lib.types.derivation;
description = "The mpfr source for the package.";
};
version = lib.options.create {
type = lib.types.string;
description = "Version of mpfr.";
};
};
mpc = {
src = lib.options.create {
type = lib.types.derivation;
description = "The mpc source for the package.";
};
version = lib.options.create {
type = lib.types.string;
description = "Version of mpc.";
};
};
isl = {
src = lib.options.create {
type = lib.types.derivation;
description = "The isl source for the package.";
};
version = lib.options.create {
type = lib.types.string;
description = "Version of isl.";
};
};
configureFlags = lib.options.create {
type = lib.types.list.of lib.types.string;
description = "Flags to pass to the configure script.";
};
exports = lib.options.create {
type = lib.types.attrs.of lib.types.string;
description = "List of exports to add to the environment.";
};
};
config =
let
isBuildBootstrapped = config.platform.build.double == "i686-linux";
isHostBootstrapped = config.platform.host.double == "i686-linux";
isBootstrapped = isBuildBootstrapped && isHostBootstrapped;
crossTool =
(config.platform.target.triple != config.platform.host.triple)
&& (config.platform.host.triple == config.platform.build.triple);
cross =
(config.platform.target.triple != config.platform.host.triple)
&& (config.platform.host.triple == config.platform.target.triple);
programPrefix = lib.strings.when
(
config.platform.build.triple != config.platform.target.triple
) "${config.platform.target.triple}-";
libc = if isBootstrapped then foundation.stage1-musl else config.deps.build.build.glibc.package;
libcLd =
if isBootstrapped then
"${foundation.stage1-musl}/lib/libc.so"
bootstrapArch =
if
config.platform.target.double == "x86_64-linux" || config.platform.target.double == "i686-linux"
then
"i686-linux"
else
"${config.deps.build.build.glibc.package}/lib/ld-linux-x86-64.so.2";
"x86_64-linux";
host = lib.systems.withBuildInfo config.platform.host;
target = lib.systems.withBuildInfo config.platform.target;
in
{
meta = {
platforms = [
"i686-linux"
];
};
pname = "gcc-${config.platform.build.double}--${config.platform.host.double}--${config.platform.target.double}";
version = "13.2.0";
builder = builders.basic;
deps = {
build = {
build = lib.modules.when (!isBootstrapped) {
gcc = packages.foundation.gcc-cross.versions.latest;
glibc = packages.foundation.glibc.versions.latest;
linux-headers = packages.foundation.linux-headers.versions.latest;
binutils = packages.foundation.binutils.versions.latest;
only = {
gcc = lib.modules.when (!isBootstrapped) (
packages.foundation.gcc-bootstrap.versions.latest.extend {
platform = lib.modules.override 0 ({
inherit (config.platform) target host;
build = bootstrapArch;
});
}
);
binutils = lib.modules.when (!isBuildBootstrapped) (
packages.foundation.binutils.versions.latest.extend {
platform = lib.modules.override 0 ({
inherit (config.platform) target host;
build = bootstrapArch;
});
}
);
gnumake = lib.modules.when (!isBuildBootstrapped) (
packages.foundation.gnumake.versions.latest.extend {
platform = lib.modules.override 0 ({
inherit (config.platform) target host;
build = bootstrapArch;
});
}
);
gnused = lib.modules.when (!isBuildBootstrapped) (
packages.foundation.gnused.versions.latest.extend {
platform = lib.modules.override 0 ({
inherit (config.platform) target host;
build = bootstrapArch;
});
}
);
gnugrep = lib.modules.when (!isBuildBootstrapped) (
packages.foundation.gnugrep.versions.latest.extend {
platform = lib.modules.override 0 ({
inherit (config.platform) target host;
build = bootstrapArch;
});
}
);
gnupatch = lib.modules.when (!isBuildBootstrapped) (
packages.foundation.gnupatch.versions.latest.extend {
platform = lib.modules.override 0 ({
inherit (config.platform) target host;
build = bootstrapArch;
});
}
);
gawk = lib.modules.when (!isBuildBootstrapped) (
packages.foundation.gawk.versions.latest.extend {
platform = lib.modules.override 0 ({
inherit (config.platform) target host;
build = bootstrapArch;
});
}
);
diffutils = lib.modules.when (!isBuildBootstrapped) (
packages.foundation.diffutils.versions.latest.extend {
platform = lib.modules.override 0 ({
inherit (config.platform) target host;
build = bootstrapArch;
});
}
);
findutils = lib.modules.when (!isBuildBootstrapped) (
packages.foundation.findutils.versions.latest.extend {
platform = lib.modules.override 0 ({
inherit (config.platform) target host;
build = bootstrapArch;
});
}
);
gnutar = lib.modules.when (!isBuildBootstrapped) (
packages.foundation.gnutar.versions.latest.extend {
platform = lib.modules.override 0 ({
inherit (config.platform) target host;
build = bootstrapArch;
});
}
);
gzip = lib.modules.when (!isBuildBootstrapped) (
packages.foundation.gzip.versions.latest.extend {
platform = lib.modules.override 0 ({
inherit (config.platform) target host;
build = bootstrapArch;
});
}
);
bzip2 = lib.modules.when (!isBuildBootstrapped) (
packages.foundation.bzip2.versions.latest.extend {
platform = lib.modules.override 0 ({
inherit (config.platform) target host;
build = bootstrapArch;
});
}
);
xz = lib.modules.when (!isBuildBootstrapped) (
packages.foundation.xz.versions.latest.extend {
platform = lib.modules.override 0 ({
inherit (config.platform) target host;
build = bootstrapArch;
});
}
);
};
};
host = {
host = {
glibc = packages.foundation.glibc.versions.latest.extend {
platform = lib.modules.override 0 ({
inherit (config.platform) target host;
build = bootstrapArch;
});
};
};
};
};
env =
{
PATH = lib.modules.when (isBuildBootstrapped) (
lib.paths.bin ([
foundation.stage2-gnumake
foundation.stage2-gnused
foundation.stage2-gnugrep
foundation.stage2-gnupatch
foundation.stage2-gawk
foundation.stage2-diffutils
foundation.stage2-findutils
foundation.stage2-gnutar
foundation.stage2-gzip
foundation.stage2-bzip2
foundation.stage1-xz
] ++ (lib.lists.when (isBootstrapped) [
foundation.stage2-gcc
foundation.stage2-binutils
]))
);
CFLAGS_FOR_TARGET = "-Wl,-dynamic-linker -Wl,${libcLd}";
}
// lib.attrs.when (isBootstrapped) {
CC = "gcc -Wl,-dynamic-linker -Wl,${foundation.stage1-musl}/lib/libc.so";
CXX = "g++ -Wl,-dynamic-linker -Wl,${foundation.stage1-musl}/lib/libc.so";
}
// lib.attrs.when (!cross && !crossTool) {
LIBRARY_PATH = "${libc}/lib";
env = {
CFLAGS_FOR_TARGET = "-Wl,-dynamic-linker -Wl,${
if isBootstrapped then
"${foundation.stage1-musl}/lib/libc.so"
else
"${config.deps.host.host.glibc.package}/lib/ld-linux${
lib.strings.when (target.isx86 && target.is64bit) "-x86-64"
}.so.2"
}";
LIBRARY_PATH = "${
if isBootstrapped then foundation.stage1-musl else config.deps.host.host.glibc.package
}/lib";
};
hooks =
let
flags =
if (isBootstrapped && !(cross || crossTool)) then
[
flags = [
"-Wl,-dynamic-linker"
"-Wl,${foundation.stage1-musl}/lib/libc.so"
]
else
[
"-Wl,-dynamic-linker"
"-Wl,${config.deps.build.build.glibc.package}/lib/ld-linux${lib.strings.when (target.isx86 && target.is64bit) "-x86-64"}.so.2"
"-B${config.deps.build.build.glibc.package}/lib"
# "-idirafter ${config.deps.build.build.glibc.package}/include"
"-Wl,${config.deps.host.host.glibc.package}/lib/ld-linux${
lib.strings.when (target.isx86 && target.is64bit) "-x86-64"
}.so.2"
"-B${config.deps.host.host.glibc.package}/lib"
];
in
ctx: {
"aux:gcc:env" = lib.dag.entry.between [ "unpack" ] [ "configure" ] ''
export CC='${config.package}/bin/${programPrefix}gcc ${builtins.concatStringsSep " " flags}'
export CXX='${config.package}/bin/${programPrefix}g++ ${builtins.concatStringsSep " " flags}'
export CC='${config.package}/bin/gcc ${builtins.concatStringsSep " " flags}'
export CXX='${config.package}/bin/g++ ${builtins.concatStringsSep " " flags}'
export CC_FOR_TARGET=$CC
export CXX_FOR_TARGET=$CXX
export CC_FOR_BUILD=$CC
@ -215,7 +206,9 @@ in
"--disable-libsanitizer"
"--disable-multilib"
"--with-build-sysroot=/"
"--with-native-system-header-dir=${libc}/include"
"--with-native-system-header-dir=${
if isBootstrapped then foundation.stage1-musl else config.deps.host.host.glibc.package
}/include"
]
++ lib.lists.when (isBootstrapped) [
"--disable-lto"
@ -229,92 +222,13 @@ in
];
in
{
unpack = ''
# Unpack
tar xf ${config.src}
tar xf ${config.gmp.src}
tar xf ${config.mpfr.src}
tar xf ${config.mpc.src}
tar xf ${config.isl.src}
cd gcc-${config.version}
ln -s ../gmp-${config.gmp.version} gmp
ln -s ../mpfr-${config.mpfr.version} mpfr
ln -s ../mpc-${config.mpc.version} mpc
ln -s ../isl-${config.isl.version} isl
'';
patch = ''
patch = lib.modules.override 0 ''
${lib.strings.concatMapSep "\n" (file: "patch -Np1 -i ${file}") patches}
${lib.strings.when (isBootstrapped && !(crossTool || cross))''
# force musl even if host triple is gnu
sed -i 's|"os/gnu-linux"|"os/generic"|' libstdc++-v3/configure.host
''}
'';
configure = ''
# Configure
mkdir build
cd build
bash ../configure ${builtins.concatStringsSep " " config.configureFlags}
'';
build = ''
# Build
make -j $NIX_BUILD_CORES
'';
install = ''
# Install
${
lib.strings.when (host.is64bit) ''
mkdir -p $out/lib
ln -s lib $out/lib64
''
}
make -j $NIX_BUILD_CORES install
'';
};
src = builtins.fetchurl {
url = "${mirrors.gnu}/gcc/gcc-${config.version}/gcc-${config.version}.tar.xz";
sha256 = "4nXnZEKmBnNBon8Exca4PYYTFEAEwEE1KIY9xrXHQ9o=";
};
gmp = {
version = "6.3.0";
src = builtins.fetchurl {
url = "${mirrors.gnu}/gmp/gmp-${config.gmp.version}.tar.xz";
sha256 = "o8K4AgG4nmhhb0rTC8Zq7kknw85Q4zkpyoGdXENTiJg=";
};
};
mpfr = {
version = "4.2.1";
src = builtins.fetchurl {
url = "${mirrors.gnu}/mpfr/mpfr-${config.mpfr.version}.tar.xz";
sha256 = "J3gHNTpnJpeJlpRa8T5Sgp46vXqaW3+yeTiU4Y8fy7I=";
};
};
mpc = {
version = "1.3.1";
src = builtins.fetchurl {
url = "${mirrors.gnu}/mpc/mpc-${config.mpc.version}.tar.gz";
sha256 = "q2QkkvXPiCt0qgy3MM1BCoHtzb7IlRg86TDnBsHHWbg=";
};
};
isl = {
version = "0.24";
src = builtins.fetchurl {
url = "https://gcc.gnu.org/pub/gcc/infrastructure/isl-${config.isl.version}.tar.bz2";
sha256 = "/PeN2WVsEOuM+fvV9ZoLawE4YgX+GTSzsoegoYmBRcA=";
};
};
};
};
};
};
}
);
};
};
}

View file

@ -8,42 +8,99 @@ in
{
config.packages.foundation.gcc-newlib = {
versions = {
"latest" = config.packages.foundation.gcc.versions.latest.extend (
"latest" = config.packages.foundation.gcc-common.versions.latest.extend (
{ config }:
{
config =
let
programPrefix = lib.strings.when
(
programPrefix = lib.strings.when (
config.platform.build.triple != config.platform.target.triple
) "${config.platform.target.triple}-";
isBuildBootstrapped = config.platform.build.double == "i686-linux";
isHostBootstrapped = config.platform.host.double == "i686-linux";
isBootstrapped = isBuildBootstrapped && isHostBootstrapped;
bootstrapArch =
if
config.platform.target.double == "x86_64-linux" || config.platform.target.double == "i686-linux"
then
"i686-linux"
else
"x86_64-linux";
in
{
meta = {
platforms = lib.modules.override 0 [
"i686-linux"
"x86_64-linux"
];
};
pname =
lib.modules.override 0
"gcc-newlib-${config.platform.build.double}--${config.platform.host.double}--${config.platform.target.double}";
deps = {
build = {
build = {
only = {
binutils = lib.modules.when (!isBuildBootstrapped) packages.foundation.binutils.versions.latest;
gnumake = lib.modules.when (!isBuildBootstrapped) packages.foundation.gnumake.versions.latest;
gnused = lib.modules.when (!isBuildBootstrapped) packages.foundation.gnused.versions.latest;
gnugrep = lib.modules.when (!isBuildBootstrapped) packages.foundation.gnugrep.versions.latest;
gnupatch = lib.modules.when (!isBuildBootstrapped) packages.foundation.gnupatch.versions.latest;
gawk = lib.modules.when (!isBuildBootstrapped) packages.foundation.gawk.versions.latest;
diffutils = lib.modules.when (!isBuildBootstrapped) packages.foundation.diffutils.versions.latest;
findutils = lib.modules.when (!isBuildBootstrapped) packages.foundation.findutils.versions.latest;
gnutar = lib.modules.when (!isBuildBootstrapped) packages.foundation.gnutar.versions.latest;
gzip = lib.modules.when (!isBuildBootstrapped) packages.foundation.gzip.versions.latest;
bzip2 = lib.modules.when (!isBuildBootstrapped) packages.foundation.bzip2.versions.latest;
xz = lib.modules.when (!isBuildBootstrapped) packages.foundation.xz.versions.latest;
};
host = {
gcc = (
lib.modules.when (!isBootstrapped) (
lib.modules.override 0 (
packages.foundation.gcc.versions.latest.extend {
platform = lib.modules.override 0 {
inherit (config.platform) build host;
target = bootstrapArch;
};
}
)
)
);
binutils = (
lib.modules.override 0 (
packages.foundation.binutils.versions.latest.extend {
platform = lib.modules.override 0 config.platform;
}
)
);
};
};
};
hooks = lib.modules.override 0 (ctx: {
"aux:gcc:env" = lib.dag.entry.between [ "unpack" ] [ "configure" ] ''
export CC='${config.package}/bin/${programPrefix}gcc'
export CXX='${config.package}/bin/${programPrefix}g++'
export CC_FOR_TARGET=$CC
export CXX_FOR_TARGET=$CXX
export CC_FOR_BUILD=$CC
export CXX_FOR_BUILD=$CXX
alias gcc='$CC'
alias g++='$CXX'
'';
});
configureFlags = lib.modules.override 0 [
"--prefix=${builtins.placeholder "out"}"
"--build=${config.platform.build.triple}"
"--host=${config.platform.host.triple}"
"--target=${config.platform.target.triple}"
"--with-as=${config.deps.build.build.binutils.package}/bin/${programPrefix}as"
"--with-ld=${config.deps.build.build.binutils.package}/bin/${programPrefix}ld"
"--with-as=${config.deps.build.host.binutils.package}/bin/${programPrefix}as"
"--with-ld=${config.deps.build.host.binutils.package}/bin/${programPrefix}ld"
"--enable-languages=c,c++"
"--disable-bootstrap"
"--disable-libsanitizer"

View file

@ -30,22 +30,12 @@ in
config =
let
isBuildBootstrapped = config.platform.build.double == "i686-linux";
isHostBootstrapped = config.platform.host.double == "i686-linux";
isBootstrapped = isBuildBootstrapped && isHostBootstrapped;
isCross =
(config.platform.build.triple != config.platform.host.triple)
&& (config.platform.host.triple == config.platform.target.triple);
binutils =
if isCross then
"${
(packages.foundation.binutils.versions.latest.extend {
platform = lib.modules.override 0 {
inherit (config.platform) build target;
host = config.platform.build;
};
}).package
}/${config.platform.target.triple}"
else
foundation.stage2-binutils;
in
{
@ -56,7 +46,17 @@ in
];
};
pname = "glibc";
platform = lib.modules.override 1 {
build =
if
config.platform.target.double == "x86_64-linux" || config.platform.target.double == "i686-linux"
then
"i686-linux"
else
"x86_64-linux";
};
pname = "glibc-${config.platform.build.double}--${config.platform.host.double}--${config.platform.target.double}";
version = "2.38";
src = builtins.fetchurl {
@ -68,9 +68,48 @@ in
deps = {
build = {
only = {
gcc = lib.modules.when (!isBootstrapped && !isCross) (packages.foundation.gcc.versions.latest);
binutils = lib.modules.when (!isBootstrapped && !isCross) (
packages.foundation.binutils.versions.latest
);
gnumake = lib.modules.when (!isBuildBootstrapped) packages.foundation.gnumake.versions.latest;
gnused = lib.modules.when (!isBuildBootstrapped) packages.foundation.gnused.versions.latest;
gnugrep = lib.modules.when (!isBuildBootstrapped) packages.foundation.gnugrep.versions.latest;
gnupatch = lib.modules.when (!isBuildBootstrapped) packages.foundation.gnupatch.versions.latest;
gawk = lib.modules.when (!isBuildBootstrapped) packages.foundation.gawk.versions.latest;
diffutils = lib.modules.when (!isBuildBootstrapped) packages.foundation.diffutils.versions.latest;
findutils = lib.modules.when (!isBuildBootstrapped) packages.foundation.findutils.versions.latest;
gnutar = lib.modules.when (!isBuildBootstrapped) packages.foundation.gnutar.versions.latest;
gzip = lib.modules.when (!isBuildBootstrapped) packages.foundation.gzip.versions.latest;
bzip2 = lib.modules.when (!isBuildBootstrapped) packages.foundation.bzip2.versions.latest;
xz = lib.modules.when (!isBuildBootstrapped) packages.foundation.xz.versions.latest;
};
host = {
gcc = lib.modules.when isCross (
packages.foundation.gcc-newlib.versions.latest.extend {
platform = lib.modules.override 0 {
inherit (config.platform) build target;
host = config.platform.build;
};
}
);
binutils = lib.modules.when isCross (
packages.foundation.binutils.versions.latest.extend {
platform = lib.modules.override 0 {
inherit (config.platform) target build;
host = config.platform.build;
};
}
);
};
};
host = {
host = {
linux-headers = (
packages.foundation.linux-headers.versions.latest.extend {
platform.build = lib.modules.override 0 config.platform.build;
platform.host = lib.modules.override 0 config.platform.host;
platform.target = lib.modules.override 0 config.platform.target;
}
);
@ -79,26 +118,12 @@ in
};
env = {
PATH =
let
gcc =
if
isCross
# Otherwise we are going to need a cross-compiler.
then
(packages.foundation.gcc-newlib.versions.latest.extend {
platform = lib.modules.override 0 {
inherit (config.platform) build target;
host = config.platform.build;
};
}).package
# If we're on the same system then we can use the existing GCC instance.
else
foundation.stage2-gcc;
in
lib.paths.bin [
gcc
binutils
PATH = lib.paths.bin (
lib.lists.when (isBootstrapped) [
foundation.stage2-gcc
foundation.stage2-binutils
]
++ (lib.lists.when (isBuildBootstrapped) [
foundation.stage2-gnumake
foundation.stage2-gnused
foundation.stage2-gnugrep
@ -111,12 +136,11 @@ in
foundation.stage1-python
foundation.stage1-bison
foundation.stage1-xz
];
])
);
};
phases =
{
phases = {
unpack = ''
tar xf ${config.src}
cd glibc-${config.version}
@ -130,8 +154,15 @@ in
--prefix=$out \
--build=${config.platform.build.triple} \
--host=${config.platform.host.triple} \
--with-headers=${config.deps.build.host.linux-headers.package}/include \
--with-binutils=${binutils}/bin
--with-headers=${config.deps.host.host.linux-headers.package}/include \
--with-binutils=${
if isBootstrapped then
foundation.stage2-binutils
else if isCross then
config.deps.build.host.binutils.package
else
config.deps.build.only.binutils.package
}${lib.strings.when (isCross) "/${config.platform.target.triple}"}/bin
'';
build = ''
@ -142,7 +173,7 @@ in
install = ''
# Install
make -j $NIX_BUILD_CORES install
ln -sv $(ls -d ${config.deps.build.host.linux-headers.package}/include/* | grep -v scsi\$) $out/include/
ln -sv $(ls -d ${config.deps.host.host.linux-headers.package}/include/* | grep -v scsi\$) $out/include/
'';
};
};

View file

@ -0,0 +1,126 @@
{ config, options }:
let
inherit (config)
lib
mirrors
builders
# These are the upstream foundational packages exported from the Aux Foundation project.
foundation
packages
;
in
{
config.packages.foundation.gnugrep = {
versions = {
"latest" =
{ config, meta }:
{
options = {
src = lib.options.create {
type = lib.types.derivation;
description = "Source for the package.";
};
};
config =
let
isBuildBootstrapped = config.platform.build.double == "i686-linux";
isCross =
(config.platform.build.triple != config.platform.host.triple)
&& (config.platform.host.triple == config.platform.target.triple);
in
{
meta = {
platforms = [
"x86_64-linux"
"i686-linux"
];
};
platform = lib.modules.override 1 {
build =
if
config.platform.target.double == "x86_64-linux" || config.platform.target.double == "i686-linux"
then
"i686-linux"
else
"x86_64-linux";
};
pname = "gnugrep";
version = "3.11";
builder = builders.basic;
deps = {
build = {
only = {
gcc = lib.modules.when (!isCross) packages.foundation.gcc.versions.latest;
binutils = lib.modules.when (!isCross) packages.foundation.binutils.versions.latest;
};
host = {
gcc = lib.modules.when (isCross) (
packages.foundation.gcc-cross.versions.latest.extend {
platform = lib.modules.override 0 {
inherit (config.platform) build target;
host = config.platform.build;
};
}
);
binutils = lib.modules.when (isCross) (
packages.foundation.binutils.versions.latest.extend {
platform = lib.modules.override 0 {
inherit (config.platform) target build;
host = config.platform.build;
};
}
);
};
};
};
env = {
PATH = lib.paths.bin (
lib.lists.when (isBuildBootstrapped) [
foundation.stage2-gnumake
foundation.stage2-gnupatch
foundation.stage2-gnused
foundation.stage2-gnugrep
foundation.stage2-gawk
foundation.stage2-diffutils
foundation.stage2-findutils
foundation.stage2-gnutar
foundation.stage1-xz
]
);
};
phases = {
unpack = ''
tar xf ${config.src}
cd grep-${config.version}
'';
build = ''
bash ./configure \
--prefix=$out \
--build=${config.platform.build.triple} \
--host=${config.platform.host.triple}
make -j $NIX_BUILD_CORES
'';
install = ''
make -j $NIX_BUILD_CORES install
rm $out/bin/{egrep,fgrep}
'';
};
src = builtins.fetchurl {
url = "${mirrors.gnu}/grep/grep-${config.version}.tar.xz";
sha256 = "HbKu3eidDepCsW2VKPiUyNFdrk4ZC1muzHj1qVEnbqs=";
};
};
};
};
};
}

View file

@ -0,0 +1,140 @@
{ config, options }:
let
inherit (config)
lib
mirrors
builders
# These are the upstream foundational packages exported from the Aux Foundation project.
foundation
packages
;
in
{
config.packages.foundation.gnumake = {
versions = {
"latest" =
{ config, meta }:
{
options = {
src = lib.options.create {
type = lib.types.derivation;
description = "Source for the package.";
};
};
config =
let
isBuildBootstrapped = config.platform.build.double == "i686-linux";
isCross =
(config.platform.build.triple != config.platform.host.triple)
&& (config.platform.host.triple == config.platform.target.triple);
in
{
meta = {
platforms = [
"x86_64-linux"
"i686-linux"
];
};
platform = lib.modules.override 1 {
build =
if
config.platform.target.double == "x86_64-linux" || config.platform.target.double == "i686-linux"
then
"i686-linux"
else
"x86_64-linux";
};
pname = "gnumake";
version = "4.4.1";
builder = builders.basic;
deps = {
build = {
only = {
gcc = lib.modules.when (!isCross) packages.foundation.gcc.versions.latest;
binutils = lib.modules.when (!isCross) packages.foundation.binutils.versions.latest;
};
host = {
gcc = lib.modules.when (isCross) (
packages.foundation.gcc-cross.versions.latest.extend {
platform = lib.modules.override 0 {
inherit (config.platform) build target;
host = config.platform.build;
};
}
);
binutils = lib.modules.when (isCross) (
packages.foundation.binutils.versions.latest.extend {
platform = lib.modules.override 0 {
inherit (config.platform) target build;
host = config.platform.build;
};
}
);
};
};
};
env = {
PATH = lib.paths.bin (
lib.lists.when (isBuildBootstrapped) [
foundation.stage2-gnumake
foundation.stage2-gnupatch
foundation.stage2-gnused
foundation.stage2-gnugrep
foundation.stage2-gawk
foundation.stage2-diffutils
foundation.stage2-findutils
foundation.stage2-gnutar
foundation.stage2-gzip
]
);
};
phases =
let
patches = [
# Replaces /bin/sh with sh, see patch file for reasoning
./patches/0001-No-impure-bin-sh.patch
# Purity: don't look for library dependencies (of the form `-lfoo') in /lib
# and /usr/lib. It's a stupid feature anyway. Likewise, when searching for
# included Makefiles, don't look in /usr/include and friends.
./patches/0002-remove-impure-dirs.patch
];
in
{
unpack = ''
tar xf ${config.src}
cd make-${config.version}
'';
patch = ''
${lib.strings.concatMapSep "\n" (file: "patch -Np1 -i ${file}") patches}
'';
build = ''
bash ./configure \
--prefix=$out \
--build=${config.platform.build.triple} \
--host=${config.platform.host.triple}
make -j $NIX_BUILD_CORES
'';
install = ''
make -j $NIX_BUILD_CORES install
'';
};
src = builtins.fetchurl {
url = "${mirrors.gnu}/make/make-${config.version}.tar.gz";
sha256 = "3Rb7HWe/q3mnL16DkHNcSePo5wtJRaFasfgd23hlj7M=";
};
};
};
};
};
}

View file

@ -0,0 +1,36 @@
From e00a5257a6ca5fedbf68b09eee7df3502971a057 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
Date: Sat, 24 Apr 2021 10:11:40 +0200
Subject: [PATCH 1/2] No impure bin sh
default_shell is used to populuate default shell used to execute jobs.
Unless SHELL is set to a different value this would be /bin/sh.
Our stdenv provides sh in form of bash anyway. Having this value not
hard-coded has some advantages:
- It would ensure that on all systems it uses sh from its PATH rather
than /bin/sh, which helps as different systems might have different
shells there (bash vs. dash)
- In the past I had issues with LD_PRELOAD with BEAR, where /bin/sh
used a different glibc than BEAR which came from my development shell.
---
src/job.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/job.c b/src/job.c
index ae1f18b..6b4ddb3 100644
--- a/src/job.c
+++ b/src/job.c
@@ -77,7 +77,7 @@ char * vms_strsignal (int status);
#else
-const char *default_shell = "/bin/sh";
+const char *default_shell = "sh";
int batch_mode_shell = 0;
#endif
--
2.31.1

View file

@ -0,0 +1,41 @@
From 795d63d3c8b5c0dbb7e544954f75507b371b7228 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
Date: Sat, 24 Apr 2021 10:20:16 +0200
Subject: [PATCH 2/2] remove impure dirs
---
src/read.c | 3 ---
src/remake.c | 2 --
2 files changed, 5 deletions(-)
diff --git a/src/read.c b/src/read.c
index fa197fb..defacfb 100644
--- a/src/read.c
+++ b/src/read.c
@@ -109,9 +109,6 @@ static const char *default_include_directories[] =
#endif
INCLUDEDIR,
#ifndef _AMIGA
- "/usr/gnu/include",
- "/usr/local/include",
- "/usr/include",
#endif
0
};
diff --git a/src/remake.c b/src/remake.c
index fb237c5..94bff7d 100644
--- a/src/remake.c
+++ b/src/remake.c
@@ -1601,8 +1601,6 @@ library_search (const char *lib, FILE_TIMESTAMP *mtime_ptr)
static const char *dirs[] =
{
#ifndef _AMIGA
- "/lib",
- "/usr/lib",
#endif
#if defined(WINDOWS32) && !defined(LIBDIR)
/*
--
2.31.1

View file

@ -0,0 +1,125 @@
{ config, options }:
let
inherit (config)
lib
mirrors
builders
# These are the upstream foundational packages exported from the Aux Foundation project.
foundation
packages
;
in
{
config.packages.foundation.gnupatch = {
versions = {
"latest" =
{ config, meta }:
{
options = {
src = lib.options.create {
type = lib.types.derivation;
description = "Source for the package.";
};
};
config =
let
isBuildBootstrapped = config.platform.build.double == "i686-linux";
isCross =
(config.platform.build.triple != config.platform.host.triple)
&& (config.platform.host.triple == config.platform.target.triple);
in
{
meta = {
platforms = [
"x86_64-linux"
"i686-linux"
];
};
platform = lib.modules.override 1 {
build =
if
config.platform.target.double == "x86_64-linux" || config.platform.target.double == "i686-linux"
then
"i686-linux"
else
"x86_64-linux";
};
pname = "gnupatch";
version = "2.7";
builder = builders.basic;
deps = {
build = {
only = {
gcc = lib.modules.when (!isCross) packages.foundation.gcc.versions.latest;
binutils = lib.modules.when (!isCross) packages.foundation.binutils.versions.latest;
};
host = {
gcc = lib.modules.when (isCross) (
packages.foundation.gcc-cross.versions.latest.extend {
platform = lib.modules.override 0 {
inherit (config.platform) build target;
host = config.platform.build;
};
}
);
binutils = lib.modules.when (isCross) (
packages.foundation.binutils.versions.latest.extend {
platform = lib.modules.override 0 {
inherit (config.platform) target build;
host = config.platform.build;
};
}
);
};
};
};
env = {
PATH = lib.paths.bin (
lib.lists.when (isBuildBootstrapped) [
foundation.stage2-gnumake
foundation.stage2-gnupatch
foundation.stage2-gnused
foundation.stage2-gnugrep
foundation.stage2-gawk
foundation.stage2-diffutils
foundation.stage2-findutils
foundation.stage2-gnutar
foundation.stage1-xz
]
);
};
phases = {
unpack = ''
tar xf ${config.src}
cd patch-${config.version}
'';
build = ''
bash ./configure \
--prefix=$out \
--build=${config.platform.build.triple} \
--host=${config.platform.host.triple}
make -j $NIX_BUILD_CORES
'';
install = ''
make -j $NIX_BUILD_CORES install
'';
};
src = builtins.fetchurl {
url = "${mirrors.gnu}/patch/patch-${config.version}.tar.xz";
sha256 = "XCyR/kFUKWISbwvhUKpPo0lIXPLtwMfqfbwky4FxEa4=";
};
};
};
};
};
}

View file

@ -0,0 +1,125 @@
{ config, options }:
let
inherit (config)
lib
mirrors
builders
# These are the upstream foundational packages exported from the Aux Foundation project.
foundation
packages
;
in
{
config.packages.foundation.gnused = {
versions = {
"latest" =
{ config, meta }:
{
options = {
src = lib.options.create {
type = lib.types.derivation;
description = "Source for the package.";
};
};
config =
let
isBuildBootstrapped = config.platform.build.double == "i686-linux";
isCross =
(config.platform.build.triple != config.platform.host.triple)
&& (config.platform.host.triple == config.platform.target.triple);
in
{
meta = {
platforms = [
"x86_64-linux"
"i686-linux"
];
};
platform = lib.modules.override 1 {
build =
if
config.platform.target.double == "x86_64-linux" || config.platform.target.double == "i686-linux"
then
"i686-linux"
else
"x86_64-linux";
};
pname = "gnused";
version = "4.9";
builder = builders.basic;
deps = {
build = {
only = {
gcc = lib.modules.when (!isCross) packages.foundation.gcc.versions.latest;
binutils = lib.modules.when (!isCross) packages.foundation.binutils.versions.latest;
};
host = {
gcc = lib.modules.when (isCross) (
packages.foundation.gcc-cross.versions.latest.extend {
platform = lib.modules.override 0 {
inherit (config.platform) build target;
host = config.platform.build;
};
}
);
binutils = lib.modules.when (isCross) (
packages.foundation.binutils.versions.latest.extend {
platform = lib.modules.override 0 {
inherit (config.platform) target build;
host = config.platform.build;
};
}
);
};
};
};
env = {
PATH = lib.paths.bin (
lib.lists.when (isBuildBootstrapped) [
foundation.stage2-gnumake
foundation.stage2-gnupatch
foundation.stage2-gnused
foundation.stage2-gnugrep
foundation.stage2-gawk
foundation.stage2-diffutils
foundation.stage2-findutils
foundation.stage2-gnutar
foundation.stage1-xz
]
);
};
phases = {
unpack = ''
tar xf ${config.src}
cd sed-${config.version}
'';
build = ''
bash ./configure \
--prefix=$out \
--build=${config.platform.build.triple} \
--host=${config.platform.host.triple}
make -j $NIX_BUILD_CORES
'';
install = ''
make -j $NIX_BUILD_CORES install
'';
};
src = builtins.fetchurl {
url = "${mirrors.gnu}/sed/sed-${config.version}.tar.xz";
sha256 = "biJrcy4c1zlGStaGK9Ghq6QteYKSLaelNRljHSSXUYE=";
};
};
};
};
};
}

View file

@ -0,0 +1,125 @@
{ config, options }:
let
inherit (config)
lib
mirrors
builders
# These are the upstream foundational packages exported from the Aux Foundation project.
foundation
packages
;
in
{
config.packages.foundation.gnutar = {
versions = {
"latest" =
{ config, meta }:
{
options = {
src = lib.options.create {
type = lib.types.derivation;
description = "Source for the package.";
};
};
config =
let
isBuildBootstrapped = config.platform.build.double == "i686-linux";
isCross =
(config.platform.build.triple != config.platform.host.triple)
&& (config.platform.host.triple == config.platform.target.triple);
in
{
meta = {
platforms = [
"x86_64-linux"
"i686-linux"
];
};
platform = lib.modules.override 1 {
build =
if
config.platform.target.double == "x86_64-linux" || config.platform.target.double == "i686-linux"
then
"i686-linux"
else
"x86_64-linux";
};
pname = "gnutar";
version = "1.35";
builder = builders.basic;
deps = {
build = {
only = {
gcc = lib.modules.when (!isCross) packages.foundation.gcc.versions.latest;
binutils = lib.modules.when (!isCross) packages.foundation.binutils.versions.latest;
};
host = {
gcc = lib.modules.when (isCross) (
packages.foundation.gcc-cross.versions.latest.extend {
platform = lib.modules.override 0 {
inherit (config.platform) build target;
host = config.platform.build;
};
}
);
binutils = lib.modules.when (isCross) (
packages.foundation.binutils.versions.latest.extend {
platform = lib.modules.override 0 {
inherit (config.platform) target build;
host = config.platform.build;
};
}
);
};
};
};
env = {
PATH = lib.paths.bin (
lib.lists.when (isBuildBootstrapped) [
foundation.stage2-gnumake
foundation.stage2-gnupatch
foundation.stage2-gnused
foundation.stage2-gnugrep
foundation.stage2-gawk
foundation.stage2-diffutils
foundation.stage2-findutils
foundation.stage2-gnutar
foundation.stage2-gzip
]
);
};
phases = {
unpack = ''
tar xf ${config.src}
cd tar-${config.version}
'';
build = ''
bash ./configure \
--prefix=$out \
--build=${config.platform.build.triple} \
--host=${config.platform.host.triple}
make -j $NIX_BUILD_CORES
'';
install = ''
make -j $NIX_BUILD_CORES install
'';
};
src = builtins.fetchurl {
url = "${mirrors.gnu}/tar/tar-${config.version}.tar.gz";
sha256 = "FNVeMgY+qVJuBX+/Nfyr1TN452l4fv95GcN1WwLStX4=";
};
};
};
};
};
}

View file

@ -0,0 +1,125 @@
{ config, options }:
let
inherit (config)
lib
mirrors
builders
# These are the upstream foundational packages exported from the Aux Foundation project.
foundation
packages
;
in
{
config.packages.foundation.gzip = {
versions = {
"latest" =
{ config, meta }:
{
options = {
src = lib.options.create {
type = lib.types.derivation;
description = "Source for the package.";
};
};
config =
let
isBuildBootstrapped = config.platform.build.double == "i686-linux";
isCross =
(config.platform.build.triple != config.platform.host.triple)
&& (config.platform.host.triple == config.platform.target.triple);
in
{
meta = {
platforms = [
"x86_64-linux"
"i686-linux"
];
};
platform = lib.modules.override 1 {
build =
if
config.platform.target.double == "x86_64-linux" || config.platform.target.double == "i686-linux"
then
"i686-linux"
else
"x86_64-linux";
};
pname = "gzip";
version = "1.13";
builder = builders.basic;
deps = {
build = {
only = {
gcc = lib.modules.when (!isCross) packages.foundation.gcc.versions.latest;
binutils = lib.modules.when (!isCross) packages.foundation.binutils.versions.latest;
};
host = {
gcc = lib.modules.when (isCross) (
packages.foundation.gcc-cross.versions.latest.extend {
platform = lib.modules.override 0 {
inherit (config.platform) build target;
host = config.platform.build;
};
}
);
binutils = lib.modules.when (isCross) (
packages.foundation.binutils.versions.latest.extend {
platform = lib.modules.override 0 {
inherit (config.platform) target build;
host = config.platform.build;
};
}
);
};
};
};
env = {
PATH = lib.paths.bin (
lib.lists.when (isBuildBootstrapped) [
foundation.stage2-gnumake
foundation.stage2-gnupatch
foundation.stage2-gnused
foundation.stage2-gnugrep
foundation.stage2-gawk
foundation.stage2-diffutils
foundation.stage2-findutils
foundation.stage2-gnutar
foundation.stage1-xz
]
);
};
phases = {
unpack = ''
tar xf ${config.src}
cd gzip-${config.version}
'';
build = ''
bash ./configure \
--prefix=$out \
--build=${config.platform.build.triple} \
--host=${config.platform.host.triple}
make -j $NIX_BUILD_CORES
'';
install = ''
make -j $NIX_BUILD_CORES install
'';
};
src = builtins.fetchurl {
url = "${mirrors.gnu}/gzip/gzip-${config.version}.tar.xz";
sha256 = "dFTraTXbF8ZlVXbC4bD6vv04tNCTbg+H9IzQYs6RoFc=";
};
};
};
};
};
}

View file

@ -1,12 +1,11 @@
{ lib
, lib'
, config
, options
,
{
lib,
lib',
config,
options,
}:
let
inherit (config)
mirrors
builders
# These are the upstream foundational packages exported from the Aux Foundation project.
@ -28,7 +27,10 @@ in
config = {
meta = {
platforms = [ "x86_64-linux" "i686-linux" ];
platforms = [
"x86_64-linux"
"i686-linux"
];
};
pname = "linux-headers";

View file

@ -0,0 +1,121 @@
{ config, options }:
let
inherit (config)
lib
builders
# These are the upstream foundational packages exported from the Aux Foundation project.
foundation
packages
;
in
{
config.packages.foundation.xz = {
versions = {
"latest" =
{ config, meta }:
{
options = {
src = lib.options.create {
type = lib.types.derivation;
description = "Source for the package.";
};
};
config =
let
isBuildBootstrapped = config.platform.build.double == "i686-linux";
isCross =
(config.platform.build.triple != config.platform.host.triple)
&& (config.platform.host.triple == config.platform.target.triple);
in
{
meta = {
platforms = [
"x86_64-linux"
"i686-linux"
];
};
platform = lib.modules.override 1 {
build =
if
config.platform.target.double == "x86_64-linux" || config.platform.target.double == "i686-linux"
then
"i686-linux"
else
"x86_64-linux";
};
pname = "xz";
version = "5.4.3";
builder = builders.basic;
deps = {
build = {
only = {
gcc = lib.modules.when (!isCross) packages.foundation.gcc.versions.latest;
binutils = lib.modules.when (!isCross) packages.foundation.binutils.versions.latest;
};
host = {
gcc = lib.modules.when (isCross) (
packages.foundation.gcc-cross.versions.latest.extend {
platform = lib.modules.override 0 {
inherit (config.platform) build target;
host = config.platform.build;
};
}
);
binutils = lib.modules.when (isCross) (
packages.foundation.binutils.versions.latest.extend {
platform = lib.modules.override 0 {
inherit (config.platform) target build;
host = config.platform.build;
};
}
);
};
};
};
env = {
PATH = lib.paths.bin (
lib.lists.when (isBuildBootstrapped) [
foundation.stage2-gnumake
foundation.stage2-gnused
foundation.stage2-gnugrep
foundation.stage2-gawk
foundation.stage2-gnutar
foundation.stage2-gzip
]
);
};
phases = {
unpack = ''
tar xf ${config.src}
cd xz-${config.version}
'';
build = ''
bash ./configure \
--prefix=$out \
--build=${config.platform.build.triple} \
--host=${config.platform.host.triple}
make -j $NIX_BUILD_CORES
'';
install = ''
make -j $NIX_BUILD_CORES install
'';
};
src = builtins.fetchurl {
url = "https://tukaani.org/xz/xz-${config.version}.tar.gz";
sha256 = "HDguC8Lk4K9YOYqQPdYv/35RAXHS3keh6+BtFSjpt+k=";
};
};
};
};
};
}