forked from auxolotl/labs
working gcc stage 2
This commit is contained in:
parent
238dddb970
commit
ef2df44dd8
12 changed files with 223 additions and 284 deletions
|
|
@ -25,9 +25,8 @@ in
|
|||
phasesWithHooks =
|
||||
let
|
||||
all = lib.lists.flatten [
|
||||
hooks.build.build
|
||||
hooks.build.host
|
||||
hooks.host.host
|
||||
hooks.build
|
||||
hooks.host
|
||||
];
|
||||
in
|
||||
builtins.foldl' (
|
||||
|
|
@ -59,13 +58,11 @@ in
|
|||
"${foundation.stage2-bash}/bin/bash"
|
||||
else if system == "x86_64-linux" then
|
||||
"${
|
||||
(lib.packages.build packages.foundation.bash.versions."5.2.15-stage1" "i686-linux" system system)
|
||||
.package
|
||||
(lib.packages.build packages.foundation.bash.versions."5.2.15-stage1" "i686-linux" system).package
|
||||
}/bin/bash"
|
||||
else
|
||||
"${
|
||||
(lib.packages.build packages.foundation.bash.versions."5.2.15-stage1" "x86_64-linux" system system)
|
||||
.package
|
||||
(lib.packages.build packages.foundation.bash.versions."5.2.15-stage1" "x86_64-linux" system).package
|
||||
}/bin/bash";
|
||||
|
||||
built = builtins.derivation (
|
||||
|
|
@ -83,25 +80,20 @@ in
|
|||
PATH =
|
||||
let
|
||||
bins = lib.paths.bin (
|
||||
(lib.packages.dependencies.get dependencies.build.build)
|
||||
++ (lib.packages.dependencies.get dependencies.build.host)
|
||||
++ (lib.packages.dependencies.get dependencies.host.host)
|
||||
(lib.packages.dependencies.get dependencies.build)
|
||||
++ (lib.packages.dependencies.get dependencies.host)
|
||||
++ lib.lists.when (system == "i686-linux") [
|
||||
foundation.stage2-bash
|
||||
foundation.stage2-coreutils
|
||||
]
|
||||
++ lib.lists.when (system == "x86_64-linux") [
|
||||
(lib.packages.build packages.foundation.bash.versions."5.2.15-stage1" "i686-linux" system system)
|
||||
.package
|
||||
(lib.packages.build packages.foundation.coreutils.versions."9.4-stage1" "i686-linux" system system)
|
||||
.package
|
||||
(lib.packages.build packages.foundation.bash.versions."5.2.15-stage1" "i686-linux" system).package
|
||||
(lib.packages.build packages.foundation.coreutils.versions."9.4-stage1" "i686-linux" system).package
|
||||
]
|
||||
++ lib.lists.when (system != "i686-linux" && system != "x86_64-linux") [
|
||||
(lib.packages.build packages.foundation.bash.versions."5.2.15-stage1" "x86_64-linux" system system)
|
||||
(lib.packages.build packages.foundation.bash.versions."5.2.15-stage1" "x86_64-linux" system).package
|
||||
(lib.packages.build packages.foundation.coreutils.versions."9.4-stage1" "x86_64-linux" system)
|
||||
.package
|
||||
(lib.packages.build packages.foundation.coreutils.versions."9.4-stage1" "x86_64-linux" system
|
||||
system
|
||||
).package
|
||||
]
|
||||
);
|
||||
in
|
||||
|
|
@ -159,7 +151,7 @@ in
|
|||
Review the phases printed above and resolve the cycle to proceed.
|
||||
|
||||
TIP: This can happen when you have two of the same dependency added as different dependencies
|
||||
such as `build.build` and `build.host`.
|
||||
such as `build` and `host`.
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,8 +15,7 @@ in
|
|||
builtins.map (dependency: dependency.package) available;
|
||||
|
||||
build =
|
||||
build: host:
|
||||
builtins.mapAttrs (name: dep: (lib.packages.resolve dep).packages.${build}.${host});
|
||||
build: host: builtins.mapAttrs (name: dep: (lib.packages.resolve dep).packages.${build}.${host});
|
||||
|
||||
collect =
|
||||
package:
|
||||
|
|
@ -32,20 +31,13 @@ in
|
|||
let
|
||||
dependency = lib.packages.resolve dep;
|
||||
deps = {
|
||||
build = {
|
||||
build =
|
||||
getPropagatedDependencies dependency.deps.build.build ++ process dependency.deps.build.build;
|
||||
host = getPropagatedDependencies dependency.deps.build.host ++ process dependency.deps.build.host;
|
||||
};
|
||||
host = {
|
||||
host = getPropagatedDependencies dependency.deps.host.host ++ process dependency.deps.host.host;
|
||||
};
|
||||
build = getPropagatedDependencies dependency.deps.build ++ process dependency.deps.build;
|
||||
host = getPropagatedDependencies dependency.deps.host ++ process dependency.deps.host;
|
||||
};
|
||||
in
|
||||
lib.lists.flatten [
|
||||
deps.build.build
|
||||
deps.build.host
|
||||
deps.host.host
|
||||
deps.build
|
||||
deps.host
|
||||
];
|
||||
|
||||
propagated = lib.attrs.mapToList getDeps dependencies;
|
||||
|
|
@ -55,17 +47,8 @@ in
|
|||
withoutNulls = deps: builtins.filter (dep: dep != null) deps;
|
||||
in
|
||||
{
|
||||
build = {
|
||||
build = withoutNulls (
|
||||
builtins.attrValues package.deps.build.build ++ process package.deps.build.build
|
||||
);
|
||||
host = withoutNulls (
|
||||
builtins.attrValues package.deps.build.host ++ process package.deps.build.host
|
||||
);
|
||||
};
|
||||
host = {
|
||||
host = withoutNulls (builtins.attrValues package.deps.host.host ++ process package.deps.host.host);
|
||||
};
|
||||
build = withoutNulls (builtins.attrValues package.deps.build ++ process package.deps.build);
|
||||
host = withoutNulls (builtins.attrValues package.deps.host ++ process package.deps.host);
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -111,11 +94,10 @@ in
|
|||
result.config;
|
||||
|
||||
build = process "build" [
|
||||
collected.build.build
|
||||
collected.build.host
|
||||
collected.build
|
||||
];
|
||||
host = process "host" [
|
||||
collected.host.host
|
||||
collected.host
|
||||
];
|
||||
in
|
||||
build
|
||||
|
|
@ -163,22 +145,12 @@ in
|
|||
hooks;
|
||||
in
|
||||
{
|
||||
build = {
|
||||
build = process [
|
||||
"build"
|
||||
"build"
|
||||
];
|
||||
host = process [
|
||||
"build"
|
||||
"host"
|
||||
];
|
||||
};
|
||||
host = {
|
||||
host = process [
|
||||
"host"
|
||||
"host"
|
||||
];
|
||||
};
|
||||
build = process [
|
||||
"build"
|
||||
];
|
||||
host = process [
|
||||
"host"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -49,11 +49,10 @@ in
|
|||
in
|
||||
builtins.concatMap (
|
||||
build:
|
||||
builtins.concatMap (
|
||||
host:
|
||||
build = build;
|
||||
host = if host == "@build" then build else host;
|
||||
) host
|
||||
builtins.map (host: {
|
||||
build = build;
|
||||
host = if host == "@build" then build else host;
|
||||
}) host
|
||||
) build
|
||||
) specs
|
||||
);
|
||||
|
|
|
|||
|
|
@ -487,26 +487,15 @@ in
|
|||
build: host:
|
||||
lib.types.submodule {
|
||||
options = {
|
||||
build = {
|
||||
build = lib.options.create {
|
||||
description = "Dependencies which are created in the build environment and are executed in the build environment.";
|
||||
type = lib.types.dependencies;
|
||||
default.value = { };
|
||||
};
|
||||
|
||||
host = lib.options.create {
|
||||
description = "Dependencies which are created in the build environment and are executed in the host environment.";
|
||||
type = lib.types.dependencies;
|
||||
default.value = { };
|
||||
};
|
||||
build = lib.options.create {
|
||||
description = "Dependencies which are executed in the build environment.";
|
||||
type = lib.types.dependencies;
|
||||
default.value = { };
|
||||
};
|
||||
|
||||
host = {
|
||||
host = lib.options.create {
|
||||
description = "Dependencies which are executed in the host environment.";
|
||||
type = lib.types.dependencies;
|
||||
default.value = { };
|
||||
};
|
||||
host = lib.options.create {
|
||||
description = "Dependencies which are executed in the host environment.";
|
||||
type = lib.types.dependencies;
|
||||
default.value = { };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
@ -781,11 +770,7 @@ in
|
|||
type = lib.types.raw;
|
||||
writable = false;
|
||||
default.value = lib.attrs.generate lib.systems.doubles.all (
|
||||
build:
|
||||
lib.attrs.generate lib.systems.doubles.all (
|
||||
host:
|
||||
lib.attrs.generate lib.systems.doubles.all (target: lib.packages.build config build host)
|
||||
)
|
||||
build: lib.attrs.generate lib.systems.doubles.all (host: lib.packages.build config build host)
|
||||
);
|
||||
};
|
||||
|
||||
|
|
@ -826,13 +811,8 @@ in
|
|||
type = deps build host;
|
||||
default.value = { };
|
||||
apply = value: {
|
||||
build = {
|
||||
build = lib.packages.dependencies.build build build build value.build.build;
|
||||
host = lib.packages.dependencies.build build build host value.build.host;
|
||||
};
|
||||
host = {
|
||||
host = lib.packages.dependencies.build build host host value.host.host;
|
||||
};
|
||||
build = lib.packages.dependencies.build build build value.build;
|
||||
host = lib.packages.dependencies.build build host value.host;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -10,18 +10,31 @@ let
|
|||
package = packages.foundation.binutils.versions."2.41-stage1".extend {
|
||||
platform = {
|
||||
build = lib.modules.overrides.force (
|
||||
if config.platform.build != config.platform.target then
|
||||
config.platform.build
|
||||
else if config.platform.build == "x86_64-linux" || config.platform.build == "i686-linux" then
|
||||
if config.platform.build == "x86_64-linux" || config.platform.build == "i686-linux" then
|
||||
"i686-linux"
|
||||
else
|
||||
"x86_64-linux"
|
||||
config.platform.build
|
||||
);
|
||||
host = lib.modules.overrides.force config.platform.host;
|
||||
};
|
||||
inherit (config) settings;
|
||||
};
|
||||
in
|
||||
{
|
||||
options = {
|
||||
settings = {
|
||||
target = lib.options.create {
|
||||
type = lib.types.nullish lib.types.string;
|
||||
default.value = null;
|
||||
};
|
||||
allTargets = lib.options.create {
|
||||
description = "Include all targets (dramatically increases size of binaries).";
|
||||
type = lib.types.bool;
|
||||
default.value = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
meta = {
|
||||
description = "Tools for manipulating binaries (linker, assembler, etc.)";
|
||||
|
|
@ -34,10 +47,6 @@ in
|
|||
build = "@linux";
|
||||
host = "@linux";
|
||||
}
|
||||
{
|
||||
build = "@linux";
|
||||
target = "@linux";
|
||||
}
|
||||
];
|
||||
|
||||
builder = builders.foundation.passthrough.extend {
|
||||
|
|
|
|||
|
|
@ -13,40 +13,16 @@ let
|
|||
host = lib.systems.withBuildInfo config.platform.host;
|
||||
};
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
isBuildBootstrapped = platform.build.double == "i686-linux";
|
||||
isHostBootstrapped = platform.host.double == "i686-linux";
|
||||
|
||||
isBootstrapped = isBuildBootstrapped && isHostBootstrapped;
|
||||
|
||||
isCross =
|
||||
platform.build.double != platform.host.double;
|
||||
|
||||
>>>>>>> 586d02f (Remove target cause GCC is dumb)
|
||||
version = lib.strings.removeSuffix "-stage1" config.version;
|
||||
|
||||
patches = [
|
||||
../patches/2.41-deterministic.patch
|
||||
];
|
||||
|
||||
<<<<<<< HEAD
|
||||
configureFlags = [
|
||||
"--prefix=${builtins.placeholder "out"}"
|
||||
"--build=${platform.build.triple}"
|
||||
"--host=${platform.host.triple}"
|
||||
"--target=${platform.target.triple}"
|
||||
=======
|
||||
configureFlags =
|
||||
lib.lists.when (!isCross) [
|
||||
"LDFLAGS=--static"
|
||||
]
|
||||
++ [
|
||||
"--prefix=${builtins.placeholder "out"}"
|
||||
"--build=${platform.build.triple}"
|
||||
"--host=${platform.host.triple}"
|
||||
"--target=${platform.host.triple}"
|
||||
>>>>>>> 586d02f (Remove target cause GCC is dumb)
|
||||
|
||||
"--with-sysroot=/"
|
||||
"--enable-deterministic-archives"
|
||||
|
|
@ -64,9 +40,30 @@ let
|
|||
"--with-lib-path=:"
|
||||
|
||||
"--disable-multilib"
|
||||
"--enable-64-bit-bfd"
|
||||
]
|
||||
++ lib.lists.when (config.settings.allTargets) [
|
||||
"--enable-target=all"
|
||||
]
|
||||
++ lib.lists.when (config.settings.target != null) [
|
||||
"--target=${(lib.systems.withBuildInfo config.settings.target).triple}"
|
||||
];
|
||||
in
|
||||
{
|
||||
options = {
|
||||
settings = {
|
||||
target = lib.options.create {
|
||||
type = lib.types.nullish lib.types.string;
|
||||
default.value = null;
|
||||
};
|
||||
allTargets = lib.options.create {
|
||||
description = "Include all targets (dramatically increases size of binaries).";
|
||||
type = lib.types.bool;
|
||||
default.value = false;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
meta = {
|
||||
description = "Tools for manipulating binaries (linker, assembler, etc.)";
|
||||
|
|
@ -76,21 +73,16 @@ in
|
|||
|
||||
platforms = [
|
||||
{
|
||||
<<<<<<< HEAD
|
||||
build = "i686-linux";
|
||||
target = "x86_64-linux";
|
||||
=======
|
||||
build = "@linux";
|
||||
>>>>>>> 586d02f (Remove target cause GCC is dumb)
|
||||
}
|
||||
{
|
||||
build = "i686-linux";
|
||||
host = "x86_64-linux";
|
||||
}
|
||||
{
|
||||
build = "x86_64-linux";
|
||||
host = "@linux";
|
||||
}
|
||||
{
|
||||
build = "x86_64-linux";
|
||||
target = "@linux";
|
||||
}
|
||||
];
|
||||
|
||||
builder = builders.foundation.basic;
|
||||
|
|
@ -101,8 +93,8 @@ in
|
|||
};
|
||||
|
||||
deps = {
|
||||
build = {
|
||||
build =
|
||||
build =
|
||||
(
|
||||
if (config.platform.build == "i686-linux") then
|
||||
{
|
||||
gnumake = packages.foundation.gnumake.versions."4.4.1-bootstrap";
|
||||
|
|
@ -134,13 +126,21 @@ in
|
|||
xz = packages.foundation.xz.versions."5.4.3-stage1-passthrough";
|
||||
gcc = packages.foundation.gcc.versions."13.2.0-stage4";
|
||||
binutils = packages.foundation.binutils.versions."2.41-stage1-passthrough";
|
||||
};
|
||||
}
|
||||
)
|
||||
// (lib.attrs.when (config.platform.build != config.platform.host) {
|
||||
gcc-cross = packages.foundation.gcc.versions."13.2.0-stage2".extend {
|
||||
target = config.platform.host;
|
||||
};
|
||||
binutils-cross = packages.foundation.binutils.versions."2.41-stage1".extend {
|
||||
settings.target = config.platform.host;
|
||||
};
|
||||
});
|
||||
|
||||
host = lib.attrs.when (config.platform.build != config.platform.host) {
|
||||
gcc = packages.foundation.gcc.versions."13.2.0-stage2";
|
||||
binutils = packages.foundation.binutils.versions."2.41-stage1";
|
||||
};
|
||||
};
|
||||
# host = lib.attrs.when (config.platform.build != config.platform.host) {
|
||||
# gcc = packages.foundation.gcc.versions."13.2.0-stage2";
|
||||
# binutils = packages.foundation.binutils.versions."2.41-stage1";
|
||||
# };
|
||||
};
|
||||
|
||||
phases = {
|
||||
|
|
|
|||
|
|
@ -14,24 +14,24 @@ let
|
|||
platform = {
|
||||
build = lib.systems.withBuildInfo config.platform.build;
|
||||
host = lib.systems.withBuildInfo config.platform.host;
|
||||
target = lib.systems.withBuildInfo config.settings.target;
|
||||
};
|
||||
|
||||
prefix = lib.strings.when (
|
||||
platform.build.triple != config.target.triple
|
||||
) "${config.target.triple}-";
|
||||
platform.build.triple != platform.target.triple
|
||||
) "${platform.target.triple}-";
|
||||
|
||||
patches = [
|
||||
../patches/libstdc++-target.patch
|
||||
];
|
||||
|
||||
configureFlags = [
|
||||
"LDFLAGS=--static"
|
||||
"--prefix=${builtins.placeholder "out"}"
|
||||
"--build=${platform.build.triple}"
|
||||
"--host=${platform.host.triple}"
|
||||
"--target=${config.target.triple}"
|
||||
"--with-as=${config.deps.build.host.binutils.package}/bin/${prefix}as"
|
||||
"--with-ld=${config.deps.build.host.binutils.package}/bin/${prefix}ld"
|
||||
"--target=${platform.target.triple}"
|
||||
"--with-as=${config.deps.build.binutils-cross.package}/bin/${prefix}as"
|
||||
"--with-ld=${config.deps.build.binutils-cross.package}/bin/${prefix}ld"
|
||||
"--enable-languages=c,c++"
|
||||
"--disable-bootstrap"
|
||||
"--disable-libsanitizer"
|
||||
|
|
@ -74,9 +74,10 @@ in
|
|||
description = "Version of isl.";
|
||||
};
|
||||
|
||||
target.triple = lib.options.create {
|
||||
settings.target = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Target of the compiler"
|
||||
default.value = "x86_64-linux";
|
||||
description = "Target of the compiler";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -90,15 +91,14 @@ in
|
|||
platforms = [
|
||||
{
|
||||
build = "i686-linux";
|
||||
host = "x86_64-linux";
|
||||
}
|
||||
{
|
||||
build = "x86_64-linux";
|
||||
host = "@linux";
|
||||
}
|
||||
];
|
||||
|
||||
target.triple = platforms.host.triple;
|
||||
builder = builders.foundation.basic;
|
||||
|
||||
gmp.version = "6.3.0";
|
||||
mpfr.version = "4.2.1";
|
||||
mpc.version = "1.3.1";
|
||||
|
|
@ -132,8 +132,8 @@ in
|
|||
};
|
||||
|
||||
deps = {
|
||||
build = {
|
||||
build =
|
||||
build =
|
||||
(
|
||||
if (config.platform.build == "i686-linux") then
|
||||
{
|
||||
bzip2 = packages.foundation.bzip2.versions."1.0.8-bootstrap";
|
||||
|
|
@ -165,11 +165,13 @@ in
|
|||
gzip = packages.foundation.gzip.versions."1.13-stage1-passthrough";
|
||||
xz = packages.foundation.xz.versions."5.4.3-stage1-passthrough";
|
||||
binutils = packages.foundation.binutils.versions."2.41-stage1-passthrough";
|
||||
};
|
||||
host = {
|
||||
binutils = packages.foundation.binutils.versions."2.41-stage1";
|
||||
}
|
||||
)
|
||||
// {
|
||||
binutils-cross = packages.foundation.binutils.versions."2.41-stage1".extend {
|
||||
settings.target = config.settings.target;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
hooks = ctx: {
|
||||
|
|
@ -181,12 +183,8 @@ in
|
|||
export CXX='${config.package}/bin/${prefix}g++ ${
|
||||
builtins.concatStringsSep " " (ctx.host."foundation:cflags")
|
||||
}'
|
||||
export CC_FOR_TARGET='${config.package}/bin/${prefix}gcc ${
|
||||
builtins.concatStringsSep " " (ctx.target."foundation:cflags")
|
||||
}'
|
||||
export CXX_FOR_TARGET='${config.package}/bin/${prefix}g++ ${
|
||||
builtins.concatStringsSep " " (ctx.target."foundation:cflags")
|
||||
}'
|
||||
export CC_FOR_TARGET=$CC
|
||||
export CXX_FOR_TARGET=$CXX
|
||||
alias gcc='$CC'
|
||||
alias g++='$CXX'
|
||||
'';
|
||||
|
|
@ -213,10 +211,6 @@ in
|
|||
'';
|
||||
|
||||
configure = ''
|
||||
echo "--configure: ${builtins.concatStringsSep " " configureFlags}"
|
||||
ls -la ${config.deps.build.build.binutils.package}/bin
|
||||
ls -la ${config.deps.build.build.gcc.package}/bin
|
||||
|
||||
# Configure
|
||||
mkdir build
|
||||
cd build
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ let
|
|||
platform = {
|
||||
build = lib.systems.withBuildInfo config.platform.build;
|
||||
host = lib.systems.withBuildInfo config.platform.host;
|
||||
target = lib.systems.withBuildInfo config.settings.target;
|
||||
};
|
||||
|
||||
prefix = lib.strings.when (
|
||||
|
|
@ -29,9 +30,9 @@ let
|
|||
];
|
||||
|
||||
gccFlags = [
|
||||
"-Wl,-dynamic-linker=${config.deps.target.target.glibc.dynamicLinker}"
|
||||
"-L${config.deps.target.target.glibc.package}/lib"
|
||||
"-B${config.deps.target.target.glibc.package}/lib"
|
||||
"-Wl,-dynamic-linker=${config.deps.host.glibc.dynamicLinker}"
|
||||
"-L${config.deps.host.glibc.package}/lib"
|
||||
"-B${config.deps.host.glibc.package}/lib"
|
||||
"-L${config.package.outPath}${libPrefix}/lib"
|
||||
"-B${config.package.outPath}${libPrefix}/lib"
|
||||
];
|
||||
|
|
@ -40,17 +41,17 @@ let
|
|||
"--prefix=${builtins.placeholder "out"}"
|
||||
"--build=${platform.build.triple}"
|
||||
"--host=${platform.host.triple}"
|
||||
"--target=${config.target.triple}"
|
||||
"--with-as=${config.deps.build.host.binutils.package}/bin/${prefix}as"
|
||||
"--with-ld=${config.deps.build.host.binutils.package}/bin/${prefix}ld"
|
||||
"--target=${platform.target.triple}"
|
||||
"--with-as=${config.deps.build.binutils-cross.package}/bin/${prefix}as"
|
||||
"--with-ld=${config.deps.build.binutils-cross.package}/bin/${prefix}ld"
|
||||
"--enable-languages=c,c++"
|
||||
"--disable-libsanitizer"
|
||||
"--disable-lto"
|
||||
"--disable-multilib"
|
||||
"--with-headers=${config.deps.host.host.glibc.package}/include"
|
||||
"--with-headers=${config.deps.host.glibc.package}/include"
|
||||
"--with-build-sysroot=/"
|
||||
"--with-native-system-header-dir=${config.deps.host.host.glibc.package}/include"
|
||||
"--with-build-time-tools=${config.deps.build.host.binutils.package}/bin"
|
||||
"--with-native-system-header-dir=${config.deps.host.glibc.package}/include"
|
||||
"--with-build-time-tools=${config.deps.build.binutils-cross.package}/bin"
|
||||
];
|
||||
in
|
||||
{
|
||||
|
|
@ -75,9 +76,10 @@ in
|
|||
description = "Version of isl.";
|
||||
};
|
||||
|
||||
target.triple = lib.options.create {
|
||||
settings.target = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Target of GCC";
|
||||
default.value = "x86_64-linux";
|
||||
description = "Target of the compiler";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -99,7 +101,6 @@ in
|
|||
|
||||
builder = builders.foundation.basic;
|
||||
|
||||
target.triple = config.platforms.host;
|
||||
gmp.version = "6.3.0";
|
||||
mpfr.version = "4.2.1";
|
||||
mpc.version = "1.3.1";
|
||||
|
|
@ -133,8 +134,8 @@ in
|
|||
};
|
||||
|
||||
deps = {
|
||||
build = {
|
||||
build =
|
||||
build =
|
||||
(
|
||||
if (config.platform.build == "i686-linux") then
|
||||
{
|
||||
bzip2 = packages.foundation.bzip2.versions."1.0.8-bootstrap";
|
||||
|
|
@ -166,24 +167,25 @@ in
|
|||
gzip = packages.foundation.gzip.versions."1.13-stage1-passthrough";
|
||||
xz = packages.foundation.xz.versions."5.4.3-stage1-passthrough";
|
||||
binutils = packages.foundation.binutils.versions."2.41-stage1-passthrough";
|
||||
};
|
||||
|
||||
host = {
|
||||
binutils = packages.foundation.binutils.versions."2.41-stage1";
|
||||
}
|
||||
)
|
||||
// {
|
||||
binutils-cross = packages.foundation.binutils.versions."2.41-stage1".extend {
|
||||
settings.target = config.settings.target;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
host = {
|
||||
host = {
|
||||
glibc = packages.foundation.glibc.versions."2.38-stage1";
|
||||
glibc = packages.foundation.glibc.versions."2.38-stage1".extend {
|
||||
platform.host = lib.modules.overrides.force config.settings.target;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
env = {
|
||||
CFLAGS_FOR_TARGET = "-Wl,-dynamic-linker -Wl,${config.deps.host.host.glibc.dynamicLinker} -B${config.deps.host.host.glibc.package}/lib";
|
||||
LDFLAGS_FOR_TARGET = "-L$(pwd)/${config.target.triple}/libgcc -L${config.deps.host.host.glibc.package}/lib";
|
||||
LIBRARY_PATH = "${config.deps.host.host.glibc.package}/lib";
|
||||
CFLAGS_FOR_TARGET = "-Wl,-dynamic-linker -Wl,${config.deps.host.glibc.dynamicLinker} -B${config.deps.host.glibc.package}/lib";
|
||||
LDFLAGS_FOR_TARGET = "-L$(pwd)/${platform.target.triple}/libgcc -L${config.deps.host.glibc.package}/lib";
|
||||
LIBRARY_PATH = "${config.deps.host.glibc.package}/lib";
|
||||
};
|
||||
|
||||
hooks = ctx: {
|
||||
|
|
@ -195,12 +197,8 @@ in
|
|||
export CXX='${config.package}/bin/${prefix}g++ ${
|
||||
builtins.concatStringsSep " " (gccFlags ++ ctx.host."foundation:cflags")
|
||||
}'
|
||||
export CC_FOR_TARGET='${config.package}/bin/${prefix}gcc ${
|
||||
builtins.concatStringsSep " " (gccFlags ++ ctx.target."foundation:cflags")
|
||||
}'
|
||||
export CXX_FOR_TARGET='${config.package}/bin/${prefix}g++ ${
|
||||
builtins.concatStringsSep " " (gccFlags ++ ctx.target."foundation:cflags")
|
||||
}'
|
||||
export CC_FOR_TARGET=$CC
|
||||
export CXX_FOR_TARGET=$CXX
|
||||
alias gcc='$CC'
|
||||
alias g++='$CXX'
|
||||
'';
|
||||
|
|
@ -233,9 +231,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.host.host.glibc.package}/lib/{crti.o,crtn.o} gcc
|
||||
mkdir -p ${platform.host.host}/libstdc++-v3/src
|
||||
ln -sv ${config.deps.host.host.glibc.package}/lib/{crti.o,crtn.o} ${platform.host.host}/libstdc++-v3/src
|
||||
ln -sv ${config.deps.host.glibc.package}/lib/{crti.o,crtn.o} gcc
|
||||
mkdir -p ${platform.target.triple}/libstdc++-v3/src
|
||||
ln -sv ${config.deps.host.glibc.package}/lib/{crti.o,crtn.o} ${platform.target.triple}/libstdc++-v3/src
|
||||
|
||||
bash ../configure ${builtins.concatStringsSep " " configureFlags}
|
||||
'';
|
||||
|
|
|
|||
|
|
@ -41,26 +41,24 @@ in
|
|||
|
||||
deps = {
|
||||
build = {
|
||||
build = {
|
||||
bzip2 = packages.foundation.bzip2.versions."1.0.8-bootstrap";
|
||||
diffutils = packages.foundation.diffutils.versions."3.10-bootstrap";
|
||||
findutils = packages.foundation.findutils.versions."4.9.0-bootstrap";
|
||||
gawk = packages.foundation.gawk.versions."5.2.2-bootstrap";
|
||||
gnugrep = packages.foundation.gnugrep.versions."3.11-bootstrap";
|
||||
gnumake = packages.foundation.gnumake.versions."4.4.1-bootstrap";
|
||||
gnupatch = packages.foundation.gnupatch.versions."2.7-bootstrap";
|
||||
gnused = packages.foundation.gnused.versions."4.9-bootstrap";
|
||||
gnutar = packages.foundation.gnutar.versions."1.35-bootstrap";
|
||||
gzip = packages.foundation.gzip.versions."1.13-bootstrap";
|
||||
xz = packages.foundation.xz.versions."5.4.3-bootstrap";
|
||||
python = packages.foundation.python.versions."3.12.0-bootstrap";
|
||||
bison = packages.foundation.bison.versions."3.8.2-bootstrap";
|
||||
};
|
||||
host = {
|
||||
gcc = packages.foundation.gcc.versions."13.2.0-bootstrap";
|
||||
binutils = packages.foundation.binutils.versions."2.41-bootstrap";
|
||||
linux-headers = packages.foundation.linux-headers.versions."6.5.6-stage1";
|
||||
};
|
||||
bzip2 = packages.foundation.bzip2.versions."1.0.8-bootstrap";
|
||||
diffutils = packages.foundation.diffutils.versions."3.10-bootstrap";
|
||||
findutils = packages.foundation.findutils.versions."4.9.0-bootstrap";
|
||||
gawk = packages.foundation.gawk.versions."5.2.2-bootstrap";
|
||||
gnugrep = packages.foundation.gnugrep.versions."3.11-bootstrap";
|
||||
gnumake = packages.foundation.gnumake.versions."4.4.1-bootstrap";
|
||||
gnupatch = packages.foundation.gnupatch.versions."2.7-bootstrap";
|
||||
gnused = packages.foundation.gnused.versions."4.9-bootstrap";
|
||||
gnutar = packages.foundation.gnutar.versions."1.35-bootstrap";
|
||||
gzip = packages.foundation.gzip.versions."1.13-bootstrap";
|
||||
xz = packages.foundation.xz.versions."5.4.3-bootstrap";
|
||||
python = packages.foundation.python.versions."3.12.0-bootstrap";
|
||||
bison = packages.foundation.bison.versions."3.8.2-bootstrap";
|
||||
gcc = packages.foundation.gcc.versions."13.2.0-bootstrap";
|
||||
binutils = packages.foundation.binutils.versions."2.41-bootstrap";
|
||||
};
|
||||
host = {
|
||||
linux-headers = packages.foundation.linux-headers.versions."6.5.6-stage1";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -80,8 +78,8 @@ in
|
|||
--prefix=$out \
|
||||
--build=${platform.build.triple} \
|
||||
--host=${platform.host.triple} \
|
||||
--with-headers=${config.deps.build.host.linux-headers.package}/include \
|
||||
--with-binutils=${config.deps.build.host.binutils.package}/${platform.host.triple}/bin
|
||||
--with-headers=${config.deps.host.linux-headers.package}/include \
|
||||
--with-binutils=${config.deps.build.binutils.package}/bin
|
||||
'';
|
||||
|
||||
build = ''
|
||||
|
|
@ -92,7 +90,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.linux-headers.package}/include/* | grep -v scsi\$) $out/include/
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -10,12 +10,10 @@ let
|
|||
package = packages.foundation.glibc.versions."2.38-stage1".extend {
|
||||
platform = {
|
||||
build = lib.modules.overrides.force (
|
||||
if config.platform.build != config.platform.target then
|
||||
config.platform.build
|
||||
else if config.platform.build == "x86_64-linux" || config.platform.build == "i686-linux" then
|
||||
if config.platform.build == "x86_64-linux" || config.platform.build == "i686-linux" then
|
||||
"i686-linux"
|
||||
else
|
||||
"x86_64-linux"
|
||||
config.platform.build
|
||||
);
|
||||
host = lib.modules.overrides.force config.platform.host;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -53,8 +53,8 @@ in
|
|||
};
|
||||
|
||||
deps = {
|
||||
build = {
|
||||
build =
|
||||
build =
|
||||
(
|
||||
if (config.platform.build == "i686-linux") then
|
||||
{
|
||||
bzip2 = packages.foundation.bzip2.versions."1.0.8-bootstrap";
|
||||
|
|
@ -96,14 +96,18 @@ in
|
|||
}
|
||||
// lib.attrs.when (config.platform.build != config.platform.host) {
|
||||
glibc = packages.foundation.glibc.versions."2.38-stage1-passthrough";
|
||||
};
|
||||
host = {
|
||||
linux-headers = packages.foundation.linux-headers.versions."6.5.6-stage1";
|
||||
}
|
||||
}
|
||||
)
|
||||
// lib.attrs.when (config.platform.build != config.platform.host) {
|
||||
gcc = packages.foundation.gcc.versions."13.2.0-stage1";
|
||||
binutils = packages.foundation.binutils.versions."2.41-stage1";
|
||||
gcc-cross = packages.foundation.gcc.versions."13.2.0-stage1".extend {
|
||||
settings.target = config.platform.host;
|
||||
};
|
||||
binutils-cross = packages.foundation.binutils.versions."2.41-stage1".extend {
|
||||
settings.target = config.platform.host;
|
||||
};
|
||||
};
|
||||
host = {
|
||||
linux-headers = packages.foundation.linux-headers.versions."6.5.6-stage1";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -133,10 +137,10 @@ in
|
|||
"--prefix=$out"
|
||||
"--build=${platform.build.triple}"
|
||||
"--host=${platform.host.triple}"
|
||||
"--with-headers=${config.deps.build.host.linux-headers.package}/include"
|
||||
"--with-headers=${config.deps.host.linux-headers.package}/include"
|
||||
]
|
||||
++ lib.lists.when (config.platform.build != config.platform.host) [
|
||||
"--with-binutils=${config.deps.build.host.binutils.package}/${platform.host.triple}/bin"
|
||||
"--with-binutils=${config.deps.build.binutils-cross.package}/${platform.host.triple}/bin"
|
||||
]
|
||||
);
|
||||
in
|
||||
|
|
@ -165,15 +169,15 @@ in
|
|||
"make \"localedata/install-locales\" \"localedir=$out/lib/locale\""
|
||||
else
|
||||
''
|
||||
mkdir -p $TMPDIR/${config.deps.build.build.glibc.package}/lib/locale
|
||||
mkdir -p $TMPDIR/${config.deps.build.glibc.package}/lib/locale
|
||||
sed -i -e \
|
||||
's,^$(rtld-prefix) $(common-objpfx)locale/localedef,localedef --prefix=''${TMPDIR} --${platform.host.system.cpu.endian.name}-endian,' \
|
||||
../localedata/Makefile
|
||||
make SHELL='sh -x' "localedata/install-locales" "localedir=$out/lib/locale"
|
||||
cp -r $TMPDIR/${config.deps.build.build.glibc.package}/lib/locale $out/lib
|
||||
cp -r $TMPDIR/${config.deps.build.glibc.package}/lib/locale $out/lib
|
||||
''
|
||||
}
|
||||
ln -sv $(ls -d ${config.deps.build.host.linux-headers.package}/include/* | grep -v scsi\$) $out/include/
|
||||
ln -sv $(ls -d ${config.deps.host.linux-headers.package}/include/* | grep -v scsi\$) $out/include/
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -30,43 +30,38 @@ in
|
|||
};
|
||||
|
||||
deps = {
|
||||
build = {
|
||||
build =
|
||||
if (config.platform.build == "i686-linux") then
|
||||
{
|
||||
diffutils = packages.foundation.diffutils.versions."3.10-bootstrap";
|
||||
findutils = packages.foundation.findutils.versions."4.9.0-bootstrap";
|
||||
gawk = packages.foundation.gawk.versions."5.2.2-bootstrap";
|
||||
gnugrep = packages.foundation.gnugrep.versions."3.11-bootstrap";
|
||||
gnumake = packages.foundation.gnumake.versions."4.4.1-bootstrap";
|
||||
gnupatch = packages.foundation.gnupatch.versions."2.7-bootstrap";
|
||||
gnused = packages.foundation.gnused.versions."4.9-bootstrap";
|
||||
gnutar = packages.foundation.gnutar.versions."1.35-bootstrap";
|
||||
gzip = packages.foundation.gzip.versions."1.13-bootstrap";
|
||||
xz = packages.foundation.xz.versions."5.4.3-bootstrap";
|
||||
gcc = packages.foundation.gcc.versions."13.2.0-bootstrap";
|
||||
binutils = packages.foundation.binutils.versions."2.41-bootstrap";
|
||||
}
|
||||
else
|
||||
{
|
||||
diffutils = packages.foundation.diffutils.versions."3.10-stage1-passthrough";
|
||||
findutils = packages.foundation.findutils.versions."4.9.0-stage1-passthrough";
|
||||
gawk = packages.foundation.gawk.versions."5.2.2-stage1-passthrough";
|
||||
gnugrep = packages.foundation.gnugrep.versions."3.11-stage1-passthrough";
|
||||
gnumake = packages.foundation.gnumake.versions."4.4.1-stage1-passthrough";
|
||||
gnupatch = packages.foundation.gnupatch.versions."2.7-stage1-passthrough";
|
||||
gnused = packages.foundation.gnused.versions."4.9-stage1-passthrough";
|
||||
gnutar = packages.foundation.gnutar.versions."1.35-stage1-passthrough";
|
||||
gzip = packages.foundation.gzip.versions."1.13-stage1-passthrough";
|
||||
xz = packages.foundation.xz.versions."5.4.3-stage1-passthrough";
|
||||
gcc = packages.foundation.gcc.versions."13.2.0-stage4";
|
||||
binutils = packages.foundation.binutils.versions."2.41-stage1-passthrough";
|
||||
};
|
||||
host = lib.attrs.when (config.platform.build != config.platform.host) {
|
||||
gcc = packages.foundation.gcc.versions."13.2.0-stage2";
|
||||
binutils = packages.foundation.binutils.versions."2.41-stage1";
|
||||
};
|
||||
};
|
||||
build = (
|
||||
if (config.platform.build == "i686-linux") then
|
||||
{
|
||||
diffutils = packages.foundation.diffutils.versions."3.10-bootstrap";
|
||||
findutils = packages.foundation.findutils.versions."4.9.0-bootstrap";
|
||||
gawk = packages.foundation.gawk.versions."5.2.2-bootstrap";
|
||||
gnugrep = packages.foundation.gnugrep.versions."3.11-bootstrap";
|
||||
gnumake = packages.foundation.gnumake.versions."4.4.1-bootstrap";
|
||||
gnupatch = packages.foundation.gnupatch.versions."2.7-bootstrap";
|
||||
gnused = packages.foundation.gnused.versions."4.9-bootstrap";
|
||||
gnutar = packages.foundation.gnutar.versions."1.35-bootstrap";
|
||||
gzip = packages.foundation.gzip.versions."1.13-bootstrap";
|
||||
xz = packages.foundation.xz.versions."5.4.3-bootstrap";
|
||||
gcc = packages.foundation.gcc.versions."13.2.0-bootstrap";
|
||||
binutils = packages.foundation.binutils.versions."2.41-bootstrap";
|
||||
}
|
||||
else
|
||||
{
|
||||
diffutils = packages.foundation.diffutils.versions."3.10-stage1-passthrough";
|
||||
findutils = packages.foundation.findutils.versions."4.9.0-stage1-passthrough";
|
||||
gawk = packages.foundation.gawk.versions."5.2.2-stage1-passthrough";
|
||||
gnugrep = packages.foundation.gnugrep.versions."3.11-stage1-passthrough";
|
||||
gnumake = packages.foundation.gnumake.versions."4.4.1-stage1-passthrough";
|
||||
gnupatch = packages.foundation.gnupatch.versions."2.7-stage1-passthrough";
|
||||
gnused = packages.foundation.gnused.versions."4.9-stage1-passthrough";
|
||||
gnutar = packages.foundation.gnutar.versions."1.35-stage1-passthrough";
|
||||
gzip = packages.foundation.gzip.versions."1.13-stage1-passthrough";
|
||||
xz = packages.foundation.xz.versions."5.4.3-stage1-passthrough";
|
||||
gcc = packages.foundation.gcc.versions."13.2.0-stage4";
|
||||
binutils = packages.foundation.binutils.versions."2.41-stage1-passthrough";
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
phases = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue