forked from auxolotl/labs
refactor: code cleanup, move sources to separate module
This commit is contained in:
parent
d104903c16
commit
1642b2173b
|
@ -3,7 +3,7 @@
|
||||||
"lib": {
|
"lib": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1,
|
"lastModified": 1,
|
||||||
"narHash": "sha256-303zkU+ntdAF6JLE9gA3k5piX5RvKtQp6JXovZWzDdQ=",
|
"narHash": "sha256-wgO96O9ALMMXtfBKuh9rYo3KIVq4nk8V7Cke4dg0MOk=",
|
||||||
"path": "../lib",
|
"path": "../lib",
|
||||||
"type": "path"
|
"type": "path"
|
||||||
},
|
},
|
||||||
|
|
|
@ -19,8 +19,6 @@
|
||||||
# "aarch64-darwin"
|
# "aarch64-darwin"
|
||||||
];
|
];
|
||||||
in {
|
in {
|
||||||
modules.aux = modules;
|
|
||||||
|
|
||||||
packages = forEachSystem (
|
packages = forEachSystem (
|
||||||
system: let
|
system: let
|
||||||
result = lib.modules.run {
|
result = lib.modules.run {
|
||||||
|
|
35
foundation/src/stages/stage0/architecture/default.nix
Normal file
35
foundation/src/stages/stage0/architecture/default.nix
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
}: let
|
||||||
|
system = config.aux.system;
|
||||||
|
|
||||||
|
architecture =
|
||||||
|
if system == "x86_64-linux"
|
||||||
|
then "AMD64"
|
||||||
|
else if system == "aarch64-linux"
|
||||||
|
then "AArch64"
|
||||||
|
else if system == "i686-linux"
|
||||||
|
then "x86"
|
||||||
|
else builtins.throw "Unsupported system for stage0: ${system}";
|
||||||
|
in {
|
||||||
|
options.aux.foundation.stages.stage0.architecture = {
|
||||||
|
base = lib.options.create {
|
||||||
|
type = lib.types.string;
|
||||||
|
description = "The architecture to use for the source.";
|
||||||
|
default = {
|
||||||
|
value = architecture;
|
||||||
|
text = ''"AMD64" or "AArch64" or "x86"'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
m2libc = lib.options.create {
|
||||||
|
type = lib.types.string;
|
||||||
|
description = "The architecture to use for the M2libc source.";
|
||||||
|
default = {
|
||||||
|
value = lib.strings.lower architecture;
|
||||||
|
text = ''"amd64" or "aarch64" or "x86"'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -17,6 +17,9 @@
|
||||||
else builtins.throw "Unsupported system for stage0: ${system}";
|
else builtins.throw "Unsupported system for stage0: ${system}";
|
||||||
in {
|
in {
|
||||||
includes = [
|
includes = [
|
||||||
|
./sources
|
||||||
|
./architecture
|
||||||
|
|
||||||
./phases/phase00.nix
|
./phases/phase00.nix
|
||||||
./phases/phase01.nix
|
./phases/phase01.nix
|
||||||
./phases/phase02.nix
|
./phases/phase02.nix
|
||||||
|
|
|
@ -3,20 +3,13 @@
|
||||||
config,
|
config,
|
||||||
}: let
|
}: let
|
||||||
cfg = config.aux.foundation.stages.stage0.kaem;
|
cfg = config.aux.foundation.stages.stage0.kaem;
|
||||||
hex0 = config.aux.foundation.stages.stage0.hex0;
|
|
||||||
catm = config.aux.foundation.stages.stage0.catm;
|
|
||||||
M0 = config.aux.foundation.stages.stage0.M0;
|
|
||||||
cc_arch = config.aux.foundation.stages.stage0.cc_arch;
|
|
||||||
M2 = config.aux.foundation.stages.stage0.M2;
|
|
||||||
blood-elf = config.aux.foundation.stages.stage0.blood-elf;
|
|
||||||
M1 = config.aux.foundation.stages.stage0.M1;
|
|
||||||
hex2 = config.aux.foundation.stages.stage0.hex2;
|
|
||||||
kaem-unwrapped = config.aux.foundation.stages.stage0.kaem-unwrapped;
|
|
||||||
mescc-tools = config.aux.foundation.stages.stage0.mescc-tools;
|
|
||||||
mescc-tools-extra = config.aux.foundation.stages.stage0.mescc-tools-extra;
|
|
||||||
|
|
||||||
system = config.aux.system;
|
system = config.aux.system;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
|
||||||
|
kaem-unwrapped = config.aux.foundation.stages.stage0.kaem-unwrapped;
|
||||||
|
mescc-tools = config.aux.foundation.stages.stage0.mescc-tools;
|
||||||
|
mescc-tools-extra = config.aux.foundation.stages.stage0.mescc-tools-extra;
|
||||||
in {
|
in {
|
||||||
options.aux.foundation.stages.stage0.kaem = {
|
options.aux.foundation.stages.stage0.kaem = {
|
||||||
package = lib.options.create {
|
package = lib.options.create {
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
|
|
||||||
system = config.aux.system;
|
system = config.aux.system;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
sources = config.aux.foundation.stages.stage0.sources;
|
||||||
|
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||||
in {
|
in {
|
||||||
options.aux.foundation.stages.stage0.mescc-tools-extra = {
|
options.aux.foundation.stages.stage0.mescc-tools-extra = {
|
||||||
package = lib.options.create {
|
package = lib.options.create {
|
||||||
|
@ -68,10 +70,10 @@ in {
|
||||||
./build.kaem
|
./build.kaem
|
||||||
];
|
];
|
||||||
|
|
||||||
src = hex0.mescc-tools-extra.src;
|
src = sources.mescc-tools-extra;
|
||||||
|
|
||||||
m2libcOS = "linux";
|
m2libcOS = "linux";
|
||||||
m2libcArch = hex0.m2libc.architecture;
|
m2libcArch = architecture.m2libc;
|
||||||
mesccTools = mescc-tools.package;
|
mesccTools = mescc-tools.package;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
|
|
||||||
system = config.aux.system;
|
system = config.aux.system;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
sources = config.aux.foundation.stages.stage0.sources;
|
||||||
|
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||||
|
|
||||||
bloodFlag =
|
bloodFlag =
|
||||||
if config.aux.platform.bits == 64
|
if config.aux.platform.bits == 64
|
||||||
|
@ -35,13 +37,13 @@
|
||||||
|
|
||||||
getExtraUtil = name: let
|
getExtraUtil = name: let
|
||||||
script = builtins.toFile "build-${name}.kaem" ''
|
script = builtins.toFile "build-${name}.kaem" ''
|
||||||
''${M2} --architecture ${hex0.m2libc.architecture} \
|
''${M2} --architecture ${architecture.m2libc} \
|
||||||
-f ''${m2libc}/sys/types.h \
|
-f ''${m2libc}/sys/types.h \
|
||||||
-f ''${m2libc}/stddef.h \
|
-f ''${m2libc}/stddef.h \
|
||||||
-f ''${m2libc}/${hex0.m2libc.architecture}/linux/fcntl.c \
|
-f ''${m2libc}/${architecture.m2libc}/linux/fcntl.c \
|
||||||
-f ''${m2libc}/fcntl.c \
|
-f ''${m2libc}/fcntl.c \
|
||||||
-f ''${m2libc}/${hex0.m2libc.architecture}/linux/unistd.c \
|
-f ''${m2libc}/${architecture.m2libc}/linux/unistd.c \
|
||||||
-f ''${m2libc}/${hex0.m2libc.architecture}/linux/sys/stat.c \
|
-f ''${m2libc}/${architecture.m2libc}/linux/sys/stat.c \
|
||||||
-f ''${m2libc}/stdlib.c \
|
-f ''${m2libc}/stdlib.c \
|
||||||
-f ''${m2libc}/stdio.h \
|
-f ''${m2libc}/stdio.h \
|
||||||
-f ''${m2libc}/stdio.c \
|
-f ''${m2libc}/stdio.c \
|
||||||
|
@ -53,17 +55,17 @@
|
||||||
|
|
||||||
''${blood-elf-0} ${endianFlag} ${bloodFlag} -f ${name}.M1 -o ${name}-footer.M1
|
''${blood-elf-0} ${endianFlag} ${bloodFlag} -f ${name}.M1 -o ${name}-footer.M1
|
||||||
|
|
||||||
''${M1} --architecture ${hex0.m2libc.architecture} \
|
''${M1} --architecture ${architecture.m2libc} \
|
||||||
${endianFlag} \
|
${endianFlag} \
|
||||||
-f ''${m2libc}/${hex0.m2libc.architecture}/${hex0.m2libc.architecture}_defs.M1 \
|
-f ''${m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1 \
|
||||||
-f ''${m2libc}/${hex0.m2libc.architecture}/libc-full.M1 \
|
-f ''${m2libc}/${architecture.m2libc}/libc-full.M1 \
|
||||||
-f ${name}.M1 \
|
-f ${name}.M1 \
|
||||||
-f ${name}-footer.M1 \
|
-f ${name}-footer.M1 \
|
||||||
-o ${name}.hex2
|
-o ${name}.hex2
|
||||||
|
|
||||||
''${hex2} --architecture ${hex0.m2libc.architecture} \
|
''${hex2} --architecture ${architecture.m2libc} \
|
||||||
${endianFlag} \
|
${endianFlag} \
|
||||||
-f ''${m2libc}/${hex0.m2libc.architecture}/ELF-${hex0.m2libc.architecture}-debug.hex2 \
|
-f ''${m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}-debug.hex2 \
|
||||||
-f ${name}.hex2 \
|
-f ${name}.hex2 \
|
||||||
--base-address ${baseAddress} \
|
--base-address ${baseAddress} \
|
||||||
-o ''${out}
|
-o ''${out}
|
||||||
|
@ -85,16 +87,18 @@
|
||||||
script
|
script
|
||||||
];
|
];
|
||||||
|
|
||||||
src = hex0.src;
|
src = sources.base;
|
||||||
|
|
||||||
M1 = M1.package;
|
M1 = M1.package;
|
||||||
M2 = M2.package;
|
M2 = M2.package;
|
||||||
blood-elf-0 = blood-elf.package;
|
blood-elf-0 = blood-elf.package;
|
||||||
hex2 = hex2.package;
|
hex2 = hex2.package;
|
||||||
m2libc = hex0.m2libc.src;
|
|
||||||
m2planet = hex0.m2planet.src;
|
m2libc = sources.m2libc;
|
||||||
m2mesoplanet = hex0.m2mesoplanet.src;
|
m2planet = sources.m2planet;
|
||||||
mesccTools = hex0.mescc-tools.src;
|
m2mesoplanet = sources.m2mesoplanet;
|
||||||
mesccToolsExtra = hex0.mescc-tools-extra.src;
|
mesccTools = sources.mescc-tools;
|
||||||
|
mesccToolsExtra = sources.mescc-tools-extra;
|
||||||
|
|
||||||
bloodFlag = bloodFlag;
|
bloodFlag = bloodFlag;
|
||||||
endianFlag = endianFlag;
|
endianFlag = endianFlag;
|
||||||
|
@ -157,12 +161,12 @@ in {
|
||||||
blood-elf-0 = blood-elf.package;
|
blood-elf-0 = blood-elf.package;
|
||||||
hex2 = hex2.package;
|
hex2 = hex2.package;
|
||||||
|
|
||||||
m2libc = hex0.m2libc.src;
|
m2libc = sources.m2libc;
|
||||||
m2libcArch = hex0.m2libc.architecture;
|
m2libcArch = architecture.m2libc;
|
||||||
m2planet = hex0.m2planet.src;
|
m2planet = sources.m2planet;
|
||||||
m2mesoplanet = hex0.m2mesoplanet.src;
|
m2mesoplanet = sources.m2mesoplanet;
|
||||||
mesccTools = hex0.mescc-tools.src;
|
mesccTools = sources.mescc-tools;
|
||||||
mesccToolsExtra = hex0.mescc-tools-extra.src;
|
mesccToolsExtra = sources.mescc-tools-extra;
|
||||||
|
|
||||||
bloodFlag = bloodFlag;
|
bloodFlag = bloodFlag;
|
||||||
endianFlag = endianFlag;
|
endianFlag = endianFlag;
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
system = config.aux.system;
|
system = config.aux.system;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
sources = config.aux.foundation.stages.stage0.sources;
|
||||||
|
|
||||||
architecture =
|
architecture =
|
||||||
if system == "x86_64-linux"
|
if system == "x86_64-linux"
|
||||||
|
@ -61,64 +62,6 @@ in {
|
||||||
type = lib.types.package;
|
type = lib.types.package;
|
||||||
description = "The derivation to use to build hex0.";
|
description = "The derivation to use to build hex0.";
|
||||||
};
|
};
|
||||||
|
|
||||||
src = lib.options.create {
|
|
||||||
type = lib.types.string;
|
|
||||||
description = "The source for the hex0 build files.";
|
|
||||||
};
|
|
||||||
|
|
||||||
m2libc = {
|
|
||||||
src = lib.options.create {
|
|
||||||
type = lib.types.string;
|
|
||||||
description = "The source for the M2libc build files.";
|
|
||||||
};
|
|
||||||
|
|
||||||
architecture = lib.options.create {
|
|
||||||
type = lib.types.string;
|
|
||||||
description = "The architecture to use for the M2libc source.";
|
|
||||||
default = {
|
|
||||||
value = lib.strings.lower architecture;
|
|
||||||
text = ''"amd64" or "aarch64" or "x86"'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
m2planet = {
|
|
||||||
src = lib.options.create {
|
|
||||||
type = lib.types.string;
|
|
||||||
description = "The source for the M2-Planet build files.";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
m2mesoplanet = {
|
|
||||||
src = lib.options.create {
|
|
||||||
type = lib.types.string;
|
|
||||||
description = "The source for the M2-MesoPlanet build files.";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
mescc-tools = {
|
|
||||||
src = lib.options.create {
|
|
||||||
type = lib.types.string;
|
|
||||||
description = "The source for the mescc-tools build files.";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
mescc-tools-extra = {
|
|
||||||
src = lib.options.create {
|
|
||||||
type = lib.types.string;
|
|
||||||
description = "The source for the mescc-tools-extra build files.";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
architecture = lib.options.create {
|
|
||||||
type = lib.types.string;
|
|
||||||
description = "The architecture to use for the source.";
|
|
||||||
default = {
|
|
||||||
value = architecture;
|
|
||||||
text = ''"AMD64" or "AArch64" or "x86"'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
|
@ -132,7 +75,7 @@ in {
|
||||||
executable = cfg.executable;
|
executable = cfg.executable;
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
"${cfg.src}/hex0_${architecture}.hex0"
|
"${sources.base}/hex0_${architecture}.hex0"
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -157,67 +100,6 @@ in {
|
||||||
executable = true;
|
executable = true;
|
||||||
hash = cfg.hash;
|
hash = cfg.hash;
|
||||||
});
|
});
|
||||||
|
|
||||||
# All sources are combined a central repository via submodules. Due to potential quirks surrounding
|
|
||||||
# fetching that, we are instead fetching each submodule directly. The central repository is located
|
|
||||||
# here: https://github.com/oriansj/stage0-posix
|
|
||||||
src =
|
|
||||||
if architecture == "AMD64"
|
|
||||||
then
|
|
||||||
builtins.fetchTarball {
|
|
||||||
url = "https://github.com/oriansj/stage0-posix-amd64/archive/93fbe4c08772d8df1412e2554668e24cf604088c.tar.gz";
|
|
||||||
sha256 = "10d1xnjzqplpfip3pm89bydd501x1bcgkg7lkkadyq5bqpad5flp";
|
|
||||||
}
|
|
||||||
else if architecture == "AArch64"
|
|
||||||
then
|
|
||||||
# FIXME: We may need to patch the aarch64 variant.
|
|
||||||
# https://github.com/oriansj/M2libc/pull/17
|
|
||||||
builtins.fetchTarball {
|
|
||||||
url = "https://github.com/oriansj/stage0-posix-aarch64/archive/39a43f803d572b53f95d42507202152eeda18361.tar.gz";
|
|
||||||
sha256 = "1x607hr3n5j89394d156r23igpx8hifjd14ygksx7902rlwrrry2";
|
|
||||||
}
|
|
||||||
else if architecture == "x86"
|
|
||||||
then
|
|
||||||
builtins.fetchTarball {
|
|
||||||
url = "https://github.com/oriansj/stage0-posix-x86/archive/e86bf7d304bae5ce5ccc88454bb60cf0837e941f.tar.gz";
|
|
||||||
sha256 = "1c1fk793yzq8zbg60n2zd22fsmirc3zr26fj0iskap456g84nxv8";
|
|
||||||
}
|
|
||||||
else builtins.throw "Unsupported architecture for stage0: ${architecture}";
|
|
||||||
|
|
||||||
m2libc = {
|
|
||||||
src = builtins.fetchTarball {
|
|
||||||
url = "https://github.com/oriansj/M2libc/archive/de7c75f144176c3b9be77695d9bf94440445aeae.tar.gz";
|
|
||||||
sha256 = "01k81zn8yx4jg6fbcjgkrf9rp074yikkmwqykdgi9143yfb2k3yv";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
m2planet = {
|
|
||||||
src = builtins.fetchTarball {
|
|
||||||
url = "https://github.com/oriansj/M2-Planet/archive/51dc63b349ca13fa57b345964254cf26930c0a7d.tar.gz";
|
|
||||||
sha256 = "1kksk260dh6qd0dzgl9vgs67fs0lsxs9w0gniy0ii5fgmqxi8p65";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
m2mesoplanet = {
|
|
||||||
src = builtins.fetchTarball {
|
|
||||||
url = "https://github.com/oriansj/M2-Mesoplanet/archive/c80645f06b035debaa08e95da3206346a9f61b97.tar.gz";
|
|
||||||
sha256 = "02vzqln38ylfnd88p87935yf26i60gkbv93ns5j7parqgyyz2kl4";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
mescc-tools = {
|
|
||||||
src = builtins.fetchTarball {
|
|
||||||
url = "https://github.com/oriansj/mescc-tools/archive/5d37991e22d1e4147411a766f4410508ba872962.tar.gz";
|
|
||||||
sha256 = "1xgpqhc5diim3rr9a00939976svrbhfp4v5970548a137fdynl4c";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
mescc-tools-extra = {
|
|
||||||
src = builtins.fetchTarball {
|
|
||||||
url = "https://github.com/oriansj/mescc-tools-extra/archive/c1bd4ab4c5b994d8167c1e6dfc14050dc151a911.tar.gz";
|
|
||||||
sha256 = "0v8vxn3a8rxbgi6vcw73jqkw9j5vg3qlvd4sxk2w0fpybjml8brd";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
|
|
||||||
system = config.aux.system;
|
system = config.aux.system;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
sources = config.aux.foundation.stages.stage0.sources;
|
||||||
|
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||||
in {
|
in {
|
||||||
options.aux.foundation.stages.stage0.hex1 = {
|
options.aux.foundation.stages.stage0.hex1 = {
|
||||||
package = lib.options.create {
|
package = lib.options.create {
|
||||||
|
@ -53,7 +55,7 @@ in {
|
||||||
executable = hex0.package;
|
executable = hex0.package;
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
"${hex0.src}/hex1_${hex0.architecture}.hex0"
|
"${sources.base}/hex1_${architecture.base}.hex0"
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,6 +8,8 @@
|
||||||
|
|
||||||
system = config.aux.system;
|
system = config.aux.system;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
sources = config.aux.foundation.stages.stage0.sources;
|
||||||
|
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||||
in {
|
in {
|
||||||
options.aux.foundation.stages.stage0.hex2-0 = {
|
options.aux.foundation.stages.stage0.hex2-0 = {
|
||||||
package = lib.options.create {
|
package = lib.options.create {
|
||||||
|
@ -54,7 +56,7 @@ in {
|
||||||
executable = hex1.package;
|
executable = hex1.package;
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
"${hex0.src}/hex2_${hex0.architecture}.hex1"
|
"${sources.base}/hex2_${architecture.base}.hex1"
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
system = config.aux.system;
|
system = config.aux.system;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
sources = config.aux.foundation.stages.stage0.sources;
|
||||||
|
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||||
in {
|
in {
|
||||||
options.aux.foundation.stages.stage0.catm = {
|
options.aux.foundation.stages.stage0.catm = {
|
||||||
package = lib.options.create {
|
package = lib.options.create {
|
||||||
|
@ -53,18 +55,18 @@ in {
|
||||||
meta = cfg.meta;
|
meta = cfg.meta;
|
||||||
|
|
||||||
executable =
|
executable =
|
||||||
if hex0.architecture == "AArch64"
|
if architecture.base == "AArch64"
|
||||||
then hex1.package
|
then hex1.package
|
||||||
else hex2-0.package;
|
else hex2-0.package;
|
||||||
|
|
||||||
args =
|
args =
|
||||||
if hex0.architecture == "AArch64"
|
if architecture.base == "AArch64"
|
||||||
then [
|
then [
|
||||||
"${hex0.src}/catm_${hex0.architecture}.hex1"
|
"${sources.base}/catm_${architecture.base}.hex1"
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
]
|
]
|
||||||
else [
|
else [
|
||||||
"${hex0.src}/catm_${hex0.architecture}.hex2"
|
"${sources.base}/catm_${architecture.base}.hex2"
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
system = config.aux.system;
|
system = config.aux.system;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
sources = config.aux.foundation.stages.stage0.sources;
|
||||||
|
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||||
in {
|
in {
|
||||||
options.aux.foundation.stages.stage0.M0 = {
|
options.aux.foundation.stages.stage0.M0 = {
|
||||||
package = lib.options.create {
|
package = lib.options.create {
|
||||||
|
@ -65,8 +67,8 @@ in {
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/ELF-${hex0.m2libc.architecture}.hex2"
|
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}.hex2"
|
||||||
"${hex0.src}/M0_${hex0.architecture}.hex2"
|
"${sources.base}/M0_${architecture.base}.hex2"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
in [
|
in [
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
|
|
||||||
system = config.aux.system;
|
system = config.aux.system;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
sources = config.aux.foundation.stages.stage0.sources;
|
||||||
|
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||||
in {
|
in {
|
||||||
options.aux.foundation.stages.stage0.cc_arch = {
|
options.aux.foundation.stages.stage0.cc_arch = {
|
||||||
package = lib.options.create {
|
package = lib.options.create {
|
||||||
|
@ -65,7 +67,7 @@ in {
|
||||||
executable = M0.package;
|
executable = M0.package;
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
"${hex0.src}/cc_${hex0.m2libc.architecture}.M1"
|
"${sources.base}/cc_${architecture.m2libc}.M1"
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
@ -79,7 +81,7 @@ in {
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/ELF-${hex0.m2libc.architecture}.hex2"
|
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}.hex2"
|
||||||
cc_arch0_hex2-0
|
cc_arch0_hex2-0
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
|
|
||||||
system = config.aux.system;
|
system = config.aux.system;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
sources = config.aux.foundation.stages.stage0.sources;
|
||||||
|
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||||
in {
|
in {
|
||||||
options.aux.foundation.stages.stage0.M2 = {
|
options.aux.foundation.stages.stage0.M2 = {
|
||||||
package = lib.options.create {
|
package = lib.options.create {
|
||||||
|
@ -67,16 +69,16 @@ in {
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/linux/bootstrap.c"
|
"${sources.m2libc}/${architecture.m2libc}/linux/bootstrap.c"
|
||||||
"${hex0.m2planet.src}/cc.h"
|
"${sources.m2planet}/cc.h"
|
||||||
"${hex0.m2libc.src}/bootstrappable.c"
|
"${sources.m2libc}/bootstrappable.c"
|
||||||
"${hex0.m2planet.src}/cc_globals.c"
|
"${sources.m2planet}/cc_globals.c"
|
||||||
"${hex0.m2planet.src}/cc_reader.c"
|
"${sources.m2planet}/cc_reader.c"
|
||||||
"${hex0.m2planet.src}/cc_strings.c"
|
"${sources.m2planet}/cc_strings.c"
|
||||||
"${hex0.m2planet.src}/cc_types.c"
|
"${sources.m2planet}/cc_types.c"
|
||||||
"${hex0.m2planet.src}/cc_core.c"
|
"${sources.m2planet}/cc_core.c"
|
||||||
"${hex0.m2planet.src}/cc_macro.c"
|
"${sources.m2planet}/cc_macro.c"
|
||||||
"${hex0.m2planet.src}/cc.c"
|
"${sources.m2planet}/cc.c"
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
M2_M1 = builders.raw.build {
|
M2_M1 = builders.raw.build {
|
||||||
|
@ -102,8 +104,8 @@ in {
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/${hex0.m2libc.architecture}_defs.M1"
|
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/libc-core.M1"
|
"${sources.m2libc}/${architecture.m2libc}/libc-core.M1"
|
||||||
M2_M1
|
M2_M1
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
@ -130,7 +132,7 @@ in {
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/ELF-${hex0.m2libc.architecture}.hex2"
|
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}.hex2"
|
||||||
M2_hex2-0
|
M2_hex2-0
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
|
|
||||||
system = config.aux.system;
|
system = config.aux.system;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
sources = config.aux.foundation.stages.stage0.sources;
|
||||||
|
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||||
in {
|
in {
|
||||||
options.aux.foundation.stages.stage0.blood-elf = {
|
options.aux.foundation.stages.stage0.blood-elf = {
|
||||||
package = lib.options.create {
|
package = lib.options.create {
|
||||||
|
@ -68,15 +70,15 @@ in {
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
"--architecture"
|
"--architecture"
|
||||||
hex0.m2libc.architecture
|
architecture.m2libc
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/linux/bootstrap.c"
|
"${sources.m2libc}/${architecture.m2libc}/linux/bootstrap.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/bootstrappable.c"
|
"${sources.m2libc}/bootstrappable.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.mescc-tools.src}/stringify.c"
|
"${sources.mescc-tools}/stringify.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.mescc-tools.src}/blood-elf.c"
|
"${sources.mescc-tools}/blood-elf.c"
|
||||||
"--bootstrap-mode"
|
"--bootstrap-mode"
|
||||||
"-o"
|
"-o"
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
|
@ -92,8 +94,8 @@ in {
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/${hex0.m2libc.architecture}_defs.M1"
|
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/libc-core.M1"
|
"${sources.m2libc}/${architecture.m2libc}/libc-core.M1"
|
||||||
blood-elf_M1
|
blood-elf_M1
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
@ -120,7 +122,7 @@ in {
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/ELF-${hex0.m2libc.architecture}.hex2"
|
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}.hex2"
|
||||||
blood-elf_hex2-0
|
blood-elf_hex2-0
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
|
|
||||||
system = config.aux.system;
|
system = config.aux.system;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
sources = config.aux.foundation.stages.stage0.sources;
|
||||||
|
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||||
in {
|
in {
|
||||||
options.aux.foundation.stages.stage0.M1-0 = {
|
options.aux.foundation.stages.stage0.M1-0 = {
|
||||||
package = lib.options.create {
|
package = lib.options.create {
|
||||||
|
@ -69,15 +71,15 @@ in {
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
"--architecture"
|
"--architecture"
|
||||||
hex0.m2libc.architecture
|
architecture.m2libc
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/linux/bootstrap.c"
|
"${sources.m2libc}/${architecture.m2libc}/linux/bootstrap.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/bootstrappable.c"
|
"${sources.m2libc}/bootstrappable.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.mescc-tools.src}/stringify.c"
|
"${sources.mescc-tools}/stringify.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.mescc-tools.src}/M1-macro.c"
|
"${sources.mescc-tools}/M1-macro.c"
|
||||||
"--bootstrap-mode"
|
"--bootstrap-mode"
|
||||||
"--debug"
|
"--debug"
|
||||||
"-o"
|
"-o"
|
||||||
|
@ -116,8 +118,8 @@ in {
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/${hex0.m2libc.architecture}_defs.M1"
|
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/libc-core.M1"
|
"${sources.m2libc}/${architecture.m2libc}/libc-core.M1"
|
||||||
M1-macro-0_M1
|
M1-macro-0_M1
|
||||||
M1-macro-0-footer_M1
|
M1-macro-0-footer_M1
|
||||||
];
|
];
|
||||||
|
@ -145,7 +147,7 @@ in {
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/ELF-${hex0.m2libc.architecture}-debug.hex2"
|
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}-debug.hex2"
|
||||||
M1-macro-0_hex2-0
|
M1-macro-0_hex2-0
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
|
|
||||||
system = config.aux.system;
|
system = config.aux.system;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
sources = config.aux.foundation.stages.stage0.sources;
|
||||||
|
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||||
in {
|
in {
|
||||||
options.aux.foundation.stages.stage0.hex2-1 = {
|
options.aux.foundation.stages.stage0.hex2-1 = {
|
||||||
package = lib.options.create {
|
package = lib.options.create {
|
||||||
|
@ -70,35 +72,35 @@ in {
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
"--architecture"
|
"--architecture"
|
||||||
hex0.m2libc.architecture
|
architecture.m2libc
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/sys/types.h"
|
"${sources.m2libc}/sys/types.h"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/stddef.h"
|
"${sources.m2libc}/stddef.h"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/linux/unistd.c"
|
"${sources.m2libc}/${architecture.m2libc}/linux/unistd.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/linux/fcntl.c"
|
"${sources.m2libc}/${architecture.m2libc}/linux/fcntl.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/fcntl.c"
|
"${sources.m2libc}/fcntl.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/linux/sys/stat.c"
|
"${sources.m2libc}/${architecture.m2libc}/linux/sys/stat.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/stdlib.c"
|
"${sources.m2libc}/stdlib.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/stdio.h"
|
"${sources.m2libc}/stdio.h"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/stdio.c"
|
"${sources.m2libc}/stdio.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/bootstrappable.c"
|
"${sources.m2libc}/bootstrappable.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.mescc-tools.src}/hex2.h"
|
"${sources.mescc-tools}/hex2.h"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.mescc-tools.src}/hex2_linker.c"
|
"${sources.mescc-tools}/hex2_linker.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.mescc-tools.src}/hex2_word.c"
|
"${sources.mescc-tools}/hex2_word.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.mescc-tools.src}/hex2.c"
|
"${sources.mescc-tools}/hex2.c"
|
||||||
"--debug"
|
"--debug"
|
||||||
"-o"
|
"-o"
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
|
@ -136,16 +138,16 @@ in {
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
"--architecture"
|
"--architecture"
|
||||||
hex0.m2libc.architecture
|
architecture.m2libc
|
||||||
(
|
(
|
||||||
if config.aux.platform.endian == "little"
|
if config.aux.platform.endian == "little"
|
||||||
then "--little-endian"
|
then "--little-endian"
|
||||||
else "--big-endian"
|
else "--big-endian"
|
||||||
)
|
)
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/${hex0.m2libc.architecture}_defs.M1"
|
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/libc-full.M1"
|
"${sources.m2libc}/${architecture.m2libc}/libc-full.M1"
|
||||||
"-f"
|
"-f"
|
||||||
hex2_linker_M1
|
hex2_linker_M1
|
||||||
"-f"
|
"-f"
|
||||||
|
@ -164,7 +166,7 @@ in {
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/ELF-${hex0.m2libc.architecture}-debug.hex2"
|
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}-debug.hex2"
|
||||||
hex2_linker_hex2
|
hex2_linker_hex2
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
|
|
||||||
system = config.aux.system;
|
system = config.aux.system;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
sources = config.aux.foundation.stages.stage0.sources;
|
||||||
|
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||||
in {
|
in {
|
||||||
options.aux.foundation.stages.stage0.M1 = {
|
options.aux.foundation.stages.stage0.M1 = {
|
||||||
package = lib.options.create {
|
package = lib.options.create {
|
||||||
|
@ -71,33 +73,33 @@ in {
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
"--architecture"
|
"--architecture"
|
||||||
hex0.m2libc.architecture
|
architecture.m2libc
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/sys/types.h"
|
"${sources.m2libc}/sys/types.h"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/stddef.h"
|
"${sources.m2libc}/stddef.h"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/linux/unistd.c"
|
"${sources.m2libc}/${architecture.m2libc}/linux/unistd.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/linux/fcntl.c"
|
"${sources.m2libc}/${architecture.m2libc}/linux/fcntl.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/fcntl.c"
|
"${sources.m2libc}/fcntl.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/linux/sys/stat.c"
|
"${sources.m2libc}/${architecture.m2libc}/linux/sys/stat.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/string.c"
|
"${sources.m2libc}/string.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/stdlib.c"
|
"${sources.m2libc}/stdlib.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/stdio.h"
|
"${sources.m2libc}/stdio.h"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/stdio.c"
|
"${sources.m2libc}/stdio.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/bootstrappable.c"
|
"${sources.m2libc}/bootstrappable.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.mescc-tools.src}/stringify.c"
|
"${sources.mescc-tools}/stringify.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.mescc-tools.src}/M1-macro.c"
|
"${sources.mescc-tools}/M1-macro.c"
|
||||||
"--debug"
|
"--debug"
|
||||||
"-o"
|
"-o"
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
|
@ -135,16 +137,16 @@ in {
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
"--architecture"
|
"--architecture"
|
||||||
hex0.m2libc.architecture
|
architecture.m2libc
|
||||||
(
|
(
|
||||||
if config.aux.platform.endian == "little"
|
if config.aux.platform.endian == "little"
|
||||||
then "--little-endian"
|
then "--little-endian"
|
||||||
else "--big-endian"
|
else "--big-endian"
|
||||||
)
|
)
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/${hex0.m2libc.architecture}_defs.M1"
|
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/libc-full.M1"
|
"${sources.m2libc}/${architecture.m2libc}/libc-full.M1"
|
||||||
"-f"
|
"-f"
|
||||||
M1-macro_M1
|
M1-macro_M1
|
||||||
"-f"
|
"-f"
|
||||||
|
@ -155,7 +157,7 @@ in {
|
||||||
};
|
};
|
||||||
in [
|
in [
|
||||||
"--architecture"
|
"--architecture"
|
||||||
hex0.m2libc.architecture
|
architecture.m2libc
|
||||||
(
|
(
|
||||||
if config.aux.platform.endian == "little"
|
if config.aux.platform.endian == "little"
|
||||||
then "--little-endian"
|
then "--little-endian"
|
||||||
|
@ -172,7 +174,7 @@ in {
|
||||||
else builtins.throw "Unsupported system: ${config.aux.system}"
|
else builtins.throw "Unsupported system: ${config.aux.system}"
|
||||||
)
|
)
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/ELF-${hex0.m2libc.architecture}-debug.hex2"
|
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}-debug.hex2"
|
||||||
"-f"
|
"-f"
|
||||||
M1-macro_hex2
|
M1-macro_hex2
|
||||||
"-o"
|
"-o"
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
|
|
||||||
system = config.aux.system;
|
system = config.aux.system;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
sources = config.aux.foundation.stages.stage0.sources;
|
||||||
|
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||||
in {
|
in {
|
||||||
options.aux.foundation.stages.stage0.hex2 = {
|
options.aux.foundation.stages.stage0.hex2 = {
|
||||||
package = lib.options.create {
|
package = lib.options.create {
|
||||||
|
@ -70,35 +72,35 @@ in {
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
"--architecture"
|
"--architecture"
|
||||||
hex0.m2libc.architecture
|
architecture.m2libc
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/sys/types.h"
|
"${sources.m2libc}/sys/types.h"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/stddef.h"
|
"${sources.m2libc}/stddef.h"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/linux/unistd.c"
|
"${sources.m2libc}/${architecture.m2libc}/linux/unistd.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/linux/fcntl.c"
|
"${sources.m2libc}/${architecture.m2libc}/linux/fcntl.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/fcntl.c"
|
"${sources.m2libc}/fcntl.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/linux/sys/stat.c"
|
"${sources.m2libc}/${architecture.m2libc}/linux/sys/stat.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/stdlib.c"
|
"${sources.m2libc}/stdlib.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/stdio.h"
|
"${sources.m2libc}/stdio.h"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/stdio.c"
|
"${sources.m2libc}/stdio.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/bootstrappable.c"
|
"${sources.m2libc}/bootstrappable.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.mescc-tools.src}/hex2.h"
|
"${sources.mescc-tools}/hex2.h"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.mescc-tools.src}/hex2_linker.c"
|
"${sources.mescc-tools}/hex2_linker.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.mescc-tools.src}/hex2_word.c"
|
"${sources.mescc-tools}/hex2_word.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.mescc-tools.src}/hex2.c"
|
"${sources.mescc-tools}/hex2.c"
|
||||||
"--debug"
|
"--debug"
|
||||||
"-o"
|
"-o"
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
|
@ -135,16 +137,16 @@ in {
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
"--architecture"
|
"--architecture"
|
||||||
hex0.m2libc.architecture
|
architecture.m2libc
|
||||||
(
|
(
|
||||||
if config.aux.platform.endian == "little"
|
if config.aux.platform.endian == "little"
|
||||||
then "--little-endian"
|
then "--little-endian"
|
||||||
else "--big-endian"
|
else "--big-endian"
|
||||||
)
|
)
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/${hex0.m2libc.architecture}_defs.M1"
|
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/libc-full.M1"
|
"${sources.m2libc}/${architecture.m2libc}/libc-full.M1"
|
||||||
"-f"
|
"-f"
|
||||||
hex2_linker_M1
|
hex2_linker_M1
|
||||||
"-f"
|
"-f"
|
||||||
|
@ -155,7 +157,7 @@ in {
|
||||||
};
|
};
|
||||||
in [
|
in [
|
||||||
"--architecture"
|
"--architecture"
|
||||||
hex0.m2libc.architecture
|
architecture.m2libc
|
||||||
(
|
(
|
||||||
if config.aux.platform.endian == "little"
|
if config.aux.platform.endian == "little"
|
||||||
then "--little-endian"
|
then "--little-endian"
|
||||||
|
@ -172,7 +174,7 @@ in {
|
||||||
else builtins.throw "Unsupported system: ${config.aux.system}"
|
else builtins.throw "Unsupported system: ${config.aux.system}"
|
||||||
)
|
)
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/ELF-${hex0.m2libc.architecture}-debug.hex2"
|
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}-debug.hex2"
|
||||||
"-f"
|
"-f"
|
||||||
hex2_linker_hex2
|
hex2_linker_hex2
|
||||||
"-o"
|
"-o"
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
|
|
||||||
system = config.aux.system;
|
system = config.aux.system;
|
||||||
builders = config.aux.foundation.builders;
|
builders = config.aux.foundation.builders;
|
||||||
|
sources = config.aux.foundation.stages.stage0.sources;
|
||||||
|
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||||
in {
|
in {
|
||||||
options.aux.foundation.stages.stage0.kaem-unwrapped = {
|
options.aux.foundation.stages.stage0.kaem-unwrapped = {
|
||||||
package = lib.options.create {
|
package = lib.options.create {
|
||||||
|
@ -70,37 +72,37 @@ in {
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
"--architecture"
|
"--architecture"
|
||||||
hex0.m2libc.architecture
|
architecture.m2libc
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/sys/types.h"
|
"${sources.m2libc}/sys/types.h"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/stddef.h"
|
"${sources.m2libc}/stddef.h"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/linux/unistd.c"
|
"${sources.m2libc}/${architecture.m2libc}/linux/unistd.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/linux/fcntl.c"
|
"${sources.m2libc}/${architecture.m2libc}/linux/fcntl.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/fcntl.c"
|
"${sources.m2libc}/fcntl.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/linux/sys/stat.c"
|
"${sources.m2libc}/${architecture.m2libc}/linux/sys/stat.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/string.c"
|
"${sources.m2libc}/string.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/stdlib.c"
|
"${sources.m2libc}/stdlib.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/stdio.h"
|
"${sources.m2libc}/stdio.h"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/stdio.c"
|
"${sources.m2libc}/stdio.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/bootstrappable.c"
|
"${sources.m2libc}/bootstrappable.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.mescc-tools.src}/Kaem/kaem.h"
|
"${sources.mescc-tools}/Kaem/kaem.h"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.mescc-tools.src}/Kaem/variable.c"
|
"${sources.mescc-tools}/Kaem/variable.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.mescc-tools.src}/Kaem/kaem_globals.c"
|
"${sources.mescc-tools}/Kaem/kaem_globals.c"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.mescc-tools.src}/Kaem/kaem.c"
|
"${sources.mescc-tools}/Kaem/kaem.c"
|
||||||
"--debug"
|
"--debug"
|
||||||
"-o"
|
"-o"
|
||||||
(builtins.placeholder "out")
|
(builtins.placeholder "out")
|
||||||
|
@ -137,16 +139,16 @@ in {
|
||||||
|
|
||||||
args = [
|
args = [
|
||||||
"--architecture"
|
"--architecture"
|
||||||
hex0.m2libc.architecture
|
architecture.m2libc
|
||||||
(
|
(
|
||||||
if config.aux.platform.endian == "little"
|
if config.aux.platform.endian == "little"
|
||||||
then "--little-endian"
|
then "--little-endian"
|
||||||
else "--big-endian"
|
else "--big-endian"
|
||||||
)
|
)
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/${hex0.m2libc.architecture}_defs.M1"
|
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/libc-full.M1"
|
"${sources.m2libc}/${architecture.m2libc}/libc-full.M1"
|
||||||
"-f"
|
"-f"
|
||||||
kaem_M1
|
kaem_M1
|
||||||
"-f"
|
"-f"
|
||||||
|
@ -157,7 +159,7 @@ in {
|
||||||
};
|
};
|
||||||
in [
|
in [
|
||||||
"--architecture"
|
"--architecture"
|
||||||
hex0.m2libc.architecture
|
architecture.m2libc
|
||||||
(
|
(
|
||||||
if config.aux.platform.endian == "little"
|
if config.aux.platform.endian == "little"
|
||||||
then "--little-endian"
|
then "--little-endian"
|
||||||
|
@ -174,7 +176,7 @@ in {
|
||||||
else builtins.throw "Unsupported system: ${config.aux.system}"
|
else builtins.throw "Unsupported system: ${config.aux.system}"
|
||||||
)
|
)
|
||||||
"-f"
|
"-f"
|
||||||
"${hex0.m2libc.src}/${hex0.m2libc.architecture}/ELF-${hex0.m2libc.architecture}-debug.hex2"
|
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}-debug.hex2"
|
||||||
"-f"
|
"-f"
|
||||||
kaem_hex2
|
kaem_hex2
|
||||||
"-o"
|
"-o"
|
||||||
|
|
95
foundation/src/stages/stage0/sources/default.nix
Normal file
95
foundation/src/stages/stage0/sources/default.nix
Normal file
|
@ -0,0 +1,95 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
config,
|
||||||
|
}: let
|
||||||
|
system = config.aux.system;
|
||||||
|
|
||||||
|
architecture = config.aux.foundation.stages.stage0.architecture.base;
|
||||||
|
in {
|
||||||
|
options.aux.foundation.stages.stage0.sources = {
|
||||||
|
base = lib.options.create {
|
||||||
|
type = lib.types.string;
|
||||||
|
description = "The source for the hex0 build files.";
|
||||||
|
};
|
||||||
|
|
||||||
|
m2libc = lib.options.create {
|
||||||
|
type = lib.types.string;
|
||||||
|
description = "The source for the M2libc build files.";
|
||||||
|
};
|
||||||
|
|
||||||
|
m2planet = lib.options.create {
|
||||||
|
type = lib.types.string;
|
||||||
|
description = "The source for the M2-Planet build files.";
|
||||||
|
};
|
||||||
|
|
||||||
|
m2mesoplanet = lib.options.create {
|
||||||
|
type = lib.types.string;
|
||||||
|
description = "The source for the M2-Mesoplanet build files.";
|
||||||
|
};
|
||||||
|
|
||||||
|
mescc-tools = lib.options.create {
|
||||||
|
type = lib.types.string;
|
||||||
|
description = "The source for the mescc-tools build files.";
|
||||||
|
};
|
||||||
|
|
||||||
|
mescc-tools-extra = lib.options.create {
|
||||||
|
type = lib.types.string;
|
||||||
|
description = "The source for the mescc-tools-extra build files.";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
config = {
|
||||||
|
aux.foundation.stages.stage0.sources = {
|
||||||
|
# All sources are combined a central repository via submodules. Due to potential quirks surrounding
|
||||||
|
# fetching that, we are instead fetching each submodule directly. The central repository is located
|
||||||
|
# here: https://github.com/oriansj/stage0-posix
|
||||||
|
base =
|
||||||
|
if architecture == "AMD64"
|
||||||
|
then
|
||||||
|
builtins.fetchTarball {
|
||||||
|
url = "https://github.com/oriansj/stage0-posix-amd64/archive/93fbe4c08772d8df1412e2554668e24cf604088c.tar.gz";
|
||||||
|
sha256 = "10d1xnjzqplpfip3pm89bydd501x1bcgkg7lkkadyq5bqpad5flp";
|
||||||
|
}
|
||||||
|
else if architecture == "AArch64"
|
||||||
|
then
|
||||||
|
# FIXME: We may need to patch the aarch64 variant.
|
||||||
|
# https://github.com/oriansj/M2libc/pull/17
|
||||||
|
builtins.fetchTarball {
|
||||||
|
url = "https://github.com/oriansj/stage0-posix-aarch64/archive/39a43f803d572b53f95d42507202152eeda18361.tar.gz";
|
||||||
|
sha256 = "1x607hr3n5j89394d156r23igpx8hifjd14ygksx7902rlwrrry2";
|
||||||
|
}
|
||||||
|
else if architecture == "x86"
|
||||||
|
then
|
||||||
|
builtins.fetchTarball {
|
||||||
|
url = "https://github.com/oriansj/stage0-posix-x86/archive/e86bf7d304bae5ce5ccc88454bb60cf0837e941f.tar.gz";
|
||||||
|
sha256 = "1c1fk793yzq8zbg60n2zd22fsmirc3zr26fj0iskap456g84nxv8";
|
||||||
|
}
|
||||||
|
else builtins.throw "Unsupported architecture for stage0: ${architecture}";
|
||||||
|
|
||||||
|
m2libc = builtins.fetchTarball {
|
||||||
|
url = "https://github.com/oriansj/M2libc/archive/de7c75f144176c3b9be77695d9bf94440445aeae.tar.gz";
|
||||||
|
sha256 = "01k81zn8yx4jg6fbcjgkrf9rp074yikkmwqykdgi9143yfb2k3yv";
|
||||||
|
};
|
||||||
|
|
||||||
|
m2planet = builtins.fetchTarball {
|
||||||
|
url = "https://github.com/oriansj/M2-Planet/archive/51dc63b349ca13fa57b345964254cf26930c0a7d.tar.gz";
|
||||||
|
sha256 = "1kksk260dh6qd0dzgl9vgs67fs0lsxs9w0gniy0ii5fgmqxi8p65";
|
||||||
|
};
|
||||||
|
|
||||||
|
m2mesoplanet = builtins.fetchTarball {
|
||||||
|
url = "https://github.com/oriansj/M2-Mesoplanet/archive/c80645f06b035debaa08e95da3206346a9f61b97.tar.gz";
|
||||||
|
sha256 = "02vzqln38ylfnd88p87935yf26i60gkbv93ns5j7parqgyyz2kl4";
|
||||||
|
};
|
||||||
|
|
||||||
|
mescc-tools = builtins.fetchTarball {
|
||||||
|
url = "https://github.com/oriansj/mescc-tools/archive/5d37991e22d1e4147411a766f4410508ba872962.tar.gz";
|
||||||
|
sha256 = "1xgpqhc5diim3rr9a00939976svrbhfp4v5970548a137fdynl4c";
|
||||||
|
};
|
||||||
|
|
||||||
|
mescc-tools-extra = builtins.fetchTarball {
|
||||||
|
url = "https://github.com/oriansj/mescc-tools-extra/archive/c1bd4ab4c5b994d8167c1e6dfc14050dc151a911.tar.gz";
|
||||||
|
sha256 = "0v8vxn3a8rxbgi6vcw73jqkw9j5vg3qlvd4sxk2w0fpybjml8brd";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -5,7 +5,8 @@ lib: {
|
||||||
## `lib.paths.into.drv` for convenience.
|
## `lib.paths.into.drv` for convenience.
|
||||||
##
|
##
|
||||||
## @type a -> Bool
|
## @type a -> Bool
|
||||||
isDerivation = value: value.type or null == "derivation";
|
isDerivation = value:
|
||||||
|
value.type or null == "derivation";
|
||||||
|
|
||||||
## Sanitize a string to produce a valid name for a derivation.
|
## Sanitize a string to produce a valid name for a derivation.
|
||||||
##
|
##
|
||||||
|
|
|
@ -25,7 +25,7 @@ lib: {
|
||||||
##
|
##
|
||||||
## @type Path -> Bool
|
## @type Path -> Bool
|
||||||
store = value:
|
store = value:
|
||||||
if lib.strings.stringifiable value
|
if lib.strings.validate.stringifiable value
|
||||||
then
|
then
|
||||||
builtins.substring 0 1 (builtins.toString value)
|
builtins.substring 0 1 (builtins.toString value)
|
||||||
== "/"
|
== "/"
|
||||||
|
|
Loading…
Reference in a new issue