From 5d6cff8d64affc17f5f20f26479a3daa98cf734f Mon Sep 17 00:00:00 2001 From: dish Date: Fri, 29 Aug 2025 20:51:37 -0400 Subject: [PATCH 1/8] minimal-bootstrap.stage0-posix: 1.6.0 -> 1.9.1 Gives us smaller bootstrap tarballs, better M2-Planet, and more. --- .../stage0-posix/bootstrap-sources.nix | 4 +-- .../minimal-bootstrap/stage0-posix/hex0.nix | 10 +++---- .../stage0-posix/make-bootstrap-sources.nix | 9 ------- .../stage0-posix/mescc-tools-boot.nix | 27 ++++++++++++++++++- .../stage0-posix/mescc-tools-extra/build.kaem | 4 ++- .../stage0-posix/mescc-tools/build.kaem | 15 ++++++++++- .../stage0-posix/mescc-tools/default.nix | 3 +++ .../stage0-posix/platforms.nix | 2 +- 8 files changed, 54 insertions(+), 20 deletions(-) diff --git a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/bootstrap-sources.nix b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/bootstrap-sources.nix index dcf9b50da37d..87f4cced81e3 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/bootstrap-sources.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/bootstrap-sources.nix @@ -4,10 +4,10 @@ rec { name = "stage0-posix-${version}-source"; - version = "1.6.0"; + version = "1.9.1"; rev = "Release_${version}"; outputHashAlgo = "sha256"; - outputHash = "sha256-epUaShjKiAd749ICvc6rS6WhUkS8R4heKuPdwUjEtsQ="; + outputHash = "sha256-UNoyb2teqH26VM7YoOcazyqZ0AlDae045aWc31ZHFdw="; /* Since `make-minimal-bootstrap-sources` requires nixpkgs and nix it diff --git a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/hex0.nix b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/hex0.nix index 661b375b8d9a..d6d509851d4d 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/hex0.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/hex0.nix @@ -12,16 +12,16 @@ let hash = { "AArch64" = "sha256-XTPsoKeI6wTZAF0UwEJPzuHelWOJe//wXg4HYO0dEJo="; - "AMD64" = "sha256-RCgK9oZRDQUiWLVkcIBSR2HeoB+Bh0czthrpjFEkCaY="; - "x86" = "sha256-QU3RPGy51W7M2xnfFY1IqruKzusrSLU+L190ztN6JW8="; + "AMD64" = "sha256-DCzZduYrix9yOeJoem/Jhz/WDzAss7UWwjZbkXJq6Ms="; + "x86" = "sha256-DFmSpy4EYoKBSuPQRqtTsUfIUjlg794PnMrEg5stOFY="; } .${stage0Arch} or (throw "Unsupported system: ${hostPlatform.system}"); - # Pinned from https://github.com/oriansj/stage0-posix/commit/3189b5f325b7ef8b88e3edec7c1cde4fce73c76c - # This 256 byte seed is the only pre-compiled binary in the bootstrap chain. + # Pinned from https://github.com/oriansj/stage0-posix/commit/45d90f5955b6907dc6cdea9ebafce558359edcd3 + # This 181 byte seed is the only pre-compiled binary in the bootstrap chain. hex0-seed = import { name = "hex0-seed"; - url = "https://github.com/oriansj/bootstrap-seeds/raw/b1263ff14a17835f4d12539226208c426ced4fba/POSIX/${stage0Arch}/hex0-seed"; + url = "https://github.com/oriansj/bootstrap-seeds/raw/cedec6b8066d1db229b6c77d42d120a23c6980ed/POSIX/${stage0Arch}/hex0-seed"; executable = true; inherit hash; }; diff --git a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/make-bootstrap-sources.nix b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/make-bootstrap-sources.nix index 02d128fa1258..89c6ca17e3f3 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/make-bootstrap-sources.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/make-bootstrap-sources.nix @@ -40,15 +40,6 @@ fetchFromGitHub { $out/M2-Planet/M2libc \ $out/mescc-tools/M2libc \ $out/mescc-tools-extra/M2libc - - # aarch64: syscall: mkdir -> mkdirat - # https://github.com/oriansj/M2libc/pull/17 - patch -Np1 -d $out/M2libc -i ${ - (fetchpatch { - url = "https://github.com/oriansj/M2libc/commit/ff7c3023b3ab6cfcffc5364620b25f8d0279e96b.patch"; - hash = "sha256-QAKddv4TixIQHpFa9SVu9fAkeKbzhQaxjaWzW2yJy7A="; - }) - } ''; meta = { diff --git a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools-boot.nix b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools-boot.nix index 2c968c465cc1..1c4360d67025 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools-boot.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools-boot.nix @@ -159,6 +159,7 @@ rec { "${src}/M2-Planet/cc_reader.c" "${src}/M2-Planet/cc_strings.c" "${src}/M2-Planet/cc_types.c" + "${src}/M2-Planet/cc_emit.c" "${src}/M2-Planet/cc_core.c" "${src}/M2-Planet/cc_macro.c" "${src}/M2-Planet/cc.c" @@ -298,6 +299,8 @@ rec { "-f" "${m2libc}/stddef.h" "-f" + "${m2libc}/sys/utsname.h" + "-f" "${m2libc}/${m2libcArch}/linux/unistd.c" "-f" "${m2libc}/${m2libcArch}/linux/fcntl.c" @@ -306,8 +309,12 @@ rec { "-f" "${m2libc}/${m2libcArch}/linux/sys/stat.c" "-f" + "${m2libc}/ctype.c" + "-f" "${m2libc}/stdlib.c" "-f" + "${m2libc}/stdarg.h" + "-f" "${m2libc}/stdio.h" "-f" "${m2libc}/stdio.c" @@ -379,14 +386,20 @@ rec { "-f" "${m2libc}/stddef.h" "-f" + "${m2libc}/sys/utsname.h" + "-f" "${m2libc}/${m2libcArch}/linux/fcntl.c" "-f" "${m2libc}/fcntl.c" "-f" "${m2libc}/${m2libcArch}/linux/unistd.c" "-f" + "${m2libc}/stdarg.h" + "-f" "${m2libc}/string.c" "-f" + "${m2libc}/ctype.c" + "-f" "${m2libc}/stdlib.c" "-f" "${m2libc}/stdio.h" @@ -456,6 +469,8 @@ rec { "-f" "${m2libc}/stddef.h" "-f" + "${m2libc}/sys/utsname.h" + "-f" "${m2libc}/${m2libcArch}/linux/unistd.c" "-f" "${m2libc}/${m2libcArch}/linux/fcntl.c" @@ -464,8 +479,12 @@ rec { "-f" "${m2libc}/${m2libcArch}/linux/sys/stat.c" "-f" + "${m2libc}/ctype.c" + "-f" "${m2libc}/stdlib.c" "-f" + "${m2libc}/stdarg.h" + "-f" "${m2libc}/stdio.h" "-f" "${m2libc}/stdio.c" @@ -537,7 +556,7 @@ rec { "-f" "${m2libc}/stddef.h" "-f" - "${m2libc}/string.c" + "${m2libc}/sys/utsname.h" "-f" "${m2libc}/${m2libcArch}/linux/unistd.c" "-f" @@ -545,8 +564,14 @@ rec { "-f" "${m2libc}/fcntl.c" "-f" + "${m2libc}/ctype.c" + "-f" "${m2libc}/stdlib.c" "-f" + "${m2libc}/string.c" + "-f" + "${m2libc}/stdarg.h" + "-f" "${m2libc}/stdio.h" "-f" "${m2libc}/stdio.c" diff --git a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools-extra/build.kaem b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools-extra/build.kaem index fb27eccab830..42d43dff9486 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools-extra/build.kaem +++ b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools-extra/build.kaem @@ -1,5 +1,5 @@ # 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 +# https://github.com/oriansj/mescc-tools-extra/blob/56e6b8df3e95f4bc04f8b420a4cd8c82c70b9efa/mescc-tools-extra.kaem # - Paths to build inputs have been changed for nix # - Added additional step to create $out directory @@ -32,8 +32,10 @@ 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 unxz.c -o ${out}/bin/unxz 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 +CC wrap.c -o ${out}/bin/wrap diff --git a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools/build.kaem b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools/build.kaem index 128ff360fd2c..0a374c1a0674 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools/build.kaem +++ b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools/build.kaem @@ -1,5 +1,5 @@ # 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 +# https://github.com/oriansj/stage0-posix-x86/blob/3b9c2bb6d4155e4f2e5f642b5e0f59255dfc5934/mescc-tools-full-kaem.kaem # - Paths to build inputs have been changed for nix # Mes --- Maxwell Equations of Software @@ -51,9 +51,12 @@ ${M2} --architecture ${m2libcArch} \ -f ${m2libc}/stddef.h \ -f ${m2libc}/${m2libcArch}/linux/fcntl.c \ -f ${m2libc}/fcntl.c \ + -f ${m2libc}/sys/utsname.h \ -f ${m2libc}/${m2libcArch}/linux/unistd.c \ -f ${m2libc}/${m2libcArch}/linux/sys/stat.c \ + -f ${m2libc}/ctype.c \ -f ${m2libc}/stdlib.c \ + -f ${m2libc}/stdarg.h \ -f ${m2libc}/stdio.h \ -f ${m2libc}/stdio.c \ -f ${m2libc}/string.c \ @@ -95,8 +98,11 @@ ${M2} --architecture ${m2libcArch} \ -f ${m2libc}/stddef.h \ -f ${m2libc}/${m2libcArch}/linux/fcntl.c \ -f ${m2libc}/fcntl.c \ + -f ${m2libc}/sys/utsname.h \ -f ${m2libc}/${m2libcArch}/linux/unistd.c \ + -f ${m2libc}/ctype.c \ -f ${m2libc}/stdlib.c \ + -f ${m2libc}/stdarg.h \ -f ${m2libc}/stdio.h \ -f ${m2libc}/stdio.c \ -f ${m2libc}/bootstrappable.c \ @@ -133,10 +139,13 @@ ${hex2} --architecture ${m2libcArch} \ ${M2} --architecture ${m2libcArch} \ -f ${m2libc}/sys/types.h \ -f ${m2libc}/stddef.h \ + -f ${m2libc}/sys/utsname.h \ -f ${m2libc}/${m2libcArch}/linux/unistd.c \ -f ${m2libc}/${m2libcArch}/linux/fcntl.c \ -f ${m2libc}/fcntl.c \ + -f ${m2libc}/ctype.c \ -f ${m2libc}/stdlib.c \ + -f ${m2libc}/stdarg.h \ -f ${m2libc}/stdio.h \ -f ${m2libc}/stdio.c \ -f ${m2libc}/bootstrappable.c \ @@ -168,10 +177,13 @@ ${hex2} --architecture ${m2libcArch} \ ${M2} --architecture ${m2libcArch} \ -f ${m2libc}/sys/types.h \ -f ${m2libc}/stddef.h \ + -f ${m2libc}/sys/utsname.h \ -f ${m2libc}/${m2libcArch}/linux/unistd.c \ -f ${m2libc}/${m2libcArch}/linux/fcntl.c \ -f ${m2libc}/fcntl.c \ + -f ${m2libc}/ctype.c \ -f ${m2libc}/stdlib.c \ + -f ${m2libc}/stdarg.h \ -f ${m2libc}/stdio.h \ -f ${m2libc}/stdio.c \ -f ${m2libc}/bootstrappable.c \ @@ -180,6 +192,7 @@ ${M2} --architecture ${m2libcArch} \ -f ${src}/M2-Planet/cc_reader.c \ -f ${src}/M2-Planet/cc_strings.c \ -f ${src}/M2-Planet/cc_types.c \ + -f ${src}/M2-Planet/cc_emit.c \ -f ${src}/M2-Planet/cc_core.c \ -f ${src}/M2-Planet/cc_macro.c \ -f ${src}/M2-Planet/cc.c \ diff --git a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools/default.nix index b1027a29a5a4..3ba72657cdb0 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/mescc-tools/default.nix @@ -33,11 +33,14 @@ let ''${M2} --architecture ${m2libcArch} \ -f ''${m2libc}/sys/types.h \ -f ''${m2libc}/stddef.h \ + -f ''${m2libc}/sys/utsname.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}/ctype.c \ -f ''${m2libc}/stdlib.c \ + -f ''${m2libc}/stdarg.h \ -f ''${m2libc}/stdio.h \ -f ''${m2libc}/stdio.c \ -f ''${m2libc}/string.c \ diff --git a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/platforms.nix b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/platforms.nix index fb96f91fa917..15a84ad5d568 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/platforms.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/stage0-posix/platforms.nix @@ -26,7 +26,7 @@ rec { # Passed to M2-Mesoplanet as --operating-system m2libcOS = - if hostPlatform.isLinux then "linux" else throw "Unsupported system: ${hostPlatform.system}"; + if hostPlatform.isLinux then "Linux" else throw "Unsupported system: ${hostPlatform.system}"; baseAddress = { From 873fec39eb14a010cedc475b2d69655c2ed6b724 Mon Sep 17 00:00:00 2001 From: dish Date: Sat, 30 Aug 2025 01:27:43 -0400 Subject: [PATCH 2/8] minimal-bootstrap.mes.nyacc: 1.00.2 -> 2.02.2; minimal-bootstrap.mes: 0.25 -> 0.27.1 --- .../linux/minimal-bootstrap/mes/default.nix | 17 +- .../linux/minimal-bootstrap/mes/nyacc.nix | 8 +- .../linux/minimal-bootstrap/mes/sources.nix | 192 +++++++++++++----- 3 files changed, 158 insertions(+), 59 deletions(-) diff --git a/pkgs/os-specific/linux/minimal-bootstrap/mes/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/mes/default.nix index f704204f365d..fe507e985aa7 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/mes/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/mes/default.nix @@ -13,11 +13,11 @@ let pname = "mes"; - version = "0.25"; + version = "0.27.1"; src = fetchurl { url = "mirror://gnu/mes/mes-${version}.tar.gz"; - hash = "sha256-MlJQs1Z+2SA7pwFhyDWvAQeec+vtl7S1u3fKUAuCiUA="; + hash = "sha256-GDpA6kfqSfih470bnRLmdjdNZNY7x557wa59Zz398l0="; }; nyacc = callPackage ./nyacc.nix { inherit nyacc; }; @@ -28,6 +28,7 @@ let ''; sources = (import ./sources.nix).x86.linux.mescc; + inherit (sources) libc_mini_SOURCES libmescc_SOURCES @@ -43,7 +44,9 @@ let homepage = "https://www.gnu.org/software/mes"; license = lib.licenses.gpl3Plus; teams = [ lib.teams.minimal-bootstrap ]; - platforms = [ "i686-linux" ]; + platforms = [ + "i686-linux" + ]; }; srcPost = @@ -69,8 +72,9 @@ let 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 + cp include/linux/x86/signal.h include/arch/signal.h + cp include/linux/x86/syscall.h include/arch/syscall.h # Remove pregenerated files rm mes/module/mes/psyntax.pp mes/module/mes/psyntax.pp.header @@ -81,9 +85,9 @@ let # Remove environment impurities __GUILE_LOAD_PATH="\"''${MES_PREFIX}/mes/module:''${MES_PREFIX}/module:${nyacc.guilePath}\"" - boot0_scm=mes/module/mes/boot-0.scm + guile_module_scm=mes/module/mes/guile-module.mes 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_module_scm} --output ''${guile_module_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 @@ -127,7 +131,6 @@ let "-e" "main" "${srcPost.bin}/bin/mescc.scm" - "--" "-D" "HAVE_CONFIG_H=1" "-I" diff --git a/pkgs/os-specific/linux/minimal-bootstrap/mes/nyacc.nix b/pkgs/os-specific/linux/minimal-bootstrap/mes/nyacc.nix index 6332fc15f257..69ce93995b82 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/mes/nyacc.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/mes/nyacc.nix @@ -7,13 +7,13 @@ let pname = "nyacc"; # NYACC is a tightly coupled dependency of mes. This version is known to work - # with mes 0.25. - # https://git.savannah.gnu.org/cgit/mes.git/tree/INSTALL?h=v0.25#n31 - version = "1.00.2"; + # with mes 0.27.1. + # https://git.savannah.gnu.org/cgit/mes.git/tree/INSTALL?h=v0.27.1#n31 + version = "2.02.2"; src = fetchurl { url = "mirror://savannah/nyacc/nyacc-${version}.tar.gz"; - sha256 = "065ksalfllbdrzl12dz9d9dcxrv97wqxblslngsc6kajvnvlyvpk"; + hash = "sha256-aRpTcKU6c6Lc+onZL4EbPlZIOmf5IZnNAGGUTQRLAgU="; }; in kaem.runCommand "${pname}-${version}" diff --git a/pkgs/os-specific/linux/minimal-bootstrap/mes/sources.nix b/pkgs/os-specific/linux/minimal-bootstrap/mes/sources.nix index 4b5d3b336575..c9220a69c67c 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/mes/sources.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/mes/sources.nix @@ -55,6 +55,9 @@ "lib/posix/write.c" "lib/stdlib/atoi.c" "lib/linux/lseek.c" + "lib/dirent/__getdirentries.c" + "lib/dirent/closedir.c" + "lib/dirent/opendir.c" "lib/mes/__assert_fail.c" "lib/mes/__buffered_read.c" "lib/mes/__mes_debug.c" @@ -74,6 +77,7 @@ "lib/stdio/putc.c" "lib/stdio/putchar.c" "lib/stdio/ungetc.c" + "lib/stdlib/calloc.c" "lib/stdlib/free.c" "lib/stdlib/realloc.c" "lib/string/memchr.c" @@ -87,21 +91,39 @@ "lib/posix/raise.c" "lib/linux/access.c" "lib/linux/brk.c" + "lib/linux/chdir.c" "lib/linux/chmod.c" "lib/linux/clock_gettime.c" + "lib/linux/close.c" "lib/linux/dup.c" "lib/linux/dup2.c" "lib/linux/execve.c" + "lib/linux/fcntl.c" "lib/linux/fork.c" + "lib/linux/fstat.c" "lib/linux/fsync.c" "lib/linux/_getcwd.c" + "lib/linux/getdents.c" "lib/linux/gettimeofday.c" "lib/linux/ioctl3.c" + "lib/linux/link.c" + "lib/linux/lstat.c" "lib/linux/_open3.c" "lib/linux/malloc.c" + "lib/linux/mkdir.c" + "lib/linux/nanosleep.c" + "lib/linux/pipe.c" "lib/linux/_read.c" + "lib/linux/readdir.c" + "lib/linux/rename.c" + "lib/linux/rmdir.c" + "lib/linux/stat.c" + "lib/linux/symlink.c" "lib/linux/time.c" + "lib/linux/umask.c" + "lib/linux/uname.c" "lib/linux/unlink.c" + "lib/linux/utimensat.c" "lib/linux/wait4.c" "lib/linux/waitpid.c" "lib/linux/x86-mes-mescc/syscall.c" @@ -142,6 +164,9 @@ "lib/posix/write.c" "lib/stdlib/atoi.c" "lib/linux/lseek.c" + "lib/dirent/__getdirentries.c" + "lib/dirent/closedir.c" + "lib/dirent/opendir.c" "lib/mes/__assert_fail.c" "lib/mes/__buffered_read.c" "lib/mes/__mes_debug.c" @@ -161,6 +186,7 @@ "lib/stdio/putc.c" "lib/stdio/putchar.c" "lib/stdio/ungetc.c" + "lib/stdlib/calloc.c" "lib/stdlib/free.c" "lib/stdlib/realloc.c" "lib/string/memchr.c" @@ -174,21 +200,39 @@ "lib/posix/raise.c" "lib/linux/access.c" "lib/linux/brk.c" + "lib/linux/chdir.c" "lib/linux/chmod.c" "lib/linux/clock_gettime.c" + "lib/linux/close.c" "lib/linux/dup.c" "lib/linux/dup2.c" "lib/linux/execve.c" + "lib/linux/fcntl.c" "lib/linux/fork.c" + "lib/linux/fstat.c" "lib/linux/fsync.c" "lib/linux/_getcwd.c" + "lib/linux/getdents.c" "lib/linux/gettimeofday.c" "lib/linux/ioctl3.c" + "lib/linux/link.c" + "lib/linux/lstat.c" "lib/linux/_open3.c" "lib/linux/malloc.c" + "lib/linux/mkdir.c" + "lib/linux/nanosleep.c" + "lib/linux/pipe.c" "lib/linux/_read.c" + "lib/linux/readdir.c" + "lib/linux/rename.c" + "lib/linux/rmdir.c" + "lib/linux/stat.c" + "lib/linux/symlink.c" "lib/linux/time.c" + "lib/linux/umask.c" + "lib/linux/uname.c" "lib/linux/unlink.c" + "lib/linux/utimensat.c" "lib/linux/wait4.c" "lib/linux/waitpid.c" "lib/linux/x86-mes-mescc/syscall.c" @@ -222,7 +266,6 @@ "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" @@ -243,11 +286,10 @@ "lib/stub/ldexp.c" "lib/stub/mprotect.c" "lib/stub/localtime.c" + "lib/stub/putenv.c" + "lib/stub/realpath.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_SOURCES = [ "lib/mes/__init_io.c" @@ -283,6 +325,9 @@ "lib/posix/write.c" "lib/stdlib/atoi.c" "lib/linux/lseek.c" + "lib/dirent/__getdirentries.c" + "lib/dirent/closedir.c" + "lib/dirent/opendir.c" "lib/mes/__assert_fail.c" "lib/mes/__buffered_read.c" "lib/mes/__mes_debug.c" @@ -302,6 +347,7 @@ "lib/stdio/putc.c" "lib/stdio/putchar.c" "lib/stdio/ungetc.c" + "lib/stdlib/calloc.c" "lib/stdlib/free.c" "lib/stdlib/realloc.c" "lib/string/memchr.c" @@ -315,21 +361,39 @@ "lib/posix/raise.c" "lib/linux/access.c" "lib/linux/brk.c" + "lib/linux/chdir.c" "lib/linux/chmod.c" "lib/linux/clock_gettime.c" + "lib/linux/close.c" "lib/linux/dup.c" "lib/linux/dup2.c" "lib/linux/execve.c" + "lib/linux/fcntl.c" "lib/linux/fork.c" + "lib/linux/fstat.c" "lib/linux/fsync.c" "lib/linux/_getcwd.c" + "lib/linux/getdents.c" "lib/linux/gettimeofday.c" "lib/linux/ioctl3.c" + "lib/linux/link.c" + "lib/linux/lstat.c" "lib/linux/_open3.c" "lib/linux/malloc.c" + "lib/linux/mkdir.c" + "lib/linux/nanosleep.c" + "lib/linux/pipe.c" "lib/linux/_read.c" + "lib/linux/readdir.c" + "lib/linux/rename.c" + "lib/linux/rmdir.c" + "lib/linux/stat.c" + "lib/linux/symlink.c" "lib/linux/time.c" + "lib/linux/umask.c" + "lib/linux/uname.c" "lib/linux/unlink.c" + "lib/linux/utimensat.c" "lib/linux/wait4.c" "lib/linux/waitpid.c" "lib/linux/x86-mes-mescc/syscall.c" @@ -363,7 +427,6 @@ "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" @@ -384,11 +447,10 @@ "lib/stub/ldexp.c" "lib/stub/mprotect.c" "lib/stub/localtime.c" + "lib/stub/putenv.c" + "lib/stub/realpath.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" @@ -396,10 +458,6 @@ "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" @@ -408,6 +466,7 @@ "lib/posix/execl.c" "lib/posix/execlp.c" "lib/posix/mktemp.c" + "lib/posix/pathconf.c" "lib/posix/sbrk.c" "lib/posix/sleep.c" "lib/posix/unsetenv.c" @@ -479,12 +538,7 @@ "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" @@ -492,20 +546,13 @@ "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_SOURCES = [ "src/builtins.c" @@ -526,6 +573,7 @@ "src/string.c" "src/struct.c" "src/symbol.c" + "src/variable.c" "src/vector.c" ]; }; @@ -583,6 +631,9 @@ "lib/posix/write.c" "lib/stdlib/atoi.c" "lib/linux/lseek.c" + "lib/dirent/__getdirentries.c" + "lib/dirent/closedir.c" + "lib/dirent/opendir.c" "lib/mes/__assert_fail.c" "lib/mes/__buffered_read.c" "lib/mes/__mes_debug.c" @@ -602,6 +653,7 @@ "lib/stdio/putc.c" "lib/stdio/putchar.c" "lib/stdio/ungetc.c" + "lib/stdlib/calloc.c" "lib/stdlib/free.c" "lib/stdlib/realloc.c" "lib/string/memchr.c" @@ -615,21 +667,39 @@ "lib/posix/raise.c" "lib/linux/access.c" "lib/linux/brk.c" + "lib/linux/chdir.c" "lib/linux/chmod.c" "lib/linux/clock_gettime.c" + "lib/linux/close.c" "lib/linux/dup.c" "lib/linux/dup2.c" "lib/linux/execve.c" + "lib/linux/fcntl.c" "lib/linux/fork.c" + "lib/linux/fstat.c" "lib/linux/fsync.c" "lib/linux/_getcwd.c" + "lib/linux/getdents.c" "lib/linux/gettimeofday.c" "lib/linux/ioctl3.c" + "lib/linux/link.c" + "lib/linux/lstat.c" "lib/linux/_open3.c" "lib/linux/malloc.c" + "lib/linux/mkdir.c" + "lib/linux/nanosleep.c" + "lib/linux/pipe.c" "lib/linux/_read.c" + "lib/linux/readdir.c" + "lib/linux/rename.c" + "lib/linux/rmdir.c" + "lib/linux/stat.c" + "lib/linux/symlink.c" "lib/linux/time.c" + "lib/linux/umask.c" + "lib/linux/uname.c" "lib/linux/unlink.c" + "lib/linux/utimensat.c" "lib/linux/wait4.c" "lib/linux/waitpid.c" "lib/linux/x86-mes-gcc/syscall.c" @@ -670,6 +740,9 @@ "lib/posix/write.c" "lib/stdlib/atoi.c" "lib/linux/lseek.c" + "lib/dirent/__getdirentries.c" + "lib/dirent/closedir.c" + "lib/dirent/opendir.c" "lib/mes/__assert_fail.c" "lib/mes/__buffered_read.c" "lib/mes/__mes_debug.c" @@ -689,6 +762,7 @@ "lib/stdio/putc.c" "lib/stdio/putchar.c" "lib/stdio/ungetc.c" + "lib/stdlib/calloc.c" "lib/stdlib/free.c" "lib/stdlib/realloc.c" "lib/string/memchr.c" @@ -702,21 +776,39 @@ "lib/posix/raise.c" "lib/linux/access.c" "lib/linux/brk.c" + "lib/linux/chdir.c" "lib/linux/chmod.c" "lib/linux/clock_gettime.c" + "lib/linux/close.c" "lib/linux/dup.c" "lib/linux/dup2.c" "lib/linux/execve.c" + "lib/linux/fcntl.c" "lib/linux/fork.c" + "lib/linux/fstat.c" "lib/linux/fsync.c" "lib/linux/_getcwd.c" + "lib/linux/getdents.c" "lib/linux/gettimeofday.c" "lib/linux/ioctl3.c" + "lib/linux/link.c" + "lib/linux/lstat.c" "lib/linux/_open3.c" "lib/linux/malloc.c" + "lib/linux/mkdir.c" + "lib/linux/nanosleep.c" + "lib/linux/pipe.c" "lib/linux/_read.c" + "lib/linux/readdir.c" + "lib/linux/rename.c" + "lib/linux/rmdir.c" + "lib/linux/stat.c" + "lib/linux/symlink.c" "lib/linux/time.c" + "lib/linux/umask.c" + "lib/linux/uname.c" "lib/linux/unlink.c" + "lib/linux/utimensat.c" "lib/linux/wait4.c" "lib/linux/waitpid.c" "lib/linux/x86-mes-gcc/syscall.c" @@ -750,7 +842,6 @@ "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" @@ -771,11 +862,10 @@ "lib/stub/ldexp.c" "lib/stub/mprotect.c" "lib/stub/localtime.c" + "lib/stub/putenv.c" + "lib/stub/realpath.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_SOURCES = [ "lib/mes/__init_io.c" @@ -811,6 +901,9 @@ "lib/posix/write.c" "lib/stdlib/atoi.c" "lib/linux/lseek.c" + "lib/dirent/__getdirentries.c" + "lib/dirent/closedir.c" + "lib/dirent/opendir.c" "lib/mes/__assert_fail.c" "lib/mes/__buffered_read.c" "lib/mes/__mes_debug.c" @@ -830,6 +923,7 @@ "lib/stdio/putc.c" "lib/stdio/putchar.c" "lib/stdio/ungetc.c" + "lib/stdlib/calloc.c" "lib/stdlib/free.c" "lib/stdlib/realloc.c" "lib/string/memchr.c" @@ -843,21 +937,39 @@ "lib/posix/raise.c" "lib/linux/access.c" "lib/linux/brk.c" + "lib/linux/chdir.c" "lib/linux/chmod.c" "lib/linux/clock_gettime.c" + "lib/linux/close.c" "lib/linux/dup.c" "lib/linux/dup2.c" "lib/linux/execve.c" + "lib/linux/fcntl.c" "lib/linux/fork.c" + "lib/linux/fstat.c" "lib/linux/fsync.c" "lib/linux/_getcwd.c" + "lib/linux/getdents.c" "lib/linux/gettimeofday.c" "lib/linux/ioctl3.c" + "lib/linux/link.c" + "lib/linux/lstat.c" "lib/linux/_open3.c" "lib/linux/malloc.c" + "lib/linux/mkdir.c" + "lib/linux/nanosleep.c" + "lib/linux/pipe.c" "lib/linux/_read.c" + "lib/linux/readdir.c" + "lib/linux/rename.c" + "lib/linux/rmdir.c" + "lib/linux/stat.c" + "lib/linux/symlink.c" "lib/linux/time.c" + "lib/linux/umask.c" + "lib/linux/uname.c" "lib/linux/unlink.c" + "lib/linux/utimensat.c" "lib/linux/wait4.c" "lib/linux/waitpid.c" "lib/linux/x86-mes-gcc/syscall.c" @@ -891,7 +1003,6 @@ "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" @@ -912,11 +1023,10 @@ "lib/stub/ldexp.c" "lib/stub/mprotect.c" "lib/stub/localtime.c" + "lib/stub/putenv.c" + "lib/stub/realpath.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" @@ -924,10 +1034,6 @@ "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" @@ -936,6 +1042,7 @@ "lib/posix/execl.c" "lib/posix/execlp.c" "lib/posix/mktemp.c" + "lib/posix/pathconf.c" "lib/posix/sbrk.c" "lib/posix/sleep.c" "lib/posix/unsetenv.c" @@ -1007,12 +1114,7 @@ "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" @@ -1020,20 +1122,13 @@ "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_SOURCES = [ "src/builtins.c" @@ -1054,6 +1149,7 @@ "src/string.c" "src/struct.c" "src/symbol.c" + "src/variable.c" "src/vector.c" ]; }; From e1b215735eda20100e22050393daae56a1934e9a Mon Sep 17 00:00:00 2001 From: dish Date: Sat, 30 Aug 2025 01:28:18 -0400 Subject: [PATCH 3/8] minimal-bootstrap.bash_2_05: fix building with tcc with newer patches --- pkgs/os-specific/linux/minimal-bootstrap/bash/2.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/os-specific/linux/minimal-bootstrap/bash/2.nix b/pkgs/os-specific/linux/minimal-bootstrap/bash/2.nix index 037c3254edc7..b569dde98187 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/bash/2.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/bash/2.nix @@ -20,8 +20,8 @@ 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"; + # See https://github.com/fosslinux/live-bootstrap/blob/c0494d9af84b9e8c3e76e34c6e898978013a3b39/steps/bash-2.05b/pass1.kaem + liveBootstrap = "https://github.com/fosslinux/live-bootstrap/raw/c0494d9af84b9e8c3e76e34c6e898978013a3b39/steps/bash-2.05b"; main_mk = fetchurl { url = "${liveBootstrap}/mk/main.mk"; @@ -30,7 +30,7 @@ let common_mk = fetchurl { url = "${liveBootstrap}/mk/common.mk"; - sha256 = "09rigxxf85p2ybnq248sai1gdx95yykc8jmwi4yjx389zh09mcr8"; + sha256 = "sha256-9BzUJPz6Vx+r69i2SQlqRTH9ihgLaUp1JSYGlTbWWu8="; }; builtins_mk = fetchurl { From f401ff60036a6c8e2be5d539dc84b0fbd4157316 Mon Sep 17 00:00:00 2001 From: dish Date: Sun, 31 Aug 2025 11:48:13 -0400 Subject: [PATCH 4/8] minimal-bootstrap.tinycc-bootstrappable: unstable-2023-04-20 -> unstable-2024-07-07 Updated to work with mes 0.27 --- .../linux/minimal-bootstrap/tinycc/bootstrappable.nix | 7 ++++--- pkgs/os-specific/linux/minimal-bootstrap/tinycc/musl.nix | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pkgs/os-specific/linux/minimal-bootstrap/tinycc/bootstrappable.nix b/pkgs/os-specific/linux/minimal-bootstrap/tinycc/bootstrappable.nix index 4c6dd1bb6cb9..64236471a6c5 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/tinycc/bootstrappable.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/tinycc/bootstrappable.nix @@ -18,12 +18,12 @@ let inherit (callPackage ./common.nix { }) buildTinyccMes recompileLibc; - version = "unstable-2023-04-20"; - rev = "80114c4da6b17fbaabb399cc29f427e368309bc8"; + version = "unstable-2024-07-07"; + rev = "ea3900f6d5e71776c5cfabcabee317652e3a19ee"; tarball = fetchurl { url = "https://gitlab.com/janneke/tinycc/-/archive/${rev}/tinycc-${rev}.tar.gz"; - sha256 = "1a0cw9a62qc76qqn5sjmp3xrbbvsz2dxrw21lrnx9q0s74mwaxbq"; + sha256 = "sha256-16JBGJATAWP+lPylOi3+lojpdv0SR5pqyxOV2PiVx0A="; }; src = (kaem.runCommand "tinycc-bootstrappable-${version}-source" { } '' @@ -67,6 +67,7 @@ let -o tcc.s \ -I . \ -D BOOTSTRAP=1 \ + -D HAVE_LONG_LONG=0 \ -I ${src} \ -D TCC_TARGET_I386=1 \ -D inline= \ diff --git a/pkgs/os-specific/linux/minimal-bootstrap/tinycc/musl.nix b/pkgs/os-specific/linux/minimal-bootstrap/tinycc/musl.nix index a8b624c0efba..9a9c26f6171f 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/tinycc/musl.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/tinycc/musl.nix @@ -12,7 +12,7 @@ let pname = "tinycc-musl"; # next commit introduces use of realpath (unsupported in mes-libc) - version = "unstable-2023-07-10"; + version = "unstable-2023-07-31"; rev = "fd6d2180c5c801bb0b4c5dde27d61503059fc97d"; src = fetchurl { From 6bcba60b3dde61267275db457ba75c0c52fa5a10 Mon Sep 17 00:00:00 2001 From: dish Date: Sun, 31 Aug 2025 11:49:19 -0400 Subject: [PATCH 5/8] minimal-bootstrap.musl11: Fix build with newer tcc --- pkgs/os-specific/linux/minimal-bootstrap/default.nix | 10 +++++----- pkgs/os-specific/linux/minimal-bootstrap/musl/1.1.nix | 6 +----- .../linux/minimal-bootstrap/musl/default.nix | 4 ++-- .../linux/minimal-bootstrap/tinycc/musl.nix | 1 - 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/pkgs/os-specific/linux/minimal-bootstrap/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/default.nix index 061727a47063..4c4b461f2f13 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/default.nix @@ -75,7 +75,7 @@ lib.makeScope gawk-mes = callPackage ./gawk/mes.nix { bash = bash_2_05; - tinycc = tinycc-mes; + tinycc = tinycc-bootstrappable; gnused = gnused-mes; }; @@ -123,7 +123,7 @@ lib.makeScope tinycc = tinycc-mes; }; - gnumake = callPackage ./gnumake { tinycc = tinycc-mes; }; + gnumake = callPackage ./gnumake { tinycc = tinycc-bootstrappable; }; gnumake-musl = callPackage ./gnumake/musl.nix { bash = bash_2_05; @@ -141,7 +141,7 @@ lib.makeScope }; gnused-mes = callPackage ./gnused/mes.nix { bash = bash_2_05; - tinycc = tinycc-mes; + tinycc = tinycc-bootstrappable; }; gnutar = callPackage ./gnutar/mes.nix { @@ -165,13 +165,13 @@ lib.makeScope gzip = callPackage ./gzip { bash = bash_2_05; - tinycc = tinycc-mes; + tinycc = tinycc-bootstrappable; gnused = gnused-mes; }; heirloom = callPackage ./heirloom { bash = bash_2_05; - tinycc = tinycc-mes; + tinycc = tinycc-bootstrappable; }; heirloom-devtools = callPackage ./heirloom-devtools { tinycc = tinycc-mes; }; diff --git a/pkgs/os-specific/linux/minimal-bootstrap/musl/1.1.nix b/pkgs/os-specific/linux/minimal-bootstrap/musl/1.1.nix index 4ec34686cb57..fc762a956aa2 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/musl/1.1.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/musl/1.1.nix @@ -54,12 +54,8 @@ let url = "${liveBootstrap}/patches/sigsetjmp.patch"; hash = "sha256-wd2Aev1zPJXy3q933aiup5p1IMKzVJBquAyl3gbK4PU="; }) - # FIXME: this patch causes the build to fail - # (fetchurl { - # url = "${liveBootstrap}/patches/stdio_flush_on_exit.patch"; - # hash = "sha256-/z5ze3h3QTysay8nRvyvwPv3pmTcKptdkBIaMCoeLDg="; - # }) # HACK: always flush stdio immediately + # Do not remove atm, gcc 4.6 does not build without this patch applied. ./always-flush.patch (fetchurl { url = "${liveBootstrap}/patches/va_list.patch"; diff --git a/pkgs/os-specific/linux/minimal-bootstrap/musl/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/musl/default.nix index 138e530efb5d..79ca931501d6 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/musl/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/musl/default.nix @@ -14,11 +14,11 @@ }: let inherit (import ./common.nix { inherit lib; }) pname meta; - version = "1.2.4"; + version = "1.2.5"; src = fetchurl { url = "https://musl.libc.org/releases/musl-${version}.tar.gz"; - hash = "sha256-ejXq4z1TcqfA2hGI3nmHJvaIJVE7euPr6XqqpSEU8Dk="; + hash = "sha256-qaEYu+hNh2TaDqDSizqz+uhHf8fkCF2QECuFlvx8deQ="; }; in bash.runCommand "${pname}-${version}" diff --git a/pkgs/os-specific/linux/minimal-bootstrap/tinycc/musl.nix b/pkgs/os-specific/linux/minimal-bootstrap/tinycc/musl.nix index 9a9c26f6171f..62f69fe1c24f 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/tinycc/musl.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/tinycc/musl.nix @@ -1,7 +1,6 @@ { lib, fetchurl, - callPackage, bash, tinycc-bootstrappable, musl, From 2d7ae75a423a611fd0f483de7edc499989c4dd99 Mon Sep 17 00:00:00 2001 From: dish Date: Sun, 31 Aug 2025 11:51:29 -0400 Subject: [PATCH 6/8] minimal-bootstrap.coreutils-musl: Fix build Disable chdir_long support since even though the symbol exists, it can't be found, which causes build errors. --- pkgs/os-specific/linux/minimal-bootstrap/coreutils/musl.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/os-specific/linux/minimal-bootstrap/coreutils/musl.nix b/pkgs/os-specific/linux/minimal-bootstrap/coreutils/musl.nix index 3606e378c27b..11778bb35833 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/coreutils/musl.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/coreutils/musl.nix @@ -28,7 +28,10 @@ let # musl 1.1.x doesn't use 64bit time_t "--disable-year2038" # libstdbuf.so fails in static builds - "--enable-no-install-program=stdbuf" + "--enable-no-install-program=stdbuf,arch,coreutils,hostname" + # Disable PATH_MAX for better reproducibility + "gl_cv_func_getcwd_path_max=\"no, but it is partly working\"" + "gl_cv_have_unlimited_file_name_length=no" ]; in bash.runCommand "${pname}-${version}" @@ -68,6 +71,7 @@ bash.runCommand "${pname}-${version}" # Configure export CC="tcc -B ${tinycc.libs}/lib" export LD=tcc + export LDFLAGS="-L ./lib" bash ./configure ${lib.concatStringsSep " " configureFlags} # Build From a0685d704c3a20dac47c15d7725cb24b9805bced Mon Sep 17 00:00:00 2001 From: dish Date: Sun, 31 Aug 2025 11:51:53 -0400 Subject: [PATCH 7/8] minimal-bootstrap.heirloom: Remove unneeded stubs These caused the build to fail, so they had to be removed. --- .../os-specific/linux/minimal-bootstrap/heirloom/stubs.h | 9 --------- 1 file changed, 9 deletions(-) diff --git a/pkgs/os-specific/linux/minimal-bootstrap/heirloom/stubs.h b/pkgs/os-specific/linux/minimal-bootstrap/heirloom/stubs.h index 5aef8168180b..002855eaa079 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/heirloom/stubs.h +++ b/pkgs/os-specific/linux/minimal-bootstrap/heirloom/stubs.h @@ -28,15 +28,6 @@ int mkstemp(char *t) 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) From 8d0938c9de034ec550927ed1c58bbaf2ec9a5930 Mon Sep 17 00:00:00 2001 From: Luna Nova Date: Sat, 4 Oct 2025 19:41:46 -0700 Subject: [PATCH 8/8] minimal-bootstrap.musl11: add stdio_flush_on_exit.patch, drop always-flush.patch The upstream version of this patch has been commented out since 913e70d77b67722a5b3bd42f21b9ea4cc02046e9, due to error: implicit declaration of function '__stdio_exit' Revived this approach by updating the patch to forward declare. --- .../linux/minimal-bootstrap/musl/1.1.nix | 7 +- .../minimal-bootstrap/musl/always-flush.patch | 12 ---- .../musl/stdio_flush_on_exit.patch | 71 +++++++++++++++++++ 3 files changed, 75 insertions(+), 15 deletions(-) delete mode 100644 pkgs/os-specific/linux/minimal-bootstrap/musl/always-flush.patch create mode 100644 pkgs/os-specific/linux/minimal-bootstrap/musl/stdio_flush_on_exit.patch diff --git a/pkgs/os-specific/linux/minimal-bootstrap/musl/1.1.nix b/pkgs/os-specific/linux/minimal-bootstrap/musl/1.1.nix index fc762a956aa2..b14082365652 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/musl/1.1.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/musl/1.1.nix @@ -54,9 +54,10 @@ let url = "${liveBootstrap}/patches/sigsetjmp.patch"; hash = "sha256-wd2Aev1zPJXy3q933aiup5p1IMKzVJBquAyl3gbK4PU="; }) - # HACK: always flush stdio immediately - # Do not remove atm, gcc 4.6 does not build without this patch applied. - ./always-flush.patch + # liveBootstrap/sysa/musl-1.1.24/patches/stdio_flush_on_exit.patch with forward declarations added + # to avoid `error: implicit declaration of function '__stdio_exit'` + # Required to fix buffered stdout being truncated on exit + ./stdio_flush_on_exit.patch (fetchurl { url = "${liveBootstrap}/patches/va_list.patch"; hash = "sha256-UmcMIl+YCi3wIeVvjbsCyqFlkyYsM4ECNwTfXP+s7vg="; diff --git a/pkgs/os-specific/linux/minimal-bootstrap/musl/always-flush.patch b/pkgs/os-specific/linux/minimal-bootstrap/musl/always-flush.patch deleted file mode 100644 index cdeddf962d9d..000000000000 --- a/pkgs/os-specific/linux/minimal-bootstrap/musl/always-flush.patch +++ /dev/null @@ -1,12 +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/pkgs/os-specific/linux/minimal-bootstrap/musl/stdio_flush_on_exit.patch b/pkgs/os-specific/linux/minimal-bootstrap/musl/stdio_flush_on_exit.patch new file mode 100644 index 000000000000..145c13b29611 --- /dev/null +++ b/pkgs/os-specific/linux/minimal-bootstrap/musl/stdio_flush_on_exit.patch @@ -0,0 +1,71 @@ +Initial patch version retrieved from +https://git.stikonas.eu/andrius/live-bootstrap/src/commit/cd361e63f77842d9780303d63382eb686843c76b/sysa/musl-1.1.24/patches/stdio_flush_on_exit.patch + +SPDX-FileCopyrightText: 2021 Paul Dersey +SPDX-FileCopyrightText: 2025 Luna Nova + +SPDX-License-Identifier: MIT + +Make sure real __stdio_exit() is called on exit and not the dummy +noop versions. This fixes the issue of truncated output when redirecting +output to a file or pipe. It also fixes truncated output on programs +that forget to call fclose() + +Adds forward declarations to avoid implicit declaration error. + +diff --git a/src/exit/exit.c b/src/exit/exit.c +index a6869b37..a4164682 100644 +--- src/exit/exit.c ++++ src/exit/exit.c +@@ -2,16 +2,10 @@ + #include + #include "libc.h" + +-static void dummy() +-{ +-} +- +-/* atexit.c and __stdio_exit.c override these. the latter is linked +- * as a consequence of linking either __toread.c or __towrite.c. */ +-weak_alias(dummy, __funcs_on_exit); +-weak_alias(dummy, __stdio_exit); +-weak_alias(dummy, _fini); ++void __funcs_on_exit(void); ++void __stdio_exit(void); ++void _fini(void); + + extern weak hidden void (*const __fini_array_start)(void), (*const __fini_array_end)(void); + + static void libc_exit_fini(void) +diff --git a/src/internal/stdio_impl.h b/src/internal/stdio_impl.h +index d7398f59..69141813 100644 +--- src/internal/stdio_impl.h ++++ src/internal/stdio_impl.h +@@ -47,9 +47,9 @@ struct _IO_FILE { + struct __locale_struct *locale; + }; + +-extern hidden FILE *volatile __stdin_used; +-extern hidden FILE *volatile __stdout_used; +-extern hidden FILE *volatile __stderr_used; ++extern FILE *volatile __stdin_used; ++extern FILE *volatile __stdout_used; ++extern FILE *volatile __stderr_used; + + hidden int __lockfile(FILE *); + hidden void __unlockfile(FILE *); +diff --git a/src/stdio/__stdio_exit.c b/src/stdio/__stdio_exit.c +index a5e42c67..5947a141 100644 +--- src/stdio/__stdio_exit.c ++++ src/stdio/__stdio_exit.c +@@ -1,10 +1,5 @@ + #include "stdio_impl.h" + +-static FILE *volatile dummy_file = 0; +-weak_alias(dummy_file, __stdin_used); +-weak_alias(dummy_file, __stdout_used); +-weak_alias(dummy_file, __stderr_used); +- + static void close_file(FILE *f) + { + if (!f) return;