diff --git a/Jinxfile b/Jinxfile index 83f02b4c..d72fa131 100644 --- a/Jinxfile +++ b/Jinxfile @@ -1,4 +1,7 @@ -JINX_MAJOR_VER=0.6 +JINX_MAJOR_VER=0.8 +JINX_DEBIAN_SNAPSHOT=20260430T144239Z +JINX_BASE_PACKAGES="autopoint bison cmake docbook-xsl docbook-xml docbook-xsl-ns docbook5-xml doxygen file flex gettext groff m4 make meson ninja-build perl python3 texinfo w3m which xmlto xsltproc" + export CFLAGS="-O2 -march=x86-64 -pipe -mtune=generic" export CXXFLAGS="${CFLAGS}" diff --git a/Makefile b/Makefile index 2041c6fd..bcd795d8 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ all: $(JINX_DIR)/.astral_ok @echo jinx: - curl https://codeberg.org/Mintsuki/jinx/raw/commit/fba7f3150aa0bd13d27161968b1f441836d06279/jinx > jinx + curl https://codeberg.org/Mintsuki/jinx/raw/commit/1c40ceb62e09befc5172d1caf53e3e440a19f624/jinx > jinx chmod +x jinx $(JINX_DIR)/.astral_ok: jinx @@ -77,11 +77,11 @@ kernel: distro-minimal: cd $(JINX_DIR) && \ - ../jinx build-if-needed $(MINIMALPACKAGES) + ../jinx update $(MINIMALPACKAGES) distro-full: cd $(JINX_DIR) && \ - ../jinx build-if-needed '*' + ../jinx update '*' # ------ initrd targets ------ diff --git a/patches/bash/jinx-working-patch.patch b/patches/bash/jinx-working-patch.patch index fc8dc31e..37c1fa94 100644 --- a/patches/bash/jinx-working-patch.patch +++ b/patches/bash/jinx-working-patch.patch @@ -1,18 +1,18 @@ diff --git bash-clean/externs.h bash-workdir/externs.h -index 3d7716c..8fb66a8 100644 +index 47b80f6..063912f 100644 --- bash-clean/externs.h +++ bash-workdir/externs.h -@@ -290,7 +290,7 @@ extern int getdtablesize PARAMS((void)); +@@ -308,7 +308,7 @@ extern int getdtablesize (void); #endif /* !HAVE_GETDTABLESIZE */ #if !defined (HAVE_GETHOSTNAME) --extern int gethostname PARAMS((char *, int)); -+extern int gethostname PARAMS((char *, size_t)); +-extern int gethostname (char *, int); ++extern int gethostname (char *, size_t); #endif /* !HAVE_GETHOSTNAME */ - extern int getmaxgroups PARAMS((void)); + extern int getmaxgroups (void); diff --git bash-clean/subst.c bash-workdir/subst.c -index 9ccbf33..909bac9 100644 +index e9d3e75..f787665 100644 --- bash-clean/subst.c +++ bash-workdir/subst.c @@ -32,6 +32,7 @@ @@ -24,29 +24,29 @@ index 9ccbf33..909bac9 100644 #if defined (HAVE_UNISTD_H) # include diff --git bash-clean/support/config.sub bash-workdir/support/config.sub -index c874b7a..8e4744e 100755 +index 4aaae46..dfefff8 100644 --- bash-clean/support/config.sub +++ bash-workdir/support/config.sub -@@ -1720,7 +1720,7 @@ case $os in - | skyos* | haiku* | rdos* | toppers* | drops* | es* \ - | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \ - | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \ -- | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx*) -+ | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | astral*) - ;; - # This one is extra strict with allowed versions - sco3.2v2 | sco3.2v[4-9]* | sco5v6*) +@@ -1974,6 +1974,7 @@ case $os in + | aos* \ + | aros* \ + | atheos* \ ++ | astral* \ + | auroraux* \ + | aux* \ + | beos* \ diff --git bash-clean/support/shobj-conf bash-workdir/support/shobj-conf -index 5a3f977..4d21483 100755 +index c3df351..0576089 100755 --- bash-clean/support/shobj-conf +++ bash-workdir/support/shobj-conf -@@ -79,6 +79,9 @@ nsk-cc-tandem|nsk-c99-tandem) +@@ -79,6 +79,10 @@ nsk-cc-tandem|nsk-c99-tandem) SHOBJ_LDFLAGS='-shared -bglobalized -unres_symbols ignore' ;; +astral*-*gcc*) + SHOBJ_CFLAGS=-fpic + ;; ++ sunos4*-*gcc*) SHOBJ_CFLAGS=-fpic SHOBJ_LD=/usr/bin/ld diff --git a/patches/cmake/jinx-working-patch.patch b/patches/cmake/jinx-working-patch.patch new file mode 100644 index 00000000..1ed04a57 --- /dev/null +++ b/patches/cmake/jinx-working-patch.patch @@ -0,0 +1,12 @@ +diff --git cmake-clean/Utilities/cmcppdap/include/dap/network.h cmake-workdir/Utilities/cmcppdap/include/dap/network.h +index 9d14f6b..4c5868f 100644 +--- cmake-clean/Utilities/cmcppdap/include/dap/network.h ++++ cmake-workdir/Utilities/cmcppdap/include/dap/network.h +@@ -17,6 +17,7 @@ + + #include + #include ++#include + + namespace dap { + class ReaderWriter; diff --git a/patches/gcc/jinx-working-patch.patch b/patches/gcc/jinx-working-patch.patch index d261d93d..d79de798 100644 --- a/patches/gcc/jinx-working-patch.patch +++ b/patches/gcc/jinx-working-patch.patch @@ -55,10 +55,10 @@ index 0000000..1768e2c + builtin_assert ("system=posix"); \ + } while(0); diff --git gcc-clean/gcc/config.gcc gcc-workdir/gcc/config.gcc -index 087aaa7..f6f72a0 100644 +index a3566f5..93b4acc 100644 --- gcc-clean/gcc/config.gcc +++ gcc-workdir/gcc/config.gcc -@@ -826,6 +826,14 @@ case ${target} in +@@ -825,6 +825,14 @@ case ${target} in rust_target_objs="${rust_target_objs} dragonfly-rust.o" target_has_targetrustm=yes ;; @@ -73,33 +73,33 @@ index 087aaa7..f6f72a0 100644 *-*-freebsd*) # This is the generic ELF configuration of FreeBSD. Later # machine-specific sections may refine and add to this -@@ -1186,6 +1194,9 @@ case ${target} in +@@ -1189,6 +1197,9 @@ case ${target} in esac case ${target} in +x86_64-*-astral*) -+ tm_file="${tm_file} i386/unix.h i386/att.h elfos.h glibc-stdint.h i386/i386elf.h i386/x86-64.h astral.h gnu-user.h" ++ tm_file="${tm_file} i386/unix.h i386/att.h elfos.h glibc-stdint.h i386/i386elf.h i386/x86-64.h gnu-user.h astral.h" + ;; aarch64*-*-elf | aarch64*-*-fuchsia* | aarch64*-*-rtems*) tm_file="${tm_file} elfos.h newlib-stdint.h" tm_file="${tm_file} aarch64/aarch64-elf.h aarch64/aarch64-errata.h aarch64/aarch64-elf-raw.h" diff --git gcc-clean/libgcc/config.host gcc-workdir/libgcc/config.host -index 6a88ee5..c54151b 100644 +index ee10e99..411a213 100644 --- gcc-clean/libgcc/config.host +++ gcc-workdir/libgcc/config.host -@@ -793,6 +793,10 @@ i[34567]86-*-openbsd*) +@@ -784,6 +784,10 @@ i[34567]86-*-openbsd*) ;; x86_64-*-openbsd*) ;; +x86_64-*-astral*) -+ extra_parts="$extra_parts crti.o crtbegin.o crtend.o crtn.o crtbeginS.o crtendS.o crtprec32.o crtprec64.o crtprec80.o crtfastmath.o" ++ extra_parts="$extra_parts crtbegin.o crtend.o crtbeginS.o crtendS.o crtprec32.o crtprec64.o crtprec80.o crtfastmath.o" + tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic i386/t-crtpc t-crtfm i386/t-crtstuff t-dfprules" + ;; i[34567]86-*-linux*) extra_parts="$extra_parts crtprec32.o crtprec64.o crtprec80.o crtfastmath.o" tmake_file="${tmake_file} i386/t-crtpc t-crtfm i386/t-crtstuff t-dfprules" diff --git gcc-clean/libgcc/libgcov.h gcc-workdir/libgcc/libgcov.h -index 3d7d52a..cd9d819 100644 +index 9d83a27..5315570 100644 --- gcc-clean/libgcc/libgcov.h +++ gcc-workdir/libgcc/libgcov.h @@ -25,6 +25,8 @@ @@ -112,7 +112,7 @@ index 3d7d52a..cd9d819 100644 #ifndef xmalloc #define xmalloc malloc diff --git gcc-clean/libstdc++-v3/configure.ac gcc-workdir/libstdc++-v3/configure.ac -index a6c01b2..9e2faad 100644 +index a6525a9..6c8c322 100644 --- gcc-clean/libstdc++-v3/configure.ac +++ gcc-workdir/libstdc++-v3/configure.ac @@ -134,7 +134,7 @@ fi diff --git a/patches/gnutls/jinx-working-patch.patch b/patches/gnutls/jinx-working-patch.patch new file mode 100644 index 00000000..8441c7dd --- /dev/null +++ b/patches/gnutls/jinx-working-patch.patch @@ -0,0 +1,12 @@ +diff --git gnutls-clean/build-aux/config.sub gnutls-workdir/build-aux/config.sub +index 4aaae46..cd5a02a 100755 +--- gnutls-clean/build-aux/config.sub ++++ gnutls-workdir/build-aux/config.sub +@@ -2109,6 +2109,7 @@ case $os in + | solaris* \ + | solidbsd* \ + | sortix* \ ++ | astral* \ + | storm-chaos* \ + | sunos \ + | sunos[34]* \ diff --git a/patches/llvm/jinx-working-patch.patch b/patches/llvm/jinx-working-patch.patch index 888d7bdc..38621e81 100644 --- a/patches/llvm/jinx-working-patch.patch +++ b/patches/llvm/jinx-working-patch.patch @@ -1,5 +1,5 @@ diff --git llvm-clean/clang/lib/Basic/Targets/OSTargets.h llvm-workdir/clang/lib/Basic/Targets/OSTargets.h -index 4366c11..a2f2a26 100644 +index 4366c11..46ff0e0 100644 --- llvm-clean/clang/lib/Basic/Targets/OSTargets.h +++ llvm-workdir/clang/lib/Basic/Targets/OSTargets.h @@ -447,6 +447,36 @@ public: @@ -40,7 +40,7 @@ index 4366c11..a2f2a26 100644 template class LLVM_LIBRARY_VISIBILITY PS3PPUTargetInfo : public OSTargetInfo { diff --git llvm-clean/clang/lib/Basic/Targets.cpp llvm-workdir/clang/lib/Basic/Targets.cpp -index e328351..c67fbc8 100644 +index e328351..180c537 100644 --- llvm-clean/clang/lib/Basic/Targets.cpp +++ llvm-workdir/clang/lib/Basic/Targets.cpp @@ -174,6 +174,10 @@ std::unique_ptr AllocateTarget(const llvm::Triple &Triple, @@ -75,7 +75,7 @@ index e328351..c67fbc8 100644 return std::make_unique(Triple, Opts); } diff --git llvm-clean/clang/lib/Driver/CMakeLists.txt llvm-workdir/clang/lib/Driver/CMakeLists.txt -index 58427e3..9fd4eb1 100644 +index 58427e3..26dae28 100644 --- llvm-clean/clang/lib/Driver/CMakeLists.txt +++ llvm-workdir/clang/lib/Driver/CMakeLists.txt @@ -79,6 +79,7 @@ add_clang_library(clangDriver @@ -87,7 +87,7 @@ index 58427e3..9fd4eb1 100644 ToolChains/XCore.cpp ToolChains/PPCLinux.cpp diff --git llvm-clean/clang/lib/Driver/Driver.cpp llvm-workdir/clang/lib/Driver/Driver.cpp -index 93cddf7..5930d07 100644 +index 93cddf7..e2f5d7a 100644 --- llvm-clean/clang/lib/Driver/Driver.cpp +++ llvm-workdir/clang/lib/Driver/Driver.cpp @@ -46,6 +46,7 @@ @@ -108,52 +108,9 @@ index 93cddf7..5930d07 100644 case llvm::Triple::LiteOS: TC = std::make_unique(*this, Target, Args); break; -diff --git llvm-clean/clang/lib/Driver/ToolChains/Gnu.cpp llvm-workdir/clang/lib/Driver/ToolChains/Gnu.cpp -index e5e1b1d..5d2d67e 100644 ---- llvm-clean/clang/lib/Driver/ToolChains/Gnu.cpp -+++ llvm-workdir/clang/lib/Driver/ToolChains/Gnu.cpp -@@ -228,6 +228,8 @@ static const char *getLDMOption(const llvm::Triple &T, const ArgList &Args) { - return "elf_iamcu"; - return "elf_i386"; - case llvm::Triple::aarch64: -+ if (T.getOS() == llvm::Triple::Astral) -+ return "aarch64astral"; - return "aarch64linux"; - case llvm::Triple::aarch64_be: - return "aarch64linuxb"; -@@ -2452,7 +2454,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( - static const char *const AArch64LibDirs[] = {"/lib64", "/lib"}; - static const char *const AArch64Triples[] = { - "aarch64-none-linux-gnu", "aarch64-linux-gnu", "aarch64-redhat-linux", -- "aarch64-suse-linux"}; -+ "aarch64-suse-linux", "aarch64-astral"}; - static const char *const AArch64beLibDirs[] = {"/lib"}; - static const char *const AArch64beTriples[] = {"aarch64_be-none-linux-gnu", - "aarch64_be-linux-gnu"}; -@@ -2482,7 +2484,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( - "x86_64-redhat-linux", "x86_64-suse-linux", - "x86_64-manbo-linux-gnu", "x86_64-linux-gnu", - "x86_64-slackware-linux", "x86_64-unknown-linux", -- "x86_64-amazon-linux"}; -+ "x86_64-amazon-linux", "x86_64-astral"}; -+ - static const char *const X32Triples[] = {"x86_64-linux-gnux32", - "x86_64-pc-linux-gnux32"}; - static const char *const X32LibDirs[] = {"/libx32", "/lib"}; -@@ -2558,7 +2561,9 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( - static const char *const RISCV64LibDirs[] = {"/lib64", "/lib"}; - static const char *const RISCV64Triples[] = {"riscv64-unknown-linux-gnu", - "riscv64-linux-gnu", -- "riscv64-unknown-elf"}; -+ "riscv64-unknown-elf", -+ "riscv64-astral", -+ - - static const char *const SPARCv8LibDirs[] = {"/lib32", "/lib"}; - static const char *const SPARCv8Triples[] = {"sparc-linux-gnu", diff --git llvm-workdir/clang/lib/Driver/ToolChains/Astral.cpp llvm-workdir/clang/lib/Driver/ToolChains/Astral.cpp new file mode 100644 -index 0000000..c087c3d +index 0000000..ec626e1 --- /dev/null +++ llvm-workdir/clang/lib/Driver/ToolChains/Astral.cpp @@ -0,0 +1,230 @@ @@ -389,7 +346,7 @@ index 0000000..c087c3d +} diff --git llvm-workdir/clang/lib/Driver/ToolChains/Astral.h llvm-workdir/clang/lib/Driver/ToolChains/Astral.h new file mode 100644 -index 0000000..d422f8d +index 0000000..c680298 --- /dev/null +++ llvm-workdir/clang/lib/Driver/ToolChains/Astral.h @@ -0,0 +1,54 @@ @@ -447,8 +404,63 @@ index 0000000..d422f8d +} // end namespace clang + +#endif // LLVM_CLANG_LIB_DRIVER_TOOLCHAINS_ASTRAL_H +diff --git llvm-clean/clang/lib/Driver/ToolChains/Gnu.cpp llvm-workdir/clang/lib/Driver/ToolChains/Gnu.cpp +index e5e1b1d..9ef11b3 100644 +--- llvm-clean/clang/lib/Driver/ToolChains/Gnu.cpp ++++ llvm-workdir/clang/lib/Driver/ToolChains/Gnu.cpp +@@ -228,6 +228,8 @@ static const char *getLDMOption(const llvm::Triple &T, const ArgList &Args) { + return "elf_iamcu"; + return "elf_i386"; + case llvm::Triple::aarch64: ++ if (T.getOS() == llvm::Triple::Astral) ++ return "aarch64astral"; + return "aarch64linux"; + case llvm::Triple::aarch64_be: + return "aarch64linuxb"; +@@ -2452,7 +2454,7 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( + static const char *const AArch64LibDirs[] = {"/lib64", "/lib"}; + static const char *const AArch64Triples[] = { + "aarch64-none-linux-gnu", "aarch64-linux-gnu", "aarch64-redhat-linux", +- "aarch64-suse-linux"}; ++ "aarch64-suse-linux", "aarch64-astral"}; + static const char *const AArch64beLibDirs[] = {"/lib"}; + static const char *const AArch64beTriples[] = {"aarch64_be-none-linux-gnu", + "aarch64_be-linux-gnu"}; +@@ -2482,7 +2484,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( + "x86_64-redhat-linux", "x86_64-suse-linux", + "x86_64-manbo-linux-gnu", "x86_64-linux-gnu", + "x86_64-slackware-linux", "x86_64-unknown-linux", +- "x86_64-amazon-linux"}; ++ "x86_64-amazon-linux", "x86_64-astral"}; ++ + static const char *const X32Triples[] = {"x86_64-linux-gnux32", + "x86_64-pc-linux-gnux32"}; + static const char *const X32LibDirs[] = {"/libx32", "/lib"}; +@@ -2558,7 +2561,9 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes( + static const char *const RISCV64LibDirs[] = {"/lib64", "/lib"}; + static const char *const RISCV64Triples[] = {"riscv64-unknown-linux-gnu", + "riscv64-linux-gnu", +- "riscv64-unknown-elf"}; ++ "riscv64-unknown-elf", ++ "riscv64-astral", ++ + + static const char *const SPARCv8LibDirs[] = {"/lib32", "/lib"}; + static const char *const SPARCv8Triples[] = {"sparc-linux-gnu", +diff --git llvm-clean/llvm/include/llvm/ADT/SmallVector.h llvm-workdir/llvm/include/llvm/ADT/SmallVector.h +index 09676d7..1744414 100644 +--- llvm-clean/llvm/include/llvm/ADT/SmallVector.h ++++ llvm-workdir/llvm/include/llvm/ADT/SmallVector.h +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + #include + #include + #include diff --git llvm-clean/llvm/include/llvm/ADT/bit.h llvm-workdir/llvm/include/llvm/ADT/bit.h -index c42b5e6..5745ec3 100644 +index c42b5e6..b7b8101 100644 --- llvm-clean/llvm/include/llvm/ADT/bit.h +++ llvm-workdir/llvm/include/llvm/ADT/bit.h @@ -29,7 +29,7 @@ @@ -461,7 +473,7 @@ index c42b5e6..5745ec3 100644 #elif defined(_AIX) #include diff --git llvm-clean/llvm/include/llvm/TargetParser/Triple.h llvm-workdir/llvm/include/llvm/TargetParser/Triple.h -index 49ec8de..17e97e6 100644 +index 49ec8de..36f00c1 100644 --- llvm-clean/llvm/include/llvm/TargetParser/Triple.h +++ llvm-workdir/llvm/include/llvm/TargetParser/Triple.h @@ -226,7 +226,8 @@ public: @@ -486,7 +498,7 @@ index 49ec8de..17e97e6 100644 enum ObjectFormatType { UnknownObjectFormat, diff --git llvm-clean/llvm/lib/Support/Unix/Path.inc llvm-workdir/llvm/lib/Support/Unix/Path.inc -index 9f89d63..fc8db42 100644 +index 9f89d63..cfb29f2 100644 --- llvm-clean/llvm/lib/Support/Unix/Path.inc +++ llvm-workdir/llvm/lib/Support/Unix/Path.inc @@ -112,7 +112,7 @@ typedef uint_t uint; @@ -528,7 +540,7 @@ index 9f89d63..fc8db42 100644 // conservative answer. return false; diff --git llvm-clean/llvm/lib/TargetParser/Triple.cpp llvm-workdir/llvm/lib/TargetParser/Triple.cpp -index 0bbe8a3..fd175c4 100644 +index 0bbe8a3..0124236 100644 --- llvm-clean/llvm/lib/TargetParser/Triple.cpp +++ llvm-workdir/llvm/lib/TargetParser/Triple.cpp @@ -276,6 +276,7 @@ StringRef Triple::getOSTypeName(OSType Kind) { diff --git a/patches/mlibc/jinx-working-patch.patch b/patches/mlibc/jinx-working-patch.patch index 3b74360f..02b25140 100644 --- a/patches/mlibc/jinx-working-patch.patch +++ b/patches/mlibc/jinx-working-patch.patch @@ -1,153 +1,3 @@ -diff --git mlibc-clean/options/ansi/generic/time.cpp mlibc-workdir/options/ansi/generic/time.cpp -index 8edf44b..c13a2c1 100644 ---- mlibc-clean/options/ansi/generic/time.cpp -+++ mlibc-workdir/options/ansi/generic/time.cpp -@@ -598,7 +598,7 @@ int nanosleep(const struct timespec *req, struct timespec *rem) { - int e = mlibc::sys_sleep(&tmp.tv_sec, &tmp.tv_nsec); - if (!e) - return 0; -- else if (e == EINTR) -+ else if (e == EINTR && rem) - *rem = tmp; - - errno = e; -diff --git mlibc-clean/options/internal/include/mlibc/strtol.hpp mlibc-workdir/options/internal/include/mlibc/strtol.hpp -index a77d9d0..9f3fe08 100644 ---- mlibc-clean/options/internal/include/mlibc/strtol.hpp -+++ mlibc-workdir/options/internal/include/mlibc/strtol.hpp -@@ -4,6 +4,7 @@ - #include - #include - #include -+#include - #include - - namespace mlibc { -diff --git mlibc-clean/options/ansi/generic/inttypes.cpp mlibc-workdir/options/ansi/generic/inttypes.cpp -index 6478680..1ca08f4 100644 ---- mlibc-clean/options/ansi/generic/inttypes.cpp -+++ mlibc-workdir/options/ansi/generic/inttypes.cpp -@@ -1,11 +1,7 @@ -- --#include - #include --#include -+#include - - #include - #include -- --static const char *__mlibc_digits = "0123456789abcdefghijklmnopqrstuvwxyz"; - - intmax_t imaxabs(intmax_t num) { -@@ -16,83 +14,17 @@ imaxdiv_t imaxdiv(intmax_t number, intmax_t denom) { - return r; - } - --template T strtoxmax(const char *it, char **out, int base) { -- T v = 0; -- bool negate = false; -- const unsigned char *s = (const unsigned char *)it; -- int c; -- -- if(std::is_signed_v) { -- if(*s == '+') { -- s++; -- }else if(*s == '-') { -- negate = true; -- s++; -- } -- } -- -- do { -- c = *s++; -- } while (isspace(c)); -- if ((base == 0 || base == 16) && c == '0' && (*s == 'x' || *s == 'X')) { -- c = s[1]; -- s += 2; -- base = 16; -- } -- if (base == 0) -- base = c == '0' ? 8 : 10; -- -- if(base == 8) { -- if(*it != 0) -- goto parse_digits; -- it++; -- }else if(base == 16) { -- if(*it != 0) -- goto parse_digits; -- it++; -- if(*it != 'x' && *it != 'X') -- goto parse_digits; -- it++; -- } -- --parse_digits: -- while(*it) { -- if(isspace(*it)) { -- it++; -- continue; -- } -- -- __ensure(base <= 10); // TODO: For base > 10 we need to implement tolower(). -- //auto c = strchr(__mlibc_digits, tolower(*it)); -- auto c = strchr(__mlibc_digits, *it); -- if(!c || (c - __mlibc_digits) >= base) -- break; -- v = v * base + (c - __mlibc_digits); -- it++; -- } -- -- if(std::is_signed_v) { -- if(negate) -- v = -v; -- } -- -- if(out) -- *out = const_cast(it); -- return v; --} -- --intmax_t strtoimax(const char *it, char **out, int base) { -- // TODO: This function has to check for overflow! -- return strtoxmax(it, out, base); -+intmax_t strtoimax(const char *string, char **end, int base) { -+ return mlibc::stringToInteger(string, end, base); - } --uintmax_t strtoumax(const char *it, char **out, int base) { -- return strtoxmax(it, out, base); -+uintmax_t strtoumax(const char *string, char **end, int base) { -+ return mlibc::stringToInteger(string, end, base); - } - intmax_t wcstoimax(const wchar_t *__restrict, wchar_t **__restrict, int) { - __ensure(!"Not implemented"); - __builtin_unreachable(); - } - uintmax_t wcstoumax(const wchar_t *__restrict, wchar_t **__restrict, int) { - __ensure(!"Not implemented"); - __builtin_unreachable(); - } -diff --git mlibc-clean/options/ansi/generic/wchar.cpp mlibc-workdir/options/ansi/generic/wchar.cpp -index b44ebc2..9339316 100644 ---- mlibc-clean/options/ansi/generic/wchar.cpp -+++ mlibc-workdir/options/ansi/generic/wchar.cpp -@@ -54,8 +54,13 @@ size_t mbrlen(const char *__restrict mbs, size_t mb_limit, mbstate_t *__restrict - - mlibc::code_seq nseq{mbs, mbs + mb_limit}; - mlibc::code_seq wseq{&wc, &wc + 1}; -- if(auto e = cc->decode_wtranscode(nseq, wseq, *stp); e != mlibc::charcode_error::null) -- __ensure(!"decode_wtranscode() errors are not handled"); -+ if(auto e = cc->decode_wtranscode(nseq, wseq, *stp); e != mlibc::charcode_error::null) { -+ if(e == mlibc::charcode_error::input_underflow) -+ return static_cast(-1); -+ __ensure(e == mlibc::charcode_error::illegal_input); -+ errno = EILSEQ; -+ return static_cast(-1); -+ } - return nseq.it - mbs; - } - diff --git mlibc-clean/options/glibc/generic/execinfo.cpp mlibc-workdir/options/glibc/generic/execinfo.cpp index 1ed110d..ded9114 100644 --- mlibc-clean/options/glibc/generic/execinfo.cpp @@ -218,140 +68,216 @@ index 1ed110d..ded9114 100644 - } +void backtrace_symbols_fd(void *const *, int, int) { } +diff --git mlibc-clean/options/internal/generic/global-config.cpp mlibc-workdir/options/internal/generic/global-config.cpp +index 3b7b862..3d86e7a 100644 +--- mlibc-clean/options/internal/generic/global-config.cpp ++++ mlibc-workdir/options/internal/generic/global-config.cpp +@@ -1,9 +1,15 @@ + #include +-#include ++#include + #include + + namespace mlibc { + ++namespace { ++ ++constinit mlibc::lazy_eternal globalConfigInstance; ++ ++} // namespace ++ + struct GlobalConfigGuard { + GlobalConfigGuard(); + }; +@@ -12,7 +18,7 @@ GlobalConfigGuard guard; + + GlobalConfigGuard::GlobalConfigGuard() { + // Force the config to be created during initialization of libc.so. +- mlibc::globalConfig(); ++ globalConfigInstance.get(); + } + + static bool envEnabled(const char *env) { +@@ -29,4 +35,8 @@ GlobalConfig::GlobalConfig() { + debugMonetaryLengths = envEnabled("MLIBC_DEBUG_MONETARY_LENGTHS"); + } + ++const GlobalConfig &globalConfig() { ++ return globalConfigInstance.get(); ++} ++ + } // namespace mlibc +diff --git mlibc-clean/options/internal/include/mlibc/allocator.hpp mlibc-workdir/options/internal/include/mlibc/allocator.hpp +index 852620a..a1bfb0a 100644 +--- mlibc-clean/options/internal/include/mlibc/allocator.hpp ++++ mlibc-workdir/options/internal/include/mlibc/allocator.hpp +@@ -3,6 +3,7 @@ + + #include + #include ++#include + #include + #include + +@@ -35,4 +36,34 @@ MemoryAllocator &getAllocator(); + + #endif // !MLIBC_DEBUG_ALLOCATOR + ++namespace mlibc { ++ ++template ++struct lazy_eternal { ++ constexpr lazy_eternal() = default; ++ ++ template ++ auto &get(this Self &&self) { ++ if (__atomic_load_n(&self.initialized_, __ATOMIC_ACQUIRE)) ++ return *self.box_.get(); ++ ++ { ++ frg::unique_lock lock{self.lock_}; ++ if (!__atomic_load_n(&self.initialized_, __ATOMIC_RELAXED)) { ++ self.box_.initialize(); ++ __atomic_store_n(&self.initialized_, 1, __ATOMIC_RELEASE); ++ } ++ } ++ ++ return *self.box_.get(); ++ } ++ ++private: ++ mutable uint32_t initialized_ = 0; ++ mutable FutexLock lock_; ++ mutable frg::manual_box box_; ++}; ++ ++} // namespace mlibc ++ + #endif // MLIBC_FRIGG_ALLOC +diff --git mlibc-clean/options/internal/include/mlibc/global-config.hpp mlibc-workdir/options/internal/include/mlibc/global-config.hpp +index 0235c54..3fad411 100644 +--- mlibc-clean/options/internal/include/mlibc/global-config.hpp ++++ mlibc-workdir/options/internal/include/mlibc/global-config.hpp +@@ -14,11 +14,8 @@ struct GlobalConfig { + bool debugMonetaryLengths; + }; + +-inline const GlobalConfig &globalConfig() { +- static GlobalConfig cached; +- return cached; +-} ++const GlobalConfig &globalConfig(); + +-} ++} // namespace mlibc + + #endif // MLIBC_GLOBAL_CONFIG +diff --git mlibc-clean/options/internal/include/mlibc/lock.hpp mlibc-workdir/options/internal/include/mlibc/lock.hpp +index f447741..ab44667 100644 +--- mlibc-clean/options/internal/include/mlibc/lock.hpp ++++ mlibc-workdir/options/internal/include/mlibc/lock.hpp +@@ -14,7 +14,7 @@ + + template + struct alignas(4) FutexLockImpl { +- FutexLockImpl() : _state{0}, _recursion{0} { } ++ constexpr FutexLockImpl() : _state{0}, _recursion{0} { } + + FutexLockImpl(const FutexLockImpl &) = delete; + +diff --git mlibc-clean/options/internal/include/mlibc/sysdep-signatures.hpp mlibc-workdir/options/internal/include/mlibc/sysdep-signatures.hpp +index d639e43..bff59a5 100644 +--- mlibc-clean/options/internal/include/mlibc/sysdep-signatures.hpp ++++ mlibc-workdir/options/internal/include/mlibc/sysdep-signatures.hpp +@@ -23,6 +23,10 @@ + + #include + ++#if __MLIBC_POSIX_OPTION ++#include ++#endif ++ + namespace mlibc { + + template +@@ -235,6 +239,7 @@ SYSDEP_FUNC(SetRegid, gid_t rgid, gid_t egid); + SYSDEP_FUNC(GetLoginR, char *name, size_t name_len); + SYSDEP_FUNC(IfIndextoname, unsigned int index, char *name); + SYSDEP_FUNC(IfNametoindex, const char *name, unsigned int *ret); ++SYSDEP_FUNC(IfNameindex, struct if_nameindex **ret); + SYSDEP_FUNC(Ptsname, int fd, char *buffer, size_t length); + SYSDEP_FUNC(Unlockpt, int fd); + SYSDEP_FUNC(ThreadSetname, void *tcb, const char *name); +diff --git mlibc-clean/options/internal/include/mlibc/sysdep-tags.hpp mlibc-workdir/options/internal/include/mlibc/sysdep-tags.hpp +index 17cf422..b90d201 100644 +--- mlibc-clean/options/internal/include/mlibc/sysdep-tags.hpp ++++ mlibc-workdir/options/internal/include/mlibc/sysdep-tags.hpp +@@ -476,6 +476,8 @@ struct GetLoginR {}; + struct IfIndextoname {}; + // int sys_if_nametoindex(const char *name, unsigned int *ret); + struct IfNametoindex {}; ++// int sys_if_nameindex(struct if_nameindex **ret); ++struct IfNameindex {}; + // int sys_ptsname(int fd, char *buffer, size_t length); + struct Ptsname {}; + // int sys_unlockpt(int fd); diff --git mlibc-clean/options/posix/generic/net-if.cpp mlibc-workdir/options/posix/generic/net-if.cpp -index 992aef7..e39c499 100644 +index ed0c463..8df2580 100644 --- mlibc-clean/options/posix/generic/net-if.cpp +++ mlibc-workdir/options/posix/generic/net-if.cpp -@@ -22,11 +22,18 @@ char *if_indextoname(unsigned int index, char *name) { +@@ -6,8 +6,13 @@ + #include + #include + +-void if_freenameindex(struct if_nameindex *) { +- mlibc::infoLogger() << "mlibc: if_freenameindex is a no-op" << frg::endlog; ++void if_freenameindex(struct if_nameindex *index) { ++ if(!index) ++ return; ++ ++ for(struct if_nameindex *it = index; it->if_index || it->if_name; ++it) ++ free(it->if_name); ++ free(index); + } + + char *if_indextoname(unsigned int index, char *name) { +@@ -20,9 +25,13 @@ char *if_indextoname(unsigned int index, char *name) { } struct if_nameindex *if_nameindex(void) { - mlibc::infoLogger() << "mlibc: if_nameindex() is a no-op" << frg::endlog; - errno = ENOSYS; - return nullptr; -+ auto sysdep = MLIBC_CHECK_OR_ENOSYS(mlibc::sys_if_nameindex, 0); -+ struct if_nameindex *ret = 0; -+ -+ if(int e = sysdep(&ret); e) { ++ struct if_nameindex *ret = nullptr; ++ if(int e = mlibc::sysdep_or_enosys(&ret); e) { + errno = e; -+ return 0; ++ return nullptr; + } + + return ret; } -+ unsigned int if_nametoindex(const char *name) { - auto sysdep = MLIBC_CHECK_OR_ENOSYS(mlibc::sys_if_nametoindex, 0); - unsigned int ret = 0; -diff --git mlibc-clean/options/posix/generic/netdb.cpp mlibc-workdir/options/posix/generic/netdb.cpp -index 299d9d3..d32237c 100644 ---- mlibc-clean/options/posix/generic/netdb.cpp -+++ mlibc-workdir/options/posix/generic/netdb.cpp -@@ -371,8 +371,8 @@ int gethostbyaddr_r(const void *__restrict, socklen_t, int, struct hostent *__re - - int gethostbyname_r(const char *__restrict, struct hostent *__restrict, char *__restrict, size_t, - struct hostent **__restrict, int *__restrict) { -- __ensure(!"Not implemented"); -- __builtin_unreachable(); -+ mlibc::infoLogger() << "gethostbyname_r is a stub!" << frg::endlog; -+ return -1; - } - - struct protoent *getprotobyname(const char *) { -diff --git mlibc-clean/options/posix/generic/utmpx.cpp mlibc-workdir/options/posix/generic/utmpx.cpp -index 2c6252c..1d9064c 100644 ---- mlibc-clean/options/posix/generic/utmpx.cpp -+++ mlibc-workdir/options/posix/generic/utmpx.cpp -@@ -77,10 +77,10 @@ void setutxent(void) { - } - - struct utmpx *getutxent(void) { -- frg::unique_lock lock{utmpxMutex}; -- - if(!utmpxFd) - setutxent(); -+ frg::unique_lock lock{utmpxMutex}; -+ - if(!utmpxFd) { - errno = ENOENT; - return nullptr; -@@ -95,10 +95,10 @@ struct utmpx *getutxent(void) { - } - - struct utmpx *pututxline(const struct utmpx *ut) { -- frg::unique_lock lock{utmpxMutex}; -- - if(!utmpxFd) - setutxent(); -+ frg::unique_lock lock{utmpxMutex}; -+ - if(!utmpxFd) { - errno = ENOENT; - return nullptr; -@@ -135,10 +135,10 @@ int utmpxname(const char *file) { - } - - struct utmpx *getutxid(const struct utmpx *ut) { -- frg::unique_lock lock{utmpxMutex}; -- - if(!utmpxFd) - setutxent(); -+ -+ frg::unique_lock lock{utmpxMutex}; - if(!utmpxFd) { - errno = ENOENT; - return nullptr; -@@ -153,10 +153,10 @@ struct utmpx *getutxid(const struct utmpx *ut) { - } - - struct utmpx *getutxline(const struct utmpx *ut) { -- frg::unique_lock lock{utmpxMutex}; -- - if(!utmpxFd) - setutxent(); -+ frg::unique_lock lock{utmpxMutex}; -+ - if(!utmpxFd) { - errno = ENOENT; - return nullptr; -diff --git mlibc-clean/options/posix/include/mlibc/posix-sysdeps.hpp mlibc-workdir/options/posix/include/mlibc/posix-sysdeps.hpp -index 3666050..ecfc1ae 100644 ---- mlibc-clean/options/posix/include/mlibc/posix-sysdeps.hpp -+++ mlibc-workdir/options/posix/include/mlibc/posix-sysdeps.hpp -@@ -230,6 +230,7 @@ int sys_vm_unmap(void *pointer, size_t size); - - [[gnu::weak]] int sys_if_indextoname(unsigned int index, char *name); - [[gnu::weak]] int sys_if_nametoindex(const char *name, unsigned int *ret); -+[[gnu::weak]] int sys_if_nameindex(struct if_nameindex **); - - [[gnu::weak]] int sys_ptsname(int fd, char *buffer, size_t length); - [[gnu::weak]] int sys_unlockpt(int fd); -diff --git mlibc-clean/options/rtld/generic/linker.cpp mlibc-workdir/options/rtld/generic/linker.cpp -index 07dbe11..3ece6ec 100644 ---- mlibc-clean/options/rtld/generic/linker.cpp -+++ mlibc-workdir/options/rtld/generic/linker.cpp -@@ -29,7 +29,7 @@ uintptr_t libraryBase = 0x41000000; - - constexpr bool verbose = false; - constexpr bool stillSlightlyVerbose = false; --constexpr bool logBaseAddresses = false; -+constexpr bool logBaseAddresses = true; - constexpr bool logRpath = false; - constexpr bool logLdPath = false; - constexpr bool logSymbolVersions = false; diff --git mlibc-clean/sysdeps/astral/generic/generic.cpp mlibc-workdir/sysdeps/astral/generic/generic.cpp -index 939925e..f8f8c8f 100644 +index 3b04372..a4b934a 100644 --- mlibc-clean/sysdeps/astral/generic/generic.cpp +++ mlibc-workdir/sysdeps/astral/generic/generic.cpp -@@ -1,4 +1,5 @@ +@@ -1,7 +1,9 @@ #include +#include #include #include #include -@@ -13,6 +14,16 @@ ++#include + #include + #include + #include +@@ -11,8 +13,20 @@ + #include + #include #include ++#include ++#include #include #include +#include @@ -366,21 +292,27 @@ index 939925e..f8f8c8f 100644 +} astral_net_info_t; namespace mlibc { - int sys_setgroups(size_t size, const gid_t *list) { -@@ -31,13 +42,216 @@ namespace mlibc { + int Sysdeps::operator()(size_t size, const gid_t *list) { +@@ -31,14 +45,214 @@ namespace mlibc { return 0; } -+ int sys_setxattr(const char *path, const char *name, +- int Sysdeps::operator()(int fd, int layer, int number, +- void *__restrict buffer, socklen_t *__restrict size) { ++ int Sysdeps::operator()(const char *path, const char *name, + const void *val, size_t size, int flags) { + (void)path; + (void)name; + (void)val; -+ (void)size; + (void)size; +- (void)buffer; +- // TODO unstub +- mlibc::infoLogger() << "getsockopt: " << fd << " " << layer << " " << number << frg::endlog; + (void)flags; + return ENOTSUP; + } -+ int sys_lsetxattr(const char *path, const char *name, ++ ++ int Sysdeps::operator()(const char *path, const char *name, + const void *val, size_t size, int flags) { + (void)path; + (void)name; @@ -390,7 +322,7 @@ index 939925e..f8f8c8f 100644 + return ENOTSUP; + } + -+ int sys_fsetxattr(int fd, const char *name, const void *val, ++ int Sysdeps::operator()(int fd, const char *name, const void *val, + size_t size, int flags) { + (void)fd; + (void)name; @@ -400,7 +332,7 @@ index 939925e..f8f8c8f 100644 + return ENOTSUP; + } + -+ int sys_getxattr(const char *path, const char *name, ++ int Sysdeps::operator()(const char *path, const char *name, + void *val, size_t size, ssize_t *nread) { + (void)path; + (void)name; @@ -410,7 +342,7 @@ index 939925e..f8f8c8f 100644 + return ENOTSUP; + } + -+ int sys_lgetxattr(const char *path, const char *name, ++ int Sysdeps::operator()(const char *path, const char *name, + void *val, size_t size, ssize_t *nread) { + (void)path; + (void)name; @@ -420,7 +352,7 @@ index 939925e..f8f8c8f 100644 + return ENOTSUP; + } + -+ int sys_fgetxattr(int fd, const char *name, void *val, ++ int Sysdeps::operator()(int fd, const char *name, void *val, + size_t size, ssize_t *nread) { + (void)fd; + (void)name; @@ -430,7 +362,7 @@ index 939925e..f8f8c8f 100644 + return ENOTSUP; + } + -+ int sys_listxattr(const char *path, char *list, size_t size, ++ int Sysdeps::operator()(const char *path, char *list, size_t size, + ssize_t *nread) { + (void)path; + (void)list; @@ -439,7 +371,7 @@ index 939925e..f8f8c8f 100644 + return ENOTSUP; + } + -+ int sys_llistxattr(const char *path, char *list, size_t size, ++ int Sysdeps::operator()(const char *path, char *list, size_t size, + ssize_t *nread) { + (void)path; + (void)list; @@ -448,7 +380,7 @@ index 939925e..f8f8c8f 100644 + return ENOTSUP; + } + -+ int sys_flistxattr(int fd, char *list, size_t size, ++ int Sysdeps::operator()(int fd, char *list, size_t size, + ssize_t *nread) { + (void)fd; + (void)list; @@ -459,43 +391,41 @@ index 939925e..f8f8c8f 100644 + +#ifndef MLIBC_BUILDING_RTLD + // XXX this might leak memory in case of an error. -+ int sys_getifaddrs(struct ifaddrs **out) { -+ struct ifaddrs *list = NULL; ++ int Sysdeps::operator()(struct ifaddrs **out) { ++ struct ifaddrs *list = nullptr; + + int dirfd; -+ int error = sys_open("/dev/", O_DIRECTORY | O_RDONLY, 0, &dirfd); -+ if (error) ++ int error = sysdep("/dev/", O_DIRECTORY | O_RDONLY, 0, &dirfd); ++ if(error) + return error; + -+ + struct dirent dent; + size_t bytes_read; -+ for (;;) { -+ error = sys_read_entries(dirfd, &dent, sizeof(dent), &bytes_read); -+ if (error) ++ for(;;) { ++ error = sysdep(dirfd, &dent, sizeof(dent), &bytes_read); ++ if(error) + goto leave; + -+ if (bytes_read == 0) ++ if(bytes_read == 0) + break; + + struct stat st; -+ if (sys_stat(fsfd_target::fd_path, dirfd, dent.d_name, AT_SYMLINK_NOFOLLOW, &st)) ++ if(sysdep(fsfd_target::fd_path, dirfd, dent.d_name, AT_SYMLINK_NOFOLLOW, &st)) + continue; + -+ // check if network device -+ if (!S_ISCHR(st.st_mode) || major(st.st_rdev) != 10) ++ if(!S_ISCHR(st.st_mode) || major(st.st_rdev) != 10) + continue; + + int fd; -+ error = sys_openat(dirfd, dent.d_name, 0, 0, &fd); -+ if (error) ++ error = sysdep(dirfd, dent.d_name, 0, 0, &fd); ++ if(error) + continue; + + astral_net_info_t net_info = {}; + int r; -+ error = sys_ioctl(fd, 0x1337631, &net_info, &r); -+ if (error) { -+ sys_close(fd); ++ error = sysdep(fd, 0x1337631, &net_info, &r); ++ if(error) { ++ sysdep(fd); + continue; + } + @@ -513,13 +443,13 @@ index 939925e..f8f8c8f 100644 + __ensure(next->ifa_addr); + memcpy(next->ifa_addr, &net_info.addr, sizeof(struct sockaddr)); + -+ if (net_info.netmask.sa_family) { ++ if(net_info.netmask.sa_family) { + next->ifa_netmask = (struct sockaddr *)malloc(sizeof(struct sockaddr)); + __ensure(next->ifa_netmask); + memcpy(next->ifa_netmask, &net_info.netmask, sizeof(struct sockaddr)); + } + -+ if (net_info.broadaddr.sa_family) { ++ if(net_info.broadaddr.sa_family) { + next->ifa_broadaddr = (struct sockaddr *)malloc(sizeof(struct sockaddr)); + __ensure(next->ifa_broadaddr); + memcpy(next->ifa_broadaddr, &net_info.broadaddr, sizeof(struct sockaddr)); @@ -528,35 +458,35 @@ index 939925e..f8f8c8f 100644 + next->ifa_data = nullptr; + + list = next; -+ sys_close(fd); ++ sysdep(fd); + } + + *out = list; + -+ leave: -+ sys_close(dirfd); ++leave: ++ sysdep(dirfd); + return error; + } + + // XXX extremely leaky. -+ int sys_if_nameindex(struct if_nameindex **out) { ++ int Sysdeps::operator()(struct if_nameindex **out) { + struct ifaddrs *ifaddrs; -+ if (int e = sys_getifaddrs(&ifaddrs); e) ++ if(int e = sysdep(&ifaddrs); e) + return e; + + struct ifaddrs *it = ifaddrs; + int count = 0; -+ while (it) { ++ while(it) { + ++count; + it = it->ifa_next; + } + + struct if_nameindex *arr = (struct if_nameindex *)malloc(sizeof(struct if_nameindex) * (count + 1)); -+ if (!arr) ++ if(!arr) + return ENOMEM; + + int i = 0; -+ while (ifaddrs) { ++ while(ifaddrs) { + arr[i].if_index = i + 1; + arr[i].if_name = strdup(ifaddrs->ifa_name); + __ensure(arr[i].if_name); @@ -571,36 +501,32 @@ index 939925e..f8f8c8f 100644 + + *out = arr; + -+ return 0; -+ } + return 0; + } +#endif + - int sys_getsockopt(int fd, int layer, int number, - void *__restrict buffer, socklen_t *__restrict size) { - (void)size; - (void)buffer; -- // TODO unstub -- mlibc::infoLogger() << "getsockopt: " << fd << " " << layer << " " << number << frg::endlog; -- return 0; ++ int Sysdeps::operator()(int fd, int layer, int number, ++ void *__restrict buffer, socklen_t *__restrict size) { + long ret; + return syscall(SYSCALL_GETSOCKOPT, &ret, fd, layer, number, (uint64_t)buffer, (uint64_t)size); - } ++ } - int sys_inet_configured(bool *ipv4, bool *ipv6) { + int Sysdeps::operator()(bool *ipv4, bool *ipv6) { + // there is no ipv6 support in the kernel currently and no way of checking for configured interfaces @@ -47,6 +261,71 @@ namespace mlibc { return 0; } -+ int sys_unlockpt(int fd) { ++ int Sysdeps::operator()(int fd) { + int r; + // unlockpt is a no-op kernel side, so use this to check for an invalid pty -+ return sys_ioctl(fd, 0x13376167, NULL, &r); ++ return sysdep(fd, 0x13376167, nullptr, &r); + } + -+ int sys_statfs(const char *path, struct statfs *buf) { ++ int Sysdeps::operator()(const char *path, struct statfs *buf) { + struct statvfs stvfs; -+ int ret = sys_statvfs(path, &stvfs); -+ if (ret) ++ int ret = sysdep(path, &stvfs); ++ if(ret) + return ret; + + buf->f_type = 0; /* statvfs has no f_type */ @@ -619,10 +545,10 @@ index 939925e..f8f8c8f 100644 + return 0; + } + -+ int sys_fstatfs(int fd, struct statfs *buf) { ++ int Sysdeps::operator()(int fd, struct statfs *buf) { + struct statvfs stvfs; -+ int ret = sys_fstatvfs(fd, &stvfs); -+ if (ret) ++ int ret = sysdep(fd, &stvfs); ++ if(ret) + return ret; + + buf->f_type = 0; /* statvfs has no f_type */ @@ -641,38 +567,55 @@ index 939925e..f8f8c8f 100644 + return 0; + } + -+ int sys_statvfs(const char *path, struct statvfs *out) { ++ int Sysdeps::operator()(const char *path, struct statvfs *out) { + long r; + return syscall(SYSCALL_FSTATVFSAT, &r, AT_FDCWD, (uint64_t)path, (uint64_t)out, 0); + } + -+ int sys_fstatvfs(int fd, struct statvfs *out) { ++ int Sysdeps::operator()(int fd, struct statvfs *out) { + long r; + return syscall(SYSCALL_FSTATVFS, &r, fd, (uint64_t)out); + } + -+ void sys_yield() { ++ void Sysdeps::operator()() { + long r; + syscall(SYSCALL_YIELD, &r); + } + - int sys_readv(int fd, const struct iovec *iovs, int iovc, ssize_t *bytes_read) { + int Sysdeps::operator()(int fd, const struct iovec *iovs, int iovc, ssize_t *bytes_read) { long r; int error = syscall(SYSCALL_READV, &r, fd, (uint64_t)iovs, iovc); @@ -489,6 +768,7 @@ namespace mlibc { - int sys_setsockopt(int fd, int layer, int number, const void *buffer, socklen_t size) { + int Sysdeps::operator()(int fd, int layer, int number, const void *buffer, socklen_t size) { long ret; + mlibc::infoLogger() << "setsockopt: fd " << fd << " layer " << layer << " number " << number << frg::endlog; return syscall(SYSCALL_SETSOCKOPT, &ret, fd, layer, number, (uint64_t)buffer, size); } -@@ -932,4 +1212,13 @@ namespace mlibc { +@@ -562,6 +842,16 @@ namespace mlibc { + return sysdep(fd, TCSETS, (void *)attr, &res); + } + ++ int Sysdeps::operator()(int fd, struct winsize *winsz) { ++ int res; ++ return sysdep(fd, TIOCGWINSZ, (void *)winsz, &res); ++ } ++ ++ int Sysdeps::operator()(int fd, const struct winsize *winsz) { ++ int res; ++ return sysdep(fd, TIOCSWINSZ, (void *)winsz, &res); ++ } ++ + int Sysdeps::operator()(struct pollfd *fds, nfds_t count, int timeout, int *num_events) { + long ret; + long error = syscall(SYSCALL_POLL, &ret, (uint64_t)fds, count, timeout); +@@ -932,4 +1222,13 @@ namespace mlibc { *nanos = ts.tv_nsec; return err; } + -+ int sys_clock_getres(int clock, time_t *secs, long *nanos) { ++ int Sysdeps::operator()(int clock, time_t *secs, long *nanos) { + struct timespec ts; + long ret; + int err = syscall(SYSCALL_CLOCK_GETRES, &ret, clock, (uint64_t)&ts); @@ -719,3 +662,50 @@ index a6c4067..f1e0b65 100644 #ifndef __MLIBC_ABI_ONLY +diff --git mlibc-clean/sysdeps/astral/include/mlibc/sysdeps.hpp mlibc-workdir/sysdeps/astral/include/mlibc/sysdeps.hpp +index ce91084..e7e9b6d 100644 +--- mlibc-clean/sysdeps/astral/include/mlibc/sysdeps.hpp ++++ mlibc-workdir/sysdeps/astral/include/mlibc/sysdeps.hpp +@@ -7,8 +7,25 @@ namespace mlibc { + struct AstralSysdepTags : + SetGroups, + GetGroups, ++ Setxattr, ++ Lsetxattr, ++ Fsetxattr, ++ Getxattr, ++ Lgetxattr, ++ Fgetxattr, ++ Listxattr, ++ Llistxattr, ++ Flistxattr, ++ Getifaddrs, ++ IfNameindex, + GetSockopt, + InetConfigured, ++ Unlockpt, ++ Statfs, ++ Fstatfs, ++ Statvfs, ++ Fstatvfs, ++ Yield, + Readv, + Writev, + Sysinfo, +@@ -85,6 +102,8 @@ struct AstralSysdepTags : + Sleep, + Tcgetattr, + Tcsetattr, ++ Tcgetwinsize, ++ Tcsetwinsize, + Poll, + Ppoll, + Pselect, +@@ -135,6 +154,7 @@ struct AstralSysdepTags : + VmUnmap, + Isatty, + ClockGet, ++ ClockGetres, + PrepareStack + {}; + diff --git a/recipes/bash b/recipes/bash index 15ca83ee..3a594b4f 100644 --- a/recipes/bash +++ b/recipes/bash @@ -7,7 +7,7 @@ deps="readline base" configure() { cp -rp ${source_dir}/* . - ./configure --host=x86_64-astral --prefix=${prefix} --without-bash-malloc + CFLAGS_FOR_BUILD="-std=gnu17 -g" ./configure --host=x86_64-astral --prefix=${prefix} --without-bash-malloc } build() { diff --git a/recipes/glib b/recipes/glib index a530eeff..a8fcb0e6 100644 --- a/recipes/glib +++ b/recipes/glib @@ -2,8 +2,8 @@ name=glib revision=1 from_source=glib imagedeps="gcc meson ninja-build" -hostdeps="xgcc xbinutils pkgconfig automake autoconf util-macros libtool" -deps="base libiconv pcre2 libffi libintl" +hostdeps="xgcc xbinutils libstdc++-v3 pkgconfig automake autoconf util-macros libtool" +deps="base pcre2 libffi" configure() { meson --cross-file ${base_dir}/util/crossfile --prefix=${prefix} --buildtype=release -Dxattr=false ${source_dir} diff --git a/recipes/gnutls b/recipes/gnutls index 5881842b..a41b5384 100644 --- a/recipes/gnutls +++ b/recipes/gnutls @@ -1,12 +1,13 @@ name=gnutls revision=1 from_source=gnutls -imagedeps="build-essential automake-1.16 autoconf" +imagedeps="build-essential automake autoconf" hostdeps="xgcc xbinutils libtool pkgconfig libstdc++-v3" deps="base nettle make-ca libunistring libtasn1 p11-kit zlib zstd" configure() { cp -rp ${source_dir}/* . + sed -i 's/sortix/astral/g' ./build-aux/config.sub ./configure --prefix=${prefix} --host=x86_64-astral --docdir=${prefix}/share/doc/gnutls-3.8.10 --with-default-trust-store-pkcs11="pkcs11:" --disable-static --enable-shared } diff --git a/recipes/openal b/recipes/openal index b89e58b9..5950ad47 100644 --- a/recipes/openal +++ b/recipes/openal @@ -1,8 +1,8 @@ name=openal revision=1 from_source=openal -imagedeps="build-essential cmake" -hostdeps="xgcc xbinutils libstdc++-v3 pkgconfig" +imagedeps="build-essential" +hostdeps="xgcc xbinutils libstdc++-v3 pkgconfig cmake" deps="base alsa-lib" configure() { diff --git a/recipes/qemu b/recipes/qemu index 2c6f93cc..0ff43fdc 100644 --- a/recipes/qemu +++ b/recipes/qemu @@ -1,7 +1,7 @@ name=qemu revision=1 from_source=qemu -imagedeps="build-essential python3-venv python3-sphinx ninja-build meson git" +imagedeps="build-essential python3-pip python3-venv python3-distlib python3-sphinx ninja-build meson git" hostdeps="xgcc xbinutils pkgconfig libtool" deps="base sdl2 glib libiconv libintl" allow_network="yes" diff --git a/recipes/wine b/recipes/wine index 5431049e..8383b6e9 100644 --- a/recipes/wine +++ b/recipes/wine @@ -2,7 +2,7 @@ name=wine revision=1 from_source=wine imagedeps="build-essential mingw-w64" -hostdeps="xgcc xbinutils pkgconfig wine freetype" +hostdeps="xgcc xbinutils pkgconfig libtool wine freetype" deps="base libxcursor libxfixes libxi libxrandr libxrender libxxf86vm libx11 libxext mesa fontconfig sdl2 freetype glib xorgproto openssl gnutls" configure() { diff --git a/source-recipes/bash b/source-recipes/bash index 2be96c6a..d3dabbcb 100644 --- a/source-recipes/bash +++ b/source-recipes/bash @@ -1,8 +1,8 @@ name=bash -version=5.1 +version=5.3 source_method=tarball tarball_url="https://ftpmirror.gnu.org/gnu/bash/bash-${version}.tar.gz" -tarball_sha512=c44a0ce381469219548a3a27589af3fea4f22eda1ca4e9434b59fc16da81b471c29ce18e31590e0860a6a251a664b68c2b45e3a17d22cfc02799ffd9a208390c +tarball_sha512=426702c8b0fb9e0c9956259973ce5b657890fd47f4f807a64febf20077bb48d0b91474ed6e843d2ef277186b46c5fffa79b808da9b48d4ec027d5e2de1b28ed8 prepare() { true diff --git a/source-recipes/frigg b/source-recipes/frigg index dea8018f..d544e3e4 100644 --- a/source-recipes/frigg +++ b/source-recipes/frigg @@ -1,9 +1,5 @@ name=frigg -version=6355f7677fa39156aeb77603d246d977531e28ee +version=d79bfd49fcd1458dbe8a5f3c10880800b108cc14 source_method=tarball tarball_url="https://github.com/managarm/frigg/archive/${version}.tar.gz" -tarball_sha512=48bba34936929886bb240758bcd8b8bf2408152a56172a1cbbcca05ee76bc55f04b3c8cb7a11cdb1e5f1017fd4557ca8e23585b3735182796935f78c3aa7f13f - -prepare() { - true -} +tarball_sha512=6f6927b7a9d14cbe5bac7c6a6faf2ff82edcb0e70223e1a3086a43cc25e1e6a544e49f32a3e201bb03e682e1bf5c1a8fd978e5314ea8b0e06aa46503c82987cf diff --git a/source-recipes/gnutls b/source-recipes/gnutls index 8d3ac9aa..e99ef37b 100644 --- a/source-recipes/gnutls +++ b/source-recipes/gnutls @@ -4,8 +4,7 @@ source_method=tarball tarball_url="https://www.gnupg.org/ftp/gcrypt/gnutls/v3.8/gnutls-${version}.tar.xz" tarball_sha512="d453bd4527af95cb3905ce8753ceafd969e3f442ad1d148544a233ebf13285b999930553a805a0511293cc25390bb6a040260df5544a7c55019640f920ad3d92" imagedeps="autoconf automake gtk-doc-tools" -hostdeps="libtool pkgconfig automake" +hostdeps="libtool" prepare() { autoreconf -fvi - cp -v $(find /usr/local/share/automake* -name config.sub) build-aux } diff --git a/source-recipes/mlibc b/source-recipes/mlibc index ea929e88..bf056660 100644 --- a/source-recipes/mlibc +++ b/source-recipes/mlibc @@ -1,8 +1,8 @@ name=mlibc -version=d6a7ab7b9a17e3b8e40ba32dd41a9dc7c394434e +version=5ded28c8e7255aba28436acdd1107d9a5092ce86 source_method=tarball tarball_url="https://github.com/managarm/mlibc/archive/${version}.tar.gz" -tarball_sha512="6f96f66a3840e70c24a68f39fe438ba12ee64120921278572579958b34e37398872a049acaf0385907c33441c105b2cb2b7664bfbb5b7529a750bff892787ee9" +tarball_sha512="e5a4aa35e7a07417c4710cb223cbe45f28b948a755c5a9a6be0e8df45507b2b127f3ba024e6f96681e9bd18e314066c555f1c14d367e029b8292084bd07cb76b" prepare() { true diff --git a/source-recipes/xneko b/source-recipes/xneko index bc37b4ac..a374bef1 100644 --- a/source-recipes/xneko +++ b/source-recipes/xneko @@ -1,7 +1,7 @@ name=xneko version=1.4 source_method=tarball -tarball_url="https://astral-os.org/mirror/xneko.tar.gz" +tarball_url="http://astral-os.org/mirror/xneko.tar.gz" tarball_sha512=7e2429f8a66ecfe342e3df907ccd6b4f5378a3441ec05aaf4cbb3cae67e95ea1ac4427abad400704f489619d0dd107ae5b58dc8bdba09a4a05d8332c33a06a6f prepare() { true