chore(foundation): remove foundation from labs
This commit is contained in:
parent
5bec48ef8a
commit
85e3fea0d4
143 changed files with 20 additions and 14587 deletions
|
@ -27,5 +27,4 @@ may collaborate.
|
|||
|
||||
| Name | Phase | Description |
|
||||
| ------------------------------ | --------- | ------------------------------------------------------------------------------------ |
|
||||
| [Aux Foundation](./foundation) | Iteration | Foundational packages which allow for bootstrapping a greater package set. |
|
||||
| [Aux Tidepool](./tidepool) | Idea | An initial package set built on top of Aux Foundation using Aux Lib's module system. |
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
MIT License
|
||||
Copyright (c) 2003-2023 Eelco Dolstra and the Nixpkgs/NixOS contributors
|
||||
Copyright (c) 2024 Aux Contributors
|
||||
|
||||
Permission is hereby granted, free
|
||||
of charge, to any person obtaining a copy of this software and associated
|
||||
documentation files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to the
|
||||
following conditions:
|
||||
|
||||
The above copyright notice and this permission notice
|
||||
(including the next paragraph) shall be included in all copies or substantial
|
||||
portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
|
||||
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
|
@ -1,111 +0,0 @@
|
|||
# Aux Foundation
|
||||
|
||||
Aux Foundation provides a set of foundational packages which are required for bootstrapping
|
||||
a larger package set.
|
||||
|
||||
## Usage
|
||||
|
||||
Packages can be imported both with and without Nix Flakes. To import them using Nix Flakes,
|
||||
add this repository as an input.
|
||||
|
||||
```nix
|
||||
inputs.foundation.url = "https://git.auxolotl.org/auxolotl/labs/archive/main.tar.gz?dir=foundation";
|
||||
```
|
||||
|
||||
To import this library without using Nix Flakes, you will need to use `fetchTarball` and
|
||||
import the library entrypoint.
|
||||
|
||||
```nix
|
||||
let
|
||||
labs = builtins.fetchTarball {
|
||||
url = "https://git.auxolotl.org/auxolotl/labs/archive/main.tar.gz";
|
||||
sha256 = "<sha256>";
|
||||
};
|
||||
foundation = import "${labs}/foundation" {
|
||||
# Specifying a system is optional. By default it will use the current system.
|
||||
system = "i686-linux";
|
||||
};
|
||||
in
|
||||
# ...
|
||||
```
|
||||
|
||||
## Development
|
||||
|
||||
This foundational package set is created using modules. Each builder and package is separated
|
||||
accordingly and can be found in their respective directories. In addition, packages are grouped
|
||||
into the different stages of the bootstrapping process.
|
||||
|
||||
### Inputs
|
||||
|
||||
Due to the fundamental nature of this project, the only accepted input is `lib` which itself
|
||||
has no dependencies. _Everything_ else must be built from scratch in the package set.
|
||||
|
||||
### Formatting
|
||||
|
||||
> **Note**
|
||||
> To keep this flake light and keep its inputs empty we do not include a package
|
||||
> set which would provide a formatter. Instead please run `nix run nixpkgs#nixfmt-rfc-style`
|
||||
> until an improved solution is available.
|
||||
|
||||
All code in this project must be formatted using the provided formatter in the `flake.nix`
|
||||
file. You can run this formatter using the command `nix fmt` (not currently available).
|
||||
|
||||
### Code Quality
|
||||
|
||||
In order to keep the project approachable and easy to maintain, certain patterns are not allowed.
|
||||
In particular, the use of `with` and `rec` are not allowed. Additionally, you should prefer the
|
||||
fully qualified name of a variable rather than creating intermediate ones using `inherit`.
|
||||
|
||||
### Builders
|
||||
|
||||
Builders are wrappers around `builtins.derivation` and provide additional functionality via
|
||||
abstraction. They can be found in [`./src/builders`](./src/builders). Each builder specifies
|
||||
its own `build` function which can be called elsewhere in the package set to construct packages.
|
||||
|
||||
For example, here is a module that makes use of the `kaem` builder:
|
||||
|
||||
```nix
|
||||
{config}: let
|
||||
builders = config.aux.foundation.builders;
|
||||
stage0 = config.aux.foundation.stages.stage0;
|
||||
|
||||
package = builders.kaem.build {
|
||||
name = "my-package";
|
||||
|
||||
deps.build.host = [
|
||||
stage0.mescc-tools.package
|
||||
stage0.mescc-tools-extra.package
|
||||
];
|
||||
|
||||
script = ''
|
||||
mkdir ''${out}/bin
|
||||
cp ${./my-binary} ''${out}/bin/my-package
|
||||
chmod 555 ''${out}/bin/my-package
|
||||
'';
|
||||
};
|
||||
in
|
||||
# ...
|
||||
```
|
||||
|
||||
### Stages
|
||||
|
||||
The bootstrapping process is broken up into different stages which focus on different goals.
|
||||
Each stage can be found in [`./src/stages`](./src/stages).
|
||||
|
||||
#### Stage 0
|
||||
|
||||
This stage is responsible for starting with a single binary seed and producing the tools
|
||||
necessary to compile (simple) C code. This stage will then compile the original tools it
|
||||
used from C sources.
|
||||
|
||||
#### Stage 1
|
||||
|
||||
This stage is responsible for building up to a recent version of `gcc`. Along with the
|
||||
compiler, this stage provides things like `bash`, `coreutils`, `gnumake`, and several
|
||||
other important tools.
|
||||
|
||||
#### Stage 2
|
||||
|
||||
This stage refines the existing packages by building static binaries as well as the most recent
|
||||
versions of the tools. In addition, certain load-bearing packages such as `patchelf` and `glibc`
|
||||
are built.
|
|
@ -1,14 +0,0 @@
|
|||
{
|
||||
system ? builtins.currentSystem,
|
||||
}:
|
||||
let
|
||||
pins = import ./npins;
|
||||
lib = import pins.lib;
|
||||
|
||||
modules = import ./src;
|
||||
|
||||
result = lib.modules.run {
|
||||
modules = (builtins.attrValues modules) ++ [ { config.aux.system = system; } ];
|
||||
};
|
||||
in
|
||||
result.config.exports.resolved.packages
|
7
foundation/flake.lock
generated
7
foundation/flake.lock
generated
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"nodes": {
|
||||
"root": {}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
{
|
||||
description = "A set of foundational packages required for bootstrapping a larger package set.";
|
||||
|
||||
inputs = { };
|
||||
|
||||
outputs =
|
||||
_:
|
||||
let
|
||||
pins = import ./npins;
|
||||
lib = import pins.lib;
|
||||
|
||||
modules = import ./src;
|
||||
|
||||
forEachSystem = lib.attrs.generate [ "i686-linux" ];
|
||||
in
|
||||
{
|
||||
extras =
|
||||
let
|
||||
result = lib.modules.run { modules = builtins.attrValues modules; };
|
||||
in
|
||||
result.config.exports.resolved.extras;
|
||||
|
||||
packages = forEachSystem (
|
||||
system:
|
||||
let
|
||||
result = lib.modules.run {
|
||||
modules = (builtins.attrValues modules) ++ [{ config.aux.system = system; }];
|
||||
};
|
||||
in
|
||||
result.config.exports.resolved.packages
|
||||
);
|
||||
};
|
||||
}
|
|
@ -1,80 +0,0 @@
|
|||
# Generated by npins. Do not modify; will be overwritten regularly
|
||||
let
|
||||
data = builtins.fromJSON (builtins.readFile ./sources.json);
|
||||
version = data.version;
|
||||
|
||||
mkSource =
|
||||
spec:
|
||||
assert spec ? type;
|
||||
let
|
||||
path =
|
||||
if spec.type == "Git" then
|
||||
mkGitSource spec
|
||||
else if spec.type == "GitRelease" then
|
||||
mkGitSource spec
|
||||
else if spec.type == "PyPi" then
|
||||
mkPyPiSource spec
|
||||
else if spec.type == "Channel" then
|
||||
mkChannelSource spec
|
||||
else
|
||||
builtins.throw "Unknown source type ${spec.type}";
|
||||
in
|
||||
spec // { outPath = path; };
|
||||
|
||||
mkGitSource =
|
||||
{
|
||||
repository,
|
||||
revision,
|
||||
url ? null,
|
||||
hash,
|
||||
branch ? null,
|
||||
...
|
||||
}:
|
||||
assert repository ? type;
|
||||
# At the moment, either it is a plain git repository (which has an url), or it is a GitHub/GitLab repository
|
||||
# In the latter case, there we will always be an url to the tarball
|
||||
if url != null then
|
||||
(builtins.fetchTarball {
|
||||
inherit url;
|
||||
sha256 = hash; # FIXME: check nix version & use SRI hashes
|
||||
})
|
||||
else
|
||||
assert repository.type == "Git";
|
||||
let
|
||||
urlToName =
|
||||
url: rev:
|
||||
let
|
||||
matched = builtins.match "^.*/([^/]*)(\\.git)?$" repository.url;
|
||||
|
||||
short = builtins.substring 0 7 rev;
|
||||
|
||||
appendShort = if (builtins.match "[a-f0-9]*" rev) != null then "-${short}" else "";
|
||||
in
|
||||
"${if matched == null then "source" else builtins.head matched}${appendShort}";
|
||||
name = urlToName repository.url revision;
|
||||
in
|
||||
builtins.fetchGit {
|
||||
url = repository.url;
|
||||
rev = revision;
|
||||
inherit name;
|
||||
# hash = hash;
|
||||
};
|
||||
|
||||
mkPyPiSource =
|
||||
{ url, hash, ... }:
|
||||
builtins.fetchurl {
|
||||
inherit url;
|
||||
sha256 = hash;
|
||||
};
|
||||
|
||||
mkChannelSource =
|
||||
{ url, hash, ... }:
|
||||
builtins.fetchTarball {
|
||||
inherit url;
|
||||
sha256 = hash;
|
||||
};
|
||||
in
|
||||
if version == 3 then
|
||||
builtins.mapAttrs (_: mkSource) data.pins
|
||||
else
|
||||
throw "Unsupported format version ${toString version} in sources.json. Try running `npins upgrade`"
|
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
"pins": {
|
||||
"lib": {
|
||||
"type": "Git",
|
||||
"repository": {
|
||||
"type": "Git",
|
||||
"url": "git+ssh://forgejo@git.auxolotl.org/auxolotl/lib.git"
|
||||
},
|
||||
"branch": "main",
|
||||
"revision": "7552ab48bb394d59d2bf1f7a558d28ce59da524d",
|
||||
"url": null,
|
||||
"hash": "0705fm00k9f95b6idf5qnfvqm4qf1a0cv966ghgd48kd1qy4il5c"
|
||||
}
|
||||
},
|
||||
"version": 3
|
||||
}
|
|
@ -1,82 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
system = config.aux.system;
|
||||
builders = config.aux.foundation.builders;
|
||||
|
||||
stage0 = config.aux.foundation.stages.stage0;
|
||||
stage1 = config.aux.foundation.stages.stage1;
|
||||
in
|
||||
{
|
||||
options.aux.foundation.builders.bash.boot = {
|
||||
build = lib.options.create {
|
||||
type = lib.types.function lib.types.derivation;
|
||||
description = "Builds a package using the kaem builder.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.builders.bash.boot = {
|
||||
build =
|
||||
settings@{
|
||||
name,
|
||||
script,
|
||||
meta ? { },
|
||||
extras ? { },
|
||||
env ? { },
|
||||
deps ? { },
|
||||
...
|
||||
}:
|
||||
let
|
||||
package = builtins.derivation (
|
||||
(builtins.removeAttrs settings [
|
||||
"meta"
|
||||
"extras"
|
||||
"executable"
|
||||
"env"
|
||||
"deps"
|
||||
"script"
|
||||
])
|
||||
// env
|
||||
// {
|
||||
inherit name system script;
|
||||
|
||||
passAsFile = [ "script" ];
|
||||
|
||||
builder = "${stage1.bash.boot.package}/bin/bash";
|
||||
|
||||
args = [
|
||||
"-e"
|
||||
(builtins.toFile "bash-builder.sh" ''
|
||||
export CONFIG_SHELL=$SHELL
|
||||
|
||||
# Normalize the NIX_BUILD_CORES variable. The value might be 0, which
|
||||
# means that we're supposed to try and auto-detect the number of
|
||||
# available CPU cores at run-time. We don't have nproc to detect the
|
||||
# number of available CPU cores so default to 1 if not set.
|
||||
NIX_BUILD_CORES="''${NIX_BUILD_CORES:-1}"
|
||||
if [ $NIX_BUILD_CORES -le 0 ]; then
|
||||
NIX_BUILD_CORES=1
|
||||
fi
|
||||
export NIX_BUILD_CORES
|
||||
|
||||
bash -eux $scriptPath
|
||||
'')
|
||||
];
|
||||
|
||||
SHELL = "${stage1.bash.boot.package}/bin/bash";
|
||||
|
||||
PATH = lib.paths.bin (
|
||||
(deps.build.host or [ ])
|
||||
++ [
|
||||
stage1.bash.boot.package
|
||||
stage1.coreutils.boot.package
|
||||
stage0.mescc-tools-extra.package
|
||||
]
|
||||
);
|
||||
}
|
||||
);
|
||||
in
|
||||
package // { inherit meta extras; };
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,82 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
system = config.aux.system;
|
||||
builders = config.aux.foundation.builders;
|
||||
|
||||
stage1 = config.aux.foundation.stages.stage1;
|
||||
in
|
||||
{
|
||||
includes = [ ./boot.nix ];
|
||||
|
||||
options.aux.foundation.builders.bash = {
|
||||
build = lib.options.create {
|
||||
type = lib.types.function lib.types.derivation;
|
||||
description = "Builds a package using the bash builder.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.builders.bash = {
|
||||
build =
|
||||
settings@{
|
||||
name,
|
||||
script,
|
||||
meta ? { },
|
||||
extras ? { },
|
||||
env ? { },
|
||||
deps ? { },
|
||||
...
|
||||
}:
|
||||
let
|
||||
package = builtins.derivation (
|
||||
(builtins.removeAttrs settings [
|
||||
"meta"
|
||||
"extras"
|
||||
"executable"
|
||||
"env"
|
||||
"deps"
|
||||
"script"
|
||||
])
|
||||
// env
|
||||
// {
|
||||
inherit name system script;
|
||||
|
||||
passAsFile = [ "script" ];
|
||||
|
||||
builder = "${stage1.bash.package}/bin/bash";
|
||||
|
||||
args = [
|
||||
"-e"
|
||||
(builtins.toFile "bash-builder.sh" ''
|
||||
export CONFIG_SHELL=$SHELL
|
||||
|
||||
# Normalize the NIX_BUILD_CORES variable. The value might be 0, which
|
||||
# means that we're supposed to try and auto-detect the number of
|
||||
# available CPU cores at run-time.
|
||||
NIX_BUILD_CORES="''${NIX_BUILD_CORES:-1}"
|
||||
if ((NIX_BUILD_CORES <= 0)); then
|
||||
guess=$(nproc 2>/dev/null || true)
|
||||
((NIX_BUILD_CORES = guess <= 0 ? 1 : guess))
|
||||
fi
|
||||
export NIX_BUILD_CORES
|
||||
|
||||
bash -eux $scriptPath
|
||||
'')
|
||||
];
|
||||
|
||||
SHELL = "${stage1.bash.package}/bin/bash";
|
||||
|
||||
PATH = lib.paths.bin (
|
||||
(deps.build.host or [ ])
|
||||
++ [
|
||||
stage1.bash.package
|
||||
stage1.coreutils.package
|
||||
]
|
||||
);
|
||||
}
|
||||
);
|
||||
in
|
||||
package // { inherit meta extras; };
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
system = config.aux.system;
|
||||
|
||||
stage0 = config.aux.foundation.stages.stage0;
|
||||
in
|
||||
{
|
||||
options.aux.foundation.builders.file.text = {
|
||||
build = lib.options.create {
|
||||
type = lib.types.function lib.types.derivation;
|
||||
description = "Builds a package using the text file builder.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.builders.file.text = {
|
||||
build =
|
||||
settings@{
|
||||
name,
|
||||
contents,
|
||||
isExecutable ? false,
|
||||
destination ? "",
|
||||
meta ? { },
|
||||
extras ? { },
|
||||
...
|
||||
}:
|
||||
let
|
||||
script =
|
||||
''
|
||||
target=''${out}''${destination}
|
||||
''
|
||||
+ lib.strings.when (builtins.dirOf destination == ".") ''
|
||||
mkdir -p ''${out}''${destinationDir}
|
||||
''
|
||||
+ ''
|
||||
cp ''${contentsPath} ''${target}
|
||||
''
|
||||
+ lib.strings.when isExecutable ''
|
||||
chmod 555 ''${target}
|
||||
'';
|
||||
package = builtins.derivation (
|
||||
(builtins.removeAttrs settings [
|
||||
"meta"
|
||||
"extras"
|
||||
"executable"
|
||||
"isExecutable"
|
||||
])
|
||||
// {
|
||||
inherit
|
||||
name
|
||||
system
|
||||
destination
|
||||
contents
|
||||
;
|
||||
destinationDir = builtins.dirOf destination;
|
||||
|
||||
passAsFile = [ "contents" ];
|
||||
|
||||
builder = "${stage0.kaem.package}/bin/kaem";
|
||||
|
||||
args = [
|
||||
"--verbose"
|
||||
"--strict"
|
||||
"--file"
|
||||
(builtins.toFile "write-text-to-file.kaem" script)
|
||||
];
|
||||
|
||||
PATH = lib.paths.bin [ stage0.mescc-tools-extra.package ];
|
||||
}
|
||||
);
|
||||
in
|
||||
package // { inherit meta extras; };
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
system = config.aux.system;
|
||||
builders = config.aux.foundation.builders;
|
||||
|
||||
stage0 = config.aux.foundation.stages.stage0;
|
||||
in
|
||||
{
|
||||
options.aux.foundation.builders.kaem = {
|
||||
build = lib.options.create {
|
||||
type = lib.types.function lib.types.derivation;
|
||||
description = "Builds a package using the kaem builder.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.builders.kaem = {
|
||||
build =
|
||||
settings@{
|
||||
name,
|
||||
script,
|
||||
meta ? { },
|
||||
extras ? { },
|
||||
env ? { },
|
||||
deps ? { },
|
||||
...
|
||||
}:
|
||||
let
|
||||
package = builtins.derivation (
|
||||
(builtins.removeAttrs settings [
|
||||
"meta"
|
||||
"extras"
|
||||
"executable"
|
||||
"env"
|
||||
"deps"
|
||||
"script"
|
||||
])
|
||||
// env
|
||||
// {
|
||||
inherit name system;
|
||||
|
||||
builder = "${stage0.kaem.package}/bin/kaem";
|
||||
|
||||
args = [
|
||||
"--verbose"
|
||||
"--strict"
|
||||
"--file"
|
||||
(builders.file.text.build {
|
||||
name = "${name}-builder";
|
||||
contents = script;
|
||||
})
|
||||
];
|
||||
|
||||
PATH = lib.paths.bin (
|
||||
(deps.build.host or [ ])
|
||||
++ [
|
||||
stage0.kaem.package
|
||||
stage0.mescc-tools.package
|
||||
stage0.mescc-tools-extra.package
|
||||
]
|
||||
);
|
||||
}
|
||||
);
|
||||
in
|
||||
package // { inherit meta extras; };
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
system = config.aux.system;
|
||||
in
|
||||
{
|
||||
options.aux.foundation.builders.raw = {
|
||||
build = lib.options.create {
|
||||
type = lib.types.function lib.types.derivation;
|
||||
description = "Builds a package using the raw builder.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.builders.raw = {
|
||||
build =
|
||||
settings@{
|
||||
pname,
|
||||
version,
|
||||
executable,
|
||||
args ? [ ],
|
||||
meta ? { },
|
||||
extras ? { },
|
||||
...
|
||||
}:
|
||||
let
|
||||
package = builtins.derivation (
|
||||
(builtins.removeAttrs settings [
|
||||
"meta"
|
||||
"extras"
|
||||
"executable"
|
||||
])
|
||||
// {
|
||||
inherit
|
||||
version
|
||||
pname
|
||||
system
|
||||
args
|
||||
;
|
||||
|
||||
name = "${pname}-${version}";
|
||||
|
||||
builder = executable;
|
||||
}
|
||||
);
|
||||
in
|
||||
package // { inherit meta extras; };
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
let
|
||||
modules = {
|
||||
builderBash = builders/bash;
|
||||
builderFileText = ./builders/file/text;
|
||||
builderKaem = ./builders/kaem;
|
||||
builderRaw = ./builders/raw;
|
||||
mirrors = ./mirrors;
|
||||
exports = ./exports;
|
||||
platform = ./platform;
|
||||
stage0 = ./stages/stage0;
|
||||
stage1 = ./stages/stage1;
|
||||
stage2 = ./stages/stage2;
|
||||
system = ./system;
|
||||
};
|
||||
in
|
||||
modules
|
|
@ -1,43 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
options = {
|
||||
packages = lib.options.create {
|
||||
default.value = { };
|
||||
|
||||
type = lib.types.attrs.of lib.types.derivation;
|
||||
};
|
||||
|
||||
extras = lib.options.create {
|
||||
default.value = { };
|
||||
type = lib.types.attrs.any;
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
options = {
|
||||
exports = {
|
||||
inherit (options) packages extras;
|
||||
|
||||
resolved = {
|
||||
inherit (options) packages extras;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
exports.resolved = {
|
||||
packages = builtins.mapAttrs (
|
||||
name: value:
|
||||
lib.attrs.filter (
|
||||
name: value:
|
||||
if value ? meta && value.meta ? platforms then
|
||||
builtins.elem config.aux.system value.meta.platforms
|
||||
else
|
||||
true
|
||||
) value
|
||||
) config.exports.packages;
|
||||
|
||||
extras = config.exports.extras;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
{ lib }:
|
||||
{
|
||||
options.aux.mirrors = {
|
||||
gnu = lib.options.create {
|
||||
type = lib.types.string;
|
||||
default.value = "https://ftp.gnu.org/gnu";
|
||||
description = "The GNU mirror to use";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,346 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
system = config.aux.system;
|
||||
|
||||
parts = lib.strings.split "-" system;
|
||||
|
||||
platform = builtins.elemAt parts 0;
|
||||
target = builtins.elemAt parts 1;
|
||||
|
||||
platforms = {
|
||||
arm = {
|
||||
bits = 32;
|
||||
endian = "little";
|
||||
family = "arm";
|
||||
};
|
||||
armv5tel = {
|
||||
bits = 32;
|
||||
endian = "little";
|
||||
family = "arm";
|
||||
version = "5";
|
||||
arch = "armv5t";
|
||||
};
|
||||
armv6m = {
|
||||
bits = 32;
|
||||
endian = "little";
|
||||
family = "arm";
|
||||
version = "6";
|
||||
arch = "armv6-m";
|
||||
};
|
||||
armv6l = {
|
||||
bits = 32;
|
||||
endian = "little";
|
||||
family = "arm";
|
||||
version = "6";
|
||||
arch = "armv6";
|
||||
};
|
||||
armv7a = {
|
||||
bits = 32;
|
||||
endian = "little";
|
||||
family = "arm";
|
||||
version = "7";
|
||||
arch = "armv7-a";
|
||||
};
|
||||
armv7r = {
|
||||
bits = 32;
|
||||
endian = "little";
|
||||
family = "arm";
|
||||
version = "7";
|
||||
arch = "armv7-r";
|
||||
};
|
||||
armv7m = {
|
||||
bits = 32;
|
||||
endian = "little";
|
||||
family = "arm";
|
||||
version = "7";
|
||||
arch = "armv7-m";
|
||||
};
|
||||
armv7l = {
|
||||
bits = 32;
|
||||
endian = "little";
|
||||
family = "arm";
|
||||
version = "7";
|
||||
arch = "armv7";
|
||||
};
|
||||
armv8a = {
|
||||
bits = 32;
|
||||
endian = "little";
|
||||
family = "arm";
|
||||
version = "8";
|
||||
arch = "armv8-a";
|
||||
};
|
||||
armv8r = {
|
||||
bits = 32;
|
||||
endian = "little";
|
||||
family = "arm";
|
||||
version = "8";
|
||||
arch = "armv8-a";
|
||||
};
|
||||
armv8m = {
|
||||
bits = 32;
|
||||
endian = "little";
|
||||
family = "arm";
|
||||
version = "8";
|
||||
arch = "armv8-m";
|
||||
};
|
||||
aarch64 = {
|
||||
bits = 64;
|
||||
endian = "little";
|
||||
family = "arm";
|
||||
version = "8";
|
||||
arch = "armv8-a";
|
||||
};
|
||||
aarch64_be = {
|
||||
bits = 64;
|
||||
endian = "big";
|
||||
family = "arm";
|
||||
version = "8";
|
||||
arch = "armv8-a";
|
||||
};
|
||||
|
||||
i386 = {
|
||||
bits = 32;
|
||||
endian = "little";
|
||||
family = "x86";
|
||||
arch = "i386";
|
||||
};
|
||||
i486 = {
|
||||
bits = 32;
|
||||
endian = "little";
|
||||
family = "x86";
|
||||
arch = "i486";
|
||||
};
|
||||
i586 = {
|
||||
bits = 32;
|
||||
endian = "little";
|
||||
family = "x86";
|
||||
arch = "i586";
|
||||
};
|
||||
i686 = {
|
||||
bits = 32;
|
||||
endian = "little";
|
||||
family = "x86";
|
||||
arch = "i686";
|
||||
};
|
||||
x86_64 = {
|
||||
bits = 64;
|
||||
endian = "little";
|
||||
family = "x86";
|
||||
arch = "x86-64";
|
||||
};
|
||||
|
||||
microblaze = {
|
||||
bits = 32;
|
||||
endian = "big";
|
||||
family = "microblaze";
|
||||
};
|
||||
microblazeel = {
|
||||
bits = 32;
|
||||
endian = "little";
|
||||
family = "microblaze";
|
||||
};
|
||||
|
||||
mips = {
|
||||
bits = 32;
|
||||
endian = "big";
|
||||
family = "mips";
|
||||
};
|
||||
mipsel = {
|
||||
bits = 32;
|
||||
endian = "little";
|
||||
family = "mips";
|
||||
};
|
||||
mips64 = {
|
||||
bits = 64;
|
||||
endian = "big";
|
||||
family = "mips";
|
||||
};
|
||||
mips64el = {
|
||||
bits = 64;
|
||||
endian = "little";
|
||||
family = "mips";
|
||||
};
|
||||
|
||||
mmix = {
|
||||
bits = 64;
|
||||
endian = "big";
|
||||
family = "mmix";
|
||||
};
|
||||
|
||||
m68k = {
|
||||
bits = 32;
|
||||
endian = "big";
|
||||
family = "m68k";
|
||||
};
|
||||
|
||||
powerpc = {
|
||||
bits = 32;
|
||||
endian = "big";
|
||||
family = "power";
|
||||
};
|
||||
powerpc64 = {
|
||||
bits = 64;
|
||||
endian = "big";
|
||||
family = "power";
|
||||
};
|
||||
powerpc64le = {
|
||||
bits = 64;
|
||||
endian = "little";
|
||||
family = "power";
|
||||
};
|
||||
powerpcle = {
|
||||
bits = 32;
|
||||
endian = "little";
|
||||
family = "power";
|
||||
};
|
||||
|
||||
riscv32 = {
|
||||
bits = 32;
|
||||
endian = "little";
|
||||
family = "riscv";
|
||||
};
|
||||
riscv64 = {
|
||||
bits = 64;
|
||||
endian = "little";
|
||||
family = "riscv";
|
||||
};
|
||||
|
||||
s390 = {
|
||||
bits = 32;
|
||||
endian = "big";
|
||||
family = "s390";
|
||||
};
|
||||
s390x = {
|
||||
bits = 64;
|
||||
endian = "big";
|
||||
family = "s390";
|
||||
};
|
||||
|
||||
sparc = {
|
||||
bits = 32;
|
||||
endian = "big";
|
||||
family = "sparc";
|
||||
};
|
||||
sparc64 = {
|
||||
bits = 64;
|
||||
endian = "big";
|
||||
family = "sparc";
|
||||
};
|
||||
|
||||
wasm32 = {
|
||||
bits = 32;
|
||||
endian = "little";
|
||||
family = "wasm";
|
||||
};
|
||||
wasm64 = {
|
||||
bits = 64;
|
||||
endian = "little";
|
||||
family = "wasm";
|
||||
};
|
||||
|
||||
alpha = {
|
||||
bits = 64;
|
||||
endian = "little";
|
||||
family = "alpha";
|
||||
};
|
||||
|
||||
rx = {
|
||||
bits = 32;
|
||||
endian = "little";
|
||||
family = "rx";
|
||||
};
|
||||
msp430 = {
|
||||
bits = 16;
|
||||
endian = "little";
|
||||
family = "msp430";
|
||||
};
|
||||
avr = {
|
||||
bits = 8;
|
||||
family = "avr";
|
||||
};
|
||||
|
||||
vc4 = {
|
||||
bits = 32;
|
||||
endian = "little";
|
||||
family = "vc4";
|
||||
};
|
||||
|
||||
or1k = {
|
||||
bits = 32;
|
||||
endian = "big";
|
||||
family = "or1k";
|
||||
};
|
||||
|
||||
loongarch64 = {
|
||||
bits = 64;
|
||||
endian = "little";
|
||||
family = "loongarch";
|
||||
};
|
||||
|
||||
javascript = {
|
||||
bits = 32;
|
||||
endian = "little";
|
||||
family = "javascript";
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
options.aux.platform = {
|
||||
name = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Name of the platform";
|
||||
};
|
||||
|
||||
family = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Family of the platform";
|
||||
};
|
||||
|
||||
bits = lib.options.create {
|
||||
type = lib.types.int;
|
||||
description = "Number of bits in the platform";
|
||||
};
|
||||
|
||||
endian = lib.options.create {
|
||||
type = lib.types.enum [
|
||||
"little"
|
||||
"big"
|
||||
];
|
||||
default.value = "big";
|
||||
description = "Endianess of the platform";
|
||||
};
|
||||
|
||||
arch = lib.options.create {
|
||||
type = lib.types.nullish lib.types.string;
|
||||
default.value = null;
|
||||
description = "Architecture of the platform";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.nullish lib.types.string;
|
||||
default.value = null;
|
||||
description = "Version of the platform";
|
||||
};
|
||||
|
||||
build = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "The build entry, such as x86-unknown-linux-gnu.";
|
||||
};
|
||||
|
||||
host = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "The host entry, such as x86-unknown-linux-gnu.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.platform = (platforms.${platform} or (builtins.throw "Unsupported platform: ${system}")) // {
|
||||
name = platform;
|
||||
|
||||
# These will only ever have `linux` as the target since we
|
||||
# do not support darwin bootstrapping.
|
||||
build = "${platform}-unknown-${target}-gnu";
|
||||
host = "${platform}-unknown-${target}-gnu";
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
{ 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"'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage0;
|
||||
|
||||
system = config.aux.system;
|
||||
builders = config.aux.foundation.builders;
|
||||
|
||||
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
|
||||
{
|
||||
includes = [
|
||||
./sources
|
||||
./architecture
|
||||
|
||||
./phases/phase00.nix
|
||||
./phases/phase01.nix
|
||||
./phases/phase02.nix
|
||||
./phases/phase03.nix
|
||||
./phases/phase04.nix
|
||||
./phases/phase05.nix
|
||||
./phases/phase06.nix
|
||||
./phases/phase07.nix
|
||||
./phases/phase08.nix
|
||||
./phases/phase09.nix
|
||||
./phases/phase10.nix
|
||||
./phases/phase11.nix
|
||||
./phases/phase12.nix
|
||||
|
||||
./mescc-tools
|
||||
./mescc-tools-extra
|
||||
./kaem
|
||||
];
|
||||
|
||||
config = {
|
||||
exports = {
|
||||
packages = {
|
||||
stage0-hex0 = cfg.hex0.package;
|
||||
|
||||
stage0-hex1 = cfg.hex1.package;
|
||||
|
||||
stage0-hex2-0 = cfg.hex2-0.package;
|
||||
|
||||
stage0-catm = cfg.catm.package;
|
||||
|
||||
stage0-M0 = cfg.M0.package;
|
||||
|
||||
stage0-cc_arch = cfg.cc_arch.package;
|
||||
|
||||
stage0-M2 = cfg.M2.package;
|
||||
|
||||
stage0-blood-elf = cfg.blood-elf.package;
|
||||
|
||||
stage0-M1-0 = cfg.M1-0.package;
|
||||
|
||||
stage0-hex2-1 = cfg.hex2-1.package;
|
||||
|
||||
stage0-M1 = cfg.M1.package;
|
||||
|
||||
stage0-hex2 = cfg.hex2.package;
|
||||
|
||||
stage0-kaem-unwrapped = cfg.kaem-unwrapped.package;
|
||||
|
||||
stage0-mescc-tools = cfg.mescc-tools.package;
|
||||
|
||||
stage0-mescc-tools-extra = cfg.mescc-tools-extra.package;
|
||||
|
||||
stage0-kaem = cfg.kaem.package;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
mkdir -p ${out}/bin
|
||||
cp ${kaemUnwrapped} ${out}/bin/kaem
|
||||
chmod 555 ${out}/bin/kaem
|
|
@ -1,71 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage0.kaem;
|
||||
|
||||
system = config.aux.system;
|
||||
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
|
||||
{
|
||||
options.aux.foundation.stages.stage0.kaem = {
|
||||
meta = {
|
||||
description = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Description for the package.";
|
||||
default.value = "Minimal build tool for running scripts on systems that lack any shell.";
|
||||
};
|
||||
|
||||
homepage = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Homepage for the package.";
|
||||
default.value = "https://github.com/oriansj/stage0-posix";
|
||||
};
|
||||
|
||||
license = lib.options.create {
|
||||
# TODO: Add a proper type for licenses.
|
||||
type = lib.types.attrs.any;
|
||||
description = "License for the package.";
|
||||
default.value = lib.licenses.gpl3Plus;
|
||||
};
|
||||
|
||||
platforms = lib.options.create {
|
||||
type = lib.types.list.of lib.types.string;
|
||||
description = "Platforms the package supports.";
|
||||
default.value = [ "i686-linux" ];
|
||||
};
|
||||
};
|
||||
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for kaem.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage0.kaem = {
|
||||
package = lib.modules.overrides.default (
|
||||
builders.raw.build {
|
||||
pname = "kaem";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = kaem-unwrapped.package;
|
||||
|
||||
args = [
|
||||
"--verbose"
|
||||
"--strict"
|
||||
"--file"
|
||||
./build.kaem
|
||||
];
|
||||
|
||||
kaemUnwrapped = kaem-unwrapped.package;
|
||||
PATH = lib.paths.bin [ mescc-tools-extra.package ];
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
# This is a modified version of mescc-tools-extra/mescc-tools-extra.kaem
|
||||
# https://github.com/oriansj/mescc-tools-extra/blob/ec53af69d6d2119b47b369cd0ec37ac806e7ad60/mescc-tools-extra.kaem
|
||||
# - Paths to build inputs have been changed for nix
|
||||
# - Added additional step to create $out directory
|
||||
|
||||
## Copyright (C) 2017 Jeremiah Orians
|
||||
## This file is part of mescc-tools.
|
||||
##
|
||||
## mescc-tools is free software: you can redistribute it and/or modify
|
||||
## it under the terms of the GNU General Public License as published by
|
||||
## the Free Software Foundation, either version 3 of the License, or
|
||||
## (at your option) any later version.
|
||||
##
|
||||
## mescc-tools is distributed in the hope that it will be useful,
|
||||
## but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
## GNU General Public License for more details.
|
||||
##
|
||||
## You should have received a copy of the GNU General Public License
|
||||
## along with mescc-tools. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
alias CC="${mesccTools}/bin/M2-Mesoplanet --operating-system ${m2libcOS} --architecture ${m2libcArch} -f"
|
||||
cd ${src}
|
||||
|
||||
# Create output folder
|
||||
CC mkdir.c -o ${TMP}/mkdir
|
||||
${TMP}/mkdir -p ${out}/bin
|
||||
|
||||
CC sha256sum.c -o ${out}/bin/sha256sum
|
||||
CC match.c -o ${out}/bin/match
|
||||
CC mkdir.c -o ${out}/bin/mkdir
|
||||
CC untar.c -o ${out}/bin/untar
|
||||
CC ungz.c -o ${out}/bin/ungz
|
||||
CC unbz2.c -o ${out}/bin/unbz2
|
||||
CC catm.c -o ${out}/bin/catm
|
||||
CC cp.c -o ${out}/bin/cp
|
||||
CC chmod.c -o ${out}/bin/chmod
|
||||
CC rm.c -o ${out}/bin/rm
|
||||
CC replace.c -o ${out}/bin/replace
|
||||
|
|
@ -1,82 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage0.mescc-tools-extra;
|
||||
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;
|
||||
|
||||
system = config.aux.system;
|
||||
builders = config.aux.foundation.builders;
|
||||
sources = config.aux.foundation.stages.stage0.sources;
|
||||
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||
in
|
||||
{
|
||||
options.aux.foundation.stages.stage0.mescc-tools-extra = {
|
||||
meta = {
|
||||
description = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Description for the package.";
|
||||
default.value = "Collection of tools for use in bootstrapping.";
|
||||
};
|
||||
|
||||
homepage = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Homepage for the package.";
|
||||
default.value = "https://github.com/oriansj/stage0-posix";
|
||||
};
|
||||
|
||||
license = lib.options.create {
|
||||
# TODO: Add a proper type for licenses.
|
||||
type = lib.types.attrs.any;
|
||||
description = "License for the package.";
|
||||
default.value = lib.licenses.gpl3Plus;
|
||||
};
|
||||
|
||||
platforms = lib.options.create {
|
||||
type = lib.types.list.of lib.types.string;
|
||||
description = "Platforms the package supports.";
|
||||
default.value = [ "i686-linux" ];
|
||||
};
|
||||
};
|
||||
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for mescc-tools-extra.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage0.mescc-tools-extra = {
|
||||
package = lib.modules.overrides.default (
|
||||
builders.raw.build {
|
||||
pname = "mescc-tools-tools";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = kaem-unwrapped.package;
|
||||
|
||||
args = [
|
||||
"--verbose"
|
||||
"--strict"
|
||||
"--file"
|
||||
./build.kaem
|
||||
];
|
||||
|
||||
src = sources.mescc-tools-extra;
|
||||
|
||||
m2libcOS = "linux";
|
||||
m2libcArch = architecture.m2libc;
|
||||
mesccTools = mescc-tools.package;
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,205 +0,0 @@
|
|||
# This is a modified version of stage0-posix/x86/mescc-tools-full-kaem.kaem
|
||||
# https://github.com/oriansj/stage0-posix-x86/blob/56e6b8df3e95f4bc04f8b420a4cd8c82c70b9efa/mescc-tools-full-kaem.kaem
|
||||
# - Paths to build inputs have been changed for nix
|
||||
|
||||
# Mes --- Maxwell Equations of Software
|
||||
# Copyright © 2017,2019 Jan Nieuwenhuizen <janneke@gnu.org>
|
||||
# Copyright © 2017,2019 Jeremiah Orians
|
||||
#
|
||||
# This file is part of Mes.
|
||||
#
|
||||
# Mes is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or (at
|
||||
# your option) any later version.
|
||||
#
|
||||
# Mes is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
${mkdir} -p ${out}/bin
|
||||
${cp} ${M2} ${out}/bin/M2
|
||||
${chmod} 0555 ${out}/bin/M2
|
||||
${cp} ${M1} ${out}/bin/M1
|
||||
${chmod} 0555 ${out}/bin/M1
|
||||
${cp} ${hex2} ${out}/bin/hex2
|
||||
${chmod} 0555 ${out}/bin/hex2
|
||||
|
||||
# M2-Mesoplanet searches for runtime dependencies in environment variables
|
||||
# We can hardcode them with the "replace" utility from mescc-tools-extra
|
||||
${replace} \
|
||||
--file ${m2mesoplanet}/cc.c \
|
||||
--output ./cc_patched.c \
|
||||
--match-on "env_lookup(\"M2LIBC_PATH\")" \
|
||||
--replace-with "\"${m2libc}\""
|
||||
${replace} \
|
||||
--file ${m2mesoplanet}/cc_spawn.c \
|
||||
--output ./cc_spawn_patched.c \
|
||||
--match-on "env_lookup(\"PATH\")" \
|
||||
--replace-with "\"${out}/bin:\""
|
||||
|
||||
###############################################
|
||||
# Phase-12 Build M2-Mesoplanet from M2-Planet #
|
||||
###############################################
|
||||
|
||||
${M2} --architecture ${m2libcArch} \
|
||||
-f ${m2libc}/sys/types.h \
|
||||
-f ${m2libc}/stddef.h \
|
||||
-f ${m2libc}/${m2libcArch}/linux/fcntl.c \
|
||||
-f ${m2libc}/fcntl.c \
|
||||
-f ${m2libc}/${m2libcArch}/linux/unistd.c \
|
||||
-f ${m2libc}/${m2libcArch}/linux/sys/stat.c \
|
||||
-f ${m2libc}/stdlib.c \
|
||||
-f ${m2libc}/stdio.h \
|
||||
-f ${m2libc}/stdio.c \
|
||||
-f ${m2libc}/string.c \
|
||||
-f ${m2libc}/bootstrappable.c \
|
||||
-f ${m2mesoplanet}/cc.h \
|
||||
-f ${m2mesoplanet}/cc_globals.c \
|
||||
-f ${m2mesoplanet}/cc_env.c \
|
||||
-f ${m2mesoplanet}/cc_reader.c \
|
||||
-f ./cc_spawn_patched.c \
|
||||
-f ${m2mesoplanet}/cc_core.c \
|
||||
-f ${m2mesoplanet}/cc_macro.c \
|
||||
-f ./cc_patched.c \
|
||||
--debug \
|
||||
-o ./M2-Mesoplanet-1.M1
|
||||
|
||||
${blood-elf-0} ${endianFlag} ${bloodFlag} -f ./M2-Mesoplanet-1.M1 -o ./M2-Mesoplanet-1-footer.M1
|
||||
|
||||
${M1} --architecture ${m2libcArch} \
|
||||
${endianFlag} \
|
||||
-f ${m2libc}/${m2libcArch}/${m2libcArch}_defs.M1 \
|
||||
-f ${m2libc}/${m2libcArch}/libc-full.M1 \
|
||||
-f ./M2-Mesoplanet-1.M1 \
|
||||
-f ./M2-Mesoplanet-1-footer.M1 \
|
||||
-o ./M2-Mesoplanet-1.hex2
|
||||
|
||||
${hex2} --architecture ${m2libcArch} \
|
||||
${endianFlag} \
|
||||
--base-address ${baseAddress} \
|
||||
-f ${m2libc}/${m2libcArch}/ELF-${m2libcArch}-debug.hex2 \
|
||||
-f ./M2-Mesoplanet-1.hex2 \
|
||||
-o ${out}/bin/M2-Mesoplanet
|
||||
|
||||
#################################################
|
||||
# Phase-13 Build final blood-elf from C sources #
|
||||
#################################################
|
||||
|
||||
${M2} --architecture ${m2libcArch} \
|
||||
-f ${m2libc}/sys/types.h \
|
||||
-f ${m2libc}/stddef.h \
|
||||
-f ${m2libc}/${m2libcArch}/linux/fcntl.c \
|
||||
-f ${m2libc}/fcntl.c \
|
||||
-f ${m2libc}/${m2libcArch}/linux/unistd.c \
|
||||
-f ${m2libc}/stdlib.c \
|
||||
-f ${m2libc}/stdio.h \
|
||||
-f ${m2libc}/stdio.c \
|
||||
-f ${m2libc}/bootstrappable.c \
|
||||
-f ${mesccTools}/stringify.c \
|
||||
-f ${mesccTools}/blood-elf.c \
|
||||
--debug \
|
||||
-o ./blood-elf-1.M1
|
||||
|
||||
${blood-elf-0} ${endianFlag} ${bloodFlag} -f ./blood-elf-1.M1 -o ./blood-elf-1-footer.M1
|
||||
|
||||
${M1} --architecture ${m2libcArch} \
|
||||
${endianFlag} \
|
||||
-f ${m2libc}/${m2libcArch}/${m2libcArch}_defs.M1 \
|
||||
-f ${m2libc}/${m2libcArch}/libc-full.M1 \
|
||||
-f ./blood-elf-1.M1 \
|
||||
-f ./blood-elf-1-footer.M1 \
|
||||
-o ./blood-elf-1.hex2
|
||||
|
||||
${hex2} --architecture ${m2libcArch} \
|
||||
${endianFlag} \
|
||||
--base-address ${baseAddress} \
|
||||
-f ${m2libc}/${m2libcArch}/ELF-${m2libcArch}-debug.hex2 \
|
||||
-f ./blood-elf-1.hex2 \
|
||||
-o ${out}/bin/blood-elf
|
||||
|
||||
# Now we have our shipping debuggable blood-elf, the rest will be down hill from
|
||||
# here as we have ALL of the core pieces of compiling and assembling debuggable
|
||||
# programs in a debuggable form with corresponding C source code.
|
||||
|
||||
#############################################
|
||||
# Phase-14 Build get_machine from C sources #
|
||||
#############################################
|
||||
|
||||
${M2} --architecture ${m2libcArch} \
|
||||
-f ${m2libc}/sys/types.h \
|
||||
-f ${m2libc}/stddef.h \
|
||||
-f ${m2libc}/${m2libcArch}/linux/unistd.c \
|
||||
-f ${m2libc}/${m2libcArch}/linux/fcntl.c \
|
||||
-f ${m2libc}/fcntl.c \
|
||||
-f ${m2libc}/stdlib.c \
|
||||
-f ${m2libc}/stdio.h \
|
||||
-f ${m2libc}/stdio.c \
|
||||
-f ${m2libc}/bootstrappable.c \
|
||||
-f ${mesccTools}/get_machine.c \
|
||||
--debug \
|
||||
-o get_machine.M1
|
||||
|
||||
${out}/bin/blood-elf ${endianFlag} ${bloodFlag} -f ./get_machine.M1 -o ./get_machine-footer.M1
|
||||
|
||||
${M1} --architecture ${m2libcArch} \
|
||||
${endianFlag} \
|
||||
-f ${m2libc}/${m2libcArch}/${m2libcArch}_defs.M1 \
|
||||
-f ${m2libc}/${m2libcArch}/libc-full.M1 \
|
||||
-f ./get_machine.M1 \
|
||||
-f ./get_machine-footer.M1 \
|
||||
-o ./get_machine.hex2
|
||||
|
||||
${hex2} --architecture ${m2libcArch} \
|
||||
${endianFlag} \
|
||||
--base-address ${baseAddress} \
|
||||
-f ${m2libc}/${m2libcArch}/ELF-${m2libcArch}-debug.hex2 \
|
||||
-f ./get_machine.hex2 \
|
||||
-o ${out}/bin/get_machine
|
||||
|
||||
############################################
|
||||
# Phase-15 Build M2-Planet from M2-Planet #
|
||||
############################################
|
||||
|
||||
${M2} --architecture ${m2libcArch} \
|
||||
-f ${m2libc}/sys/types.h \
|
||||
-f ${m2libc}/stddef.h \
|
||||
-f ${m2libc}/${m2libcArch}/linux/unistd.c \
|
||||
-f ${m2libc}/${m2libcArch}/linux/fcntl.c \
|
||||
-f ${m2libc}/fcntl.c \
|
||||
-f ${m2libc}/stdlib.c \
|
||||
-f ${m2libc}/stdio.h \
|
||||
-f ${m2libc}/stdio.c \
|
||||
-f ${m2libc}/bootstrappable.c \
|
||||
-f ${m2planet}/cc.h \
|
||||
-f ${m2planet}/cc_globals.c \
|
||||
-f ${m2planet}/cc_reader.c \
|
||||
-f ${m2planet}/cc_strings.c \
|
||||
-f ${m2planet}/cc_types.c \
|
||||
-f ${m2planet}/cc_core.c \
|
||||
-f ${m2planet}/cc_macro.c \
|
||||
-f ${m2planet}/cc.c \
|
||||
--debug \
|
||||
-o ./M2-1.M1
|
||||
|
||||
${out}/bin/blood-elf ${endianFlag} ${bloodFlag} -f ./M2-1.M1 -o ./M2-1-footer.M1
|
||||
|
||||
${M1} --architecture ${m2libcArch} \
|
||||
${endianFlag} \
|
||||
-f ${m2libc}/${m2libcArch}/${m2libcArch}_defs.M1 \
|
||||
-f ${m2libc}/${m2libcArch}/libc-full.M1 \
|
||||
-f ./M2-1.M1 \
|
||||
-f ./M2-1-footer.M1 \
|
||||
-o ./M2-1.hex2
|
||||
|
||||
${hex2} --architecture ${m2libcArch} \
|
||||
${endianFlag} \
|
||||
--base-address ${baseAddress} \
|
||||
-f ${m2libc}/${m2libcArch}/ELF-${m2libcArch}-debug.hex2 \
|
||||
-f ./M2-1.hex2 \
|
||||
-o ${out}/bin/M2-Planet
|
||||
|
|
@ -1,180 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage0.mescc-tools;
|
||||
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;
|
||||
|
||||
system = config.aux.system;
|
||||
builders = config.aux.foundation.builders;
|
||||
sources = config.aux.foundation.stages.stage0.sources;
|
||||
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||
|
||||
bloodFlag = if config.aux.platform.bits == 64 then "--64" else " ";
|
||||
endianFlag = if config.aux.platform.endian == "little" then "--little-endian" else "--big-endian";
|
||||
baseAddress =
|
||||
if config.aux.system == "x86_64-linux" then
|
||||
"0x00600000"
|
||||
else if config.aux.system == "aarch64-linux" then
|
||||
"0x00600000"
|
||||
else if config.aux.system == "i686-linux" then
|
||||
"0x08048000"
|
||||
else
|
||||
builtins.throw "Unsupported system: ${config.aux.system}";
|
||||
|
||||
getExtraUtil =
|
||||
name:
|
||||
let
|
||||
script = builtins.toFile "build-${name}.kaem" ''
|
||||
''${M2} --architecture ${architecture.m2libc} \
|
||||
-f ''${m2libc}/sys/types.h \
|
||||
-f ''${m2libc}/stddef.h \
|
||||
-f ''${m2libc}/${architecture.m2libc}/linux/fcntl.c \
|
||||
-f ''${m2libc}/fcntl.c \
|
||||
-f ''${m2libc}/${architecture.m2libc}/linux/unistd.c \
|
||||
-f ''${m2libc}/${architecture.m2libc}/linux/sys/stat.c \
|
||||
-f ''${m2libc}/stdlib.c \
|
||||
-f ''${m2libc}/stdio.h \
|
||||
-f ''${m2libc}/stdio.c \
|
||||
-f ''${m2libc}/string.c \
|
||||
-f ''${m2libc}/bootstrappable.c \
|
||||
-f ''${mesccToolsExtra}/${name}.c \
|
||||
--debug \
|
||||
-o ${name}.M1
|
||||
|
||||
''${blood-elf-0} ${endianFlag} ${bloodFlag} -f ${name}.M1 -o ${name}-footer.M1
|
||||
|
||||
''${M1} --architecture ${architecture.m2libc} \
|
||||
${endianFlag} \
|
||||
-f ''${m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1 \
|
||||
-f ''${m2libc}/${architecture.m2libc}/libc-full.M1 \
|
||||
-f ${name}.M1 \
|
||||
-f ${name}-footer.M1 \
|
||||
-o ${name}.hex2
|
||||
|
||||
''${hex2} --architecture ${architecture.m2libc} \
|
||||
${endianFlag} \
|
||||
-f ''${m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}-debug.hex2 \
|
||||
-f ${name}.hex2 \
|
||||
--base-address ${baseAddress} \
|
||||
-o ''${out}
|
||||
|
||||
'';
|
||||
in
|
||||
builders.raw.build {
|
||||
pname = "mescc-tools-extra-${name}";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = kaem-unwrapped.package;
|
||||
|
||||
args = [
|
||||
"--verbose"
|
||||
"--strict"
|
||||
"--file"
|
||||
script
|
||||
];
|
||||
|
||||
src = sources.base;
|
||||
|
||||
M1 = M1.package;
|
||||
M2 = M2.package;
|
||||
blood-elf-0 = blood-elf.package;
|
||||
hex2 = hex2.package;
|
||||
|
||||
m2libc = sources.m2libc;
|
||||
m2planet = sources.m2planet;
|
||||
m2mesoplanet = sources.m2mesoplanet;
|
||||
mesccTools = sources.mescc-tools;
|
||||
mesccToolsExtra = sources.mescc-tools-extra;
|
||||
|
||||
bloodFlag = bloodFlag;
|
||||
endianFlag = endianFlag;
|
||||
baseAddress = baseAddress;
|
||||
};
|
||||
in
|
||||
{
|
||||
options.aux.foundation.stages.stage0.mescc-tools = {
|
||||
meta = {
|
||||
description = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Description for the package.";
|
||||
default.value = "Collection of tools for use in bootstrapping.";
|
||||
};
|
||||
|
||||
homepage = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Homepage for the package.";
|
||||
default.value = "https://github.com/oriansj/stage0-posix";
|
||||
};
|
||||
|
||||
license = lib.options.create {
|
||||
# TODO: Add a proper type for licenses.
|
||||
type = lib.types.attrs.any;
|
||||
description = "License for the package.";
|
||||
default.value = lib.licenses.gpl3Plus;
|
||||
};
|
||||
|
||||
platforms = lib.options.create {
|
||||
type = lib.types.list.of lib.types.string;
|
||||
description = "Platforms the package supports.";
|
||||
default.value = [ "i686-linux" ];
|
||||
};
|
||||
};
|
||||
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for mescc-tools.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage0.mescc-tools = {
|
||||
package = lib.modules.overrides.default (
|
||||
builders.raw.build {
|
||||
pname = "mescc-tools";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = kaem-unwrapped.package;
|
||||
|
||||
args = [
|
||||
"--verbose"
|
||||
"--strict"
|
||||
"--file"
|
||||
./build.kaem
|
||||
];
|
||||
|
||||
M1 = M1.package;
|
||||
M2 = M2.package;
|
||||
blood-elf-0 = blood-elf.package;
|
||||
hex2 = hex2.package;
|
||||
|
||||
m2libc = sources.m2libc;
|
||||
m2libcArch = architecture.m2libc;
|
||||
m2planet = sources.m2planet;
|
||||
m2mesoplanet = sources.m2mesoplanet;
|
||||
mesccTools = sources.mescc-tools;
|
||||
mesccToolsExtra = sources.mescc-tools-extra;
|
||||
|
||||
bloodFlag = bloodFlag;
|
||||
endianFlag = endianFlag;
|
||||
baseAddress = baseAddress;
|
||||
|
||||
mkdir = getExtraUtil "mkdir";
|
||||
cp = getExtraUtil "cp";
|
||||
chmod = getExtraUtil "chmod";
|
||||
replace = getExtraUtil "replace";
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,110 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage0.hex0;
|
||||
|
||||
system = config.aux.system;
|
||||
builders = config.aux.foundation.builders;
|
||||
sources = config.aux.foundation.stages.stage0.sources;
|
||||
|
||||
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.hex0 = {
|
||||
meta = {
|
||||
description = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Description for the package.";
|
||||
default.value = "Minimal assembler for bootstrapping.";
|
||||
};
|
||||
|
||||
homepage = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Homepage for the package.";
|
||||
default.value = "https://github.com/oriansj/stage0-posix";
|
||||
};
|
||||
|
||||
license = lib.options.create {
|
||||
# TODO: Add a proper type for licenses.
|
||||
type = lib.types.attrs.any;
|
||||
description = "License for the package.";
|
||||
default.value = lib.licenses.gpl3Plus;
|
||||
};
|
||||
|
||||
platforms = lib.options.create {
|
||||
type = lib.types.list.of lib.types.string;
|
||||
description = "Platforms the package supports.";
|
||||
default.value = [ "i686-linux" ];
|
||||
};
|
||||
};
|
||||
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for hex0.";
|
||||
};
|
||||
|
||||
hash = lib.options.create {
|
||||
type = lib.types.nullish lib.types.string;
|
||||
default = {
|
||||
text = "<sha256 hash>";
|
||||
value = null;
|
||||
};
|
||||
};
|
||||
|
||||
executable = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The derivation to use to build hex0.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage0.hex0 = {
|
||||
package = lib.modules.overrides.default (
|
||||
builders.raw.build {
|
||||
pname = "hex0";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = cfg.executable;
|
||||
|
||||
args = [
|
||||
"${sources.base}/hex0_${architecture}.hex0"
|
||||
(builtins.placeholder "out")
|
||||
];
|
||||
|
||||
outputHashMode = "recursive";
|
||||
outputHashAlgo = "sha256";
|
||||
outputHash = cfg.hash;
|
||||
}
|
||||
);
|
||||
|
||||
hash = lib.modules.overrides.default (
|
||||
if system == "x86_64-linux" then
|
||||
"sha256-RCgK9oZRDQUiWLVkcIBSR2HeoB+Bh0czthrpjFEkCaY="
|
||||
else if system == "aarch64-linux" then
|
||||
"sha256-XTPsoKeI6wTZAF0UwEJPzuHelWOJe//wXg4HYO0dEJo="
|
||||
else if system == "i686-linux" then
|
||||
"sha256-QU3RPGy51W7M2xnfFY1IqruKzusrSLU+L190ztN6JW8="
|
||||
else
|
||||
null
|
||||
);
|
||||
|
||||
executable = lib.modules.overrides.default (
|
||||
import <nix/fetchurl.nix> {
|
||||
name = "hex0-seed";
|
||||
url = "https://github.com/oriansj/bootstrap-seeds/raw/b1263ff14a17835f4d12539226208c426ced4fba/POSIX/${architecture}/hex0-seed";
|
||||
executable = true;
|
||||
hash = cfg.hash;
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,65 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage0.hex1;
|
||||
hex0 = config.aux.foundation.stages.stage0.hex0;
|
||||
|
||||
system = config.aux.system;
|
||||
builders = config.aux.foundation.builders;
|
||||
sources = config.aux.foundation.stages.stage0.sources;
|
||||
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||
in
|
||||
{
|
||||
options.aux.foundation.stages.stage0.hex1 = {
|
||||
meta = {
|
||||
description = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Description for the package.";
|
||||
default.value = "Collection of tools for use in bootstrapping.";
|
||||
};
|
||||
|
||||
homepage = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Homepage for the package.";
|
||||
default.value = "https://github.com/oriansj/stage0-posix";
|
||||
};
|
||||
|
||||
license = lib.options.create {
|
||||
# TODO: Add a proper type for licenses.
|
||||
type = lib.types.attrs.any;
|
||||
description = "License for the package.";
|
||||
default.value = lib.licenses.gpl3Plus;
|
||||
};
|
||||
|
||||
platforms = lib.options.create {
|
||||
type = lib.types.list.of lib.types.string;
|
||||
description = "Platforms the package supports.";
|
||||
default.value = [ "i686-linux" ];
|
||||
};
|
||||
};
|
||||
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for hex1.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage0.hex1 = {
|
||||
package = lib.modules.overrides.default (
|
||||
builders.raw.build {
|
||||
pname = "hex1";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = hex0.package;
|
||||
|
||||
args = [
|
||||
"${sources.base}/hex1_${architecture.base}.hex0"
|
||||
(builtins.placeholder "out")
|
||||
];
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,66 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage0.hex2-0;
|
||||
hex0 = config.aux.foundation.stages.stage0.hex0;
|
||||
hex1 = config.aux.foundation.stages.stage0.hex1;
|
||||
|
||||
system = config.aux.system;
|
||||
builders = config.aux.foundation.builders;
|
||||
sources = config.aux.foundation.stages.stage0.sources;
|
||||
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||
in
|
||||
{
|
||||
options.aux.foundation.stages.stage0.hex2-0 = {
|
||||
meta = {
|
||||
description = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Description for the package.";
|
||||
default.value = "Collection of tools for use in bootstrapping.";
|
||||
};
|
||||
|
||||
homepage = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Homepage for the package.";
|
||||
default.value = "https://github.com/oriansj/stage0-posix";
|
||||
};
|
||||
|
||||
license = lib.options.create {
|
||||
# TODO: Add a proper type for licenses.
|
||||
type = lib.types.attrs.any;
|
||||
description = "License for the package.";
|
||||
default.value = lib.licenses.gpl3Plus;
|
||||
};
|
||||
|
||||
platforms = lib.options.create {
|
||||
type = lib.types.list.of lib.types.string;
|
||||
description = "Platforms the package supports.";
|
||||
default.value = [ "i686-linux" ];
|
||||
};
|
||||
};
|
||||
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for hex2-0.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage0.hex2-0 = {
|
||||
package = lib.modules.overrides.default (
|
||||
builders.raw.build {
|
||||
pname = "hex2-0";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = hex1.package;
|
||||
|
||||
args = [
|
||||
"${sources.base}/hex2_${architecture.base}.hex1"
|
||||
(builtins.placeholder "out")
|
||||
];
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,74 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage0.catm;
|
||||
hex0 = config.aux.foundation.stages.stage0.hex0;
|
||||
hex1 = config.aux.foundation.stages.stage0.hex1;
|
||||
hex2-0 = config.aux.foundation.stages.stage0.hex2-0;
|
||||
|
||||
system = config.aux.system;
|
||||
builders = config.aux.foundation.builders;
|
||||
sources = config.aux.foundation.stages.stage0.sources;
|
||||
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||
in
|
||||
{
|
||||
options.aux.foundation.stages.stage0.catm = {
|
||||
meta = {
|
||||
description = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Description for the package.";
|
||||
default.value = "Collection of tools for use in bootstrapping.";
|
||||
};
|
||||
|
||||
homepage = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Homepage for the package.";
|
||||
default.value = "https://github.com/oriansj/stage0-posix";
|
||||
};
|
||||
|
||||
license = lib.options.create {
|
||||
# TODO: Add a proper type for licenses.
|
||||
type = lib.types.attrs.any;
|
||||
description = "License for the package.";
|
||||
default.value = lib.licenses.gpl3Plus;
|
||||
};
|
||||
|
||||
platforms = lib.options.create {
|
||||
type = lib.types.list.of lib.types.string;
|
||||
description = "Platforms the package supports.";
|
||||
default.value = [ "i686-linux" ];
|
||||
};
|
||||
};
|
||||
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for catm.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage0.catm = {
|
||||
package = lib.modules.overrides.default (
|
||||
builders.raw.build {
|
||||
pname = "catm";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = if architecture.base == "AArch64" then hex1.package else hex2-0.package;
|
||||
|
||||
args =
|
||||
if architecture.base == "AArch64" then
|
||||
[
|
||||
"${sources.base}/catm_${architecture.base}.hex1"
|
||||
(builtins.placeholder "out")
|
||||
]
|
||||
else
|
||||
[
|
||||
"${sources.base}/catm_${architecture.base}.hex2"
|
||||
(builtins.placeholder "out")
|
||||
];
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,84 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage0.M0;
|
||||
hex0 = config.aux.foundation.stages.stage0.hex0;
|
||||
hex2-0 = config.aux.foundation.stages.stage0.hex2-0;
|
||||
catm = config.aux.foundation.stages.stage0.catm;
|
||||
|
||||
system = config.aux.system;
|
||||
builders = config.aux.foundation.builders;
|
||||
sources = config.aux.foundation.stages.stage0.sources;
|
||||
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||
in
|
||||
{
|
||||
options.aux.foundation.stages.stage0.M0 = {
|
||||
meta = {
|
||||
description = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Description for the package.";
|
||||
default.value = "Collection of tools for use in bootstrapping.";
|
||||
};
|
||||
|
||||
homepage = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Homepage for the package.";
|
||||
default.value = "https://github.com/oriansj/stage0-posix";
|
||||
};
|
||||
|
||||
license = lib.options.create {
|
||||
# TODO: Add a proper type for licenses.
|
||||
type = lib.types.attrs.any;
|
||||
description = "License for the package.";
|
||||
default.value = lib.licenses.gpl3Plus;
|
||||
};
|
||||
|
||||
platforms = lib.options.create {
|
||||
type = lib.types.list.of lib.types.string;
|
||||
description = "Platforms the package supports.";
|
||||
default.value = [ "i686-linux" ];
|
||||
};
|
||||
};
|
||||
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for M0.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage0.M0 = {
|
||||
package = lib.modules.overrides.default (
|
||||
builders.raw.build {
|
||||
pname = "M0";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = hex2-0.package;
|
||||
|
||||
args =
|
||||
let
|
||||
M0_hex2-0 = builders.raw.build {
|
||||
pname = "M0_hex2-0";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = catm.package;
|
||||
|
||||
args = [
|
||||
(builtins.placeholder "out")
|
||||
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}.hex2"
|
||||
"${sources.base}/M0_${architecture.base}.hex2"
|
||||
];
|
||||
};
|
||||
in
|
||||
[
|
||||
M0_hex2-0
|
||||
(builtins.placeholder "out")
|
||||
];
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,98 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage0.cc_arch;
|
||||
hex0 = config.aux.foundation.stages.stage0.hex0;
|
||||
hex2-0 = config.aux.foundation.stages.stage0.hex2-0;
|
||||
catm = config.aux.foundation.stages.stage0.catm;
|
||||
M0 = config.aux.foundation.stages.stage0.M0;
|
||||
|
||||
system = config.aux.system;
|
||||
builders = config.aux.foundation.builders;
|
||||
sources = config.aux.foundation.stages.stage0.sources;
|
||||
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||
in
|
||||
{
|
||||
options.aux.foundation.stages.stage0.cc_arch = {
|
||||
meta = {
|
||||
description = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Description for the package.";
|
||||
default.value = "Collection of tools for use in bootstrapping.";
|
||||
};
|
||||
|
||||
homepage = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Homepage for the package.";
|
||||
default.value = "https://github.com/oriansj/stage0-posix";
|
||||
};
|
||||
|
||||
license = lib.options.create {
|
||||
# TODO: Add a proper type for licenses.
|
||||
type = lib.types.attrs.any;
|
||||
description = "License for the package.";
|
||||
default.value = lib.licenses.gpl3Plus;
|
||||
};
|
||||
|
||||
platforms = lib.options.create {
|
||||
type = lib.types.list.of lib.types.string;
|
||||
description = "Platforms the package supports.";
|
||||
default.value = [ "i686-linux" ];
|
||||
};
|
||||
};
|
||||
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for cc_arch.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage0.cc_arch = {
|
||||
package = lib.modules.overrides.default (
|
||||
builders.raw.build {
|
||||
pname = "cc_arch";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = hex2-0.package;
|
||||
|
||||
args =
|
||||
let
|
||||
cc_arch0_hex2-0 = builders.raw.build {
|
||||
pname = "cc_arch0_hex2-0";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = M0.package;
|
||||
|
||||
args = [
|
||||
"${sources.base}/cc_${architecture.m2libc}.M1"
|
||||
(builtins.placeholder "out")
|
||||
];
|
||||
};
|
||||
cc_arch1_hex2-0 = builders.raw.build {
|
||||
pname = "cc_arch1_hex2-0";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = catm.package;
|
||||
|
||||
args = [
|
||||
(builtins.placeholder "out")
|
||||
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}.hex2"
|
||||
cc_arch0_hex2-0
|
||||
];
|
||||
};
|
||||
in
|
||||
[
|
||||
cc_arch1_hex2-0
|
||||
(builtins.placeholder "out")
|
||||
];
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,149 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage0.M2;
|
||||
hex0 = config.aux.foundation.stages.stage0.hex0;
|
||||
hex2-0 = config.aux.foundation.stages.stage0.hex2-0;
|
||||
catm = config.aux.foundation.stages.stage0.catm;
|
||||
M0 = config.aux.foundation.stages.stage0.M0;
|
||||
cc_arch = config.aux.foundation.stages.stage0.cc_arch;
|
||||
|
||||
system = config.aux.system;
|
||||
builders = config.aux.foundation.builders;
|
||||
sources = config.aux.foundation.stages.stage0.sources;
|
||||
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||
in
|
||||
{
|
||||
options.aux.foundation.stages.stage0.M2 = {
|
||||
meta = {
|
||||
description = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Description for the package.";
|
||||
default.value = "Collection of tools for use in bootstrapping.";
|
||||
};
|
||||
|
||||
homepage = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Homepage for the package.";
|
||||
default.value = "https://github.com/oriansj/stage0-posix";
|
||||
};
|
||||
|
||||
license = lib.options.create {
|
||||
# TODO: Add a proper type for licenses.
|
||||
type = lib.types.attrs.any;
|
||||
description = "License for the package.";
|
||||
default.value = lib.licenses.gpl3Plus;
|
||||
};
|
||||
|
||||
platforms = lib.options.create {
|
||||
type = lib.types.list.of lib.types.string;
|
||||
description = "Platforms the package supports.";
|
||||
default.value = [ "i686-linux" ];
|
||||
};
|
||||
};
|
||||
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for M2.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage0.M2 = {
|
||||
package = lib.modules.overrides.default (
|
||||
builders.raw.build {
|
||||
pname = "M2";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = hex2-0.package;
|
||||
|
||||
args =
|
||||
let
|
||||
M2_c = builders.raw.build {
|
||||
pname = "M2_c";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = catm.package;
|
||||
|
||||
args = [
|
||||
(builtins.placeholder "out")
|
||||
"${sources.m2libc}/${architecture.m2libc}/linux/bootstrap.c"
|
||||
"${sources.m2planet}/cc.h"
|
||||
"${sources.m2libc}/bootstrappable.c"
|
||||
"${sources.m2planet}/cc_globals.c"
|
||||
"${sources.m2planet}/cc_reader.c"
|
||||
"${sources.m2planet}/cc_strings.c"
|
||||
"${sources.m2planet}/cc_types.c"
|
||||
"${sources.m2planet}/cc_core.c"
|
||||
"${sources.m2planet}/cc_macro.c"
|
||||
"${sources.m2planet}/cc.c"
|
||||
];
|
||||
};
|
||||
M2_M1 = builders.raw.build {
|
||||
pname = "M2_M1";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = cc_arch.package;
|
||||
|
||||
args = [
|
||||
M2_c
|
||||
(builtins.placeholder "out")
|
||||
];
|
||||
};
|
||||
M2_M1' = builders.raw.build {
|
||||
pname = "M2_M1";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = catm.package;
|
||||
|
||||
args = [
|
||||
(builtins.placeholder "out")
|
||||
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
|
||||
"${sources.m2libc}/${architecture.m2libc}/libc-core.M1"
|
||||
M2_M1
|
||||
];
|
||||
};
|
||||
M2_hex2-0 = builders.raw.build {
|
||||
pname = "M2_hex2-0";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = M0.package;
|
||||
|
||||
args = [
|
||||
M2_M1'
|
||||
(builtins.placeholder "out")
|
||||
];
|
||||
};
|
||||
M2_hex2-0' = builders.raw.build {
|
||||
pname = "M2_hex2-0";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = catm.package;
|
||||
|
||||
args = [
|
||||
(builtins.placeholder "out")
|
||||
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}.hex2"
|
||||
M2_hex2-0
|
||||
];
|
||||
};
|
||||
in
|
||||
[
|
||||
M2_hex2-0'
|
||||
(builtins.placeholder "out")
|
||||
];
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,139 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage0.blood-elf;
|
||||
hex0 = config.aux.foundation.stages.stage0.hex0;
|
||||
hex2-0 = config.aux.foundation.stages.stage0.hex2-0;
|
||||
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;
|
||||
|
||||
system = config.aux.system;
|
||||
builders = config.aux.foundation.builders;
|
||||
sources = config.aux.foundation.stages.stage0.sources;
|
||||
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||
in
|
||||
{
|
||||
options.aux.foundation.stages.stage0.blood-elf = {
|
||||
meta = {
|
||||
description = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Description for the package.";
|
||||
default.value = "Collection of tools for use in bootstrapping.";
|
||||
};
|
||||
|
||||
homepage = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Homepage for the package.";
|
||||
default.value = "https://github.com/oriansj/stage0-posix";
|
||||
};
|
||||
|
||||
license = lib.options.create {
|
||||
# TODO: Add a proper type for licenses.
|
||||
type = lib.types.attrs.any;
|
||||
description = "License for the package.";
|
||||
default.value = lib.licenses.gpl3Plus;
|
||||
};
|
||||
|
||||
platforms = lib.options.create {
|
||||
type = lib.types.list.of lib.types.string;
|
||||
description = "Platforms the package supports.";
|
||||
default.value = [ "i686-linux" ];
|
||||
};
|
||||
};
|
||||
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for blood-elf.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage0.blood-elf = {
|
||||
package = lib.modules.overrides.default (
|
||||
builders.raw.build {
|
||||
pname = "blood-elf";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = hex2-0.package;
|
||||
|
||||
args =
|
||||
let
|
||||
blood-elf_M1 = builders.raw.build {
|
||||
pname = "blood-elf_M1";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = M2.package;
|
||||
|
||||
args = [
|
||||
"--architecture"
|
||||
architecture.m2libc
|
||||
"-f"
|
||||
"${sources.m2libc}/${architecture.m2libc}/linux/bootstrap.c"
|
||||
"-f"
|
||||
"${sources.m2libc}/bootstrappable.c"
|
||||
"-f"
|
||||
"${sources.mescc-tools}/stringify.c"
|
||||
"-f"
|
||||
"${sources.mescc-tools}/blood-elf.c"
|
||||
"--bootstrap-mode"
|
||||
"-o"
|
||||
(builtins.placeholder "out")
|
||||
];
|
||||
};
|
||||
blood-elf_M1' = builders.raw.build {
|
||||
pname = "blood-elf_M1-1";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = catm.package;
|
||||
|
||||
args = [
|
||||
(builtins.placeholder "out")
|
||||
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
|
||||
"${sources.m2libc}/${architecture.m2libc}/libc-core.M1"
|
||||
blood-elf_M1
|
||||
];
|
||||
};
|
||||
blood-elf_hex2-0 = builders.raw.build {
|
||||
pname = "blood-elf_hex2-0";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = M0.package;
|
||||
|
||||
args = [
|
||||
blood-elf_M1'
|
||||
(builtins.placeholder "out")
|
||||
];
|
||||
};
|
||||
blood-elf_hex2-0' = builders.raw.build {
|
||||
pname = "blood-elf_hex2-0-1";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = catm.package;
|
||||
|
||||
args = [
|
||||
(builtins.placeholder "out")
|
||||
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}.hex2"
|
||||
blood-elf_hex2-0
|
||||
];
|
||||
};
|
||||
in
|
||||
[
|
||||
blood-elf_hex2-0'
|
||||
(builtins.placeholder "out")
|
||||
];
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,158 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage0.M1-0;
|
||||
hex0 = config.aux.foundation.stages.stage0.hex0;
|
||||
hex2-0 = config.aux.foundation.stages.stage0.hex2-0;
|
||||
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;
|
||||
|
||||
system = config.aux.system;
|
||||
builders = config.aux.foundation.builders;
|
||||
sources = config.aux.foundation.stages.stage0.sources;
|
||||
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||
in
|
||||
{
|
||||
options.aux.foundation.stages.stage0.M1-0 = {
|
||||
meta = {
|
||||
description = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Description for the package.";
|
||||
default.value = "Collection of tools for use in bootstrapping.";
|
||||
};
|
||||
|
||||
homepage = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Homepage for the package.";
|
||||
default.value = "https://github.com/oriansj/stage0-posix";
|
||||
};
|
||||
|
||||
license = lib.options.create {
|
||||
# TODO: Add a proper type for licenses.
|
||||
type = lib.types.attrs.any;
|
||||
description = "License for the package.";
|
||||
default.value = lib.licenses.gpl3Plus;
|
||||
};
|
||||
|
||||
platforms = lib.options.create {
|
||||
type = lib.types.list.of lib.types.string;
|
||||
description = "Platforms the package supports.";
|
||||
default.value = [ "i686-linux" ];
|
||||
};
|
||||
};
|
||||
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for M1-0.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage0.M1-0 = {
|
||||
package = lib.modules.overrides.default (
|
||||
builders.raw.build {
|
||||
pname = "M1-0";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = hex2-0.package;
|
||||
|
||||
args =
|
||||
let
|
||||
M1-macro-0_M1 = builders.raw.build {
|
||||
pname = "M1-macro-0_M1";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = M2.package;
|
||||
|
||||
args = [
|
||||
"--architecture"
|
||||
architecture.m2libc
|
||||
"-f"
|
||||
"${sources.m2libc}/${architecture.m2libc}/linux/bootstrap.c"
|
||||
"-f"
|
||||
"${sources.m2libc}/bootstrappable.c"
|
||||
"-f"
|
||||
"${sources.mescc-tools}/stringify.c"
|
||||
"-f"
|
||||
"${sources.mescc-tools}/M1-macro.c"
|
||||
"--bootstrap-mode"
|
||||
"--debug"
|
||||
"-o"
|
||||
(builtins.placeholder "out")
|
||||
];
|
||||
};
|
||||
M1-macro-0-footer_M1 = builders.raw.build {
|
||||
pname = "M1-macro-0-footer_M1";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = blood-elf.package;
|
||||
|
||||
args = (lib.lists.when (config.aux.platform.bits == 64) "--64") ++ [
|
||||
"-f"
|
||||
M1-macro-0_M1
|
||||
(if config.aux.platform.endian == "little" then "--little-endian" else "--big-endian")
|
||||
"-o"
|
||||
(builtins.placeholder "out")
|
||||
];
|
||||
};
|
||||
M1-macro-0_M1' = builders.raw.build {
|
||||
pname = "M1-macro-0_M1-1";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = catm.package;
|
||||
|
||||
args = [
|
||||
(builtins.placeholder "out")
|
||||
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
|
||||
"${sources.m2libc}/${architecture.m2libc}/libc-core.M1"
|
||||
M1-macro-0_M1
|
||||
M1-macro-0-footer_M1
|
||||
];
|
||||
};
|
||||
M1-macro-0_hex2-0 = builders.raw.build {
|
||||
pname = "M1-macro-0_hex2-0";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = M0.package;
|
||||
|
||||
args = [
|
||||
M1-macro-0_M1'
|
||||
(builtins.placeholder "out")
|
||||
];
|
||||
};
|
||||
M1-macro-0_hex2-0' = builders.raw.build {
|
||||
pname = "M1-macro-0_hex2-0-1";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = catm.package;
|
||||
|
||||
args = [
|
||||
(builtins.placeholder "out")
|
||||
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}-debug.hex2"
|
||||
M1-macro-0_hex2-0
|
||||
];
|
||||
};
|
||||
in
|
||||
[
|
||||
M1-macro-0_hex2-0'
|
||||
(builtins.placeholder "out")
|
||||
];
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,173 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage0.hex2-1;
|
||||
hex0 = config.aux.foundation.stages.stage0.hex0;
|
||||
hex2-0 = config.aux.foundation.stages.stage0.hex2-0;
|
||||
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-0 = config.aux.foundation.stages.stage0.M1-0;
|
||||
|
||||
system = config.aux.system;
|
||||
builders = config.aux.foundation.builders;
|
||||
sources = config.aux.foundation.stages.stage0.sources;
|
||||
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||
in
|
||||
{
|
||||
options.aux.foundation.stages.stage0.hex2-1 = {
|
||||
meta = {
|
||||
description = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Description for the package.";
|
||||
default.value = "Collection of tools for use in bootstrapping.";
|
||||
};
|
||||
|
||||
homepage = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Homepage for the package.";
|
||||
default.value = "https://github.com/oriansj/stage0-posix";
|
||||
};
|
||||
|
||||
license = lib.options.create {
|
||||
# TODO: Add a proper type for licenses.
|
||||
type = lib.types.attrs.any;
|
||||
description = "License for the package.";
|
||||
default.value = lib.licenses.gpl3Plus;
|
||||
};
|
||||
|
||||
platforms = lib.options.create {
|
||||
type = lib.types.list.of lib.types.string;
|
||||
description = "Platforms the package supports.";
|
||||
default.value = [ "i686-linux" ];
|
||||
};
|
||||
};
|
||||
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for hex2-1.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage0.hex2-1 = {
|
||||
package = lib.modules.overrides.default (
|
||||
builders.raw.build {
|
||||
pname = "hex2-1";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = hex2-0.package;
|
||||
|
||||
args =
|
||||
let
|
||||
hex2_linker_M1 = builders.raw.build {
|
||||
pname = "hex2_linker_M1";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = M2.package;
|
||||
|
||||
args = [
|
||||
"--architecture"
|
||||
architecture.m2libc
|
||||
"-f"
|
||||
"${sources.m2libc}/sys/types.h"
|
||||
"-f"
|
||||
"${sources.m2libc}/stddef.h"
|
||||
"-f"
|
||||
"${sources.m2libc}/${architecture.m2libc}/linux/unistd.c"
|
||||
"-f"
|
||||
"${sources.m2libc}/${architecture.m2libc}/linux/fcntl.c"
|
||||
"-f"
|
||||
"${sources.m2libc}/fcntl.c"
|
||||
"-f"
|
||||
"${sources.m2libc}/${architecture.m2libc}/linux/sys/stat.c"
|
||||
"-f"
|
||||
"${sources.m2libc}/stdlib.c"
|
||||
"-f"
|
||||
"${sources.m2libc}/stdio.h"
|
||||
"-f"
|
||||
"${sources.m2libc}/stdio.c"
|
||||
"-f"
|
||||
"${sources.m2libc}/bootstrappable.c"
|
||||
"-f"
|
||||
"${sources.mescc-tools}/hex2.h"
|
||||
"-f"
|
||||
"${sources.mescc-tools}/hex2_linker.c"
|
||||
"-f"
|
||||
"${sources.mescc-tools}/hex2_word.c"
|
||||
"-f"
|
||||
"${sources.mescc-tools}/hex2.c"
|
||||
"--debug"
|
||||
"-o"
|
||||
(builtins.placeholder "out")
|
||||
];
|
||||
};
|
||||
hex2_linker-footer_M1 = builders.raw.build {
|
||||
pname = "hex2_linker-footer_M1";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = blood-elf.package;
|
||||
|
||||
args = (lib.lists.when (config.aux.platform.bits == 64) "--64") ++ [
|
||||
"-f"
|
||||
hex2_linker_M1
|
||||
(if config.aux.platform.endian == "little" then "--little-endian" else "--big-endian")
|
||||
"-o"
|
||||
(builtins.placeholder "out")
|
||||
];
|
||||
};
|
||||
hex2_linker_hex2 = builders.raw.build {
|
||||
pname = "hex2_linker_hex2";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = M1-0.package;
|
||||
|
||||
args = [
|
||||
"--architecture"
|
||||
architecture.m2libc
|
||||
(if config.aux.platform.endian == "little" then "--little-endian" else "--big-endian")
|
||||
"-f"
|
||||
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
|
||||
"-f"
|
||||
"${sources.m2libc}/${architecture.m2libc}/libc-full.M1"
|
||||
"-f"
|
||||
hex2_linker_M1
|
||||
"-f"
|
||||
hex2_linker-footer_M1
|
||||
"-o"
|
||||
(builtins.placeholder "out")
|
||||
];
|
||||
};
|
||||
hex2_linker_hex2' = builders.raw.build {
|
||||
pname = "hex2_linker_hex2-1";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = catm.package;
|
||||
|
||||
args = [
|
||||
(builtins.placeholder "out")
|
||||
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}-debug.hex2"
|
||||
hex2_linker_hex2
|
||||
];
|
||||
};
|
||||
in
|
||||
[
|
||||
hex2_linker_hex2'
|
||||
(builtins.placeholder "out")
|
||||
];
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,176 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage0.M1;
|
||||
hex0 = config.aux.foundation.stages.stage0.hex0;
|
||||
hex2-0 = config.aux.foundation.stages.stage0.hex2-0;
|
||||
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-0 = config.aux.foundation.stages.stage0.M1-0;
|
||||
hex2-1 = config.aux.foundation.stages.stage0.hex2-1;
|
||||
|
||||
system = config.aux.system;
|
||||
builders = config.aux.foundation.builders;
|
||||
sources = config.aux.foundation.stages.stage0.sources;
|
||||
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||
in
|
||||
{
|
||||
options.aux.foundation.stages.stage0.M1 = {
|
||||
meta = {
|
||||
description = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Description for the package.";
|
||||
default.value = "Collection of tools for use in bootstrapping.";
|
||||
};
|
||||
|
||||
homepage = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Homepage for the package.";
|
||||
default.value = "https://github.com/oriansj/stage0-posix";
|
||||
};
|
||||
|
||||
license = lib.options.create {
|
||||
# TODO: Add a proper type for licenses.
|
||||
type = lib.types.attrs.any;
|
||||
description = "License for the package.";
|
||||
default.value = lib.licenses.gpl3Plus;
|
||||
};
|
||||
|
||||
platforms = lib.options.create {
|
||||
type = lib.types.list.of lib.types.string;
|
||||
description = "Platforms the package supports.";
|
||||
default.value = [ "i686-linux" ];
|
||||
};
|
||||
};
|
||||
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for M1.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage0.M1 = {
|
||||
package = lib.modules.overrides.default (
|
||||
builders.raw.build {
|
||||
pname = "M1";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = hex2-1.package;
|
||||
|
||||
args =
|
||||
let
|
||||
M1-macro_M1 = builders.raw.build {
|
||||
pname = "M1-macro_M1";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = M2.package;
|
||||
|
||||
args = [
|
||||
"--architecture"
|
||||
architecture.m2libc
|
||||
"-f"
|
||||
"${sources.m2libc}/sys/types.h"
|
||||
"-f"
|
||||
"${sources.m2libc}/stddef.h"
|
||||
"-f"
|
||||
"${sources.m2libc}/${architecture.m2libc}/linux/unistd.c"
|
||||
"-f"
|
||||
"${sources.m2libc}/${architecture.m2libc}/linux/fcntl.c"
|
||||
"-f"
|
||||
"${sources.m2libc}/fcntl.c"
|
||||
"-f"
|
||||
"${sources.m2libc}/${architecture.m2libc}/linux/sys/stat.c"
|
||||
"-f"
|
||||
"${sources.m2libc}/string.c"
|
||||
"-f"
|
||||
"${sources.m2libc}/stdlib.c"
|
||||
"-f"
|
||||
"${sources.m2libc}/stdio.h"
|
||||
"-f"
|
||||
"${sources.m2libc}/stdio.c"
|
||||
"-f"
|
||||
"${sources.m2libc}/bootstrappable.c"
|
||||
"-f"
|
||||
"${sources.mescc-tools}/stringify.c"
|
||||
"-f"
|
||||
"${sources.mescc-tools}/M1-macro.c"
|
||||
"--debug"
|
||||
"-o"
|
||||
(builtins.placeholder "out")
|
||||
];
|
||||
};
|
||||
M1-macro-footer_M1 = builders.raw.build {
|
||||
pname = "M1-macro-footer_M1";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = blood-elf.package;
|
||||
|
||||
args = (lib.lists.when (config.aux.platform.bits == 64) "--64") ++ [
|
||||
"-f"
|
||||
M1-macro_M1
|
||||
(if config.aux.platform.endian == "little" then "--little-endian" else "--big-endian")
|
||||
"-o"
|
||||
(builtins.placeholder "out")
|
||||
];
|
||||
};
|
||||
M1-macro_hex2 = builders.raw.build {
|
||||
pname = "M1-macro_hex2";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = M1-0.package;
|
||||
|
||||
args = [
|
||||
"--architecture"
|
||||
architecture.m2libc
|
||||
(if config.aux.platform.endian == "little" then "--little-endian" else "--big-endian")
|
||||
"-f"
|
||||
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
|
||||
"-f"
|
||||
"${sources.m2libc}/${architecture.m2libc}/libc-full.M1"
|
||||
"-f"
|
||||
M1-macro_M1
|
||||
"-f"
|
||||
M1-macro-footer_M1
|
||||
"-o"
|
||||
(builtins.placeholder "out")
|
||||
];
|
||||
};
|
||||
in
|
||||
[
|
||||
"--architecture"
|
||||
architecture.m2libc
|
||||
(if config.aux.platform.endian == "little" then "--little-endian" else "--big-endian")
|
||||
"--base-address"
|
||||
(
|
||||
if config.aux.system == "x86_64-linux" then
|
||||
"0x00600000"
|
||||
else if config.aux.system == "aarch64-linux" then
|
||||
"0x00600000"
|
||||
else if config.aux.system == "i686-linux" then
|
||||
"0x08048000"
|
||||
else
|
||||
builtins.throw "Unsupported system: ${config.aux.system}"
|
||||
)
|
||||
"-f"
|
||||
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}-debug.hex2"
|
||||
"-f"
|
||||
M1-macro_hex2
|
||||
"-o"
|
||||
(builtins.placeholder "out")
|
||||
];
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,177 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage0.hex2;
|
||||
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-1 = config.aux.foundation.stages.stage0.hex2-1;
|
||||
|
||||
system = config.aux.system;
|
||||
builders = config.aux.foundation.builders;
|
||||
sources = config.aux.foundation.stages.stage0.sources;
|
||||
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||
in
|
||||
{
|
||||
options.aux.foundation.stages.stage0.hex2 = {
|
||||
meta = {
|
||||
description = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Description for the package.";
|
||||
default.value = "Collection of tools for use in bootstrapping.";
|
||||
};
|
||||
|
||||
homepage = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Homepage for the package.";
|
||||
default.value = "https://github.com/oriansj/stage0-posix";
|
||||
};
|
||||
|
||||
license = lib.options.create {
|
||||
# TODO: Add a proper type for licenses.
|
||||
type = lib.types.attrs.any;
|
||||
description = "License for the package.";
|
||||
default.value = lib.licenses.gpl3Plus;
|
||||
};
|
||||
|
||||
platforms = lib.options.create {
|
||||
type = lib.types.list.of lib.types.string;
|
||||
description = "Platforms the package supports.";
|
||||
default.value = [ "i686-linux" ];
|
||||
};
|
||||
};
|
||||
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for hex2.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage0.hex2 = {
|
||||
package = lib.modules.overrides.default (
|
||||
builders.raw.build {
|
||||
pname = "hex2";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = hex2-1.package;
|
||||
|
||||
args =
|
||||
let
|
||||
hex2_linker_M1 = builders.raw.build {
|
||||
pname = "hex2_linker_M1";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = M2.package;
|
||||
|
||||
args = [
|
||||
"--architecture"
|
||||
architecture.m2libc
|
||||
"-f"
|
||||
"${sources.m2libc}/sys/types.h"
|
||||
"-f"
|
||||
"${sources.m2libc}/stddef.h"
|
||||
"-f"
|
||||
"${sources.m2libc}/${architecture.m2libc}/linux/unistd.c"
|
||||
"-f"
|
||||
"${sources.m2libc}/${architecture.m2libc}/linux/fcntl.c"
|
||||
"-f"
|
||||
"${sources.m2libc}/fcntl.c"
|
||||
"-f"
|
||||
"${sources.m2libc}/${architecture.m2libc}/linux/sys/stat.c"
|
||||
"-f"
|
||||
"${sources.m2libc}/stdlib.c"
|
||||
"-f"
|
||||
"${sources.m2libc}/stdio.h"
|
||||
"-f"
|
||||
"${sources.m2libc}/stdio.c"
|
||||
"-f"
|
||||
"${sources.m2libc}/bootstrappable.c"
|
||||
"-f"
|
||||
"${sources.mescc-tools}/hex2.h"
|
||||
"-f"
|
||||
"${sources.mescc-tools}/hex2_linker.c"
|
||||
"-f"
|
||||
"${sources.mescc-tools}/hex2_word.c"
|
||||
"-f"
|
||||
"${sources.mescc-tools}/hex2.c"
|
||||
"--debug"
|
||||
"-o"
|
||||
(builtins.placeholder "out")
|
||||
];
|
||||
};
|
||||
hex2_linker-footer_M1 = builders.raw.build {
|
||||
pname = "hex2_linker-footer_M1";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = blood-elf.package;
|
||||
|
||||
args = (lib.lists.when (config.aux.platform.bits == 64) "--64") ++ [
|
||||
"-f"
|
||||
hex2_linker_M1
|
||||
(if config.aux.platform.endian == "little" then "--little-endian" else "--big-endian")
|
||||
"-o"
|
||||
(builtins.placeholder "out")
|
||||
];
|
||||
};
|
||||
hex2_linker_hex2 = builders.raw.build {
|
||||
pname = "hex2_linker_hex2";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = M1.package;
|
||||
|
||||
args = [
|
||||
"--architecture"
|
||||
architecture.m2libc
|
||||
(if config.aux.platform.endian == "little" then "--little-endian" else "--big-endian")
|
||||
"-f"
|
||||
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
|
||||
"-f"
|
||||
"${sources.m2libc}/${architecture.m2libc}/libc-full.M1"
|
||||
"-f"
|
||||
hex2_linker_M1
|
||||
"-f"
|
||||
hex2_linker-footer_M1
|
||||
"-o"
|
||||
(builtins.placeholder "out")
|
||||
];
|
||||
};
|
||||
in
|
||||
[
|
||||
"--architecture"
|
||||
architecture.m2libc
|
||||
(if config.aux.platform.endian == "little" then "--little-endian" else "--big-endian")
|
||||
"--base-address"
|
||||
(
|
||||
if config.aux.system == "x86_64-linux" then
|
||||
"0x00600000"
|
||||
else if config.aux.system == "aarch64-linux" then
|
||||
"0x00600000"
|
||||
else if config.aux.system == "i686-linux" then
|
||||
"0x08048000"
|
||||
else
|
||||
builtins.throw "Unsupported system: ${config.aux.system}"
|
||||
)
|
||||
"-f"
|
||||
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}-debug.hex2"
|
||||
"-f"
|
||||
hex2_linker_hex2
|
||||
"-o"
|
||||
(builtins.placeholder "out")
|
||||
];
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,179 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage0.kaem-unwrapped;
|
||||
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;
|
||||
|
||||
system = config.aux.system;
|
||||
builders = config.aux.foundation.builders;
|
||||
sources = config.aux.foundation.stages.stage0.sources;
|
||||
architecture = config.aux.foundation.stages.stage0.architecture;
|
||||
in
|
||||
{
|
||||
options.aux.foundation.stages.stage0.kaem-unwrapped = {
|
||||
meta = {
|
||||
description = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Description for the package.";
|
||||
default.value = "Collection of tools for use in bootstrapping.";
|
||||
};
|
||||
|
||||
homepage = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Homepage for the package.";
|
||||
default.value = "https://github.com/oriansj/stage0-posix";
|
||||
};
|
||||
|
||||
license = lib.options.create {
|
||||
# TODO: Add a proper type for licenses.
|
||||
type = lib.types.attrs.any;
|
||||
description = "License for the package.";
|
||||
default.value = lib.licenses.gpl3Plus;
|
||||
};
|
||||
|
||||
platforms = lib.options.create {
|
||||
type = lib.types.list.of lib.types.string;
|
||||
description = "Platforms the package supports.";
|
||||
default.value = [ "i686-linux" ];
|
||||
};
|
||||
};
|
||||
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for kaem-unwrapped.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage0.kaem-unwrapped = {
|
||||
package = lib.modules.overrides.default (
|
||||
builders.raw.build {
|
||||
pname = "kaem-unwrapped";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = hex2.package;
|
||||
|
||||
args =
|
||||
let
|
||||
kaem_M1 = builders.raw.build {
|
||||
pname = "kaem_M1";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = M2.package;
|
||||
|
||||
args = [
|
||||
"--architecture"
|
||||
architecture.m2libc
|
||||
"-f"
|
||||
"${sources.m2libc}/sys/types.h"
|
||||
"-f"
|
||||
"${sources.m2libc}/stddef.h"
|
||||
"-f"
|
||||
"${sources.m2libc}/${architecture.m2libc}/linux/unistd.c"
|
||||
"-f"
|
||||
"${sources.m2libc}/${architecture.m2libc}/linux/fcntl.c"
|
||||
"-f"
|
||||
"${sources.m2libc}/fcntl.c"
|
||||
"-f"
|
||||
"${sources.m2libc}/${architecture.m2libc}/linux/sys/stat.c"
|
||||
"-f"
|
||||
"${sources.m2libc}/string.c"
|
||||
"-f"
|
||||
"${sources.m2libc}/stdlib.c"
|
||||
"-f"
|
||||
"${sources.m2libc}/stdio.h"
|
||||
"-f"
|
||||
"${sources.m2libc}/stdio.c"
|
||||
"-f"
|
||||
"${sources.m2libc}/bootstrappable.c"
|
||||
"-f"
|
||||
"${sources.mescc-tools}/Kaem/kaem.h"
|
||||
"-f"
|
||||
"${sources.mescc-tools}/Kaem/variable.c"
|
||||
"-f"
|
||||
"${sources.mescc-tools}/Kaem/kaem_globals.c"
|
||||
"-f"
|
||||
"${sources.mescc-tools}/Kaem/kaem.c"
|
||||
"--debug"
|
||||
"-o"
|
||||
(builtins.placeholder "out")
|
||||
];
|
||||
};
|
||||
kaem-footer_M1 = builders.raw.build {
|
||||
pname = "kaem-footer_M1";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = blood-elf.package;
|
||||
|
||||
args = (lib.lists.when (config.aux.platform.bits == 64) "--64") ++ [
|
||||
"-f"
|
||||
kaem_M1
|
||||
(if config.aux.platform.endian == "little" then "--little-endian" else "--big-endian")
|
||||
"-o"
|
||||
(builtins.placeholder "out")
|
||||
];
|
||||
};
|
||||
kaem_hex2 = builders.raw.build {
|
||||
pname = "kaem_hex2";
|
||||
version = "1.6.0";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
executable = M1.package;
|
||||
|
||||
args = [
|
||||
"--architecture"
|
||||
architecture.m2libc
|
||||
(if config.aux.platform.endian == "little" then "--little-endian" else "--big-endian")
|
||||
"-f"
|
||||
"${sources.m2libc}/${architecture.m2libc}/${architecture.m2libc}_defs.M1"
|
||||
"-f"
|
||||
"${sources.m2libc}/${architecture.m2libc}/libc-full.M1"
|
||||
"-f"
|
||||
kaem_M1
|
||||
"-f"
|
||||
kaem-footer_M1
|
||||
"-o"
|
||||
(builtins.placeholder "out")
|
||||
];
|
||||
};
|
||||
in
|
||||
[
|
||||
"--architecture"
|
||||
architecture.m2libc
|
||||
(if config.aux.platform.endian == "little" then "--little-endian" else "--big-endian")
|
||||
"--base-address"
|
||||
(
|
||||
if config.aux.system == "x86_64-linux" then
|
||||
"0x00600000"
|
||||
else if config.aux.system == "aarch64-linux" then
|
||||
"0x00600000"
|
||||
else if config.aux.system == "i686-linux" then
|
||||
"0x08048000"
|
||||
else
|
||||
builtins.throw "Unsupported system: ${config.aux.system}"
|
||||
)
|
||||
"-f"
|
||||
"${sources.m2libc}/${architecture.m2libc}/ELF-${architecture.m2libc}-debug.hex2"
|
||||
"-f"
|
||||
kaem_hex2
|
||||
"-o"
|
||||
(builtins.placeholder "out")
|
||||
];
|
||||
}
|
||||
);
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,92 +0,0 @@
|
|||
{ 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";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,162 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage1.bash.boot;
|
||||
|
||||
builders = config.aux.foundation.builders;
|
||||
|
||||
stage1 = config.aux.foundation.stages.stage1;
|
||||
in
|
||||
{
|
||||
options.aux.foundation.stages.stage1.bash.boot = {
|
||||
meta = {
|
||||
description = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Description for the package.";
|
||||
default.value = "GNU Bourne-Again Shell, the de facto standard shell on Linux";
|
||||
};
|
||||
|
||||
homepage = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Homepage for the package.";
|
||||
default.value = "https://www.gnu.org/software/bash";
|
||||
};
|
||||
|
||||
license = lib.options.create {
|
||||
# TODO: Add a proper type for licenses.
|
||||
type = lib.types.attrs.any;
|
||||
description = "License for the package.";
|
||||
default.value = lib.licenses.gpl3Plus;
|
||||
};
|
||||
|
||||
platforms = lib.options.create {
|
||||
type = lib.types.list.of lib.types.string;
|
||||
description = "Platforms the package supports.";
|
||||
default.value = [ "i686-linux" ];
|
||||
};
|
||||
};
|
||||
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for bash-boot.";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of the package.";
|
||||
};
|
||||
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "Source for the package.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage1.bash.boot = {
|
||||
version = "2.05b";
|
||||
|
||||
src = builtins.fetchurl {
|
||||
url = "${config.aux.mirrors.gnu}/bash/bash-${cfg.version}.tar.gz";
|
||||
sha256 = "1r1z2qdw3rz668nxrzwa14vk2zcn00hw7mpjn384picck49d80xs";
|
||||
};
|
||||
|
||||
package =
|
||||
let
|
||||
# Thanks to the live-bootstrap project!
|
||||
# See https://github.com/fosslinux/live-bootstrap/blob/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/bash-2.05b/bash-2.05b.kaem
|
||||
liveBootstrap = "https://github.com/fosslinux/live-bootstrap/raw/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/bash-2.05b";
|
||||
|
||||
main_mk = builtins.fetchurl {
|
||||
url = "${liveBootstrap}/mk/main.mk";
|
||||
sha256 = "0hj29q3pq3370p18sxkpvv9flb7yvx2fs96xxlxqlwa8lkimd0j4";
|
||||
};
|
||||
|
||||
common_mk = builtins.fetchurl {
|
||||
url = "${liveBootstrap}/mk/common.mk";
|
||||
sha256 = "09rigxxf85p2ybnq248sai1gdx95yykc8jmwi4yjx389zh09mcr8";
|
||||
};
|
||||
|
||||
builtins_mk = builtins.fetchurl {
|
||||
url = "${liveBootstrap}/mk/builtins.mk";
|
||||
sha256 = "0939dy5by1xhfmsjj6w63nlgk509fjrhpb2crics3dpcv7prl8lj";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# mes libc does not have locale support
|
||||
(builtins.fetchurl {
|
||||
url = "${liveBootstrap}/patches/mes-libc.patch";
|
||||
sha256 = "0zksdjf6zbb3p4hqg6plq631y76hhhgab7kdvf7cnpk8bcykn12z";
|
||||
})
|
||||
# int name, namelen; is wrong for mes libc, it is char* name, so we modify tinycc
|
||||
# to reflect this.
|
||||
(builtins.fetchurl {
|
||||
url = "${liveBootstrap}/patches/tinycc.patch";
|
||||
sha256 = "042d2kr4a8klazk1hlvphxr6frn4mr53k957aq3apf6lbvrjgcj2";
|
||||
})
|
||||
# add ifdef's for features we don't want
|
||||
(builtins.fetchurl {
|
||||
url = "${liveBootstrap}/patches/missing-defines.patch";
|
||||
sha256 = "1q0k1kj5mrvjkqqly7ki5575a5b3hy1ywnmvhrln318yh67qnkj4";
|
||||
})
|
||||
# mes libc + setting locale = not worky
|
||||
(builtins.fetchurl {
|
||||
url = "${liveBootstrap}/patches/locale.patch";
|
||||
sha256 = "1p1q1slhafsgj8x4k0dpn9h6ryq5fwfx7dicbbxhldbw7zvnnbx9";
|
||||
})
|
||||
# We do not have /dev at this stage of the bootstrap, including /dev/tty
|
||||
(builtins.fetchurl {
|
||||
url = "${liveBootstrap}/patches/dev-tty.patch";
|
||||
sha256 = "1315slv5f7ziajqyxg4jlyanf1xwd06xw14y6pq7xpm3jzjk55j9";
|
||||
})
|
||||
];
|
||||
in
|
||||
builders.kaem.build {
|
||||
name = "bash-${cfg.version}";
|
||||
|
||||
meta = cfg.meta;
|
||||
src = cfg.src;
|
||||
|
||||
deps.build.host = [
|
||||
stage1.tinycc.mes.compiler.package
|
||||
stage1.gnumake.boot.package
|
||||
stage1.gnupatch.package
|
||||
stage1.coreutils.boot.package
|
||||
];
|
||||
|
||||
script = ''
|
||||
# Unpack
|
||||
ungz --file ${cfg.src} --output bash.tar
|
||||
untar --file bash.tar
|
||||
rm bash.tar
|
||||
cd bash-${cfg.version}
|
||||
|
||||
# Patch
|
||||
${lib.strings.concatMapSep "\n" (file: "patch -Np0 -i ${file}") patches}
|
||||
|
||||
# Configure
|
||||
cp ${main_mk} Makefile
|
||||
cp ${builtins_mk} builtins/Makefile
|
||||
cp ${common_mk} common.mk
|
||||
touch config.h
|
||||
touch include/version.h
|
||||
touch include/pipesize.h
|
||||
|
||||
# Build
|
||||
make \
|
||||
CC="tcc -B ${stage1.tinycc.mes.libs.package}/lib" \
|
||||
mkbuiltins
|
||||
cd builtins
|
||||
make \
|
||||
CC="tcc -B ${stage1.tinycc.mes.libs.package}/lib" \
|
||||
libbuiltins.a
|
||||
cd ..
|
||||
make CC="tcc -B ${stage1.tinycc.mes.libs.package}/lib"
|
||||
|
||||
# Install
|
||||
install -D bash ''${out}/bin/bash
|
||||
ln -s bash ''${out}/bin/sh
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,125 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage1.bash;
|
||||
|
||||
platform = config.aux.platform;
|
||||
builders = config.aux.foundation.builders;
|
||||
|
||||
stage1 = config.aux.foundation.stages.stage1;
|
||||
in
|
||||
{
|
||||
includes = [ ./boot.nix ];
|
||||
|
||||
options.aux.foundation.stages.stage1.bash = {
|
||||
meta = {
|
||||
description = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Description for the package.";
|
||||
default.value = "GNU Bourne-Again Shell, the de facto standard shell on Linux";
|
||||
};
|
||||
|
||||
homepage = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Homepage for the package.";
|
||||
default.value = "https://www.gnu.org/software/bash";
|
||||
};
|
||||
|
||||
license = lib.options.create {
|
||||
# TODO: Add a proper type for licenses.
|
||||
type = lib.types.attrs.any;
|
||||
description = "License for the package.";
|
||||
default.value = lib.licenses.gpl3Plus;
|
||||
};
|
||||
|
||||
platforms = lib.options.create {
|
||||
type = lib.types.list.of lib.types.string;
|
||||
description = "Platforms the package supports.";
|
||||
default.value = [ "i686-linux" ];
|
||||
};
|
||||
|
||||
mainProgram = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "The main program of the package.";
|
||||
default.value = "bash";
|
||||
};
|
||||
};
|
||||
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for bash.";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of the package.";
|
||||
};
|
||||
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "Source for the package.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage1.bash = {
|
||||
version = "5.2.15";
|
||||
|
||||
src = builtins.fetchurl {
|
||||
url = "${config.aux.mirrors.gnu}/bash/bash-${cfg.version}.tar.gz";
|
||||
sha256 = "132qng0jy600mv1fs95ylnlisx2wavkkgpb19c6kmz7lnmjhjwhk";
|
||||
};
|
||||
|
||||
package =
|
||||
let
|
||||
patches = [
|
||||
# flush output for generated code
|
||||
./patches/mksignames-flush.patch
|
||||
];
|
||||
in
|
||||
builders.bash.boot.build {
|
||||
name = "bash-${cfg.version}";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
deps.build.host = [
|
||||
stage1.tinycc.musl.compiler.package
|
||||
stage1.coreutils.package
|
||||
stage1.gnumake.package
|
||||
stage1.gnupatch.package
|
||||
stage1.gnused.package
|
||||
stage1.gnugrep.package
|
||||
stage1.gnutar.musl.package
|
||||
stage1.gawk.boot.package
|
||||
stage1.gzip.package
|
||||
stage1.diffutils.package
|
||||
];
|
||||
|
||||
script = ''
|
||||
# Unpack
|
||||
tar xzf ${cfg.src}
|
||||
cd bash-${cfg.version}
|
||||
|
||||
# Patch
|
||||
${lib.strings.concatMapSep "\n" (file: "patch -Np1 -i ${file}") patches}
|
||||
|
||||
# Configure
|
||||
export CC="tcc -B ${stage1.tinycc.musl.libs.package}/lib"
|
||||
export AR="tcc -ar"
|
||||
export LD=tcc
|
||||
bash ./configure \
|
||||
--prefix=$out \
|
||||
--build=${platform.build} \
|
||||
--host=${platform.host} \
|
||||
--without-bash-malloc
|
||||
|
||||
# Build
|
||||
make -j $NIX_BUILD_CORES SHELL=bash
|
||||
|
||||
# Install
|
||||
make -j $NIX_BUILD_CORES install
|
||||
ln -s bash $out/bin/sh
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
--- a/support/mksignames.c
|
||||
+++ b/support/mksignames.c
|
||||
@@ -68,6 +68,7 @@ write_signames (stream)
|
||||
fprintf (stream, "};\n\n");
|
||||
fprintf (stream, "#define initialize_signames()\n\n");
|
||||
#endif
|
||||
+ fflush(stream);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
@ -1,146 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage1.binutils;
|
||||
|
||||
platform = config.aux.platform;
|
||||
builders = config.aux.foundation.builders;
|
||||
|
||||
stage1 = config.aux.foundation.stages.stage1;
|
||||
in
|
||||
{
|
||||
options.aux.foundation.stages.stage1.binutils = {
|
||||
meta = {
|
||||
description = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Description for the package.";
|
||||
default.value = "Tools for manipulating binaries (linker, assembler, etc.)";
|
||||
};
|
||||
|
||||
homepage = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Homepage for the package.";
|
||||
default.value = "https://www.gnu.org/software/binutils";
|
||||
};
|
||||
|
||||
license = lib.options.create {
|
||||
# TODO: Add a proper type for licenses.
|
||||
type = lib.types.attrs.any;
|
||||
description = "License for the package.";
|
||||
default.value = lib.licenses.gpl3Plus;
|
||||
};
|
||||
|
||||
platforms = lib.options.create {
|
||||
type = lib.types.list.of lib.types.string;
|
||||
description = "Platforms the package supports.";
|
||||
default.value = [ "i686-linux" ];
|
||||
};
|
||||
};
|
||||
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for binutils.";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of the package.";
|
||||
};
|
||||
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "Source for the package.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage1.binutils = {
|
||||
version = "2.41";
|
||||
|
||||
src = builtins.fetchurl {
|
||||
url = "${config.aux.mirrors.gnu}/binutils/binutils-${cfg.version}.tar.xz";
|
||||
sha256 = "rppXieI0WeWWBuZxRyPy0//DHAMXQZHvDQFb3wYAdFA=";
|
||||
};
|
||||
|
||||
package =
|
||||
let
|
||||
patches = [
|
||||
# Make binutils output deterministic by default.
|
||||
./patches/deterministic.patch
|
||||
];
|
||||
|
||||
configureFlags = [
|
||||
"--prefix=${builtins.placeholder "out"}"
|
||||
"--build=${platform.build}"
|
||||
"--host=${platform.host}"
|
||||
"--with-sysroot=/"
|
||||
"--enable-deterministic-archives"
|
||||
# depends on bison
|
||||
"--disable-gprofng"
|
||||
|
||||
# Turn on --enable-new-dtags by default to make the linker set
|
||||
# RUNPATH instead of RPATH on binaries. This is important because
|
||||
# RUNPATH can be overridden using LD_LIBRARY_PATH at runtime.
|
||||
"--enable-new-dtags"
|
||||
|
||||
# By default binutils searches $libdir for libraries. This brings in
|
||||
# libbfd and libopcodes into a default visibility. Drop default lib
|
||||
# path to force users to declare their use of these libraries.
|
||||
"--with-lib-path=:"
|
||||
];
|
||||
in
|
||||
builders.bash.boot.build {
|
||||
name = "binutils-${cfg.version}";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
deps.build.host = [
|
||||
stage1.tinycc.musl.compiler.package
|
||||
stage1.gnumake.package
|
||||
stage1.gnupatch.package
|
||||
stage1.gnused.package
|
||||
stage1.gnugrep.package
|
||||
stage1.gnutar.musl.package
|
||||
stage1.gzip.package
|
||||
stage1.gawk.package
|
||||
stage1.diffutils.package
|
||||
stage1.xz.package
|
||||
];
|
||||
|
||||
script = ''
|
||||
# Unpack
|
||||
cp ${cfg.src} binutils.tar.xz
|
||||
unxz binutils.tar.xz
|
||||
tar xf binutils.tar
|
||||
rm binutils.tar
|
||||
cd binutils-${cfg.version}
|
||||
|
||||
# Patch
|
||||
${lib.strings.concatMapSep "\n" (file: "patch -Np1 -i ${file}") patches}
|
||||
sed -i 's|/bin/sh|${stage1.bash.boot.package}/bin/bash|' \
|
||||
missing install-sh mkinstalldirs
|
||||
# see libtool's 74c8993c178a1386ea5e2363a01d919738402f30
|
||||
sed -i 's/| \$NL2SP/| sort | $NL2SP/' ltmain.sh
|
||||
# alias makeinfo to true
|
||||
mkdir aliases
|
||||
ln -s ${stage1.coreutils.package}/bin/true aliases/makeinfo
|
||||
export PATH="$(pwd)/aliases/:$PATH"
|
||||
|
||||
# Configure
|
||||
export CC="tcc -B ${stage1.tinycc.musl.libs.package}/lib"
|
||||
export AR="tcc -ar"
|
||||
export lt_cv_sys_max_cmd_len=32768
|
||||
export CFLAGS="-D__LITTLE_ENDIAN__=1"
|
||||
bash ./configure ${builtins.concatStringsSep " " configureFlags}
|
||||
|
||||
# Build
|
||||
make -j $NIX_BUILD_CORES all-libiberty all-gas all-bfd all-libctf all-zlib all-gprof
|
||||
make all-ld # race condition on ld/.deps/ldwrite.Po, serialize
|
||||
make -j $NIX_BUILD_CORES
|
||||
|
||||
# Install
|
||||
make -j $NIX_BUILD_CORES install
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
diff -ur orig/binutils-2.23.1/ld/ldlang.c binutils-2.23.1/ld/ldlang.c
|
||||
--- orig/ld/ldlang.c
|
||||
+++ new/ld/ldlang.c
|
||||
@@ -3095,6 +3095,8 @@
|
||||
ldfile_output_machine))
|
||||
einfo (_("%P%F:%s: can not set architecture: %E\n"), name);
|
||||
|
||||
+ link_info.output_bfd->flags |= BFD_DETERMINISTIC_OUTPUT;
|
||||
+
|
||||
link_info.hash = bfd_link_hash_table_create (link_info.output_bfd);
|
||||
if (link_info.hash == NULL)
|
||||
einfo (_("%P%F: can not create hash table: %E\n"));
|
||||
|
|
@ -1,104 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage1.bison;
|
||||
|
||||
platform = config.aux.platform;
|
||||
builders = config.aux.foundation.builders;
|
||||
|
||||
stage1 = config.aux.foundation.stages.stage1;
|
||||
in
|
||||
{
|
||||
options.aux.foundation.stages.stage1.bison = {
|
||||
meta = {
|
||||
description = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Description for the package.";
|
||||
default.value = "Yacc-compatible parser generator.";
|
||||
};
|
||||
|
||||
homepage = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Homepage for the package.";
|
||||
default.value = "https://www.gnu.org/software/bison";
|
||||
};
|
||||
|
||||
license = lib.options.create {
|
||||
# TODO: Add a proper type for licenses.
|
||||
type = lib.types.attrs.any;
|
||||
description = "License for the package.";
|
||||
default.value = lib.licenses.gpl3Plus;
|
||||
};
|
||||
|
||||
platforms = lib.options.create {
|
||||
type = lib.types.list.of lib.types.string;
|
||||
description = "Platforms the package supports.";
|
||||
default.value = [ "i686-linux" ];
|
||||
};
|
||||
};
|
||||
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for bison.";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of the package.";
|
||||
};
|
||||
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "Source for the package.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage1.bison = {
|
||||
version = "3.8.2";
|
||||
|
||||
src = builtins.fetchurl {
|
||||
url = "${config.aux.mirrors.gnu}/bison/bison-${cfg.version}.tar.xz";
|
||||
sha256 = "m7oCFMz38QecXVkhAEUie89hlRmEDr+oDNOEnP9aW/I=";
|
||||
};
|
||||
|
||||
package = builders.bash.build {
|
||||
name = "bison-${cfg.version}";
|
||||
meta = cfg.meta;
|
||||
|
||||
deps.build.host = [
|
||||
stage1.gcc.package
|
||||
stage1.musl.package
|
||||
stage1.binutils.package
|
||||
stage1.gnumake.package
|
||||
stage1.gnused.package
|
||||
stage1.gnugrep.package
|
||||
stage1.gawk.package
|
||||
stage1.diffutils.package
|
||||
stage1.findutils.package
|
||||
stage1.gnutar.package
|
||||
stage1.xz.package
|
||||
stage1.gnum4.package
|
||||
];
|
||||
|
||||
script = ''
|
||||
# Unpack
|
||||
tar xf ${cfg.src}
|
||||
cd bison-${cfg.version}
|
||||
|
||||
# Configure
|
||||
bash ./configure \
|
||||
--prefix=$out \
|
||||
--build=${platform.build} \
|
||||
--host=${platform.host} \
|
||||
CC=musl-gcc
|
||||
|
||||
# Build
|
||||
make -j $NIX_BUILD_CORES
|
||||
|
||||
# Install
|
||||
make -j $NIX_BUILD_CORES install
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,96 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage1.bzip2;
|
||||
|
||||
platform = config.aux.platform;
|
||||
builders = config.aux.foundation.builders;
|
||||
|
||||
stage1 = config.aux.foundation.stages.stage1;
|
||||
in
|
||||
{
|
||||
options.aux.foundation.stages.stage1.bzip2 = {
|
||||
meta = {
|
||||
description = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Description for the package.";
|
||||
default.value = "High-quality data compression program";
|
||||
};
|
||||
|
||||
homepage = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Homepage for the package.";
|
||||
default.value = "https://www.sourceware.org/bzip2";
|
||||
};
|
||||
|
||||
license = lib.options.create {
|
||||
# TODO: Add a proper type for licenses.
|
||||
type = lib.types.attrs.any;
|
||||
description = "License for the package.";
|
||||
default.value = lib.licenses.bsdOriginal;
|
||||
};
|
||||
|
||||
platforms = lib.options.create {
|
||||
type = lib.types.list.of lib.types.string;
|
||||
description = "Platforms the package supports.";
|
||||
# TODO: Support more platforms.
|
||||
default.value = [ "i686-linux" ];
|
||||
};
|
||||
};
|
||||
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for bzip2.";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of the package.";
|
||||
};
|
||||
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "Source for the package.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage1.bzip2 = {
|
||||
version = "1.0.8";
|
||||
|
||||
src = builtins.fetchurl {
|
||||
url = "https://sourceware.org/pub/bzip2/bzip2-${cfg.version}.tar.gz";
|
||||
sha256 = "0s92986cv0p692icqlw1j42y9nld8zd83qwhzbqd61p1dqbh6nmb";
|
||||
};
|
||||
|
||||
package = builders.bash.build {
|
||||
name = "bzip2-${cfg.version}";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
deps.build.host = [
|
||||
stage1.tinycc.musl.compiler.package
|
||||
stage1.gnumake.package
|
||||
stage1.gnutar.musl.package
|
||||
stage1.gzip.package
|
||||
];
|
||||
|
||||
script = ''
|
||||
# Unpack
|
||||
tar xzf ${cfg.src}
|
||||
cd bzip2-${cfg.version}
|
||||
|
||||
# Build
|
||||
make \
|
||||
-j $NIX_BUILD_CORES \
|
||||
CC="tcc -B ${stage1.tinycc.musl.libs.package}/lib" \
|
||||
AR="tcc -ar" \
|
||||
bzip2 bzip2recover
|
||||
|
||||
# Install
|
||||
make install -j $NIX_BUILD_CORES PREFIX=$out
|
||||
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,138 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage1.coreutils.boot;
|
||||
|
||||
builders = config.aux.foundation.builders;
|
||||
|
||||
stage1 = config.aux.foundation.stages.stage1;
|
||||
in
|
||||
{
|
||||
options.aux.foundation.stages.stage1.coreutils.boot = {
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for coreutils-boot.";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of the package.";
|
||||
};
|
||||
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "Source for the package.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage1.coreutils.boot = {
|
||||
version = "5.0";
|
||||
|
||||
src = builtins.fetchurl {
|
||||
url = "${config.aux.mirrors.gnu}/coreutils/coreutils-${cfg.version}.tar.gz";
|
||||
sha256 = "10wq6k66i8adr4k08p0xmg87ff4ypiazvwzlmi7myib27xgffz62";
|
||||
};
|
||||
|
||||
package =
|
||||
let
|
||||
# Thanks to the live-bootstrap project!
|
||||
# See https://github.com/fosslinux/live-bootstrap/blob/a8752029f60217a5c41c548b16f5cdd2a1a0e0db/sysa/coreutils-5.0/coreutils-5.0.kaem
|
||||
liveBootstrap = "https://github.com/fosslinux/live-bootstrap/raw/a8752029f60217a5c41c548b16f5cdd2a1a0e0db/sysa/coreutils-5.0";
|
||||
|
||||
makefile = builtins.fetchurl {
|
||||
url = "${liveBootstrap}/mk/main.mk";
|
||||
sha256 = "0njg4xccxfqrslrmlb8ls7h6hlnfmdx42nvxwmca8flvczwrplfd";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# modechange.h uses functions defined in sys/stat.h, so we need to move it to
|
||||
# after sys/stat.h include.
|
||||
(builtins.fetchurl {
|
||||
url = "${liveBootstrap}/patches/modechange.patch";
|
||||
sha256 = "04xa4a5w2syjs3xs6qhh8kdzqavxnrxpxwyhc3qqykpk699p3ms5";
|
||||
})
|
||||
# mbstate_t is a struct that is required. However, it is not defined by mes libc.
|
||||
(builtins.fetchurl {
|
||||
url = "${liveBootstrap}/patches/mbstate.patch";
|
||||
sha256 = "0rz3c0sflgxjv445xs87b83i7gmjpl2l78jzp6nm3khdbpcc53vy";
|
||||
})
|
||||
# strcoll() does not exist in mes libc, change it to strcmp.
|
||||
(builtins.fetchurl {
|
||||
url = "${liveBootstrap}/patches/ls-strcmp.patch";
|
||||
sha256 = "0lx8rz4sxq3bvncbbr6jf0kyn5bqwlfv9gxyafp0541dld6l55p6";
|
||||
})
|
||||
# getdate.c is pre-compiled from getdate.y
|
||||
# At this point we don't have bison yet and in any case getdate.y does not
|
||||
# compile when generated with modern bison.
|
||||
(builtins.fetchurl {
|
||||
url = "${liveBootstrap}/patches/touch-getdate.patch";
|
||||
sha256 = "1xd3z57lvkj7r8vs5n0hb9cxzlyp58pji7d335snajbxzwy144ma";
|
||||
})
|
||||
# touch: add -h to change symlink timestamps, where supported
|
||||
(builtins.fetchurl {
|
||||
url = "${liveBootstrap}/patches/touch-dereference.patch";
|
||||
sha256 = "0wky5r3k028xwyf6g6ycwqxzc7cscgmbymncjg948vv4qxsxlfda";
|
||||
})
|
||||
# strcoll() does not exist in mes libc, change it to strcmp.
|
||||
(builtins.fetchurl {
|
||||
url = "${liveBootstrap}/patches/expr-strcmp.patch";
|
||||
sha256 = "19f31lfsm1iwqzvp2fyv97lmqg4730prfygz9zip58651jf739a9";
|
||||
})
|
||||
# strcoll() does not exist in mes libc, change it to strcmp.
|
||||
# hard_LC_COLLATE is used but not declared when HAVE_SETLOCALE is unset.
|
||||
(builtins.fetchurl {
|
||||
url = "${liveBootstrap}/patches/sort-locale.patch";
|
||||
sha256 = "0bdch18mpyyxyl6gyqfs0wb4pap9flr11izqdyxccx1hhz0a2i6c";
|
||||
})
|
||||
# don't assume fopen cannot return stdin or stdout.
|
||||
(builtins.fetchurl {
|
||||
url = "${liveBootstrap}/patches/uniq-fopen.patch";
|
||||
sha256 = "0qs6shyxl9j4h34v5j5sgpxrr4gjfljd2hxzw416ghwc3xzv63fp";
|
||||
})
|
||||
];
|
||||
in
|
||||
builders.kaem.build {
|
||||
name = "coreutils-boot-${cfg.version}";
|
||||
|
||||
meta = stage1.coreutils.meta;
|
||||
|
||||
deps.build.host = [
|
||||
stage1.tinycc.mes.compiler.package
|
||||
stage1.gnumake.boot.package
|
||||
stage1.gnupatch.package
|
||||
];
|
||||
|
||||
script = ''
|
||||
# Unpack
|
||||
ungz --file ${cfg.src} --output coreutils.tar
|
||||
untar --file coreutils.tar
|
||||
rm coreutils.tar
|
||||
cd coreutils-${cfg.version}
|
||||
|
||||
# Patch
|
||||
${lib.strings.concatMapSep "\n" (file: "patch -Np0 -i ${file}") patches}
|
||||
|
||||
# Configure
|
||||
catm config.h
|
||||
cp lib/fnmatch_.h lib/fnmatch.h
|
||||
cp lib/ftw_.h lib/ftw.h
|
||||
cp lib/search_.h lib/search.h
|
||||
rm src/dircolors.h
|
||||
|
||||
# Build
|
||||
make -f ${makefile} \
|
||||
CC="tcc -B ${stage1.tinycc.mes.libs.package}/lib" \
|
||||
PREFIX=''${out}
|
||||
|
||||
# Check
|
||||
./src/echo "Hello coreutils!"
|
||||
|
||||
# Install
|
||||
./src/mkdir -p ''${out}/bin
|
||||
make -f ${makefile} install PREFIX=''${out}
|
||||
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,112 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage1.coreutils;
|
||||
|
||||
platform = config.aux.platform;
|
||||
builders = config.aux.foundation.builders;
|
||||
|
||||
stage1 = config.aux.foundation.stages.stage1;
|
||||
in
|
||||
{
|
||||
includes = [ ./boot.nix ];
|
||||
|
||||
options.aux.foundation.stages.stage1.coreutils = {
|
||||
meta = {
|
||||
description = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Description for the package.";
|
||||
default.value = "The GNU Core Utilities.";
|
||||
};
|
||||
|
||||
homepage = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Homepage for the package.";
|
||||
default.value = "https://www.gnu.org/software/coreutils";
|
||||
};
|
||||
|
||||
license = lib.options.create {
|
||||
# TODO: Add a proper type for licenses.
|
||||
type = lib.types.attrs.any;
|
||||
description = "License for the package.";
|
||||
default.value = lib.licenses.gpl3Plus;
|
||||
};
|
||||
|
||||
platforms = lib.options.create {
|
||||
type = lib.types.list.of lib.types.string;
|
||||
description = "Platforms the package supports.";
|
||||
default.value = [ "i686-linux" ];
|
||||
};
|
||||
};
|
||||
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for coreutils.";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of the package.";
|
||||
};
|
||||
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "Source for the package.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage1.coreutils = {
|
||||
version = "9.4";
|
||||
|
||||
src = builtins.fetchurl {
|
||||
url = "${config.aux.mirrors.gnu}/coreutils/coreutils-${cfg.version}.tar.gz";
|
||||
sha256 = "X2ANkJOXOwr+JTk9m8GMRPIjJlf0yg2V6jHHAutmtzk=";
|
||||
};
|
||||
|
||||
package =
|
||||
let
|
||||
configureFlags = [
|
||||
"--prefix=${builtins.placeholder "out"}"
|
||||
"--build=${platform.build}"
|
||||
"--host=${platform.host}"
|
||||
# musl 1.1.x doesn't use 64bit time_t
|
||||
"--disable-year2038"
|
||||
# libstdbuf.so fails in static builds
|
||||
"--enable-no-install-program=stdbuf"
|
||||
];
|
||||
in
|
||||
builders.bash.boot.build {
|
||||
name = "coreutils-${cfg.version}";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
deps.build.host = [
|
||||
stage1.tinycc.musl.compiler.package
|
||||
stage1.gnumake.package
|
||||
stage1.gnused.package
|
||||
stage1.gnugrep.package
|
||||
stage1.gawk.package
|
||||
stage1.gnutar.musl.package
|
||||
stage1.gzip.package
|
||||
];
|
||||
|
||||
script = ''
|
||||
# Unpack
|
||||
tar xzf ${cfg.src}
|
||||
cd coreutils-${cfg.version}
|
||||
|
||||
# Configure
|
||||
export CC="tcc -B ${stage1.tinycc.musl.libs.package}/lib"
|
||||
export LD=tcc
|
||||
bash ./configure ${builtins.concatStringsSep " " configureFlags}
|
||||
|
||||
# Build
|
||||
make -j $NIX_BUILD_CORES AR="tcc -ar" MAKEINFO="true"
|
||||
|
||||
# Install
|
||||
make -j $NIX_BUILD_CORES install MAKEINFO="true"
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,105 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage1;
|
||||
|
||||
stage1 = config.aux.foundation.stages.stage1;
|
||||
in
|
||||
{
|
||||
includes = [
|
||||
./nyacc
|
||||
./mes
|
||||
./ln-boot
|
||||
./tinycc
|
||||
./gnupatch
|
||||
./gnumake
|
||||
./coreutils
|
||||
./heirloom
|
||||
./bash
|
||||
|
||||
./gnused
|
||||
./gnugrep
|
||||
./gnutar
|
||||
./gzip
|
||||
./musl
|
||||
./gawk
|
||||
./xz
|
||||
./diffutils
|
||||
./binutils
|
||||
./findutils
|
||||
./bzip2
|
||||
./gcc
|
||||
./gnum4
|
||||
./bison
|
||||
./linux-headers
|
||||
./zlib
|
||||
./python
|
||||
];
|
||||
|
||||
config = {
|
||||
exports = {
|
||||
packages = {
|
||||
# These packages are built using Kaem.
|
||||
stage1-nyacc = stage1.nyacc.package;
|
||||
stage1-mes = stage1.mes.compiler.package;
|
||||
stage1-mes-libs = stage1.mes.libs.package;
|
||||
stage1-ln-boot = stage1.ln-boot.package;
|
||||
stage1-mes-libc = stage1.mes.libc.package;
|
||||
stage1-tinycc-boot = stage1.tinycc.boot.compiler.package;
|
||||
stage1-tinycc-boot-libs = stage1.tinycc.boot.libs.package;
|
||||
stage1-tinycc-mes = stage1.tinycc.mes.compiler.package;
|
||||
stage1-tinycc-mes-libs = stage1.tinycc.mes.libs.package;
|
||||
stage1-gnupatch = stage1.gnupatch.package;
|
||||
stage1-gnumake-boot = stage1.gnumake.boot.package;
|
||||
stage1-coreutils-boot = stage1.coreutils.boot.package;
|
||||
stage1-heirloom-devtools = stage1.heirloom.devtools.package;
|
||||
stage1-bash-boot = stage1.bash.boot.package;
|
||||
|
||||
# These packages are built using Bash v2.
|
||||
stage1-gnused-boot = stage1.gnused.boot.package;
|
||||
stage1-gnugrep = stage1.gnugrep.package;
|
||||
stage1-gnutar-boot = stage1.gnutar.boot.package;
|
||||
stage1-gzip = stage1.gzip.package;
|
||||
stage1-musl-boot = stage1.musl.boot.package;
|
||||
stage1-tinycc-musl = stage1.tinycc.musl.compiler.package;
|
||||
stage1-tinycc-musl-libs = stage1.tinycc.musl.libs.package;
|
||||
stage1-gawk-boot = stage1.gawk.boot.package;
|
||||
stage1-gnused = stage1.gnused.package;
|
||||
stage1-gnumake = stage1.gnumake.package;
|
||||
stage1-gnutar-musl = stage1.gnutar.musl.package;
|
||||
stage1-gawk = stage1.gawk.package;
|
||||
stage1-xz = stage1.xz.package;
|
||||
stage1-diffutils = stage1.diffutils.package;
|
||||
stage1-coreutils = stage1.coreutils.package;
|
||||
stage1-binutils = stage1.binutils.package;
|
||||
stage1-findutils = stage1.findutils.package;
|
||||
stage1-heirloom = stage1.heirloom.package;
|
||||
stage1-bash = stage1.bash.package;
|
||||
|
||||
# These packages are built using Bash v5
|
||||
stage1-gcc-46 = stage1.gcc.v46.package;
|
||||
stage1-musl = stage1.musl.package;
|
||||
stage1-bzip2 = stage1.bzip2.package;
|
||||
stage1-gcc-46-cxx = stage1.gcc.v46.cxx.package;
|
||||
stage1-gnutar = stage1.gnutar.package;
|
||||
stage1-gcc-8 = stage1.gcc.v8.package;
|
||||
stage1-gcc = stage1.gcc.package;
|
||||
stage1-gnum4 = stage1.gnum4.package;
|
||||
stage1-bison = stage1.bison.package;
|
||||
stage1-linux-headers = stage1.linux-headers.package;
|
||||
stage1-zlib = stage1.zlib.package;
|
||||
stage1-python = stage1.python.package;
|
||||
};
|
||||
|
||||
extras = {
|
||||
stage1 = {
|
||||
mes = {
|
||||
src = stage1.mes.src;
|
||||
libs = {
|
||||
prefix = stage1.mes.libs.prefix;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,104 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage1.diffutils;
|
||||
|
||||
platform = config.aux.platform;
|
||||
builders = config.aux.foundation.builders;
|
||||
|
||||
stage1 = config.aux.foundation.stages.stage1;
|
||||
in
|
||||
{
|
||||
options.aux.foundation.stages.stage1.diffutils = {
|
||||
meta = {
|
||||
description = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Description for the package.";
|
||||
default.value = "Commands for showing the differences between files (diff, cmp, etc.)";
|
||||
};
|
||||
|
||||
homepage = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Homepage for the package.";
|
||||
default.value = "https://www.gnu.org/software/diffutils";
|
||||
};
|
||||
|
||||
license = lib.options.create {
|
||||
# TODO: Add a proper type for licenses.
|
||||
type = lib.types.attrs.any;
|
||||
description = "License for the package.";
|
||||
default.value = lib.licenses.gpl3Only;
|
||||
};
|
||||
|
||||
platforms = lib.options.create {
|
||||
type = lib.types.list.of lib.types.string;
|
||||
description = "Platforms the package supports.";
|
||||
default.value = [ "i686-linux" ];
|
||||
};
|
||||
};
|
||||
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for diffutils.";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of the package.";
|
||||
};
|
||||
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "Source for the package.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage1.diffutils = {
|
||||
version = "3.8";
|
||||
|
||||
src = builtins.fetchurl {
|
||||
url = "${config.aux.mirrors.gnu}/diffutils/diffutils-${cfg.version}.tar.xz";
|
||||
sha256 = "pr3X0bMSZtEcT03mwbdI1GB6sCMa9RiPwlM9CuJDj+w=";
|
||||
};
|
||||
|
||||
package = builders.bash.boot.build {
|
||||
name = "diffutils-${cfg.version}";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
deps.build.host = [
|
||||
stage1.tinycc.musl.compiler.package
|
||||
stage1.gnumake.package
|
||||
stage1.gnused.package
|
||||
stage1.gnugrep.package
|
||||
stage1.gnutar.musl.package
|
||||
stage1.gawk.package
|
||||
stage1.xz.package
|
||||
];
|
||||
|
||||
script = ''
|
||||
# Unpack
|
||||
cp ${cfg.src} diffutils.tar.xz
|
||||
unxz diffutils.tar.xz
|
||||
tar xf diffutils.tar
|
||||
rm diffutils.tar
|
||||
cd diffutils-${cfg.version}
|
||||
|
||||
# Configure
|
||||
export CC="tcc -B ${stage1.tinycc.musl.libs.package}/lib"
|
||||
export LD=tcc
|
||||
bash ./configure \
|
||||
--prefix=$out \
|
||||
--build=${platform.build} \
|
||||
--host=${platform.host}
|
||||
|
||||
# Build
|
||||
make -j $NIX_BUILD_CORES AR="tcc -ar"
|
||||
|
||||
# Install
|
||||
make -j $NIX_BUILD_CORES install
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,110 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage1.findutils;
|
||||
|
||||
platform = config.aux.platform;
|
||||
builders = config.aux.foundation.builders;
|
||||
|
||||
stage1 = config.aux.foundation.stages.stage1;
|
||||
in
|
||||
{
|
||||
options.aux.foundation.stages.stage1.findutils = {
|
||||
meta = {
|
||||
description = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Description for the package.";
|
||||
default.value = "GNU Find Utilities, the basic directory searching utilities of the GNU operating system";
|
||||
};
|
||||
|
||||
homepage = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Homepage for the package.";
|
||||
default.value = "https://www.gnu.org/software/findutils";
|
||||
};
|
||||
|
||||
license = lib.options.create {
|
||||
# TODO: Add a proper type for licenses.
|
||||
type = lib.types.attrs.any;
|
||||
description = "License for the package.";
|
||||
default.value = lib.licenses.gpl3Plus;
|
||||
};
|
||||
|
||||
platforms = lib.options.create {
|
||||
type = lib.types.list.of lib.types.string;
|
||||
description = "Platforms the package supports.";
|
||||
default.value = [ "i686-linux" ];
|
||||
};
|
||||
};
|
||||
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for findutils.";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of the package.";
|
||||
};
|
||||
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "Source for the package.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage1.findutils = {
|
||||
version = "4.9.0";
|
||||
|
||||
src = builtins.fetchurl {
|
||||
url = "${config.aux.mirrors.gnu}/findutils/findutils-${cfg.version}.tar.xz";
|
||||
sha256 = "or+4wJ1DZ3DtxZ9Q+kg+eFsWGjt7nVR1c8sIBl/UYv4=";
|
||||
};
|
||||
|
||||
package = builders.bash.boot.build {
|
||||
name = "findutils-${cfg.version}";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
deps.build.host = [
|
||||
stage1.tinycc.musl.compiler.package
|
||||
stage1.gnumake.package
|
||||
stage1.gnused.package
|
||||
stage1.gnugrep.package
|
||||
stage1.gnutar.musl.package
|
||||
stage1.gawk.package
|
||||
stage1.xz.package
|
||||
];
|
||||
|
||||
script = ''
|
||||
# Unpack
|
||||
cp ${cfg.src} findutils.tar.xz
|
||||
unxz findutils.tar.xz
|
||||
tar xf findutils.tar
|
||||
rm findutils.tar
|
||||
cd findutils-${cfg.version}
|
||||
|
||||
# Patch
|
||||
# configure fails to accurately detect PATH_MAX support
|
||||
sed -i 's/chdir_long/chdir/' gl/lib/save-cwd.c
|
||||
|
||||
# Configure
|
||||
export CC="tcc -B ${stage1.tinycc.musl.libs.package}/lib"
|
||||
export AR="tcc -ar"
|
||||
export LD=tcc
|
||||
bash ./configure \
|
||||
--prefix=$out \
|
||||
--build=${platform.build} \
|
||||
--host=${platform.host}
|
||||
|
||||
# Build
|
||||
make -j $NIX_BUILD_CORES
|
||||
|
||||
# Install
|
||||
make -j $NIX_BUILD_CORES install
|
||||
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,88 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage1.gawk.boot;
|
||||
|
||||
platform = config.aux.platform;
|
||||
builders = config.aux.foundation.builders;
|
||||
|
||||
stage1 = config.aux.foundation.stages.stage1;
|
||||
in
|
||||
{
|
||||
options.aux.foundation.stages.stage1.gawk.boot = {
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for gnutar-boot.";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of the package.";
|
||||
};
|
||||
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "Source for the package.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage1.gawk.boot = {
|
||||
version = "3.0.6";
|
||||
|
||||
src = builtins.fetchurl {
|
||||
url = "${config.aux.mirrors.gnu}/gawk/gawk-${cfg.version}.tar.gz";
|
||||
sha256 = "1z4bibjm7ldvjwq3hmyifyb429rs2d9bdwkvs0r171vv1khpdwmb";
|
||||
};
|
||||
|
||||
package =
|
||||
let
|
||||
patches = [
|
||||
# for reproducibility don't generate date stamp
|
||||
./patches/no-stamp.patch
|
||||
];
|
||||
in
|
||||
builders.bash.boot.build {
|
||||
name = "gawk-boot-${cfg.version}";
|
||||
|
||||
meta = stage1.gawk.meta;
|
||||
|
||||
deps.build.host = [
|
||||
stage1.tinycc.mes.compiler.package
|
||||
stage1.gnumake.boot.package
|
||||
stage1.gnused.boot.package
|
||||
stage1.gnugrep.package
|
||||
stage1.gnupatch.package
|
||||
];
|
||||
|
||||
script = ''
|
||||
# Unpack
|
||||
ungz --file ${cfg.src} --output gawk.tar
|
||||
untar --file gawk.tar
|
||||
rm gawk.tar
|
||||
cd gawk-${cfg.version}
|
||||
|
||||
# Patch
|
||||
${lib.strings.concatMapSep "\n" (file: "patch -Np0 -i ${file}") patches}
|
||||
|
||||
# Configure
|
||||
export CC="tcc -B ${stage1.tinycc.mes.libs.package}/lib"
|
||||
export ac_cv_func_getpgrp_void=yes
|
||||
export ac_cv_func_tzset=yes
|
||||
chmod 0755 missing
|
||||
bash ./configure \
|
||||
--build=${platform.build} \
|
||||
--host=${platform.host} \
|
||||
--disable-nls \
|
||||
--prefix=$out
|
||||
|
||||
# Build
|
||||
make gawk
|
||||
|
||||
# Install
|
||||
install -D gawk $out/bin/gawk
|
||||
ln -s gawk $out/bin/awk
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,110 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage1.gawk;
|
||||
|
||||
platform = config.aux.platform;
|
||||
builders = config.aux.foundation.builders;
|
||||
|
||||
stage1 = config.aux.foundation.stages.stage1;
|
||||
in
|
||||
{
|
||||
includes = [ ./boot.nix ];
|
||||
|
||||
options.aux.foundation.stages.stage1.gawk = {
|
||||
meta = {
|
||||
description = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Description for the package.";
|
||||
default.value = "GNU implementation of the Awk programming language";
|
||||
};
|
||||
|
||||
homepage = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Homepage for the package.";
|
||||
default.value = "https://www.gnu.org/software/gawk";
|
||||
};
|
||||
|
||||
license = lib.options.create {
|
||||
# TODO: Add a proper type for licenses.
|
||||
type = lib.types.attrs.any;
|
||||
description = "License for the package.";
|
||||
default.value = lib.licenses.gpl3Plus;
|
||||
};
|
||||
|
||||
platforms = lib.options.create {
|
||||
type = lib.types.list.of lib.types.string;
|
||||
description = "Platforms the package supports.";
|
||||
default.value = [ "i686-linux" ];
|
||||
};
|
||||
|
||||
mainProgram = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "The main program of the package.";
|
||||
default.value = "awk";
|
||||
};
|
||||
};
|
||||
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for gawk.";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of the package.";
|
||||
};
|
||||
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "Source for the package.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage1.gawk = {
|
||||
version = "5.2.2";
|
||||
|
||||
src = builtins.fetchurl {
|
||||
url = "${config.aux.mirrors.gnu}/gawk/gawk-${cfg.version}.tar.gz";
|
||||
sha256 = "lFrvfM/xAfILIqEIArwAXplKsrjqPnJMwaGXxi9B9lA=";
|
||||
};
|
||||
|
||||
package = builders.bash.boot.build {
|
||||
name = "gawk-${cfg.version}";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
deps.build.host = [
|
||||
stage1.tinycc.musl.compiler.package
|
||||
stage1.gnumake.package
|
||||
stage1.gnused.package
|
||||
stage1.gnugrep.package
|
||||
stage1.gnutar.musl.package
|
||||
stage1.gzip.package
|
||||
stage1.gawk.boot.package
|
||||
];
|
||||
|
||||
script = ''
|
||||
# Unpack
|
||||
tar xzf ${cfg.src}
|
||||
cd gawk-${cfg.version}
|
||||
|
||||
# Configure
|
||||
export CC="tcc -B ${stage1.tinycc.musl.libs.package}/lib"
|
||||
export AR="tcc -ar"
|
||||
export LD=tcc
|
||||
bash ./configure \
|
||||
--prefix=$out \
|
||||
--build=${platform.build} \
|
||||
--host=${platform.host}
|
||||
|
||||
# Build
|
||||
make -j $NIX_BUILD_CORES
|
||||
|
||||
# Install
|
||||
make -j $NIX_BUILD_CORES install
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
--- configure
|
||||
+++ configure
|
||||
@@ -3676,7 +3676,6 @@ cat >> $CONFIG_STATUS <<EOF
|
||||
|
||||
EOF
|
||||
cat >> $CONFIG_STATUS <<\EOF
|
||||
-date > stamp-h
|
||||
exit 0
|
||||
EOF
|
||||
chmod +x $CONFIG_STATUS
|
||||
|
|
@ -1,222 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage1.gcc;
|
||||
|
||||
platform = config.aux.platform;
|
||||
builders = config.aux.foundation.builders;
|
||||
|
||||
stage1 = config.aux.foundation.stages.stage1;
|
||||
in
|
||||
{
|
||||
includes = [
|
||||
./v4.6.nix
|
||||
./v4.6.cxx.nix
|
||||
./v8.nix
|
||||
];
|
||||
|
||||
options.aux.foundation.stages.stage1.gcc = {
|
||||
meta = {
|
||||
description = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Description for the package.";
|
||||
default.value = "GNU Compiler Collection.";
|
||||
};
|
||||
|
||||
homepage = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Homepage for the package.";
|
||||
default.value = "https://gcc.gnu.org";
|
||||
};
|
||||
|
||||
license = lib.options.create {
|
||||
# TODO: Add a proper type for licenses.
|
||||
type = lib.types.attrs.any;
|
||||
description = "License for the package.";
|
||||
default.value = lib.licenses.gpl3Plus;
|
||||
};
|
||||
|
||||
platforms = lib.options.create {
|
||||
type = lib.types.list.of lib.types.string;
|
||||
description = "Platforms the package supports.";
|
||||
default.value = [ "i686-linux" ];
|
||||
};
|
||||
};
|
||||
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for gcc.";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of the package.";
|
||||
};
|
||||
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "Source for the package.";
|
||||
};
|
||||
|
||||
cc = {
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The cc source for the package.";
|
||||
};
|
||||
};
|
||||
|
||||
gmp = {
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The gmp source for the package.";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of gmp.";
|
||||
};
|
||||
};
|
||||
|
||||
mpfr = {
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The mpfr source for the package.";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of mpfr.";
|
||||
};
|
||||
};
|
||||
|
||||
mpc = {
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The mpc source for the package.";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of mpc.";
|
||||
};
|
||||
};
|
||||
|
||||
isl = {
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The isl source for the package.";
|
||||
};
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of isl.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage1.gcc = {
|
||||
version = "13.2.0";
|
||||
|
||||
src = builtins.fetchurl {
|
||||
url = "${config.aux.mirrors.gnu}/gcc/gcc-${cfg.version}/gcc-${cfg.version}.tar.xz";
|
||||
sha256 = "4nXnZEKmBnNBon8Exca4PYYTFEAEwEE1KIY9xrXHQ9o=";
|
||||
};
|
||||
|
||||
gmp = {
|
||||
version = "6.3.0";
|
||||
src = builtins.fetchurl {
|
||||
url = "${config.aux.mirrors.gnu}/gmp/gmp-${cfg.gmp.version}.tar.xz";
|
||||
sha256 = "o8K4AgG4nmhhb0rTC8Zq7kknw85Q4zkpyoGdXENTiJg=";
|
||||
};
|
||||
};
|
||||
|
||||
mpfr = {
|
||||
version = "4.2.1";
|
||||
src = builtins.fetchurl {
|
||||
url = "${config.aux.mirrors.gnu}/mpfr/mpfr-${cfg.mpfr.version}.tar.xz";
|
||||
sha256 = "J3gHNTpnJpeJlpRa8T5Sgp46vXqaW3+yeTiU4Y8fy7I=";
|
||||
};
|
||||
};
|
||||
|
||||
mpc = {
|
||||
version = "1.3.1";
|
||||
src = builtins.fetchurl {
|
||||
url = "${config.aux.mirrors.gnu}/mpc/mpc-${cfg.mpc.version}.tar.gz";
|
||||
sha256 = "q2QkkvXPiCt0qgy3MM1BCoHtzb7IlRg86TDnBsHHWbg=";
|
||||
};
|
||||
};
|
||||
|
||||
isl = {
|
||||
version = "0.24";
|
||||
src = builtins.fetchurl {
|
||||
url = "https://gcc.gnu.org/pub/gcc/infrastructure/isl-${cfg.isl.version}.tar.bz2";
|
||||
sha256 = "/PeN2WVsEOuM+fvV9ZoLawE4YgX+GTSzsoegoYmBRcA=";
|
||||
};
|
||||
};
|
||||
|
||||
package = builders.bash.build {
|
||||
name = "gcc-${cfg.version}";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
deps.build.host = [
|
||||
stage1.gcc.v8.package
|
||||
stage1.binutils.package
|
||||
stage1.gnumake.package
|
||||
stage1.gnused.package
|
||||
stage1.gnugrep.package
|
||||
stage1.gawk.boot.package
|
||||
stage1.diffutils.package
|
||||
stage1.findutils.package
|
||||
stage1.gnutar.package
|
||||
stage1.gzip.package
|
||||
stage1.bzip2.package
|
||||
stage1.xz.package
|
||||
];
|
||||
|
||||
script = ''
|
||||
# Unpack
|
||||
tar xf ${cfg.src}
|
||||
tar xf ${cfg.gmp.src}
|
||||
tar xf ${cfg.mpfr.src}
|
||||
tar xf ${cfg.mpc.src}
|
||||
tar xf ${cfg.isl.src}
|
||||
cd gcc-${cfg.version}
|
||||
|
||||
ln -s ../gmp-${cfg.gmp.version} gmp
|
||||
ln -s ../mpfr-${cfg.mpfr.version} mpfr
|
||||
ln -s ../mpc-${cfg.mpc.version} mpc
|
||||
ln -s ../isl-${cfg.isl.version} isl
|
||||
|
||||
# Patch
|
||||
# force musl even if host triple is gnu
|
||||
sed -i 's|"os/gnu-linux"|"os/generic"|' libstdc++-v3/configure.host
|
||||
|
||||
# Configure
|
||||
export CC="gcc -Wl,-dynamic-linker -Wl,${stage1.musl.package}/lib/libc.so"
|
||||
export CXX="g++ -Wl,-dynamic-linker -Wl,${stage1.musl.package}/lib/libc.so"
|
||||
export CFLAGS_FOR_TARGET="-Wl,-dynamic-linker -Wl,${stage1.musl.package}/lib/libc.so"
|
||||
export LIBRARY_PATH="${stage1.musl.package}/lib"
|
||||
|
||||
bash ./configure \
|
||||
--prefix=$out \
|
||||
--build=${platform.build} \
|
||||
--host=${platform.host} \
|
||||
--with-native-system-header-dir=/include \
|
||||
--with-sysroot=${stage1.musl.package} \
|
||||
--enable-languages=c,c++ \
|
||||
--disable-bootstrap \
|
||||
--disable-libsanitizer \
|
||||
--disable-lto \
|
||||
--disable-multilib \
|
||||
--disable-plugin
|
||||
|
||||
# Build
|
||||
make -j $NIX_BUILD_CORES
|
||||
|
||||
# Install
|
||||
make -j $NIX_BUILD_CORES install-strip
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
--- a/gcc/Makefile.in
|
||||
+++ b/gcc/Makefile.in
|
||||
@@ -440,7 +440,7 @@ LINKER_PLUGIN_API_H = $(srcdir)/../include/plugin-api.h
|
||||
LTO_SYMTAB_H = $(srcdir)/../include/lto-symtab.h
|
||||
|
||||
# Default native SYSTEM_HEADER_DIR, to be overridden by targets.
|
||||
-NATIVE_SYSTEM_HEADER_DIR = /usr/include
|
||||
+# NATIVE_SYSTEM_HEADER_DIR = /usr/include
|
||||
# Default cross SYSTEM_HEADER_DIR, to be overridden by targets.
|
||||
CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
|
||||
|
||||
|
|
@ -1,187 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage1.gcc.v46.cxx;
|
||||
|
||||
platform = config.aux.platform;
|
||||
builders = config.aux.foundation.builders;
|
||||
|
||||
stage1 = config.aux.foundation.stages.stage1;
|
||||
in
|
||||
{
|
||||
options.aux.foundation.stages.stage1.gcc.v46.cxx = {
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for gcc-cxx.";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of the package.";
|
||||
};
|
||||
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "Source for the package.";
|
||||
};
|
||||
|
||||
cc = {
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The cc source for the package.";
|
||||
};
|
||||
};
|
||||
|
||||
gmp = {
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The gmp source for the package.";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of gmp.";
|
||||
};
|
||||
};
|
||||
|
||||
mpfr = {
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The mpfr source for the package.";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of mpfr.";
|
||||
};
|
||||
};
|
||||
|
||||
mpc = {
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The mpc source for the package.";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of mpc.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage1.gcc.v46.cxx = {
|
||||
version = "4.6.4";
|
||||
|
||||
src = builtins.fetchurl {
|
||||
url = "${config.aux.mirrors.gnu}/gcc/gcc-${cfg.version}/gcc-core-${cfg.version}.tar.gz";
|
||||
sha256 = "173kdb188qg79pcz073cj9967rs2vzanyjdjyxy9v0xb0p5sad75";
|
||||
};
|
||||
|
||||
cc = {
|
||||
src = builtins.fetchurl {
|
||||
url = "${config.aux.mirrors.gnu}/gcc/gcc-${cfg.version}/gcc-g++-${cfg.version}.tar.gz";
|
||||
sha256 = "1fqqk5zkmdg4vmqzdmip9i42q6b82i3f6yc0n86n9021cr7ms2k9";
|
||||
};
|
||||
};
|
||||
|
||||
gmp = {
|
||||
version = "4.3.2";
|
||||
|
||||
src = builtins.fetchurl {
|
||||
url = "${config.aux.mirrors.gnu}/gmp/gmp-${cfg.gmp.version}.tar.gz";
|
||||
sha256 = "15rwq54fi3s11izas6g985y9jklm3xprfsmym3v1g6xr84bavqvv";
|
||||
};
|
||||
};
|
||||
|
||||
mpfr = {
|
||||
version = "2.4.2";
|
||||
|
||||
src = builtins.fetchurl {
|
||||
url = "${config.aux.mirrors.gnu}/mpfr/mpfr-${cfg.mpfr.version}.tar.gz";
|
||||
sha256 = "0dxn4904dra50xa22hi047lj8kkpr41d6vb9sd4grca880c7wv94";
|
||||
};
|
||||
};
|
||||
|
||||
mpc = {
|
||||
version = "1.0.3";
|
||||
|
||||
src = builtins.fetchurl {
|
||||
url = "${config.aux.mirrors.gnu}/mpc/mpc-${cfg.mpc.version}.tar.gz";
|
||||
sha256 = "1hzci2zrrd7v3g1jk35qindq05hbl0bhjcyyisq9z209xb3fqzb1";
|
||||
};
|
||||
};
|
||||
|
||||
package =
|
||||
let
|
||||
patches = [
|
||||
# Remove hardcoded NATIVE_SYSTEM_HEADER_DIR
|
||||
./patches/no-system-headers.patch
|
||||
];
|
||||
in
|
||||
builders.bash.build {
|
||||
name = "gcc-cxx-${cfg.version}";
|
||||
|
||||
meta = stage1.gcc.meta;
|
||||
|
||||
deps.build.host = [
|
||||
stage1.gcc.v46.package
|
||||
stage1.binutils.package
|
||||
stage1.gnumake.package
|
||||
stage1.gnupatch.package
|
||||
stage1.gnused.package
|
||||
stage1.gnugrep.package
|
||||
stage1.gawk.boot.package
|
||||
stage1.diffutils.package
|
||||
stage1.findutils.package
|
||||
stage1.gnutar.musl.package
|
||||
stage1.gzip.package
|
||||
];
|
||||
|
||||
script = ''
|
||||
# Unpack
|
||||
tar xzf ${cfg.src}
|
||||
tar xzf ${cfg.cc.src}
|
||||
tar xzf ${cfg.gmp.src}
|
||||
tar xzf ${cfg.mpfr.src}
|
||||
tar xzf ${cfg.mpc.src}
|
||||
cd gcc-${cfg.version}
|
||||
|
||||
ln -s ../gmp-${cfg.gmp.version} gmp
|
||||
ln -s ../mpfr-${cfg.mpfr.version} mpfr
|
||||
ln -s ../mpc-${cfg.mpc.version} mpc
|
||||
|
||||
# Patch
|
||||
${lib.strings.concatMapSep "\n" (file: "patch -Np1 -i ${file}") patches}
|
||||
# doesn't recognise musl
|
||||
sed -i 's|"os/gnu-linux"|"os/generic"|' libstdc++-v3/configure.host
|
||||
|
||||
# Configure
|
||||
export CC="gcc -Wl,-dynamic-linker -Wl,${stage1.musl.package}/lib/libc.so"
|
||||
export CFLAGS_FOR_TARGET="-Wl,-dynamic-linker -Wl,${stage1.musl.package}/lib/libc.so"
|
||||
export C_INCLUDE_PATH="${stage1.musl.package}/include"
|
||||
export CPLUS_INCLUDE_PATH="$C_INCLUDE_PATH"
|
||||
export LIBRARY_PATH="${stage1.musl.package}/lib"
|
||||
|
||||
bash ./configure \
|
||||
--prefix=$out \
|
||||
--build=${platform.build} \
|
||||
--host=${platform.host} \
|
||||
--with-native-system-header-dir=${stage1.musl.package}/include \
|
||||
--with-build-sysroot=${stage1.musl.package} \
|
||||
--enable-languages=c,c++ \
|
||||
--disable-bootstrap \
|
||||
--disable-libmudflap \
|
||||
--disable-libstdcxx-pch \
|
||||
--disable-lto \
|
||||
--disable-multilib
|
||||
|
||||
# Build
|
||||
make -j $NIX_BUILD_CORES
|
||||
|
||||
# Install
|
||||
make -j $NIX_BUILD_CORES install
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,204 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage1.gcc.v46;
|
||||
|
||||
platform = config.aux.platform;
|
||||
builders = config.aux.foundation.builders;
|
||||
|
||||
stage1 = config.aux.foundation.stages.stage1;
|
||||
in
|
||||
{
|
||||
options.aux.foundation.stages.stage1.gcc.v46 = {
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for gcc.";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of the package.";
|
||||
};
|
||||
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "Source for the package.";
|
||||
};
|
||||
|
||||
cc = {
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The cc source for the package.";
|
||||
};
|
||||
};
|
||||
|
||||
gmp = {
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The gmp source for the package.";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of gmp.";
|
||||
};
|
||||
};
|
||||
|
||||
mpfr = {
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The mpfr source for the package.";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of mpfr.";
|
||||
};
|
||||
};
|
||||
|
||||
mpc = {
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The mpc source for the package.";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of mpc.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage1.gcc.v46 = {
|
||||
version = "4.6.4";
|
||||
|
||||
src = builtins.fetchurl {
|
||||
url = "${config.aux.mirrors.gnu}/gcc/gcc-${cfg.version}/gcc-core-${cfg.version}.tar.gz";
|
||||
sha256 = "173kdb188qg79pcz073cj9967rs2vzanyjdjyxy9v0xb0p5sad75";
|
||||
};
|
||||
|
||||
cc = {
|
||||
src = builtins.fetchurl {
|
||||
url = "${config.aux.mirrors.gnu}/gcc/gcc-${cfg.version}/gcc-g++-${cfg.version}.tar.gz";
|
||||
sha256 = "1fqqk5zkmdg4vmqzdmip9i42q6b82i3f6yc0n86n9021cr7ms2k9";
|
||||
};
|
||||
};
|
||||
|
||||
gmp = {
|
||||
version = "4.3.2";
|
||||
|
||||
src = builtins.fetchurl {
|
||||
url = "${config.aux.mirrors.gnu}/gmp/gmp-${cfg.gmp.version}.tar.gz";
|
||||
sha256 = "15rwq54fi3s11izas6g985y9jklm3xprfsmym3v1g6xr84bavqvv";
|
||||
};
|
||||
};
|
||||
|
||||
mpfr = {
|
||||
version = "2.4.2";
|
||||
|
||||
src = builtins.fetchurl {
|
||||
url = "${config.aux.mirrors.gnu}/mpfr/mpfr-${cfg.mpfr.version}.tar.gz";
|
||||
sha256 = "0dxn4904dra50xa22hi047lj8kkpr41d6vb9sd4grca880c7wv94";
|
||||
};
|
||||
};
|
||||
|
||||
mpc = {
|
||||
version = "1.0.3";
|
||||
|
||||
src = builtins.fetchurl {
|
||||
url = "${config.aux.mirrors.gnu}/mpc/mpc-${cfg.mpc.version}.tar.gz";
|
||||
sha256 = "1hzci2zrrd7v3g1jk35qindq05hbl0bhjcyyisq9z209xb3fqzb1";
|
||||
};
|
||||
};
|
||||
|
||||
package =
|
||||
let
|
||||
patches = [
|
||||
# Remove hardcoded NATIVE_SYSTEM_HEADER_DIR
|
||||
./patches/no-system-headers.patch
|
||||
];
|
||||
in
|
||||
builders.bash.build {
|
||||
name = "gcc-${cfg.version}";
|
||||
|
||||
meta = stage1.gcc.meta;
|
||||
|
||||
deps.build.host = [
|
||||
stage1.tinycc.musl.compiler.package
|
||||
stage1.binutils.package
|
||||
stage1.gnumake.package
|
||||
stage1.gnupatch.package
|
||||
stage1.gnused.package
|
||||
stage1.gnugrep.package
|
||||
stage1.gawk.boot.package
|
||||
stage1.diffutils.package
|
||||
stage1.findutils.package
|
||||
stage1.gnutar.musl.package
|
||||
stage1.gzip.package
|
||||
];
|
||||
|
||||
script = ''
|
||||
# Unpack
|
||||
tar xzf ${cfg.src}
|
||||
tar xzf ${cfg.cc.src}
|
||||
tar xzf ${cfg.gmp.src}
|
||||
tar xzf ${cfg.mpfr.src}
|
||||
tar xzf ${cfg.mpc.src}
|
||||
cd gcc-${cfg.version}
|
||||
|
||||
ln -s ../gmp-${cfg.gmp.version} gmp
|
||||
ln -s ../mpfr-${cfg.mpfr.version} mpfr
|
||||
ln -s ../mpc-${cfg.mpc.version} mpc
|
||||
|
||||
# Patch
|
||||
${lib.strings.concatMapSep "\n" (file: "patch -Np1 -i ${file}") patches}
|
||||
|
||||
# Configure
|
||||
export CC="tcc -B ${stage1.tinycc.musl.libs.package}/lib"
|
||||
export C_INCLUDE_PATH="${stage1.tinycc.musl.libs.package}/include:$(pwd)/mpfr/src"
|
||||
export CPLUS_INCLUDE_PATH="$C_INCLUDE_PATH"
|
||||
|
||||
# Avoid "Link tests are not allowed after GCC_NO_EXECUTABLES"
|
||||
export lt_cv_shlibpath_overrides_runpath=yes
|
||||
export ac_cv_func_memcpy=yes
|
||||
export ac_cv_func_strerror=yes
|
||||
|
||||
bash ./configure \
|
||||
--prefix=$out \
|
||||
--build=${platform.build} \
|
||||
--host=${platform.host} \
|
||||
--with-native-system-header-dir=${stage1.tinycc.musl.libs.package}/include \
|
||||
--with-build-sysroot=${stage1.tinycc.musl.libs.package}/include \
|
||||
--disable-bootstrap \
|
||||
--disable-decimal-float \
|
||||
--disable-libatomic \
|
||||
--disable-libcilkrts \
|
||||
--disable-libgomp \
|
||||
--disable-libitm \
|
||||
--disable-libmudflap \
|
||||
--disable-libquadmath \
|
||||
--disable-libsanitizer \
|
||||
--disable-libssp \
|
||||
--disable-libvtv \
|
||||
--disable-lto \
|
||||
--disable-lto-plugin \
|
||||
--disable-multilib \
|
||||
--disable-plugin \
|
||||
--disable-threads \
|
||||
--enable-languages=c \
|
||||
--enable-static \
|
||||
--disable-shared \
|
||||
--enable-threads=single \
|
||||
--disable-libstdcxx-pch \
|
||||
--disable-build-with-cxx
|
||||
|
||||
# Build
|
||||
make -j $NIX_BUILD_CORES
|
||||
|
||||
# Install
|
||||
make -j $NIX_BUILD_CORES install
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,194 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage1.gcc.v8;
|
||||
|
||||
platform = config.aux.platform;
|
||||
builders = config.aux.foundation.builders;
|
||||
|
||||
stage1 = config.aux.foundation.stages.stage1;
|
||||
in
|
||||
{
|
||||
options.aux.foundation.stages.stage1.gcc.v8 = {
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for gcc.";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of the package.";
|
||||
};
|
||||
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "Source for the package.";
|
||||
};
|
||||
|
||||
cc = {
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The cc source for the package.";
|
||||
};
|
||||
};
|
||||
|
||||
gmp = {
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The gmp source for the package.";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of gmp.";
|
||||
};
|
||||
};
|
||||
|
||||
mpfr = {
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The mpfr source for the package.";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of mpfr.";
|
||||
};
|
||||
};
|
||||
|
||||
mpc = {
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The mpc source for the package.";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of mpc.";
|
||||
};
|
||||
};
|
||||
|
||||
isl = {
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The isl source for the package.";
|
||||
};
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of isl.";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage1.gcc.v8 = {
|
||||
version = "8.5.0";
|
||||
|
||||
src = builtins.fetchurl {
|
||||
url = "${config.aux.mirrors.gnu}/gcc/gcc-${cfg.version}/gcc-${cfg.version}.tar.xz";
|
||||
sha256 = "0wiEGlEbuDCmEAOXsAQtskzhH2Qtq26m7kSELlMl7VA=";
|
||||
};
|
||||
|
||||
gmp = {
|
||||
# last version to compile with gcc 4.6
|
||||
version = "6.2.1";
|
||||
src = builtins.fetchurl {
|
||||
url = "${config.aux.mirrors.gnu}/gmp/gmp-${cfg.gmp.version}.tar.xz";
|
||||
sha256 = "/UgpkSzd0S+EGBw0Ucx1K+IkZD6H+sSXtp7d2txJtPI=";
|
||||
};
|
||||
};
|
||||
|
||||
mpfr = {
|
||||
version = "4.2.1";
|
||||
src = builtins.fetchurl {
|
||||
url = "${config.aux.mirrors.gnu}/mpfr/mpfr-${cfg.mpfr.version}.tar.xz";
|
||||
sha256 = "J3gHNTpnJpeJlpRa8T5Sgp46vXqaW3+yeTiU4Y8fy7I=";
|
||||
};
|
||||
};
|
||||
|
||||
mpc = {
|
||||
version = "1.3.1";
|
||||
src = builtins.fetchurl {
|
||||
url = "${config.aux.mirrors.gnu}/mpc/mpc-${cfg.mpc.version}.tar.gz";
|
||||
sha256 = "q2QkkvXPiCt0qgy3MM1BCoHtzb7IlRg86TDnBsHHWbg=";
|
||||
};
|
||||
};
|
||||
|
||||
isl = {
|
||||
version = "0.24";
|
||||
src = builtins.fetchurl {
|
||||
url = "https://gcc.gnu.org/pub/gcc/infrastructure/isl-${cfg.isl.version}.tar.bz2";
|
||||
sha256 = "/PeN2WVsEOuM+fvV9ZoLawE4YgX+GTSzsoegoYmBRcA=";
|
||||
};
|
||||
};
|
||||
|
||||
package = builders.bash.build {
|
||||
name = "gcc-${cfg.version}";
|
||||
|
||||
meta = stage1.gcc.meta;
|
||||
|
||||
deps.build.host = [
|
||||
stage1.gcc.v46.cxx.package
|
||||
stage1.binutils.package
|
||||
stage1.gnumake.package
|
||||
stage1.gnused.package
|
||||
stage1.gnugrep.package
|
||||
stage1.gawk.boot.package
|
||||
stage1.diffutils.package
|
||||
stage1.findutils.package
|
||||
stage1.gnutar.package
|
||||
stage1.gzip.package
|
||||
stage1.bzip2.package
|
||||
stage1.xz.package
|
||||
];
|
||||
|
||||
script = ''
|
||||
# Unpack
|
||||
tar xf ${cfg.src}
|
||||
tar xf ${cfg.gmp.src}
|
||||
tar xf ${cfg.mpfr.src}
|
||||
tar xf ${cfg.mpc.src}
|
||||
tar xf ${cfg.isl.src}
|
||||
cd gcc-${cfg.version}
|
||||
|
||||
ln -s ../gmp-${cfg.gmp.version} gmp
|
||||
ln -s ../mpfr-${cfg.mpfr.version} mpfr
|
||||
ln -s ../mpc-${cfg.mpc.version} mpc
|
||||
ln -s ../isl-${cfg.isl.version} isl
|
||||
|
||||
# Patch
|
||||
# doesn't recognise musl
|
||||
sed -i 's|"os/gnu-linux"|"os/generic"|' libstdc++-v3/configure.host
|
||||
|
||||
# Configure
|
||||
export CC="gcc -Wl,-dynamic-linker -Wl,${stage1.musl.package}/lib/libc.so"
|
||||
export CXX="g++ -Wl,-dynamic-linker -Wl,${stage1.musl.package}/lib/libc.so"
|
||||
export CFLAGS_FOR_TARGET="-Wl,-dynamic-linker -Wl,${stage1.musl.package}/lib/libc.so"
|
||||
export C_INCLUDE_PATH="${stage1.musl.package}/include"
|
||||
export CPLUS_INCLUDE_PATH="$C_INCLUDE_PATH"
|
||||
export LIBRARY_PATH="${stage1.musl.package}/lib"
|
||||
|
||||
bash ./configure \
|
||||
--prefix=$out \
|
||||
--build=${platform.build} \
|
||||
--host=${platform.host} \
|
||||
--with-native-system-header-dir=/include \
|
||||
--with-sysroot=${stage1.musl.package} \
|
||||
--enable-languages=c,c++ \
|
||||
--disable-bootstrap \
|
||||
--disable-libmpx \
|
||||
--disable-libsanitizer \
|
||||
--disable-lto \
|
||||
--disable-multilib \
|
||||
--disable-plugin
|
||||
|
||||
# Build
|
||||
make -j $NIX_BUILD_CORES
|
||||
|
||||
# Install
|
||||
make -j $NIX_BUILD_CORES install-strip
|
||||
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,106 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage1.gnugrep;
|
||||
|
||||
builders = config.aux.foundation.builders;
|
||||
|
||||
stage1 = config.aux.foundation.stages.stage1;
|
||||
in
|
||||
{
|
||||
options.aux.foundation.stages.stage1.gnugrep = {
|
||||
meta = {
|
||||
description = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Description for the package.";
|
||||
default.value = "GNU implementation of the Unix grep command";
|
||||
};
|
||||
|
||||
homepage = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Homepage for the package.";
|
||||
default.value = "https://www.gnu.org/software/grep";
|
||||
};
|
||||
|
||||
license = lib.options.create {
|
||||
# TODO: Add a proper type for licenses.
|
||||
type = lib.types.attrs.any;
|
||||
description = "License for the package.";
|
||||
default.value = lib.licenses.gpl3Plus;
|
||||
};
|
||||
|
||||
platforms = lib.options.create {
|
||||
type = lib.types.list.of lib.types.string;
|
||||
description = "Platforms the package supports.";
|
||||
default.value = [ "i686-linux" ];
|
||||
};
|
||||
|
||||
mainProgram = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "The main program of the package.";
|
||||
default.value = "grep";
|
||||
};
|
||||
};
|
||||
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for gnugrep.";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of the package.";
|
||||
};
|
||||
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "Source for the package.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage1.gnugrep = {
|
||||
version = "2.4";
|
||||
|
||||
src = builtins.fetchurl {
|
||||
url = "${config.aux.mirrors.gnu}/grep/grep-${cfg.version}.tar.gz";
|
||||
sha256 = "05iayw5sfclc476vpviz67hdy03na0pz2kb5csa50232nfx34853";
|
||||
};
|
||||
|
||||
package =
|
||||
let
|
||||
# Thanks to the live-bootstrap project!
|
||||
# See https://github.com/fosslinux/live-bootstrap/blob/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/grep-2.4
|
||||
makefile = builtins.fetchurl {
|
||||
url = "https://github.com/fosslinux/live-bootstrap/raw/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/grep-2.4/mk/main.mk";
|
||||
sha256 = "08an9ljlqry3p15w28hahm6swnd3jxizsd2188przvvsj093j91k";
|
||||
};
|
||||
in
|
||||
builders.bash.boot.build {
|
||||
name = "gnugrep-${cfg.version}";
|
||||
meta = cfg.meta;
|
||||
|
||||
deps.build.host = [
|
||||
stage1.tinycc.mes.compiler.package
|
||||
stage1.gnumake.boot.package
|
||||
];
|
||||
|
||||
script = ''
|
||||
# Unpack
|
||||
ungz --file ${cfg.src} --output grep.tar
|
||||
untar --file grep.tar
|
||||
rm grep.tar
|
||||
cd grep-${cfg.version}
|
||||
|
||||
# Configure
|
||||
cp ${makefile} Makefile
|
||||
|
||||
# Build
|
||||
make CC="tcc -B ${stage1.tinycc.mes.libs.package}/lib"
|
||||
|
||||
# Install
|
||||
make install PREFIX=$out
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,103 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage1.gnum4;
|
||||
|
||||
platform = config.aux.platform;
|
||||
builders = config.aux.foundation.builders;
|
||||
|
||||
stage1 = config.aux.foundation.stages.stage1;
|
||||
in
|
||||
{
|
||||
options.aux.foundation.stages.stage1.gnum4 = {
|
||||
meta = {
|
||||
description = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Description for the package.";
|
||||
default.value = "GNU M4, a macro processor.";
|
||||
};
|
||||
|
||||
homepage = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Homepage for the package.";
|
||||
default.value = "https://www.gnu.org/software/m4";
|
||||
};
|
||||
|
||||
license = lib.options.create {
|
||||
# TODO: Add a proper type for licenses.
|
||||
type = lib.types.attrs.any;
|
||||
description = "License for the package.";
|
||||
default.value = lib.licenses.gpl3Plus;
|
||||
};
|
||||
|
||||
platforms = lib.options.create {
|
||||
type = lib.types.list.of lib.types.string;
|
||||
description = "Platforms the package supports.";
|
||||
default.value = [ "i686-linux" ];
|
||||
};
|
||||
};
|
||||
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for gnum4.";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of the package.";
|
||||
};
|
||||
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "Source for the package.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage1.gnum4 = {
|
||||
version = "1.4.19";
|
||||
|
||||
src = builtins.fetchurl {
|
||||
url = "${config.aux.mirrors.gnu}/m4/m4-${cfg.version}.tar.xz";
|
||||
sha256 = "Y67eXG0zttmxNRHNC+LKwEby5w/QoHqpVzoEqCeDr5Y=";
|
||||
};
|
||||
|
||||
package = builders.bash.build {
|
||||
name = "gnum4-${cfg.version}";
|
||||
meta = cfg.meta;
|
||||
|
||||
deps.build.host = [
|
||||
stage1.gcc.package
|
||||
stage1.musl.package
|
||||
stage1.binutils.package
|
||||
stage1.gnumake.package
|
||||
stage1.gnused.package
|
||||
stage1.gnugrep.package
|
||||
stage1.gawk.package
|
||||
stage1.diffutils.package
|
||||
stage1.findutils.package
|
||||
stage1.gnutar.package
|
||||
stage1.xz.package
|
||||
];
|
||||
|
||||
script = ''
|
||||
# Unpack
|
||||
tar xf ${cfg.src}
|
||||
cd m4-${cfg.version}
|
||||
|
||||
# Configure
|
||||
bash ./configure \
|
||||
--prefix=$out \
|
||||
--build=${platform.build} \
|
||||
--host=${platform.host} \
|
||||
CC=musl-gcc
|
||||
|
||||
# Build
|
||||
make -j $NIX_BUILD_CORES
|
||||
|
||||
# Install
|
||||
make -j $NIX_BUILD_CORES install
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,219 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage1.gnumake.boot;
|
||||
|
||||
builders = config.aux.foundation.builders;
|
||||
|
||||
stage1 = config.aux.foundation.stages.stage1;
|
||||
in
|
||||
{
|
||||
options.aux.foundation.stages.stage1.gnumake.boot = {
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for gnumake.";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of the package.";
|
||||
};
|
||||
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "Source for the package.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage1.gnumake.boot = {
|
||||
version = "4.4.1";
|
||||
|
||||
src = builtins.fetchurl {
|
||||
url = "${config.aux.mirrors.gnu}/make/make-${cfg.version}.tar.gz";
|
||||
sha256 = "1cwgcmwdn7gqn5da2ia91gkyiqs9birr10sy5ykpkaxzcwfzn5nx";
|
||||
};
|
||||
|
||||
package =
|
||||
let
|
||||
patches = [
|
||||
# Replaces /bin/sh with sh, see patch file for reasoning
|
||||
./patches/0001-No-impure-bin-sh.patch
|
||||
# Purity: don't look for library dependencies (of the form `-lfoo') in /lib
|
||||
# and /usr/lib. It's a stupid feature anyway. Likewise, when searching for
|
||||
# included Makefiles, don't look in /usr/include and friends.
|
||||
./patches/0002-remove-impure-dirs.patch
|
||||
# Fixes for tinycc. See comments in patch file for reasoning
|
||||
./patches/0003-tinycc-support.patch
|
||||
];
|
||||
|
||||
/*
|
||||
Maintenance notes:
|
||||
|
||||
Generated by
|
||||
./configure \
|
||||
--build i686-pc-linux-gnu \
|
||||
--host i686-pc-linux-gnu \
|
||||
CC="${tinycc.compiler}/bin/tcc -B ${tinycc.libs}/lib" \
|
||||
ac_cv_func_dup=no
|
||||
- `ac_cv_func_dup` disabled as mes-libc doesn't implement tmpfile()
|
||||
|
||||
The output src/config.h was then manually filtered, removing definitions that
|
||||
didn't have uses in the source code
|
||||
*/
|
||||
config = [
|
||||
"-DFILE_TIMESTAMP_HI_RES=0"
|
||||
"-DHAVE_ALLOCA"
|
||||
"-DHAVE_ALLOCA_H"
|
||||
"-DHAVE_ATEXIT"
|
||||
"-DHAVE_DECL_BSD_SIGNAL=0"
|
||||
"-DHAVE_DECL_GETLOADAVG=0"
|
||||
"-DHAVE_DECL_SYS_SIGLIST=0"
|
||||
"-DHAVE_DECL__SYS_SIGLIST=0"
|
||||
"-DHAVE_DECL___SYS_SIGLIST=0"
|
||||
"-DHAVE_DIRENT_H"
|
||||
"-DHAVE_DUP2"
|
||||
"-DHAVE_FCNTL_H"
|
||||
"-DHAVE_FDOPEN"
|
||||
"-DHAVE_GETCWD"
|
||||
"-DHAVE_GETTIMEOFDAY"
|
||||
"-DHAVE_INTTYPES_H"
|
||||
"-DHAVE_ISATTY"
|
||||
"-DHAVE_LIMITS_H"
|
||||
"-DHAVE_LOCALE_H"
|
||||
"-DHAVE_MEMORY_H"
|
||||
"-DHAVE_MKTEMP"
|
||||
"-DHAVE_SA_RESTART"
|
||||
"-DHAVE_SETVBUF"
|
||||
"-DHAVE_SIGACTION"
|
||||
"-DHAVE_SIGSETMASK"
|
||||
"-DHAVE_STDINT_H"
|
||||
"-DHAVE_STDLIB_H"
|
||||
"-DHAVE_STRDUP"
|
||||
"-DHAVE_STRERROR"
|
||||
"-DHAVE_STRINGS_H"
|
||||
"-DHAVE_STRING_H"
|
||||
"-DHAVE_STRTOLL"
|
||||
"-DHAVE_SYS_FILE_H"
|
||||
"-DHAVE_SYS_PARAM_H"
|
||||
"-DHAVE_SYS_RESOURCE_H"
|
||||
"-DHAVE_SYS_SELECT_H"
|
||||
"-DHAVE_SYS_STAT_H"
|
||||
"-DHAVE_SYS_TIMEB_H"
|
||||
"-DHAVE_SYS_TIME_H"
|
||||
"-DHAVE_SYS_WAIT_H"
|
||||
"-DHAVE_TTYNAME"
|
||||
"-DHAVE_UMASK"
|
||||
"-DHAVE_UNISTD_H"
|
||||
"-DHAVE_WAITPID"
|
||||
"-DMAKE_JOBSERVER"
|
||||
"-DMAKE_SYMLINKS"
|
||||
"-DPATH_SEPARATOR_CHAR=':'"
|
||||
"-DSCCS_GET=\\\"get\\\""
|
||||
"-DSTDC_HEADERS"
|
||||
"-Dsig_atomic_t=int"
|
||||
"-Dvfork=fork"
|
||||
];
|
||||
|
||||
cflags = [
|
||||
"-I./src"
|
||||
"-I./lib"
|
||||
"-DHAVE_CONFIG_H"
|
||||
"-DMAKE_MAINTAINER_MODE"
|
||||
"-DLIBDIR=\\\"${builtins.placeholder "out"}/lib\\\""
|
||||
"-DLOCALEDIR=\\\"/fake-locale\\\""
|
||||
"-DPOSIX=1"
|
||||
# mes-libc doesn't implement osync_* methods
|
||||
"-DNO_OUTPUT_SYNC=1"
|
||||
# mes-libc doesn't define O_TMPFILE
|
||||
"-DO_TMPFILE=020000000"
|
||||
] ++ config;
|
||||
|
||||
sources = {
|
||||
# Maintenance note: list of source files derived from Basic.mk
|
||||
make = [
|
||||
"src/ar.c"
|
||||
"src/arscan.c"
|
||||
"src/commands.c"
|
||||
"src/default.c"
|
||||
"src/dir.c"
|
||||
"src/expand.c"
|
||||
"src/file.c"
|
||||
"src/function.c"
|
||||
"src/getopt.c"
|
||||
"src/getopt1.c"
|
||||
"src/guile.c"
|
||||
"src/hash.c"
|
||||
"src/implicit.c"
|
||||
"src/job.c"
|
||||
"src/load.c"
|
||||
"src/loadapi.c"
|
||||
"src/main.c"
|
||||
"src/misc.c"
|
||||
"src/output.c"
|
||||
"src/read.c"
|
||||
"src/remake.c"
|
||||
"src/rule.c"
|
||||
"src/shuffle.c"
|
||||
"src/signame.c"
|
||||
"src/strcache.c"
|
||||
"src/variable.c"
|
||||
"src/version.c"
|
||||
"src/vpath.c"
|
||||
];
|
||||
glob = [
|
||||
"lib/fnmatch.c"
|
||||
"lib/glob.c"
|
||||
];
|
||||
remote = [ "src/remote-stub.c" ];
|
||||
};
|
||||
|
||||
files = sources.make ++ sources.glob ++ sources.remote ++ [ "src/posixos.c" ];
|
||||
|
||||
objects = builtins.map (
|
||||
value: builtins.replaceStrings [ ".c" ] [ ".o" ] (builtins.baseNameOf value)
|
||||
) files;
|
||||
in
|
||||
builders.kaem.build {
|
||||
name = "gnumake-${cfg.version}";
|
||||
|
||||
meta = stage1.gnumake.meta;
|
||||
|
||||
deps.build.host = [
|
||||
stage1.tinycc.mes.compiler.package
|
||||
stage1.gnupatch.package
|
||||
];
|
||||
|
||||
script = ''
|
||||
# Unpack
|
||||
ungz --file ${cfg.src} --output make.tar
|
||||
untar --file make.tar
|
||||
rm make.tar
|
||||
cd make-${cfg.version}
|
||||
|
||||
# Patch
|
||||
${lib.strings.concatMapSep "\n" (file: "patch -Np1 -i ${file}") patches}
|
||||
|
||||
# Configure
|
||||
catm src/config.h src/mkconfig.h src/mkcustom.h
|
||||
cp lib/glob.in.h lib/glob.h
|
||||
cp lib/fnmatch.in.h lib/fnmatch.h
|
||||
|
||||
# Compile
|
||||
alias CC="tcc -B ${stage1.tinycc.mes.libs.package}/lib ${builtins.concatStringsSep " " cflags}"
|
||||
${lib.strings.concatMapSep "\n" (file: "CC -c ${file}") files}
|
||||
|
||||
# Link
|
||||
CC -o make ${builtins.concatStringsSep " " objects}
|
||||
|
||||
# Check
|
||||
./make --version
|
||||
|
||||
# Install
|
||||
mkdir -p ''${out}/bin
|
||||
cp ./make ''${out}/bin
|
||||
chmod 555 ''${out}/bin/make
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,118 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage1.gnumake;
|
||||
|
||||
platform = config.aux.platform;
|
||||
builders = config.aux.foundation.builders;
|
||||
|
||||
stage1 = config.aux.foundation.stages.stage1;
|
||||
in
|
||||
{
|
||||
includes = [ ./boot.nix ];
|
||||
|
||||
options.aux.foundation.stages.stage1.gnumake = {
|
||||
meta = {
|
||||
description = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Description for the package.";
|
||||
default.value = "A tool to control the generation of non-source files from sources";
|
||||
};
|
||||
|
||||
homepage = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Homepage for the package.";
|
||||
default.value = "https://www.gnu.org/software/make";
|
||||
};
|
||||
|
||||
license = lib.options.create {
|
||||
# TODO: Add a proper type for licenses.
|
||||
type = lib.types.attrs.any;
|
||||
description = "License for the package.";
|
||||
default.value = lib.licenses.gpl3Plus;
|
||||
};
|
||||
|
||||
platforms = lib.options.create {
|
||||
type = lib.types.list.of lib.types.string;
|
||||
description = "Platforms the package supports.";
|
||||
default.value = [ "i686-linux" ];
|
||||
};
|
||||
};
|
||||
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for gnumake.";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of the package.";
|
||||
};
|
||||
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "Source for the package.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage1.gnumake = {
|
||||
version = "4.4.1";
|
||||
|
||||
src = builtins.fetchurl {
|
||||
url = "${config.aux.mirrors.gnu}/make/make-${cfg.version}.tar.gz";
|
||||
sha256 = "3Rb7HWe/q3mnL16DkHNcSePo5wtJRaFasfgd23hlj7M=";
|
||||
};
|
||||
|
||||
package =
|
||||
let
|
||||
patches = [
|
||||
# Replaces /bin/sh with sh, see patch file for reasoning
|
||||
./patches/0001-No-impure-bin-sh.patch
|
||||
# Purity: don't look for library dependencies (of the form `-lfoo') in /lib
|
||||
# and /usr/lib. It's a stupid feature anyway. Likewise, when searching for
|
||||
# included Makefiles, don't look in /usr/include and friends.
|
||||
./patches/0002-remove-impure-dirs.patch
|
||||
];
|
||||
in
|
||||
builders.bash.boot.build {
|
||||
name = "gnumake-${cfg.version}";
|
||||
|
||||
meta = cfg.meta;
|
||||
|
||||
deps.build.host = [
|
||||
stage1.tinycc.musl.compiler.package
|
||||
stage1.gnumake.boot.package
|
||||
stage1.gnupatch.package
|
||||
stage1.gnused.package
|
||||
stage1.gnugrep.package
|
||||
stage1.gawk.boot.package
|
||||
stage1.gnutar.boot.package
|
||||
stage1.gzip.package
|
||||
];
|
||||
|
||||
script = ''
|
||||
# Unpack
|
||||
tar xzf ${cfg.src}
|
||||
cd make-${cfg.version}
|
||||
|
||||
# Patch
|
||||
${lib.strings.concatMapSep "\n" (file: "patch -Np1 -i ${file}") patches}
|
||||
|
||||
# Configure
|
||||
export CC="tcc -B ${stage1.tinycc.musl.libs.package}/lib"
|
||||
export LD=tcc
|
||||
bash ./configure \
|
||||
--prefix=$out \
|
||||
--build=${platform.build} \
|
||||
--host=${platform.host}
|
||||
|
||||
# Build
|
||||
make AR="tcc -ar"
|
||||
|
||||
# Install
|
||||
make install
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
From e00a5257a6ca5fedbf68b09eee7df3502971a057 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
|
||||
Date: Sat, 24 Apr 2021 10:11:40 +0200
|
||||
Subject: [PATCH 1/2] No impure bin sh
|
||||
|
||||
default_shell is used to populuate default shell used to execute jobs.
|
||||
Unless SHELL is set to a different value this would be /bin/sh.
|
||||
Our stdenv provides sh in form of bash anyway. Having this value not
|
||||
hard-coded has some advantages:
|
||||
|
||||
- It would ensure that on all systems it uses sh from its PATH rather
|
||||
than /bin/sh, which helps as different systems might have different
|
||||
shells there (bash vs. dash)
|
||||
- In the past I had issues with LD_PRELOAD with BEAR, where /bin/sh
|
||||
used a different glibc than BEAR which came from my development shell.
|
||||
---
|
||||
src/job.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/job.c b/src/job.c
|
||||
index ae1f18b..6b4ddb3 100644
|
||||
--- a/src/job.c
|
||||
+++ b/src/job.c
|
||||
@@ -77,7 +77,7 @@ char * vms_strsignal (int status);
|
||||
|
||||
#else
|
||||
|
||||
-const char *default_shell = "/bin/sh";
|
||||
+const char *default_shell = "sh";
|
||||
int batch_mode_shell = 0;
|
||||
|
||||
#endif
|
||||
--
|
||||
2.31.1
|
||||
|
||||
|
|
@ -1,41 +0,0 @@
|
|||
From 795d63d3c8b5c0dbb7e544954f75507b371b7228 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
|
||||
Date: Sat, 24 Apr 2021 10:20:16 +0200
|
||||
Subject: [PATCH 2/2] remove impure dirs
|
||||
|
||||
---
|
||||
src/read.c | 3 ---
|
||||
src/remake.c | 2 --
|
||||
2 files changed, 5 deletions(-)
|
||||
|
||||
diff --git a/src/read.c b/src/read.c
|
||||
index fa197fb..defacfb 100644
|
||||
--- a/src/read.c
|
||||
+++ b/src/read.c
|
||||
@@ -109,9 +109,6 @@ static const char *default_include_directories[] =
|
||||
#endif
|
||||
INCLUDEDIR,
|
||||
#ifndef _AMIGA
|
||||
- "/usr/gnu/include",
|
||||
- "/usr/local/include",
|
||||
- "/usr/include",
|
||||
#endif
|
||||
0
|
||||
};
|
||||
diff --git a/src/remake.c b/src/remake.c
|
||||
index fb237c5..94bff7d 100644
|
||||
--- a/src/remake.c
|
||||
+++ b/src/remake.c
|
||||
@@ -1601,8 +1601,6 @@ library_search (const char *lib, FILE_TIMESTAMP *mtime_ptr)
|
||||
static const char *dirs[] =
|
||||
{
|
||||
#ifndef _AMIGA
|
||||
- "/lib",
|
||||
- "/usr/lib",
|
||||
#endif
|
||||
#if defined(WINDOWS32) && !defined(LIBDIR)
|
||||
/*
|
||||
--
|
||||
2.31.1
|
||||
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
diff --git a/src/dir.c b/src/dir.c
|
||||
index 3e94b98..cfaa6a2 100644
|
||||
--- a/src/dir.c
|
||||
+++ b/src/dir.c
|
||||
@@ -1331,10 +1331,9 @@ local_stat (const char *path, struct stat *buf)
|
||||
|
||||
/* Similarly for lstat. */
|
||||
#if !defined(lstat) && !defined(WINDOWS32) || defined(VMS)
|
||||
-# ifndef VMS
|
||||
-# ifndef HAVE_SYS_STAT_H
|
||||
+// mes-libc implements but does not declare lstat
|
||||
+# if (!defined(VMS) && !defined(HAVE_SYS_STAT_H)) || defined(__TINYC__)
|
||||
int lstat (const char *path, struct stat *sbuf);
|
||||
-# endif
|
||||
# else
|
||||
/* We are done with the fake lstat. Go back to the real lstat */
|
||||
# ifdef lstat
|
||||
diff --git a/src/job.c b/src/job.c
|
||||
index ea88561..8388a82 100644
|
||||
--- a/src/job.c
|
||||
+++ b/src/job.c
|
||||
@@ -2052,7 +2052,8 @@ job_next_command (struct child *child)
|
||||
static int
|
||||
load_too_high (void)
|
||||
{
|
||||
-#if defined(__MSDOS__) || defined(VMS) || defined(_AMIGA) || defined(__riscos__)
|
||||
+// mes-libc does not support getloadavg
|
||||
+#if defined(__MSDOS__) || defined(VMS) || defined(_AMIGA) || defined(__riscos__) || defined (__TINYC__)
|
||||
return 1;
|
||||
#else
|
||||
static double last_sec;
|
||||
diff --git a/src/main.c b/src/main.c
|
||||
index a9d3a64..664d40f 100644
|
||||
--- a/src/main.c
|
||||
+++ b/src/main.c
|
||||
@@ -2770,7 +2770,7 @@ main (int argc, char **argv, char **envp)
|
||||
char *b = alloca (40);
|
||||
sprintf (b, "MAKE_RESTARTS=%s%u",
|
||||
OUTPUT_IS_TRACED () ? "-" : "", restarts);
|
||||
- putenv (b);
|
||||
+ // mes-libc does not support putenv
|
||||
}
|
||||
|
||||
fflush (stdout);
|
||||
diff --git a/src/misc.c b/src/misc.c
|
||||
index eb14f40..bffca82 100644
|
||||
--- a/src/misc.c
|
||||
+++ b/src/misc.c
|
||||
@@ -653,7 +653,8 @@ get_tmppath ()
|
||||
|
||||
# ifdef HAVE_MKTEMP
|
||||
path = get_tmptemplate ();
|
||||
- if (*mktemp (path) == '\0')
|
||||
+ // tinycc: "src/misc.c:656: error: pointer expected"
|
||||
+ if (!strcmp(mktemp (path), ""))
|
||||
{
|
||||
OSS (error, NILF,
|
||||
_("cannot generate temp path from %s: %s"), path, strerror (errno));
|
||||
|
|
@ -1,158 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage1.gnupatch;
|
||||
|
||||
builders = config.aux.foundation.builders;
|
||||
|
||||
stage1 = config.aux.foundation.stages.stage1;
|
||||
in
|
||||
{
|
||||
options.aux.foundation.stages.stage1.gnupatch = {
|
||||
meta = {
|
||||
description = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Description for the package.";
|
||||
default.value = "GNU Patch, a program to apply differences to files.";
|
||||
};
|
||||
|
||||
homepage = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Homepage for the package.";
|
||||
default.value = "https://www.gnu.org/software/patch";
|
||||
};
|
||||
|
||||
license = lib.options.create {
|
||||
# TODO: Add a proper type for licenses.
|
||||
type = lib.types.attrs.any;
|
||||
description = "License for the package.";
|
||||
default.value = lib.licenses.gpl3Plus;
|
||||
};
|
||||
|
||||
platforms = lib.options.create {
|
||||
type = lib.types.list.of lib.types.string;
|
||||
description = "Platforms the package supports.";
|
||||
default.value = [ "i686-linux" ];
|
||||
};
|
||||
};
|
||||
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for gnupatch.";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of the package.";
|
||||
};
|
||||
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "Source for the package.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage1.gnupatch = {
|
||||
version = "2.5.9";
|
||||
|
||||
src = builtins.fetchurl {
|
||||
url = "${config.aux.mirrors.gnu}/patch/patch-${cfg.version}.tar.gz";
|
||||
sha256 = "12nv7jx3gxfp50y11nxzlnmqqrpicjggw6pcsq0wyavkkm3cddgc";
|
||||
};
|
||||
|
||||
package =
|
||||
let
|
||||
# Thanks to the live-bootstrap project!
|
||||
# https://github.com/fosslinux/live-bootstrap/blob/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/patch-2.5.9/mk/main.mk
|
||||
cflags = [
|
||||
"-I."
|
||||
"-DHAVE_DECL_GETENV"
|
||||
"-DHAVE_DECL_MALLOC"
|
||||
"-DHAVE_DIRENT_H"
|
||||
"-DHAVE_LIMITS_H"
|
||||
"-DHAVE_GETEUID"
|
||||
"-DHAVE_MKTEMP"
|
||||
"-DPACKAGE_BUGREPORT="
|
||||
"-Ded_PROGRAM=\\\"/nullop\\\""
|
||||
"-Dmbstate_t=int" # When HAVE_MBRTOWC is not enabled uses of mbstate_t are always a no-op
|
||||
"-DRETSIGTYPE=int"
|
||||
"-DHAVE_MKDIR"
|
||||
"-DHAVE_RMDIR"
|
||||
"-DHAVE_FCNTL_H"
|
||||
"-DPACKAGE_NAME=\\\"patch\\\""
|
||||
"-DPACKAGE_VERSION=\\\"${cfg.version}\\\""
|
||||
"-DHAVE_MALLOC"
|
||||
"-DHAVE_REALLOC"
|
||||
"-DSTDC_HEADERS"
|
||||
"-DHAVE_STRING_H"
|
||||
"-DHAVE_STDLIB_H"
|
||||
];
|
||||
|
||||
# Maintenance note: List of sources from Makefile.in
|
||||
files = [
|
||||
"addext.c"
|
||||
"argmatch.c"
|
||||
"backupfile.c"
|
||||
"basename.c"
|
||||
"dirname.c"
|
||||
"getopt.c"
|
||||
"getopt1.c"
|
||||
"inp.c"
|
||||
"maketime.c"
|
||||
"partime.c"
|
||||
"patch.c"
|
||||
"pch.c"
|
||||
"quote.c"
|
||||
"quotearg.c"
|
||||
"quotesys.c"
|
||||
"util.c"
|
||||
"version.c"
|
||||
"xmalloc.c"
|
||||
];
|
||||
|
||||
sources = files ++ [
|
||||
# mes-libc doesn't implement `error()`
|
||||
"error.c"
|
||||
];
|
||||
|
||||
objects = builtins.map (
|
||||
value: builtins.replaceStrings [ ".c" ] [ ".o" ] (builtins.baseNameOf value)
|
||||
) sources;
|
||||
in
|
||||
builders.kaem.build {
|
||||
name = "gnupatch-${cfg.version}";
|
||||
|
||||
meta = cfg.meta;
|
||||
src = cfg.src;
|
||||
|
||||
deps.build.host = [ stage1.tinycc.mes.compiler.package ];
|
||||
|
||||
script = ''
|
||||
# Unpack
|
||||
ungz --file ${cfg.src} --output patch.tar
|
||||
untar --file patch.tar
|
||||
rm patch.tar
|
||||
cd patch-${cfg.version}
|
||||
|
||||
# Configure
|
||||
catm config.h
|
||||
|
||||
# Build
|
||||
alias CC="tcc -B ${stage1.tinycc.mes.libs.package}/lib ${builtins.concatStringsSep " " cflags}"
|
||||
${lib.strings.concatMapSep "\n" (source: "CC -c ${source}") sources}
|
||||
|
||||
# Link
|
||||
CC -o patch ${builtins.concatStringsSep " " objects}
|
||||
|
||||
# Check
|
||||
./patch --version
|
||||
|
||||
# Install
|
||||
mkdir -p ''${out}/bin
|
||||
cp ./patch ''${out}/bin
|
||||
chmod 555 ''${out}/bin/patch
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,77 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage1.gnused.boot;
|
||||
|
||||
builders = config.aux.foundation.builders;
|
||||
|
||||
stage1 = config.aux.foundation.stages.stage1;
|
||||
in
|
||||
{
|
||||
options.aux.foundation.stages.stage1.gnused.boot = {
|
||||
package = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "The package to use for gnused-boot.";
|
||||
};
|
||||
|
||||
version = lib.options.create {
|
||||
type = lib.types.string;
|
||||
description = "Version of the package.";
|
||||
};
|
||||
|
||||
src = lib.options.create {
|
||||
type = lib.types.derivation;
|
||||
description = "Source for the package.";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
aux.foundation.stages.stage1.gnused.boot = {
|
||||
version = "4.0.9";
|
||||
|
||||
src = builtins.fetchurl {
|
||||
url = "${config.aux.mirrors.gnu}/sed/sed-${cfg.version}.tar.gz";
|
||||
sha256 = "0006gk1dw2582xsvgx6y6rzs9zw8b36rhafjwm288zqqji3qfrf3";
|
||||
};
|
||||
|
||||
package =
|
||||
let
|
||||
# Thanks to the live-bootstrap project!
|
||||
# See https://github.com/fosslinux/live-bootstrap/blob/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/sed-4.0.9/sed-4.0.9.kaem
|
||||
makefile = builtins.fetchurl {
|
||||
url = "https://github.com/fosslinux/live-bootstrap/raw/1bc4296091c51f53a5598050c8956d16e945b0f5/sysa/sed-4.0.9/mk/main.mk";
|
||||
sha256 = "0w1f5ri0g5zla31m6l6xyzbqwdvandqfnzrsw90dd6ak126w3mya";
|
||||
};
|
||||
in
|
||||
builders.bash.boot.build {
|
||||
name = "gnused-boot-${cfg.version}";
|
||||
|
||||
meta = stage1.gnused.meta;
|
||||
|
||||
deps.build.host = [
|
||||
stage1.tinycc.mes.compiler.package
|
||||
stage1.gnumake.boot.package
|
||||
];
|
||||
|
||||
script = ''
|
||||
# Unpack
|
||||
ungz --file ${cfg.src} --output sed.tar
|
||||
untar --file sed.tar
|
||||
rm sed.tar
|
||||
cd sed-${cfg.version}
|
||||
|
||||
# Configure
|
||||
cp ${makefile} Makefile
|
||||
catm config.h
|
||||
|
||||
# Build
|
||||
make \
|
||||
CC="tcc -B ${stage1.tinycc.mes.libs.package}/lib" \
|
||||
LIBC=mes
|
||||
|
||||
# Install
|
||||
make install PREFIX=$out
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1,111 +0,0 @@
|
|||
{ lib, config }:
|
||||
let
|
||||
cfg = config.aux.foundation.stages.stage1.gnused;
|
||||
|
||||
platform = config.aux.platform;
|
||||
builders = config.aux.foundation.builders;
|
||||
|
||||
stage1 = config.aux.foundation.stages.stage1;
|
||||
in
|
||||
{
|
||||
includes = [ ./boot.nix ];
|
||||
|
||||