Compare commits
No commits in common. "main" and "main" have entirely different histories.
|
@ -3,18 +3,17 @@
|
||||||
"lib": {
|
"lib": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"dir": "lib",
|
"dir": "lib",
|
||||||
"lastModified": 1723737980,
|
"dirtyRev": "2be3111b2c0911f40b47fe0a1fb22b5f5188cf59-dirty",
|
||||||
"narHash": "sha256-1WnFatW5kSuO2jjt62hvSbH84TSYyO+VmvkJ0d5e/ZY=",
|
"dirtyShortRev": "2be3111-dirty",
|
||||||
"ref": "master",
|
"lastModified": 1719251485,
|
||||||
"rev": "cadfaabc853d20f2bc20bad794fcbe520ea48f13",
|
"narHash": "sha256-63NvfFVeTDITfNu60rmCUlaZtAeZUnvrIaOLSk9ScC8=",
|
||||||
"revCount": 82,
|
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "file:../"
|
"url": "file:../?dir=lib"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"dir": "lib",
|
"dir": "lib",
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "file:../"
|
"url": "file:../?dir=lib"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
|
|
|
@ -149,7 +149,7 @@ in
|
||||||
];
|
];
|
||||||
actual = lib.dag.sort.topological {
|
actual = lib.dag.sort.topological {
|
||||||
a = lib.dag.entry.anywhere "a";
|
a = lib.dag.entry.anywhere "a";
|
||||||
b = lib.dag.entry.between [ "a" ] [ "c" ] "b";
|
b = lib.dag.entry.between [ "c" ] [ "a" ] "b";
|
||||||
c = lib.dag.entry.before [ "c" ] "c";
|
c = lib.dag.entry.before [ "c" ] "c";
|
||||||
d = lib.dag.entry.after [ "c" ] "d";
|
d = lib.dag.entry.after [ "c" ] "d";
|
||||||
};
|
};
|
||||||
|
|
|
@ -579,7 +579,7 @@ lib: {
|
||||||
##
|
##
|
||||||
## @type Attrs
|
## @type Attrs
|
||||||
shell = lib.types.derivation // {
|
shell = lib.types.derivation // {
|
||||||
check = value: lib.packages.isDerivation value && builtins.hasAttr "shellPath" value;
|
check = value: lib.packages.isDerivation && builtins.hasAttr "shellPath" value;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -8,35 +8,33 @@
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"dir": "foundation",
|
"dir": "foundation",
|
||||||
"lastModified": 1724190751,
|
"dirtyRev": "3f9d287065ac685ce500c2cddb35428b2927f5a2-dirty",
|
||||||
"narHash": "sha256-e8sOmeXS9YWuQqjW6gvtS3PIueazkf4S1iiJ/94eXv4=",
|
"dirtyShortRev": "3f9d287-dirty",
|
||||||
"ref": "master",
|
"lastModified": 1720514984,
|
||||||
"rev": "4b36a5a0133f5481840bdfaf693c971215a7ef1f",
|
"narHash": "sha256-AuixwSlYk34Z6+GEc7y4QotF3Hk963zC9I9hAwX5KCE=",
|
||||||
"revCount": 84,
|
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "file:../"
|
"url": "file:../?dir=foundation"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"dir": "foundation",
|
"dir": "foundation",
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "file:../"
|
"url": "file:../?dir=foundation"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lib": {
|
"lib": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"dir": "lib",
|
"dir": "lib",
|
||||||
"lastModified": 1724190751,
|
"dirtyRev": "3f9d287065ac685ce500c2cddb35428b2927f5a2-dirty",
|
||||||
"narHash": "sha256-e8sOmeXS9YWuQqjW6gvtS3PIueazkf4S1iiJ/94eXv4=",
|
"dirtyShortRev": "3f9d287-dirty",
|
||||||
"ref": "master",
|
"lastModified": 1720514984,
|
||||||
"rev": "4b36a5a0133f5481840bdfaf693c971215a7ef1f",
|
"narHash": "sha256-AuixwSlYk34Z6+GEc7y4QotF3Hk963zC9I9hAwX5KCE=",
|
||||||
"revCount": 84,
|
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "file:../"
|
"url": "file:../?dir=lib"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"dir": "lib",
|
"dir": "lib",
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "file:../"
|
"url": "file:../?dir=lib"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": {
|
"root": {
|
||||||
|
|
|
@ -65,15 +65,7 @@ in
|
||||||
PATH =
|
PATH =
|
||||||
let
|
let
|
||||||
bins = lib.paths.bin (
|
bins = lib.paths.bin (
|
||||||
(lib.packages.dependencies.get dependencies.build.only)
|
(lib.packages.dependencies.get dependencies.build.host)
|
||||||
++ (lib.packages.dependencies.get dependencies.build.build)
|
|
||||||
++ (lib.packages.dependencies.get dependencies.build.host)
|
|
||||||
++ (lib.packages.dependencies.get dependencies.build.target)
|
|
||||||
++ (lib.packages.dependencies.get dependencies.host.only)
|
|
||||||
++ (lib.packages.dependencies.get dependencies.host.host)
|
|
||||||
++ (lib.packages.dependencies.get dependencies.host.target)
|
|
||||||
++ (lib.packages.dependencies.get dependencies.target.only)
|
|
||||||
++ (lib.packages.dependencies.get dependencies.target.target)
|
|
||||||
++ [
|
++ [
|
||||||
foundation.stage2-bash
|
foundation.stage2-bash
|
||||||
foundation.stage2-coreutils
|
foundation.stage2-coreutils
|
||||||
|
@ -107,7 +99,6 @@ in
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
# (builtins.trace "build: ${package.name} -> build=${package.platform.build.triple} host=${package.platform.host.triple} target=${package.platform.target.triple}")
|
|
||||||
built
|
built
|
||||||
// {
|
// {
|
||||||
inherit (package) meta;
|
inherit (package) meta;
|
||||||
|
|
|
@ -16,24 +16,27 @@ in
|
||||||
aux-a = config.packages.aux.a;
|
aux-a = config.packages.aux.a;
|
||||||
aux-b = config.packages.aux.b;
|
aux-b = config.packages.aux.b;
|
||||||
|
|
||||||
|
# foundation-gcc-x86_64 =
|
||||||
|
# (config.packages.foundation.gcc.versions."13.2.0".extend (args: {
|
||||||
|
# config = {
|
||||||
|
# platform = {
|
||||||
|
# target = lib.modules.overrides.force "x86_64-linux";
|
||||||
|
# };
|
||||||
|
# };
|
||||||
|
# }))
|
||||||
|
# .config;
|
||||||
foundation-gcc = config.packages.foundation.gcc;
|
foundation-gcc = config.packages.foundation.gcc;
|
||||||
foundation-glibc = config.packages.foundation.glibc;
|
|
||||||
foundation-binutils = config.packages.foundation.binutils;
|
foundation-binutils = config.packages.foundation.binutils;
|
||||||
foundation-linux-headers = config.packages.foundation.linux-headers;
|
foundation-linux-headers = config.packages.foundation.linux-headers;
|
||||||
|
# foundation-linux-headers = config.packages.foundation.linux-headers.versions.latest.extend {
|
||||||
|
# platform.host = lib.modules.overrides.force "x86_64-linux";
|
||||||
|
# };
|
||||||
|
# example-x = config.packages.example.x;
|
||||||
|
cross-aux-a-x86_64-linux = config.packages.cross.x86_64-linux.aux.a;
|
||||||
|
cross-foundation-gcc-x86_64-linux = config.packages.cross.x86_64-linux.foundation.gcc;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
cross-foundation-glibc-x86_64-linux = config.packages.cross.x86_64-linux.foundation.glibc;
|
# exported.packages.i686-linux.cross-foundation-gcc-x86_64-linux = config.packages.cross.x86_64-linux.foundation.gcc.package;
|
||||||
cross-foundation-binutils-x86_64-linux = config.packages.cross.x86_64-linux.foundation.binutils;
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
example-a = config.packages.foundation.gcc.versions.latest.extend {
|
|
||||||
platform = {
|
|
||||||
target = lib.modules.override 0 "x86_64-linux";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,34 +230,6 @@ in
|
||||||
default.value = [ ];
|
default.value = [ ];
|
||||||
};
|
};
|
||||||
|
|
||||||
# extend = lib.options.create {
|
|
||||||
# description = "Extend the package definition.";
|
|
||||||
# type = lib.types.function lib.types.raw;
|
|
||||||
# internal = true;
|
|
||||||
# writable = false;
|
|
||||||
# default.value = module:
|
|
||||||
# let
|
|
||||||
# normalized =
|
|
||||||
# if builtins.isList module then
|
|
||||||
# module
|
|
||||||
# else if builtins.isFunction module || module ? config then
|
|
||||||
# [ module ]
|
|
||||||
# else
|
|
||||||
# [{
|
|
||||||
# config = module;
|
|
||||||
# }];
|
|
||||||
# result = meta.extend {
|
|
||||||
# modules =
|
|
||||||
# normalized ++ [
|
|
||||||
# {
|
|
||||||
# config.__modules__ = lib.modules.overrides.force (config.__modules__ ++ normalized);
|
|
||||||
# }
|
|
||||||
# ];
|
|
||||||
# };
|
|
||||||
# in
|
|
||||||
# result.config;
|
|
||||||
# };
|
|
||||||
|
|
||||||
extend = lib.options.create {
|
extend = lib.options.create {
|
||||||
description = "Extend the package definition.";
|
description = "Extend the package definition.";
|
||||||
type = lib.types.function lib.types.raw;
|
type = lib.types.function lib.types.raw;
|
||||||
|
@ -274,14 +246,13 @@ in
|
||||||
[{
|
[{
|
||||||
config = module;
|
config = module;
|
||||||
}];
|
}];
|
||||||
|
result = meta.extend {
|
||||||
modules = config.__modules__ ++ normalized;
|
modules =
|
||||||
|
normalized ++ [
|
||||||
result = lib.modules.run {
|
{
|
||||||
modules = [
|
config.__modules__ = lib.modules.overrides.force (config.__modules__ ++ normalized);
|
||||||
submodule
|
}
|
||||||
{ config.__modules__ = modules; }
|
];
|
||||||
] ++ modules;
|
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
result.config;
|
result.config;
|
||||||
|
@ -290,8 +261,8 @@ in
|
||||||
meta = {
|
meta = {
|
||||||
description = lib.options.create {
|
description = lib.options.create {
|
||||||
description = "The description for the package.";
|
description = "The description for the package.";
|
||||||
type = lib.types.string;
|
type = lib.types.nullish lib.types.string;
|
||||||
default.value = "";
|
default.value = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
homepage = lib.options.create {
|
homepage = lib.options.create {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ config }:
|
{ lib', config }:
|
||||||
let
|
let
|
||||||
inherit (config) builders packages;
|
inherit (config) builders packages;
|
||||||
in
|
in
|
||||||
|
|
|
@ -4,7 +4,7 @@ let
|
||||||
|
|
||||||
doubles = lib.systems.doubles.all;
|
doubles = lib.systems.doubles.all;
|
||||||
|
|
||||||
packages = builtins.removeAttrs config.packages [ "cross" "cross-tools" ];
|
packages = builtins.removeAttrs config.packages [ "cross" ];
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
includes = [
|
includes = [
|
||||||
|
@ -21,14 +21,6 @@ in
|
||||||
freeform = lib.types.packages;
|
freeform = lib.types.packages;
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
cross-tools = lib.attrs.generate doubles (
|
|
||||||
system:
|
|
||||||
lib.options.create {
|
|
||||||
description = "The cross-compilation tools for the ${system} target.";
|
|
||||||
type = lib.types.packages;
|
|
||||||
default.value = { };
|
|
||||||
}
|
|
||||||
);
|
|
||||||
cross = lib.attrs.generate doubles (
|
cross = lib.attrs.generate doubles (
|
||||||
system:
|
system:
|
||||||
lib.options.create {
|
lib.options.create {
|
||||||
|
@ -62,36 +54,6 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
packages.cross-tools = lib.attrs.generate doubles (
|
|
||||||
system:
|
|
||||||
builtins.mapAttrs
|
|
||||||
(
|
|
||||||
namespace:
|
|
||||||
builtins.mapAttrs (
|
|
||||||
name: alias:
|
|
||||||
let
|
|
||||||
setTarget =
|
|
||||||
package:
|
|
||||||
package
|
|
||||||
// {
|
|
||||||
__modules__ = package.__modules__ ++ [
|
|
||||||
{
|
|
||||||
config.platform = {
|
|
||||||
target = lib.modules.override 5 system;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
updated = alias // {
|
|
||||||
versions = builtins.mapAttrs (version: package: setTarget package) alias.versions;
|
|
||||||
};
|
|
||||||
in
|
|
||||||
updated
|
|
||||||
)
|
|
||||||
)
|
|
||||||
packages
|
|
||||||
);
|
|
||||||
packages.cross = lib.attrs.generate doubles (
|
packages.cross = lib.attrs.generate doubles (
|
||||||
system:
|
system:
|
||||||
builtins.mapAttrs
|
builtins.mapAttrs
|
||||||
|
@ -100,7 +62,7 @@ in
|
||||||
builtins.mapAttrs (
|
builtins.mapAttrs (
|
||||||
name: alias:
|
name: alias:
|
||||||
let
|
let
|
||||||
setPlatform =
|
setHost =
|
||||||
package:
|
package:
|
||||||
package
|
package
|
||||||
// {
|
// {
|
||||||
|
@ -115,7 +77,7 @@ in
|
||||||
};
|
};
|
||||||
|
|
||||||
updated = alias // {
|
updated = alias // {
|
||||||
versions = builtins.mapAttrs (version: package: setPlatform package) alias.versions;
|
versions = builtins.mapAttrs (version: package: setHost package) alias.versions;
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
updated
|
updated
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{ lib
|
{
|
||||||
, lib'
|
lib,
|
||||||
, config
|
lib',
|
||||||
, options
|
config,
|
||||||
,
|
options,
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (config)
|
inherit (config)
|
||||||
|
@ -27,23 +27,9 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = {
|
||||||
let
|
|
||||||
isBuildBootstrapped = config.platform.build.double == "i686-linux";
|
|
||||||
isHostBootstrapped = config.platform.host.double == "i686-linux";
|
|
||||||
|
|
||||||
isBootstrapped = isBuildBootstrapped && isHostBootstrapped;
|
|
||||||
|
|
||||||
isCross =
|
|
||||||
config.platform.build.double != config.platform.host.double
|
|
||||||
&& config.platform.host.double == config.platform.target.double;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
meta = {
|
meta = {
|
||||||
platforms = [
|
platforms = [ "i686-linux" ];
|
||||||
"i686-linux"
|
|
||||||
"x86_64-linux"
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pname = "binutils";
|
pname = "binutils";
|
||||||
|
@ -53,43 +39,15 @@ in
|
||||||
|
|
||||||
deps = {
|
deps = {
|
||||||
build = {
|
build = {
|
||||||
only = {
|
host = {
|
||||||
gcc = lib.modules.when (!isBootstrapped) (
|
inherit (packages.foundation) gcc;
|
||||||
if isCross then
|
|
||||||
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) (
|
|
||||||
packages.foundation.binutils.versions.latest.extend {
|
|
||||||
platform = lib.modules.override 0 {
|
|
||||||
inherit (config.platform) target build;
|
|
||||||
host = config.platform.build;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
env = {
|
env = {
|
||||||
PATH = lib.paths.bin (
|
PATH = lib.paths.bin [
|
||||||
lib.lists.when (isBootstrapped) [ foundation.stage2-gcc ]
|
# foundation.stage2-gcc
|
||||||
++ [
|
|
||||||
foundation.stage2-gcc
|
|
||||||
foundation.stage2-binutils
|
foundation.stage2-binutils
|
||||||
foundation.stage2-gnumake
|
foundation.stage2-gnumake
|
||||||
foundation.stage2-gnupatch
|
foundation.stage2-gnupatch
|
||||||
|
@ -100,11 +58,8 @@ in
|
||||||
foundation.stage2-findutils
|
foundation.stage2-findutils
|
||||||
foundation.stage2-gnutar
|
foundation.stage2-gnutar
|
||||||
foundation.stage1-xz
|
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 =
|
phases =
|
||||||
let
|
let
|
||||||
|
@ -113,11 +68,9 @@ in
|
||||||
./patches/deterministic.patch
|
./patches/deterministic.patch
|
||||||
];
|
];
|
||||||
|
|
||||||
configureFlags =
|
configureFlags = [
|
||||||
lib.lists.when (!isCross) [
|
# "CC=musl-gcc"
|
||||||
"LDFLAGS=--static"
|
"LDFLAGS=--static"
|
||||||
]
|
|
||||||
++ [
|
|
||||||
"--prefix=${builtins.placeholder "out"}"
|
"--prefix=${builtins.placeholder "out"}"
|
||||||
"--build=${config.platform.build.triple}"
|
"--build=${config.platform.build.triple}"
|
||||||
"--host=${config.platform.host.triple}"
|
"--host=${config.platform.host.triple}"
|
||||||
|
@ -139,7 +92,6 @@ in
|
||||||
"--with-lib-path=:"
|
"--with-lib-path=:"
|
||||||
|
|
||||||
"--disable-multilib"
|
"--disable-multilib"
|
||||||
|
|
||||||
];
|
];
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,84 +0,0 @@
|
||||||
{ config, options }:
|
|
||||||
let
|
|
||||||
inherit (config)
|
|
||||||
lib
|
|
||||||
packages
|
|
||||||
;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
config.packages.foundation.gcc-bootstrap = {
|
|
||||||
versions = {
|
|
||||||
"latest" = config.packages.foundation.gcc.versions.latest.extend
|
|
||||||
(
|
|
||||||
{ config }:
|
|
||||||
{
|
|
||||||
config = {
|
|
||||||
meta = {
|
|
||||||
platforms = lib.modules.override 0 [
|
|
||||||
"i686-linux"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
deps = {
|
|
||||||
build = {
|
|
||||||
build = {
|
|
||||||
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";
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
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;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
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;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
env = {
|
|
||||||
LIBRARY_PATH = lib.modules.override 0 "${config.deps.build.build.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";
|
|
||||||
};
|
|
||||||
|
|
||||||
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"
|
|
||||||
"--enable-languages=c,c++"
|
|
||||||
"--disable-bootstrap"
|
|
||||||
"--disable-libsanitizer"
|
|
||||||
"--disable-multilib"
|
|
||||||
"--with-native-system-header-dir=${config.deps.build.build.glibc.package}/include"
|
|
||||||
"--with-gxx-include-dir=${placeholder "out"}/include/c++/${config.version}/"
|
|
||||||
"--with-build-sysroot=/"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,104 +0,0 @@
|
||||||
{ config, options }:
|
|
||||||
let
|
|
||||||
inherit (config)
|
|
||||||
lib
|
|
||||||
foundation
|
|
||||||
packages
|
|
||||||
;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
config.packages.foundation.gcc-cross = {
|
|
||||||
versions = {
|
|
||||||
"latest" = config.packages.foundation.gcc.versions.latest.extend
|
|
||||||
(
|
|
||||||
{ config }:
|
|
||||||
{
|
|
||||||
config =
|
|
||||||
let
|
|
||||||
programPrefix = lib.strings.when
|
|
||||||
(
|
|
||||||
config.platform.build.triple != config.platform.target.triple
|
|
||||||
) "${config.platform.target.triple}-";
|
|
||||||
in
|
|
||||||
{
|
|
||||||
meta = {
|
|
||||||
platforms = lib.modules.override 0 [
|
|
||||||
"i686-linux"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
deps = {
|
|
||||||
build = {
|
|
||||||
build = {
|
|
||||||
binutils = (
|
|
||||||
packages.foundation.binutils.versions.latest.extend {
|
|
||||||
platform = lib.modules.override 0 config.platform;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
glibc = (
|
|
||||||
packages.foundation.glibc.versions.latest.extend {
|
|
||||||
platform = lib.modules.override 0 {
|
|
||||||
inherit (config.platform) build target;
|
|
||||||
host = config.platform.target;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
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";
|
|
||||||
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";
|
|
||||||
LDFLAGS_FOR_TARGET =
|
|
||||||
lib.modules.override 0
|
|
||||||
"-L$(pwd)/${config.platform.target.triple}/libgcc -L${config.deps.build.build.glibc.package}/lib";
|
|
||||||
};
|
|
||||||
|
|
||||||
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"
|
|
||||||
"--enable-languages=c,c++"
|
|
||||||
"--disable-libsanitizer"
|
|
||||||
"--disable-lto"
|
|
||||||
"--disable-multilib"
|
|
||||||
"--with-headers=${config.deps.build.build.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"
|
|
||||||
];
|
|
||||||
|
|
||||||
phases.configure = lib.modules.override 0 ''
|
|
||||||
# Configure
|
|
||||||
|
|
||||||
mkdir build
|
|
||||||
cd build
|
|
||||||
echo PATH=$PATH
|
|
||||||
|
|
||||||
# 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
|
|
||||||
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
|
|
||||||
|
|
||||||
bash ../configure ${builtins.concatStringsSep " " config.configureFlags}
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -11,11 +11,12 @@ let
|
||||||
;
|
;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
includes = [
|
config.packages.context.options = {
|
||||||
./newlib.nix
|
"foundation:cflags" = lib.options.create {
|
||||||
./cross.nix
|
type = lib.types.list.of lib.types.string;
|
||||||
./bootstrap.nix
|
default.value = [ ];
|
||||||
];
|
};
|
||||||
|
};
|
||||||
|
|
||||||
config.packages.foundation.gcc = {
|
config.packages.foundation.gcc = {
|
||||||
versions = {
|
versions = {
|
||||||
|
@ -81,78 +82,25 @@ in
|
||||||
description = "Version of isl.";
|
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 {
|
config = {
|
||||||
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"
|
|
||||||
else
|
|
||||||
"${config.deps.build.build.glibc.package}/lib/ld-linux-x86-64.so.2";
|
|
||||||
|
|
||||||
host = lib.systems.withBuildInfo config.platform.host;
|
|
||||||
target = lib.systems.withBuildInfo config.platform.target;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
meta = {
|
meta = {
|
||||||
platforms = [
|
platforms = [ "i686-linux" ];
|
||||||
"i686-linux"
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pname = "gcc-${config.platform.build.double}--${config.platform.host.double}--${config.platform.target.double}";
|
pname = "gcc";
|
||||||
version = "13.2.0";
|
version = "13.2.0";
|
||||||
|
|
||||||
builder = builders.basic;
|
builder = builders.basic;
|
||||||
|
|
||||||
deps = {
|
env = {
|
||||||
build = {
|
PATH = lib.paths.bin [
|
||||||
build = lib.modules.when (!isBootstrapped) {
|
foundation.stage2-gcc
|
||||||
gcc = packages.foundation.gcc-cross.versions.latest;
|
foundation.stage2-binutils
|
||||||
glibc = packages.foundation.glibc.versions.latest;
|
|
||||||
linux-headers = packages.foundation.linux-headers.versions.latest;
|
|
||||||
binutils = packages.foundation.binutils.versions.latest;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
env =
|
|
||||||
{
|
|
||||||
PATH = lib.modules.when (isBuildBootstrapped) (
|
|
||||||
lib.paths.bin ([
|
|
||||||
foundation.stage2-gnumake
|
foundation.stage2-gnumake
|
||||||
foundation.stage2-gnused
|
foundation.stage2-gnused
|
||||||
foundation.stage2-gnugrep
|
foundation.stage2-gnugrep
|
||||||
foundation.stage2-gnupatch
|
|
||||||
foundation.stage2-gawk
|
foundation.stage2-gawk
|
||||||
foundation.stage2-diffutils
|
foundation.stage2-diffutils
|
||||||
foundation.stage2-findutils
|
foundation.stage2-findutils
|
||||||
|
@ -160,73 +108,14 @@ in
|
||||||
foundation.stage2-gzip
|
foundation.stage2-gzip
|
||||||
foundation.stage2-bzip2
|
foundation.stage2-bzip2
|
||||||
foundation.stage1-xz
|
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";
|
|
||||||
};
|
|
||||||
|
|
||||||
hooks =
|
|
||||||
let
|
|
||||||
flags =
|
|
||||||
if (isBootstrapped && !(cross || crossTool)) then
|
|
||||||
[
|
|
||||||
"-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"
|
|
||||||
];
|
];
|
||||||
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_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 =
|
|
||||||
[
|
|
||||||
"--prefix=${builtins.placeholder "out"}"
|
|
||||||
"--build=${config.platform.build.triple}"
|
|
||||||
"--host=${config.platform.host.triple}"
|
|
||||||
"--target=${config.platform.target.triple}"
|
|
||||||
"--enable-languages=c,c++"
|
|
||||||
"--disable-bootstrap"
|
|
||||||
"--disable-libsanitizer"
|
|
||||||
"--disable-multilib"
|
|
||||||
"--with-build-sysroot=/"
|
|
||||||
"--with-native-system-header-dir=${libc}/include"
|
|
||||||
]
|
|
||||||
++ lib.lists.when (isBootstrapped) [
|
|
||||||
"--disable-lto"
|
|
||||||
];
|
|
||||||
|
|
||||||
phases =
|
phases =
|
||||||
let
|
let
|
||||||
patches = [
|
host = lib.systems.withBuildInfo config.platform.host;
|
||||||
# Make binutils output deterministic by default.
|
|
||||||
./patches/libstdc++-target.patch
|
mbits = if host.system.cpu.family == "x86" then if host.is64bit then "-m64" else "-m32" else "";
|
||||||
];
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
unpack = ''
|
unpack = ''
|
||||||
|
@ -245,19 +134,33 @@ in
|
||||||
'';
|
'';
|
||||||
|
|
||||||
patch = ''
|
patch = ''
|
||||||
${lib.strings.concatMapSep "\n" (file: "patch -Np1 -i ${file}") patches}
|
# Patch
|
||||||
${lib.strings.when (isBootstrapped && !(crossTool || cross))''
|
|
||||||
# force musl even if host triple is gnu
|
# force musl even if host triple is gnu
|
||||||
sed -i 's|"os/gnu-linux"|"os/generic"|' libstdc++-v3/configure.host
|
sed -i 's|"os/gnu-linux"|"os/generic"|' libstdc++-v3/configure.host
|
||||||
''}
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
configure = ''
|
configure = ''
|
||||||
# Configure
|
# Configure
|
||||||
mkdir build
|
export CC="gcc -Wl,-dynamic-linker -Wl,${foundation.stage1-musl}/lib/libc.so"
|
||||||
cd build
|
export CXX="g++ -Wl,-dynamic-linker -Wl,${foundation.stage1-musl}/lib/libc.so"
|
||||||
|
export CFLAGS_FOR_TARGET="-Wl,-dynamic-linker -Wl,${foundation.stage1-musl}/lib/libc.so"
|
||||||
|
export LIBRARY_PATH="${foundation.stage1-musl}/lib"
|
||||||
|
|
||||||
bash ../configure ${builtins.concatStringsSep " " config.configureFlags}
|
bash ./configure \
|
||||||
|
--prefix=$out \
|
||||||
|
--build=${config.platform.build.triple} \
|
||||||
|
--host=${config.platform.host.triple} \
|
||||||
|
--target=${config.platform.target.triple} \
|
||||||
|
--with-native-system-header-dir=/include \
|
||||||
|
--with-sysroot=${foundation.stage1-musl} \
|
||||||
|
--enable-languages=c,c++ \
|
||||||
|
--disable-bootstrap \
|
||||||
|
--disable-libsanitizer \
|
||||||
|
--disable-lto \
|
||||||
|
--disable-multilib \
|
||||||
|
--disable-plugin \
|
||||||
|
CFLAGS=-static \
|
||||||
|
CXXFLAGS=-static
|
||||||
'';
|
'';
|
||||||
|
|
||||||
build = ''
|
build = ''
|
||||||
|
@ -267,13 +170,7 @@ in
|
||||||
|
|
||||||
install = ''
|
install = ''
|
||||||
# Install
|
# Install
|
||||||
${
|
make -j $NIX_BUILD_CORES install-strip
|
||||||
lib.strings.when (host.is64bit) ''
|
|
||||||
mkdir -p $out/lib
|
|
||||||
ln -s lib $out/lib64
|
|
||||||
''
|
|
||||||
}
|
|
||||||
make -j $NIX_BUILD_CORES install
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,71 +0,0 @@
|
||||||
{ config, options }:
|
|
||||||
let
|
|
||||||
inherit (config)
|
|
||||||
lib
|
|
||||||
packages
|
|
||||||
;
|
|
||||||
in
|
|
||||||
{
|
|
||||||
config.packages.foundation.gcc-newlib = {
|
|
||||||
versions = {
|
|
||||||
"latest" = config.packages.foundation.gcc.versions.latest.extend (
|
|
||||||
{ config }:
|
|
||||||
{
|
|
||||||
config =
|
|
||||||
let
|
|
||||||
programPrefix = lib.strings.when
|
|
||||||
(
|
|
||||||
config.platform.build.triple != config.platform.target.triple
|
|
||||||
) "${config.platform.target.triple}-";
|
|
||||||
in
|
|
||||||
{
|
|
||||||
meta = {
|
|
||||||
platforms = lib.modules.override 0 [
|
|
||||||
"i686-linux"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
deps = {
|
|
||||||
build = {
|
|
||||||
build = {
|
|
||||||
binutils = (
|
|
||||||
packages.foundation.binutils.versions.latest.extend {
|
|
||||||
platform = lib.modules.override 0 config.platform;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
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"
|
|
||||||
"--enable-languages=c,c++"
|
|
||||||
"--disable-bootstrap"
|
|
||||||
"--disable-libsanitizer"
|
|
||||||
"--disable-lto"
|
|
||||||
"--disable-multilib"
|
|
||||||
"--disable-plugin"
|
|
||||||
"--disable-libssp"
|
|
||||||
"--disable-libvtv"
|
|
||||||
"--disable-libstdcxx"
|
|
||||||
"--disable-libquadmath"
|
|
||||||
"--disable-threads"
|
|
||||||
"--disable-decimal-float"
|
|
||||||
"--disable-shared"
|
|
||||||
"--disable-libmudflap"
|
|
||||||
"--disable-libgomp"
|
|
||||||
"--disable-libatomic"
|
|
||||||
"--without-headers"
|
|
||||||
"--with-newlib"
|
|
||||||
];
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,33 +0,0 @@
|
||||||
# From https://github.com/NixOS/nixpkgs/blob/nixos-24.05/pkgs/development/compilers/gcc/patches/libstdc%2B%2B-target.patch
|
|
||||||
Patch to make the target libraries 'configure' scripts find the proper CPP.
|
|
||||||
I noticed that building the mingw32 cross compiler.
|
|
||||||
Looking at the build script for mingw in archlinux, I think that only nixos
|
|
||||||
needs this patch. I don't know why.
|
|
||||||
diff --git a/Makefile.in b/Makefile.in
|
|
||||||
index 93f66b6..d691917 100644
|
|
||||||
--- a/Makefile.in
|
|
||||||
+++ b/Makefile.in
|
|
||||||
@@ -266,6 +266,7 @@ BASE_TARGET_EXPORTS = \
|
|
||||||
AR="$(AR_FOR_TARGET)"; export AR; \
|
|
||||||
AS="$(COMPILER_AS_FOR_TARGET)"; export AS; \
|
|
||||||
CC="$(CC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CC; \
|
|
||||||
+ CPP="$(CC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS -E"; export CC; \
|
|
||||||
CFLAGS="$(CFLAGS_FOR_TARGET)"; export CFLAGS; \
|
|
||||||
CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
|
|
||||||
CPPFLAGS="$(CPPFLAGS_FOR_TARGET)"; export CPPFLAGS; \
|
|
||||||
@@ -291,11 +292,13 @@ BASE_TARGET_EXPORTS = \
|
|
||||||
RAW_CXX_TARGET_EXPORTS = \
|
|
||||||
$(BASE_TARGET_EXPORTS) \
|
|
||||||
CXX_FOR_TARGET="$(RAW_CXX_FOR_TARGET)"; export CXX_FOR_TARGET; \
|
|
||||||
- CXX="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX;
|
|
||||||
+ CXX="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX; \
|
|
||||||
+ CXXCPP="$(RAW_CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS -E"; export CXX;
|
|
||||||
|
|
||||||
NORMAL_TARGET_EXPORTS = \
|
|
||||||
$(BASE_TARGET_EXPORTS) \
|
|
||||||
- CXX="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX;
|
|
||||||
+ CXX="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export CXX; \
|
|
||||||
+ CXXCPP="$(CXX_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS -E"; export CXX;
|
|
||||||
|
|
||||||
# Where to find GMP
|
|
||||||
HOST_GMPLIBS = @gmplibs@
|
|
|
@ -3,7 +3,6 @@
|
||||||
lib',
|
lib',
|
||||||
config,
|
config,
|
||||||
options,
|
options,
|
||||||
packages,
|
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (config)
|
inherit (config)
|
||||||
|
@ -11,7 +10,6 @@ let
|
||||||
builders
|
builders
|
||||||
# These are the upstream foundational packages exported from the Aux Foundation project.
|
# These are the upstream foundational packages exported from the Aux Foundation project.
|
||||||
|
|
||||||
packages
|
|
||||||
foundation
|
foundation
|
||||||
;
|
;
|
||||||
in
|
in
|
||||||
|
@ -28,35 +26,12 @@ in
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config =
|
config = {
|
||||||
let
|
|
||||||
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
|
|
||||||
{
|
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
platforms = [
|
platforms = [ "i686-linux" ];
|
||||||
"i686-linux"
|
|
||||||
"x86_64-linux"
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
pname = "glibc";
|
pname = "gcc";
|
||||||
version = "2.38";
|
version = "2.38";
|
||||||
|
|
||||||
src = builtins.fetchurl {
|
src = builtins.fetchurl {
|
||||||
|
@ -66,39 +41,30 @@ in
|
||||||
|
|
||||||
builder = builders.basic;
|
builder = builders.basic;
|
||||||
|
|
||||||
deps = {
|
|
||||||
build = {
|
|
||||||
host = {
|
|
||||||
linux-headers = (
|
|
||||||
packages.foundation.linux-headers.versions.latest.extend {
|
|
||||||
platform.target = lib.modules.override 0 config.platform.target;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
env = {
|
env = {
|
||||||
PATH =
|
PATH =
|
||||||
let
|
let
|
||||||
gcc =
|
gcc =
|
||||||
if
|
if
|
||||||
isCross
|
config.platform.build.triple == config.platform.host.triple
|
||||||
# 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.
|
# If we're on the same system then we can use the existing GCC instance.
|
||||||
|
then
|
||||||
|
foundation.stage2-gcc
|
||||||
|
# Otherwise we are going to need a cross-compiler.
|
||||||
else
|
else
|
||||||
foundation.stage2-gcc;
|
(meta.extend (args: {
|
||||||
|
config = {
|
||||||
|
platform = {
|
||||||
|
build = config.platform.build.triple;
|
||||||
|
host = config.platform.build.triple;
|
||||||
|
target = lib.modules.override.force config.platform.host.triple;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
})).config.package;
|
||||||
in
|
in
|
||||||
lib.paths.bin [
|
lib.paths.bin [
|
||||||
gcc
|
foundation.stage2-gcc
|
||||||
binutils
|
foundation.stage2-binutils
|
||||||
foundation.stage2-gnumake
|
foundation.stage2-gnumake
|
||||||
foundation.stage2-gnused
|
foundation.stage2-gnused
|
||||||
foundation.stage2-gnugrep
|
foundation.stage2-gnugrep
|
||||||
|
@ -108,15 +74,11 @@ in
|
||||||
foundation.stage2-gnutar
|
foundation.stage2-gnutar
|
||||||
foundation.stage2-gzip
|
foundation.stage2-gzip
|
||||||
foundation.stage2-bzip2
|
foundation.stage2-bzip2
|
||||||
foundation.stage1-python
|
|
||||||
foundation.stage1-bison
|
|
||||||
foundation.stage1-xz
|
foundation.stage1-xz
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
phases =
|
phases = {
|
||||||
|
|
||||||
{
|
|
||||||
unpack = ''
|
unpack = ''
|
||||||
tar xf ${config.src}
|
tar xf ${config.src}
|
||||||
cd glibc-${config.version}
|
cd glibc-${config.version}
|
||||||
|
@ -125,13 +87,13 @@ in
|
||||||
configure = ''
|
configure = ''
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
|
# libstdc++.so is built against musl and fails to link
|
||||||
|
export CXX=false
|
||||||
bash ../configure \
|
bash ../configure \
|
||||||
--prefix=$out \
|
--prefix=$out \
|
||||||
--build=${config.platform.build.triple} \
|
--build=${config.platform.build.triple} \
|
||||||
--host=${config.platform.host.triple} \
|
--host=${config.platform.host.triple} \
|
||||||
--with-headers=${config.deps.build.host.linux-headers.package}/include \
|
--with-headers=${foundation.stage1-linux-headers}/include
|
||||||
--with-binutils=${binutils}/bin
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
build = ''
|
build = ''
|
||||||
|
@ -141,8 +103,7 @@ in
|
||||||
|
|
||||||
install = ''
|
install = ''
|
||||||
# Install
|
# Install
|
||||||
make -j $NIX_BUILD_CORES install
|
make -j $NIX_BUILD_CORES install-strip
|
||||||
ln -sv $(ls -d ${config.deps.build.host.linux-headers.package}/include/* | grep -v scsi\$) $out/include/
|
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
{ lib
|
{
|
||||||
, lib'
|
lib,
|
||||||
, config
|
lib',
|
||||||
, options
|
config,
|
||||||
,
|
options,
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (config)
|
inherit (config)
|
||||||
|
@ -28,7 +28,7 @@ in
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
meta = {
|
meta = {
|
||||||
platforms = [ "x86_64-linux" "i686-linux" ];
|
platforms = [ "i686-linux" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
pname = "linux-headers";
|
pname = "linux-headers";
|
||||||
|
@ -60,7 +60,7 @@ in
|
||||||
'';
|
'';
|
||||||
|
|
||||||
build = ''
|
build = ''
|
||||||
make -j $NIX_BUILD_CORES CC=musl-gcc HOSTCC=musl-gcc ARCH=${config.platform.target.linux.arch} headers
|
make -j $NIX_BUILD_CORES CC=musl-gcc HOSTCC=musl-gcc ARCH=${config.platform.host.linux.arch} headers
|
||||||
'';
|
'';
|
||||||
|
|
||||||
install = ''
|
install = ''
|
||||||
|
|
Loading…
Reference in a new issue