From 85e3fea0d48cc15f3ed9b02c5b6f7e9398fb5c99 Mon Sep 17 00:00:00 2001 From: Jake Hamilton <jake.hamilton@hey.com> Date: Sun, 30 Mar 2025 06:55:20 -0700 Subject: [PATCH] chore(foundation): remove foundation from labs --- README.md | 1 - foundation/LICENSE | 23 - foundation/README.md | 111 -- foundation/default.nix | 14 - foundation/flake.lock | 7 - foundation/flake.nix | 33 - foundation/npins/default.nix | 80 -- foundation/npins/sources.json | 16 - foundation/src/builders/bash/boot.nix | 82 -- foundation/src/builders/bash/default.nix | 82 -- foundation/src/builders/file/text/default.nix | 75 -- foundation/src/builders/kaem/default.nix | 68 -- foundation/src/builders/raw/default.nix | 49 - foundation/src/default.nix | 16 - foundation/src/exports/default.nix | 43 - foundation/src/mirrors/default.nix | 10 - foundation/src/platform/default.nix | 346 ------ .../stages/stage0/architecture/default.nix | 35 - foundation/src/stages/stage0/default.nix | 79 -- foundation/src/stages/stage0/kaem/build.kaem | 3 - foundation/src/stages/stage0/kaem/default.nix | 71 -- .../stage0/mescc-tools-extra/build.kaem | 40 - .../stage0/mescc-tools-extra/default.nix | 82 -- .../src/stages/stage0/mescc-tools/build.kaem | 205 ---- .../src/stages/stage0/mescc-tools/default.nix | 180 --- .../src/stages/stage0/phases/phase00.nix | 110 -- .../src/stages/stage0/phases/phase01.nix | 65 - .../src/stages/stage0/phases/phase02.nix | 66 -- .../src/stages/stage0/phases/phase03.nix | 74 -- .../src/stages/stage0/phases/phase04.nix | 84 -- .../src/stages/stage0/phases/phase05.nix | 98 -- .../src/stages/stage0/phases/phase06.nix | 149 --- .../src/stages/stage0/phases/phase07.nix | 139 --- .../src/stages/stage0/phases/phase08.nix | 158 --- .../src/stages/stage0/phases/phase09.nix | 173 --- .../src/stages/stage0/phases/phase10.nix | 176 --- .../src/stages/stage0/phases/phase11.nix | 177 --- .../src/stages/stage0/phases/phase12.nix | 179 --- .../src/stages/stage0/sources/default.nix | 92 -- foundation/src/stages/stage1/bash/boot.nix | 162 --- foundation/src/stages/stage1/bash/default.nix | 125 -- .../bash/patches/mksignames-flush.patch | 11 - .../src/stages/stage1/binutils/default.nix | 146 --- .../binutils/patches/deterministic.patch | 13 - .../src/stages/stage1/bison/default.nix | 104 -- .../src/stages/stage1/bzip2/default.nix | 96 -- .../src/stages/stage1/coreutils/boot.nix | 138 --- .../src/stages/stage1/coreutils/default.nix | 112 -- foundation/src/stages/stage1/default.nix | 105 -- .../src/stages/stage1/diffutils/default.nix | 104 -- .../src/stages/stage1/findutils/default.nix | 110 -- foundation/src/stages/stage1/gawk/boot.nix | 88 -- foundation/src/stages/stage1/gawk/default.nix | 110 -- .../stages/stage1/gawk/patches/no-stamp.patch | 11 - foundation/src/stages/stage1/gcc/default.nix | 222 ---- .../gcc/patches/no-system-headers.patch | 12 - foundation/src/stages/stage1/gcc/v4.6.cxx.nix | 187 --- foundation/src/stages/stage1/gcc/v4.6.nix | 204 ---- foundation/src/stages/stage1/gcc/v8.nix | 194 --- .../src/stages/stage1/gnugrep/default.nix | 106 -- .../src/stages/stage1/gnum4/default.nix | 103 -- foundation/src/stages/stage1/gnumake/boot.nix | 219 ---- .../src/stages/stage1/gnumake/default.nix | 118 -- .../patches/0001-No-impure-bin-sh.patch | 36 - .../patches/0002-remove-impure-dirs.patch | 41 - .../gnumake/patches/0003-tinycc-support.patch | 59 - .../src/stages/stage1/gnupatch/default.nix | 158 --- foundation/src/stages/stage1/gnused/boot.nix | 77 -- .../src/stages/stage1/gnused/default.nix | 111 -- foundation/src/stages/stage1/gnutar/boot.nix | 77 -- .../src/stages/stage1/gnutar/default.nix | 114 -- foundation/src/stages/stage1/gnutar/musl.nix | 79 -- foundation/src/stages/stage1/gzip/default.nix | 98 -- .../src/stages/stage1/heirloom/default.nix | 166 --- .../src/stages/stage1/heirloom/devtools.nix | 150 --- foundation/src/stages/stage1/heirloom/musl.h | 53 - .../heirloom/patches/cp-no-socket.patch | 84 -- .../heirloom/patches/disable-programs.patch | 43 - .../heirloom/patches/dont-link-lm.patch | 44 - .../stage1/heirloom/patches/langinfo.patch | 99 -- .../heirloom/patches/meslibc-support.patch | 322 ----- .../stage1/heirloom/patches/proctab.patch | 11 - .../stage1/heirloom/patches/strcoll.patch | 73 -- .../stage1/heirloom/patches/sysconf.patch | 77 -- .../heirloom/patches/tcc-empty-ar.patch | 11 - .../stage1/heirloom/patches/termios.patch | 141 --- .../stage1/heirloom/patches/utime.patch | 90 -- .../stage1/heirloom/patches/vprintf.patch | 128 -- .../src/stages/stage1/heirloom/proctab.c | 206 ---- foundation/src/stages/stage1/heirloom/stubs.h | 64 - .../stages/stage1/linux-headers/default.nix | 92 -- .../src/stages/stage1/ln-boot/default.nix | 63 - foundation/src/stages/stage1/ln-boot/main.c | 16 - foundation/src/stages/stage1/mes/compiler.nix | 109 -- .../src/stages/stage1/mes/create-sources.sh | 99 -- foundation/src/stages/stage1/mes/default.nix | 37 - foundation/src/stages/stage1/mes/libc.nix | 93 -- foundation/src/stages/stage1/mes/libs.nix | 253 ---- foundation/src/stages/stage1/mes/sources.nix | 1056 ----------------- foundation/src/stages/stage1/musl/boot.nix | 139 --- foundation/src/stages/stage1/musl/default.nix | 116 -- .../stage1/musl/patches/always-flush.patch | 13 - .../src/stages/stage1/nyacc/default.nix | 77 -- .../src/stages/stage1/python/default.nix | 121 -- .../stage1/python/patches/no-ldconfig.patch | 108 -- foundation/src/stages/stage1/tinycc/boot.nix | 197 --- .../src/stages/stage1/tinycc/default.nix | 55 - .../src/stages/stage1/tinycc/helpers.nix | 183 --- foundation/src/stages/stage1/tinycc/mes.nix | 146 --- foundation/src/stages/stage1/tinycc/musl.nix | 178 --- .../patches/ignore-duplicate-symbols.patch | 14 - .../patches/ignore-static-inside-array.patch | 22 - .../stage1/tinycc/patches/static-link.patch | 11 - foundation/src/stages/stage1/xz/default.nix | 108 -- foundation/src/stages/stage1/zlib/default.nix | 97 -- foundation/src/stages/stage2/bash/default.nix | 118 -- .../src/stages/stage2/binutils/default.nix | 135 --- .../binutils/patches/deterministic.patch | 13 - .../src/stages/stage2/busybox/default.nix | 119 -- .../busybox/patches/busybox-in-store.patch | 24 - .../src/stages/stage2/bzip2/default.nix | 98 -- .../src/stages/stage2/coreutils/default.nix | 113 -- foundation/src/stages/stage2/default.nix | 49 - .../src/stages/stage2/diffutils/default.nix | 107 -- .../src/stages/stage2/findutils/default.nix | 107 -- foundation/src/stages/stage2/gawk/default.nix | 112 -- foundation/src/stages/stage2/gcc/default.nix | 218 ---- .../src/stages/stage2/glibc/default.nix | 110 -- .../src/stages/stage2/gnugrep/default.nix | 112 -- .../src/stages/stage2/gnumake/default.nix | 122 -- .../patches/0001-No-impure-bin-sh.patch | 36 - .../patches/0002-remove-impure-dirs.patch | 41 - .../gnumake/patches/0003-tinycc-support.patch | 59 - .../src/stages/stage2/gnupatch/default.nix | 106 -- .../src/stages/stage2/gnused/default.nix | 113 -- .../src/stages/stage2/gnutar/default.nix | 111 -- foundation/src/stages/stage2/gzip/default.nix | 105 -- .../src/stages/stage2/patchelf/default.nix | 106 -- foundation/src/system/default.nix | 13 - tidepool/default.nix | 11 +- tidepool/flake.lock | 22 +- tidepool/flake.nix | 10 +- tidepool/npins/sources.json | 11 + 143 files changed, 20 insertions(+), 14587 deletions(-) delete mode 100644 foundation/LICENSE delete mode 100644 foundation/README.md delete mode 100644 foundation/default.nix delete mode 100644 foundation/flake.lock delete mode 100644 foundation/flake.nix delete mode 100644 foundation/npins/default.nix delete mode 100644 foundation/npins/sources.json delete mode 100644 foundation/src/builders/bash/boot.nix delete mode 100644 foundation/src/builders/bash/default.nix delete mode 100644 foundation/src/builders/file/text/default.nix delete mode 100644 foundation/src/builders/kaem/default.nix delete mode 100644 foundation/src/builders/raw/default.nix delete mode 100644 foundation/src/default.nix delete mode 100644 foundation/src/exports/default.nix delete mode 100644 foundation/src/mirrors/default.nix delete mode 100644 foundation/src/platform/default.nix delete mode 100644 foundation/src/stages/stage0/architecture/default.nix delete mode 100644 foundation/src/stages/stage0/default.nix delete mode 100644 foundation/src/stages/stage0/kaem/build.kaem delete mode 100644 foundation/src/stages/stage0/kaem/default.nix delete mode 100644 foundation/src/stages/stage0/mescc-tools-extra/build.kaem delete mode 100644 foundation/src/stages/stage0/mescc-tools-extra/default.nix delete mode 100644 foundation/src/stages/stage0/mescc-tools/build.kaem delete mode 100644 foundation/src/stages/stage0/mescc-tools/default.nix delete mode 100644 foundation/src/stages/stage0/phases/phase00.nix delete mode 100644 foundation/src/stages/stage0/phases/phase01.nix delete mode 100644 foundation/src/stages/stage0/phases/phase02.nix delete mode 100644 foundation/src/stages/stage0/phases/phase03.nix delete mode 100644 foundation/src/stages/stage0/phases/phase04.nix delete mode 100644 foundation/src/stages/stage0/phases/phase05.nix delete mode 100644 foundation/src/stages/stage0/phases/phase06.nix delete mode 100644 foundation/src/stages/stage0/phases/phase07.nix delete mode 100644 foundation/src/stages/stage0/phases/phase08.nix delete mode 100644 foundation/src/stages/stage0/phases/phase09.nix delete mode 100644 foundation/src/stages/stage0/phases/phase10.nix delete mode 100644 foundation/src/stages/stage0/phases/phase11.nix delete mode 100644 foundation/src/stages/stage0/phases/phase12.nix delete mode 100644 foundation/src/stages/stage0/sources/default.nix delete mode 100644 foundation/src/stages/stage1/bash/boot.nix delete mode 100644 foundation/src/stages/stage1/bash/default.nix delete mode 100644 foundation/src/stages/stage1/bash/patches/mksignames-flush.patch delete mode 100644 foundation/src/stages/stage1/binutils/default.nix delete mode 100644 foundation/src/stages/stage1/binutils/patches/deterministic.patch delete mode 100644 foundation/src/stages/stage1/bison/default.nix delete mode 100644 foundation/src/stages/stage1/bzip2/default.nix delete mode 100644 foundation/src/stages/stage1/coreutils/boot.nix delete mode 100644 foundation/src/stages/stage1/coreutils/default.nix delete mode 100644 foundation/src/stages/stage1/default.nix delete mode 100644 foundation/src/stages/stage1/diffutils/default.nix delete mode 100644 foundation/src/stages/stage1/findutils/default.nix delete mode 100644 foundation/src/stages/stage1/gawk/boot.nix delete mode 100644 foundation/src/stages/stage1/gawk/default.nix delete mode 100644 foundation/src/stages/stage1/gawk/patches/no-stamp.patch delete mode 100644 foundation/src/stages/stage1/gcc/default.nix delete mode 100644 foundation/src/stages/stage1/gcc/patches/no-system-headers.patch delete mode 100644 foundation/src/stages/stage1/gcc/v4.6.cxx.nix delete mode 100644 foundation/src/stages/stage1/gcc/v4.6.nix delete mode 100644 foundation/src/stages/stage1/gcc/v8.nix delete mode 100644 foundation/src/stages/stage1/gnugrep/default.nix delete mode 100644 foundation/src/stages/stage1/gnum4/default.nix delete mode 100644 foundation/src/stages/stage1/gnumake/boot.nix delete mode 100644 foundation/src/stages/stage1/gnumake/default.nix delete mode 100644 foundation/src/stages/stage1/gnumake/patches/0001-No-impure-bin-sh.patch delete mode 100644 foundation/src/stages/stage1/gnumake/patches/0002-remove-impure-dirs.patch delete mode 100644 foundation/src/stages/stage1/gnumake/patches/0003-tinycc-support.patch delete mode 100644 foundation/src/stages/stage1/gnupatch/default.nix delete mode 100644 foundation/src/stages/stage1/gnused/boot.nix delete mode 100644 foundation/src/stages/stage1/gnused/default.nix delete mode 100644 foundation/src/stages/stage1/gnutar/boot.nix delete mode 100644 foundation/src/stages/stage1/gnutar/default.nix delete mode 100644 foundation/src/stages/stage1/gnutar/musl.nix delete mode 100644 foundation/src/stages/stage1/gzip/default.nix delete mode 100644 foundation/src/stages/stage1/heirloom/default.nix delete mode 100644 foundation/src/stages/stage1/heirloom/devtools.nix delete mode 100644 foundation/src/stages/stage1/heirloom/musl.h delete mode 100644 foundation/src/stages/stage1/heirloom/patches/cp-no-socket.patch delete mode 100644 foundation/src/stages/stage1/heirloom/patches/disable-programs.patch delete mode 100644 foundation/src/stages/stage1/heirloom/patches/dont-link-lm.patch delete mode 100644 foundation/src/stages/stage1/heirloom/patches/langinfo.patch delete mode 100644 foundation/src/stages/stage1/heirloom/patches/meslibc-support.patch delete mode 100644 foundation/src/stages/stage1/heirloom/patches/proctab.patch delete mode 100644 foundation/src/stages/stage1/heirloom/patches/strcoll.patch delete mode 100644 foundation/src/stages/stage1/heirloom/patches/sysconf.patch delete mode 100644 foundation/src/stages/stage1/heirloom/patches/tcc-empty-ar.patch delete mode 100644 foundation/src/stages/stage1/heirloom/patches/termios.patch delete mode 100644 foundation/src/stages/stage1/heirloom/patches/utime.patch delete mode 100644 foundation/src/stages/stage1/heirloom/patches/vprintf.patch delete mode 100644 foundation/src/stages/stage1/heirloom/proctab.c delete mode 100644 foundation/src/stages/stage1/heirloom/stubs.h delete mode 100644 foundation/src/stages/stage1/linux-headers/default.nix delete mode 100644 foundation/src/stages/stage1/ln-boot/default.nix delete mode 100644 foundation/src/stages/stage1/ln-boot/main.c delete mode 100644 foundation/src/stages/stage1/mes/compiler.nix delete mode 100755 foundation/src/stages/stage1/mes/create-sources.sh delete mode 100644 foundation/src/stages/stage1/mes/default.nix delete mode 100644 foundation/src/stages/stage1/mes/libc.nix delete mode 100644 foundation/src/stages/stage1/mes/libs.nix delete mode 100644 foundation/src/stages/stage1/mes/sources.nix delete mode 100644 foundation/src/stages/stage1/musl/boot.nix delete mode 100644 foundation/src/stages/stage1/musl/default.nix delete mode 100644 foundation/src/stages/stage1/musl/patches/always-flush.patch delete mode 100644 foundation/src/stages/stage1/nyacc/default.nix delete mode 100644 foundation/src/stages/stage1/python/default.nix delete mode 100644 foundation/src/stages/stage1/python/patches/no-ldconfig.patch delete mode 100644 foundation/src/stages/stage1/tinycc/boot.nix delete mode 100644 foundation/src/stages/stage1/tinycc/default.nix delete mode 100644 foundation/src/stages/stage1/tinycc/helpers.nix delete mode 100644 foundation/src/stages/stage1/tinycc/mes.nix delete mode 100644 foundation/src/stages/stage1/tinycc/musl.nix delete mode 100644 foundation/src/stages/stage1/tinycc/patches/ignore-duplicate-symbols.patch delete mode 100644 foundation/src/stages/stage1/tinycc/patches/ignore-static-inside-array.patch delete mode 100644 foundation/src/stages/stage1/tinycc/patches/static-link.patch delete mode 100644 foundation/src/stages/stage1/xz/default.nix delete mode 100644 foundation/src/stages/stage1/zlib/default.nix delete mode 100644 foundation/src/stages/stage2/bash/default.nix delete mode 100644 foundation/src/stages/stage2/binutils/default.nix delete mode 100644 foundation/src/stages/stage2/binutils/patches/deterministic.patch delete mode 100644 foundation/src/stages/stage2/busybox/default.nix delete mode 100644 foundation/src/stages/stage2/busybox/patches/busybox-in-store.patch delete mode 100644 foundation/src/stages/stage2/bzip2/default.nix delete mode 100644 foundation/src/stages/stage2/coreutils/default.nix delete mode 100644 foundation/src/stages/stage2/default.nix delete mode 100644 foundation/src/stages/stage2/diffutils/default.nix delete mode 100644 foundation/src/stages/stage2/findutils/default.nix delete mode 100644 foundation/src/stages/stage2/gawk/default.nix delete mode 100644 foundation/src/stages/stage2/gcc/default.nix delete mode 100644 foundation/src/stages/stage2/glibc/default.nix delete mode 100644 foundation/src/stages/stage2/gnugrep/default.nix delete mode 100644 foundation/src/stages/stage2/gnumake/default.nix delete mode 100644 foundation/src/stages/stage2/gnumake/patches/0001-No-impure-bin-sh.patch delete mode 100644 foundation/src/stages/stage2/gnumake/patches/0002-remove-impure-dirs.patch delete mode 100644 foundation/src/stages/stage2/gnumake/patches/0003-tinycc-support.patch delete mode 100644 foundation/src/stages/stage2/gnupatch/default.nix delete mode 100644 foundation/src/stages/stage2/gnused/default.nix delete mode 100644 foundation/src/stages/stage2/gnutar/default.nix delete mode 100644 foundation/src/stages/stage2/gzip/default.nix delete mode 100644 foundation/src/stages/stage2/patchelf/default.nix delete mode 100644 foundation/src/system/default.nix diff --git a/README.md b/README.md index c931a63..0c0497b 100644 --- a/README.md +++ b/README.md @@ -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. | diff --git a/foundation/LICENSE b/foundation/LICENSE deleted file mode 100644 index 22c5fd5..0000000 --- a/foundation/LICENSE +++ /dev/null @@ -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. diff --git a/foundation/README.md b/foundation/README.md deleted file mode 100644 index d944d40..0000000 --- a/foundation/README.md +++ /dev/null @@ -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. diff --git a/foundation/default.nix b/foundation/default.nix deleted file mode 100644 index c43ed7f..0000000 --- a/foundation/default.nix +++ /dev/null @@ -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 diff --git a/foundation/flake.lock b/foundation/flake.lock deleted file mode 100644 index 5999137..0000000 --- a/foundation/flake.lock +++ /dev/null @@ -1,7 +0,0 @@ -{ - "nodes": { - "root": {} - }, - "root": "root", - "version": 7 -} diff --git a/foundation/flake.nix b/foundation/flake.nix deleted file mode 100644 index a59da8d..0000000 --- a/foundation/flake.nix +++ /dev/null @@ -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 - ); - }; -} diff --git a/foundation/npins/default.nix b/foundation/npins/default.nix deleted file mode 100644 index 5e7d086..0000000 --- a/foundation/npins/default.nix +++ /dev/null @@ -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`" diff --git a/foundation/npins/sources.json b/foundation/npins/sources.json deleted file mode 100644 index 99ec39b..0000000 --- a/foundation/npins/sources.json +++ /dev/null @@ -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 -} \ No newline at end of file diff --git a/foundation/src/builders/bash/boot.nix b/foundation/src/builders/bash/boot.nix deleted file mode 100644 index 452a868..0000000 --- a/foundation/src/builders/bash/boot.nix +++ /dev/null @@ -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; }; - }; - }; -} diff --git a/foundation/src/builders/bash/default.nix b/foundation/src/builders/bash/default.nix deleted file mode 100644 index 3868f47..0000000 --- a/foundation/src/builders/bash/default.nix +++ /dev/null @@ -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; }; - }; - }; -} diff --git a/foundation/src/builders/file/text/default.nix b/foundation/src/builders/file/text/default.nix deleted file mode 100644 index ac34eda..0000000 --- a/foundation/src/builders/file/text/default.nix +++ /dev/null @@ -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; }; - }; - }; -} diff --git a/foundation/src/builders/kaem/default.nix b/foundation/src/builders/kaem/default.nix deleted file mode 100644 index ab8cc5f..0000000 --- a/foundation/src/builders/kaem/default.nix +++ /dev/null @@ -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; }; - }; - }; -} diff --git a/foundation/src/builders/raw/default.nix b/foundation/src/builders/raw/default.nix deleted file mode 100644 index eb170a8..0000000 --- a/foundation/src/builders/raw/default.nix +++ /dev/null @@ -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; }; - }; - }; -} diff --git a/foundation/src/default.nix b/foundation/src/default.nix deleted file mode 100644 index 2df67a4..0000000 --- a/foundation/src/default.nix +++ /dev/null @@ -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 diff --git a/foundation/src/exports/default.nix b/foundation/src/exports/default.nix deleted file mode 100644 index 03a0adc..0000000 --- a/foundation/src/exports/default.nix +++ /dev/null @@ -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; - }; - }; -} diff --git a/foundation/src/mirrors/default.nix b/foundation/src/mirrors/default.nix deleted file mode 100644 index e3dbbfe..0000000 --- a/foundation/src/mirrors/default.nix +++ /dev/null @@ -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"; - }; - }; -} diff --git a/foundation/src/platform/default.nix b/foundation/src/platform/default.nix deleted file mode 100644 index cb8c16c..0000000 --- a/foundation/src/platform/default.nix +++ /dev/null @@ -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"; - }; - }; -} diff --git a/foundation/src/stages/stage0/architecture/default.nix b/foundation/src/stages/stage0/architecture/default.nix deleted file mode 100644 index 4405d1f..0000000 --- a/foundation/src/stages/stage0/architecture/default.nix +++ /dev/null @@ -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"''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage0/default.nix b/foundation/src/stages/stage0/default.nix deleted file mode 100644 index edd064e..0000000 --- a/foundation/src/stages/stage0/default.nix +++ /dev/null @@ -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; - }; - }; - }; -} diff --git a/foundation/src/stages/stage0/kaem/build.kaem b/foundation/src/stages/stage0/kaem/build.kaem deleted file mode 100644 index 164854f..0000000 --- a/foundation/src/stages/stage0/kaem/build.kaem +++ /dev/null @@ -1,3 +0,0 @@ -mkdir -p ${out}/bin -cp ${kaemUnwrapped} ${out}/bin/kaem -chmod 555 ${out}/bin/kaem diff --git a/foundation/src/stages/stage0/kaem/default.nix b/foundation/src/stages/stage0/kaem/default.nix deleted file mode 100644 index acd1105..0000000 --- a/foundation/src/stages/stage0/kaem/default.nix +++ /dev/null @@ -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 ]; - } - ); - }; - }; -} diff --git a/foundation/src/stages/stage0/mescc-tools-extra/build.kaem b/foundation/src/stages/stage0/mescc-tools-extra/build.kaem deleted file mode 100644 index 1fe3042..0000000 --- a/foundation/src/stages/stage0/mescc-tools-extra/build.kaem +++ /dev/null @@ -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 - diff --git a/foundation/src/stages/stage0/mescc-tools-extra/default.nix b/foundation/src/stages/stage0/mescc-tools-extra/default.nix deleted file mode 100644 index 253be54..0000000 --- a/foundation/src/stages/stage0/mescc-tools-extra/default.nix +++ /dev/null @@ -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; - } - ); - }; - }; -} diff --git a/foundation/src/stages/stage0/mescc-tools/build.kaem b/foundation/src/stages/stage0/mescc-tools/build.kaem deleted file mode 100644 index 0db41f4..0000000 --- a/foundation/src/stages/stage0/mescc-tools/build.kaem +++ /dev/null @@ -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 - diff --git a/foundation/src/stages/stage0/mescc-tools/default.nix b/foundation/src/stages/stage0/mescc-tools/default.nix deleted file mode 100644 index ce15baa..0000000 --- a/foundation/src/stages/stage0/mescc-tools/default.nix +++ /dev/null @@ -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"; - } - ); - }; - }; -} diff --git a/foundation/src/stages/stage0/phases/phase00.nix b/foundation/src/stages/stage0/phases/phase00.nix deleted file mode 100644 index 7ce452d..0000000 --- a/foundation/src/stages/stage0/phases/phase00.nix +++ /dev/null @@ -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; - } - ); - }; - }; -} diff --git a/foundation/src/stages/stage0/phases/phase01.nix b/foundation/src/stages/stage0/phases/phase01.nix deleted file mode 100644 index 28a856c..0000000 --- a/foundation/src/stages/stage0/phases/phase01.nix +++ /dev/null @@ -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") - ]; - } - ); - }; - }; -} diff --git a/foundation/src/stages/stage0/phases/phase02.nix b/foundation/src/stages/stage0/phases/phase02.nix deleted file mode 100644 index fb3f1b2..0000000 --- a/foundation/src/stages/stage0/phases/phase02.nix +++ /dev/null @@ -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") - ]; - } - ); - }; - }; -} diff --git a/foundation/src/stages/stage0/phases/phase03.nix b/foundation/src/stages/stage0/phases/phase03.nix deleted file mode 100644 index f446684..0000000 --- a/foundation/src/stages/stage0/phases/phase03.nix +++ /dev/null @@ -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") - ]; - } - ); - }; - }; -} diff --git a/foundation/src/stages/stage0/phases/phase04.nix b/foundation/src/stages/stage0/phases/phase04.nix deleted file mode 100644 index 53da830..0000000 --- a/foundation/src/stages/stage0/phases/phase04.nix +++ /dev/null @@ -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") - ]; - } - ); - }; - }; -} diff --git a/foundation/src/stages/stage0/phases/phase05.nix b/foundation/src/stages/stage0/phases/phase05.nix deleted file mode 100644 index fe4e046..0000000 --- a/foundation/src/stages/stage0/phases/phase05.nix +++ /dev/null @@ -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") - ]; - } - ); - }; - }; -} diff --git a/foundation/src/stages/stage0/phases/phase06.nix b/foundation/src/stages/stage0/phases/phase06.nix deleted file mode 100644 index a5dee9f..0000000 --- a/foundation/src/stages/stage0/phases/phase06.nix +++ /dev/null @@ -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") - ]; - } - ); - }; - }; -} diff --git a/foundation/src/stages/stage0/phases/phase07.nix b/foundation/src/stages/stage0/phases/phase07.nix deleted file mode 100644 index 7829828..0000000 --- a/foundation/src/stages/stage0/phases/phase07.nix +++ /dev/null @@ -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") - ]; - } - ); - }; - }; -} diff --git a/foundation/src/stages/stage0/phases/phase08.nix b/foundation/src/stages/stage0/phases/phase08.nix deleted file mode 100644 index 0656675..0000000 --- a/foundation/src/stages/stage0/phases/phase08.nix +++ /dev/null @@ -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") - ]; - } - ); - }; - }; -} diff --git a/foundation/src/stages/stage0/phases/phase09.nix b/foundation/src/stages/stage0/phases/phase09.nix deleted file mode 100644 index c3fe96d..0000000 --- a/foundation/src/stages/stage0/phases/phase09.nix +++ /dev/null @@ -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") - ]; - } - ); - }; - }; -} diff --git a/foundation/src/stages/stage0/phases/phase10.nix b/foundation/src/stages/stage0/phases/phase10.nix deleted file mode 100644 index 67dac35..0000000 --- a/foundation/src/stages/stage0/phases/phase10.nix +++ /dev/null @@ -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") - ]; - } - ); - }; - }; -} diff --git a/foundation/src/stages/stage0/phases/phase11.nix b/foundation/src/stages/stage0/phases/phase11.nix deleted file mode 100644 index 8873ae0..0000000 --- a/foundation/src/stages/stage0/phases/phase11.nix +++ /dev/null @@ -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") - ]; - } - ); - }; - }; -} diff --git a/foundation/src/stages/stage0/phases/phase12.nix b/foundation/src/stages/stage0/phases/phase12.nix deleted file mode 100644 index c7634a7..0000000 --- a/foundation/src/stages/stage0/phases/phase12.nix +++ /dev/null @@ -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") - ]; - } - ); - }; - }; -} diff --git a/foundation/src/stages/stage0/sources/default.nix b/foundation/src/stages/stage0/sources/default.nix deleted file mode 100644 index c6406c0..0000000 --- a/foundation/src/stages/stage0/sources/default.nix +++ /dev/null @@ -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"; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/bash/boot.nix b/foundation/src/stages/stage1/bash/boot.nix deleted file mode 100644 index d5c7035..0000000 --- a/foundation/src/stages/stage1/bash/boot.nix +++ /dev/null @@ -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 - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/bash/default.nix b/foundation/src/stages/stage1/bash/default.nix deleted file mode 100644 index 2e0b319..0000000 --- a/foundation/src/stages/stage1/bash/default.nix +++ /dev/null @@ -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 - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/bash/patches/mksignames-flush.patch b/foundation/src/stages/stage1/bash/patches/mksignames-flush.patch deleted file mode 100644 index 0b0dfe7..0000000 --- a/foundation/src/stages/stage1/bash/patches/mksignames-flush.patch +++ /dev/null @@ -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 - diff --git a/foundation/src/stages/stage1/binutils/default.nix b/foundation/src/stages/stage1/binutils/default.nix deleted file mode 100644 index cbe9333..0000000 --- a/foundation/src/stages/stage1/binutils/default.nix +++ /dev/null @@ -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 - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/binutils/patches/deterministic.patch b/foundation/src/stages/stage1/binutils/patches/deterministic.patch deleted file mode 100644 index 5b479ba..0000000 --- a/foundation/src/stages/stage1/binutils/patches/deterministic.patch +++ /dev/null @@ -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")); - diff --git a/foundation/src/stages/stage1/bison/default.nix b/foundation/src/stages/stage1/bison/default.nix deleted file mode 100644 index 711f85e..0000000 --- a/foundation/src/stages/stage1/bison/default.nix +++ /dev/null @@ -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 - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/bzip2/default.nix b/foundation/src/stages/stage1/bzip2/default.nix deleted file mode 100644 index 5435bcb..0000000 --- a/foundation/src/stages/stage1/bzip2/default.nix +++ /dev/null @@ -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 - - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/coreutils/boot.nix b/foundation/src/stages/stage1/coreutils/boot.nix deleted file mode 100644 index 46ccba7..0000000 --- a/foundation/src/stages/stage1/coreutils/boot.nix +++ /dev/null @@ -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} - - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/coreutils/default.nix b/foundation/src/stages/stage1/coreutils/default.nix deleted file mode 100644 index a3390e7..0000000 --- a/foundation/src/stages/stage1/coreutils/default.nix +++ /dev/null @@ -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" - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/default.nix b/foundation/src/stages/stage1/default.nix deleted file mode 100644 index 6bc94f8..0000000 --- a/foundation/src/stages/stage1/default.nix +++ /dev/null @@ -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; - }; - }; - }; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/diffutils/default.nix b/foundation/src/stages/stage1/diffutils/default.nix deleted file mode 100644 index c3903ea..0000000 --- a/foundation/src/stages/stage1/diffutils/default.nix +++ /dev/null @@ -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 - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/findutils/default.nix b/foundation/src/stages/stage1/findutils/default.nix deleted file mode 100644 index 30eb797..0000000 --- a/foundation/src/stages/stage1/findutils/default.nix +++ /dev/null @@ -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 - - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/gawk/boot.nix b/foundation/src/stages/stage1/gawk/boot.nix deleted file mode 100644 index 3f79d41..0000000 --- a/foundation/src/stages/stage1/gawk/boot.nix +++ /dev/null @@ -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 - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/gawk/default.nix b/foundation/src/stages/stage1/gawk/default.nix deleted file mode 100644 index 0ac0583..0000000 --- a/foundation/src/stages/stage1/gawk/default.nix +++ /dev/null @@ -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 - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/gawk/patches/no-stamp.patch b/foundation/src/stages/stage1/gawk/patches/no-stamp.patch deleted file mode 100644 index 1351d4e..0000000 --- a/foundation/src/stages/stage1/gawk/patches/no-stamp.patch +++ /dev/null @@ -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 - diff --git a/foundation/src/stages/stage1/gcc/default.nix b/foundation/src/stages/stage1/gcc/default.nix deleted file mode 100644 index 93f91d9..0000000 --- a/foundation/src/stages/stage1/gcc/default.nix +++ /dev/null @@ -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 - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/gcc/patches/no-system-headers.patch b/foundation/src/stages/stage1/gcc/patches/no-system-headers.patch deleted file mode 100644 index 09801d3..0000000 --- a/foundation/src/stages/stage1/gcc/patches/no-system-headers.patch +++ /dev/null @@ -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@ - - diff --git a/foundation/src/stages/stage1/gcc/v4.6.cxx.nix b/foundation/src/stages/stage1/gcc/v4.6.cxx.nix deleted file mode 100644 index 459fde6..0000000 --- a/foundation/src/stages/stage1/gcc/v4.6.cxx.nix +++ /dev/null @@ -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 - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/gcc/v4.6.nix b/foundation/src/stages/stage1/gcc/v4.6.nix deleted file mode 100644 index 5568ac3..0000000 --- a/foundation/src/stages/stage1/gcc/v4.6.nix +++ /dev/null @@ -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 - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/gcc/v8.nix b/foundation/src/stages/stage1/gcc/v8.nix deleted file mode 100644 index c738289..0000000 --- a/foundation/src/stages/stage1/gcc/v8.nix +++ /dev/null @@ -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 - - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/gnugrep/default.nix b/foundation/src/stages/stage1/gnugrep/default.nix deleted file mode 100644 index f5150fb..0000000 --- a/foundation/src/stages/stage1/gnugrep/default.nix +++ /dev/null @@ -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 - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/gnum4/default.nix b/foundation/src/stages/stage1/gnum4/default.nix deleted file mode 100644 index 35482a7..0000000 --- a/foundation/src/stages/stage1/gnum4/default.nix +++ /dev/null @@ -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 - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/gnumake/boot.nix b/foundation/src/stages/stage1/gnumake/boot.nix deleted file mode 100644 index 3518268..0000000 --- a/foundation/src/stages/stage1/gnumake/boot.nix +++ /dev/null @@ -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 - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/gnumake/default.nix b/foundation/src/stages/stage1/gnumake/default.nix deleted file mode 100644 index 94b018b..0000000 --- a/foundation/src/stages/stage1/gnumake/default.nix +++ /dev/null @@ -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 - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/gnumake/patches/0001-No-impure-bin-sh.patch b/foundation/src/stages/stage1/gnumake/patches/0001-No-impure-bin-sh.patch deleted file mode 100644 index 17a08a2..0000000 --- a/foundation/src/stages/stage1/gnumake/patches/0001-No-impure-bin-sh.patch +++ /dev/null @@ -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 - - diff --git a/foundation/src/stages/stage1/gnumake/patches/0002-remove-impure-dirs.patch b/foundation/src/stages/stage1/gnumake/patches/0002-remove-impure-dirs.patch deleted file mode 100644 index 08660a6..0000000 --- a/foundation/src/stages/stage1/gnumake/patches/0002-remove-impure-dirs.patch +++ /dev/null @@ -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 - - diff --git a/foundation/src/stages/stage1/gnumake/patches/0003-tinycc-support.patch b/foundation/src/stages/stage1/gnumake/patches/0003-tinycc-support.patch deleted file mode 100644 index 805f156..0000000 --- a/foundation/src/stages/stage1/gnumake/patches/0003-tinycc-support.patch +++ /dev/null @@ -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)); - diff --git a/foundation/src/stages/stage1/gnupatch/default.nix b/foundation/src/stages/stage1/gnupatch/default.nix deleted file mode 100644 index af02e78..0000000 --- a/foundation/src/stages/stage1/gnupatch/default.nix +++ /dev/null @@ -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 - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/gnused/boot.nix b/foundation/src/stages/stage1/gnused/boot.nix deleted file mode 100644 index 5299386..0000000 --- a/foundation/src/stages/stage1/gnused/boot.nix +++ /dev/null @@ -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 - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/gnused/default.nix b/foundation/src/stages/stage1/gnused/default.nix deleted file mode 100644 index 3c4418f..0000000 --- a/foundation/src/stages/stage1/gnused/default.nix +++ /dev/null @@ -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 ]; - - options.aux.foundation.stages.stage1.gnused = { - meta = { - description = lib.options.create { - type = lib.types.string; - description = "Description for the package."; - default.value = "GNU sed, a batch stream editor."; - }; - - homepage = lib.options.create { - type = lib.types.string; - description = "Homepage for the package."; - default.value = "https://www.gnu.org/software/sed"; - }; - - 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 = "sed"; - }; - }; - - package = lib.options.create { - type = lib.types.derivation; - description = "The package to use for gnused."; - }; - - 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 = { - version = "4.2"; - - src = builtins.fetchurl { - url = "${config.aux.mirrors.gnu}/sed/sed-${cfg.version}.tar.gz"; - sha256 = "20XNY/0BDmUFN9ZdXfznaJplJ0UjZgbl5ceCk3Jn2YM="; - }; - - package = builders.bash.boot.build { - name = "gnused-${cfg.version}"; - - meta = cfg.meta; - - deps.build.host = [ - stage1.tinycc.musl.compiler.package - stage1.gnumake.boot.package - stage1.gnused.boot.package - stage1.gnugrep.package - stage1.gnutar.boot.package - stage1.gzip.package - ]; - - script = '' - # Unpack - tar xzf ${cfg.src} - cd sed-${cfg.version} - - # Configure - export CC="tcc -B ${stage1.tinycc.musl.libs.package}/lib" - export LD=tcc - ./configure \ - --build=${platform.build} \ - --host=${platform.host} \ - --disable-shared \ - --disable-nls \ - --disable-dependency-tracking \ - --prefix=$out - - # Build - make AR="tcc -ar" - - # Install - make install - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/gnutar/boot.nix b/foundation/src/stages/stage1/gnutar/boot.nix deleted file mode 100644 index 678c8b2..0000000 --- a/foundation/src/stages/stage1/gnutar/boot.nix +++ /dev/null @@ -1,77 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage1.gnutar.boot; - - platform = config.aux.platform; - builders = config.aux.foundation.builders; - - stage1 = config.aux.foundation.stages.stage1; -in -{ - options.aux.foundation.stages.stage1.gnutar.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.gnutar.boot = { - version = "1.12"; - - src = builtins.fetchurl { - url = "${config.aux.mirrors.gnu}/tar/tar-${cfg.version}.tar.gz"; - sha256 = "02m6gajm647n8l9a5bnld6fnbgdpyi4i3i83p7xcwv0kif47xhy6"; - }; - - package = - let - in - builders.bash.boot.build { - name = "gnutar-boot-${cfg.version}"; - - meta = stage1.gnutar.meta; - - deps.build.host = [ - stage1.tinycc.mes.compiler.package - stage1.gnumake.boot.package - stage1.gnused.boot.package - stage1.gnugrep.package - ]; - - script = '' - # Unpack - ungz --file ${cfg.src} --output tar.tar - untar --file tar.tar - rm tar.tar - cd tar-${cfg.version} - - # Configure - export CC="tcc -B ${stage1.tinycc.mes.libs.package}/lib" - chmod 0755 missing - bash ./configure \ - --build=${platform.build} \ - --host=${platform.host} \ - --disable-nls \ - --prefix=$out - - # Build - make AR="tcc -ar" - - # Install - make install - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/gnutar/default.nix b/foundation/src/stages/stage1/gnutar/default.nix deleted file mode 100644 index ba25738..0000000 --- a/foundation/src/stages/stage1/gnutar/default.nix +++ /dev/null @@ -1,114 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage1.gnutar; - - platform = config.aux.platform; - builders = config.aux.foundation.builders; - - stage1 = config.aux.foundation.stages.stage1; -in -{ - includes = [ - ./boot.nix - ./musl.nix - ]; - - options.aux.foundation.stages.stage1.gnutar = { - meta = { - description = lib.options.create { - type = lib.types.string; - description = "Description for the package."; - default.value = "GNU implementation of the `tar` archiver"; - }; - - homepage = lib.options.create { - type = lib.types.string; - description = "Homepage for the package."; - default.value = "https://www.gnu.org/software/tar"; - }; - - 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 = "tar"; - }; - }; - - package = lib.options.create { - type = lib.types.derivation; - description = "The package to use for gnutar."; - }; - - 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.gnutar = { - version = "1.35"; - - src = builtins.fetchurl { - url = "${config.aux.mirrors.gnu}/tar/tar-${cfg.version}.tar.gz"; - sha256 = "FNVeMgY+qVJuBX+/Nfyr1TN452l4fv95GcN1WwLStX4="; - }; - - package = builders.bash.boot.build { - name = "gnutar-${cfg.version}"; - - meta = cfg.meta; - - deps.build.host = [ - stage1.gcc.v46.cxx.package - stage1.musl.package - stage1.binutils.package - stage1.gnumake.package - stage1.gnused.package - stage1.gnugrep.package - stage1.gawk.package - stage1.gzip.package - stage1.gnutar.musl.package - ]; - - script = '' - # Unpack - tar xzf ${cfg.src} - cd tar-${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 - - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/gnutar/musl.nix b/foundation/src/stages/stage1/gnutar/musl.nix deleted file mode 100644 index 5da29cb..0000000 --- a/foundation/src/stages/stage1/gnutar/musl.nix +++ /dev/null @@ -1,79 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage1.gnutar.musl; - - platform = config.aux.platform; - builders = config.aux.foundation.builders; - - stage1 = config.aux.foundation.stages.stage1; -in -{ - options.aux.foundation.stages.stage1.gnutar.musl = { - package = lib.options.create { - type = lib.types.derivation; - description = "The package to use for gnutar-musl."; - }; - - 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.gnutar.musl = { - version = "1.12"; - - src = builtins.fetchurl { - url = "${config.aux.mirrors.gnu}/tar/tar-${cfg.version}.tar.gz"; - sha256 = "xsN+iIsTbM76uQPFEUn0t71lnWnUrqISRfYQU6V6pgo="; - }; - - package = builders.bash.boot.build { - name = "gnutar-musl-${cfg.version}"; - - meta = stage1.gnutar.meta; - - deps.build.host = [ - stage1.tinycc.musl.compiler.package - stage1.gnumake.boot.package - stage1.gnused.boot.package - stage1.gnugrep.package - ]; - - script = '' - # Unpack - ungz --file ${cfg.src} --output tar.tar - untar --file tar.tar - rm tar.tar - cd tar-${cfg.version} - - # Configure - export CC="tcc -B ${stage1.tinycc.musl.libs.package}/lib" - export LD=tcc - export ac_cv_sizeof_unsigned_long=4 - export ac_cv_sizeof_long_long=8 - export ac_cv_header_netdb_h=no - chmod 0755 missing - bash ./configure \ - --prefix=$out \ - --build=${platform.build} \ - --host=${platform.host} \ - --disable-nls - - # Build - make AR="tcc -ar" - - # Install - make install - - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/gzip/default.nix b/foundation/src/stages/stage1/gzip/default.nix deleted file mode 100644 index a59b251..0000000 --- a/foundation/src/stages/stage1/gzip/default.nix +++ /dev/null @@ -1,98 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage1.gzip; - - builders = config.aux.foundation.builders; - - stage1 = config.aux.foundation.stages.stage1; -in -{ - options.aux.foundation.stages.stage1.gzip = { - meta = { - description = lib.options.create { - type = lib.types.string; - description = "Description for the package."; - default.value = "GNU zip compression program."; - }; - - homepage = lib.options.create { - type = lib.types.string; - description = "Homepage for the package."; - default.value = "https://www.gnu.org/software/gzip"; - }; - - 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 gzip."; - }; - - 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.gzip = { - version = "1.2.4"; - - src = builtins.fetchurl { - url = "${config.aux.mirrors.gnu}/gzip/gzip-${cfg.version}.tar.gz"; - sha256 = "0ryr5b00qz3xcdcv03qwjdfji8pasp0007ay3ppmk71wl8c1i90w"; - }; - - package = - let - in - builders.bash.boot.build { - name = "gzip-${cfg.version}"; - meta = cfg.meta; - - deps.build.host = [ - stage1.tinycc.mes.compiler.package - stage1.gnumake.boot.package - stage1.gnused.boot.package - stage1.gnugrep.package - ]; - - script = '' - # Unpack - ungz --file ${cfg.src} --output gzip.tar - untar --file gzip.tar - rm gzip.tar - cd gzip-${cfg.version} - - # Configure - export CC="tcc -B ${stage1.tinycc.mes.libs.package}/lib -Dstrlwr=unused" - bash ./configure --prefix=$out - - # Build - make - - # Install - mkdir $out - make install - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/heirloom/default.nix b/foundation/src/stages/stage1/heirloom/default.nix deleted file mode 100644 index 63f79cf..0000000 --- a/foundation/src/stages/stage1/heirloom/default.nix +++ /dev/null @@ -1,166 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage1.heirloom; - - platform = config.aux.platform; - builders = config.aux.foundation.builders; - - stage1 = config.aux.foundation.stages.stage1; - stage2 = config.aux.foundation.stages.stage2; -in -{ - includes = [ ./devtools.nix ]; - - options.aux.foundation.stages.stage1.heirloom = { - meta = { - description = lib.options.create { - type = lib.types.string; - description = "Description for the package."; - default.value = "The Heirloom Toolchest is a collection of standard Unix utilities."; - }; - - homepage = lib.options.create { - type = lib.types.string; - description = "Homepage for the package."; - default.value = "https://heirloom.sourceforge.net/tools.html"; - }; - - license = lib.options.create { - # TODO: Add a proper type for licenses. - type = lib.types.list.of lib.types.attrs.any; - description = "License for the package."; - default.value = [ - lib.licenses.zlib - lib.licenses.caldera - lib.licenses.bsdOriginalUC - lib.licenses.cddl - lib.licenses.bsd3 - lib.licenses.gpl2Plus - lib.licenses.lgpl21Plus - lib.licenses.lpl-102 - lib.licenses.info-zip - ]; - }; - - 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 heirloom."; - }; - - 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.heirloom = { - version = "070715"; - - src = builtins.fetchurl { - url = "https://downloads.sourceforge.net/heirloom/heirloom/${cfg.version}/heirloom-${cfg.version}.tar.bz2"; - sha256 = "6zP3C8wBmx0OCkHx11UtRcV6FicuThxIY07D5ESWow8="; - }; - - package = - let - patches = [ - # we pre-generate nawk's proctab.c as meslibc is not capable of running maketab - # during build time (insufficient sscanf support) - ./patches/proctab.patch - - # disable utilities that don't build successfully - ./patches/disable-programs.patch - - # "tcc -ar" doesn't support creating empty archives - ./patches/tcc-empty-ar.patch - # meslibc doesn't have seperate libm - ./patches/dont-link-lm.patch - # meslibc's vprintf doesn't support %ll - ./patches/vprintf.patch - # meslibc doesn't support sysconf() - ./patches/sysconf.patch - # meslibc doesn't support locale - ./patches/strcoll.patch - # meslibc doesn't support termios.h - ./patches/termios.patch - # meslibc doesn't support utime.h - ./patches/utime.patch - # meslibc doesn't support langinfo.h - ./patches/langinfo.patch - # support building with meslibc - ./patches/meslibc-support.patch - # remove socket functionality as unsupported by meslibc - ./patches/cp-no-socket.patch - ]; - - makeFlags = [ - # mk.config build options - "CC='tcc -B ${stage1.tinycc.mes.libs.package}/lib -include ${./stubs.h} -include ${./musl.h}'" - "AR='tcc -ar'" - "RANLIB=true" - "STRIP=true" - "SHELL=${stage1.bash.package}/bin/sh" - "POSIX_SHELL=${stage1.bash.package}/bin/sh" - "DEFBIN=/bin" - "SV3BIN=/5bin" - "S42BIN=/5bin/s42" - "SUSBIN=/bin" - "SU3BIN=/5bin/posix2001" - "UCBBIN=/ucb" - "CCSBIN=/ccs/bin" - "DEFLIB=/lib" - "DEFSBIN=/bin" - "MANDIR=/share/man" - "LCURS=" # disable ncurses - "USE_ZLIB=0" # disable zlib - "IWCHAR='-I../libwchar'" - "LWCHAR='-L../libwchar -lwchar'" - ]; - in - builders.bash.boot.build { - name = "heirloom-${cfg.version}"; - meta = cfg.meta; - - deps.build.host = [ - stage1.tinycc.mes.compiler.package - stage1.gnumake.package - stage1.gnupatch.package - stage1.heirloom.devtools.package - ]; - - script = '' - # Unpack - unbz2 --file ${cfg.src} --output heirloom.tar - untar --file heirloom.tar - rm heirloom.tar - cd heirloom-${cfg.version} - - # Patch - ${lib.strings.concatMapSep "\n" (file: "patch -Np0 -i ${file}") patches} - cp ${./proctab.c} nawk/proctab.c - - # Build - # These tools are required during later build steps - export PATH="$PATH:$PWD/ed:$PWD/nawk:$PWD/sed" - make ${builtins.concatStringsSep " " makeFlags} - - # Install - make install ROOT=$out ${builtins.concatStringsSep " " makeFlags} - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/heirloom/devtools.nix b/foundation/src/stages/stage1/heirloom/devtools.nix deleted file mode 100644 index 87b9243..0000000 --- a/foundation/src/stages/stage1/heirloom/devtools.nix +++ /dev/null @@ -1,150 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage1.heirloom.devtools; - - platform = config.aux.platform; - builders = config.aux.foundation.builders; - - stage0 = config.aux.foundation.stages.stage0; - stage1 = config.aux.foundation.stages.stage1; - stage2 = config.aux.foundation.stages.stage2; -in -{ - options.aux.foundation.stages.stage1.heirloom.devtools = { - package = lib.options.create { - type = lib.types.derivation; - description = "The package to use for heirloom-devtools."; - }; - - 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."; - }; - - meta = { - description = lib.options.create { - type = lib.types.string; - description = "Description for the package."; - default.value = "Portable yacc and lex derived from OpenSolaris"; - }; - - homepage = lib.options.create { - type = lib.types.string; - description = "Homepage for the package."; - default.value = "https://heirloom.sourceforge.net/devtools.html"; - }; - - license = lib.options.create { - # TODO: Add a proper type for licenses. - type = lib.types.list.of lib.types.attrs.any; - description = "License for the package."; - default.value = [ - lib.licenses.cddl - lib.licenses.bsdOriginalUC - lib.licenses.caldera - ]; - }; - - platforms = lib.options.create { - type = lib.types.list.of lib.types.string; - description = "Platforms the package supports."; - default.value = [ "i686-linux" ]; - }; - }; - }; - - config = { - aux.foundation.stages.stage1.heirloom.devtools = { - version = "070527"; - - src = builtins.fetchurl { - url = "https://downloads.sourceforge.net/heirloom/heirloom-devtools/heirloom-devtools-${cfg.version}.tar.bz2"; - sha256 = "9f233d8b78e4351fe9dd2d50d83958a0e5af36f54e9818521458a08e058691ba"; - }; - - package = - let - # Thanks to the live-bootstrap project! - # See https://github.com/fosslinux/live-bootstrap/blob/d918b984ad6fe4fc7680f3be060fd82f8c9fddd9/sysa/heirloom-devtools-070527/heirloom-devtools-070527.kaem - liveBootstrap = "https://github.com/fosslinux/live-bootstrap/raw/d918b984ad6fe4fc7680f3be060fd82f8c9fddd9/sysa/heirloom-devtools-070527"; - - patches = [ - # Remove all kinds of wchar support. Mes Libc does not support wchar in any form - (builtins.fetchurl { - url = "${liveBootstrap}/patches/yacc_remove_wchar.patch"; - sha256 = "0wgiz02bb7xzjy2gnbjp8y31qy6rc4b29v01zi32zh9lw54j68hc"; - }) - # Similarly to yacc, remove wchar. See yacc patch for further information - (builtins.fetchurl { - url = "${liveBootstrap}/patches/lex_remove_wchar.patch"; - sha256 = "168dfngi51ljjqgd55wbvmffaq61gk48gak50ymnl1br92qkp4zh"; - }) - ]; - in - builders.kaem.build { - name = "heirloom-${cfg.version}"; - meta = cfg.meta; - - deps.build.host = [ - stage1.tinycc.mes.compiler.package - stage1.gnumake.package - stage1.gnupatch.package - stage1.coreutils.package - stage0.mescc-tools-extra.package - ]; - - script = '' - # Unpack - unbz2 --file ${cfg.src} --output heirloom-devtools.tar - untar --file heirloom-devtools.tar - rm heirloom-devtools.tar - build=''${NIX_BUILD_TOP}/heirloom-devtools-${cfg.version} - cd ''${build} - - # Patch - ${lib.strings.concatMapSep "\n" (f: "patch -Np0 -i ${f}") patches} - - # Build yacc - cd yacc - make -f Makefile.mk \ - CC="tcc -B ${stage1.tinycc.mes.libs.package}/lib" \ - AR="tcc -ar" \ - CFLAGS="-DMAXPATHLEN=4096 -DEILSEQ=84 -DMB_LEN_MAX=100" \ - LDFLAGS="-lgetopt" \ - RANLIB=true \ - LIBDIR=''${out}/lib - - # Install yacc - install -D yacc ''${out}/bin/yacc - install -Dm 444 liby.a ''${out}/lib/liby.a - install -Dm 444 yaccpar ''${out}/lib/yaccpar - - # Make yacc available to lex - PATH="''${out}/bin:''${PATH}" - - # Build lex - cd ../lex - make -f Makefile.mk \ - CC="tcc -B ${stage1.tinycc.mes.libs.package}/lib" \ - AR="tcc -ar" \ - CFLAGS="-DEILSEQ=84 -DMB_LEN_MAX=100" \ - LDFLAGS="-lgetopt" \ - RANLIB=true \ - LIBDIR=''${out}/lib - - # Install lex - install -D lex ''${out}/bin/lex - install -Dm 444 ncform ''${out}/lib/lex/ncform - install -Dm 444 nceucform ''${out}/lib/lex/nceucform - install -Dm 444 nrform ''${out}/lib/lex/nrform - install -Dm 444 libl.a ''${out}/lib/libl.a - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/heirloom/musl.h b/foundation/src/stages/stage1/heirloom/musl.h deleted file mode 100644 index b4a3140..0000000 --- a/foundation/src/stages/stage1/heirloom/musl.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - Copyright © 2005-2019 Rich Felker, et al. - - 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 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. -*/ - -// Additional utilities from musl 1.1.24 - -// include/stdlib.h -#define WEXITSTATUS(s) (((s) & 0xff00) >> 8) -#define WTERMSIG(s) ((s) & 0x7f) -#define WIFEXITED(s) (!WTERMSIG(s)) -#define WIFSIGNALED(s) (((s)&0xffff)-1U < 0xffu) - -// include/sys/sysmacros.h -#define major(x) \ - ((unsigned)( (((x)>>31>>1) & 0xfffff000) | (((x)>>8) & 0x00000fff) )) -#define minor(x) \ - ((unsigned)( (((x)>>12) & 0xffffff00) | ((x) & 0x000000ff) )) -#define makedev(x,y) ( \ - (((x)&0xfffff000ULL) << 32) | \ - (((x)&0x00000fffULL) << 8) | \ - (((y)&0xffffff00ULL) << 12) | \ - (((y)&0x000000ffULL)) ) - -// src/misc/basename.c -#include <string.h> -char *basename(char *s) -{ - size_t i; - if (!s || !*s) return "."; - i = strlen(s)-1; - for (; i&&s[i]=='/'; i--) s[i] = 0; - for (; i&&s[i-1]!='/'; i--); - return s+i; -} diff --git a/foundation/src/stages/stage1/heirloom/patches/cp-no-socket.patch b/foundation/src/stages/stage1/heirloom/patches/cp-no-socket.patch deleted file mode 100644 index 88d6e7d..0000000 --- a/foundation/src/stages/stage1/heirloom/patches/cp-no-socket.patch +++ /dev/null @@ -1,84 +0,0 @@ ---- cp/cp.c -+++ cp/cp.c -@@ -42,8 +42,6 @@ static const char sccsid[] USED = "@(#)cp.sl 1.84 (gritter) 3/4/06"; - - #include <sys/types.h> - #include <sys/stat.h> --#include <sys/socket.h> --#include <sys/un.h> - #include <sys/time.h> - #include <sys/resource.h> - #include <fcntl.h> -@@ -427,6 +425,7 @@ fdcopy(const char *src, const struct stat *ssp, const int sfd, - #endif - - #ifdef __linux__ -+#ifdef O_DIRECT - if (!bflag && !Dflag && ssp->st_size > 0) { - long long sent; - -@@ -436,6 +435,7 @@ fdcopy(const char *src, const struct stat *ssp, const int sfd, - if (sent < 0) - goto err; - } -+#endif - #endif /* __linux__ */ - if (pagesize == 0) - if ((pagesize = 4096) < 0) -@@ -702,37 +702,6 @@ symlinkcopy(const char *src, const struct stat *ssp, - } - } - --static void --socketcopy(const char *src, const struct stat *ssp, -- const char *tgt, const struct stat *dsp) --{ -- int fd, addrsz; -- struct sockaddr_un addr; -- size_t len; -- -- if (do_unlink(tgt, dsp) != OKAY) -- return; -- len = strlen(tgt); -- memset(&addr, 0, sizeof addr); -- addr.sun_family = AF_UNIX; -- addrsz = sizeof addr - sizeof addr.sun_path + len; -- if ((len >= sizeof addr.sun_path ? errno = ENAMETOOLONG, fd = -1, 1 : -- (strncpy(addr.sun_path,tgt,sizeof addr.sun_path), 0)) || -- (fd = socket(AF_UNIX, SOCK_STREAM, 0)) < 0 || -- bind(fd, (struct sockaddr *)&addr, addrsz) < 0) { -- fprintf(stderr, "%s: cannot create socket %s\n%s: %s\n", -- progname, tgt, -- progname, strerror(errno)); -- if (fd >= 0) -- close(fd); -- errcnt |= 01; -- return; -- } -- close(fd); -- if (pflag) -- permissions(tgt, ssp); --} -- - static void - specialcopy(const char *src, const struct stat *ssp, - const char *tgt, const struct stat *dsp) -@@ -748,9 +717,6 @@ specialcopy(const char *src, const struct stat *ssp, - case S_IFLNK: - symlinkcopy(src, ssp, tgt, dsp); - break; -- case S_IFSOCK: -- socketcopy(src, ssp, tgt, dsp); -- break; - case S_IFDOOR: - ignoring("door", src); - break; -@@ -1043,7 +1009,7 @@ ln(const char *src, const char *tgt, struct stat *dsp, int level, - errcnt |= 01; - return; - } --#if (defined (SUS) || defined (S42)) && (defined (__linux__) || defined (__sun)) -+#if (defined (SUS) || defined (S42)) && (defined (__linux__) || defined (__sun)) && !defined (__TINYC__) - if (sflag == 0) { - char *rpbuf = alloca(PATH_MAX+1); - if (realpath(src, rpbuf) == NULL) { diff --git a/foundation/src/stages/stage1/heirloom/patches/disable-programs.patch b/foundation/src/stages/stage1/heirloom/patches/disable-programs.patch deleted file mode 100644 index 2b15ae2..0000000 --- a/foundation/src/stages/stage1/heirloom/patches/disable-programs.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- makefile -+++ makefile -@@ -1,21 +1,24 @@ --SHELL = /bin/sh -+SHELL = sh - --SUBDIRS = build libwchar libcommon libuxre _install \ -- banner basename bc bdiff bfs \ -- cal calendar cat chmod chown \ -- cksum cmp col comm copy cp cpio csplit cut \ -- date dc dd deroff diff diff3 dircmp dirname df du \ -+SUBDIRS = libwchar libcommon libuxre _install \ -+ banner basename bdiff bfs \ -+ cat chmod chown \ -+ cksum cmp col comm copy cp csplit cut \ -+ dc dirname \ - echo ed env expand expr \ -- factor file find fmt fmtmsg fold \ -- getconf getopt grep groups hd head hostname id join \ -- kill line listusers ln logins logname ls \ -- mail man mesg mkdir mkfifo mknod more mvdir \ -- nawk news nice nl nohup oawk od \ -- paste pathchk pg pgrep pr printenv printf priocntl ps psrinfo pwd \ -- random renice rm rmdir \ -- sdiff sed setpgrp shl sleep sort spell split stty su sum sync \ -- tabs tail tapecntl tar tcopy tee test time touch tr true tsort tty \ -- ul uname uniq units users wc what who whoami whodo xargs yes -+ file fmt fold \ -+ getopt grep hd head join \ -+ kill line ln logname ls \ -+ mesg mkdir mknod \ -+ nl nohup od \ -+ paste pathchk pgrep pr printenv printf pwd \ -+ random rm rmdir \ -+ sed sleep sort split sum \ -+ tee test touch tr true tsort tty \ -+ uniq units wc what whoami xargs yes -+ -+# These depend on some coreutils that we need to build first -+SUBDIRS += bc nawk build - - dummy: makefiles all - diff --git a/foundation/src/stages/stage1/heirloom/patches/dont-link-lm.patch b/foundation/src/stages/stage1/heirloom/patches/dont-link-lm.patch deleted file mode 100644 index bf7a72b..0000000 --- a/foundation/src/stages/stage1/heirloom/patches/dont-link-lm.patch +++ /dev/null @@ -1,44 +0,0 @@ ---- csplit/Makefile.mk -+++ csplit/Makefile.mk -@@ -1,19 +1,19 @@ - all: csplit csplit_sus csplit_su3 - - csplit: csplit.o -- $(LD) $(LDFLAGS) csplit.o $(LCOMMON) $(LWCHAR) $(LIBS) -lm -o csplit -+ $(LD) $(LDFLAGS) csplit.o $(LCOMMON) $(LWCHAR) $(LIBS) -o csplit - - csplit.o: csplit.c - $(CC) $(CFLAGS) $(CPPFLAGS) $(XO6FL) $(LARGEF) $(IWCHAR) $(ICOMMON) -c csplit.c - - csplit_sus: csplit_sus.o -- $(LD) $(LDFLAGS) csplit_sus.o $(LUXRE) $(LCOMMON) $(LWCHAR) $(LIBS) -lm -o csplit_sus -+ $(LD) $(LDFLAGS) csplit_sus.o $(LUXRE) $(LCOMMON) $(LWCHAR) $(LIBS) -o csplit_sus - - csplit_sus.o: csplit.c - $(CC) $(CFLAGS) $(CPPFLAGS) $(XO6FL) $(LARGEF) $(IUXRE) $(IWCHAR) $(ICOMMON) -DSUS -c csplit.c -o csplit_sus.o - - csplit_su3: csplit_su3.o -- $(LD) $(LDFLAGS) csplit_su3.o $(LUXRE) $(LCOMMON) $(LWCHAR) $(LIBS) -lm -o csplit_su3 -+ $(LD) $(LDFLAGS) csplit_su3.o $(LUXRE) $(LCOMMON) $(LWCHAR) $(LIBS) -o csplit_su3 - - csplit_su3.o: csplit.c - $(CC) $(CFLAGS) $(CPPFLAGS) $(XO6FL) $(LARGEF) $(IUXRE) $(IWCHAR) $(ICOMMON) -DSU3 -c csplit.c -o csplit_su3.o ---- nawk/Makefile.mk -+++ nawk/Makefile.mk -@@ -3,13 +3,13 @@ all: awk awk_sus awk_su3 - OBJ = awk.lx.o b.o lib.o main.o parse.o proctab.o run.o tran.o - - awk: awk.g.o $(OBJ) version.o -- $(LD) $(LDFLAGS) awk.g.o $(OBJ) version.o $(LUXRE) -lm $(LCOMMON) $(LWCHAR) $(LIBS) -o awk -+ $(LD) $(LDFLAGS) awk.g.o $(OBJ) version.o $(LUXRE) $(LCOMMON) $(LWCHAR) $(LIBS) -o awk - - awk_sus: awk.g.o $(OBJ) version_sus.o -- $(LD) $(LDFLAGS) awk.g.o $(OBJ) version_sus.o $(LUXRE) -lm $(LCOMMON) $(LWCHAR) $(LIBS) -o awk_sus -+ $(LD) $(LDFLAGS) awk.g.o $(OBJ) version_sus.o $(LUXRE) $(LCOMMON) $(LWCHAR) $(LIBS) -o awk_sus - - awk_su3: awk.g.2001.o $(OBJ) version_su3.o -- $(LD) $(LDFLAGS) awk.g.2001.o $(OBJ) version_su3.o $(LUXRE) -lm $(LCOMMON) $(LWCHAR) $(LIBS) -o awk_su3 -+ $(LD) $(LDFLAGS) awk.g.2001.o $(OBJ) version_su3.o $(LUXRE) $(LCOMMON) $(LWCHAR) $(LIBS) -o awk_su3 - - awk.g.c: awk.g.y - $(YACC) -d awk.g.y diff --git a/foundation/src/stages/stage1/heirloom/patches/langinfo.patch b/foundation/src/stages/stage1/heirloom/patches/langinfo.patch deleted file mode 100644 index a8ad842..0000000 --- a/foundation/src/stages/stage1/heirloom/patches/langinfo.patch +++ /dev/null @@ -1,99 +0,0 @@ ---- nawk/main.c -+++ nawk/main.c -@@ -35,7 +35,6 @@ - #include <errno.h> - #include <string.h> - #include <locale.h> --#include <langinfo.h> - #include <libgen.h> - - #define CMDCLASS ""/*"UX:"*/ /* Command classification */ ---- sort/sort.c -+++ sort/sort.c -@@ -63,7 +63,6 @@ static const char sccsid[] USED = "@(#)sort.sl 1.37 (gritter) 5/29/05"; - #include <locale.h> - #include <wchar.h> - #include <wctype.h> --#include <langinfo.h> - #include <inttypes.h> - #include <errno.h> - -@@ -287,18 +286,6 @@ main(int argc, char **argv) - else - chkblank(); - compare = cmpf = ccoll ? mb_cur_max > 1 ? cmpm : cmpa : cmpl; -- setlocale(LC_NUMERIC, ""); -- arg = nl_langinfo(RADIXCHAR); -- if (mb_cur_max > 1) -- next(radixchar, arg, i); -- else -- radixchar = *arg & 0377; -- arg = nl_langinfo(THOUSEP); -- if (mb_cur_max > 1) -- next(thousep, arg, i); -- else -- thousep = *arg & 0377; -- setlocale(LC_TIME, ""); - fields = smalloc(NF * sizeof *fields); - copyproto(); - eargv = argv; -@@ -1088,8 +1075,7 @@ cmp(const char *i, const char *j) - } else { - sa = elicpy(collba, pa, la, '\n', ignore, code); - sb = elicpy(collbb, pb, lb, '\n', ignore, code); -- n = fp->Mflg ? monthcmp(collba, collbb) : -- strcoll(collba, collbb); -+ n = strcmp(collba, collbb); - if (n) - return n > 0 ? -fp->rflg : fp->rflg; - pa = &pa[sa]; -@@ -1570,49 +1556,6 @@ upcdup(const char *s) - return r; - } - --static const char *months[12]; -- --#define COPY_ABMON(m) months[m-1] = upcdup(nl_langinfo(ABMON_##m)) -- --static void --fillmonths(void) --{ -- COPY_ABMON(1); -- COPY_ABMON(2); -- COPY_ABMON(3); -- COPY_ABMON(4); -- COPY_ABMON(5); -- COPY_ABMON(6); -- COPY_ABMON(7); -- COPY_ABMON(8); -- COPY_ABMON(9); -- COPY_ABMON(10); -- COPY_ABMON(11); -- COPY_ABMON(12); --} -- --static int --monthcoll(const char *s) --{ -- int i; -- char u[MB_LEN_MAX*3+1]; -- -- cpcu3(u, s); -- for (i = 0; i < 12; i++) -- if (strcmp(u, months[i]) == 0) -- return i; -- return 0; --} -- -- --static int --monthcmp(const char *pa, const char *pb) --{ -- if (months[0] == NULL) -- fillmonths(); -- return monthcoll(pa) - monthcoll(pb); --} -- - /* - * isblank() consumes half of execution time (in skip()) with - * glibc 2.3.1. Check if it contains only space and tab, and diff --git a/foundation/src/stages/stage1/heirloom/patches/meslibc-support.patch b/foundation/src/stages/stage1/heirloom/patches/meslibc-support.patch deleted file mode 100644 index f8f7dae..0000000 --- a/foundation/src/stages/stage1/heirloom/patches/meslibc-support.patch +++ /dev/null @@ -1,322 +0,0 @@ ---- _install/install_ucb.c -+++ _install/install_ucb.c -@@ -267,7 +267,7 @@ cp(const char *src, const char *tgt, struct stat *dsp) - if (check(src, tgt, dsp, &sst) != OKAY) - return; - unlink(tgt); -- if ((dfd = creat(tgt, 0700)) < 0 || fchmod(dfd, 0700) < 0 || -+ if ((dfd = creat(tgt, 0700)) < 0 || chmod(tgt, 0700) < 0 || - fstat(dfd, &nst) < 0) { - fprintf(stderr, "%s: %s: %s\n", progname, src, - strerror(errno)); ---- libcommon/Makefile.mk -+++ libcommon/Makefile.mk -@@ -15,7 +15,7 @@ CHECK: CHECK.c - headers: CHECK - one() { \ - rm -f "$$1.h"; \ -- if grep "$$1_h[ ]*=[ ]*[^0][ ]*;" CHECK >/dev/null; \ -+ if true; \ - then \ - ln -s "_$$1.h" "$$1.h"; \ - fi; \ ---- libcommon/atoll.h -+++ libcommon/atoll.h -@@ -1,8 +1,10 @@ - /* Sccsid @(#)atoll.h 1.4 (gritter) 7/18/04 */ - - #if defined (__hpux) || defined (_AIX) || \ -- defined (__FreeBSD__) && (__FreeBSD__) < 5 -+ (defined (__FreeBSD__) && (__FreeBSD__) < 5) || defined (__TINYC__) -+#ifndef __TINYC__ - extern long long strtoll(const char *nptr, char **endptr, int base); - extern unsigned long long strtoull(const char *nptr, char **endptr, int base); -+#endif - extern long long atoll(const char *nptr); - #endif /* __hpux || _AIX || __FreeBSD__ < 5 */ ---- libcommon/blank.h -+++ libcommon/blank.h -@@ -5,7 +5,7 @@ - */ - /* Sccsid @(#)blank.h 1.3 (gritter) 5/1/04 */ - --#ifndef __dietlibc__ -+#if !defined(__dietlibc__) && !defined(__TINYC__) - #ifndef LIBCOMMON_BLANK_H - #define LIBCOMMON_BLANK_H 1 - ---- libcommon/getdir.c -+++ libcommon/getdir.c -@@ -52,7 +52,7 @@ extern int getdents(int, struct dirent *, size_t); - #undef d_ino - #endif /* __FreeBSD__ || __NetBSD__ || __OpenBSD__ || __DragonFly__ - || __APPLE__ */ --#elif defined (__dietlibc__) -+#elif defined (__dietlibc__) || defined(__TINYC__) - #include <dirent.h> - #include <unistd.h> - #else /* !__GLIBC__, !__dietlibc__ */ ---- libcommon/memalign.c -+++ libcommon/memalign.c -@@ -23,7 +23,7 @@ - - #if defined (__FreeBSD__) || defined (__dietlibc__) || defined (_AIX) || \ - defined (__NetBSD__) || defined (__OpenBSD__) || \ -- defined (__DragonFly__) || defined (__APPLE__) -+ defined (__DragonFly__) || defined (__APPLE__) || defined(__TINYC__) - /* - * FreeBSD malloc(3) promises to page-align the return of malloc() calls - * if size is at least a page. This serves for a poor man's memalign() ---- libcommon/memalign.h -+++ libcommon/memalign.h -@@ -26,7 +26,7 @@ - - #if defined (__FreeBSD__) || defined (__dietlibc__) || defined (_AIX) || \ - defined (__NetBSD__) || defined (__OpenBSD__) || \ -- defined (__DragonFly__) || defined (__APPLE__) -+ defined (__DragonFly__) || defined (__APPLE__) || defined(__TINYC__) - #include <stdlib.h> - - extern void *memalign(size_t, size_t); ---- libcommon/pathconf.c -+++ libcommon/pathconf.c -@@ -21,7 +21,7 @@ - */ - /* Sccsid @(#)pathconf.c 1.2 (gritter) 5/1/04 */ - --#ifdef __dietlibc__ -+#if defined(__dietlibc__) || defined(__TINYC__) - #include <unistd.h> - #include "pathconf.h" - ---- libcommon/pathconf.h -+++ libcommon/pathconf.h -@@ -21,7 +21,7 @@ - */ - /* Sccsid @(#)pathconf.h 1.2 (gritter) 5/1/04 */ - --#ifdef __dietlibc__ -+#if defined(__dietlibc__) || defined(__TINYC__) - #include <unistd.h> - - extern long fpathconf(int, int); ---- libcommon/regexp.h -+++ libcommon/regexp.h -@@ -47,7 +47,7 @@ - static const char regexp_h_sccsid[] REGEXP_H_USED = - "@(#)regexp.sl 1.56 (gritter) 5/29/05"; - --#if !defined (REGEXP_H_USED_FROM_VI) && !defined (__dietlibc__) -+#if !defined (REGEXP_H_USED_FROM_VI) && !defined (__dietlibc__) && !defined (__TINYC__) - #define REGEXP_H_WCHARS - #endif - ---- libcommon/sfile.c -+++ libcommon/sfile.c -@@ -21,7 +21,7 @@ - */ - /* Sccsid @(#)sfile.c 1.9 (gritter) 6/7/04 */ - --#ifdef __linux__ -+#if defined(__linux__) && !defined(__TINYC__) - #undef _FILE_OFFSET_BITS - - #include <sys/types.h> ---- libcommon/sighold.c -+++ libcommon/sighold.c -@@ -22,7 +22,7 @@ - /* Sccsid @(#)sighold.c 1.7 (gritter) 1/22/06 */ - - #if defined (__FreeBSD__) || defined (__dietlibc__) || defined (__NetBSD__) || \ -- defined (__OpenBSD__) || defined (__DragonFly__) || defined (__APPLE__) -+ defined (__OpenBSD__) || defined (__DragonFly__) || defined (__APPLE__) || defined (__TINYC__) - #include <signal.h> - #include "sigset.h" - ---- libcommon/sigignore.c -+++ libcommon/sigignore.c -@@ -22,7 +22,7 @@ - /* Sccsid @(#)sigignore.c 1.6 (gritter) 1/22/06 */ - - #if defined (__FreeBSD__) || defined (__dietlibc__) || defined (__NetBSD__) || \ -- defined (__OpenBSD__) || defined (__DragonFly__) || defined (__APPLE__) -+ defined (__OpenBSD__) || defined (__DragonFly__) || defined (__APPLE__) || defined (__TINYC__) - #include <signal.h> - #include "sigset.h" - ---- libcommon/sigpause.c -+++ libcommon/sigpause.c -@@ -22,7 +22,7 @@ - /* Sccsid @(#)sigpause.c 1.6 (gritter) 1/22/06 */ - - #if defined (__FreeBSD__) || defined (__dietlibc__) || defined (__NetBSD__) || \ -- defined (__OpenBSD__) || defined (__DragonFly__) || defined (__APPLE__) -+ defined (__OpenBSD__) || defined (__DragonFly__) || defined (__APPLE__) || defined (__TINYC__) - #include <signal.h> - #include "sigset.h" - ---- libcommon/sigrelse.c -+++ libcommon/sigrelse.c -@@ -22,7 +22,7 @@ - /* Sccsid @(#)sigrelse.c 1.8 (gritter) 1/22/06 */ - - #if defined (__FreeBSD__) || defined (__dietlibc__) || defined (__NetBSD__) || \ -- defined (__OpenBSD__) || defined (__DragonFly__) || defined (__APPLE__) -+ defined (__OpenBSD__) || defined (__DragonFly__) || defined (__APPLE__) || defined (__TINYC__) - #include <signal.h> - #include "sigset.h" - ---- libcommon/sigset.c -+++ libcommon/sigset.c -@@ -22,7 +22,7 @@ - /* Sccsid @(#)sigset.c 1.7 (gritter) 1/22/06 */ - - #if defined (__FreeBSD__) || defined (__dietlibc__) || defined (__NetBSD__) || \ -- defined (__OpenBSD__) || defined (__DragonFly__) || defined (__APPLE__) -+ defined (__OpenBSD__) || defined (__DragonFly__) || defined (__APPLE__) || defined (__TINYC__) - #include <signal.h> - #include "sigset.h" - -@@ -46,10 +46,7 @@ void (*sigset(int sig, void (*func)(int)))(int) - if (sigaction(sig, func==SIG_HOLD?(struct sigaction *)0:&nact, &oact) - == -1) - return SIG_ERR; -- if (sigismember(&oset, sig)) -- return SIG_HOLD; -- else -- return (oact.sa_handler); -+ return (oact.sa_handler); - } - #endif /* __FreeBSD__ || __dietlibc__ || __NetBSD__ || __OpenBSD__ || - __DragonFly__ || __APPLE__ */ ---- libcommon/sigset.h -+++ libcommon/sigset.h -@@ -22,7 +22,7 @@ - /* Sccsid @(#)sigset.h 1.9 (gritter) 1/22/06 */ - - #if defined (__FreeBSD__) || defined (__dietlibc__) || defined (__NetBSD__) || \ -- defined (__OpenBSD__) || defined (__DragonFly__) || defined (__APPLE__) -+ defined (__OpenBSD__) || defined (__DragonFly__) || defined (__APPLE__) || defined (__TINYC__) - - #ifndef SIG_HOLD - #define SIG_HOLD ((void (*)(int))2) ---- libcommon/strtol.c -+++ libcommon/strtol.c -@@ -1,7 +1,7 @@ - /* Sccsid @(#)strtol.c 1.6 (gritter) 7/18/04 */ - - #if defined (__hpux) || defined (_AIX) || \ -- defined (__FreeBSD__) && (__FreeBSD__) < 5 -+ (defined (__FreeBSD__) && (__FreeBSD__) < 5) || defined (__TINYC__) - - #include <stdlib.h> - #include <ctype.h> -@@ -97,6 +97,7 @@ out: if (pp <= bptr) { - return v * sign; - } - -+#ifndef __TINYC__ - long long - strtoll(const char *nptr, char **endptr, int base) - { -@@ -108,6 +109,7 @@ strtoull(const char *nptr, char **endptr, int base) - { - return (unsigned long long)internal(nptr, endptr, base, 3); - } -+#endif - - long long - atoll(const char *nptr) ---- nawk/awk.h -+++ nawk/awk.h -@@ -156,7 +156,6 @@ extern Cell *rlengthloc; /* RLENGTH */ - #endif - - #ifndef IN_MAKETAB --#include <wchar.h> - - /* - * Get next character from string s and store it in wc; n is set to ---- nawk/awk.lx.l -+++ nawk/awk.lx.l -@@ -71,7 +71,6 @@ - - #include "awk.h" - #include "y.tab.h" --#include <pfmt.h> - #include <unistd.h> - - static void awk_unputstr(const char *s); ---- nawk/run.c -+++ nawk/run.c -@@ -1467,14 +1467,6 @@ Cell *bltin(Node **a, int n) - case FRAND: - u = (Awkfloat) (rand() % 32767) / 32767.0; - break; -- case FSRAND: -- u = saved_srand; /* return previous seed */ -- if (x->tval & REC) /* no argument provided */ -- saved_srand = time(NULL); -- else -- saved_srand = getfval(x); -- srand((int) saved_srand); -- break; - case FTOUPPER: - case FTOLOWER: - p = getsval(x); ---- pgrep/pgrep.c -+++ pgrep/pgrep.c -@@ -214,7 +214,7 @@ chdir_to_proc(void) - fprintf(stderr, "%s: cannot open %s\n", progname, PROCDIR); - exit(3); - } -- if (fchdir(fd) < 0) { -+ if (chdir(PROCDIR) < 0) { - fprintf(stderr, "%s: cannot chdir to %s\n", progname, PROCDIR); - exit(3); - } ---- rm/rm.c -+++ rm/rm.c -@@ -242,7 +242,7 @@ rm(size_t pend, const char *base, const int olddir, int ssub, int level) - } - return; - } -- if (fchdir(df) < 0) { -+ if (chdir(base) < 0) { - if (rmfile(base, &st) < 0) { - fprintf(stderr, - "%s: cannot chdir to %s\n", -@@ -270,7 +270,7 @@ rm(size_t pend, const char *base, const int olddir, int ssub, int level) - progname, path); - errcnt |= 4; - } -- if (olddir >= 0 && fchdir(olddir) < 0) { -+ if (olddir >= 0) { - fprintf(stderr, "%s: cannot change backwards\n", - progname); - exit(1); -@@ -316,24 +316,6 @@ subproc(size_t pend, const char *base, int level) - int status; - - while (waitpid(pid, &status, 0) != pid); -- if (status && WIFSIGNALED(status)) { -- /* -- * If the signal was sent due to a tty keypress, -- * we should be terminated automatically and -- * never reach this point. Otherwise, we terminate -- * with the same signal, but make sure that we do -- * not overwrite a possibly generated core file. -- * This results in nearly the usual behavior except -- * that the shell never prints a 'core dumped' -- * message. -- */ -- struct rlimit rl; -- -- rl.rlim_cur = rl.rlim_max = 0; -- setrlimit(RLIMIT_CORE, &rl); -- raise(WTERMSIG(status)); -- pause(); -- } - return status ? WEXITSTATUS(status) : 0; - } - case -1: diff --git a/foundation/src/stages/stage1/heirloom/patches/proctab.patch b/foundation/src/stages/stage1/heirloom/patches/proctab.patch deleted file mode 100644 index 30913c9..0000000 --- a/foundation/src/stages/stage1/heirloom/patches/proctab.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- nawk/Makefile.mk -+++ nawk/Makefile.mk -@@ -28,8 +28,6 @@ maketab: maketab.o - $(HOSTCC) maketab.o -o maketab - ./maketab > proctab.c - --proctab.c: maketab -- - awk.g.o: awk.g.c - $(CC) $(CFLAGSS) $(CPPFLAGS) $(XO5FL) $(LARGEF) $(IWCHAR) $(ICOMMON) $(IUXRE) -c awk.g.c - diff --git a/foundation/src/stages/stage1/heirloom/patches/strcoll.patch b/foundation/src/stages/stage1/heirloom/patches/strcoll.patch deleted file mode 100644 index 20ed5c5..0000000 --- a/foundation/src/stages/stage1/heirloom/patches/strcoll.patch +++ /dev/null @@ -1,73 +0,0 @@ ---- comm/comm.c -+++ comm/comm.c -@@ -242,7 +242,7 @@ compare(const char *a, const char *b) - return(2); - } - } else { -- n = strcoll(a, b); -+ n = strcmp(a, b); - return n ? n > 0 ? 2 : 1 : 0; - } - } ---- expr/expr.y -+++ expr/expr.y -@@ -234,7 +234,7 @@ _rel(int op, register char *r1, register char *r2) - if (numeric(r1) && numeric(r2)) - i = atoll(r1) - atoll(r2); - else -- i = strcoll(r1, r2); -+ i = strcmp(r1, r2); - switch(op) { - case EQ: i = i==0; break; - case GT: i = i>0; break; ---- join/join.c -+++ join/join.c -@@ -65,7 +65,7 @@ enum { - JF = -1 - }; - #define ppi(f, j) ((j) >= 0 && (j) < ppisize[f] ? ppibuf[f][j] : null) --#define comp() strcoll(ppi(F1, j1),ppi(F2, j2)) -+#define comp() strcmp(ppi(F1, j1),ppi(F2, j2)) - - #define next(wc, s, n) (*(s) & 0200 ? ((n) = mbtowi(&(wc), (s), mb_cur_max), \ - (n) = ((n) > 0 ? (n) : (n) < 0 ? (wc=WEOF, 1) : 1)) : \ ---- ls/ls.c -+++ ls/ls.c -@@ -575,13 +575,13 @@ _mergesort(struct file **al) - static int - namecmp(struct file *f1, struct file *f2) - { -- return strcoll(f1->name, f2->name); -+ return strcmp(f1->name, f2->name); - } - - static int - extcmp(struct file *f1, struct file *f2) - { -- return strcoll(extension(f1->name), extension(f2->name)); -+ return strcmp(extension(f1->name), extension(f2->name)); - } - - static int ---- nawk/run.c -+++ nawk/run.c -@@ -608,7 +608,7 @@ Cell *relop(Node **a, int n) - j = x->fval - y->fval; - i = j<0? -1: (j>0? 1: 0); - } else { -- i = strcoll((char*)getsval(x), (char*)getsval(y)); -+ i = strcmp((char*)getsval(x), (char*)getsval(y)); - } - tempfree(x, ""); - tempfree(y, ""); ---- sort/sort.c -+++ sort/sort.c -@@ -1148,7 +1148,7 @@ cmpl(const char *pa, const char *pb) - - ecpy(collba, pa, '\n'); - ecpy(collbb, pb, '\n'); -- n = strcoll(collba, collbb); -+ n = strcmp(collba, collbb); - return n ? n > 0 ? -fields[0].rflg : fields[0].rflg : 0; - } - diff --git a/foundation/src/stages/stage1/heirloom/patches/sysconf.patch b/foundation/src/stages/stage1/heirloom/patches/sysconf.patch deleted file mode 100644 index 3d1b3e1..0000000 --- a/foundation/src/stages/stage1/heirloom/patches/sysconf.patch +++ /dev/null @@ -1,77 +0,0 @@ ---- cmp/cmp.c -+++ cmp/cmp.c -@@ -264,7 +264,7 @@ openfile(const char *fn) - struct file *f; - - if (pagesize == 0) -- if ((pagesize = sysconf(_SC_PAGESIZE)) < 0) -+ if ((pagesize = 4096) < 0) - pagesize = 4096; - if ((f = memalign(pagesize, sizeof *f)) == NULL) { - write(2, "no memory\n", 10); ---- copy/copy.c -+++ copy/copy.c -@@ -362,7 +362,7 @@ fdcopy(const char *src, const struct stat *sp, int sfd, - goto err; - } - #endif /* __linux__ */ -- if (pagesize == 0 && (pagesize = sysconf(_SC_PAGESIZE)) <= 0) -+ if (pagesize == 0 && (pagesize = 4096) <= 0) - pagesize = 4096; - if ((blksize = sp->st_blksize) <= 0) - blksize = 512; ---- cp/cp.c -+++ cp/cp.c -@@ -438,7 +438,7 @@ fdcopy(const char *src, const struct stat *ssp, const int sfd, - } - #endif /* __linux__ */ - if (pagesize == 0) -- if ((pagesize = sysconf(_SC_PAGESIZE)) < 0) -+ if ((pagesize = 4096) < 0) - pagesize = 4096; - if (bflag) - blksize = bflag; ---- libcommon/ib_alloc.c -+++ libcommon/ib_alloc.c -@@ -41,7 +41,7 @@ ib_alloc(int fd, unsigned blksize) - struct stat st; - - if (pagesize == 0) -- if ((pagesize = sysconf(_SC_PAGESIZE)) < 0) -+ if ((pagesize = 4096) < 0) - pagesize = 4096; - if (blksize == 0) { - if (fstat(fd, &st) < 0) ---- libcommon/memalign.c -+++ libcommon/memalign.c -@@ -40,7 +40,7 @@ memalign(size_t alignment, size_t size) - static long pagesize; - - if (pagesize == 0) -- pagesize = sysconf(_SC_PAGESIZE); -+ pagesize = 4096; - if (alignment != pagesize) - return NULL; - if (size < pagesize) ---- libcommon/oblok.c -+++ libcommon/oblok.c -@@ -100,7 +100,7 @@ ob_alloc(int fd, enum ob_mode bf) - struct oblok *op; - - if (pagesize == 0) -- if ((pagesize = sysconf(_SC_PAGESIZE)) < 0) -+ if ((pagesize = 4096) < 0) - pagesize = 4096; - if ((op = memalign(pagesize, sizeof *op)) == NULL) - return NULL; ---- xargs/xargs.c -+++ xargs/xargs.c -@@ -404,7 +404,7 @@ static void - endcmd(void) - { - a_agg = a_cnt; -- a_maxsize = sysconf(_SC_ARG_MAX) - envsz() - 2048 - a_asz; -+ a_maxsize = 65536 - envsz() - 2048 - a_asz; - if (nflag || sflag) { - long newsize = sflag ? atol(sflag) : - #ifdef WEIRD_LIMITS diff --git a/foundation/src/stages/stage1/heirloom/patches/tcc-empty-ar.patch b/foundation/src/stages/stage1/heirloom/patches/tcc-empty-ar.patch deleted file mode 100644 index 7c57a54..0000000 --- a/foundation/src/stages/stage1/heirloom/patches/tcc-empty-ar.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- libwchar/Makefile.mk -+++ libwchar/Makefile.mk -@@ -10,7 +10,7 @@ fake: - if test "x$(LWCHAR)" = x; \ - then \ - touch $(OBJ); \ -- ar r libwchar.a $(OBJ); \ -+ touch libwchar.a $(OBJ); \ - fi - - install: diff --git a/foundation/src/stages/stage1/heirloom/patches/termios.patch b/foundation/src/stages/stage1/heirloom/patches/termios.patch deleted file mode 100644 index ea40a8d..0000000 --- a/foundation/src/stages/stage1/heirloom/patches/termios.patch +++ /dev/null @@ -1,141 +0,0 @@ ---- ed/ed.c -+++ ed/ed.c -@@ -68,7 +68,6 @@ static const char sccsid[] USED = "@(#)ed.sl 1.99 (gritter) 7/27/06"; - #include <stdlib.h> - #include <signal.h> - #include "sigset.h" --#include <termios.h> - #include <setjmp.h> - #include <libgen.h> - #include <inttypes.h> -@@ -77,7 +76,6 @@ static const char sccsid[] USED = "@(#)ed.sl 1.99 (gritter) 7/27/06"; - #include <ctype.h> - #include <wctype.h> - #include <limits.h> --#include <termios.h> - static int FNSIZE; - static int LBSIZE; - static int RHSIZE; -@@ -2273,22 +2271,10 @@ sclose(int fd) - static void - fspec(const char *lp) - { -- struct termios ts; - const char *cp; - - freetabs(); - maxlength = 0; -- if (tcgetattr(1, &ts) < 0 --#ifdef TAB3 -- || (ts.c_oflag&TAB3) == 0 --#endif -- ) -- return; -- while (lp[0]) { -- if (lp[0] == '<' && lp[1] == ':') -- break; -- lp++; -- } - if (lp[0]) { - lp += 2; - while ((cp = ftok(&lp)) != NULL) { ---- ls/ls.c -+++ ls/ls.c -@@ -102,7 +102,6 @@ static char ifmt_c[] = "-pc-d-b--nl-SD--"; - #include <grp.h> - #include <errno.h> - #include <fcntl.h> --#include <termios.h> - #include <locale.h> - #include <limits.h> - #include <ctype.h> -@@ -110,14 +109,6 @@ static char ifmt_c[] = "-pc-d-b--nl-SD--"; - #include <wchar.h> - #include <wctype.h> - #include "config.h" --#ifndef USE_TERMCAP --#ifndef sun --#include <curses.h> --#include <term.h> --#endif --#else /* USE_TERMCAP */ --#include <termcap.h> --#endif /* USE_TERMCAP */ - - #ifdef _AIX - #include <sys/sysmacros.h> -@@ -989,13 +980,6 @@ printname(const char *name, struct file *f, int doit) - bold++; - } - if (color) { --#ifndef USE_TERMCAP -- if (bold) -- vidattr(A_BOLD); --#else /* USE_TERMCAP */ -- if (Bold) -- tputs(Bold, 1, putchar); --#endif /* USE_TERMCAP */ - printf(color); - } - } -@@ -1056,13 +1040,6 @@ printname(const char *name, struct file *f, int doit) - } - } - if (doit && color) { --#if !defined (USE_TERMCAP) -- if (bold) -- vidattr(A_NORMAL); --#else /* USE_TERMCAP */ -- if (Normal) -- tputs(Normal, 1, putchar); --#endif /* USE_TERMCAP */ - printf(fc_get(FC_NORMAL)); - } - if (f) -@@ -1598,16 +1575,12 @@ main(int argc, char **argv) - { - struct file *flist = nil, **aflist = &flist; - enum depth depth; -- struct winsize ws; - int i; - char *cp; - - #ifdef __GLIBC__ - putenv("POSIXLY_CORRECT=1"); - #endif -- setlocale(LC_COLLATE, ""); -- setlocale(LC_CTYPE, ""); -- setlocale(LC_TIME, ""); - #ifndef UCB - if (getenv("SYSV3") != NULL) - sysv3 = 1; -@@ -1624,16 +1597,6 @@ main(int argc, char **argv) - } - if (istty || isatty(1)) { - istty = 1; --#if !defined (USE_TERMCAP) -- setupterm(NULL, 1, &tinfostat); --#else /* USE_TERMCAP */ -- { -- char buf[2048]; -- if ((cp = getenv("TERM")) != NULL) -- if (tgetent(buf, cp) > 0) -- tinfostat = 1; -- } --#endif /* USE_TERMCAP */ - field |= FL_STATUS; - } - while ((i = getopt(argc, argv, personalities[personality].per_opt)) -@@ -1753,12 +1716,6 @@ main(int argc, char **argv) - if ((cp = getenv("COLUMNS")) != NULL) { - ncols = atoi(cp); - } else if ((present('C') || present('x') || present('m')) && istty) { -- if (ioctl(1, TIOCGWINSZ, &ws) == 0 && ws.ws_col > 0) -- ncols = ws.ws_col - 1; --#if !defined (USE_TERMCAP) -- else if (tinfostat == 1 && columns > 0) -- ncols = columns; --#endif /* !USE_TERMCAP */ - } - depth = SURFACE; - if (optind == argc) { diff --git a/foundation/src/stages/stage1/heirloom/patches/utime.patch b/foundation/src/stages/stage1/heirloom/patches/utime.patch deleted file mode 100644 index 081ac9d..0000000 --- a/foundation/src/stages/stage1/heirloom/patches/utime.patch +++ /dev/null @@ -1,90 +0,0 @@ ---- copy/copy.c -+++ copy/copy.c -@@ -46,7 +46,6 @@ static const char sccsid[] USED = "@(#)copy.sl 1.15 (gritter) 5/29/05"; - #include <libgen.h> - #include <limits.h> - #include <dirent.h> --#include <utime.h> - #include <stdarg.h> - #include "sfile.h" - #include "memalign.h" -@@ -441,12 +440,6 @@ attribs(const char *dst, const struct stat *sp) - if (oflag && ((sp->st_mode&S_IFMT) == S_IFLNK ? - lchown:chown)(dst, sp->st_uid, sp->st_gid) < 0) - complain("Unable to chown %s", dst); -- if (mflag && (sp->st_mode&S_IFMT) != S_IFLNK) { -- struct utimbuf ut; -- ut.actime = sp->st_atime; -- ut.modtime = sp->st_mtime; -- utime(dst, &ut); -- } - } - - static void ---- cp/cp.c -+++ cp/cp.c -@@ -56,7 +56,6 @@ static const char sccsid[] USED = "@(#)cp.sl 1.84 (gritter) 3/4/06"; - #include <libgen.h> - #include <limits.h> - #include <dirent.h> --#include <utime.h> - #include "sfile.h" - #include "memalign.h" - #include "alloca.h" -@@ -354,18 +353,6 @@ permissions(const char *path, const struct stat *ssp) - - mode = ssp->st_mode & 07777; - if (pflag) { -- struct utimbuf ut; -- ut.actime = ssp->st_atime; -- ut.modtime = ssp->st_mtime; -- if (utime(path, &ut) < 0) { --#if defined (SUS) || defined (S42) -- fprintf(stderr, "%s: cannot set times for %s\n%s: %s\n", -- progname, path, -- progname, strerror(errno)); --#endif /* SUS || S42 */ -- if (pers != PERS_MV) -- errcnt |= 010; -- } - if (myuid == 0) { - if (chown(path, ssp->st_uid, ssp->st_gid) < 0) { - #if defined (SUS) || defined (S42) ---- touch/touch.c -+++ touch/touch.c -@@ -47,7 +47,6 @@ static const char sccsid[] USED = "@(#)touch.sl 1.21 (gritter) 5/29/05"; - #include <stdlib.h> - #include <errno.h> - #include <libgen.h> --#include <utime.h> - #include <ctype.h> - #include <time.h> - -@@ -80,7 +79,6 @@ static void - touch(const char *fn) - { - struct stat st; -- struct utimbuf ut; - - if (stat(fn, &st) < 0) { - if (errno == ENOENT) { -@@ -113,19 +111,6 @@ touch(const char *fn) - return; - } - } -- if (aflag) -- ut.actime = nacc; -- else -- ut.actime = st.st_atime; -- if (mflag) -- ut.modtime = nmod; -- else -- ut.modtime = st.st_mtime; -- if (utime(fn, nulltime ? NULL : &ut) < 0) { -- fprintf(stderr, "%s: cannot change times on %s\n", -- progname, fn); -- errcnt++; -- } - } - - static void diff --git a/foundation/src/stages/stage1/heirloom/patches/vprintf.patch b/foundation/src/stages/stage1/heirloom/patches/vprintf.patch deleted file mode 100644 index 6abce89..0000000 --- a/foundation/src/stages/stage1/heirloom/patches/vprintf.patch +++ /dev/null @@ -1,128 +0,0 @@ ---- cksum/cksum.c -+++ cksum/cksum.c -@@ -147,7 +147,7 @@ cksum(const char *name) - s = (s << 8) ^ crctab[(s >> 24) ^ c]; - } - s = ~s; -- printf("%u %llu", (unsigned)s, nbytes); -+ printf("%u %lu", (unsigned)s, nbytes); - if(name) - printf(" %s", name); - printf("\n"); ---- cmp/cmp.c -+++ cmp/cmp.c -@@ -246,8 +246,8 @@ different: - errcnt = 1; - } else { - if (sflag == 0) -- printf("%s %s differ: char %lld," -- " line %lld\n", -+ printf("%s %s differ: char %ld," -+ " line %ld\n", - f1->f_nam, f2->f_nam, - (long long)offset(f1), - line); ---- csplit/csplit.c -+++ csplit/csplit.c -@@ -284,7 +284,7 @@ csplit(const char *fn) - op = nextfile(); - if (op) { - if (!sflag) -- printf("%lld\n", bytes); -+ printf("%ld\n", bytes); - bytes = 0; - fclose(op); - } ---- expr/expr.y -+++ expr/expr.y -@@ -140,7 +140,7 @@ expression: expr NOARG { - if (sus && numeric($1)) { - int64_t n; - n = atoll($1); -- printf("%lld\n", n); -+ printf("%ld\n", n); - exit(n == 0); - } else - puts($1); -@@ -447,10 +447,10 @@ numpr(int64_t val) - int ret; - - rv = smalloc(NUMSZ); -- ret = snprintf(rv, NUMSZ, "%lld", (long long)val); -+ ret = snprintf(rv, NUMSZ, "%ld", (long long)val); - if (ret < 0 || ret >= NUMSZ) { - rv = srealloc(rv, ret + 1); -- ret = snprintf(rv, ret, "%lld", (long long)val); -+ ret = snprintf(rv, ret, "%ld", (long long)val); - if (ret < 0) - yyerror("illegal number"); - } ---- grep/Makefile.mk -+++ grep/Makefile.mk -@@ -92,7 +92,7 @@ config.h: - -echo 'long long foo;' >___build$$$$.c ; \ - $(CC) $(CFLAGS2) $(CPPFLAGS) $(IWCHAR) $(ICOMMON) $(IUXRE) $(LARGEF) -c ___build$$$$.c >/dev/null 2>&1 ; \ - if test $$? = 0 && test -f ___build$$$$.o ; \ -- then echo '#define LONGLONG' >>config.h ; \ -+ then echo '' >>config.h ; \ - fi ; \ - rm -f ___build$$$$.o ___build$$$$.c - ---- ls/Makefile.mk -+++ ls/Makefile.mk -@@ -76,7 +76,7 @@ config.h: - -echo 'long long foo;' >___build$$$$.c ; \ - $(CC) $(CFLAGS) $(CPPFLAGS) $(LARGEF) $(IWCHAR) -c ___build$$$$.c >/dev/null 2>&1 ; \ - if test $$? = 0 && test -f ___build$$$$.o ; \ -- then echo '#define LONGLONG' >>config.h ; \ -+ then echo '' >>config.h ; \ - fi ; \ - rm -f ___build$$$$.o ___build$$$$.c - -echo '#include <sys/types.h>' >___build$$$$.c ; \ ---- pr/pr.c -+++ pr/pr.c -@@ -548,7 +548,7 @@ print(const char *fp, const char **argp) - putcs(" "); - putcs(header); - snprintf(linebuf, sizeof linebuf, -- " Page %lld\n\n\n", page); -+ " Page %ld\n\n\n", page); - putcs(linebuf); - } - c = putpage(); ---- sed/sed1.c -+++ sed/sed1.c -@@ -489,7 +489,7 @@ command(struct reptr *ipc) - break; - - case EQCOM: -- fprintf(stdout, "%lld\n", lnum); -+ fprintf(stdout, "%ld\n", lnum); - break; - - case GCOM: ---- sum/sum.c -+++ sum/sum.c -@@ -116,7 +116,7 @@ sum(const char *name) - else { - s = (s & 0xFFFF) + (s >> 16); - s = (s & 0xFFFF) + (s >> 16); -- printf("%u %llu", (unsigned)s, -+ printf("%u %lu", (unsigned)s, - (unsigned long long)(nbytes+UNIT-1)/UNIT); - } - if(name) ---- wc/wc.c -+++ wc/wc.c -@@ -89,9 +89,9 @@ report(unsigned long long count) - #if defined (S42) - if (putspace++) - printf(" "); -- printf("%llu", count); -+ printf("%lu", count); - #else /* !S42 */ -- printf("%7llu ", count); -+ printf("%7lu ", count); - #endif /* !S42 */ - } - diff --git a/foundation/src/stages/stage1/heirloom/proctab.c b/foundation/src/stages/stage1/heirloom/proctab.c deleted file mode 100644 index 183e10a..0000000 --- a/foundation/src/stages/stage1/heirloom/proctab.c +++ /dev/null @@ -1,206 +0,0 @@ -#include <stdio.h> -#include "awk.h" -#include "y.tab.h" - -static unsigned char *printname[92] = { - (unsigned char *) "FIRSTTOKEN", /* 258 */ - (unsigned char *) "PROGRAM", /* 259 */ - (unsigned char *) "PASTAT", /* 260 */ - (unsigned char *) "PASTAT2", /* 261 */ - (unsigned char *) "XBEGIN", /* 262 */ - (unsigned char *) "XEND", /* 263 */ - (unsigned char *) "NL", /* 264 */ - (unsigned char *) "ARRAY", /* 265 */ - (unsigned char *) "MATCH", /* 266 */ - (unsigned char *) "NOTMATCH", /* 267 */ - (unsigned char *) "MATCHOP", /* 268 */ - (unsigned char *) "FINAL", /* 269 */ - (unsigned char *) "DOT", /* 270 */ - (unsigned char *) "ALL", /* 271 */ - (unsigned char *) "CCL", /* 272 */ - (unsigned char *) "NCCL", /* 273 */ - (unsigned char *) "CHAR", /* 274 */ - (unsigned char *) "MCHAR", /* 275 */ - (unsigned char *) "OR", /* 276 */ - (unsigned char *) "STAR", /* 277 */ - (unsigned char *) "QUEST", /* 278 */ - (unsigned char *) "PLUS", /* 279 */ - (unsigned char *) "AND", /* 280 */ - (unsigned char *) "BOR", /* 281 */ - (unsigned char *) "APPEND", /* 282 */ - (unsigned char *) "EQ", /* 283 */ - (unsigned char *) "GE", /* 284 */ - (unsigned char *) "GT", /* 285 */ - (unsigned char *) "LE", /* 286 */ - (unsigned char *) "LT", /* 287 */ - (unsigned char *) "NE", /* 288 */ - (unsigned char *) "IN", /* 289 */ - (unsigned char *) "ARG", /* 290 */ - (unsigned char *) "BLTIN", /* 291 */ - (unsigned char *) "BREAK", /* 292 */ - (unsigned char *) "CONTINUE", /* 293 */ - (unsigned char *) "DELETE", /* 294 */ - (unsigned char *) "DO", /* 295 */ - (unsigned char *) "EXIT", /* 296 */ - (unsigned char *) "FOR", /* 297 */ - (unsigned char *) "FUNC", /* 298 */ - (unsigned char *) "SUB", /* 299 */ - (unsigned char *) "GSUB", /* 300 */ - (unsigned char *) "IF", /* 301 */ - (unsigned char *) "INDEX", /* 302 */ - (unsigned char *) "LSUBSTR", /* 303 */ - (unsigned char *) "MATCHFCN", /* 304 */ - (unsigned char *) "NEXT", /* 305 */ - (unsigned char *) "ADD", /* 306 */ - (unsigned char *) "MINUS", /* 307 */ - (unsigned char *) "MULT", /* 308 */ - (unsigned char *) "DIVIDE", /* 309 */ - (unsigned char *) "MOD", /* 310 */ - (unsigned char *) "ASSIGN", /* 311 */ - (unsigned char *) "ASGNOP", /* 312 */ - (unsigned char *) "ADDEQ", /* 313 */ - (unsigned char *) "SUBEQ", /* 314 */ - (unsigned char *) "MULTEQ", /* 315 */ - (unsigned char *) "DIVEQ", /* 316 */ - (unsigned char *) "MODEQ", /* 317 */ - (unsigned char *) "POWEQ", /* 318 */ - (unsigned char *) "PRINT", /* 319 */ - (unsigned char *) "PRINTF", /* 320 */ - (unsigned char *) "SPRINTF", /* 321 */ - (unsigned char *) "ELSE", /* 322 */ - (unsigned char *) "INTEST", /* 323 */ - (unsigned char *) "CONDEXPR", /* 324 */ - (unsigned char *) "POSTINCR", /* 325 */ - (unsigned char *) "PREINCR", /* 326 */ - (unsigned char *) "POSTDECR", /* 327 */ - (unsigned char *) "PREDECR", /* 328 */ - (unsigned char *) "VAR", /* 329 */ - (unsigned char *) "IVAR", /* 330 */ - (unsigned char *) "VARNF", /* 331 */ - (unsigned char *) "CALL", /* 332 */ - (unsigned char *) "NUMBER", /* 333 */ - (unsigned char *) "STRING", /* 334 */ - (unsigned char *) "FIELD", /* 335 */ - (unsigned char *) "REGEXPR", /* 336 */ - (unsigned char *) "GETLINE", /* 337 */ - (unsigned char *) "RETURN", /* 338 */ - (unsigned char *) "SPLIT", /* 339 */ - (unsigned char *) "SUBSTR", /* 340 */ - (unsigned char *) "WHILE", /* 341 */ - (unsigned char *) "CAT", /* 342 */ - (unsigned char *) "NOT", /* 343 */ - (unsigned char *) "UMINUS", /* 344 */ - (unsigned char *) "POWER", /* 345 */ - (unsigned char *) "DECR", /* 346 */ - (unsigned char *) "INCR", /* 347 */ - (unsigned char *) "INDIRECT", /* 348 */ - (unsigned char *) "LASTTOKEN", /* 349 */ -}; - - -Cell *(*proctab[92])(Node **, int) = { - nullproc, /* FIRSTTOKEN */ - program, /* PROGRAM */ - pastat, /* PASTAT */ - dopa2, /* PASTAT2 */ - nullproc, /* XBEGIN */ - nullproc, /* XEND */ - nullproc, /* NL */ - array, /* ARRAY */ - matchop, /* MATCH */ - matchop, /* NOTMATCH */ - nullproc, /* MATCHOP */ - nullproc, /* FINAL */ - nullproc, /* DOT */ - nullproc, /* ALL */ - nullproc, /* CCL */ - nullproc, /* NCCL */ - nullproc, /* CHAR */ - nullproc, /* MCHAR */ - nullproc, /* OR */ - nullproc, /* STAR */ - nullproc, /* QUEST */ - nullproc, /* PLUS */ - boolop, /* AND */ - boolop, /* BOR */ - nullproc, /* APPEND */ - relop, /* EQ */ - relop, /* GE */ - relop, /* GT */ - relop, /* LE */ - relop, /* LT */ - relop, /* NE */ - instat, /* IN */ - arg, /* ARG */ - bltin, /* BLTIN */ - jump, /* BREAK */ - jump, /* CONTINUE */ - delete, /* DELETE */ - dostat, /* DO */ - jump, /* EXIT */ - forstat, /* FOR */ - nullproc, /* FUNC */ - sub, /* SUB */ - gsub, /* GSUB */ - ifstat, /* IF */ - sindex, /* INDEX */ - nullproc, /* LSUBSTR */ - matchop, /* MATCHFCN */ - jump, /* NEXT */ - arith, /* ADD */ - arith, /* MINUS */ - arith, /* MULT */ - arith, /* DIVIDE */ - arith, /* MOD */ - assign, /* ASSIGN */ - nullproc, /* ASGNOP */ - assign, /* ADDEQ */ - assign, /* SUBEQ */ - assign, /* MULTEQ */ - assign, /* DIVEQ */ - assign, /* MODEQ */ - assign, /* POWEQ */ - print, /* PRINT */ - aprintf, /* PRINTF */ - awsprintf, /* SPRINTF */ - nullproc, /* ELSE */ - intest, /* INTEST */ - condexpr, /* CONDEXPR */ - incrdecr, /* POSTINCR */ - incrdecr, /* PREINCR */ - incrdecr, /* POSTDECR */ - incrdecr, /* PREDECR */ - nullproc, /* VAR */ - nullproc, /* IVAR */ - getnf, /* VARNF */ - call, /* CALL */ - nullproc, /* NUMBER */ - nullproc, /* STRING */ - nullproc, /* FIELD */ - nullproc, /* REGEXPR */ - getline, /* GETLINE */ - jump, /* RETURN */ - split, /* SPLIT */ - substr, /* SUBSTR */ - whilestat, /* WHILE */ - cat, /* CAT */ - boolop, /* NOT */ - arith, /* UMINUS */ - arith, /* POWER */ - nullproc, /* DECR */ - nullproc, /* INCR */ - indirect, /* INDIRECT */ - nullproc, /* LASTTOKEN */ -}; - -unsigned char *tokname(int n) -{ - static unsigned char buf[100]; - - if (n < FIRSTTOKEN || n > LASTTOKEN) { - snprintf((char *)buf, sizeof buf, "token %d", n); - return buf; - } - return printname[n-257]; -} - diff --git a/foundation/src/stages/stage1/heirloom/stubs.h b/foundation/src/stages/stage1/heirloom/stubs.h deleted file mode 100644 index 5aef816..0000000 --- a/foundation/src/stages/stage1/heirloom/stubs.h +++ /dev/null @@ -1,64 +0,0 @@ -#include <getopt.h> -extern int optopt; - -int ftruncate(int fd, int offset) { - return -1; -} - -int getsid (int pid) { - return -1; -} - -static int isblank(int c) -{ - return c == ' ' || c == '\t'; -} - -#define lchown chown - -// meslibc implements lstat but is missing declaration -#include <sys/stat.h> -int lstat (char const *file_name, struct stat *statbuf); - -#include <fcntl.h> -int mkstemp(char *t) -{ - mktemp(t); - int fd = open(t, O_CREAT|O_RDWR|O_TRUNC, 0600); - return fd; -} - -int putenv(char *string) -{ - return 0; -} - -char* realpath (char* path, char* resolved) { - return NULL; -} - -#define strncasecmp(a,b,n) strncmp(strupr(a),strupr(b),n) - - -#define nlink_t unsigned long - -#include <limits.h> -#define USHRT_MAX UINT16_MAX -#define SSIZE_MAX LONG_MAX -#define MB_LEN_MAX 1 - -#define EPERM 1 -#define ESRCH 3 -#define EDOM 33 -#define S_IFSOCK 0140000 -#define S_ISVTX 01000 -#define S_IREAD S_IRUSR -#define S_IWRITE S_IWUSR -#define S_IEXEC S_IXUSR - -#define _PC_PATH_MAX PATH_MAX -#define _PC_VDISABLE 8 -#define _POSIX_PATH_MAX PATH_MAX -#define LINE_MAX 4096 - -#define LC_TIME 0 diff --git a/foundation/src/stages/stage1/linux-headers/default.nix b/foundation/src/stages/stage1/linux-headers/default.nix deleted file mode 100644 index c999611..0000000 --- a/foundation/src/stages/stage1/linux-headers/default.nix +++ /dev/null @@ -1,92 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage1.linux-headers; - - platform = config.aux.platform; - builders = config.aux.foundation.builders; - - stage1 = config.aux.foundation.stages.stage1; -in -{ - options.aux.foundation.stages.stage1.linux-headers = { - meta = { - description = lib.options.create { - type = lib.types.string; - description = "Description for the package."; - default.value = "Header files and scripts for Linux kernel."; - }; - - 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.lgpl2Plus; - }; - - 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 linux-headers."; - }; - - 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.linux-headers = { - version = "6.5.6"; - - src = builtins.fetchurl { - url = "https://cdn.kernel.org/pub/linux/kernel/v${lib.versions.major cfg.version}.x/linux-${cfg.version}.tar.xz"; - sha256 = "eONtQhRUcFHCTfIUD0zglCjWxRWtmnGziyjoCUqV0vY="; - }; - - package = builders.bash.build { - name = "linux-headers-${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 linux-${cfg.version} - - # Build - make -j $NIX_BUILD_CORES CC=musl-gcc HOSTCC=musl-gcc ARCH=x86 headers - - # Install - find usr/include -name '.*' -exec rm {} + - mkdir -p $out - cp -rv usr/include $out/ - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/ln-boot/default.nix b/foundation/src/stages/stage1/ln-boot/default.nix deleted file mode 100644 index 7b98c20..0000000 --- a/foundation/src/stages/stage1/ln-boot/default.nix +++ /dev/null @@ -1,63 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage1.ln-boot; - - builders = config.aux.foundation.builders; - - stage0 = config.aux.foundation.stages.stage0; - stage1 = config.aux.foundation.stages.stage1; -in -{ - options.aux.foundation.stages.stage1.ln-boot = { - meta = { - description = lib.options.create { - type = lib.types.string; - description = "Description for the package."; - default.value = "A basic program to create symlinks."; - }; - - homepage = lib.options.create { - type = lib.types.string; - description = "Homepage for the package."; - default.value = "https://github.com/auxolotl/labs"; - }; - - 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.mit; - }; - - 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 ln-boot."; - }; - }; - - config = { - aux.foundation.stages.stage1.ln-boot = { - package = builders.kaem.build { - name = "ln-boot"; - - meta = cfg.meta; - - script = '' - mkdir -p ''${out}/bin - ${stage1.mes.compiler.package}/bin/mes --no-auto-compile -e main ${stage1.mes.libs.src.bin}/bin/mescc.scm -- \ - -L ${stage1.mes.libs.package}/lib \ - -lc+tcc \ - -o ''${out}/bin/ln \ - ${./main.c} - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/ln-boot/main.c b/foundation/src/stages/stage1/ln-boot/main.c deleted file mode 100644 index 2e16f39..0000000 --- a/foundation/src/stages/stage1/ln-boot/main.c +++ /dev/null @@ -1,16 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <unistd.h> - -int main(int argc, char **argv) { - if (argc != 4 || strcmp(argv[1], "-s")) { - fputs("Usage: ", stdout); - fputs(argv[0], stdout); - fputs(" -s TARGET LINK_NAME\n", stdout); - exit(EXIT_FAILURE); - } - - symlink(argv[2], argv[3]); - exit(EXIT_SUCCESS); -} diff --git a/foundation/src/stages/stage1/mes/compiler.nix b/foundation/src/stages/stage1/mes/compiler.nix deleted file mode 100644 index e45e0e2..0000000 --- a/foundation/src/stages/stage1/mes/compiler.nix +++ /dev/null @@ -1,109 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage1.mes.compiler; - - 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.stages.stage1.mes.compiler = { - meta = { - description = lib.options.create { - type = lib.types.string; - description = "Description for the package."; - default.value = "Scheme interpreter and C compiler for bootstrapping."; - }; - - homepage = lib.options.create { - type = lib.types.string; - description = "Homepage for the package."; - default.value = "https://www.gnu.org/software/mes"; - }; - - 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 the mes compiler."; - }; - }; - - config = { - aux.foundation.stages.stage1.mes.compiler = { - package = - let - compile = - path: - let - file = builtins.baseNameOf path; - fileWithoutExtension = builtins.replaceStrings [ ".c" ] [ "" ] file; - - cc = builtins.concatStringsSep " " [ - "${stage1.mes.libs.src.bin}/bin/mes-m2" - "-e" - "main" - "${stage1.mes.libs.src.bin}/bin/mescc.scm" - "--" - "-D" - "HAVE_CONFIG_H=1" - "-I" - "${stage1.mes.libs.prefix}/include" - "-I" - "${stage1.mes.libs.prefix}/include/linux/x86" - ]; - in - builders.kaem.build { - name = fileWithoutExtension; - - script = '' - mkdir ''${out} - cd ''${out} - ${cc} -c ${stage1.mes.libs.prefix}/${path} - ''; - }; - - getSourcePath = suffix: source: "${source}/${source.name}${suffix}"; - - sources = import ./sources.nix; - - files = lib.strings.concatMapSep " " (getSourcePath ".o") ( - builtins.map compile sources.x86.linux.mescc.mes - ); - in - builders.kaem.build { - name = "mes-${stage1.mes.version}"; - - meta = cfg.meta; - - script = '' - mkdir -p ''${out}/bin - - ${stage1.mes.libs.src.bin}/bin/mes-m2 -e main ${stage1.mes.libs.src.bin}/bin/mescc.scm -- \ - -L ${stage1.mes.libs.prefix}/lib \ - -L ${stage1.mes.libs.package}/lib \ - -lc \ - -lmescc \ - -nostdlib \ - -o ''${out}/bin/mes \ - ${stage1.mes.libs.package}/lib/x86-mes/crt1.o \ - ${files} - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/mes/create-sources.sh b/foundation/src/stages/stage1/mes/create-sources.sh deleted file mode 100755 index 0a006f4..0000000 --- a/foundation/src/stages/stage1/mes/create-sources.sh +++ /dev/null @@ -1,99 +0,0 @@ -#!/usr/bin/env nix-shell -#!nix-shell -i bash -p bash coreutils gnutar - -# Generate a sources.nix for a version of GNU mes. Creates lists of source files -# from build-aux/configure-lib.sh. -# -# You may point this tool at a manually downloaded tarball, but more ideal is -# using the source tarball from Nixpkgs. For example: -# -# MES_TARBALL="$(nix eval --raw .#extras.stage1.mes.src)" -# ./create-sources.sh "$MES_TARBALL" > ./sources.nix -# -# Alternatively, here is a one-liner: -# -# ./create-sources.sh "$(nix eval --raw .#extras.stage1.mes.src)" > ./sources.nix - -set -eu - -# Supported platforms -ARCHS="x86" -KERNELS="linux" -COMPILERS="mescc gcc" - - -format() { - echo "[" - echo $* | xargs printf ' "%s"\n' - echo " ]" -} - -gen_sources() { - # Configuration variables used by configure-lib.sh - export mes_libc=mes - export mes_cpu=$1 - export mes_kernel=$2 - export compiler=$3 - - # Populate source file lists - source $CONFIGURE_LIB_SH - - cat <<EOF - $mes_cpu.$mes_kernel.$compiler = { - libc_mini = $(format $libc_mini_SOURCES); - libmescc = $(format $libmescc_SOURCES); - libtcc1 = $(format $libtcc1_SOURCES); - libc = $(format $libc_SOURCES); - libc_tcc = $(format $libc_tcc_SOURCES); - libc_gnu = $(format $libc_gnu_SOURCES); - mes = $(format $mes_SOURCES); - }; -EOF -} - - -MES_TARBALL=$1 -if [ ! -f $MES_TARBALL ]; then - echo "Provide path to mes-x.x.x.tar.gz as first argument" >&2 - exit 1 -fi -echo "Generating sources.nix from $MES_TARBALL" >&2 - -TMP=$(mktemp -d) -cd $TMP -echo "Workdir: $TMP" >&2 - -echo "Extracting $MES_TARBALL" >&2 -tar --strip-components 1 -xf $MES_TARBALL - -CONFIGURE_LIB_SH="$TMP/build-aux/configure-lib.sh" -if [ ! -f $CONFIGURE_LIB_SH ]; then - echo "Could not find mes's configure-lib.sh script at $CONFIGURE_LIB_SH" >&2 - exit 1 -fi - -# Create dummy config expected by configure-lib.sh -touch config.sh -chmod +x config.sh - - -echo "Configuring with $CONFIGURE_LIB_SH" >&2 - -cat <<EOF -# This file is generated by ./create-sources.sh. -# Do not edit! -{ -EOF - -for arch in $ARCHS; do - for kernel in $KERNELS; do - for compiler in $COMPILERS; do - gen_sources $arch $kernel $compiler - done - done -done - -cat <<EOF -} -EOF - diff --git a/foundation/src/stages/stage1/mes/default.nix b/foundation/src/stages/stage1/mes/default.nix deleted file mode 100644 index 008e3ae..0000000 --- a/foundation/src/stages/stage1/mes/default.nix +++ /dev/null @@ -1,37 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage1.mes; - - system = config.aux.system; - builders = config.aux.foundation.builders; -in -{ - includes = [ - ./compiler.nix - ./libs.nix - ./libc.nix - ]; - - options.aux.foundation.stages.stage1.mes = { - src = lib.options.create { - type = lib.types.derivation; - description = "Source for the package."; - }; - - version = lib.options.create { - type = lib.types.string; - description = "Version of the package."; - }; - }; - - config = { - aux.foundation.stages.stage1.mes = { - version = "0.25"; - - src = builtins.fetchurl { - url = "${config.aux.mirrors.gnu}/mes/mes-${cfg.version}.tar.gz"; - sha256 = "MlJQs1Z+2SA7pwFhyDWvAQeec+vtl7S1u3fKUAuCiUA="; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/mes/libc.nix b/foundation/src/stages/stage1/mes/libc.nix deleted file mode 100644 index 97a07de..0000000 --- a/foundation/src/stages/stage1/mes/libc.nix +++ /dev/null @@ -1,93 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage1.mes.libc; - - builders = config.aux.foundation.builders; - - stage1 = config.aux.foundation.stages.stage1; -in -{ - options.aux.foundation.stages.stage1.mes.libc = { - meta = { - description = lib.options.create { - type = lib.types.string; - description = "Description for the package."; - default.value = "The Mes C Library"; - }; - - homepage = lib.options.create { - type = lib.types.string; - description = "Homepage for the package."; - default.value = "https://gnu.org/software/mes"; - }; - - 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 mes-libc."; - }; - }; - - config = { - aux.foundation.stages.stage1.mes.libc = { - package = - let - sources = import ./sources.nix; - - libtcc1 = sources.x86.linux.gcc.libtcc1; - - first = lib.lists.take 100 sources.x86.linux.gcc.libc_gnu; - last = lib.lists.drop 100 sources.x86.linux.gcc.libc_gnu; - in - builders.kaem.build { - name = "mes-libc-${stage1.mes.version}"; - - meta = cfg.meta; - - deps.build.host = [ stage1.ln-boot.package ]; - - script = '' - cd ${stage1.mes.libs.prefix} - - # mescc compiled libc.a - mkdir -p ''${out}/lib/x86-mes - - # libc.c - catm ''${TMPDIR}/first.c ${builtins.concatStringsSep " " first} - catm ''${out}/lib/libc.c ''${TMPDIR}/first.c ${builtins.concatStringsSep " " last} - - # crt{1,n,i}.c - cp lib/linux/x86-mes-gcc/crt1.c ''${out}/lib - cp lib/linux/x86-mes-gcc/crtn.c ''${out}/lib - cp lib/linux/x86-mes-gcc/crti.c ''${out}/lib - - # libtcc1.c - catm ''${out}/lib/libtcc1.c ${builtins.concatStringsSep " " libtcc1} - - # getopt.c - cp lib/posix/getopt.c ''${out}/lib/libgetopt.c - - # Install headers - ln -s ${stage1.mes.libs.prefix}/include ''${out}/include - ''; - - extras = { - CFLAGS = "-DHAVE_CONFIG_H=1 -I${cfg.package}/include -I${cfg.package}/include/linux/x86"; - }; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/mes/libs.nix b/foundation/src/stages/stage1/mes/libs.nix deleted file mode 100644 index aa75bd7..0000000 --- a/foundation/src/stages/stage1/mes/libs.nix +++ /dev/null @@ -1,253 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage1.mes.libs; - - 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.stages.stage1.mes.libs = { - meta = { - description = lib.options.create { - type = lib.types.string; - description = "Description for the package."; - default.value = "Scheme interpreter and C compiler for bootstrapping."; - }; - - homepage = lib.options.create { - type = lib.types.string; - description = "Homepage for the package."; - default.value = "https://www.gnu.org/software/mes"; - }; - - 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 mes libs."; - }; - - src = lib.options.create { - type = lib.types.derivation; - description = "Source for the package."; - }; - - prefix = lib.options.create { - type = lib.types.string; - description = "Prefix for the package."; - }; - }; - - config = { - aux.foundation.stages.stage1.mes.libs = { - prefix = "${cfg.src.out}/mes-${stage1.mes.version}"; - - src = - let - config_h = builtins.toFile "config.h" '' - #undef SYSTEM_LIBC - #define MES_VERSION "${stage1.mes.version}" - ''; - in - builders.kaem.build { - name = "mes-src-${stage1.mes.version}"; - - meta = cfg.meta; - - outputs = [ - "out" - "bin" - ]; - - script = '' - # Unpack source - ungz --file ${stage1.mes.src} --output mes.tar - mkdir ''${out} - cd ''${out} - untar --non-strict --file ''${NIX_BUILD_TOP}/mes.tar # ignore symlinks - - MES_PREFIX=''${out}/mes-${stage1.mes.version} - - cd ''${MES_PREFIX} - - cp ${config_h} include/mes/config.h - - mkdir include/arch - cp include/linux/x86/syscall.h include/arch/syscall.h - cp include/linux/x86/kernel-stat.h include/arch/kernel-stat.h - - # Remove pregenerated files - rm mes/module/mes/psyntax.pp mes/module/mes/psyntax.pp.header - - # These files are symlinked in the repo - cp mes/module/srfi/srfi-9-struct.mes mes/module/srfi/srfi-9.mes - cp mes/module/srfi/srfi-9/gnu-struct.mes mes/module/srfi/srfi-9/gnu.mes - - # Remove environment impurities - __GUILE_LOAD_PATH="\"''${MES_PREFIX}/mes/module:''${MES_PREFIX}/module:${stage1.nyacc.package.extras.guileModule}\"" - boot0_scm=mes/module/mes/boot-0.scm - guile_mes=mes/module/mes/guile.mes - replace --file ''${boot0_scm} --output ''${boot0_scm} --match-on "(getenv \"GUILE_LOAD_PATH\")" --replace-with ''${__GUILE_LOAD_PATH} - replace --file ''${guile_mes} --output ''${guile_mes} --match-on "(getenv \"GUILE_LOAD_PATH\")" --replace-with ''${__GUILE_LOAD_PATH} - - module_mescc_scm=module/mescc/mescc.scm - replace --file ''${module_mescc_scm} --output ''${module_mescc_scm} --match-on "(getenv \"M1\")" --replace-with "\"${stage0.mescc-tools.package}/bin/M1\"" - replace --file ''${module_mescc_scm} --output ''${module_mescc_scm} --match-on "(getenv \"HEX2\")" --replace-with "\"${stage0.mescc-tools.package}/bin/hex2\"" - replace --file ''${module_mescc_scm} --output ''${module_mescc_scm} --match-on "(getenv \"BLOOD_ELF\")" --replace-with "\"${stage0.mescc-tools.package}/bin/blood-elf\"" - replace --file ''${module_mescc_scm} --output ''${module_mescc_scm} --match-on "(getenv \"srcdest\")" --replace-with "\"''${MES_PREFIX}\"" - - mes_c=src/mes.c - replace --file ''${mes_c} --output ''${mes_c} --match-on "getenv (\"MES_PREFIX\")" --replace-with "\"''${MES_PREFIX}\"" - replace --file ''${mes_c} --output ''${mes_c} --match-on "getenv (\"srcdest\")" --replace-with "\"''${MES_PREFIX}\"" - - # Increase runtime resource limits - gc_c=src/gc.c - replace --file ''${gc_c} --output ''${gc_c} --match-on "getenv (\"MES_ARENA\")" --replace-with "\"100000000\"" - replace --file ''${gc_c} --output ''${gc_c} --match-on "getenv (\"MES_MAX_ARENA\")" --replace-with "\"100000000\"" - replace --file ''${gc_c} --output ''${gc_c} --match-on "getenv (\"MES_STACK\")" --replace-with "\"6000000\"" - - # Create mescc.scm - mescc_in=scripts/mescc.scm.in - replace --file ''${mescc_in} --output ''${mescc_in} --match-on "(getenv \"MES_PREFIX\")" --replace-with "\"''${MES_PREFIX}\"" - replace --file ''${mescc_in} --output ''${mescc_in} --match-on "(getenv \"includedir\")" --replace-with "\"''${MES_PREFIX}/include\"" - replace --file ''${mescc_in} --output ''${mescc_in} --match-on "(getenv \"libdir\")" --replace-with "\"''${MES_PREFIX}/lib\"" - replace --file ''${mescc_in} --output ''${mescc_in} --match-on @prefix@ --replace-with ''${MES_PREFIX} - replace --file ''${mescc_in} --output ''${mescc_in} --match-on @VERSION@ --replace-with ${stage1.mes.version} - replace --file ''${mescc_in} --output ''${mescc_in} --match-on @mes_cpu@ --replace-with x86 - replace --file ''${mescc_in} --output ''${mescc_in} --match-on @mes_kernel@ --replace-with linux - mkdir -p ''${bin}/bin - cp ''${mescc_in} ''${bin}/bin/mescc.scm - - # Build mes-m2 - kaem --verbose --strict --file kaem.x86 - cp bin/mes-m2 ''${bin}/bin/mes-m2 - chmod 555 ''${bin}/bin/mes-m2 - ''; - }; - - package = - let - compile = - path: - let - file = builtins.baseNameOf path; - fileWithoutExtension = builtins.replaceStrings [ ".c" ] [ "" ] file; - - cc = builtins.concatStringsSep " " [ - "${cfg.src.bin}/bin/mes-m2" - "-e" - "main" - "${cfg.src.bin}/bin/mescc.scm" - "--" - "-D" - "HAVE_CONFIG_H=1" - "-I" - "${cfg.prefix}/include" - "-I" - "${cfg.prefix}/include/linux/x86" - ]; - in - builders.kaem.build { - name = fileWithoutExtension; - - script = '' - mkdir ''${out} - cd ''${out} - ${cc} -c ${cfg.prefix}/${path} - ''; - }; - - getSourcePath = suffix: source: "${source}/${source.name}${suffix}"; - - archive = - destination: sources: - "catm ${destination} ${lib.strings.concatMapSep " " (getSourcePath ".o") sources}"; - source = - destination: sources: - "catm ${destination} ${lib.strings.concatMapSep " " (getSourcePath ".s") sources}"; - - createLib = - name: sources: - let - compiled = builtins.map compile sources; - in - builders.kaem.build { - name = "mes-${name}-${stage1.mes.version}"; - - meta = cfg.meta; - - script = '' - LIBDIR=''${out}/lib - mkdir -p ''${LIBDIR} - cd ''${LIBDIR} - - ${archive "${name}.a" compiled} - ${source "${name}.s" compiled} - - ''; - }; - - sources = import ./sources.nix; - - crt1 = compile "lib/linux/x86-mes-mescc/crt1.c"; - libc-mini = createLib "libc-mini" sources.x86.linux.mescc.libc_mini; - libmescc = createLib "libmescc" sources.x86.linux.mescc.libmescc; - libc = createLib "libc" sources.x86.linux.mescc.libc; - libc_tcc = createLib "libc+tcc" ( - sources.x86.linux.mescc.libc_tcc - ++ [ - # We need `symlink` support for `ln-boot` to work. - "lib/linux/symlink.c" - ] - ); - in - builders.kaem.build { - name = "mes-m2-libs-${stage1.mes.version}"; - - meta = cfg.meta; - - script = '' - LIBDIR=''${out}/lib - mkdir -p ''${out} ''${LIBDIR} - - mkdir -p ''${LIBDIR}/x86-mes - - # crt1.o - cp ${crt1}/crt1.o ''${LIBDIR}/x86-mes - cp ${crt1}/crt1.s ''${LIBDIR}/x86-mes - - # libc-mini.a - cp ${libc-mini}/lib/libc-mini.a ''${LIBDIR}/x86-mes - cp ${libc-mini}/lib/libc-mini.s ''${LIBDIR}/x86-mes - - # libmescc.a - cp ${libmescc}/lib/libmescc.a ''${LIBDIR}/x86-mes - cp ${libmescc}/lib/libmescc.s ''${LIBDIR}/x86-mes - - # libc.a - cp ${libc}/lib/libc.a ''${LIBDIR}/x86-mes - cp ${libc}/lib/libc.s ''${LIBDIR}/x86-mes - - # libc+tcc.a - cp ${libc_tcc}/lib/libc+tcc.a ''${LIBDIR}/x86-mes - cp ${libc_tcc}/lib/libc+tcc.s ''${LIBDIR}/x86-mes - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/mes/sources.nix b/foundation/src/stages/stage1/mes/sources.nix deleted file mode 100644 index ef8c2b7..0000000 --- a/foundation/src/stages/stage1/mes/sources.nix +++ /dev/null @@ -1,1056 +0,0 @@ -# This file is generated by ./create-sources.sh. -# Do not edit! -{ - x86.linux.mescc = { - libc_mini = [ - "lib/mes/__init_io.c" - "lib/mes/eputs.c" - "lib/mes/oputs.c" - "lib/mes/globals.c" - "lib/stdlib/exit.c" - "lib/linux/x86-mes-mescc/_exit.c" - "lib/linux/x86-mes-mescc/_write.c" - "lib/stdlib/puts.c" - "lib/string/strlen.c" - "lib/mes/write.c" - ]; - libmescc = [ - "lib/mes/globals.c" - "lib/linux/x86-mes-mescc/syscall-internal.c" - ]; - libtcc1 = [ "lib/libtcc1.c" ]; - libc = [ - "lib/mes/__init_io.c" - "lib/mes/eputs.c" - "lib/mes/oputs.c" - "lib/mes/globals.c" - "lib/stdlib/exit.c" - "lib/linux/x86-mes-mescc/_exit.c" - "lib/linux/x86-mes-mescc/_write.c" - "lib/stdlib/puts.c" - "lib/string/strlen.c" - "lib/ctype/isnumber.c" - "lib/mes/abtol.c" - "lib/mes/cast.c" - "lib/mes/eputc.c" - "lib/mes/fdgetc.c" - "lib/mes/fdputc.c" - "lib/mes/fdputs.c" - "lib/mes/fdungetc.c" - "lib/mes/itoa.c" - "lib/mes/ltoa.c" - "lib/mes/ltoab.c" - "lib/mes/mes_open.c" - "lib/mes/ntoab.c" - "lib/mes/oputc.c" - "lib/mes/ultoa.c" - "lib/mes/utoa.c" - "lib/stub/__raise.c" - "lib/ctype/isdigit.c" - "lib/ctype/isspace.c" - "lib/ctype/isxdigit.c" - "lib/mes/assert_msg.c" - "lib/posix/write.c" - "lib/stdlib/atoi.c" - "lib/linux/lseek.c" - "lib/mes/__assert_fail.c" - "lib/mes/__buffered_read.c" - "lib/mes/__mes_debug.c" - "lib/posix/execv.c" - "lib/posix/getcwd.c" - "lib/posix/getenv.c" - "lib/posix/isatty.c" - "lib/posix/open.c" - "lib/posix/buffered-read.c" - "lib/posix/setenv.c" - "lib/posix/wait.c" - "lib/stdio/fgetc.c" - "lib/stdio/fputc.c" - "lib/stdio/fputs.c" - "lib/stdio/getc.c" - "lib/stdio/getchar.c" - "lib/stdio/putc.c" - "lib/stdio/putchar.c" - "lib/stdio/ungetc.c" - "lib/stdlib/free.c" - "lib/stdlib/realloc.c" - "lib/string/memchr.c" - "lib/string/memcmp.c" - "lib/string/memcpy.c" - "lib/string/memmove.c" - "lib/string/memset.c" - "lib/string/strcmp.c" - "lib/string/strcpy.c" - "lib/string/strncmp.c" - "lib/posix/raise.c" - "lib/linux/access.c" - "lib/linux/brk.c" - "lib/linux/chmod.c" - "lib/linux/clock_gettime.c" - "lib/linux/dup.c" - "lib/linux/dup2.c" - "lib/linux/execve.c" - "lib/linux/fork.c" - "lib/linux/fsync.c" - "lib/linux/_getcwd.c" - "lib/linux/gettimeofday.c" - "lib/linux/ioctl3.c" - "lib/linux/_open3.c" - "lib/linux/malloc.c" - "lib/linux/_read.c" - "lib/linux/time.c" - "lib/linux/unlink.c" - "lib/linux/wait4.c" - "lib/linux/waitpid.c" - "lib/linux/x86-mes-mescc/syscall.c" - "lib/linux/getpid.c" - "lib/linux/kill.c" - ]; - libc_tcc = [ - "lib/mes/__init_io.c" - "lib/mes/eputs.c" - "lib/mes/oputs.c" - "lib/mes/globals.c" - "lib/stdlib/exit.c" - "lib/linux/x86-mes-mescc/_exit.c" - "lib/linux/x86-mes-mescc/_write.c" - "lib/stdlib/puts.c" - "lib/string/strlen.c" - "lib/ctype/isnumber.c" - "lib/mes/abtol.c" - "lib/mes/cast.c" - "lib/mes/eputc.c" - "lib/mes/fdgetc.c" - "lib/mes/fdputc.c" - "lib/mes/fdputs.c" - "lib/mes/fdungetc.c" - "lib/mes/itoa.c" - "lib/mes/ltoa.c" - "lib/mes/ltoab.c" - "lib/mes/mes_open.c" - "lib/mes/ntoab.c" - "lib/mes/oputc.c" - "lib/mes/ultoa.c" - "lib/mes/utoa.c" - "lib/stub/__raise.c" - "lib/ctype/isdigit.c" - "lib/ctype/isspace.c" - "lib/ctype/isxdigit.c" - "lib/mes/assert_msg.c" - "lib/posix/write.c" - "lib/stdlib/atoi.c" - "lib/linux/lseek.c" - "lib/mes/__assert_fail.c" - "lib/mes/__buffered_read.c" - "lib/mes/__mes_debug.c" - "lib/posix/execv.c" - "lib/posix/getcwd.c" - "lib/posix/getenv.c" - "lib/posix/isatty.c" - "lib/posix/open.c" - "lib/posix/buffered-read.c" - "lib/posix/setenv.c" - "lib/posix/wait.c" - "lib/stdio/fgetc.c" - "lib/stdio/fputc.c" - "lib/stdio/fputs.c" - "lib/stdio/getc.c" - "lib/stdio/getchar.c" - "lib/stdio/putc.c" - "lib/stdio/putchar.c" - "lib/stdio/ungetc.c" - "lib/stdlib/free.c" - "lib/stdlib/realloc.c" - "lib/string/memchr.c" - "lib/string/memcmp.c" - "lib/string/memcpy.c" - "lib/string/memmove.c" - "lib/string/memset.c" - "lib/string/strcmp.c" - "lib/string/strcpy.c" - "lib/string/strncmp.c" - "lib/posix/raise.c" - "lib/linux/access.c" - "lib/linux/brk.c" - "lib/linux/chmod.c" - "lib/linux/clock_gettime.c" - "lib/linux/dup.c" - "lib/linux/dup2.c" - "lib/linux/execve.c" - "lib/linux/fork.c" - "lib/linux/fsync.c" - "lib/linux/_getcwd.c" - "lib/linux/gettimeofday.c" - "lib/linux/ioctl3.c" - "lib/linux/_open3.c" - "lib/linux/malloc.c" - "lib/linux/_read.c" - "lib/linux/time.c" - "lib/linux/unlink.c" - "lib/linux/wait4.c" - "lib/linux/waitpid.c" - "lib/linux/x86-mes-mescc/syscall.c" - "lib/linux/getpid.c" - "lib/linux/kill.c" - "lib/ctype/islower.c" - "lib/ctype/isupper.c" - "lib/ctype/tolower.c" - "lib/ctype/toupper.c" - "lib/mes/abtod.c" - "lib/mes/dtoab.c" - "lib/mes/search-path.c" - "lib/posix/execvp.c" - "lib/stdio/fclose.c" - "lib/stdio/fdopen.c" - "lib/stdio/ferror.c" - "lib/stdio/fflush.c" - "lib/stdio/fopen.c" - "lib/stdio/fprintf.c" - "lib/stdio/fread.c" - "lib/stdio/fseek.c" - "lib/stdio/ftell.c" - "lib/stdio/fwrite.c" - "lib/stdio/printf.c" - "lib/stdio/remove.c" - "lib/stdio/snprintf.c" - "lib/stdio/sprintf.c" - "lib/stdio/sscanf.c" - "lib/stdio/vfprintf.c" - "lib/stdio/vprintf.c" - "lib/stdio/vsnprintf.c" - "lib/stdio/vsprintf.c" - "lib/stdio/vsscanf.c" - "lib/stdlib/calloc.c" - "lib/stdlib/qsort.c" - "lib/stdlib/strtod.c" - "lib/stdlib/strtof.c" - "lib/stdlib/strtol.c" - "lib/stdlib/strtold.c" - "lib/stdlib/strtoll.c" - "lib/stdlib/strtoul.c" - "lib/stdlib/strtoull.c" - "lib/string/memmem.c" - "lib/string/strcat.c" - "lib/string/strchr.c" - "lib/string/strlwr.c" - "lib/string/strncpy.c" - "lib/string/strrchr.c" - "lib/string/strstr.c" - "lib/string/strupr.c" - "lib/stub/sigaction.c" - "lib/stub/ldexp.c" - "lib/stub/mprotect.c" - "lib/stub/localtime.c" - "lib/stub/sigemptyset.c" - "lib/x86-mes-mescc/setjmp.c" - "lib/linux/close.c" - "lib/linux/rmdir.c" - "lib/linux/stat.c" - ]; - libc_gnu = [ - "lib/mes/__init_io.c" - "lib/mes/eputs.c" - "lib/mes/oputs.c" - "lib/mes/globals.c" - "lib/stdlib/exit.c" - "lib/linux/x86-mes-mescc/_exit.c" - "lib/linux/x86-mes-mescc/_write.c" - "lib/stdlib/puts.c" - "lib/string/strlen.c" - "lib/ctype/isnumber.c" - "lib/mes/abtol.c" - "lib/mes/cast.c" - "lib/mes/eputc.c" - "lib/mes/fdgetc.c" - "lib/mes/fdputc.c" - "lib/mes/fdputs.c" - "lib/mes/fdungetc.c" - "lib/mes/itoa.c" - "lib/mes/ltoa.c" - "lib/mes/ltoab.c" - "lib/mes/mes_open.c" - "lib/mes/ntoab.c" - "lib/mes/oputc.c" - "lib/mes/ultoa.c" - "lib/mes/utoa.c" - "lib/stub/__raise.c" - "lib/ctype/isdigit.c" - "lib/ctype/isspace.c" - "lib/ctype/isxdigit.c" - "lib/mes/assert_msg.c" - "lib/posix/write.c" - "lib/stdlib/atoi.c" - "lib/linux/lseek.c" - "lib/mes/__assert_fail.c" - "lib/mes/__buffered_read.c" - "lib/mes/__mes_debug.c" - "lib/posix/execv.c" - "lib/posix/getcwd.c" - "lib/posix/getenv.c" - "lib/posix/isatty.c" - "lib/posix/open.c" - "lib/posix/buffered-read.c" - "lib/posix/setenv.c" - "lib/posix/wait.c" - "lib/stdio/fgetc.c" - "lib/stdio/fputc.c" - "lib/stdio/fputs.c" - "lib/stdio/getc.c" - "lib/stdio/getchar.c" - "lib/stdio/putc.c" - "lib/stdio/putchar.c" - "lib/stdio/ungetc.c" - "lib/stdlib/free.c" - "lib/stdlib/realloc.c" - "lib/string/memchr.c" - "lib/string/memcmp.c" - "lib/string/memcpy.c" - "lib/string/memmove.c" - "lib/string/memset.c" - "lib/string/strcmp.c" - "lib/string/strcpy.c" - "lib/string/strncmp.c" - "lib/posix/raise.c" - "lib/linux/access.c" - "lib/linux/brk.c" - "lib/linux/chmod.c" - "lib/linux/clock_gettime.c" - "lib/linux/dup.c" - "lib/linux/dup2.c" - "lib/linux/execve.c" - "lib/linux/fork.c" - "lib/linux/fsync.c" - "lib/linux/_getcwd.c" - "lib/linux/gettimeofday.c" - "lib/linux/ioctl3.c" - "lib/linux/_open3.c" - "lib/linux/malloc.c" - "lib/linux/_read.c" - "lib/linux/time.c" - "lib/linux/unlink.c" - "lib/linux/wait4.c" - "lib/linux/waitpid.c" - "lib/linux/x86-mes-mescc/syscall.c" - "lib/linux/getpid.c" - "lib/linux/kill.c" - "lib/ctype/islower.c" - "lib/ctype/isupper.c" - "lib/ctype/tolower.c" - "lib/ctype/toupper.c" - "lib/mes/abtod.c" - "lib/mes/dtoab.c" - "lib/mes/search-path.c" - "lib/posix/execvp.c" - "lib/stdio/fclose.c" - "lib/stdio/fdopen.c" - "lib/stdio/ferror.c" - "lib/stdio/fflush.c" - "lib/stdio/fopen.c" - "lib/stdio/fprintf.c" - "lib/stdio/fread.c" - "lib/stdio/fseek.c" - "lib/stdio/ftell.c" - "lib/stdio/fwrite.c" - "lib/stdio/printf.c" - "lib/stdio/remove.c" - "lib/stdio/snprintf.c" - "lib/stdio/sprintf.c" - "lib/stdio/sscanf.c" - "lib/stdio/vfprintf.c" - "lib/stdio/vprintf.c" - "lib/stdio/vsnprintf.c" - "lib/stdio/vsprintf.c" - "lib/stdio/vsscanf.c" - "lib/stdlib/calloc.c" - "lib/stdlib/qsort.c" - "lib/stdlib/strtod.c" - "lib/stdlib/strtof.c" - "lib/stdlib/strtol.c" - "lib/stdlib/strtold.c" - "lib/stdlib/strtoll.c" - "lib/stdlib/strtoul.c" - "lib/stdlib/strtoull.c" - "lib/string/memmem.c" - "lib/string/strcat.c" - "lib/string/strchr.c" - "lib/string/strlwr.c" - "lib/string/strncpy.c" - "lib/string/strrchr.c" - "lib/string/strstr.c" - "lib/string/strupr.c" - "lib/stub/sigaction.c" - "lib/stub/ldexp.c" - "lib/stub/mprotect.c" - "lib/stub/localtime.c" - "lib/stub/sigemptyset.c" - "lib/x86-mes-mescc/setjmp.c" - "lib/linux/close.c" - "lib/linux/rmdir.c" - "lib/linux/stat.c" - "lib/ctype/isalnum.c" - "lib/ctype/isalpha.c" - "lib/ctype/isascii.c" - "lib/ctype/iscntrl.c" - "lib/ctype/isgraph.c" - "lib/ctype/isprint.c" - "lib/ctype/ispunct.c" - "lib/dirent/__getdirentries.c" - "lib/dirent/closedir.c" - "lib/dirent/opendir.c" - "lib/dirent/readdir.c" - "lib/math/ceil.c" - "lib/math/fabs.c" - "lib/math/floor.c" - "lib/mes/fdgets.c" - "lib/posix/alarm.c" - "lib/posix/execl.c" - "lib/posix/execlp.c" - "lib/posix/mktemp.c" - "lib/posix/sbrk.c" - "lib/posix/sleep.c" - "lib/posix/unsetenv.c" - "lib/stdio/clearerr.c" - "lib/stdio/feof.c" - "lib/stdio/fgets.c" - "lib/stdio/fileno.c" - "lib/stdio/freopen.c" - "lib/stdio/fscanf.c" - "lib/stdio/perror.c" - "lib/stdio/vfscanf.c" - "lib/stdlib/__exit.c" - "lib/stdlib/abort.c" - "lib/stdlib/abs.c" - "lib/stdlib/alloca.c" - "lib/stdlib/atexit.c" - "lib/stdlib/atof.c" - "lib/stdlib/atol.c" - "lib/stdlib/mbstowcs.c" - "lib/string/bcmp.c" - "lib/string/bcopy.c" - "lib/string/bzero.c" - "lib/string/index.c" - "lib/string/rindex.c" - "lib/string/strcspn.c" - "lib/string/strdup.c" - "lib/string/strerror.c" - "lib/string/strncat.c" - "lib/string/strpbrk.c" - "lib/string/strspn.c" - "lib/stub/__cleanup.c" - "lib/stub/atan2.c" - "lib/stub/bsearch.c" - "lib/stub/chown.c" - "lib/stub/cos.c" - "lib/stub/ctime.c" - "lib/stub/exp.c" - "lib/stub/fpurge.c" - "lib/stub/freadahead.c" - "lib/stub/frexp.c" - "lib/stub/getgrgid.c" - "lib/stub/getgrnam.c" - "lib/stub/getlogin.c" - "lib/stub/getpgid.c" - "lib/stub/getpgrp.c" - "lib/stub/getpwnam.c" - "lib/stub/getpwuid.c" - "lib/stub/gmtime.c" - "lib/stub/log.c" - "lib/stub/mktime.c" - "lib/stub/modf.c" - "lib/stub/pclose.c" - "lib/stub/popen.c" - "lib/stub/pow.c" - "lib/stub/rand.c" - "lib/stub/rewind.c" - "lib/stub/setbuf.c" - "lib/stub/setgrent.c" - "lib/stub/setlocale.c" - "lib/stub/setvbuf.c" - "lib/stub/sigaddset.c" - "lib/stub/sigblock.c" - "lib/stub/sigdelset.c" - "lib/stub/sigsetmask.c" - "lib/stub/sin.c" - "lib/stub/sqrt.c" - "lib/stub/strftime.c" - "lib/stub/sys_siglist.c" - "lib/stub/system.c" - "lib/stub/times.c" - "lib/stub/ttyname.c" - "lib/stub/umask.c" - "lib/stub/utime.c" - "lib/linux/chdir.c" - "lib/linux/fcntl.c" - "lib/linux/fstat.c" - "lib/linux/getdents.c" - "lib/linux/getegid.c" - "lib/linux/geteuid.c" - "lib/linux/getgid.c" - "lib/linux/getppid.c" - "lib/linux/getrusage.c" - "lib/linux/getuid.c" - "lib/linux/ioctl.c" - "lib/linux/link.c" - "lib/linux/lstat.c" - "lib/linux/mkdir.c" - "lib/linux/mknod.c" - "lib/linux/nanosleep.c" - "lib/linux/pipe.c" - "lib/linux/readlink.c" - "lib/linux/rename.c" - "lib/linux/setgid.c" - "lib/linux/settimer.c" - "lib/linux/setuid.c" - "lib/linux/signal.c" - "lib/linux/sigprogmask.c" - "lib/linux/symlink.c" - ]; - mes = [ - "src/builtins.c" - "src/cc.c" - "src/core.c" - "src/display.c" - "src/eval-apply.c" - "src/gc.c" - "src/globals.c" - "src/hash.c" - "src/lib.c" - "src/math.c" - "src/mes.c" - "src/module.c" - "src/posix.c" - "src/reader.c" - "src/stack.c" - "src/string.c" - "src/struct.c" - "src/symbol.c" - "src/vector.c" - ]; - }; - x86.linux.gcc = { - libc_mini = [ - "lib/mes/__init_io.c" - "lib/mes/eputs.c" - "lib/mes/oputs.c" - "lib/mes/globals.c" - "lib/stdlib/exit.c" - "lib/linux/x86-mes-gcc/_exit.c" - "lib/linux/x86-mes-gcc/_write.c" - "lib/stdlib/puts.c" - "lib/string/strlen.c" - "lib/mes/write.c" - ]; - libmescc = [ - "lib/mes/globals.c" - "lib/linux/x86-mes-gcc/syscall-internal.c" - ]; - libtcc1 = [ "lib/libtcc1.c" ]; - libc = [ - "lib/mes/__init_io.c" - "lib/mes/eputs.c" - "lib/mes/oputs.c" - "lib/mes/globals.c" - "lib/stdlib/exit.c" - "lib/linux/x86-mes-gcc/_exit.c" - "lib/linux/x86-mes-gcc/_write.c" - "lib/stdlib/puts.c" - "lib/string/strlen.c" - "lib/ctype/isnumber.c" - "lib/mes/abtol.c" - "lib/mes/cast.c" - "lib/mes/eputc.c" - "lib/mes/fdgetc.c" - "lib/mes/fdputc.c" - "lib/mes/fdputs.c" - "lib/mes/fdungetc.c" - "lib/mes/itoa.c" - "lib/mes/ltoa.c" - "lib/mes/ltoab.c" - "lib/mes/mes_open.c" - "lib/mes/ntoab.c" - "lib/mes/oputc.c" - "lib/mes/ultoa.c" - "lib/mes/utoa.c" - "lib/stub/__raise.c" - "lib/ctype/isdigit.c" - "lib/ctype/isspace.c" - "lib/ctype/isxdigit.c" - "lib/mes/assert_msg.c" - "lib/posix/write.c" - "lib/stdlib/atoi.c" - "lib/linux/lseek.c" - "lib/mes/__assert_fail.c" - "lib/mes/__buffered_read.c" - "lib/mes/__mes_debug.c" - "lib/posix/execv.c" - "lib/posix/getcwd.c" - "lib/posix/getenv.c" - "lib/posix/isatty.c" - "lib/posix/open.c" - "lib/posix/buffered-read.c" - "lib/posix/setenv.c" - "lib/posix/wait.c" - "lib/stdio/fgetc.c" - "lib/stdio/fputc.c" - "lib/stdio/fputs.c" - "lib/stdio/getc.c" - "lib/stdio/getchar.c" - "lib/stdio/putc.c" - "lib/stdio/putchar.c" - "lib/stdio/ungetc.c" - "lib/stdlib/free.c" - "lib/stdlib/realloc.c" - "lib/string/memchr.c" - "lib/string/memcmp.c" - "lib/string/memcpy.c" - "lib/string/memmove.c" - "lib/string/memset.c" - "lib/string/strcmp.c" - "lib/string/strcpy.c" - "lib/string/strncmp.c" - "lib/posix/raise.c" - "lib/linux/access.c" - "lib/linux/brk.c" - "lib/linux/chmod.c" - "lib/linux/clock_gettime.c" - "lib/linux/dup.c" - "lib/linux/dup2.c" - "lib/linux/execve.c" - "lib/linux/fork.c" - "lib/linux/fsync.c" - "lib/linux/_getcwd.c" - "lib/linux/gettimeofday.c" - "lib/linux/ioctl3.c" - "lib/linux/_open3.c" - "lib/linux/malloc.c" - "lib/linux/_read.c" - "lib/linux/time.c" - "lib/linux/unlink.c" - "lib/linux/wait4.c" - "lib/linux/waitpid.c" - "lib/linux/x86-mes-gcc/syscall.c" - "lib/linux/getpid.c" - "lib/linux/kill.c" - ]; - libc_tcc = [ - "lib/mes/__init_io.c" - "lib/mes/eputs.c" - "lib/mes/oputs.c" - "lib/mes/globals.c" - "lib/stdlib/exit.c" - "lib/linux/x86-mes-gcc/_exit.c" - "lib/linux/x86-mes-gcc/_write.c" - "lib/stdlib/puts.c" - "lib/string/strlen.c" - "lib/ctype/isnumber.c" - "lib/mes/abtol.c" - "lib/mes/cast.c" - "lib/mes/eputc.c" - "lib/mes/fdgetc.c" - "lib/mes/fdputc.c" - "lib/mes/fdputs.c" - "lib/mes/fdungetc.c" - "lib/mes/itoa.c" - "lib/mes/ltoa.c" - "lib/mes/ltoab.c" - "lib/mes/mes_open.c" - "lib/mes/ntoab.c" - "lib/mes/oputc.c" - "lib/mes/ultoa.c" - "lib/mes/utoa.c" - "lib/stub/__raise.c" - "lib/ctype/isdigit.c" - "lib/ctype/isspace.c" - "lib/ctype/isxdigit.c" - "lib/mes/assert_msg.c" - "lib/posix/write.c" - "lib/stdlib/atoi.c" - "lib/linux/lseek.c" - "lib/mes/__assert_fail.c" - "lib/mes/__buffered_read.c" - "lib/mes/__mes_debug.c" - "lib/posix/execv.c" - "lib/posix/getcwd.c" - "lib/posix/getenv.c" - "lib/posix/isatty.c" - "lib/posix/open.c" - "lib/posix/buffered-read.c" - "lib/posix/setenv.c" - "lib/posix/wait.c" - "lib/stdio/fgetc.c" - "lib/stdio/fputc.c" - "lib/stdio/fputs.c" - "lib/stdio/getc.c" - "lib/stdio/getchar.c" - "lib/stdio/putc.c" - "lib/stdio/putchar.c" - "lib/stdio/ungetc.c" - "lib/stdlib/free.c" - "lib/stdlib/realloc.c" - "lib/string/memchr.c" - "lib/string/memcmp.c" - "lib/string/memcpy.c" - "lib/string/memmove.c" - "lib/string/memset.c" - "lib/string/strcmp.c" - "lib/string/strcpy.c" - "lib/string/strncmp.c" - "lib/posix/raise.c" - "lib/linux/access.c" - "lib/linux/brk.c" - "lib/linux/chmod.c" - "lib/linux/clock_gettime.c" - "lib/linux/dup.c" - "lib/linux/dup2.c" - "lib/linux/execve.c" - "lib/linux/fork.c" - "lib/linux/fsync.c" - "lib/linux/_getcwd.c" - "lib/linux/gettimeofday.c" - "lib/linux/ioctl3.c" - "lib/linux/_open3.c" - "lib/linux/malloc.c" - "lib/linux/_read.c" - "lib/linux/time.c" - "lib/linux/unlink.c" - "lib/linux/wait4.c" - "lib/linux/waitpid.c" - "lib/linux/x86-mes-gcc/syscall.c" - "lib/linux/getpid.c" - "lib/linux/kill.c" - "lib/ctype/islower.c" - "lib/ctype/isupper.c" - "lib/ctype/tolower.c" - "lib/ctype/toupper.c" - "lib/mes/abtod.c" - "lib/mes/dtoab.c" - "lib/mes/search-path.c" - "lib/posix/execvp.c" - "lib/stdio/fclose.c" - "lib/stdio/fdopen.c" - "lib/stdio/ferror.c" - "lib/stdio/fflush.c" - "lib/stdio/fopen.c" - "lib/stdio/fprintf.c" - "lib/stdio/fread.c" - "lib/stdio/fseek.c" - "lib/stdio/ftell.c" - "lib/stdio/fwrite.c" - "lib/stdio/printf.c" - "lib/stdio/remove.c" - "lib/stdio/snprintf.c" - "lib/stdio/sprintf.c" - "lib/stdio/sscanf.c" - "lib/stdio/vfprintf.c" - "lib/stdio/vprintf.c" - "lib/stdio/vsnprintf.c" - "lib/stdio/vsprintf.c" - "lib/stdio/vsscanf.c" - "lib/stdlib/calloc.c" - "lib/stdlib/qsort.c" - "lib/stdlib/strtod.c" - "lib/stdlib/strtof.c" - "lib/stdlib/strtol.c" - "lib/stdlib/strtold.c" - "lib/stdlib/strtoll.c" - "lib/stdlib/strtoul.c" - "lib/stdlib/strtoull.c" - "lib/string/memmem.c" - "lib/string/strcat.c" - "lib/string/strchr.c" - "lib/string/strlwr.c" - "lib/string/strncpy.c" - "lib/string/strrchr.c" - "lib/string/strstr.c" - "lib/string/strupr.c" - "lib/stub/sigaction.c" - "lib/stub/ldexp.c" - "lib/stub/mprotect.c" - "lib/stub/localtime.c" - "lib/stub/sigemptyset.c" - "lib/x86-mes-gcc/setjmp.c" - "lib/linux/close.c" - "lib/linux/rmdir.c" - "lib/linux/stat.c" - ]; - libc_gnu = [ - "lib/mes/__init_io.c" - "lib/mes/eputs.c" - "lib/mes/oputs.c" - "lib/mes/globals.c" - "lib/stdlib/exit.c" - "lib/linux/x86-mes-gcc/_exit.c" - "lib/linux/x86-mes-gcc/_write.c" - "lib/stdlib/puts.c" - "lib/string/strlen.c" - "lib/ctype/isnumber.c" - "lib/mes/abtol.c" - "lib/mes/cast.c" - "lib/mes/eputc.c" - "lib/mes/fdgetc.c" - "lib/mes/fdputc.c" - "lib/mes/fdputs.c" - "lib/mes/fdungetc.c" - "lib/mes/itoa.c" - "lib/mes/ltoa.c" - "lib/mes/ltoab.c" - "lib/mes/mes_open.c" - "lib/mes/ntoab.c" - "lib/mes/oputc.c" - "lib/mes/ultoa.c" - "lib/mes/utoa.c" - "lib/stub/__raise.c" - "lib/ctype/isdigit.c" - "lib/ctype/isspace.c" - "lib/ctype/isxdigit.c" - "lib/mes/assert_msg.c" - "lib/posix/write.c" - "lib/stdlib/atoi.c" - "lib/linux/lseek.c" - "lib/mes/__assert_fail.c" - "lib/mes/__buffered_read.c" - "lib/mes/__mes_debug.c" - "lib/posix/execv.c" - "lib/posix/getcwd.c" - "lib/posix/getenv.c" - "lib/posix/isatty.c" - "lib/posix/open.c" - "lib/posix/buffered-read.c" - "lib/posix/setenv.c" - "lib/posix/wait.c" - "lib/stdio/fgetc.c" - "lib/stdio/fputc.c" - "lib/stdio/fputs.c" - "lib/stdio/getc.c" - "lib/stdio/getchar.c" - "lib/stdio/putc.c" - "lib/stdio/putchar.c" - "lib/stdio/ungetc.c" - "lib/stdlib/free.c" - "lib/stdlib/realloc.c" - "lib/string/memchr.c" - "lib/string/memcmp.c" - "lib/string/memcpy.c" - "lib/string/memmove.c" - "lib/string/memset.c" - "lib/string/strcmp.c" - "lib/string/strcpy.c" - "lib/string/strncmp.c" - "lib/posix/raise.c" - "lib/linux/access.c" - "lib/linux/brk.c" - "lib/linux/chmod.c" - "lib/linux/clock_gettime.c" - "lib/linux/dup.c" - "lib/linux/dup2.c" - "lib/linux/execve.c" - "lib/linux/fork.c" - "lib/linux/fsync.c" - "lib/linux/_getcwd.c" - "lib/linux/gettimeofday.c" - "lib/linux/ioctl3.c" - "lib/linux/_open3.c" - "lib/linux/malloc.c" - "lib/linux/_read.c" - "lib/linux/time.c" - "lib/linux/unlink.c" - "lib/linux/wait4.c" - "lib/linux/waitpid.c" - "lib/linux/x86-mes-gcc/syscall.c" - "lib/linux/getpid.c" - "lib/linux/kill.c" - "lib/ctype/islower.c" - "lib/ctype/isupper.c" - "lib/ctype/tolower.c" - "lib/ctype/toupper.c" - "lib/mes/abtod.c" - "lib/mes/dtoab.c" - "lib/mes/search-path.c" - "lib/posix/execvp.c" - "lib/stdio/fclose.c" - "lib/stdio/fdopen.c" - "lib/stdio/ferror.c" - "lib/stdio/fflush.c" - "lib/stdio/fopen.c" - "lib/stdio/fprintf.c" - "lib/stdio/fread.c" - "lib/stdio/fseek.c" - "lib/stdio/ftell.c" - "lib/stdio/fwrite.c" - "lib/stdio/printf.c" - "lib/stdio/remove.c" - "lib/stdio/snprintf.c" - "lib/stdio/sprintf.c" - "lib/stdio/sscanf.c" - "lib/stdio/vfprintf.c" - "lib/stdio/vprintf.c" - "lib/stdio/vsnprintf.c" - "lib/stdio/vsprintf.c" - "lib/stdio/vsscanf.c" - "lib/stdlib/calloc.c" - "lib/stdlib/qsort.c" - "lib/stdlib/strtod.c" - "lib/stdlib/strtof.c" - "lib/stdlib/strtol.c" - "lib/stdlib/strtold.c" - "lib/stdlib/strtoll.c" - "lib/stdlib/strtoul.c" - "lib/stdlib/strtoull.c" - "lib/string/memmem.c" - "lib/string/strcat.c" - "lib/string/strchr.c" - "lib/string/strlwr.c" - "lib/string/strncpy.c" - "lib/string/strrchr.c" - "lib/string/strstr.c" - "lib/string/strupr.c" - "lib/stub/sigaction.c" - "lib/stub/ldexp.c" - "lib/stub/mprotect.c" - "lib/stub/localtime.c" - "lib/stub/sigemptyset.c" - "lib/x86-mes-gcc/setjmp.c" - "lib/linux/close.c" - "lib/linux/rmdir.c" - "lib/linux/stat.c" - "lib/ctype/isalnum.c" - "lib/ctype/isalpha.c" - "lib/ctype/isascii.c" - "lib/ctype/iscntrl.c" - "lib/ctype/isgraph.c" - "lib/ctype/isprint.c" - "lib/ctype/ispunct.c" - "lib/dirent/__getdirentries.c" - "lib/dirent/closedir.c" - "lib/dirent/opendir.c" - "lib/dirent/readdir.c" - "lib/math/ceil.c" - "lib/math/fabs.c" - "lib/math/floor.c" - "lib/mes/fdgets.c" - "lib/posix/alarm.c" - "lib/posix/execl.c" - "lib/posix/execlp.c" - "lib/posix/mktemp.c" - "lib/posix/sbrk.c" - "lib/posix/sleep.c" - "lib/posix/unsetenv.c" - "lib/stdio/clearerr.c" - "lib/stdio/feof.c" - "lib/stdio/fgets.c" - "lib/stdio/fileno.c" - "lib/stdio/freopen.c" - "lib/stdio/fscanf.c" - "lib/stdio/perror.c" - "lib/stdio/vfscanf.c" - "lib/stdlib/__exit.c" - "lib/stdlib/abort.c" - "lib/stdlib/abs.c" - "lib/stdlib/alloca.c" - "lib/stdlib/atexit.c" - "lib/stdlib/atof.c" - "lib/stdlib/atol.c" - "lib/stdlib/mbstowcs.c" - "lib/string/bcmp.c" - "lib/string/bcopy.c" - "lib/string/bzero.c" - "lib/string/index.c" - "lib/string/rindex.c" - "lib/string/strcspn.c" - "lib/string/strdup.c" - "lib/string/strerror.c" - "lib/string/strncat.c" - "lib/string/strpbrk.c" - "lib/string/strspn.c" - "lib/stub/__cleanup.c" - "lib/stub/atan2.c" - "lib/stub/bsearch.c" - "lib/stub/chown.c" - "lib/stub/cos.c" - "lib/stub/ctime.c" - "lib/stub/exp.c" - "lib/stub/fpurge.c" - "lib/stub/freadahead.c" - "lib/stub/frexp.c" - "lib/stub/getgrgid.c" - "lib/stub/getgrnam.c" - "lib/stub/getlogin.c" - "lib/stub/getpgid.c" - "lib/stub/getpgrp.c" - "lib/stub/getpwnam.c" - "lib/stub/getpwuid.c" - "lib/stub/gmtime.c" - "lib/stub/log.c" - "lib/stub/mktime.c" - "lib/stub/modf.c" - "lib/stub/pclose.c" - "lib/stub/popen.c" - "lib/stub/pow.c" - "lib/stub/rand.c" - "lib/stub/rewind.c" - "lib/stub/setbuf.c" - "lib/stub/setgrent.c" - "lib/stub/setlocale.c" - "lib/stub/setvbuf.c" - "lib/stub/sigaddset.c" - "lib/stub/sigblock.c" - "lib/stub/sigdelset.c" - "lib/stub/sigsetmask.c" - "lib/stub/sin.c" - "lib/stub/sqrt.c" - "lib/stub/strftime.c" - "lib/stub/sys_siglist.c" - "lib/stub/system.c" - "lib/stub/times.c" - "lib/stub/ttyname.c" - "lib/stub/umask.c" - "lib/stub/utime.c" - "lib/linux/chdir.c" - "lib/linux/fcntl.c" - "lib/linux/fstat.c" - "lib/linux/getdents.c" - "lib/linux/getegid.c" - "lib/linux/geteuid.c" - "lib/linux/getgid.c" - "lib/linux/getppid.c" - "lib/linux/getrusage.c" - "lib/linux/getuid.c" - "lib/linux/ioctl.c" - "lib/linux/link.c" - "lib/linux/lstat.c" - "lib/linux/mkdir.c" - "lib/linux/mknod.c" - "lib/linux/nanosleep.c" - "lib/linux/pipe.c" - "lib/linux/readlink.c" - "lib/linux/rename.c" - "lib/linux/setgid.c" - "lib/linux/settimer.c" - "lib/linux/setuid.c" - "lib/linux/signal.c" - "lib/linux/sigprogmask.c" - "lib/linux/symlink.c" - ]; - mes = [ - "src/builtins.c" - "src/cc.c" - "src/core.c" - "src/display.c" - "src/eval-apply.c" - "src/gc.c" - "src/globals.c" - "src/hash.c" - "src/lib.c" - "src/math.c" - "src/mes.c" - "src/module.c" - "src/posix.c" - "src/reader.c" - "src/stack.c" - "src/string.c" - "src/struct.c" - "src/symbol.c" - "src/vector.c" - ]; - }; -} diff --git a/foundation/src/stages/stage1/musl/boot.nix b/foundation/src/stages/stage1/musl/boot.nix deleted file mode 100644 index 4b1e2fa..0000000 --- a/foundation/src/stages/stage1/musl/boot.nix +++ /dev/null @@ -1,139 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage1.musl.boot; - - platform = config.aux.platform; - builders = config.aux.foundation.builders; - - stage1 = config.aux.foundation.stages.stage1; -in -{ - options.aux.foundation.stages.stage1.musl.boot = { - package = lib.options.create { - type = lib.types.derivation; - description = "The package to use for musl-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.musl.boot = { - version = "1.1.24"; - - src = builtins.fetchurl { - url = "https://musl.libc.org/releases/musl-${cfg.version}.tar.gz"; - sha256 = "E3DJqBKyzyp9koAlEMygBYzDfmanvt1wBR8KNAFQIqM="; - }; - - package = - let - # Thanks to the live-bootstrap project! - # See https://github.com/fosslinux/live-bootstrap/blob/d98f97e21413efc32c770d0356f1feda66025686/sysa/musl-1.1.24/musl-1.1.24.sh - liveBootstrap = "https://github.com/fosslinux/live-bootstrap/raw/d98f97e21413efc32c770d0356f1feda66025686/sysa/musl-1.1.24"; - patches = [ - (builtins.fetchurl { - url = "${liveBootstrap}/patches/avoid_set_thread_area.patch"; - sha256 = "TsbBZXk4/KMZG9EKi7cF+sullVXrxlizLNH0UHGXsPs="; - }) - (builtins.fetchurl { - url = "${liveBootstrap}/patches/avoid_sys_clone.patch"; - sha256 = "/ZmH64J57MmbxdfQ4RNjamAiBdkImMTlHsHdgV4gMj4="; - }) - (builtins.fetchurl { - url = "${liveBootstrap}/patches/fenv.patch"; - sha256 = "vMVGjoN4deAJW5gsSqA207SJqAbvhrnOsGK49DdEiTI="; - }) - (builtins.fetchurl { - url = "${liveBootstrap}/patches/makefile.patch"; - sha256 = "03iYBAUnsrEdLIIhhhq5mM6BGnPn2EfUmIHu51opxbw="; - }) - (builtins.fetchurl { - url = "${liveBootstrap}/patches/musl_weak_symbols.patch"; - sha256 = "/d9a2eUkpe9uyi1ye6T4CiYc9MR3FZ9na0Gb90+g4v0="; - }) - (builtins.fetchurl { - url = "${liveBootstrap}/patches/set_thread_area.patch"; - sha256 = "RIZYqbbRSx4X/0iFUhriwwBRmoXVR295GNBUjf2UrM0="; - }) - (builtins.fetchurl { - url = "${liveBootstrap}/patches/sigsetjmp.patch"; - sha256 = "wd2Aev1zPJXy3q933aiup5p1IMKzVJBquAyl3gbK4PU="; - }) - # FIXME: this patch causes the build to fail - # (builtins.fetchurl { - # url = "${liveBootstrap}/patches/stdio_flush_on_exit.patch"; - # sha256 = "/z5ze3h3QTysay8nRvyvwPv3pmTcKptdkBIaMCoeLDg="; - # }) - # HACK: always flush stdio immediately - ./patches/always-flush.patch - (builtins.fetchurl { - url = "${liveBootstrap}/patches/va_list.patch"; - sha256 = "UmcMIl+YCi3wIeVvjbsCyqFlkyYsM4ECNwTfXP+s7vg="; - }) - ]; - in - builders.bash.boot.build { - name = "musl-boot-${cfg.version}"; - - meta = stage1.musl.meta; - - deps.build.host = [ - stage1.tinycc.mes.compiler.package - stage1.gnumake.boot.package - stage1.gnused.boot.package - stage1.gnugrep.package - stage1.gnupatch.package - stage1.gnutar.boot.package - stage1.gzip.package - ]; - - script = '' - # Unpack - tar xzf ${cfg.src} - cd musl-${cfg.version} - - # Patch - ${lib.strings.concatMapSep "\n" (file: "patch -Np0 -i ${file}") patches} - # tcc does not support complex types - rm -rf src/complex - # Configure fails without this - mkdir -p /dev - # https://github.com/ZilchOS/bootstrap-from-tcc/blob/2e0c68c36b3437386f786d619bc9a16177f2e149/using-nix/2a3-intermediate-musl.nix - sed -i 's|/bin/sh|${stage1.bash.boot.package}/bin/bash|' \ - tools/*.sh - chmod 755 tools/*.sh - # patch popen/system to search in PATH instead of hardcoding /bin/sh - sed -i 's|posix_spawn(&pid, "/bin/sh",|posix_spawnp(\&pid, "sh",|' \ - src/stdio/popen.c src/process/system.c - sed -i 's|execl("/bin/sh", "sh", "-c",|execlp("sh", "-c",|'\ - src/misc/wordexp.c - - # Configure - bash ./configure \ - --prefix=$out \ - --build=${platform.build} \ - --host=${platform.host} \ - --disable-shared \ - CC=tcc - - # Build - make AR="tcc -ar" RANLIB=true CFLAGS="-DSYSCALL_NO_TLS" - - # Install - make install - cp ${stage1.tinycc.mes.libs.package}/lib/libtcc1.a $out/lib - - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/musl/default.nix b/foundation/src/stages/stage1/musl/default.nix deleted file mode 100644 index 89e245e..0000000 --- a/foundation/src/stages/stage1/musl/default.nix +++ /dev/null @@ -1,116 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage1.musl; - - platform = config.aux.platform; - builders = config.aux.foundation.builders; - - stage1 = config.aux.foundation.stages.stage1; -in -{ - includes = [ ./boot.nix ]; - - options.aux.foundation.stages.stage1.musl = { - meta = { - description = lib.options.create { - type = lib.types.string; - description = "Description for the package."; - default.value = "An efficient, small, quality libc implementation"; - }; - - homepage = lib.options.create { - type = lib.types.string; - description = "Homepage for the package."; - default.value = "https://musl.libc.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.mit; - }; - - 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 musl."; - }; - - 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.musl = { - version = "1.2.4"; - - src = builtins.fetchurl { - url = "https://musl.libc.org/releases/musl-${cfg.version}.tar.gz"; - sha256 = "ejXq4z1TcqfA2hGI3nmHJvaIJVE7euPr6XqqpSEU8Dk="; - }; - - package = builders.bash.build { - name = "musl-${cfg.version}"; - - meta = cfg.meta; - - deps.build.host = [ - stage1.gcc.v46.package - stage1.binutils.package - stage1.gnumake.package - stage1.gnused.package - stage1.gnugrep.package - stage1.gnutar.musl.package - stage1.gzip.package - ]; - - script = '' - # Unpack - tar xzf ${cfg.src} - cd musl-${cfg.version} - - # Patch - # https://github.com/ZilchOS/bootstrap-from-tcc/blob/2e0c68c36b3437386f786d619bc9a16177f2e149/using-nix/2a3-intermediate-musl.nix - sed -i 's|/bin/sh|${stage1.bash.package}/bin/bash|' \ - tools/*.sh - # patch popen/system to search in PATH instead of hardcoding /bin/sh - sed -i 's|posix_spawn(&pid, "/bin/sh",|posix_spawnp(\&pid, "sh",|' \ - src/stdio/popen.c src/process/system.c - sed -i 's|execl("/bin/sh", "sh", "-c",|execlp("sh", "-c",|'\ - src/misc/wordexp.c - - # Configure - bash ./configure \ - --prefix=$out \ - --build=${platform.build} \ - --host=${platform.host} \ - --syslibdir=$out/lib \ - --enable-wrapper - - # Build - make -j $NIX_BUILD_CORES - - # Install - make -j $NIX_BUILD_CORES install - sed -i 's|/bin/sh|${stage1.bash.package}/bin/bash|' $out/bin/* - ln -s ../lib/libc.so $out/bin/ldd - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/musl/patches/always-flush.patch b/foundation/src/stages/stage1/musl/patches/always-flush.patch deleted file mode 100644 index e01a7ee..0000000 --- a/foundation/src/stages/stage1/musl/patches/always-flush.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git src/env/__libc_start_main.c src/env/__libc_start_main.c -index 8fbe526..9476c22 100644 ---- src/env/__libc_start_main.c -+++ src/env/__libc_start_main.c -@@ -91,6 +91,7 @@ static int libc_start_main_stage2(int (*main)(int,char **,char **), int argc, ch - __libc_start_init(); - - /* Pass control to the application */ -+ setbuf(stdout, NULL); - exit(main(argc, argv, envp)); - return 0; - } - diff --git a/foundation/src/stages/stage1/nyacc/default.nix b/foundation/src/stages/stage1/nyacc/default.nix deleted file mode 100644 index 799b361..0000000 --- a/foundation/src/stages/stage1/nyacc/default.nix +++ /dev/null @@ -1,77 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage1.nyacc; - - builders = config.aux.foundation.builders; - - stage0 = config.aux.foundation.stages.stage0; - - pname = "nyacc"; - version = "1.00.2"; -in -{ - options.aux.foundation.stages.stage1.nyacc = { - meta = { - description = lib.options.create { - type = lib.types.string; - description = "Description for the package."; - default.value = "Modules for generating parsers and lexical analyzers."; - }; - - homepage = lib.options.create { - type = lib.types.string; - description = "Homepage for the package."; - default.value = "https://savannah.nongnu.org/projects/nyacc"; - }; - - 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.lgpl3Plus; - }; - - platforms = lib.options.create { - type = lib.types.list.of lib.types.string; - description = "Platforms the package supports."; - default.value = [ "i686-linux" ]; - }; - }; - - src = lib.options.create { - type = lib.types.derivation; - description = "Source for the package."; - }; - - package = lib.options.create { - type = lib.types.derivation; - description = "The package to use for nyacc."; - }; - }; - - config = { - aux.foundation.stages.stage1.nyacc = { - src = builtins.fetchurl { - url = "https://mirror.easyname.at/nongnu/nyacc/nyacc-${version}.tar.gz"; - sha256 = "065ksalfllbdrzl12dz9d9dcxrv97wqxblslngsc6kajvnvlyvpk"; - }; - - package = builders.kaem.build { - name = "${pname}-${version}"; - meta = cfg.meta; - src = cfg.src; - - script = '' - ungz --file ${cfg.src} --output nyacc.tar - mkdir -p ''${out}/share - cd ''${out}/share - untar --file ''${NIX_BUILD_TOP}/nyacc.tar - ''; - - extras = { - guileModule = "${cfg.package}/share/${pname}-${version}/module"; - }; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/python/default.nix b/foundation/src/stages/stage1/python/default.nix deleted file mode 100644 index f730cb5..0000000 --- a/foundation/src/stages/stage1/python/default.nix +++ /dev/null @@ -1,121 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage1.python; - - platform = config.aux.platform; - builders = config.aux.foundation.builders; - - stage1 = config.aux.foundation.stages.stage1; -in -{ - options.aux.foundation.stages.stage1.python = { - meta = { - description = lib.options.create { - type = lib.types.string; - description = "Description for the package."; - default.value = "A high-level dynamically-typed programming language."; - }; - - homepage = lib.options.create { - type = lib.types.string; - description = "Homepage for the package."; - default.value = "https://www.python.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.psfl; - }; - - 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 python."; - }; - - 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.python = { - version = "3.12.0"; - - src = builtins.fetchurl { - url = "https://www.python.org/ftp/python/${cfg.version}/Python-${cfg.version}.tar.xz"; - sha256 = "eVw09E30Wg6blxDIxxwVxnGHFSTNQSyhTe8hLozLFV0="; - }; - - package = - let - patches = [ - # Disable the use of ldconfig in ctypes.util.find_library (since - # ldconfig doesn't work on NixOS), and don't use - # ctypes.util.find_library during the loading of the uuid module - # (since it will do a futile invocation of gcc (!) to find - # libuuid, slowing down program startup a lot). - ./patches/no-ldconfig.patch - ]; - in - builders.bash.build { - name = "python-${cfg.version}"; - meta = cfg.meta; - - deps.build.host = [ - stage1.gcc.package - stage1.musl.package - stage1.binutils.package - stage1.gnumake.package - stage1.gnupatch.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 Python-${cfg.version} - - # Patch - ${lib.strings.concatMapSep "\n" (file: "patch -Np1 -i ${file}") patches} - - # Configure - export CC=musl-gcc - export C_INCLUDE_PATH="${stage1.zlib.package}/include" - export LIBRARY_PATH="${stage1.zlib.package}/lib" - export LD_LIBRARY_PATH="$LIBRARY_PATH" - bash ./configure \ - --prefix=$out \ - --build=${platform.build} \ - --host=${platform.host} - - # Build - make -j $NIX_BUILD_CORES - - # Install - make -j $NIX_BUILD_CORES install - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/python/patches/no-ldconfig.patch b/foundation/src/stages/stage1/python/patches/no-ldconfig.patch deleted file mode 100644 index 0e050f8..0000000 --- a/foundation/src/stages/stage1/python/patches/no-ldconfig.patch +++ /dev/null @@ -1,108 +0,0 @@ -From 5330b6af9f832af59aa5c61d9ef6971053a8e709 Mon Sep 17 00:00:00 2001 -From: Jonathan Ringer <jonringer117@gmail.com> -Date: Mon, 9 Nov 2020 10:24:35 -0800 -Subject: [PATCH] CPython: Don't use ldconfig - ---- - Lib/ctypes/util.py | 77 ++-------------------------------------------- - 1 file changed, 2 insertions(+), 75 deletions(-) - -diff --git a/Lib/ctypes/util.py b/Lib/ctypes/util.py -index 0c2510e161..7fb98af308 100644 ---- a/Lib/ctypes/util.py -+++ b/Lib/ctypes/util.py -@@ -100,53 +100,7 @@ def _is_elf(filename): - return thefile.read(4) == elf_header - - def _findLib_gcc(name): -- # Run GCC's linker with the -t (aka --trace) option and examine the -- # library name it prints out. The GCC command will fail because we -- # haven't supplied a proper program with main(), but that does not -- # matter. -- expr = os.fsencode(r'[^\(\)\s]*lib%s\.[^\(\)\s]*' % re.escape(name)) -- -- c_compiler = shutil.which('gcc') -- if not c_compiler: -- c_compiler = shutil.which('cc') -- if not c_compiler: -- # No C compiler available, give up -- return None -- -- temp = tempfile.NamedTemporaryFile() -- try: -- args = [c_compiler, '-Wl,-t', '-o', temp.name, '-l' + name] -- -- env = dict(os.environ) -- env['LC_ALL'] = 'C' -- env['LANG'] = 'C' -- try: -- proc = subprocess.Popen(args, -- stdout=subprocess.PIPE, -- stderr=subprocess.STDOUT, -- env=env) -- except OSError: # E.g. bad executable -- return None -- with proc: -- trace = proc.stdout.read() -- finally: -- try: -- temp.close() -- except FileNotFoundError: -- # Raised if the file was already removed, which is the normal -- # behaviour of GCC if linking fails -- pass -- res = re.findall(expr, trace) -- if not res: -- return None -- -- for file in res: -- # Check if the given file is an elf file: gcc can report -- # some files that are linker scripts and not actual -- # shared objects. See bpo-41976 for more details -- if not _is_elf(file): -- continue -- return os.fsdecode(file) -+ return None - - - if sys.platform == "sunos5": -@@ -268,34 +222,7 @@ def find_library(name, is64 = False): - else: - - def _findSoname_ldconfig(name): -- import struct -- if struct.calcsize('l') == 4: -- machine = os.uname().machine + '-32' -- else: -- machine = os.uname().machine + '-64' -- mach_map = { -- 'x86_64-64': 'libc6,x86-64', -- 'ppc64-64': 'libc6,64bit', -- 'sparc64-64': 'libc6,64bit', -- 's390x-64': 'libc6,64bit', -- 'ia64-64': 'libc6,IA-64', -- } -- abi_type = mach_map.get(machine, 'libc6') -- -- # XXX assuming GLIBC's ldconfig (with option -p) -- regex = r'\s+(lib%s\.[^\s]+)\s+\(%s' -- regex = os.fsencode(regex % (re.escape(name), abi_type)) -- try: -- with subprocess.Popen(['/sbin/ldconfig', '-p'], -- stdin=subprocess.DEVNULL, -- stderr=subprocess.DEVNULL, -- stdout=subprocess.PIPE, -- env={'LC_ALL': 'C', 'LANG': 'C'}) as p: -- res = re.search(regex, p.stdout.read()) -- if res: -- return os.fsdecode(res.group(1)) -- except OSError: -- pass -+ return None - - def _findLib_ld(name): - # See issue #9998 for why this is needed --- -2.33.1 - - diff --git a/foundation/src/stages/stage1/tinycc/boot.nix b/foundation/src/stages/stage1/tinycc/boot.nix deleted file mode 100644 index 9e139e4..0000000 --- a/foundation/src/stages/stage1/tinycc/boot.nix +++ /dev/null @@ -1,197 +0,0 @@ -args@{ lib, config }: -let - cfg = config.aux.foundation.stages.stage1.tinycc.boot; - - builders = config.aux.foundation.builders; - - stage1 = config.aux.foundation.stages.stage1; - - pname = "tinycc-boot"; - - helpers = lib.fp.withDynamicArgs (import ./helpers.nix) args; -in -{ - options.aux.foundation.stages.stage1.tinycc.boot = { - meta = { - description = lib.options.create { - type = lib.types.string; - description = "Description for the package."; - default.value = "Tiny C Compiler's bootstrappable fork."; - }; - - homepage = lib.options.create { - type = lib.types.string; - description = "Homepage for the package."; - default.value = "https://repo.or.cz/w/tinycc.git"; - }; - - 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.lgpl21Only; - }; - - platforms = lib.options.create { - type = lib.types.list.of lib.types.string; - description = "Platforms the package supports."; - default.value = [ - "x86_64-linux" - "i686-linux" - ]; - }; - }; - - compiler = { - package = lib.options.create { - type = lib.types.derivation; - description = "The package to use for the tinycc-boot compiler."; - }; - }; - - libs = { - package = lib.options.create { - type = lib.types.derivation; - description = "The package to use for the tinycc-boot libs."; - }; - }; - - src = lib.options.create { - type = lib.types.string; - description = "Source for the package."; - }; - - revision = lib.options.create { - type = lib.types.string; - description = "Revision of the package."; - }; - }; - - config = { - aux.foundation.stages.stage1.tinycc.boot = - let - tinycc-boot = - let - tinycc-mes-bootstrappable = helpers.createBoot { - pname = "tinycc-mes-bootstrappable"; - version = stage1.tinycc.version; - src = cfg.src; - }; - - tinycc-boot0 = helpers.createTinyccMes { - pname = "tinycc-boot0"; - version = stage1.tinycc.version; - src = cfg.src; - args = [ - "-D HAVE_LONG_LONG_STUB=1" - "-D HAVE_SETJMP=1" - ]; - lib.args = [ "-D HAVE_LONG_LONG_STUB=1" ]; - boot = tinycc-mes-bootstrappable; - meta = cfg.meta; - }; - - tinycc-boot1 = helpers.createTinyccMes { - pname = "tinycc-boot1"; - version = stage1.tinycc.version; - src = cfg.src; - args = [ - "-D HAVE_BITFIELD=1" - "-D HAVE_LONG_LONG=1" - "-D HAVE_SETJMP=1" - ]; - lib.args = [ "-D HAVE_LONG_LONG=1" ]; - boot = tinycc-boot0; - meta = cfg.meta; - }; - - tinycc-boot2 = helpers.createTinyccMes { - pname = "tinycc-boot2"; - version = stage1.tinycc.version; - src = cfg.src; - args = [ - "-D HAVE_BITFIELD=1" - "-D HAVE_FLOAT_STUB=1" - "-D HAVE_LONG_LONG=1" - "-D HAVE_SETJMP=1" - ]; - lib.args = [ - "-D HAVE_FLOAT_STUB=1" - "-D HAVE_LONG_LONG=1" - ]; - boot = tinycc-boot1; - meta = cfg.meta; - }; - - tinycc-boot3 = helpers.createTinyccMes { - pname = "tinycc-boot3"; - version = stage1.tinycc.version; - src = cfg.src; - args = [ - "-D HAVE_BITFIELD=1" - "-D HAVE_FLOAT=1" - "-D HAVE_LONG_LONG=1" - "-D HAVE_SETJMP=1" - ]; - lib.args = [ - "-D HAVE_FLOAT=1" - "-D HAVE_LONG_LONG=1" - ]; - boot = tinycc-boot2; - meta = cfg.meta; - }; - in - helpers.createTinyccMes { - pname = "tinycc-boot"; - version = stage1.tinycc.version; - src = cfg.src; - args = [ - "-D HAVE_BITFIELD=1" - "-D HAVE_FLOAT=1" - "-D HAVE_LONG_LONG=1" - "-D HAVE_SETJMP=1" - ]; - lib.args = [ - "-D HAVE_FLOAT=1" - "-D HAVE_LONG_LONG=1" - ]; - boot = tinycc-boot3; - meta = cfg.meta; - }; - in - { - revision = "80114c4da6b17fbaabb399cc29f427e368309bc8"; - - libs.package = tinycc-boot.libs; - compiler.package = tinycc-boot.compiler; - - src = - let - tarball = builtins.fetchurl { - url = "https://gitlab.com/janneke/tinycc/-/archive/${cfg.revision}/tinycc-${cfg.revision}.tar.gz"; - sha256 = "1a0cw9a62qc76qqn5sjmp3xrbbvsz2dxrw21lrnx9q0s74mwaxbq"; - }; - - patched = builders.kaem.build { - name = "${pname}-src"; - - meta = stage1.tinycc.meta; - - script = '' - ungz --file ${tarball} --output tinycc.tar - mkdir -p ''${out} - cd ''${out} - untar --file ''${NIX_BUILD_TOP}/tinycc.tar - - # Patch - cd tinycc-${cfg.revision} - - # Static link by default - replace --file libtcc.c --output libtcc.c --match-on "s->ms_extensions = 1;" --replace-with "s->ms_extensions = 1; s->static_link = 1;" - ''; - }; - in - "${patched}/tinycc-${cfg.revision}"; - }; - }; -} diff --git a/foundation/src/stages/stage1/tinycc/default.nix b/foundation/src/stages/stage1/tinycc/default.nix deleted file mode 100644 index b599aab..0000000 --- a/foundation/src/stages/stage1/tinycc/default.nix +++ /dev/null @@ -1,55 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage1.tinycc; - - builders = config.aux.foundation.builders; - - stage1 = config.aux.foundation.stages.stage1; -in -{ - includes = [ - ./boot.nix - ./mes.nix - ./musl.nix - ]; - - options.aux.foundation.stages.stage1.tinycc = { - meta = { - description = lib.options.create { - type = lib.types.string; - description = "Description for the package."; - default.value = "Small, fast, embeddable C compiler and interpreter"; - }; - - homepage = lib.options.create { - type = lib.types.string; - description = "Homepage for the package."; - default.value = "https://repo.or.cz/w/tinycc.git"; - }; - - 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.lgpl21Only; - }; - - platforms = lib.options.create { - type = lib.types.list.of lib.types.string; - description = "Platforms the package supports."; - default.value = [ "i686-linux" ]; - }; - }; - - version = lib.options.create { - type = lib.types.string; - description = "Version of the package."; - }; - }; - - config = { - aux.foundation.stages.stage1.tinycc = { - version = "unstable-2023-04-20"; - }; - }; -} diff --git a/foundation/src/stages/stage1/tinycc/helpers.nix b/foundation/src/stages/stage1/tinycc/helpers.nix deleted file mode 100644 index 7fac9fa..0000000 --- a/foundation/src/stages/stage1/tinycc/helpers.nix +++ /dev/null @@ -1,183 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage1.tinycc.boot; - - builders = config.aux.foundation.builders; - - stage1 = config.aux.foundation.stages.stage1; - cflags = stage1.mes.libc.package.extras.CFLAGS; - - createBoot = - { - pname, - version, - src, - }: - let - compiler = builders.kaem.build { - name = "${pname}-${version}"; - - script = '' - catm config.h - ${stage1.mes.compiler.package}/bin/mes --no-auto-compile -e main ${stage1.mes.libs.src.bin}/bin/mescc.scm -- \ - -S \ - -o tcc.s \ - -I . \ - -D BOOTSTRAP=1 \ - -I ${src} \ - -D TCC_TARGET_I386=1 \ - -D inline= \ - -D CONFIG_TCCDIR=\"\" \ - -D CONFIG_SYSROOT=\"\" \ - -D CONFIG_TCC_CRTPREFIX=\"{B}\" \ - -D CONFIG_TCC_ELFINTERP=\"/mes/loader\" \ - -D CONFIG_TCC_LIBPATHS=\"{B}\" \ - -D CONFIG_TCC_SYSINCLUDEPATHS=\"${stage1.mes.libc.package}/include\" \ - -D TCC_LIBGCC=\"${stage1.mes.libc.package}/lib/x86-mes/libc.a\" \ - -D CONFIG_TCC_LIBTCC1_MES=0 \ - -D CONFIG_TCCBOOT=1 \ - -D CONFIG_TCC_STATIC=1 \ - -D CONFIG_USE_LIBGCC=1 \ - -D TCC_MES_LIBC=1 \ - -D TCC_VERSION=\"${version}\" \ - -D ONE_SOURCE=1 \ - ${src}/tcc.c - mkdir -p ''${out}/bin - ${stage1.mes.compiler.package}/bin/mes --no-auto-compile -e main ${stage1.mes.libs.src.bin}/bin/mescc.scm -- \ - -L ${stage1.mes.libs.package}/lib \ - -l c+tcc \ - -o ''${out}/bin/tcc \ - tcc.s - ''; - }; - - libs = createLibc { - inherit pname version; - src = stage1.mes.libc.package; - args = cflags; - tinycc = compiler; - }; - in - { - inherit compiler libs; - }; - - createTinyccMes = - { - pname, - version, - src, - args, - boot, - lib ? { }, - meta, - }: - let - compiler = builders.kaem.build { - name = "${pname}-${version}"; - - inherit meta; - - # - script = '' - catm config.h - mkdir -p ''${out}/bin - ${boot.compiler}/bin/tcc \ - -B ${boot.libs}/lib \ - -g \ - -v \ - -o ''${out}/bin/tcc \ - -D BOOTSTRAP=1 \ - ${builtins.concatStringsSep " " args} \ - -I . \ - -I ${src} \ - -D TCC_TARGET_I386=1 \ - -D CONFIG_TCCDIR=\"\" \ - -D CONFIG_SYSROOT=\"\" \ - -D CONFIG_TCC_CRTPREFIX=\"{B}\" \ - -D CONFIG_TCC_ELFINTERP=\"\" \ - -D CONFIG_TCC_LIBPATHS=\"{B}\" \ - -D CONFIG_TCC_SYSINCLUDEPATHS=\"${stage1.mes.libc.package}/include\" \ - -D TCC_LIBGCC=\"libc.a\" \ - -D TCC_LIBTCC1=\"libtcc1.a\" \ - -D CONFIG_TCCBOOT=1 \ - -D CONFIG_TCC_STATIC=1 \ - -D CONFIG_USE_LIBGCC=1 \ - -D TCC_MES_LIBC=1 \ - -D TCC_VERSION=\"${version}\" \ - -D ONE_SOURCE=1 \ - ${src}/tcc.c - ''; - }; - - libs = createLibc { - inherit pname version src; - - args = builtins.concatStringsSep " " ( - [ - "-c" - "-D" - "TCC_TARGET_I386=1" - ] - ++ (lib.args or [ ]) - ); - - tinycc = compiler; - }; - in - { - inherit compiler libs boot; - }; - - createLibc = - { - pname, - version, - src, - args, - tinycc, - }: - let - createLibrary = - name: args: source: - builders.kaem.build { - name = "${name}.a"; - - script = '' - ${tinycc}/bin/tcc ${args} -c -o ${name}.o ${source} - ${tinycc}/bin/tcc -ar cr ''${out} ${name}.o - ''; - }; - - crt = builders.kaem.build { - name = "crt"; - - script = '' - mkdir -p ''${out}/lib - ${tinycc}/bin/tcc ${cflags} -c -o ''${out}/lib/crt1.o ${stage1.mes.libc.package}/lib/crt1.c - ${tinycc}/bin/tcc ${cflags} -c -o ''${out}/lib/crtn.o ${stage1.mes.libc.package}/lib/crtn.c - ${tinycc}/bin/tcc ${cflags} -c -o ''${out}/lib/crti.o ${stage1.mes.libc.package}/lib/crti.c - ''; - }; - - libtcc1 = createLibrary "libtcc1" args "${src}/lib/libtcc1.c"; - libc = createLibrary "libc" cflags "${stage1.mes.libc.package}/lib/libc.c"; - libgetopt = createLibrary "libgetopt" cflags "${stage1.mes.libc.package}/lib/libgetopt.c"; - in - builders.kaem.build { - name = "${pname}-libs-${version}"; - - script = '' - mkdir -p ''${out}/lib - cp ${crt}/lib/crt1.o ''${out}/lib - cp ${crt}/lib/crtn.o ''${out}/lib - cp ${crt}/lib/crti.o ''${out}/lib - cp ${libtcc1} ''${out}/lib/libtcc1.a - cp ${libc} ''${out}/lib/libc.a - cp ${libgetopt} ''${out}/lib/libgetopt.a - ''; - }; -in -{ - inherit createBoot createTinyccMes createLibc; -} diff --git a/foundation/src/stages/stage1/tinycc/mes.nix b/foundation/src/stages/stage1/tinycc/mes.nix deleted file mode 100644 index c42603f..0000000 --- a/foundation/src/stages/stage1/tinycc/mes.nix +++ /dev/null @@ -1,146 +0,0 @@ -args@{ lib, config }: -let - cfg = config.aux.foundation.stages.stage1.tinycc.mes; - - builders = config.aux.foundation.builders; - - stage1 = config.aux.foundation.stages.stage1; - - pname = "tinycc-mes"; - - helpers = lib.fp.withDynamicArgs (import ./helpers.nix) args; -in -{ - options.aux.foundation.stages.stage1.tinycc.mes = { - compiler = { - package = lib.options.create { - type = lib.types.derivation; - description = "The package to use for the tinycc-mes compiler."; - }; - }; - - libs = { - package = lib.options.create { - type = lib.types.derivation; - description = "The package to use for the tinycc-mes libs."; - }; - }; - - src = lib.options.create { - type = lib.types.string; - description = "Source for the package."; - }; - - revision = lib.options.create { - type = lib.types.string; - description = "Revision of the package."; - }; - }; - - config = { - aux.foundation.stages.stage1.tinycc.mes = - let - tinycc-mes = - let - tccdefs = builders.kaem.build { - name = "tccdefs-${stage1.tinycc.version}"; - - script = '' - mkdir ''${out} - ${stage1.tinycc.boot.compiler.package}/bin/tcc \ - -B ${stage1.tinycc.boot.libs.package}/lib \ - -DC2STR \ - -o c2str \ - ${cfg.src}/conftest.c - ./c2str ${cfg.src}/include/tccdefs.h ''${out}/tccdefs_.h - ''; - }; - - tinycc-mes-boot = helpers.createTinyccMes { - pname = "${pname}-boot"; - version = stage1.tinycc.version; - src = cfg.src; - args = [ - "-D HAVE_BITFIELD=1" - "-D HAVE_FLOAT=1" - "-D HAVE_LONG_LONG=1" - "-D HAVE_SETJMP=1" - "-D CONFIG_TCC_PREDEFS=1" - "-I ${tccdefs}" - "-D CONFIG_TCC_SEMLOCK=0" - ]; - lib.args = [ - "-D HAVE_FLOAT=1" - "-D HAVE_LONG_LONG=1" - "-D CONFIG_TCC_PREDEFS=1" - "-I ${tccdefs}" - "-D CONFIG_TCC_SEMLOCK=0" - ]; - boot = { - libs = stage1.tinycc.boot.libs.package; - compiler = stage1.tinycc.boot.compiler.package; - }; - meta = stage1.tinycc.meta; - }; - in - helpers.createTinyccMes { - inherit pname; - version = stage1.tinycc.version; - src = cfg.src; - args = [ - "-std=c99" - "-D HAVE_BITFIELD=1" - "-D HAVE_FLOAT=1" - "-D HAVE_LONG_LONG=1" - "-D HAVE_SETJMP=1" - "-D CONFIG_TCC_PREDEFS=1" - "-I ${tccdefs}" - "-D CONFIG_TCC_SEMLOCK=0" - ]; - lib.args = [ - "-D HAVE_FLOAT=1" - "-D HAVE_LONG_LONG=1" - "-D CONFIG_TCC_PREDEFS=1" - "-I ${tccdefs}" - "-D CONFIG_TCC_SEMLOCK=0" - ]; - boot = tinycc-mes-boot; - meta = stage1.tinycc.meta; - }; - in - { - revision = "86f3d8e33105435946383aee52487b5ddf918140"; - - libs.package = tinycc-mes.libs; - compiler.package = tinycc-mes.compiler; - - src = - let - tarball = builtins.fetchurl { - url = "https://repo.or.cz/tinycc.git/snapshot/${cfg.revision}.tar.gz"; - sha256 = "11idrvbwfgj1d03crv994mpbbbyg63j1k64lw1gjy7mkiifw2xap"; - }; - - patched = builders.kaem.build { - name = "${pname}-src"; - - meta = stage1.tinycc.meta; - - script = '' - ungz --file ${tarball} --output tinycc.tar - mkdir -p ''${out} - cd ''${out} - untar --file ''${NIX_BUILD_TOP}/tinycc.tar - - # Patch - cd tinycc-${builtins.substring 0 7 cfg.revision} - - # Static link by default - replace --file libtcc.c --output libtcc.c --match-on "s->ms_extensions = 1;" --replace-with "s->ms_extensions = 1; s->static_link = 1;" - ''; - }; - in - "${patched}/tinycc-${builtins.substring 0 7 cfg.revision}"; - }; - }; -} diff --git a/foundation/src/stages/stage1/tinycc/musl.nix b/foundation/src/stages/stage1/tinycc/musl.nix deleted file mode 100644 index 006921b..0000000 --- a/foundation/src/stages/stage1/tinycc/musl.nix +++ /dev/null @@ -1,178 +0,0 @@ -args@{ lib, config }: -let - cfg = config.aux.foundation.stages.stage1.tinycc.musl; - - builders = config.aux.foundation.builders; - - stage1 = config.aux.foundation.stages.stage1; - - pname = "tinycc-musl"; - - helpers = lib.fp.withDynamicArgs (import ./helpers.nix) args; -in -{ - options.aux.foundation.stages.stage1.tinycc.musl = { - compiler = { - package = lib.options.create { - type = lib.types.derivation; - description = "The package to use for the tinycc-musl compiler."; - }; - }; - - libs = { - package = lib.options.create { - type = lib.types.derivation; - description = "The package to use for the tinycc-musl libs."; - }; - }; - - src = lib.options.create { - type = lib.types.string; - description = "Source for the package."; - }; - - revision = lib.options.create { - type = lib.types.string; - description = "Revision of the package."; - }; - }; - - config = { - aux.foundation.stages.stage1.tinycc.musl = - let - patches = [ - ./patches/ignore-duplicate-symbols.patch - ./patches/ignore-static-inside-array.patch - ./patches/static-link.patch - ]; - - tinycc-musl = builders.bash.boot.build { - name = "${pname}-${stage1.tinycc.version}"; - - meta = stage1.tinycc.meta; - - deps.build.host = [ - stage1.tinycc.boot.compiler.package - stage1.gnupatch.package - stage1.gnutar.boot.package - stage1.gzip.package - ]; - - script = '' - # Unpack - tar xzf ${cfg.src} - cd tinycc-${builtins.substring 0 7 cfg.revision} - - # Patch - ${lib.strings.concatMapSep "\n" (file: "patch -Np0 -i ${file}") patches} - - # Configure - touch config.h - - # Build - # We first have to recompile using tcc-0.9.26 as tcc-0.9.27 is not self-hosting, - # but when linked with musl it is. - ln -s ${stage1.musl.boot.package}/lib/libtcc1.a ./libtcc1.a - - tcc \ - -B ${stage1.tinycc.boot.libs.package}/lib \ - -DC2STR \ - -o c2str \ - conftest.c - ./c2str include/tccdefs.h tccdefs_.h - - tcc -v \ - -static \ - -o tcc-musl \ - -D TCC_TARGET_I386=1 \ - -D CONFIG_TCCDIR=\"\" \ - -D CONFIG_TCC_CRTPREFIX=\"{B}\" \ - -D CONFIG_TCC_ELFINTERP=\"/musl/loader\" \ - -D CONFIG_TCC_LIBPATHS=\"{B}\" \ - -D CONFIG_TCC_SYSINCLUDEPATHS=\"${stage1.musl.boot.package}/include\" \ - -D TCC_LIBGCC=\"libc.a\" \ - -D TCC_LIBTCC1=\"libtcc1.a\" \ - -D CONFIG_TCC_STATIC=1 \ - -D CONFIG_USE_LIBGCC=1 \ - -D TCC_VERSION=\"0.9.27\" \ - -D ONE_SOURCE=1 \ - -D TCC_MUSL=1 \ - -D CONFIG_TCC_PREDEFS=1 \ - -D CONFIG_TCC_SEMLOCK=0 \ - -B . \ - -B ${stage1.tinycc.boot.libs.package}/lib \ - tcc.c - # libtcc1.a - rm -f libtcc1.a - tcc -c -D HAVE_CONFIG_H=1 lib/libtcc1.c - tcc -ar cr libtcc1.a libtcc1.o - - # Rebuild tcc-musl with itself - ./tcc-musl \ - -v \ - -static \ - -o tcc-musl \ - -D TCC_TARGET_I386=1 \ - -D CONFIG_TCCDIR=\"\" \ - -D CONFIG_TCC_CRTPREFIX=\"{B}\" \ - -D CONFIG_TCC_ELFINTERP=\"/musl/loader\" \ - -D CONFIG_TCC_LIBPATHS=\"{B}\" \ - -D CONFIG_TCC_SYSINCLUDEPATHS=\"${stage1.musl.boot.package}/include\" \ - -D TCC_LIBGCC=\"libc.a\" \ - -D TCC_LIBTCC1=\"libtcc1.a\" \ - -D CONFIG_TCC_STATIC=1 \ - -D CONFIG_USE_LIBGCC=1 \ - -D TCC_VERSION=\"0.9.27\" \ - -D ONE_SOURCE=1 \ - -D TCC_MUSL=1 \ - -D CONFIG_TCC_PREDEFS=1 \ - -D CONFIG_TCC_SEMLOCK=0 \ - -B . \ - -B ${stage1.musl.boot.package}/lib \ - tcc.c - # libtcc1.a - rm -f libtcc1.a - ./tcc-musl -c -D HAVE_CONFIG_H=1 lib/libtcc1.c - ./tcc-musl -c -D HAVE_CONFIG_H=1 lib/alloca.S - ./tcc-musl -ar cr libtcc1.a libtcc1.o alloca.o - - # Install - install -D tcc-musl $out/bin/tcc - install -Dm444 libtcc1.a $out/lib/libtcc1.a - ''; - }; - in - { - revision = "fd6d2180c5c801bb0b4c5dde27d61503059fc97d"; - - src = builtins.fetchurl { - url = "https://repo.or.cz/tinycc.git/snapshot/${cfg.revision}.tar.gz"; - sha256 = "R81SNbEmh4s9FNQxCWZwUiMCYRkkwOHAdRf0aMnnRiA="; - }; - - compiler.package = builders.bash.boot.build { - name = "${pname}-${stage1.tinycc.version}-compiler"; - - meta = stage1.tinycc.meta; - - script = '' - install -D ${tinycc-musl}/bin/tcc $out/bin/tcc - ''; - }; - - libs.package = builders.bash.boot.build { - name = "${pname}-${stage1.tinycc.version}-libs"; - - meta = stage1.tinycc.meta; - - script = '' - mkdir $out - cp -r ${stage1.musl.boot.package}/* $out - chmod +w $out/lib/libtcc1.a - cp ${tinycc-musl}/lib/libtcc1.a $out/lib/libtcc1.a - - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/tinycc/patches/ignore-duplicate-symbols.patch b/foundation/src/stages/stage1/tinycc/patches/ignore-duplicate-symbols.patch deleted file mode 100644 index 2e5255e..0000000 --- a/foundation/src/stages/stage1/tinycc/patches/ignore-duplicate-symbols.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- tccelf.c -+++ tccelf.c -@@ -710,8 +710,9 @@ ST_FUNC int set_elf_sym(Section *s, addr_t value, unsigned long size, - #if 0 - printf("new_bind=%x new_shndx=%x new_vis=%x old_bind=%x old_shndx=%x old_vis=%x\n", - sym_bind, shndx, new_vis, esym_bind, esym->st_shndx, esym_vis); --#endif - tcc_error_noabort("'%s' defined twice", name); -+#endif -+ goto do_patch; - } - } else { - esym->st_other = other; - diff --git a/foundation/src/stages/stage1/tinycc/patches/ignore-static-inside-array.patch b/foundation/src/stages/stage1/tinycc/patches/ignore-static-inside-array.patch deleted file mode 100644 index f03b991..0000000 --- a/foundation/src/stages/stage1/tinycc/patches/ignore-static-inside-array.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- tccgen.c -+++ tccgen.c -@@ -4941,7 +4941,7 @@ static int post_type(CType *type, AttributeDef *ad, int storage, int td) - next(); - n = -1; - t1 = 0; -- if (td & TYPE_PARAM) while (1) { -+ while (1) { - /* XXX The optional type-quals and static should only be accepted - in parameter decls. The '*' as well, and then even only - in prototypes (not function defs). */ -@@ -4972,7 +4972,8 @@ static int post_type(CType *type, AttributeDef *ad, int storage, int td) - } - break; - -- } else if (tok != ']') { -+ } -+ if (tok != ']') { - if (!local_stack || (storage & VT_STATIC)) - vpushi(expr_const()); - else { - diff --git a/foundation/src/stages/stage1/tinycc/patches/static-link.patch b/foundation/src/stages/stage1/tinycc/patches/static-link.patch deleted file mode 100644 index 8478a44..0000000 --- a/foundation/src/stages/stage1/tinycc/patches/static-link.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- libtcc.c -+++ libtcc.c -@@ -793,6 +793,7 @@ LIBTCCAPI TCCState *tcc_new(void) - - s->gnu_ext = 1; - s->tcc_ext = 1; -+ s->static_link = 1; - s->nocommon = 1; - s->dollars_in_identifiers = 1; /*on by default like in gcc/clang*/ - s->cversion = 199901; /* default unless -std=c11 is supplied */ - diff --git a/foundation/src/stages/stage1/xz/default.nix b/foundation/src/stages/stage1/xz/default.nix deleted file mode 100644 index 867f600..0000000 --- a/foundation/src/stages/stage1/xz/default.nix +++ /dev/null @@ -1,108 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage1.xz; - - platform = config.aux.platform; - builders = config.aux.foundation.builders; - - stage1 = config.aux.foundation.stages.stage1; -in -{ - options.aux.foundation.stages.stage1.xz = { - meta = { - description = lib.options.create { - type = lib.types.string; - description = "Description for the package."; - default.value = "A general-purpose data compression software, successor of LZMA"; - }; - - homepage = lib.options.create { - type = lib.types.string; - description = "Homepage for the package."; - default.value = "https://tukaani.org/xz"; - }; - - license = lib.options.create { - # TODO: Add a proper type for licenses. - type = lib.types.list.of lib.types.attrs.any; - description = "License for the package."; - default.value = [ - lib.licenses.gpl2Plus - lib.licenses.lgpl21Plus - ]; - }; - - 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 xz."; - }; - - 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.xz = { - version = "5.4.3"; - - src = builtins.fetchurl { - url = "https://tukaani.org/xz/xz-${cfg.version}.tar.gz"; - sha256 = "HDguC8Lk4K9YOYqQPdYv/35RAXHS3keh6+BtFSjpt+k="; - }; - - package = builders.bash.boot.build { - name = "xz-${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 xz-${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} \ - --disable-shared \ - --disable-assembler - - # Build - make -j $NIX_BUILD_CORES - - # Install - make -j $NIX_BUILD_CORES install - - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage1/zlib/default.nix b/foundation/src/stages/stage1/zlib/default.nix deleted file mode 100644 index ba9e018..0000000 --- a/foundation/src/stages/stage1/zlib/default.nix +++ /dev/null @@ -1,97 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage1.zlib; - - platform = config.aux.platform; - builders = config.aux.foundation.builders; - - stage1 = config.aux.foundation.stages.stage1; -in -{ - options.aux.foundation.stages.stage1.zlib = { - meta = { - description = lib.options.create { - type = lib.types.string; - description = "Description for the package."; - default.value = "Lossless data-compression library."; - }; - - homepage = lib.options.create { - type = lib.types.string; - description = "Homepage for the package."; - default.value = "https://zlib.net"; - }; - - 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.zlib; - }; - - 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 zlib."; - }; - - 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.zlib = { - version = "1.3"; - - src = builtins.fetchurl { - url = "https://github.com/madler/zlib/releases/download/v${cfg.version}/zlib-${cfg.version}.tar.xz"; - sha256 = "ipuiiY4dDXdOymultGJ6EeVYi6hciFEzbrON5GgwUKc="; - }; - - package = builders.bash.build { - name = "zlib-${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.gnutar.package - stage1.xz.package - ]; - - script = '' - # Unpack - tar xf ${cfg.src} - cd zlib-${cfg.version} - - # Configure - export CC=musl-gcc - bash ./configure --prefix=$out - - # Build - make -j $NIX_BUILD_CORES - - # Install - make -j $NIX_BUILD_CORES install - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage2/bash/default.nix b/foundation/src/stages/stage2/bash/default.nix deleted file mode 100644 index ebdada0..0000000 --- a/foundation/src/stages/stage2/bash/default.nix +++ /dev/null @@ -1,118 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage2.bash; - - platform = config.aux.platform; - builders = config.aux.foundation.builders; - - stage1 = config.aux.foundation.stages.stage1; -in -{ - options.aux.foundation.stages.stage2.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.stage2.bash = { - version = "5.2.15"; - - src = builtins.fetchurl { - url = "${config.aux.mirrors.gnu}/bash/bash-${cfg.version}.tar.gz"; - sha256 = "132qng0jy600mv1fs95ylnlisx2wavkkgpb19c6kmz7lnmjhjwhk"; - }; - - package = builders.bash.build { - name = "bash-static-${cfg.version}"; - - meta = cfg.meta; - - deps.build.host = [ - stage1.gcc.package - stage1.musl.package - stage1.coreutils.package - stage1.binutils.package - stage1.gnumake.package - stage1.gnupatch.package - stage1.gnused.package - stage1.gnugrep.package - stage1.gnutar.package - stage1.gawk.package - stage1.gzip.package - stage1.diffutils.package - stage1.findutils.package - ]; - - script = '' - # Unpack - tar xf ${cfg.src} - cd bash-${cfg.version} - - # Configure - bash ./configure \ - --prefix=$out \ - --build=${platform.build} \ - --host=${platform.host} \ - --without-bash-malloc \ - --enable-static-link \ - bash_cv_func_strtoimax=y \ - CC=musl-gcc - - # Build - make -j $NIX_BUILD_CORES - - # Install - make -j $NIX_BUILD_CORES install-strip - rm $out/bin/bashbug - - ln -s $out/bin/bash $out/bin/sh - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage2/binutils/default.nix b/foundation/src/stages/stage2/binutils/default.nix deleted file mode 100644 index 31af117..0000000 --- a/foundation/src/stages/stage2/binutils/default.nix +++ /dev/null @@ -1,135 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage2.binutils; - - platform = config.aux.platform; - builders = config.aux.foundation.builders; - - stage1 = config.aux.foundation.stages.stage1; -in -{ - options.aux.foundation.stages.stage2.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.stage2.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 = [ - "CC=musl-gcc" - "LDFLAGS=--static" - "--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.build { - name = "binutils-static-${cfg.version}"; - - meta = cfg.meta; - - deps.build.host = [ - stage1.gcc.package - stage1.musl.package - stage1.binutils.package - stage1.gnumake.package - stage1.gnupatch.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 binutils-${cfg.version} - - # Patch - ${lib.strings.concatMapSep "\n" (file: "patch -Np1 -i ${file}") patches} - - # Configure - bash ./configure ${builtins.concatStringsSep " " configureFlags} - - # Build - make -j $NIX_BUILD_CORES - - # Install - # strip to remove build dependency store path references - make -j $NIX_BUILD_CORES install-strip - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage2/binutils/patches/deterministic.patch b/foundation/src/stages/stage2/binutils/patches/deterministic.patch deleted file mode 100644 index 5b479ba..0000000 --- a/foundation/src/stages/stage2/binutils/patches/deterministic.patch +++ /dev/null @@ -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")); - diff --git a/foundation/src/stages/stage2/busybox/default.nix b/foundation/src/stages/stage2/busybox/default.nix deleted file mode 100644 index 8d50e48..0000000 --- a/foundation/src/stages/stage2/busybox/default.nix +++ /dev/null @@ -1,119 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage2.busybox; - - platform = config.aux.platform; - builders = config.aux.foundation.builders; - - stage1 = config.aux.foundation.stages.stage1; - stage2 = config.aux.foundation.stages.stage2; -in -{ - options.aux.foundation.stages.stage2.busybox = { - meta = { - description = lib.options.create { - type = lib.types.string; - description = "Description for the package."; - default.value = "Tiny versions of common UNIX utilities in a single small executable."; - }; - - homepage = lib.options.create { - type = lib.types.string; - description = "Homepage for the package."; - default.value = "https://busybox.net/"; - }; - - 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.gpl2Only; - }; - - 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 busybox."; - }; - - 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.stage2.busybox = { - version = "1.36.1"; - - src = builtins.fetchurl { - url = "https://busybox.net/downloads/busybox-${cfg.version}.tar.bz2"; - sha256 = "uMwkyVdNgJ5yecO+NJeVxdXOtv3xnKcJ+AzeUOR94xQ="; - }; - - package = - let - patches = [ ./patches/busybox-in-store.patch ]; - - busyboxConfig = [ - "CC=musl-gcc" - "HOSTCC=musl-gcc" - "CFLAGS=-I${stage1.linux-headers.package}/include" - "KCONFIG_NOTIMESTAMP=y" - "CONFIG_PREFIX=${builtins.placeholder "out"}" - "CONFIG_STATIC=y" - ]; - in - builders.bash.build { - name = "busybox-static-${cfg.version}"; - meta = cfg.meta; - - deps.build.host = [ - stage1.gcc.package - stage1.musl.package - stage1.binutils.package - stage1.gnumake.package - stage1.gnupatch.package - stage1.gnused.package - stage2.gnugrep.package - stage2.gawk.package - stage1.diffutils.package - stage1.findutils.package - stage1.gnutar.package - stage1.bzip2.package - ]; - - script = '' - # Unpack - tar xf ${cfg.src} - cd busybox-${cfg.version} - - # Patch - ${lib.strings.concatMapSep "\n" (file: "patch -Np1 -i ${file}") patches} - - # Configure - BUSYBOX_FLAGS="${builtins.concatStringsSep " " busyboxConfig}" - make -j $NIX_BUILD_CORES $BUSYBOX_FLAGS defconfig - - # Build - make -j $NIX_BUILD_CORES $BUSYBOX_FLAGS - - # Install - cp busybox $out - - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage2/busybox/patches/busybox-in-store.patch b/foundation/src/stages/stage2/busybox/patches/busybox-in-store.patch deleted file mode 100644 index 0e90576..0000000 --- a/foundation/src/stages/stage2/busybox/patches/busybox-in-store.patch +++ /dev/null @@ -1,24 +0,0 @@ -Allow BusyBox to be invoked as "<something>-busybox". This is -necessary when it's run from the Nix store as <hash>-busybox during -stdenv bootstrap. ---- a/libbb/appletlib.c -+++ b/libbb/appletlib.c -@@ -947,7 +947,7 @@ void FAST_FUNC run_applet_no_and_exit(int applet_no, const char *name, char **ar - static NORETURN void run_applet_and_exit(const char *name, char **argv) - { - # if ENABLE_BUSYBOX -- if (is_prefixed_with(name, "busybox")) -+ if (strstr(name, "busybox") != 0) - exit(busybox_main(/*unused:*/ 0, argv)); - # endif - # if NUM_APPLETS > 0 -@@ -1045,7 +1045,7 @@ int main(int argc UNUSED_PARAM, char **argv) - - lbb_prepare("busybox" IF_FEATURE_INDIVIDUAL(, argv)); - # if !ENABLE_BUSYBOX -- if (argv[1] && is_prefixed_with(bb_basename(argv[0]), "busybox")) -+ if (argv[1] && strstr(bb_basename(argv[0]), "busybox") != 0) - argv++; - # endif - applet_name = argv[0]; - diff --git a/foundation/src/stages/stage2/bzip2/default.nix b/foundation/src/stages/stage2/bzip2/default.nix deleted file mode 100644 index e503604..0000000 --- a/foundation/src/stages/stage2/bzip2/default.nix +++ /dev/null @@ -1,98 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage2.bzip2; - - platform = config.aux.platform; - builders = config.aux.foundation.builders; - - stage1 = config.aux.foundation.stages.stage1; -in -{ - options.aux.foundation.stages.stage2.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.stage2.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-static-${cfg.version}"; - - meta = cfg.meta; - - deps.build.host = [ - stage1.gcc.package - stage1.musl.package - stage1.binutils.package - stage1.gnumake.package - stage1.gnutar.package - stage1.gzip.package - ]; - - script = '' - # Unpack - tar xf ${cfg.src} - cd bzip2-${cfg.version} - - # Build - make \ - -j $NIX_BUILD_CORES \ - CC=musl-gcc \ - CFLAGS=-static \ - bzip2 bzip2recover - - # Install - make install -j $NIX_BUILD_CORES PREFIX=$out - - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage2/coreutils/default.nix b/foundation/src/stages/stage2/coreutils/default.nix deleted file mode 100644 index 734fbcc..0000000 --- a/foundation/src/stages/stage2/coreutils/default.nix +++ /dev/null @@ -1,113 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage2.coreutils; - - platform = config.aux.platform; - builders = config.aux.foundation.builders; - - stage1 = config.aux.foundation.stages.stage1; -in -{ - options.aux.foundation.stages.stage2.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.stage2.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}" - # libstdbuf.so fails in static builds - "--enable-no-install-program=stdbuf" - "--enable-single-binary=symlinks" - "CC=musl-gcc" - "CFLAGS=-static" - ]; - in - builders.bash.build { - name = "coreutils-${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.gnutar.musl.package - stage1.gzip.package - stage1.findutils.package - stage1.diffutils.package - ]; - - script = '' - # Unpack - tar xzf ${cfg.src} - cd coreutils-${cfg.version} - - # Configure - bash ./configure ${builtins.concatStringsSep " " configureFlags} - - # Build - make -j $NIX_BUILD_CORES - - # Install - make -j $NIX_BUILD_CORES install - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage2/default.nix b/foundation/src/stages/stage2/default.nix deleted file mode 100644 index e55f9f0..0000000 --- a/foundation/src/stages/stage2/default.nix +++ /dev/null @@ -1,49 +0,0 @@ -{ lib, config }: -let - stage2 = config.aux.foundation.stages.stage2; -in -{ - includes = [ - ./bash - ./binutils - ./bzip2 - ./coreutils - ./diffutils - ./findutils - ./gawk - ./gcc - ./gnugrep - ./gnumake - ./gnupatch - ./gnused - ./gnutar - ./gzip - ./glibc - ./patchelf - ./busybox - ]; - - config = { - exports = { - packages = { - stage2-bash = stage2.bash.package; - stage2-binutils = stage2.binutils.package; - stage2-bzip2 = stage2.bzip2.package; - stage2-coreutils = stage2.coreutils.package; - stage2-diffutils = stage2.diffutils.package; - stage2-findutils = stage2.findutils.package; - stage2-gawk = stage2.gawk.package; - stage2-gcc = stage2.gcc.package; - stage2-gnugrep = stage2.gnugrep.package; - stage2-gnumake = stage2.gnumake.package; - stage2-gnupatch = stage2.gnupatch.package; - stage2-gnused = stage2.gnused.package; - stage2-gnutar = stage2.gnutar.package; - stage2-gzip = stage2.gzip.package; - stage2-glibc = stage2.glibc.package; - stage2-patchelf = stage2.patchelf.package; - stage2-busybox = stage2.busybox.package; - }; - }; - }; -} diff --git a/foundation/src/stages/stage2/diffutils/default.nix b/foundation/src/stages/stage2/diffutils/default.nix deleted file mode 100644 index 92d193b..0000000 --- a/foundation/src/stages/stage2/diffutils/default.nix +++ /dev/null @@ -1,107 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage2.diffutils; - - platform = config.aux.platform; - builders = config.aux.foundation.builders; - - stage1 = config.aux.foundation.stages.stage1; -in -{ - options.aux.foundation.stages.stage2.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.stage2.diffutils = { - version = "3.10"; - - src = builtins.fetchurl { - url = "${config.aux.mirrors.gnu}/diffutils/diffutils-${cfg.version}.tar.xz"; - sha256 = "kOXpPMck5OvhLt6A3xY0Bjx6hVaSaFkZv+YLVWyb0J4="; - }; - - package = builders.bash.build { - name = "diffutils-static-${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.gnutar.package - stage1.gawk.package - stage1.xz.package - stage1.diffutils.package - stage1.findutils.package - ]; - - script = '' - # Unpack - tar xf ${cfg.src} - cd diffutils-${cfg.version} - - # Configure - bash ./configure \ - --prefix=$out \ - --build=${platform.build} \ - --host=${platform.host} \ - CC=musl-gcc \ - CFLAGS=-static \ - ac_cv_path_PR_PROGRAM=pr - - # Build - make -j $NIX_BUILD_CORES - - # Install - make -j $NIX_BUILD_CORES install - - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage2/findutils/default.nix b/foundation/src/stages/stage2/findutils/default.nix deleted file mode 100644 index 2ee6280..0000000 --- a/foundation/src/stages/stage2/findutils/default.nix +++ /dev/null @@ -1,107 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage2.findutils; - - platform = config.aux.platform; - builders = config.aux.foundation.builders; - - stage1 = config.aux.foundation.stages.stage1; -in -{ - options.aux.foundation.stages.stage2.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.stage2.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.build { - name = "findutils-static-${cfg.version}"; - - meta = cfg.meta; - - deps.build.host = [ - stage1.gcc.package - stage1.binutils.package - stage1.musl.package - stage1.gnumake.package - stage1.gnused.package - stage1.gnugrep.package - stage1.gnutar.package - stage1.gawk.package - stage1.xz.package - stage1.diffutils.package - stage1.findutils.package - ]; - - script = '' - # Unpack - tar xf ${cfg.src} - cd findutils-${cfg.version} - - # Configure - bash ./configure \ - --prefix=$out \ - --build=${platform.build} \ - --host=${platform.host} \ - CC=musl-gcc \ - CFLAGS=-static - - # Build - make -j $NIX_BUILD_CORES - - # Install - make -j $NIX_BUILD_CORES install - rm $out/bin/updatedb - - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage2/gawk/default.nix b/foundation/src/stages/stage2/gawk/default.nix deleted file mode 100644 index 1a85835..0000000 --- a/foundation/src/stages/stage2/gawk/default.nix +++ /dev/null @@ -1,112 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage2.gawk; - - platform = config.aux.platform; - builders = config.aux.foundation.builders; - - stage1 = config.aux.foundation.stages.stage1; -in -{ - options.aux.foundation.stages.stage2.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.stage2.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-static-${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.gnutar.package - stage1.gzip.package - stage1.gawk.boot.package - stage1.diffutils.package - stage1.findutils.package - ]; - - script = '' - # Unpack - tar xf ${cfg.src} - cd gawk-${cfg.version} - - # Configure - bash ./configure \ - --prefix=$out \ - --build=${platform.build} \ - --host=${platform.host} \ - CC=musl-gcc \ - CFLAGS=-static - - # Build - make -j $NIX_BUILD_CORES - - # Install - make -j $NIX_BUILD_CORES install - rm $out/bin/gawkbug - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage2/gcc/default.nix b/foundation/src/stages/stage2/gcc/default.nix deleted file mode 100644 index 8e9b7da..0000000 --- a/foundation/src/stages/stage2/gcc/default.nix +++ /dev/null @@ -1,218 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage2.gcc; - - platform = config.aux.platform; - builders = config.aux.foundation.builders; - - stage1 = config.aux.foundation.stages.stage1; -in -{ - options.aux.foundation.stages.stage2.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.stage2.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-static-${cfg.version}"; - - meta = cfg.meta; - - deps.build.host = [ - stage1.gcc.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 \ - CFLAGS=-static \ - CXXFLAGS=-static - - # Build - make -j $NIX_BUILD_CORES - - # Install - make -j $NIX_BUILD_CORES install-strip - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage2/glibc/default.nix b/foundation/src/stages/stage2/glibc/default.nix deleted file mode 100644 index 9167d48..0000000 --- a/foundation/src/stages/stage2/glibc/default.nix +++ /dev/null @@ -1,110 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage2.glibc; - - platform = config.aux.platform; - builders = config.aux.foundation.builders; - - stage1 = config.aux.foundation.stages.stage1; - stage2 = config.aux.foundation.stages.stage2; -in -{ - options.aux.foundation.stages.stage2.glibc = { - meta = { - description = lib.options.create { - type = lib.types.string; - description = "Description for the package."; - default.value = "The GNU C Library."; - }; - - homepage = lib.options.create { - type = lib.types.string; - description = "Homepage for the package."; - default.value = "https://www.gnu.org/software/libc"; - }; - - 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.lgpl2Plus; - }; - - 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 glibc."; - }; - - 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.stage2.glibc = { - version = "2.38"; - - src = builtins.fetchurl { - url = "${config.aux.mirrors.gnu}/libc/glibc-${cfg.version}.tar.xz"; - sha256 = "+4KZiZiyspllRnvBtp0VLpwwfSzzAcnq+0VVt3DvP9I="; - }; - - package = builders.bash.build { - name = "glibc-${cfg.version}"; - meta = cfg.meta; - - deps.build.host = [ - stage1.gcc.package - stage1.binutils.package - stage1.gnumake.package - stage1.gnused.package - stage2.gnugrep.package - stage2.gawk.package - stage1.diffutils.package - stage1.findutils.package - stage1.python.package - stage1.bison.package - stage1.gnutar.package - stage1.xz.package - ]; - - script = '' - # Unpack - tar xf ${cfg.src} - cd glibc-${cfg.version} - - # Configure - mkdir build - cd build - # libstdc++.so is built against musl and fails to link - export CXX=false - bash ../configure \ - --prefix=$out \ - --build=${platform.build} \ - --host=${platform.host} \ - --with-headers=${stage1.linux-headers.package}/include - - # Build - make -j $NIX_BUILD_CORES - - # Install - make -j $NIX_BUILD_CORES INSTALL_UNCOMPRESSED=yes install - find $out/{bin,sbin,lib,libexec} -type f -exec strip --strip-unneeded {} + || true - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage2/gnugrep/default.nix b/foundation/src/stages/stage2/gnugrep/default.nix deleted file mode 100644 index b304cd6..0000000 --- a/foundation/src/stages/stage2/gnugrep/default.nix +++ /dev/null @@ -1,112 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage2.gnugrep; - - platform = config.aux.platform; - builders = config.aux.foundation.builders; - - stage1 = config.aux.foundation.stages.stage1; -in -{ - options.aux.foundation.stages.stage2.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.stage2.gnugrep = { - version = "3.11"; - - src = builtins.fetchurl { - url = "${config.aux.mirrors.gnu}/grep/grep-${cfg.version}.tar.xz"; - sha256 = "HbKu3eidDepCsW2VKPiUyNFdrk4ZC1muzHj1qVEnbqs="; - }; - - package = builders.bash.build { - name = "gnugrep-static-${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 grep-${cfg.version} - - # Configure - bash ./configure \ - --prefix=$out \ - --build=${platform.build} \ - --host=${platform.host} \ - CC=musl-gcc \ - CFLAGS=-static - - # Build - make -j $NIX_BUILD_CORES - - # Install - make -j $NIX_BUILD_CORES install - rm $out/bin/{egrep,fgrep} - - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage2/gnumake/default.nix b/foundation/src/stages/stage2/gnumake/default.nix deleted file mode 100644 index cee3398..0000000 --- a/foundation/src/stages/stage2/gnumake/default.nix +++ /dev/null @@ -1,122 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage2.gnumake; - - platform = config.aux.platform; - builders = config.aux.foundation.builders; - - stage1 = config.aux.foundation.stages.stage1; - stage2 = config.aux.foundation.stages.stage2; -in -{ - options.aux.foundation.stages.stage2.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.stage2.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-static-${cfg.version}"; - - meta = cfg.meta; - - deps.build.host = [ - stage1.gcc.package - stage1.musl.package - stage1.binutils.package - stage1.gnumake.package - stage1.gnupatch.package - stage1.gnused.package - stage1.gnugrep.package - stage1.gawk.package - stage1.diffutils.package - stage1.findutils.package - stage1.gnutar.package - stage1.gzip.package - ]; - - script = '' - # Unpack - tar xf ${cfg.src} - cd make-${cfg.version} - - # Patch - ${lib.strings.concatMapSep "\n" (file: "patch -Np1 -i ${file}") patches} - - # Configure - bash ./configure \ - --prefix=$out \ - --build=${platform.build} \ - --host=${platform.host} \ - CC=musl-gcc \ - CFLAGS=-static - - # Build - make -j $NIX_BUILD_CORES - - # Install - make -j $NIX_BUILD_CORES install - - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage2/gnumake/patches/0001-No-impure-bin-sh.patch b/foundation/src/stages/stage2/gnumake/patches/0001-No-impure-bin-sh.patch deleted file mode 100644 index 17a08a2..0000000 --- a/foundation/src/stages/stage2/gnumake/patches/0001-No-impure-bin-sh.patch +++ /dev/null @@ -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 - - diff --git a/foundation/src/stages/stage2/gnumake/patches/0002-remove-impure-dirs.patch b/foundation/src/stages/stage2/gnumake/patches/0002-remove-impure-dirs.patch deleted file mode 100644 index 08660a6..0000000 --- a/foundation/src/stages/stage2/gnumake/patches/0002-remove-impure-dirs.patch +++ /dev/null @@ -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 - - diff --git a/foundation/src/stages/stage2/gnumake/patches/0003-tinycc-support.patch b/foundation/src/stages/stage2/gnumake/patches/0003-tinycc-support.patch deleted file mode 100644 index 805f156..0000000 --- a/foundation/src/stages/stage2/gnumake/patches/0003-tinycc-support.patch +++ /dev/null @@ -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)); - diff --git a/foundation/src/stages/stage2/gnupatch/default.nix b/foundation/src/stages/stage2/gnupatch/default.nix deleted file mode 100644 index 12519d4..0000000 --- a/foundation/src/stages/stage2/gnupatch/default.nix +++ /dev/null @@ -1,106 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage2.gnupatch; - - platform = config.aux.platform; - builders = config.aux.foundation.builders; - - stage1 = config.aux.foundation.stages.stage1; -in -{ - options.aux.foundation.stages.stage2.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.stage2.gnupatch = { - version = "2.7"; - - src = builtins.fetchurl { - url = "${config.aux.mirrors.gnu}/patch/patch-${cfg.version}.tar.xz"; - sha256 = "XCyR/kFUKWISbwvhUKpPo0lIXPLtwMfqfbwky4FxEa4="; - }; - - package = builders.bash.build { - name = "gnupatch-static-${cfg.version}"; - - meta = cfg.meta; - src = cfg.src; - - 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 patch-${cfg.version} - - # Configure - bash ./configure \ - --prefix=$out \ - --build=${platform.build} \ - --host=${platform.host} \ - CC=musl-gcc \ - CFLAGS=-static - - # Build - make -j $NIX_BUILD_CORES - - # Install - make -j $NIX_BUILD_CORES install - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage2/gnused/default.nix b/foundation/src/stages/stage2/gnused/default.nix deleted file mode 100644 index d4a9942..0000000 --- a/foundation/src/stages/stage2/gnused/default.nix +++ /dev/null @@ -1,113 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage2.gnused; - - platform = config.aux.platform; - builders = config.aux.foundation.builders; - - stage1 = config.aux.foundation.stages.stage1; -in -{ - options.aux.foundation.stages.stage2.gnused = { - meta = { - description = lib.options.create { - type = lib.types.string; - description = "Description for the package."; - default.value = "GNU sed, a batch stream editor."; - }; - - homepage = lib.options.create { - type = lib.types.string; - description = "Homepage for the package."; - default.value = "https://www.gnu.org/software/sed"; - }; - - 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 = "sed"; - }; - }; - - package = lib.options.create { - type = lib.types.derivation; - description = "The package to use for gnused."; - }; - - 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.stage2.gnused = { - version = "4.9"; - - src = builtins.fetchurl { - url = "${config.aux.mirrors.gnu}/sed/sed-${cfg.version}.tar.xz"; - sha256 = "biJrcy4c1zlGStaGK9Ghq6QteYKSLaelNRljHSSXUYE="; - }; - - package = builders.bash.build { - name = "gnused-static-${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.gnutar.package - stage1.gawk.package - stage1.gzip.package - stage1.diffutils.package - stage1.findutils.package - stage1.xz.package - ]; - - script = '' - # Unpack - tar xf ${cfg.src} - cd sed-${cfg.version} - - # Configure - bash ./configure \ - --prefix=$out \ - --build=${platform.build} \ - --host=${platform.host} \ - CC=musl-gcc \ - CFLAGS=-static - - # Build - make -j $NIX_BUILD_CORES - - # Install - make -j $NIX_BUILD_CORES install - - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage2/gnutar/default.nix b/foundation/src/stages/stage2/gnutar/default.nix deleted file mode 100644 index 2423b09..0000000 --- a/foundation/src/stages/stage2/gnutar/default.nix +++ /dev/null @@ -1,111 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage2.gnutar; - - platform = config.aux.platform; - builders = config.aux.foundation.builders; - - stage1 = config.aux.foundation.stages.stage1; -in -{ - options.aux.foundation.stages.stage2.gnutar = { - meta = { - description = lib.options.create { - type = lib.types.string; - description = "Description for the package."; - default.value = "GNU implementation of the `tar` archiver"; - }; - - homepage = lib.options.create { - type = lib.types.string; - description = "Homepage for the package."; - default.value = "https://www.gnu.org/software/tar"; - }; - - 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 = "tar"; - }; - }; - - package = lib.options.create { - type = lib.types.derivation; - description = "The package to use for gnutar."; - }; - - 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.stage2.gnutar = { - version = "1.35"; - - src = builtins.fetchurl { - url = "${config.aux.mirrors.gnu}/tar/tar-${cfg.version}.tar.gz"; - sha256 = "FNVeMgY+qVJuBX+/Nfyr1TN452l4fv95GcN1WwLStX4="; - }; - - package = builders.bash.build { - name = "gnutar-static-${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.gzip.package - stage1.gnutar.package - stage1.diffutils.package - stage1.findutils.package - ]; - - script = '' - # Unpack - tar xzf ${cfg.src} - cd tar-${cfg.version} - - # Configure - bash ./configure \ - --prefix=$out \ - --build=${platform.build} \ - --host=${platform.host} \ - CC=musl-gcc \ - CFLAGS=-static - - # Build - make -j $NIX_BUILD_CORES - - # Install - make -j $NIX_BUILD_CORES install - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage2/gzip/default.nix b/foundation/src/stages/stage2/gzip/default.nix deleted file mode 100644 index dc9316a..0000000 --- a/foundation/src/stages/stage2/gzip/default.nix +++ /dev/null @@ -1,105 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage2.gzip; - - platform = config.aux.platform; - builders = config.aux.foundation.builders; - - stage1 = config.aux.foundation.stages.stage1; -in -{ - options.aux.foundation.stages.stage2.gzip = { - 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" ]; - }; - }; - - package = lib.options.create { - type = lib.types.derivation; - description = "The package to use for gzip."; - }; - - 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.stage2.gzip = { - version = "1.13"; - - src = builtins.fetchurl { - url = "${config.aux.mirrors.gnu}/gzip/gzip-${cfg.version}.tar.xz"; - sha256 = "dFTraTXbF8ZlVXbC4bD6vv04tNCTbg+H9IzQYs6RoFc="; - }; - - package = builders.bash.build { - name = "gzip-static-${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 gzip-${cfg.version} - - # Configure - bash ./configure \ - --prefix=$out \ - --build=${platform.build} \ - --host=${platform.host} \ - CC=musl-gcc \ - CFLAGS=-static - - # Build - make -j $NIX_BUILD_CORES bin_SCRIPTS= - - # Install - make -j $NIX_BUILD_CORES bin_SCRIPTS= install - - ''; - }; - }; - }; -} diff --git a/foundation/src/stages/stage2/patchelf/default.nix b/foundation/src/stages/stage2/patchelf/default.nix deleted file mode 100644 index 01868cb..0000000 --- a/foundation/src/stages/stage2/patchelf/default.nix +++ /dev/null @@ -1,106 +0,0 @@ -{ lib, config }: -let - cfg = config.aux.foundation.stages.stage2.patchelf; - - platform = config.aux.platform; - builders = config.aux.foundation.builders; - - stage1 = config.aux.foundation.stages.stage1; - stage2 = config.aux.foundation.stages.stage2; -in -{ - options.aux.foundation.stages.stage2.patchelf = { - meta = { - description = lib.options.create { - type = lib.types.string; - description = "Description for the package."; - default.value = "A small utility to modify the dynamic linker and RPATH of ELF executables."; - }; - - homepage = lib.options.create { - type = lib.types.string; - description = "Homepage for the package."; - default.value = "https://github.com/NixOS/patchelf"; - }; - - 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 patchelf."; - }; - - 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.stage2.patchelf = { - version = "0.18.0"; - - src = builtins.fetchurl { - url = "https://github.com/NixOS/patchelf/releases/download/${cfg.version}/patchelf-${cfg.version}.tar.gz"; - sha256 = "ZN4Q5Ma4uDedt+h/WAMPM26nR8BRXzgRMugQ2/hKhuc="; - }; - - package = builders.bash.build { - name = "patchelf-static-${cfg.version}"; - meta = cfg.meta; - - deps.build.host = [ - stage1.gcc.package - stage1.musl.package - stage1.binutils.package - stage1.gnumake.package - stage1.gnused.package - stage2.gnugrep.package - stage2.gawk.package - stage1.diffutils.package - stage1.findutils.package - stage1.gnutar.package - stage1.gzip.package - ]; - - script = '' - # Unpack - tar xf ${cfg.src} - cd patchelf-${cfg.version} - - # Configure - bash ./configure \ - --prefix=$out \ - --build=${platform.build} \ - --host=${platform.host} \ - CC=musl-gcc \ - CXXFLAGS=-static - - # Build - make -j $NIX_BUILD_CORES - - # Install - make -j $NIX_BUILD_CORES install-strip - - ''; - }; - }; - }; -} diff --git a/foundation/src/system/default.nix b/foundation/src/system/default.nix deleted file mode 100644 index d30880c..0000000 --- a/foundation/src/system/default.nix +++ /dev/null @@ -1,13 +0,0 @@ -{ lib }: -{ - options.aux = { - system = lib.options.create { - type = lib.types.string; - default.value = "i686-linux"; - description = '' - The system to build packages for. This value can be provided as either - `config.aux.system` or by setting the `system` argument for modules. - ''; - }; - }; -} diff --git a/tidepool/default.nix b/tidepool/default.nix index d9dcc28..1671f00 100644 --- a/tidepool/default.nix +++ b/tidepool/default.nix @@ -1,9 +1,10 @@ -{ - foundation ? import ./../foundation { system = "i686-linux"; }, -}: let - pins = import ./npins; - lib = import pins.lib; + pins = import ./npins; + + lib = import pins.lib; + foundation = import pins.foundation { + system = "i686-linux"; + }; modules = import ./src/modules.nix; diff --git a/tidepool/flake.lock b/tidepool/flake.lock index e0cb1bb..5999137 100644 --- a/tidepool/flake.lock +++ b/tidepool/flake.lock @@ -1,26 +1,6 @@ { "nodes": { - "foundation": { - "locked": { - "dir": "foundation", - "dirtyRev": "c30f94972c84c5c758b705e4363f624e75560916-dirty", - "dirtyShortRev": "c30f949-dirty", - "lastModified": 1742785479, - "narHash": "sha256-jYjvytd4Ut1z3izUuGCfq2KKjHLgWYvhMtPtyRh4FR8=", - "type": "git", - "url": "file:../" - }, - "original": { - "dir": "foundation", - "type": "git", - "url": "file:../" - } - }, - "root": { - "inputs": { - "foundation": "foundation" - } - } + "root": {} }, "root": "root", "version": 7 diff --git a/tidepool/flake.nix b/tidepool/flake.nix index 0b009ef..6ec538b 100644 --- a/tidepool/flake.nix +++ b/tidepool/flake.nix @@ -1,16 +1,10 @@ { - inputs = { - foundation = { - url = "git+file:../?dir=foundation"; - }; - }; + inputs = { }; outputs = inputs: let - exports = import ./default.nix { - foundation = inputs.foundation.packages.i686-linux; - }; + exports = import ./default.nix; in exports; } diff --git a/tidepool/npins/sources.json b/tidepool/npins/sources.json index 99ec39b..02b9c7b 100644 --- a/tidepool/npins/sources.json +++ b/tidepool/npins/sources.json @@ -1,5 +1,16 @@ { "pins": { + "foundation": { + "type": "Git", + "repository": { + "type": "Git", + "url": "git+ssh://forgejo@git.auxolotl.org/auxolotl/foundation.git" + }, + "branch": "main", + "revision": "47707c015ddd2f3b2a75ec83c582819dbef83ef5", + "url": null, + "hash": "0fvs7ymwnyrssng4mwiyig5w8dkjclxw222hcx0lrs8wpa0az3i5" + }, "lib": { "type": "Git", "repository": {