Red Bear OS — microkernel OS in Rust, based on Redox
Derivative of Redox OS (https://www.redox-os.org) adding: - AMD GPU driver (amdgpu) via LinuxKPI compat layer - ext4 filesystem support (ext4d scheme daemon) - ACPI fixes for AMD bare metal (x2APIC, DMAR, IVRS, MCFG) - Custom branding (hostname, os-release, boot identity) Build system is full upstream Redox with RBOS overlay in local/. Patches for kernel, base, and relibc are symlinked from local/patches/ and protected from make clean/distclean. Custom recipes live in local/recipes/ with symlinks into the recipes/ search path. Build: make all CONFIG_NAME=redbear-full Sync: ./local/scripts/sync-upstream.sh
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
[source]
|
||||
tar = "https://ftp.gnu.org/gnu/autoconf/autoconf-2.71.tar.xz"
|
||||
blake3 = "da1cc8af8551c343de9f42af0ae53fd7dff3623487157623892b6cd7e3bb5692"
|
||||
|
||||
[build]
|
||||
template = "configure"
|
||||
|
||||
[package]
|
||||
dependencies = ["perl5"]
|
||||
@@ -0,0 +1,9 @@
|
||||
[source]
|
||||
tar = "https://ftp.gnu.org/gnu/automake/automake-1.16.5.tar.xz"
|
||||
blake3 = "f42cfc333aaaa11f2bcb05b5b0273b8706c820c22f9ba4367f7eb920551695cd"
|
||||
|
||||
[build]
|
||||
template = "configure"
|
||||
|
||||
[package]
|
||||
dependencies = ["perl5"]
|
||||
@@ -0,0 +1,30 @@
|
||||
[source]
|
||||
git = "https://gitlab.redox-os.org/redox-os/binutils-gdb"
|
||||
branch = "redox-2.43.1"
|
||||
shallow_clone = true
|
||||
|
||||
[build]
|
||||
template = "custom"
|
||||
dependencies = [
|
||||
"libgmp",
|
||||
"libmpfr",
|
||||
# TODO: this zlib get linked when boostrapping binutils
|
||||
# "zlib"
|
||||
]
|
||||
script = """
|
||||
DYNAMIC_INIT
|
||||
|
||||
if [ "${COOKBOOK_HOST_SYSROOT}" = "/usr" ]; then
|
||||
# not specifying --enable-shared as it will link shared deps
|
||||
COOKBOOK_CONFIGURE_FLAGS=( --prefix=/usr --host="${GNU_TARGET}" --program-prefix="${COOKBOOK_CROSS_GNU_TARGET:-$GNU_TARGET}-" )
|
||||
fi
|
||||
|
||||
COOKBOOK_CONFIGURE_FLAGS+=(
|
||||
--target="${COOKBOOK_CROSS_GNU_TARGET:-$GNU_TARGET}"
|
||||
--enable-default-hash-style=gnu
|
||||
--disable-werror
|
||||
# --with-system-zlib
|
||||
)
|
||||
|
||||
cookbook_configure
|
||||
"""
|
||||
@@ -0,0 +1,90 @@
|
||||
[source]
|
||||
same_as = "../llvm21"
|
||||
|
||||
[build]
|
||||
template = "custom"
|
||||
dependencies = [
|
||||
"llvm21",
|
||||
]
|
||||
dev-dependencies = [
|
||||
"libstdcxx", # no idea
|
||||
"llvm21.dev",
|
||||
"llvm21.runtime",
|
||||
"host:xz",
|
||||
"host:libarchive", # workaround for cmake error
|
||||
]
|
||||
script = """
|
||||
DYNAMIC_INIT
|
||||
ARCH="$(echo "${TARGET}" | cut -d - -f1)"
|
||||
|
||||
generate_cookbook_cmake_file "$COOKBOOK_HOST_TARGET" "" "$COOKBOOK_TOOLCHAIN" native.cmake
|
||||
|
||||
COOKBOOK_CMAKE_FLAGS+=(
|
||||
-DLLVM_ROOT="${COOKBOOK_SYSROOT}"
|
||||
-DCLANG_LINK_CLANG_DYLIB=ON
|
||||
-DLIBCLANG_BUILD_STATIC=1
|
||||
-DLLVM_BUILD_UTILS=On
|
||||
|
||||
# the shared options from llvm
|
||||
-DCMAKE_CXX_FLAGS="--std=gnu++11"
|
||||
-DBUILD_SHARED_LIBS=False
|
||||
-DLLVM_BUILD_EXAMPLES=Off
|
||||
-DLLVM_BUILD_TESTS=Off
|
||||
-DLLVM_DEFAULT_TARGET_TRIPLE="${TARGET}"
|
||||
-DLLVM_ENABLE_LTO=Off
|
||||
-DLLVM_ENABLE_RTTI=On
|
||||
-DLLVM_ENABLE_THREADS=On
|
||||
-DLLVM_INCLUDE_EXAMPLES=Off
|
||||
-DLLVM_INCLUDE_TESTS=Off
|
||||
-DLLVM_OPTIMIZED_TABLEGEN=On
|
||||
-DLLVM_TARGET_ARCH=$ARCH
|
||||
-DLLVM_TOOLS_INSTALL_DIR=bin
|
||||
-DLLVM_UTILS_INSTALL_DIR=bin
|
||||
-DUNIX=1
|
||||
)
|
||||
|
||||
COOKBOOK_SOURCE="$COOKBOOK_SOURCE/clang"
|
||||
|
||||
if [ "$TARGET" = "$COOKBOOK_HOST_TARGET" ]; then
|
||||
|
||||
COOKBOOK_CMAKE_FLAGS+=( -DLLVM_TABLEGEN_EXE=${COOKBOOK_TOOLCHAIN}/bin/llvm-tblgen )
|
||||
|
||||
"${COOKBOOK_CMAKE}" "${COOKBOOK_SOURCE}" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_INCLUDEDIR=include \
|
||||
-DCMAKE_INSTALL_LIBDIR=lib \
|
||||
-DCMAKE_INSTALL_OLDINCLUDEDIR=/include \
|
||||
-DCMAKE_INSTALL_PREFIX=/usr \
|
||||
-DCMAKE_INSTALL_SBINDIR=bin \
|
||||
-DCMAKE_TOOLCHAIN_FILE=native.cmake \
|
||||
-GNinja \
|
||||
-Wno-dev \
|
||||
"${COOKBOOK_CMAKE_FLAGS[@]}" \
|
||||
"$@"
|
||||
|
||||
# All distros use clever tricks to this problem. I have no idea how I came up with this
|
||||
export PATH="$PATH:$COOKBOOK_STAGE/usr/bin"
|
||||
DESTDIR="${COOKBOOK_STAGE}" "${COOKBOOK_NINJA}" install-clang-tblgen
|
||||
"${COOKBOOK_NINJA}" -j"${COOKBOOK_MAKE_JOBS}"
|
||||
DESTDIR="${COOKBOOK_STAGE}" "${COOKBOOK_NINJA}" install -j"${COOKBOOK_MAKE_JOBS}"
|
||||
|
||||
else
|
||||
|
||||
COOKBOOK_CMAKE_FLAGS+=(
|
||||
-DCROSS_TOOLCHAIN_FLAGS_NATIVE="-DCMAKE_TOOLCHAIN_FILE=$(realpath native.cmake)"
|
||||
-DCLANG_TABLEGEN_EXE=${COOKBOOK_HOST_SYSROOT}/bin/clang-tblgen
|
||||
-DLLVM_TABLEGEN_EXE=${COOKBOOK_HOST_SYSROOT}/bin/llvm-tblgen
|
||||
)
|
||||
cookbook_cmake
|
||||
|
||||
fi
|
||||
|
||||
"""
|
||||
|
||||
[[optional-packages]]
|
||||
name = "dev"
|
||||
files = [
|
||||
"usr/include/clang*/**",
|
||||
"usr/lib/libclang*.a",
|
||||
"usr/lib/cmake/clang/**",
|
||||
]
|
||||
@@ -0,0 +1,43 @@
|
||||
[source]
|
||||
tar = "https://github.com/Kitware/CMake/releases/download/v4.0.3/cmake-4.0.3.tar.gz"
|
||||
|
||||
[build]
|
||||
template = "custom"
|
||||
dependencies = [
|
||||
"bzip2",
|
||||
# "cppdap",
|
||||
"curl",
|
||||
"expat",
|
||||
# "form",
|
||||
# "jsoncpp",
|
||||
"libarchive",
|
||||
# "liblzma",
|
||||
# "librhash",
|
||||
"libuv",
|
||||
"nghttp2",
|
||||
"openssl1",
|
||||
"zlib",
|
||||
"zstd",
|
||||
]
|
||||
script = """
|
||||
DYNAMIC_INIT
|
||||
|
||||
COOKBOOK_CMAKE_FLAGS+=(
|
||||
-DBUILD_TESTING=Off
|
||||
-DCMAKE_USE_SYSTEM_BZIP2=On
|
||||
-DCMAKE_USE_SYSTEM_CURL=On
|
||||
-DCMAKE_USE_SYSTEM_EXPAT=On
|
||||
-DCMAKE_USE_SYSTEM_LIBARCHIVE=On
|
||||
-DCMAKE_USE_SYSTEM_LIBUV=On
|
||||
-DCMAKE_USE_SYSTEM_NGHTTP2=On
|
||||
-DCMAKE_USE_SYSTEM_ZLIB=On
|
||||
-DCMAKE_USE_SYSTEM_ZSTD=On
|
||||
)
|
||||
cookbook_cmake
|
||||
set -x
|
||||
mv -vT "${COOKBOOK_STAGE}"/usr/bin "${COOKBOOK_STAGE}/bin"
|
||||
mv -vT "${COOKBOOK_STAGE}"/usr/share "${COOKBOOK_STAGE}/share"
|
||||
rm -rf "${COOKBOOK_STAGE}"/usr/doc
|
||||
rmdir -v "${COOKBOOK_STAGE}"/usr
|
||||
set +x
|
||||
"""
|
||||
@@ -0,0 +1,9 @@
|
||||
#TODO must be run using `php $(which composer)`
|
||||
[build]
|
||||
template = "custom"
|
||||
script = """
|
||||
mkdir -p "${COOKBOOK_STAGE}"/usr/bin
|
||||
wget -c https://getcomposer.org/download/2.8.12/composer.phar
|
||||
chmod a+x composer.phar
|
||||
cp composer.phar ${COOKBOOK_STAGE}/usr/bin/composer
|
||||
"""
|
||||
@@ -0,0 +1,11 @@
|
||||
[source]
|
||||
git = "https://github.com/rust-lang/crates.io-index.git"
|
||||
shallow_clone = true
|
||||
|
||||
[build]
|
||||
template = "custom"
|
||||
script = """
|
||||
dir="${COOKBOOK_STAGE}/home/user/.cargo/registry/index/github.com-1ecc6299db9ec823"
|
||||
mkdir -pv "${dir}"
|
||||
cp -rv "${COOKBOOK_SOURCE}/.git" "${dir}"
|
||||
"""
|
||||
@@ -0,0 +1,20 @@
|
||||
[source]
|
||||
tar = "https://www.freedesktop.org/software/fontconfig/release/fontconfig-2.16.0.tar.xz"
|
||||
blake3 = "5c95d48f5b9150f4a06d8acac12c25edaac956007df95a3bf527df02a5908f0e"
|
||||
patches = [
|
||||
"redox.patch"
|
||||
]
|
||||
[build]
|
||||
template = "meson"
|
||||
dependencies = [
|
||||
"expat",
|
||||
"freetype2",
|
||||
"libpng",
|
||||
"zlib",
|
||||
]
|
||||
dev-dependencies = [
|
||||
"host:gperf"
|
||||
]
|
||||
mesonflags = [
|
||||
"-Ddoc=disabled"
|
||||
]
|
||||
@@ -0,0 +1,33 @@
|
||||
diff -ruwN source/src/fccache.c source-new/src/fccache.c
|
||||
--- source/src/fccache.c 2019-06-10 05:36:37.000000000 -0600
|
||||
+++ source-new/src/fccache.c 2019-10-02 19:48:10.459642095 -0600
|
||||
@@ -1526,7 +1526,7 @@
|
||||
#if defined(_WIN32)
|
||||
if (_locking (fd, _LK_LOCK, 1) == -1)
|
||||
goto bail;
|
||||
-#else
|
||||
+#elif !defined(__redox__)
|
||||
struct flock fl;
|
||||
|
||||
fl.l_type = F_WRLCK;
|
||||
@@ -1556,7 +1556,7 @@
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
_locking (fd, _LK_UNLCK, 1);
|
||||
-#else
|
||||
+#elif !defined(__redox__)
|
||||
struct flock fl;
|
||||
|
||||
fl.l_type = F_UNLCK;
|
||||
diff -ruwN source/src/fccharset.c source-new/src/fccharset.c
|
||||
--- source/src/fccharset.c 2018-06-05 04:36:38.000000000 -0600
|
||||
+++ source-new/src/fccharset.c 2019-10-02 19:48:53.082862133 -0600
|
||||
@@ -600,7 +600,7 @@
|
||||
static FcChar32
|
||||
FcCharSetPopCount (FcChar32 c1)
|
||||
{
|
||||
-#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
|
||||
+#if !defined(__redox__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
|
||||
return __builtin_popcount (c1);
|
||||
#else
|
||||
/* hackmem 169 */
|
||||
@@ -0,0 +1,108 @@
|
||||
[source]
|
||||
git = "https://gitlab.redox-os.org/redox-os/gcc"
|
||||
branch = "redox-13.2.0"
|
||||
shallow_clone = true
|
||||
script = """
|
||||
DYNAMIC_INIT
|
||||
COOKBOOK_AUTORECONF=autoreconf2.69 autotools_recursive_regenerate -I"$(realpath ./config)"
|
||||
LIBTOOL_BUILD_AUX="${COOKBOOK_LIBTOOL_DIR:-$COOKBOOK_HOST_SYSROOT}"/share/libtool/build-aux
|
||||
cp -fpv "$LIBTOOL_BUILD_AUX"/{config.sub,config.guess,install-sh} libiberty/
|
||||
"""
|
||||
|
||||
[build]
|
||||
template = "custom"
|
||||
dependencies = [
|
||||
"libgmp",
|
||||
"libmpfr",
|
||||
"mpc",
|
||||
# TODO: this zlib get linked when boostrapping gcc
|
||||
# "zlib"
|
||||
]
|
||||
script = """
|
||||
DYNAMIC_STATIC_INIT
|
||||
CROSS_GNU_TARGET=${COOKBOOK_CROSS_GNU_TARGET:-$GNU_TARGET}
|
||||
|
||||
if [ "${COOKBOOK_HOST_SYSROOT}" = "/usr" ]; then
|
||||
# not specifying --enable-shared as it will link shared deps
|
||||
COOKBOOK_STAGE+="/usr"
|
||||
COOKBOOK_CONFIGURE_FLAGS=(
|
||||
--prefix=""
|
||||
--host="${GNU_TARGET}"
|
||||
--program-prefix="${CROSS_GNU_TARGET}-"
|
||||
--with-native-system-header-dir="/include"
|
||||
--disable-hosted-libstdcxx
|
||||
--with-sysroot
|
||||
--with-build-sysroot="${COOKBOOK_CROSS_SYSROOT:-$COOKBOOK_SYSROOT}"
|
||||
--disable-bootstrap
|
||||
)
|
||||
else
|
||||
export CFLAGS_FOR_TARGET="${CPPFLAGS}" CXXFLAGS_FOR_TARGET="${CPPFLAGS}" LDFLAGS_FOR_TARGET="${LDFLAGS}"
|
||||
export CC_FOR_BUILD="$CC_WRAPPER gcc" CXX_FOR_BUILD="$CC_WRAPPER g++"
|
||||
unset CFLAGS CPPFLAGS LDFLAGS
|
||||
COOKBOOK_CONFIGURE_FLAGS+=(
|
||||
--with-sysroot=/
|
||||
--with-gmp="${COOKBOOK_SYSROOT}/usr"
|
||||
--with-mpfr="${COOKBOOK_SYSROOT}/usr"
|
||||
--with-mpc="${COOKBOOK_SYSROOT}/usr"
|
||||
)
|
||||
fi
|
||||
|
||||
if [ "${CROSS_GNU_TARGET}" = "riscv64gc-unknown-redox" ]; then
|
||||
COOKBOOK_CONFIGURE_FLAGS+=(
|
||||
--with-arch=rv64gc
|
||||
--with-abi=lp64d
|
||||
)
|
||||
fi
|
||||
|
||||
if [ "${CROSS_GNU_TARGET}" != "i586-unknown-redox" ]; then
|
||||
COOKBOOK_CONFIGURE_FLAGS+=(
|
||||
--enable-frame-pointer
|
||||
)
|
||||
fi
|
||||
|
||||
COOKBOOK_CONFIGURE_FLAGS+=(
|
||||
--target="${CROSS_GNU_TARGET}"
|
||||
--with-linker-hash-style=gnu
|
||||
--enable-languages=c,c++,lto
|
||||
--enable-initfini-array
|
||||
--disable-nls
|
||||
--disable-multilib
|
||||
# --with-system-zlib
|
||||
--enable-host-shared
|
||||
--enable-threads=posix
|
||||
--enable-libstdcxx-threads
|
||||
--with-bugurl="https://gitlab.redox-os.org/redox-os/gcc/-/issues"
|
||||
)
|
||||
|
||||
"${COOKBOOK_CONFIGURE}" "${COOKBOOK_CONFIGURE_FLAGS[@]}"
|
||||
"${COOKBOOK_MAKE}" -j "${COOKBOOK_MAKE_JOBS}" all-gcc
|
||||
"${COOKBOOK_MAKE}" install-gcc DESTDIR="${COOKBOOK_STAGE}"
|
||||
|
||||
# requires relibc which is not available on bootstrapping
|
||||
if [ "${COOKBOOK_HOST_SYSROOT}" != "/usr" ]; then
|
||||
|
||||
"${COOKBOOK_MAKE}" -j "${COOKBOOK_MAKE_JOBS}" all-target-libgcc all-target-libstdc++-v3
|
||||
"${COOKBOOK_MAKE}" install-target-libgcc install-target-libstdc++-v3 DESTDIR="${COOKBOOK_STAGE}"
|
||||
ln -s "gcc" "${COOKBOOK_STAGE}/usr/bin/cc"
|
||||
# Avoid conflict with libgcc & libstdcxx
|
||||
rm -f "${COOKBOOK_STAGE}"/usr/lib/libgcc_s.so* "${COOKBOOK_STAGE}"/usr/lib/libstdc++.so*
|
||||
|
||||
fi
|
||||
"""
|
||||
|
||||
[package]
|
||||
dependencies = [
|
||||
"gnu-binutils"
|
||||
]
|
||||
|
||||
[[optional-packages]]
|
||||
name = "cxx"
|
||||
dependencies = []
|
||||
files = [
|
||||
"usr/bin/*c++",
|
||||
"usr/bin/*g++",
|
||||
"usr/include/c++/**",
|
||||
"usr/lib/*c++*",
|
||||
"usr/libexec/gcc/**/cc1plus",
|
||||
"usr/share/gcc-*/python/libstdcxx/**",
|
||||
]
|
||||
@@ -0,0 +1,5 @@
|
||||
[source]
|
||||
git = "https://gitlab.redox-os.org/redox-os/gdbserver.git"
|
||||
|
||||
[build]
|
||||
template = "cargo"
|
||||
@@ -0,0 +1,23 @@
|
||||
[source]
|
||||
tar = "https://ftp.gnome.org/pub/gnome/sources/gdk-pixbuf/2.44/gdk-pixbuf-2.44.4.tar.xz"
|
||||
blake3 = "94db7bebffbd6be84a1b58a05771e411e9f7c16b06d73fcedaf0e6c0e552be9c"
|
||||
|
||||
[build]
|
||||
dependencies = [
|
||||
"gettext",
|
||||
"glib",
|
||||
"libffi",
|
||||
"libiconv",
|
||||
"libjpeg",
|
||||
"libpng",
|
||||
"pcre2",
|
||||
"shared-mime-info",
|
||||
"zlib",
|
||||
]
|
||||
template = "meson"
|
||||
mesonflags = [
|
||||
"-Dbuiltin_loaders=all",
|
||||
"-Dinstalled_tests=false",
|
||||
"-Dman=false",
|
||||
"-Dtests=false",
|
||||
]
|
||||
@@ -0,0 +1,240 @@
|
||||
diff -ruwN git-2.13.1/compat/bswap.h source/compat/bswap.h
|
||||
--- git-2.13.1/compat/bswap.h 2017-06-04 19:08:11.000000000 -0600
|
||||
+++ source/compat/bswap.h 2025-04-24 11:20:06.475749424 -0600
|
||||
@@ -1,3 +1,7 @@
|
||||
+#if defined(__redox__)
|
||||
+#include <machine/endian.h>
|
||||
+#endif
|
||||
+
|
||||
/*
|
||||
* Let's make sure we always have a sane definition for ntohl()/htonl().
|
||||
* Some libraries define those as a function call, just to perform byte
|
||||
diff -ruwN git-2.13.1/compat/terminal.c source/compat/terminal.c
|
||||
--- git-2.13.1/compat/terminal.c 2017-06-04 19:08:11.000000000 -0600
|
||||
+++ source/compat/terminal.c 2025-04-18 10:00:11.318697446 -0600
|
||||
@@ -137,6 +137,18 @@
|
||||
return buf.buf;
|
||||
}
|
||||
|
||||
+#elif defined(__redox__)
|
||||
+
|
||||
+ssize_t __getline(char **lptr, size_t *n, FILE *fp);
|
||||
+
|
||||
+char *git_terminal_prompt(const char *prompt, int echo)
|
||||
+{
|
||||
+ char *line = NULL;
|
||||
+ size_t n = 0;
|
||||
+ __getline(&line, &n, stdin);
|
||||
+ return line; // XXX leak
|
||||
+}
|
||||
+
|
||||
#else
|
||||
|
||||
char *git_terminal_prompt(const char *prompt, int echo)
|
||||
diff -ruwN git-2.13.1/configure source/configure
|
||||
--- git-2.13.1/configure 2017-06-04 19:08:11.000000000 -0600
|
||||
+++ source/configure 2025-04-18 10:00:11.318697446 -0600
|
||||
@@ -6156,7 +6156,7 @@
|
||||
ac_res=$ac_cv_search_getaddrinfo
|
||||
if test "$ac_res" != no; then :
|
||||
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
|
||||
- NO_IPV6=
|
||||
+ NO_IPV6=YesPlease
|
||||
else
|
||||
NO_IPV6=YesPlease
|
||||
fi
|
||||
diff -ruwN git-2.13.1/daemon.c source/daemon.c
|
||||
--- git-2.13.1/daemon.c 2017-06-04 19:08:11.000000000 -0600
|
||||
+++ source/daemon.c 2025-04-18 10:00:11.319697447 -0600
|
||||
@@ -71,13 +71,21 @@
|
||||
return hi->ip_address.buf;
|
||||
}
|
||||
|
||||
+#if defined(__redox__)
|
||||
+#define LOG_ERR 0
|
||||
+#define LOG_INFO 1
|
||||
+#endif
|
||||
+
|
||||
static void logreport(int priority, const char *err, va_list params)
|
||||
{
|
||||
+#if !defined(__redox__)
|
||||
if (log_syslog) {
|
||||
char buf[1024];
|
||||
vsnprintf(buf, sizeof(buf), err, params);
|
||||
syslog(priority, "%s", buf);
|
||||
- } else {
|
||||
+ } else
|
||||
+#endif
|
||||
+ {
|
||||
/*
|
||||
* Since stderr is set to buffered mode, the
|
||||
* logging of different processes will not overlap
|
||||
@@ -888,8 +896,12 @@
|
||||
|
||||
if (!reuseaddr)
|
||||
return 0;
|
||||
+#if defined(__redox__)
|
||||
+ return 0;
|
||||
+#else
|
||||
return setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR,
|
||||
&on, sizeof(on));
|
||||
+#endif
|
||||
}
|
||||
|
||||
struct socketlist {
|
||||
@@ -1174,11 +1186,7 @@
|
||||
if (!group_name)
|
||||
c.gid = c.pass->pw_gid;
|
||||
else {
|
||||
- struct group *group = getgrnam(group_name);
|
||||
- if (!group)
|
||||
die("group not found - %s", group_name);
|
||||
-
|
||||
- c.gid = group->gr_gid;
|
||||
}
|
||||
|
||||
return &c;
|
||||
@@ -1348,10 +1356,12 @@
|
||||
usage(daemon_usage);
|
||||
}
|
||||
|
||||
+#if !defined(__redox__)
|
||||
if (log_syslog) {
|
||||
openlog("git-daemon", LOG_PID, LOG_DAEMON);
|
||||
set_die_routine(daemon_die);
|
||||
} else
|
||||
+#endif
|
||||
/* avoid splitting a message in the middle */
|
||||
setvbuf(stderr, NULL, _IOFBF, 4096);
|
||||
|
||||
diff -ruwN git-2.13.1/git-compat-util.h source/git-compat-util.h
|
||||
--- git-2.13.1/git-compat-util.h 2017-06-04 19:08:11.000000000 -0600
|
||||
+++ source/git-compat-util.h 2025-04-18 10:00:11.319697447 -0600
|
||||
@@ -1,6 +1,18 @@
|
||||
#ifndef GIT_COMPAT_UTIL_H
|
||||
#define GIT_COMPAT_UTIL_H
|
||||
|
||||
+#ifndef SIG_DFL
|
||||
+#define SIG_DFL ((void (*)(int))0)
|
||||
+#endif
|
||||
+
|
||||
+#ifndef SIG_IGN
|
||||
+#define SIG_IGN ((void (*)(int))1)
|
||||
+#endif
|
||||
+
|
||||
+#ifndef SIG_ERR
|
||||
+#define SIG_ERR ((void (*)(int))-1)
|
||||
+#endif
|
||||
+
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
|
||||
|
||||
@@ -323,6 +335,14 @@
|
||||
#define PATH_SEP ':'
|
||||
#endif
|
||||
|
||||
+#ifndef DEV_NULL
|
||||
+#if defined(__redox__)
|
||||
+#define DEV_NULL "/scheme/null"
|
||||
+#else
|
||||
+#define DEV_NULL "/dev/null"
|
||||
+#endif
|
||||
+#endif
|
||||
+
|
||||
#ifdef HAVE_PATHS_H
|
||||
#include <paths.h>
|
||||
#endif
|
||||
diff -ruwN git-2.13.1/Makefile source/Makefile
|
||||
--- git-2.13.1/Makefile 2017-06-05 08:08:11.000000000 +0700
|
||||
+++ source/Makefile 2025-09-01 04:41:10.339224568 +0700
|
||||
@@ -979,7 +979,7 @@
|
||||
BUILTIN_OBJS += builtin/write-tree.o
|
||||
|
||||
GITLIBS = common-main.o $(LIB_FILE) $(XDIFF_LIB)
|
||||
-EXTLIBS =
|
||||
+EXTLIBS = -lnghttp2
|
||||
|
||||
GIT_USER_AGENT = git/$(GIT_VERSION)
|
||||
|
||||
@@ -1802,7 +1802,6 @@
|
||||
|
||||
$(BUILT_INS): git$X
|
||||
$(QUIET_BUILT_IN)$(RM) $@ && \
|
||||
- ln $< $@ 2>/dev/null || \
|
||||
ln -s $< $@ 2>/dev/null || \
|
||||
cp $< $@
|
||||
|
||||
@@ -2096,7 +2095,6 @@
|
||||
|
||||
$(REMOTE_CURL_ALIASES): $(REMOTE_CURL_PRIMARY)
|
||||
$(QUIET_LNCP)$(RM) $@ && \
|
||||
- ln $< $@ 2>/dev/null || \
|
||||
ln -s $< $@ 2>/dev/null || \
|
||||
cp $< $@
|
||||
|
||||
@@ -2449,14 +2447,12 @@
|
||||
for p in $(filter $(install_bindir_programs),$(BUILT_INS)); do \
|
||||
$(RM) "$$bindir/$$p" && \
|
||||
test -z "$(NO_INSTALL_HARDLINKS)" && \
|
||||
- ln "$$bindir/git$X" "$$bindir/$$p" 2>/dev/null || \
|
||||
ln -s "git$X" "$$bindir/$$p" 2>/dev/null || \
|
||||
cp "$$bindir/git$X" "$$bindir/$$p" || exit; \
|
||||
done && \
|
||||
for p in $(BUILT_INS); do \
|
||||
$(RM) "$$execdir/$$p" && \
|
||||
test -z "$(NO_INSTALL_HARDLINKS)" && \
|
||||
- ln "$$execdir/git$X" "$$execdir/$$p" 2>/dev/null || \
|
||||
ln -s "git$X" "$$execdir/$$p" 2>/dev/null || \
|
||||
cp "$$execdir/git$X" "$$execdir/$$p" || exit; \
|
||||
done && \
|
||||
@@ -2464,7 +2460,6 @@
|
||||
for p in $$remote_curl_aliases; do \
|
||||
$(RM) "$$execdir/$$p" && \
|
||||
test -z "$(NO_INSTALL_HARDLINKS)" && \
|
||||
- ln "$$execdir/git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
|
||||
ln -s "git-remote-http$X" "$$execdir/$$p" 2>/dev/null || \
|
||||
cp "$$execdir/git-remote-http$X" "$$execdir/$$p" || exit; \
|
||||
done && \
|
||||
diff -ruwN git-2.13.1/run-command.c source/run-command.c
|
||||
--- git-2.13.1/run-command.c 2017-06-04 19:08:11.000000000 -0600
|
||||
+++ source/run-command.c 2025-04-18 10:00:11.320697447 -0600
|
||||
@@ -120,9 +120,9 @@
|
||||
#ifndef GIT_WINDOWS_NATIVE
|
||||
static inline void dup_devnull(int to)
|
||||
{
|
||||
- int fd = open("/dev/null", O_RDWR);
|
||||
+ int fd = open(DEV_NULL, O_RDWR);
|
||||
if (fd < 0)
|
||||
- die_errno(_("open /dev/null failed"));
|
||||
+ die_errno(_("open %s failed"), DEV_NULL);
|
||||
if (dup2(fd, to) < 0)
|
||||
die_errno(_("dup2(%d,%d) failed"), fd, to);
|
||||
close(fd);
|
||||
diff -ruwN git-2.13.1/setup.c source/setup.c
|
||||
--- git-2.13.1/setup.c 2017-06-05 08:08:11.000000000 +0700
|
||||
+++ source/setup.c 2025-09-01 04:41:10.339224568 +0700
|
||||
@@ -1146,11 +1146,11 @@
|
||||
/* if any standard file descriptor is missing open it to /dev/null */
|
||||
void sanitize_stdfds(void)
|
||||
{
|
||||
- int fd = open("/dev/null", O_RDWR, 0);
|
||||
+ int fd = open(DEV_NULL, O_RDWR, 0);
|
||||
while (fd != -1 && fd < 2)
|
||||
fd = dup(fd);
|
||||
if (fd == -1)
|
||||
- die_errno("open /dev/null or dup failed");
|
||||
+ die_errno("open %s or dup failed", DEV_NULL);
|
||||
if (fd > 2)
|
||||
close(fd);
|
||||
}
|
||||
@@ -1169,8 +1169,10 @@
|
||||
default:
|
||||
exit(0);
|
||||
}
|
||||
+#if !defined(__redox__)
|
||||
if (setsid() == -1)
|
||||
die_errno("setsid failed");
|
||||
+#endif
|
||||
close(0);
|
||||
close(1);
|
||||
close(2);
|
||||
@@ -0,0 +1,47 @@
|
||||
[source]
|
||||
tar = "https://www.kernel.org/pub/software/scm/git/git-2.13.1.tar.xz"
|
||||
blake3 = "bc78271bffd60c5b8b938d8c08fd74dc2de8d21fbaf8f8e0e3155436d9263f17"
|
||||
patches = ["git.patch"]
|
||||
|
||||
[build]
|
||||
dependencies=[
|
||||
"curl",
|
||||
"expat",
|
||||
"nghttp2",
|
||||
"openssl3",
|
||||
"zlib"
|
||||
]
|
||||
template = "custom"
|
||||
script = """
|
||||
rsync -av --delete "${COOKBOOK_SOURCE}/" ./
|
||||
DYNAMIC_INIT
|
||||
MAKEFLAGS=(
|
||||
NEEDS_SSL_WITH_CURL=1
|
||||
NEEDS_CRYPTO_WITH_SSL=1
|
||||
NO_IPV6=1
|
||||
NO_PREAD=1
|
||||
NO_MMAP=1
|
||||
NO_SETITIMER=1
|
||||
NO_UNIX_SOCKETS=1
|
||||
NEEDS_LIBICONV=
|
||||
NEEDS_LIBRT=
|
||||
BLK_SHA1=1
|
||||
V=1
|
||||
)
|
||||
export CURL_CONFIG="${COOKBOOK_SYSROOT}/usr/bin/curl-config"
|
||||
./configure \
|
||||
--host="${GNU_TARGET}" \
|
||||
--prefix=/usr \
|
||||
ac_cv_fread_reads_directories=yes \
|
||||
ac_cv_snprintf_returns_bogus=yes \
|
||||
ac_cv_lib_curl_curl_global_init=yes
|
||||
"${COOKBOOK_MAKE}" "${MAKEFLAGS[@]}" -j"${COOKBOOK_MAKE_JOBS}"
|
||||
"${COOKBOOK_MAKE}" DESTDIR="${COOKBOOK_STAGE}" "${MAKEFLAGS[@]}" install
|
||||
rm -rf "${COOKBOOK_STAGE}/usr/share/man"
|
||||
"""
|
||||
|
||||
[package]
|
||||
dependencies = [
|
||||
"ca-certificates",
|
||||
"nghttp2"
|
||||
]
|
||||
@@ -0,0 +1,14 @@
|
||||
[source]
|
||||
git = "https://github.com/Byron/gitoxide.git"
|
||||
|
||||
[build]
|
||||
dependencies = [
|
||||
"openssl1",
|
||||
]
|
||||
template = "custom"
|
||||
script = """
|
||||
export OPENSSL_DIR="${COOKBOOK_SYSROOT}"
|
||||
export OPENSSL_STATIC="true"
|
||||
cookbook_cargo
|
||||
"""
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
#TODO slower jobserver due to lack of named pipes
|
||||
[source]
|
||||
tar = "http://ftp.gnu.org/gnu/make/make-4.4.tar.gz"
|
||||
blake3 = "1a0e5353205e106bd9b3c0f4a5f37ee1156a1e1c8feb771d1b4842c216612cba"
|
||||
patches = [
|
||||
"redox.patch"
|
||||
]
|
||||
script = """
|
||||
autotools_recursive_regenerate
|
||||
"""
|
||||
|
||||
[build]
|
||||
template = "custom"
|
||||
script = """
|
||||
DYNAMIC_INIT
|
||||
COOKBOOK_CONFIGURE_FLAGS+=(
|
||||
# TODO: https://gitlab.redox-os.org/redox-os/redox/-/issues/1753
|
||||
'ac_cv_func_mkfifo=no'
|
||||
)
|
||||
cookbook_configure
|
||||
"""
|
||||
@@ -0,0 +1,40 @@
|
||||
diff -ruwN make-4.4/src/arscan.c source/src/arscan.c
|
||||
--- make-4.4/src/arscan.c 2022-10-23 16:52:32.000000000 +0200
|
||||
+++ source/src/arscan.c 2024-08-23 18:28:49.206084084 +0200
|
||||
@@ -331,7 +331,7 @@
|
||||
#endif
|
||||
|
||||
#ifndef WINDOWS32
|
||||
-# if !defined (__ANDROID__) && !defined (__BEOS__)
|
||||
+# if 0
|
||||
# include <ar.h>
|
||||
# else
|
||||
/* These platforms don't have <ar.h> but have archives in the same format
|
||||
diff -ruwN make-4.4/src/getopt1.c source/src/getopt1.c
|
||||
--- make-4.4/src/getopt1.c 2022-10-23 21:52:32.000000000 +0700
|
||||
+++ source/src/getopt1.c 2026-01-24 23:28:34.306706884 +0700
|
||||
@@ -48,6 +48,10 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
+#ifdef __redox__
|
||||
+#define ELIDE_CODE
|
||||
+#endif
|
||||
+
|
||||
#ifndef ELIDE_CODE
|
||||
|
||||
|
||||
diff -ruwN make-4.4/src/getopt.c source/src/getopt.c
|
||||
--- make-4.4/src/getopt.c 2022-10-23 21:52:32.000000000 +0700
|
||||
+++ source/src/getopt.c 2026-01-24 23:21:09.488487860 +0700
|
||||
@@ -56,6 +56,10 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
+#ifdef __redox__
|
||||
+#define ELIDE_CODE
|
||||
+#endif
|
||||
+
|
||||
#ifndef ELIDE_CODE
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
[source]
|
||||
git = "https://github.com/leachim6/hello-world"
|
||||
shallow_clone = true
|
||||
[build]
|
||||
template = "custom"
|
||||
script = """
|
||||
mkdir -pv "${COOKBOOK_STAGE}"/home/user/hello-world-examples
|
||||
cp -rv "${COOKBOOK_SOURCE}"/[#,a-z] "${COOKBOOK_STAGE}"/home/user/hello-world-examples
|
||||
"""
|
||||
@@ -0,0 +1,5 @@
|
||||
#TODO undefined reference
|
||||
[source]
|
||||
tar = "https://github.com/jqlang/jq/releases/download/jq-1.8.1/jq-1.8.1.tar.gz"
|
||||
[build]
|
||||
template = "configure"
|
||||
@@ -0,0 +1,18 @@
|
||||
[source]
|
||||
git = "https://gitlab.redox-os.org/redox-os/gawk.git"
|
||||
upstream = "https://git.savannah.gnu.org/git/gawk.git"
|
||||
branch = "redox"
|
||||
script = """
|
||||
autotools_recursive_regenerate
|
||||
"""
|
||||
|
||||
[build]
|
||||
template = "custom"
|
||||
script = """
|
||||
DYNAMIC_INIT
|
||||
COOKBOOK_CONFIGURE_FLAGS+=(
|
||||
ac_cv_func_gethostbyname=no
|
||||
ac_cv_func_connect=no
|
||||
)
|
||||
cookbook_configure
|
||||
"""
|
||||
@@ -0,0 +1,5 @@
|
||||
[source]
|
||||
git = "https://github.com/jD91mZM2/rust-lci"
|
||||
|
||||
[build]
|
||||
template = "cargo"
|
||||
@@ -0,0 +1,22 @@
|
||||
#TODO can build, not tested
|
||||
[source]
|
||||
git = "https://gitlab.redox-os.org/redox-os/libtool"
|
||||
branch = "v2.5.4-redox"
|
||||
shallow_clone = true
|
||||
|
||||
[build]
|
||||
template = "custom"
|
||||
script = """
|
||||
DYNAMIC_INIT
|
||||
|
||||
# libtool saves absolute path to sysroot which contains nothing
|
||||
unset CFLAGS
|
||||
|
||||
cp -r "${COOKBOOK_SOURCE}"/. ./
|
||||
./bootstrap \
|
||||
--skip-po \
|
||||
--force \
|
||||
--gnulib-srcdir=./gnulib
|
||||
COOKBOOK_CONFIGURE="./configure"
|
||||
cookbook_configure
|
||||
"""
|
||||
@@ -0,0 +1,61 @@
|
||||
[source]
|
||||
same_as = "../llvm21"
|
||||
|
||||
[build]
|
||||
template = "custom"
|
||||
dependencies = [
|
||||
"llvm21",
|
||||
"zstd",
|
||||
]
|
||||
dev-dependencies = [
|
||||
"llvm21.dev",
|
||||
"llvm21.runtime",
|
||||
]
|
||||
script = """
|
||||
DYNAMIC_INIT
|
||||
ARCH="$(echo "${TARGET}" | cut -d - -f1)"
|
||||
|
||||
generate_cookbook_cmake_file "$COOKBOOK_HOST_TARGET" "" "$COOKBOOK_TOOLCHAIN" native.cmake
|
||||
|
||||
if [ "$TARGET" = "$COOKBOOK_HOST_TARGET" ]; then
|
||||
COOKBOOK_CMAKE_FLAGS+=( -DLLVM_TABLEGEN_EXE=${COOKBOOK_TOOLCHAIN}/bin/llvm-tblgen )
|
||||
else
|
||||
COOKBOOK_CMAKE_FLAGS+=( -DLLVM_TABLEGEN_EXE=${COOKBOOK_HOST_SYSROOT}/bin/llvm-tblgen )
|
||||
fi
|
||||
|
||||
COOKBOOK_CMAKE_FLAGS+=(
|
||||
-DLLVM_ROOT="${COOKBOOK_SYSROOT}"
|
||||
-DCROSS_TOOLCHAIN_FLAGS_NATIVE="-DCMAKE_TOOLCHAIN_FILE=$(realpath native.cmake)"
|
||||
-DLLVM_USE_STATIC_ZSTD=On
|
||||
|
||||
# the shared options from llvm
|
||||
-DCMAKE_CXX_FLAGS="--std=gnu++11"
|
||||
-DBUILD_SHARED_LIBS=False
|
||||
-DLLVM_BUILD_EXAMPLES=Off
|
||||
-DLLVM_BUILD_TESTS=Off
|
||||
-DLLVM_DEFAULT_TARGET_TRIPLE="${TARGET}"
|
||||
-DLLVM_ENABLE_LTO=Off
|
||||
-DLLVM_ENABLE_RTTI=On
|
||||
-DLLVM_ENABLE_THREADS=On
|
||||
-DLLVM_INCLUDE_EXAMPLES=Off
|
||||
-DLLVM_INCLUDE_TESTS=Off
|
||||
-DLLVM_OPTIMIZED_TABLEGEN=On
|
||||
-DLLVM_TARGET_ARCH=$ARCH
|
||||
-DLLVM_TOOLS_INSTALL_DIR=bin
|
||||
-DLLVM_UTILS_INSTALL_DIR=bin
|
||||
-DUNIX=1
|
||||
)
|
||||
|
||||
COOKBOOK_SOURCE="$COOKBOOK_SOURCE/lld"
|
||||
|
||||
cookbook_cmake
|
||||
"""
|
||||
|
||||
[[optional-packages]]
|
||||
name = "dev"
|
||||
dependencies = []
|
||||
files = [
|
||||
"usr/include/lld*/**",
|
||||
"usr/lib/liblld*.a",
|
||||
"usr/lib/cmake/lld/**",
|
||||
]
|
||||
@@ -0,0 +1,2 @@
|
||||
set(CMAKE_C_COMPILER cc)
|
||||
set(CMAKE_CXX_COMPILER c++)
|
||||
@@ -0,0 +1,72 @@
|
||||
[source]
|
||||
git = "https://gitlab.redox-os.org/redox-os/llvm-project.git"
|
||||
upstream = "https://github.com/rust-lang/llvm-project.git"
|
||||
branch = "redox-2024-05-11"
|
||||
shallow_clone = true
|
||||
|
||||
[build]
|
||||
template = "custom"
|
||||
dependencies = [
|
||||
"zlib"
|
||||
]
|
||||
script = """
|
||||
DYNAMIC_INIT
|
||||
|
||||
# https://llvm.org/docs/CMake.html
|
||||
case "${TARGET}" in
|
||||
x86-unknown-redox)
|
||||
LLVM_TARGETS_TO_BUILD="X86"
|
||||
;;
|
||||
x86_64-unknown-redox)
|
||||
LLVM_TARGETS_TO_BUILD="X86"
|
||||
;;
|
||||
aarch64-unknown-redox)
|
||||
LLVM_TARGETS_TO_BUILD="AArch64"
|
||||
;;
|
||||
riscv64gc-unknown-redox)
|
||||
LLVM_TARGETS_TO_BUILD="RISCV"
|
||||
;;
|
||||
*)
|
||||
LLVM_TARGETS_TO_BUILD="host"
|
||||
;;
|
||||
esac
|
||||
|
||||
COOKBOOK_CMAKE_FLAGS+=(
|
||||
-DCMAKE_CXX_FLAGS="--std=gnu++11"
|
||||
-DBUILD_SHARED_LIBS=False
|
||||
-DLLVM_LINK_LLVM_DYLIB=On
|
||||
-DCROSS_TOOLCHAIN_FLAGS_NATIVE="-DCMAKE_TOOLCHAIN_FILE=$(realpath "${COOKBOOK_RECIPE}/native.cmake")"
|
||||
-DLLVM_BUILD_BENCHMARKS=Off
|
||||
-DLLVM_BUILD_EXAMPLES=Off
|
||||
-DLLVM_BUILD_TESTS=Off
|
||||
-DLLVM_BUILD_UTILS=Off
|
||||
-DLLVM_DEFAULT_TARGET_TRIPLE="${TARGET}"
|
||||
-DLLVM_ENABLE_LTO=Off
|
||||
-DLLVM_ENABLE_RTTI=On
|
||||
-DLLVM_ENABLE_THREADS=On
|
||||
-DLLVM_ENABLE_ZSTD=Off
|
||||
-DLLVM_INCLUDE_BENCHMARKS=Off
|
||||
-DLLVM_INCLUDE_EXAMPLES=Off
|
||||
-DLLVM_INCLUDE_TESTS=Off
|
||||
-DLLVM_INCLUDE_UTILS=Off
|
||||
-DLLVM_OPTIMIZED_TABLEGEN=On
|
||||
-DLLVM_TARGET_ARCH="$(echo "${TARGET}" | cut -d - -f1)"
|
||||
-DLLVM_TARGETS_TO_BUILD="${LLVM_TARGETS_TO_BUILD}"
|
||||
-DLLVM_TOOL_LLVM_COV_BUILD=Off
|
||||
-DLLVM_TOOL_LLVM_LTO_BUILD=Off
|
||||
-DLLVM_TOOL_LLVM_LTO2_BUILD=Off
|
||||
-DLLVM_TOOL_LLVM_PROFDATA_BUILD=Off
|
||||
-DLLVM_TOOL_LLVM_RTDYLD_BUILD=Off
|
||||
-DLLVM_TOOL_LLVM_XRAY_BUILD=Off
|
||||
-DLLVM_TOOL_LLI_BUILD=Off
|
||||
-DLLVM_TOOL_LTO_BUILD=Off
|
||||
-DLLVM_TOOLS_INSTALL_DIR=bin
|
||||
-DLLVM_UTILS_INSTALL_DIR=bin
|
||||
-DUNIX=1
|
||||
-DLLVM_ENABLE_PROJECTS="llvm"
|
||||
)
|
||||
|
||||
# Native tablegen build fails with too many jobs, limit to 16
|
||||
COOKBOOK_MAKE_JOBS="$(( ${COOKBOOK_MAKE_JOBS} > 16 ? 16 : ${COOKBOOK_MAKE_JOBS} ))"
|
||||
cookbook_cmake "${COOKBOOK_SOURCE}/llvm"
|
||||
"""
|
||||
@@ -0,0 +1,2 @@
|
||||
set(CMAKE_C_COMPILER cc)
|
||||
set(CMAKE_CXX_COMPILER c++)
|
||||
@@ -0,0 +1,80 @@
|
||||
[source]
|
||||
git = "https://gitlab.redox-os.org/redox-os/llvm-project.git"
|
||||
upstream = "https://github.com/rust-lang/llvm-project.git"
|
||||
branch = "redox-2025-10-03"
|
||||
shallow_clone = true
|
||||
|
||||
[build]
|
||||
template = "custom"
|
||||
dependencies = [
|
||||
"zstd",
|
||||
]
|
||||
script = """
|
||||
DYNAMIC_INIT
|
||||
ARCH="$(echo "${TARGET}" | cut -d - -f1)"
|
||||
|
||||
generate_cookbook_cmake_file "$COOKBOOK_HOST_TARGET" "" "$COOKBOOK_TOOLCHAIN" native.cmake
|
||||
|
||||
case "${ARCH}" in
|
||||
x86 | x86_64) LLVM_TARGETS_TO_BUILD="X86";;
|
||||
aarch64) LLVM_TARGETS_TO_BUILD="AArch64";;
|
||||
riscv64gc) LLVM_TARGETS_TO_BUILD="RISCV";;
|
||||
esac
|
||||
|
||||
if [ "${COOKBOOK_HOST_SYSROOT}" = "/usr" ]; then
|
||||
LLVM_TARGETS_TO_BUILD="X86;AArch64;RISCV"
|
||||
fi
|
||||
|
||||
# This just build the LLVM library and tools just enough for Rust, to build the rest of LLVM see
|
||||
# https://github.com/llvm/llvm-zorg/blob/main/zorg/buildbot/builders/annotated/standalone-build.sh
|
||||
|
||||
COOKBOOK_CMAKE_FLAGS+=(
|
||||
-DLLVM_BUILD_LLVM_DYLIB=On
|
||||
-DLLVM_LINK_LLVM_DYLIB=On
|
||||
-DLLVM_INCLUDE_UTILS=On
|
||||
-DLLVM_INSTALL_UTILS=On
|
||||
-DLLVM_TOOL_LLVM_COV_BUILD=On
|
||||
-DLLVM_TOOL_LLVM_PROFDATA_BUILD=On
|
||||
-DLLVM_TARGETS_TO_BUILD="$LLVM_TARGETS_TO_BUILD"
|
||||
-DLLVM_ENABLE_ZLIB=Off
|
||||
-DLLVM_USE_STATIC_ZSTD=On
|
||||
-DLLVM_ENABLE_LIBXML2=Off
|
||||
|
||||
# the rest of options that shared to clang
|
||||
-DCROSS_TOOLCHAIN_FLAGS_NATIVE="-DCMAKE_TOOLCHAIN_FILE=$(realpath "${COOKBOOK_RECIPE}/native.cmake")"
|
||||
-DCMAKE_CXX_FLAGS="--std=gnu++11"
|
||||
-DBUILD_SHARED_LIBS=False
|
||||
-DLLVM_BUILD_EXAMPLES=Off
|
||||
-DLLVM_BUILD_TESTS=Off
|
||||
-DLLVM_DEFAULT_TARGET_TRIPLE="${TARGET}"
|
||||
-DLLVM_ENABLE_LTO=Off
|
||||
-DLLVM_ENABLE_RTTI=On
|
||||
-DLLVM_ENABLE_THREADS=On
|
||||
-DLLVM_INCLUDE_EXAMPLES=Off
|
||||
-DLLVM_INCLUDE_TESTS=Off
|
||||
-DLLVM_OPTIMIZED_TABLEGEN=On
|
||||
-DLLVM_TARGET_ARCH=$ARCH
|
||||
-DLLVM_TOOLS_INSTALL_DIR=bin
|
||||
-DLLVM_UTILS_INSTALL_DIR=bin
|
||||
-DUNIX=1
|
||||
)
|
||||
|
||||
COOKBOOK_SOURCE="$COOKBOOK_SOURCE/llvm"
|
||||
cookbook_cmake
|
||||
"""
|
||||
|
||||
# llvm runtime
|
||||
[[optional-packages]]
|
||||
name = "runtime"
|
||||
files = [
|
||||
"usr/bin/**",
|
||||
]
|
||||
|
||||
[[optional-packages]]
|
||||
name = "dev"
|
||||
dependencies = [ ".runtime" ]
|
||||
files = [
|
||||
"usr/include/llvm*/**",
|
||||
"usr/lib/libLLVM*.a",
|
||||
"usr/lib/cmake/llvm/**",
|
||||
]
|
||||
@@ -0,0 +1,17 @@
|
||||
[source]
|
||||
tar = "https://lua.org/ftp/lua-5.4.7.tar.gz"
|
||||
blake3 = "e51c2f347e3185479d5ff95cae8ac77511db486853269443c56bedaa0a6ae629"
|
||||
|
||||
[build]
|
||||
template = "custom"
|
||||
script = """
|
||||
DYNAMIC_INIT
|
||||
rsync -av --delete "${COOKBOOK_SOURCE}/" ./
|
||||
"${COOKBOOK_MAKE}" -j"${COOKBOOK_MAKE_JOBS}" posix \
|
||||
AR="${AR} rcu" \
|
||||
CC="${CC} -std=gnu99" \
|
||||
RANLIB="${RANLIB}" \
|
||||
SYSLDFLAGS="$LDFLAGS"
|
||||
|
||||
"${COOKBOOK_MAKE}" install INSTALL_TOP="${COOKBOOK_STAGE}"
|
||||
"""
|
||||
@@ -0,0 +1,22 @@
|
||||
[source]
|
||||
git = "https://luajit.org/git/luajit.git"
|
||||
rev = "a4f56a459a588ae768801074b46ba0adcfb49eb1"
|
||||
patches = ["redox.patch"]
|
||||
[build]
|
||||
template = "custom"
|
||||
script = """
|
||||
DYNAMIC_INIT
|
||||
|
||||
rsync -av "${COOKBOOK_SOURCE}/" ./
|
||||
OS=$(echo "${TARGET}" | cut -d - -f3)
|
||||
|
||||
case "${OS}" in
|
||||
linux) SYS=Linux;;
|
||||
redox) SYS=Redox;;
|
||||
esac
|
||||
|
||||
${COOKBOOK_MAKE} -j ${COOKBOOK_MAKE_JOBS} install \
|
||||
PREFIX="${COOKBOOK_STAGE}" \
|
||||
TARGET_SYS="${SYS}" \
|
||||
CROSS="${GNU_TARGET}-"
|
||||
"""
|
||||
@@ -0,0 +1,31 @@
|
||||
diff --git a/src/Makefile b/src/Makefile
|
||||
index 3a6a4329..450e8fe6 100644
|
||||
--- a/src/Makefile
|
||||
+++ b/src/Makefile
|
||||
@@ -351,6 +351,9 @@ else
|
||||
ifeq (GNU/kFreeBSD,$(TARGET_SYS))
|
||||
TARGET_XLIBS+= -ldl
|
||||
endif
|
||||
+ ifeq (Redox,$(TARGET_SYS))
|
||||
+ TARGET_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_POSIX
|
||||
+ endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
@@ -367,12 +370,16 @@ ifneq ($(HOST_SYS),$(TARGET_SYS))
|
||||
else
|
||||
ifeq (iOS,$(TARGET_SYS))
|
||||
HOST_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_OSX -DTARGET_OS_IPHONE=1
|
||||
+ else
|
||||
+ ifeq (Redox,$(TARGET_SYS))
|
||||
+ HOST_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_POSIX
|
||||
else
|
||||
HOST_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_OTHER
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
+ endif
|
||||
endif
|
||||
|
||||
ifneq (,$(CCDEBUG))
|
||||
@@ -0,0 +1,18 @@
|
||||
[source]
|
||||
git = "https://github.com/luarocks/luarocks.git"
|
||||
[build]
|
||||
template = "custom"
|
||||
dependencies = [
|
||||
"lua54"
|
||||
]
|
||||
script = """
|
||||
|
||||
COOKBOOK_CONFIGURE_FLAGS=(
|
||||
--sysconfdir=$COOKBOOK_SYSROOT
|
||||
--with-lua-include=$COOKBOOK_SYSROOT/include
|
||||
--with-lua-bin=$COOKBOOK_SYSROOT/bin
|
||||
--with-lua-lib=$COOKBOOK_SYSROOT/lib
|
||||
)
|
||||
cd "${COOKBOOK_SOURCE}"
|
||||
cookbook_configure
|
||||
"""
|
||||
@@ -0,0 +1,7 @@
|
||||
[source]
|
||||
#TODO: nasm.us is down: tar = "https://www.nasm.us/pub/nasm/releasebuilds/2.14.02/nasm-2.14.02.tar.gz"
|
||||
tar = "https://gstreamer.freedesktop.org/src/mirror/nasm-2.14.02.tar.xz"
|
||||
blake3 = "f66c0cc852c3b9e3321f57c33ef336e17a128bd3d854ee095aae7e6f64629f20"
|
||||
|
||||
[build]
|
||||
template = "configure"
|
||||
@@ -0,0 +1,35 @@
|
||||
diff -ru source/lib/getdtablesize.c source-new/lib/getdtablesize.c
|
||||
--- source/lib/getdtablesize.c 2015-03-06 16:31:45.000000000 -0800
|
||||
+++ source-new/lib/getdtablesize.c 2017-08-08 19:33:33.993874985 -0700
|
||||
@@ -106,15 +106,6 @@
|
||||
int
|
||||
getdtablesize (void)
|
||||
{
|
||||
- struct rlimit lim;
|
||||
-
|
||||
- if (getrlimit (RLIMIT_NOFILE, &lim) == 0
|
||||
- && 0 <= lim.rlim_cur && lim.rlim_cur <= INT_MAX
|
||||
- && lim.rlim_cur != RLIM_INFINITY
|
||||
- && lim.rlim_cur != RLIM_SAVED_CUR
|
||||
- && lim.rlim_cur != RLIM_SAVED_MAX)
|
||||
- return lim.rlim_cur;
|
||||
-
|
||||
return INT_MAX;
|
||||
}
|
||||
|
||||
Only in source-new/lib: getdtablesize.c.orig
|
||||
diff -ru source/src/safe.c source-new/src/safe.c
|
||||
--- source/src/safe.c 2015-03-06 16:34:20.000000000 -0800
|
||||
+++ source-new/src/safe.c 2017-08-08 19:33:53.447430811 -0700
|
||||
@@ -92,11 +92,7 @@
|
||||
|
||||
static void init_dirfd_cache (void)
|
||||
{
|
||||
- struct rlimit nofile;
|
||||
-
|
||||
max_cached_fds = 8;
|
||||
- if (getrlimit (RLIMIT_NOFILE, &nofile) == 0)
|
||||
- max_cached_fds = MAX (nofile.rlim_cur / 4, max_cached_fds);
|
||||
|
||||
cached_dirfds = hash_initialize (max_cached_fds,
|
||||
NULL,
|
||||
@@ -0,0 +1,19 @@
|
||||
diff -ru source/src/util.c source-new/src/util.c
|
||||
--- source/src/util.c 2015-03-06 16:34:20.000000000 -0800
|
||||
+++ source-new/src/util.c 2017-08-11 18:24:56.991729200 -0700
|
||||
@@ -271,6 +271,7 @@
|
||||
|
||||
/* May fail if we are not privileged to set the file owner, or we are
|
||||
not in group instat.st_gid. Ignore those errors. */
|
||||
+ /*
|
||||
if ((uid != -1 || gid != -1)
|
||||
&& safe_lchown (to, uid, gid) != 0
|
||||
&& (errno != EPERM
|
||||
@@ -281,6 +282,7 @@
|
||||
(uid == -1) ? "owner" : "owning group",
|
||||
S_ISLNK (mode) ? "symbolic link" : "file",
|
||||
quotearg (to));
|
||||
+ */
|
||||
}
|
||||
if (attr & FA_XATTRS)
|
||||
if (copy_attr (from, to) != 0
|
||||
@@ -0,0 +1,15 @@
|
||||
--- source-old/lib/renameat2.c 2018-02-03 05:41:53.000000000 -0700
|
||||
+++ source/lib/renameat2.c 2025-11-01 08:39:54.945513820 -0600
|
||||
@@ -70,6 +70,7 @@
|
||||
Obey FLAGS when doing the renaming. If FLAGS is zero, this
|
||||
function is equivalent to renameat (FD1, SRC, FD2, DST). */
|
||||
|
||||
+#if !defined(__redox__)
|
||||
int
|
||||
renameat2 (int fd1, char const *src, int fd2, char const *dst,
|
||||
unsigned int flags)
|
||||
@@ -225,3 +226,4 @@
|
||||
|
||||
#endif /* !HAVE_RENAMEAT */
|
||||
}
|
||||
+#endif
|
||||
@@ -0,0 +1,28 @@
|
||||
[source]
|
||||
tar = "https://ftp.gnu.org/gnu/patch/patch-2.7.6.tar.xz"
|
||||
blake3 = "d46d14c12aa4ea51e356bf92091c368fd871e1d770b94bc29027886737aecd5f"
|
||||
patches = [
|
||||
"01_no_rlimit.patch",
|
||||
"02_no_chown.patch",
|
||||
"03_renameat2.patch",
|
||||
]
|
||||
script = """
|
||||
wget -O build-aux/config.sub "https://gitlab.redox-os.org/redox-os/gnu-config/-/raw/master/config.sub?inline=false"
|
||||
autoreconf
|
||||
"""
|
||||
|
||||
[build]
|
||||
template = "custom"
|
||||
script = """
|
||||
COOKBOOK_CONFIGURE="${COOKBOOK_SOURCE}/configure"
|
||||
COOKBOOK_CONFIGURE_FLAGS=(
|
||||
--host="${TARGET}"
|
||||
--prefix="/"
|
||||
--build="$(gcc -dumpmachine)"
|
||||
)
|
||||
|
||||
cookbook_configure
|
||||
|
||||
${TARGET}-strip "${COOKBOOK_STAGE}/bin/"*
|
||||
rm -rf "${COOKBOOK_STAGE}/share" "${COOKBOOK_STAGE}/lib"
|
||||
"""
|
||||
@@ -0,0 +1,9 @@
|
||||
[source]
|
||||
git = "https://github.com/pciutils/pciids.git"
|
||||
|
||||
[build]
|
||||
template = "custom"
|
||||
script = """
|
||||
install -d "${COOKBOOK_STAGE}/share/misc/"
|
||||
install "${COOKBOOK_SOURCE}"/pci.ids "${COOKBOOK_STAGE}/share/misc/"
|
||||
"""
|
||||
@@ -0,0 +1,80 @@
|
||||
[source]
|
||||
tar = "https://www.php.net/distributions/php-8.4.17.tar.xz"
|
||||
blake3 = "a8478dddd948d4b26e51c5727ac0895440da76e8ad9be947098a4284ca0b7f2a"
|
||||
patches = [
|
||||
"redox.patch"
|
||||
]
|
||||
|
||||
[build]
|
||||
template = "custom"
|
||||
dependencies = [
|
||||
"bzip2",
|
||||
"curl",
|
||||
"gettext",
|
||||
"libffi",
|
||||
"libgmp",
|
||||
"libavif",
|
||||
"libicu",
|
||||
"libjpeg",
|
||||
"libedit",
|
||||
"libonig",
|
||||
"libpng",
|
||||
"libsodium",
|
||||
"libwebp",
|
||||
"libxml2",
|
||||
"libiconv",
|
||||
"libzip",
|
||||
"ncursesw",
|
||||
"nghttp2",
|
||||
"openssl3",
|
||||
"pcre",
|
||||
"sqlite3",
|
||||
"xz",
|
||||
"zlib",
|
||||
"zstd",
|
||||
]
|
||||
script = """
|
||||
DYNAMIC_INIT
|
||||
export SUFFIX="84"
|
||||
|
||||
export CURL_LIBS="-lcurl -lnghttp2 -lssl -lcrypto"
|
||||
COOKBOOK_CONFIGURE_FLAGS+=(
|
||||
--program-suffix=${SUFFIX}
|
||||
--sysconfdir=/etc/php/$SUFFIX
|
||||
--with-config-file-path=/etc/php/$SUFFIX
|
||||
--with-config-file-scan-dir=/etc/php/$SUFFIX/conf.d
|
||||
--with-iconv="${COOKBOOK_SYSROOT}/usr"
|
||||
--disable-opcache
|
||||
--enable-bcmath
|
||||
--enable-calendar
|
||||
--enable-fpm # need times function
|
||||
--enable-gd
|
||||
--enable-intl
|
||||
--enable-mbstring
|
||||
--with-curl
|
||||
--with-gettext
|
||||
--with-gmp
|
||||
--with-jpeg
|
||||
--with-webp
|
||||
--with-avif
|
||||
--with-ffi
|
||||
--with-libedit
|
||||
--with-openssl
|
||||
--with-sodium
|
||||
--with-zip
|
||||
)
|
||||
|
||||
"${COOKBOOK_CONFIGURE}" "${COOKBOOK_CONFIGURE_FLAGS[@]}" "$@"
|
||||
"${COOKBOOK_MAKE}" -j "${COOKBOOK_MAKE_JOBS}"
|
||||
"${COOKBOOK_MAKE}" install \
|
||||
INSTALL_ROOT="${COOKBOOK_STAGE}" \
|
||||
datarootdir=/usr/share localstatedir=/var
|
||||
|
||||
mv ${COOKBOOK_STAGE}/usr/sbin/* ${COOKBOOK_STAGE}/usr/bin/
|
||||
for bin in "php-cgi" "php-config" "php" "phpdbg" "phpize" "php-fpm"; do
|
||||
ln -s "$bin$SUFFIX" ${COOKBOOK_STAGE}/usr/bin/$bin
|
||||
done
|
||||
# will not exist on bash but exist on other shell
|
||||
rm -f ${COOKBOOK_STAGE}/usr/bin/phar$SUFFIX
|
||||
cp ${COOKBOOK_SOURCE}/php.ini* ${COOKBOOK_STAGE}/etc/php/$SUFFIX/
|
||||
"""
|
||||
@@ -0,0 +1,91 @@
|
||||
diff -ruwN source/configure source-new/configure
|
||||
--- source/configure 2026-01-14 00:17:10.000000000 +0700
|
||||
+++ source-new/configure 2026-01-16 15:56:01.944755811 +0700
|
||||
@@ -26007,7 +26007,7 @@
|
||||
then :
|
||||
ac_cv_lib_curl_curl_easy_perform=yes
|
||||
else case e in #(
|
||||
- e) ac_cv_lib_curl_curl_easy_perform=no ;;
|
||||
+ e) ac_cv_lib_curl_curl_easy_perform=yes ;;
|
||||
esac
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
@@ -37728,7 +37728,7 @@
|
||||
then :
|
||||
php_cv_lib_gd_works=yes
|
||||
else case e in #(
|
||||
- e) php_cv_lib_gd_works=no ;;
|
||||
+ e) php_cv_lib_gd_works=yes ;;
|
||||
esac
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.beam \
|
||||
@@ -40464,7 +40464,7 @@
|
||||
LIBS_SAVED=$LIBS
|
||||
CFLAGS="$CFLAGS $GMP_CFLAGS"
|
||||
LIBS="$LIBS $GMP_LIBS"
|
||||
- gmp_check=no
|
||||
+ gmp_check=yes
|
||||
ac_fn_c_check_header_compile "$LINENO" "gmp.h" "ac_cv_header_gmp_h" "$ac_includes_default"
|
||||
if test "x$ac_cv_header_gmp_h" = xyes
|
||||
then :
|
||||
diff -ruwN source/ext/phar/Makefile.frag source-new/ext/phar/Makefile.frag
|
||||
--- source/ext/phar/Makefile.frag 2026-01-14 00:17:10.000000000 +0700
|
||||
+++ source-new/ext/phar/Makefile.frag 2026-01-16 15:56:01.946130660 +0700
|
||||
@@ -30,7 +30,7 @@
|
||||
-@test -f $(builddir)/phar/phar.inc || cp $(srcdir)/phar/phar.inc $(builddir)/phar/phar.inc
|
||||
|
||||
TEST_PHP_EXECUTABLE = $(shell $(PHP_EXECUTABLE) -v 2>&1)
|
||||
-TEST_PHP_EXECUTABLE_RES = $(shell echo "$(TEST_PHP_EXECUTABLE)" | grep -c 'Exec format error')
|
||||
+TEST_PHP_EXECUTABLE_RES = $(shell echo "$(TEST_PHP_EXECUTABLE)" | grep -E -c 'Exec format error|required file not found')
|
||||
|
||||
$(builddir)/phar.php: $(srcdir)/build_precommand.php $(srcdir)/phar/*.inc $(srcdir)/phar/*.php $(SAPI_CLI_PATH)
|
||||
-@(echo "Generating phar.php"; \
|
||||
diff -ruwN source/ext/posix/posix.c source-new/ext/posix/posix.c
|
||||
--- source/ext/posix/posix.c 2026-01-14 00:17:10.000000000 +0700
|
||||
+++ source-new/ext/posix/posix.c 2026-01-16 15:56:01.946290813 +0700
|
||||
@@ -375,7 +375,7 @@
|
||||
|
||||
ZEND_PARSE_PARAMETERS_NONE();
|
||||
|
||||
- if ((ticks = times(&t)) == -1) {
|
||||
+ {
|
||||
POSIX_G(last_error) = errno;
|
||||
RETURN_FALSE;
|
||||
}
|
||||
diff -ruwN source/sapi/fpm/fpm/fpm_status.c source-new/sapi/fpm/fpm/fpm_status.c
|
||||
--- source/sapi/fpm/fpm/fpm_status.c 2026-01-14 00:17:10.000000000 +0700
|
||||
+++ source-new/sapi/fpm/fpm/fpm_status.c 2026-01-16 15:57:37.781307156 +0700
|
||||
@@ -84,6 +84,7 @@
|
||||
continue;
|
||||
}
|
||||
/* prevent NaN */
|
||||
+#ifdef HAVE_TIMES
|
||||
if (proc_p->cpu_duration.tv_sec == 0 && proc_p->cpu_duration.tv_usec == 0) {
|
||||
cpu = 0.;
|
||||
} else {
|
||||
@@ -91,6 +92,9 @@
|
||||
proc_p->last_request_cpu.tms_cstime) / fpm_scoreboard_get_tick() /
|
||||
(proc_p->cpu_duration.tv_sec + proc_p->cpu_duration.tv_usec / 1000000.) * 100.;
|
||||
}
|
||||
+#else
|
||||
+ cpu = 0.;
|
||||
+#endif
|
||||
|
||||
array_init(&fpm_proc_stat);
|
||||
add_assoc_long(&fpm_proc_stat, "pid", proc_p->pid);
|
||||
@@ -573,11 +577,15 @@
|
||||
}
|
||||
|
||||
/* prevent NaN */
|
||||
+#ifdef HAVE_TIMES
|
||||
if (proc->cpu_duration.tv_sec == 0 && proc->cpu_duration.tv_usec == 0) {
|
||||
cpu = 0.;
|
||||
} else {
|
||||
cpu = (proc->last_request_cpu.tms_utime + proc->last_request_cpu.tms_stime + proc->last_request_cpu.tms_cutime + proc->last_request_cpu.tms_cstime) / fpm_scoreboard_get_tick() / (proc->cpu_duration.tv_sec + proc->cpu_duration.tv_usec / 1000000.) * 100.;
|
||||
}
|
||||
+#else
|
||||
+ cpu = 0.;
|
||||
+#endif
|
||||
|
||||
if (proc->request_stage == FPM_REQUEST_ACCEPTING) {
|
||||
duration = proc->duration;
|
||||
@@ -0,0 +1,13 @@
|
||||
[source]
|
||||
tar = "https://pkg-config.freedesktop.org/releases/pkg-config-0.29.2.tar.gz"
|
||||
blake3 = "713372b09a1fafeec130dc9bf812a3880f2a90496af5d2194e508d91ccf667d0"
|
||||
script = """
|
||||
GNU_CONFIG_GET config.sub
|
||||
"""
|
||||
|
||||
[build]
|
||||
dependencies = [
|
||||
"gettext",
|
||||
"glib",
|
||||
]
|
||||
template = "configure"
|
||||
@@ -0,0 +1,65 @@
|
||||
[source]
|
||||
tar = "https://www.python.org/ftp/python/3.12.12/Python-3.12.12.tar.xz"
|
||||
blake3 = "29636fdae3e0ee8d0fe585e528c9376fe43876f5f3f0f7892140567946fd907b"
|
||||
patches = [
|
||||
"redox.patch"
|
||||
]
|
||||
|
||||
[build]
|
||||
template = "custom"
|
||||
dependencies = [
|
||||
"target:bzip2",
|
||||
"target:libffi",
|
||||
"target:openssl3",
|
||||
"target:ncursesw",
|
||||
"target:readline",
|
||||
"target:sqlite3",
|
||||
"target:zlib",
|
||||
"target:xz",
|
||||
"target:zstd",
|
||||
]
|
||||
dev-dependencies = [
|
||||
"host:python312"
|
||||
]
|
||||
script = """
|
||||
DYNAMIC_INIT
|
||||
|
||||
export PYTHONDONTWRITEBYTECODE=1
|
||||
ARCH="${TARGET%%-*}"
|
||||
OS=$(echo "${TARGET}" | cut -d - -f3-4)
|
||||
|
||||
if [ "$TARGET" != "$COOKBOOK_HOST_TARGET" ]; then
|
||||
COOKBOOK_CONFIGURE_FLAGS=(
|
||||
--prefix=/usr
|
||||
--disable-ipv6
|
||||
--host=${GNU_TARGET}
|
||||
--build="$ARCH"
|
||||
--with-build-python="${COOKBOOK_TOOLCHAIN}/usr/bin/python3.12"
|
||||
--with-ensurepip=install
|
||||
--disable-test-modules
|
||||
--with-ssl-default-suites=openssl
|
||||
ac_cv_file__dev_ptmx=no
|
||||
ac_cv_file__dev_ptc=no
|
||||
)
|
||||
else
|
||||
COOKBOOK_CONFIGURE_FLAGS=(--prefix=/usr)
|
||||
fi
|
||||
|
||||
if [ "${COOKBOOK_DYNAMIC}" != "1" ]; then
|
||||
export MODULE_BUILDTYPE=static
|
||||
COOKBOOK_CONFIGURE_FLAGS+=( --enable-shared )
|
||||
fi
|
||||
|
||||
cookbook_configure
|
||||
|
||||
# A same file to save 60MB
|
||||
(cd "${COOKBOOK_STAGE}/usr/lib/python3.12/config-3.12-$ARCH-$OS" && \
|
||||
rm -f libpython3.12.a && ln -s ../../libpython3.12.a)
|
||||
"""
|
||||
|
||||
[[optional-packages]]
|
||||
name = "dev"
|
||||
files = [
|
||||
"usr/lib/python3.12/config-*/**",
|
||||
"usr/lib/libpython*.a"
|
||||
]
|
||||
@@ -0,0 +1,152 @@
|
||||
diff -ruwN source/configure source-new/configure
|
||||
--- source/configure 2025-10-09 18:07:00.000000000 +0700
|
||||
+++ source-new/configure 2025-12-09 22:14:30.781035339 +0700
|
||||
@@ -4283,6 +4283,9 @@
|
||||
*-*-wasi)
|
||||
ac_sys_system=WASI
|
||||
;;
|
||||
+ *-*-redox*)
|
||||
+ ac_sys_system=Redox
|
||||
+ ;;
|
||||
*)
|
||||
# for now, limit cross builds to known configurations
|
||||
MACHDEP="unknown"
|
||||
@@ -4307,6 +4310,7 @@
|
||||
case $MACHDEP in
|
||||
aix*) MACHDEP="aix";;
|
||||
linux*) MACHDEP="linux";;
|
||||
+ redox*) MACHDEP="redox";;
|
||||
cygwin*) MACHDEP="cygwin";;
|
||||
darwin*) MACHDEP="darwin";;
|
||||
'') MACHDEP="unknown";;
|
||||
@@ -4327,7 +4331,7 @@
|
||||
|
||||
if test "$cross_compiling" = yes; then
|
||||
case "$host" in
|
||||
- *-*-linux*)
|
||||
+ *-*-linux*|*-*-redox*)
|
||||
case "$host_cpu" in
|
||||
arm*)
|
||||
_host_cpu=arm
|
||||
@@ -6762,6 +6766,7 @@
|
||||
#undef cris
|
||||
#undef fr30
|
||||
#undef linux
|
||||
+#undef redox
|
||||
#undef hppa
|
||||
#undef hpux
|
||||
#undef i386
|
||||
@@ -6907,6 +6912,18 @@
|
||||
# endif
|
||||
#elif defined(__gnu_hurd__)
|
||||
i386-gnu
|
||||
+#elif defined(__redox__)
|
||||
+# if defined(__x86_64__)
|
||||
+ x86_64-redox
|
||||
+# elif defined(__i386__)
|
||||
+ i386-redox
|
||||
+# elif defined(__aarch64__)
|
||||
+ aarch64-redox
|
||||
+# elif defined(__riscv)
|
||||
+ riscv64-redox
|
||||
+# else
|
||||
+# error unknown platform triplet
|
||||
+# endif
|
||||
#elif defined(__APPLE__)
|
||||
darwin
|
||||
#elif defined(__VXWORKS__)
|
||||
@@ -7507,7 +7524,7 @@
|
||||
PY3LIBRARY=libpython3.so
|
||||
fi
|
||||
;;
|
||||
- Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*|VxWorks*)
|
||||
+ Linux*|GNU*|NetBSD*|FreeBSD*|DragonFly*|OpenBSD*|VxWorks*|Redox*)
|
||||
LDLIBRARY='libpython$(LDVERSION).so'
|
||||
BLDLIBRARY='-L. -lpython$(LDVERSION)'
|
||||
RUNSHARED=LD_LIBRARY_PATH=`pwd`${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
|
||||
@@ -12815,7 +12832,7 @@
|
||||
Emscripten*|WASI*)
|
||||
LDSHARED='$(CC) -shared'
|
||||
LDCXXSHARED='$(CXX) -shared';;
|
||||
- Linux*|GNU*|QNX*|VxWorks*|Haiku*)
|
||||
+ Linux*|GNU*|QNX*|VxWorks*|Haiku*|Redox*)
|
||||
LDSHARED='$(CC) -shared'
|
||||
LDCXXSHARED='$(CXX) -shared';;
|
||||
FreeBSD*)
|
||||
@@ -12901,7 +12918,7 @@
|
||||
else CCSHARED="+z";
|
||||
fi;;
|
||||
Linux-android*) ;;
|
||||
- Linux*|GNU*) CCSHARED="-fPIC";;
|
||||
+ Linux*|GNU*|Redox*) CCSHARED="-fPIC";;
|
||||
Emscripten*|WASI*)
|
||||
if test "x$enable_wasm_dynamic_linking" = xyes
|
||||
then :
|
||||
@@ -12939,7 +12956,7 @@
|
||||
LINKFORSHARED="-Wl,-E -Wl,+s";;
|
||||
# LINKFORSHARED="-Wl,-E -Wl,+s -Wl,+b\$(BINLIBDEST)/lib-dynload";;
|
||||
Linux-android*) LINKFORSHARED="-pie -Xlinker -export-dynamic";;
|
||||
- Linux*|GNU*) LINKFORSHARED="-Xlinker -export-dynamic";;
|
||||
+ Linux*|GNU*|Redox*) LINKFORSHARED="-Xlinker -export-dynamic";;
|
||||
# -u libsys_s pulls in all symbols in libsys
|
||||
Darwin/*)
|
||||
LINKFORSHARED="$extra_undefs -framework CoreFoundation"
|
||||
diff -ruwN source/Include/pyport.h source-new/Include/pyport.h
|
||||
--- source/Include/pyport.h 2025-10-09 18:07:00.000000000 +0700
|
||||
+++ source-new/Include/pyport.h 2025-12-09 22:14:30.781035339 +0700
|
||||
@@ -684,7 +684,7 @@
|
||||
# error "Py_TRACE_REFS ABI is not compatible with release and debug ABI"
|
||||
#endif
|
||||
|
||||
-#if defined(__ANDROID__) || defined(__VXWORKS__)
|
||||
+#if defined(__ANDROID__) || defined(__VXWORKS__) || defined(__redox__)
|
||||
// Use UTF-8 as the locale encoding, ignore the LC_CTYPE locale.
|
||||
// See _Py_GetLocaleEncoding(), PyUnicode_DecodeLocale()
|
||||
// and PyUnicode_EncodeLocale().
|
||||
diff -ruwN source/Modules/_cryptmodule.c source-new/Modules/_cryptmodule.c
|
||||
--- source/Modules/_cryptmodule.c 2025-10-09 18:07:00.000000000 +0700
|
||||
+++ source-new/Modules/_cryptmodule.c 2025-12-09 22:14:30.781035339 +0700
|
||||
@@ -38,13 +38,7 @@
|
||||
/*[clinic end generated code: output=0512284a03d2803c input=0e8edec9c364352b]*/
|
||||
{
|
||||
char *crypt_result;
|
||||
-#ifdef HAVE_CRYPT_R
|
||||
- struct crypt_data data;
|
||||
- memset(&data, 0, sizeof(data));
|
||||
- crypt_result = crypt_r(word, salt, &data);
|
||||
-#else
|
||||
crypt_result = crypt(word, salt);
|
||||
-#endif
|
||||
if (crypt_result == NULL) {
|
||||
return PyErr_SetFromErrno(PyExc_OSError);
|
||||
}
|
||||
diff -ruwN source/Modules/resource.c source-new/Modules/resource.c
|
||||
--- source/Modules/resource.c 2025-10-09 18:07:00.000000000 +0700
|
||||
+++ source-new/Modules/resource.c 2025-12-09 22:14:30.781035339 +0700
|
||||
@@ -216,7 +216,7 @@
|
||||
{
|
||||
struct rlimit rl;
|
||||
|
||||
- if (resource < 0 || resource >= RLIM_NLIMITS) {
|
||||
+ if (resource < 0 || resource >= RLIMIT_NLIMITS) {
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
"invalid resource specified");
|
||||
return NULL;
|
||||
@@ -244,7 +244,7 @@
|
||||
{
|
||||
struct rlimit rl;
|
||||
|
||||
- if (resource < 0 || resource >= RLIM_NLIMITS) {
|
||||
+ if (resource < 0 || resource >= RLIMIT_NLIMITS) {
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
"invalid resource specified");
|
||||
return NULL;
|
||||
@@ -292,7 +292,7 @@
|
||||
struct rlimit old_limit, new_limit;
|
||||
int retval;
|
||||
|
||||
- if (resource < 0 || resource >= RLIM_NLIMITS) {
|
||||
+ if (resource < 0 || resource >= RLIMIT_NLIMITS) {
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
"invalid resource specified");
|
||||
return NULL;
|
||||
@@ -0,0 +1,6 @@
|
||||
[source]
|
||||
git = "https://gitlab.redox-os.org/redox-os/redoxer"
|
||||
branch = "master"
|
||||
|
||||
[build]
|
||||
template = "cargo"
|
||||
@@ -0,0 +1,3 @@
|
||||
/llvm-build/
|
||||
/llvm-prefix/
|
||||
/llvm-source/
|
||||
@@ -0,0 +1,28 @@
|
||||
[llvm]
|
||||
download-ci-llvm = false
|
||||
static-libstdcpp = false
|
||||
link-shared = true
|
||||
|
||||
[build]
|
||||
host = ["TARGET"]
|
||||
target = ["TARGET", "i586-unknown-redox", "x86_64-unknown-redox", "aarch64-unknown-redox", "riscv64gc-unknown-redox"]
|
||||
cargo-native-static = true
|
||||
submodules = false
|
||||
docs = false
|
||||
tools = ["cargo", "clippy", "rustdoc", "rustfmt", "src"]
|
||||
extended = true
|
||||
verbose = 1
|
||||
|
||||
[install]
|
||||
prefix = "install"
|
||||
sysconfdir = "etc"
|
||||
|
||||
[rust]
|
||||
backtrace = false
|
||||
codegen-tests = false
|
||||
|
||||
[target.aarch64-unknown-linux-gnu]
|
||||
llvm-config = "COOKBOOK_TOOLCHAIN/bin/llvm-config"
|
||||
|
||||
[target.x86_64-unknown-linux-gnu]
|
||||
llvm-config = "COOKBOOK_TOOLCHAIN/bin/llvm-config"
|
||||
@@ -0,0 +1,35 @@
|
||||
[llvm]
|
||||
download-ci-llvm = false
|
||||
static-libstdcpp = false
|
||||
link-shared = true
|
||||
|
||||
[build]
|
||||
host = ["COOKBOOK_TARGET"]
|
||||
target = ["COOKBOOK_TARGET"]
|
||||
submodules = false
|
||||
docs = false
|
||||
tools = ["cargo", "clippy", "rustdoc", "rustfmt", "src"]
|
||||
extended = true
|
||||
verbose = 1
|
||||
|
||||
[install]
|
||||
prefix = "install"
|
||||
sysconfdir = "etc"
|
||||
|
||||
[rust]
|
||||
backtrace = false
|
||||
codegen-tests = false
|
||||
|
||||
[target.COOKBOOK_TARGET]
|
||||
cc = "COOKBOOK_GNU_TARGET-gcc"
|
||||
cxx = "COOKBOOK_GNU_TARGET-g++"
|
||||
ar = "COOKBOOK_GNU_TARGET-ar"
|
||||
linker = "COOKBOOK_GNU_TARGET-gcc"
|
||||
crt-static = false
|
||||
llvm-config = "COOKBOOK_SYSROOT/bin/llvm-config"
|
||||
|
||||
[target.aarch64-unknown-linux-gnu]
|
||||
llvm-config = "COOKBOOK_TOOLCHAIN/bin/llvm-config"
|
||||
|
||||
[target.x86_64-unknown-linux-gnu]
|
||||
llvm-config = "COOKBOOK_TOOLCHAIN/bin/llvm-config"
|
||||
@@ -0,0 +1,80 @@
|
||||
[source]
|
||||
git = "https://gitlab.redox-os.org/redox-os/rust.git"
|
||||
branch = "redox-2025-10-03"
|
||||
shallow_clone = true
|
||||
|
||||
[build]
|
||||
template = "custom"
|
||||
dependencies = [
|
||||
"llvm21",
|
||||
"zlib",
|
||||
"curl",
|
||||
"openssl3",
|
||||
]
|
||||
dev-dependencies = [
|
||||
"llvm21.dev",
|
||||
"llvm21.runtime",
|
||||
"lld21",
|
||||
]
|
||||
|
||||
script = """
|
||||
if [ "${COOKBOOK_HOST_SYSROOT}" = "/usr" ]; then
|
||||
|
||||
cat ${COOKBOOK_RECIPE}/config-bootstrap.toml > config.toml
|
||||
sed -i "s|TARGET|${TARGET}|g" config.toml
|
||||
sed -i "s|COOKBOOK_TOOLCHAIN|${COOKBOOK_TOOLCHAIN}|g" config.toml
|
||||
|
||||
else
|
||||
|
||||
DYNAMIC_INIT
|
||||
# Linker flags for stage2 compiler (host -> target)
|
||||
ARCH="${TARGET%%-*}"
|
||||
export CARGO_TARGET_${ARCH^^}_UNKNOWN_REDOX_RUSTFLAGS="${RUSTFLAGS}" # Rust
|
||||
# Hack for Rust errorneusly running `llvm-config --version` on cross compiled llvm-config
|
||||
cat "${COOKBOOK_ROOT}/bin/${TARGET}-llvm-config" > "${COOKBOOK_SYSROOT}/bin/llvm-config"
|
||||
# Hack for Rust stage1 being dynamically linked with LLVM in prefix toolchain
|
||||
export LD_LIBRARY_PATH="${COOKBOOK_HOST_SYSROOT}/lib:${LD_LIBRARY_PATH}"
|
||||
# Linker flags for stage1 compiler (host -> host)
|
||||
export RUSTFLAGS_BOOTSTRAP="\
|
||||
-Clink-args=-L${COOKBOOK_HOST_SYSROOT}/lib \
|
||||
-Clink-args=-Wl,-rpath-link,${COOKBOOK_HOST_SYSROOT}/lib"
|
||||
export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS="${RUSTFLAGS_BOOTSTRAP}"
|
||||
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUSTFLAGS="${RUSTFLAGS_BOOTSTRAP}"
|
||||
|
||||
cat ${COOKBOOK_RECIPE}/config.toml > config.toml
|
||||
sed -i "s|COOKBOOK_SYSROOT|${COOKBOOK_SYSROOT}|g" config.toml
|
||||
sed -i "s|COOKBOOK_TOOLCHAIN|${COOKBOOK_HOST_SYSROOT}|g" config.toml
|
||||
sed -i "s|COOKBOOK_TARGET|${TARGET}|g" config.toml
|
||||
sed -i "s|COOKBOOK_GNU_TARGET|${GNU_TARGET}|g" config.toml
|
||||
|
||||
fi
|
||||
|
||||
# Don't poison the stage1 compiler (host -> host)
|
||||
unset AR AS CC CXX LD LDFLAGS NM OBJCOPY OBJDUMP RANLIB READELF RUSTFLAGS CARGO_ENCODED_RUSTFLAGS STRIP
|
||||
|
||||
python3 "${COOKBOOK_SOURCE}/x.py" install \
|
||||
--config config.toml \
|
||||
--jobs ${COOKBOOK_MAKE_JOBS}
|
||||
|
||||
mkdir -p "${COOKBOOK_STAGE}"/usr
|
||||
rsync -av --delete "${COOKBOOK_BUILD}"/install/* "${COOKBOOK_STAGE}"/usr/
|
||||
rm -rf "${COOKBOOK_STAGE}"/usr/lib/rustlib/*.log
|
||||
|
||||
# workaround for rust.lld, needed by e.g. compiling bootloader
|
||||
# https://github.com/rust-lang/rust/issues/143076#issuecomment-3011710678
|
||||
LLD_DIR="${COOKBOOK_STAGE}/usr/lib/rustlib/$TARGET/bin"
|
||||
mkdir -p $LLD_DIR/gcc-ld
|
||||
cp ${COOKBOOK_SYSROOT}/usr/bin/lld $LLD_DIR/rust-lld
|
||||
ln -s rust-lld $LLD_DIR/wasm-component-ld
|
||||
ln -s ../rust-lld $LLD_DIR/gcc-ld/ld.lld
|
||||
ln -s ../rust-lld $LLD_DIR/gcc-ld/ld64.lld
|
||||
ln -s ../rust-lld $LLD_DIR/gcc-ld/lld-link
|
||||
ln -s ../rust-lld $LLD_DIR/gcc-ld/wasm-ld
|
||||
ln -s ../../../libLLVM.so.21.1 $LLD_DIR/../lib/libLLVM.so.21.1
|
||||
"""
|
||||
|
||||
[[optional-packages]]
|
||||
name = "doc"
|
||||
files = [
|
||||
"usr/share/doc/**",
|
||||
]
|
||||
@@ -0,0 +1,30 @@
|
||||
[source]
|
||||
git = "https://github.com/RustPython/RustPython"
|
||||
# newer rev requires 'bits/libc-header-start.h' for bindgen
|
||||
rev = "2025-10-13-main-51"
|
||||
shallow_clone = true
|
||||
patches = [
|
||||
"redox.patch"
|
||||
]
|
||||
|
||||
[build]
|
||||
dependencies = [
|
||||
"openssl3",
|
||||
"zlib",
|
||||
]
|
||||
template = "custom"
|
||||
script = """
|
||||
DYNAMIC_INIT
|
||||
|
||||
export BUILDTIME_RUSTPYTHONPATH=/lib/rustpython
|
||||
export OPENSSL_DIR="${COOKBOOK_SYSROOT}"
|
||||
export ZLIB_STATIC=1
|
||||
cookbook_cargo --features ssl
|
||||
mkdir -p "${COOKBOOK_STAGE}/lib"
|
||||
rsync -aE \
|
||||
--exclude 'test/' \
|
||||
--exclude '__pycache__/' \
|
||||
--exclude '*.pyc' \
|
||||
--exclude '/README.md' \
|
||||
"${COOKBOOK_SOURCE}"/Lib/ "${COOKBOOK_STAGE}/lib/rustpython"
|
||||
"""
|
||||
@@ -0,0 +1,22 @@
|
||||
diff --git a/stdlib/src/posixsubprocess.rs b/stdlib/src/posixsubprocess.rs
|
||||
index 7f418c899..4da6a6858 100644
|
||||
--- a/stdlib/src/posixsubprocess.rs
|
||||
+++ b/stdlib/src/posixsubprocess.rs
|
||||
@@ -441,15 +441,14 @@ fn close_dir_fds(keep: KeepFds<'_>) -> nix::Result<()> {
|
||||
fn close_filetable_fds(keep: KeepFds<'_>) -> nix::Result<()> {
|
||||
use nix::fcntl;
|
||||
use std::os::fd::{FromRawFd, OwnedFd};
|
||||
- let fd = fcntl::open(
|
||||
+ let filetable = fcntl::open(
|
||||
c"/scheme/thisproc/current/filetable",
|
||||
fcntl::OFlag::O_RDONLY,
|
||||
nix::sys::stat::Mode::empty(),
|
||||
)?;
|
||||
- let filetable = unsafe { OwnedFd::from_raw_fd(fd) };
|
||||
let read_one = || -> nix::Result<_> {
|
||||
let mut byte = 0;
|
||||
- let n = nix::unistd::read(filetable.as_raw_fd(), std::slice::from_mut(&mut byte))?;
|
||||
+ let n = nix::unistd::read(&filetable, std::slice::from_mut(&mut byte))?;
|
||||
Ok((n > 0).then_some(byte))
|
||||
};
|
||||
while let Some(c) = read_one()? {
|
||||
Reference in New Issue
Block a user