Merge branch cookbook:master into neovim-deps

This commit is contained in:
Wildan Mubarok 2025-09-10 08:36:49 +00:00
commit 15fa1220e3
79 changed files with 942 additions and 3848 deletions

70
Cargo.lock generated
View File

@ -1538,6 +1538,8 @@ checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c"
[[package]]
name = "pkgar"
version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db98a45d3bdaf7dceeee5716f3eec9af0e67deec64eec9e717536b89de323c22"
dependencies = [
"anyhow",
"blake3 0.3.8",
@ -1550,29 +1552,17 @@ dependencies = [
[[package]]
name = "pkgar"
version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "db98a45d3bdaf7dceeee5716f3eec9af0e67deec64eec9e717536b89de323c22"
version = "0.1.19"
dependencies = [
"anyhow",
"blake3 0.3.8",
"bytemuck",
"clap",
"pkgar-core 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
"pkgar-keys 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
"pkgar-core 0.1.19",
"pkgar-keys 0.1.19",
"thiserror 2.0.12",
]
[[package]]
name = "pkgar-core"
version = "0.1.18"
dependencies = [
"bitflags 1.3.2",
"blake3 0.3.8",
"bytemuck",
"dryoc",
]
[[package]]
name = "pkgar-core"
version = "0.1.18"
@ -1585,9 +1575,21 @@ dependencies = [
"dryoc",
]
[[package]]
name = "pkgar-core"
version = "0.1.19"
dependencies = [
"bitflags 1.3.2",
"blake3 0.3.8",
"bytemuck",
"dryoc",
]
[[package]]
name = "pkgar-keys"
version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4494325c5c408d718d1df657cceeadc2102f02e7c9298343ce230f557f13e80c"
dependencies = [
"anyhow",
"clap",
@ -1604,16 +1606,14 @@ dependencies = [
[[package]]
name = "pkgar-keys"
version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4494325c5c408d718d1df657cceeadc2102f02e7c9298343ce230f557f13e80c"
version = "0.1.19"
dependencies = [
"anyhow",
"clap",
"dirs 3.0.2",
"hex",
"lazy_static",
"pkgar-core 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
"pkgar-core 0.1.19",
"seckey",
"serde",
"termion",
@ -1838,9 +1838,9 @@ checksum = "70f49b2c29ae3c72ff3a8dbc1c5eefba9093a8c5ceaa8ca5292833816fe931e2"
dependencies = [
"anyhow",
"indicatif",
"pkgar 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
"pkgar-core 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
"pkgar-keys 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
"pkgar 0.1.18",
"pkgar-core 0.1.18",
"pkgar-keys 0.1.18",
"reqwest",
"serde",
"serde_derive",
@ -1850,14 +1850,14 @@ dependencies = [
[[package]]
name = "redox-pkg"
version = "0.2.7"
source = "git+https://gitlab.redox-os.org/redox-os/pkgutils#436c97a0df26bfce24e33a5a86a21218aca7591f"
version = "0.2.8"
source = "git+https://gitlab.redox-os.org/redox-os/pkgutils#ea2641126c8b38d7b8997c5c7ebec74999fc9578"
dependencies = [
"anyhow",
"ignore",
"pkgar 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
"pkgar-core 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
"pkgar-keys 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
"pkgar 0.1.18",
"pkgar-core 0.1.18",
"pkgar-keys 0.1.18",
"reqwest",
"serde",
"serde_derive",
@ -1883,10 +1883,10 @@ dependencies = [
"ignore",
"object",
"pbr",
"pkgar 0.1.18",
"pkgar-core 0.1.18",
"pkgar-keys 0.1.18",
"redox-pkg 0.2.7",
"pkgar 0.1.19",
"pkgar-core 0.1.19",
"pkgar-keys 0.1.19",
"redox-pkg 0.2.8",
"redoxer",
"serde",
"tempfile",
@ -1908,9 +1908,9 @@ dependencies = [
"fscommon",
"gpt",
"libc",
"pkgar 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
"pkgar-core 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
"pkgar-keys 0.1.18 (registry+https://github.com/rust-lang/crates.io-index)",
"pkgar 0.1.18",
"pkgar-core 0.1.18",
"pkgar-keys 0.1.18",
"rand 0.8.5",
"redox-pkg 0.2.5",
"redox_liner",
@ -2923,7 +2923,7 @@ version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb"
dependencies = [
"windows-sys 0.59.0",
"windows-sys 0.48.0",
]
[[package]]

View File

@ -5,12 +5,15 @@ source config.sh
if [ $# = 0 ]
then
recipes="$(target/release/list_recipes)"
recipes="$(target/release/list_recipes --short)"
else
recipes="$@"
fi
for recipe_path in $recipes
for recipe_name in $recipes
do
./cook.sh "$recipe_path" distclean
recipe_path=`target/release/find_recipe $recipe_name`
echo -e "\033[01;38;5;215mcook - clean $recipe_name\033[0m"
rm -rf "${ROOT}/$recipe_path/target/${TARGET}"
done

View File

@ -14,7 +14,6 @@ fi
# Automatic variables
ROOT="$(cd `dirname "$0"` && pwd)"
REPO="$ROOT/repo/$TARGET"
export PATH="${ROOT}/bin:$PATH"
export AR="${HOST}-gcc-ar"
@ -43,26 +42,11 @@ export PKG_CONFIG_FOR_BUILD="pkg-config"
if [[ "$OSTYPE" == "darwin"* ]] || [[ "$OSTYPE" == "FreeBSD" ]]; then
# GNU find
FIND="gfind";
# GNU stat from Homebrew or MacPorts
if [ ! -z "$(which brew)" ]; then
STAT="$(brew --prefix)/opt/coreutils/libexec/gnubin/stat";
elif [ ! -z "$(which port)" ]; then
# TODO: find a programatic way of asking MacPorts for it's root dir.
STAT="/opt/local/opt/coreutils/libexec/gnubin/stat";
elif [ ! -z "$(which pkg)" ]; then
STAT="gnustat"
else
echo "Please install either Homebrew or MacPorts and run the boostrap script."
exit 1
fi
else
FIND="find"
STAT="stat";
FIND="find";
fi
export FIND
export STAT
if [ ! "$(uname -s)" = "Redox" ]
then

380
cook.sh
View File

@ -1,380 +0,0 @@
#!/usr/bin/env bash
set -e
shopt -s nullglob
source config.sh
# Variables to be overriden by recipes
export BINDIR=bin
export CARGO=(env RUSTFLAGS="$PREFIX_RUSTFLAGS -C link-arg=-zmuldefs" cargo)
export CARGOBUILD=rustc
export CARGOFLAGS=
export DEBUG=
export EXAMPLES=
export PREPARE_COPY=1
if hash sha256sum 2>/dev/null
then
SHASUM="sha256sum"
else
SHASUM="shasum -a 256"
fi
function usage {
echo "cook.sh $1 <op>" >&2
echo " dist" >&2
echo " distclean" >&2
echo " build" >&2
echo " clean" >&2
echo " fetch" >&2
echo " unfetch" >&2
echo " pkg" >&2
echo " unpkg" >&2
echo " prepare" >&2
echo " unprepare" >&2
echo " stage" >&2
echo " unstage" >&2
echo " version" >&2
}
function op {
if [ ! "$COOK_QUIET" = "1" ]
then
echo -e "\033[01;38;5;215mcook - $1 $2\033[0m" >&2
fi
case "$2" in
dist)
op $1 prepare
op $1 build
op $1 stage
op $1 pkg
;;
distclean)
op $1 unpkg
op $1 unstage
op $1 unprepare
;;
fetch)
skip=0
if [ "$(type -t recipe_fetch)" = "function" ]
then
recipe_fetch
fi
if [ "$skip" -eq "0" ]
then
if [ -n "$TAR" ]
then
if [ ! -f source.tar ]
then
wget "$TAR" --continue -O source.tar.tmp
mv source.tar.tmp source.tar
fi
if [ -n "$TAR_SHA256" ]
then
$SHASUM -c <<< "${TAR_SHA256} source.tar"
fi
if [ ! -d source ]
then
mkdir source
tar xvf source.tar -C source --strip-components 1
fi
elif [ -n "$GIT" ]
then
if [ ! -d source ]
then
if [ -n "$BRANCH" ]
then
git clone --recursive "$GIT" -b "$BRANCH" source
else
git clone --recursive "$GIT" source
fi
fi
pushd source > /dev/null
git remote set-url origin "$GIT"
git fetch origin
if [ -n "$GIT_UPSTREAM" ]
then
git remote set-url upstream "$GIT_UPSTREAM" &> /dev/null ||
git remote add upstream "$GIT_UPSTREAM"
git fetch upstream
fi
ORIGIN_BRANCH="$(git branch --remotes | grep '^ origin/HEAD -> ' | cut -d ' ' -f 5-)"
if [ -n "$BRANCH" ]
then
ORIGIN_BRANCH="origin/$BRANCH"
fi
if [ "$(git rev-parse HEAD)" != "$(git rev-parse $ORIGIN_BRANCH)" ]
then
git checkout -B "$(echo "$ORIGIN_BRANCH" | cut -d / -f 2-)" "$ORIGIN_BRANCH"
fi
git submodule sync --recursive
git submodule update --init --recursive
popd > /dev/null
fi
fi
;;
unfetch)
rm -rfv source source.tar
;;
prepare)
skip=0
if [ "$(type -t recipe_prepare)" = "function" ]
then
recipe_prepare
fi
if [ "$skip" -eq "0" ]
then
rm -rf "${COOKBOOK_SYSROOT}"
mkdir "${COOKBOOK_SYSROOT}"
# usrmerge
mkdir "${COOKBOOK_SYSROOT}/usr"
for folder in bin include lib share
do
mkdir "${COOKBOOK_SYSROOT}/usr/${folder}"
ln -s "usr/${folder}" "${COOKBOOK_SYSROOT}/${folder}"
done
if [ ${#BUILD_DEPENDS} -gt 0 ]
then
pushd $ROOT
./repo.sh "${BUILD_DEPENDS[@]}"
popd
for i in "${BUILD_DEPENDS[@]}"
do
pkgar \
extract \
"${COOKBOOK_SYSROOT}" \
--archive "$REPO/$i.pkgar" \
--pkey "${ROOT}/build/id_ed25519.pub.toml"
done
fi
rm -rf "${COOKBOOK_BUILD}"
if [ "$PREPARE_COPY" -eq "0" ]
then
mkdir "${COOKBOOK_BUILD}"
else
cp -Rp source "${COOKBOOK_BUILD}"
fi
for patch in *.patch
do
patch -p1 -d "${COOKBOOK_BUILD}" < "$patch"
done
fi
;;
unprepare)
rm -rf "${COOKBOOK_BUILD}"
rm -rf "${COOKBOOK_SYSROOT}"
;;
version)
pushd "${COOKBOOK_BUILD}" > /dev/null
skip=0
if [ "$(type -t recipe_version)" = "function" ]
then
recipe_version
fi
if [ "$skip" -eq "0" ]
then
# there's an unstable built-in cargo config command, so hack around it
cargo-config config package.version | tr -d '"'
fi
popd > /dev/null
;;
gitversion)
if [ -d "${COOKBOOK_BUILD}"/.git ]
then
echo "$(op $1 version)-$(git -C "${COOKBOOK_BUILD}" rev-parse --short HEAD)"
else
op $1 version
fi
;;
build)
pushd "${COOKBOOK_BUILD}" > /dev/null
skip=0
if [ "$(type -t recipe_build)" = "function" ]
then
recipe_build
fi
release_flag="--release"
if [ "$DEBUG" == 1 ]
then
release_flag=
fi
if [ -n "$CARGO_PACKAGE" ]; then
package_flag="--package=$CARGO_PACKAGE"
else
package_flag=
fi
if [ "$skip" -eq "0" ]
then
"${CARGO[@]}" "$CARGOBUILD" --target "$TARGET" $release_flag $package_flag $CARGOFLAGS
fi
popd > /dev/null
;;
clean)
pushd "${COOKBOOK_BUILD}" > /dev/null
skip=0
if [ "$(type -t recipe_clean)" = "function" ]
then
recipe_clean
fi
if [ "$skip" -eq "0" ]
then
"${CARGO[@]}" clean
fi
popd > /dev/null
;;
stage)
op $1 unstage
mkdir -p "${COOKBOOK_STAGE}"
stage="$(realpath "${COOKBOOK_STAGE}")"
source="$(realpath source)"
pushd "${COOKBOOK_BUILD}" > /dev/null
skip=0
if [ "$(type -t recipe_stage)" = "function" ]
then
recipe_stage "$stage"
fi
if [ "$skip" -eq "0" ]
then
#TODO "${CARGO[@]}" install --root "$stage" $CARGOFLAGS
if [ "$DEBUG" == 1 ]
then
build=debug
else
build=release
fi
bins="$(find target/$TARGET/$build/ -maxdepth 1 -type f ! -name '*.*')"
if [ -z "$bins" ] || [ "$EXAMPLES" == 1 ]
then
example=true
bins="$bins $(find target/$TARGET/$build/examples/ -maxdepth 1 -type f ! -name '*.*' ! -name '*-*' \
2> /dev/null || true)"
fi
if [ -n "$bins" ]
then
if [ -n "$example" ] && [ "$EXAMPLES" != 1 ]
then
echo "$(tput bold)Note$(tput sgr0): No binaries detected, using example binaries"
fi
mkdir -p "$stage/$BINDIR"
for bin in $bins
do
if [ "$DEBUG" == 1 ]
then
cp -v "$bin" "$stage/$BINDIR/$(basename $bin)"
else
"${STRIP}" -v "$bin" -o "$stage/$BINDIR/$(basename $bin)"
fi
done
else
echo "$(tput bold)Warning$(tput sgr0): Recipe does not have any binaries" >&2
fi
fi
popd > /dev/null
;;
unstage)
rm -rfv "${COOKBOOK_STAGE}"
rm -fv "${TARGET_DIR}/auto_deps.toml"
;;
pkg)
pkgar \
create \
--archive "${COOKBOOK_STAGE}.pkgar" \
--skey "${ROOT}/build/id_ed25519.toml" \
"${COOKBOOK_STAGE}"
# Generate stage.toml
echo "name = \"$1\"" > "${COOKBOOK_STAGE}.toml"
echo "version = \"$(op $1 version)\"" >> "${COOKBOOK_STAGE}.toml"
echo "target = \"$TARGET\"" >> "${COOKBOOK_STAGE}.toml"
# Add runtime dependencies to package if they exist
if [ -n "$DEPENDS" ]
then
# Remove leading and trailing whitespace, replace whitespace between
# package names with commas, and surround package names with quotes
dependencies=$(echo -e "$DEPENDS" | sed -E 's/^[[:space:]]*//;s/[[:space:]]*$//;s/[[:space:]]+/,/g;s/[^, ][^, ]*/"&"/g')
echo "depends = [$dependencies]" >> "${COOKBOOK_STAGE}.toml"
else
echo "depends = []" >> "${COOKBOOK_STAGE}.toml"
fi
;;
unpkg)
rm -fv "${COOKBOOK_STAGE}.pkgar" "${COOKBOOK_STAGE}.toml"
;;
*)
usage $1
;;
esac
}
if [ -n "$1" ]
then
if (echo "$1" | grep '.*/.*' >/dev/null); then
recipe_name=$(basename "$1")
recipe_path="$1"
else
recipe_name="$1"
recipe_path=`target/release/find_recipe $recipe_name`
fi
if [ -d "$ROOT/$recipe_path" ]
then
export COOKBOOK_RECIPE="${ROOT}/$recipe_path"
TARGET_DIR="${COOKBOOK_RECIPE}/target/${TARGET}"
mkdir -p "${TARGET_DIR}"
export COOKBOOK_BUILD="${TARGET_DIR}/build"
export COOKBOOK_STAGE="${TARGET_DIR}/stage"
export COOKBOOK_SOURCE="${COOKBOOK_RECIPE}/source"
export COOKBOOK_SYSROOT="${TARGET_DIR}/sysroot"
export PKG_CONFIG_ALLOW_CROSS=1
export PKG_CONFIG_PATH=
export PKG_CONFIG_LIBDIR="${COOKBOOK_SYSROOT}/lib/pkgconfig"
export PKG_CONFIG_SYSROOT_DIR="${COOKBOOK_SYSROOT}"
cd "${COOKBOOK_RECIPE}"
if [ -e recipe.sh ]; then
source recipe.sh
fi
ops=()
for arg in "${@:2}"
do
if [ "$arg" == "--debug" ]
then
DEBUG=1
else
ops[${#ops[@]}]="$arg"
fi
done
for i in "${ops[@]}"
do
op "$recipe_name" "$i"
done
elif [ "$IGNORE_ERROR" != "1" ]
then
echo "cook.sh: recipe '$recipe_name' at not found" >&2
exit 1
fi
else
usage "{package}"
fi

View File

@ -3,39 +3,4 @@ set -e
source config.sh
recipes=""
for arg in "${@:1}"
do
if [ "$arg" == "--nonstop" ]
then
set +e
elif [ "$arg" == "--offline" ]
then
export COOKBOOK_OFFLINE="1"
else
recipes+=" $arg"
fi
done
if [ "$recipes" == "" ]
then
recipes="$(target/release/list_recipes)"
fi
for recipe_path in $recipes
do
if (echo "$recipe_path" | grep '.*/.*' >/dev/null); then
recipe_name=$(basename "$recipe_path")
recipe_path="$recipe_path"
else
recipe_name="$recipe_path"
recipe_path=`target/release/find_recipe $recipe_name`
fi
if [ -e "$recipe_path/recipe.toml" ]
then
target/release/cook --fetch-only "$recipe_name"
else
./cook.sh "$recipe_name" fetch
fi
done
target/release/cook --fetch-only ${@:1}

2
pkgar

@ -1 +1 @@
Subproject commit 185fe5c3346d9aa552f308cf61c66f7b6e25280a
Subproject commit 44677ccbff9e315ce9de1a85ac5a30cfff1aad30

View File

@ -6,13 +6,10 @@ patches = ["redox.patch"]
[build]
template = "custom"
script = """
DYNAMIC_INIT
rsync -av --delete "${COOKBOOK_SOURCE}/" ./
# No configure provided
COOKBOOK_CONFIGURE="true"
COOKBOOK_CONFIGURE_FLAGS=""
export CPPFLAGS="${CPPFLAGS} -D_REDOX"
cookbook_configure
${COOKBOOK_MAKE}
${COOKBOOK_MAKE} install DESTDIR="${COOKBOOK_STAGE}" prefix="/usr"
"""

View File

@ -9,4 +9,5 @@ script = """
DYNAMIC_INIT
rsync -av --delete "${COOKBOOK_SOURCE}/" ./
${COOKBOOK_MAKE}
${COOKBOOK_MAKE} install DESTDIR="${COOKBOOK_STAGE}" prefix="/usr"
"""

View File

@ -13,8 +13,6 @@ dependencies = [
]
template = "custom"
script = """
export LDFLAGS="-L${COOKBOOK_SYSROOT}/lib"
export CPPFLAGS="-I${COOKBOOK_SYSROOT}/include"
"${CXX}" \
$("${PKG_CONFIG}" --cflags cairo) \
"${COOKBOOK_RECIPE}/cairodemo.c" \

View File

@ -22,9 +22,7 @@ dependencies = [
script = """
DYNAMIC_INIT
export LDFLAGS="-Wl,-rpath-link,${COOKBOOK_SYSROOT}/lib $LDFLAGS"
COOKBOOK_CMAKE_FLAGS=(
COOKBOOK_CMAKE_FLAGS+=(
-DBUILD_TESTING=Off
-DCMAKE_USE_SYSTEM_BZIP2=On
-DCMAKE_USE_SYSTEM_CURL=On

View File

@ -28,8 +28,6 @@ MAKEFLAGS=(
BLK_SHA1=1
V=1
)
export LDFLAGS="-L${COOKBOOK_SYSROOT}/usr/lib"
export CPPFLAGS="-I${COOKBOOK_SYSROOT}/usr/include"
export CURL_CONFIG="${COOKBOOK_SYSROOT}/usr/bin/curl-config"
./configure \
--host="${GNU_TARGET}" \

View File

@ -31,7 +31,7 @@ case "${TARGET}" in
;;
esac
COOKBOOK_CMAKE_FLAGS=(
COOKBOOK_CMAKE_FLAGS+=(
-DCMAKE_CXX_FLAGS="--std=gnu++11"
-DBUILD_SHARED_LIBS=False
-DLLVM_LINK_LLVM_DYLIB=On

View File

@ -15,8 +15,8 @@ dependencies = [
template = "custom"
script = """
DYNAMIC_INIT
export CFLAGS="-I${COOKBOOK_SYSROOT}/include/SDL"
export CPPFLAGS="-I${COOKBOOK_SYSROOT}/include/SDL"
export CFLAGS="${CFLAGS} -I${COOKBOOK_SYSROOT}/include/SDL"
export CPPFLAGS="${CPPFLAGS} -I${COOKBOOK_SYSROOT}/include/SDL"
export LDFLAGS+=" -lorbital"
COOKBOOK_CONFIGURE_FLAGS+=(
--disable-opengl

View File

@ -16,8 +16,8 @@ dependencies = [
]
script = """
DYNAMIC_INIT
export CFLAGS="${CFLAGS} -I${COOKBOOK_SYSROOT}/usr/include -I${COOKBOOK_SYSROOT}/usr/include/SDL2"
export CXXFLAGS="${CXXFLAGS} -D_GLIBCXX_USE_C99_MATH_TR1=1 -I${COOKBOOK_SYSROOT}/usr/include -I${COOKBOOK_SYSROOT}/usr/include/SDL2"
export CFLAGS="${CFLAGS} -I${COOKBOOK_SYSROOT}/usr/include/SDL2"
export CXXFLAGS="${CXXFLAGS} -D_GLIBCXX_USE_C99_MATH_TR1=1 -I${COOKBOOK_SYSROOT}/usr/include/SDL2"
#TODO: don't use this
export SDL_LIBS="-lSDL2 -lorbital $("${TARGET}-pkg-config" --libs osmesa) -lstdc++"
#TODO: don't add curl

View File

@ -17,7 +17,7 @@ export BUILDDIR="${COOKBOOK_BUILD}"
export DESTDIR="${COOKBOOK_STAGE}"
# Redox currently doesn't support dynamic library loading
export LDFLAGS="$(pkg-config --libs sdl)"
export LDFLAGS="${LDFLAGS} $(pkg-config --libs sdl)"
# Networking is currently broken on Redox (missing setsockopt?)
export USE_NET=0

View File

@ -19,14 +19,9 @@ DYNAMIC_INIT
# Copy source to build directory
rsync -av --delete "${COOKBOOK_SOURCE}/" ./
export CFLAGS="-I${COOKBOOK_SYSROOT}/include -I${COOKBOOK_SYSROOT}/include/SDL"
export CFLAGS="${CFLAGS} -I${COOKBOOK_SYSROOT}/include/SDL"
export SDLCONFIG="${COOKBOOK_SYSROOT}/bin/sdl-config --prefix=${COOKBOOK_SYSROOT}"
export LDFLAGS="-L${COOKBOOK_SYSROOT}/lib"
if [[ -n "${COOKBOOK_PREFER_STATIC}" ]]; then
LDFLAGS+=" -static"
fi
PLATFORM=REDOX "${COOKBOOK_MAKE}" -j"$($NPROC)"
mkdir -pv "${COOKBOOK_STAGE}/usr/games"

View File

@ -21,8 +21,6 @@ DYNAMIC_INIT
rsync -av --delete "${COOKBOOK_SOURCE}/" ./
export CPPHOST="${TARGET}-g++"
export LDFLAGS="-L${COOKBOOK_SYSROOT}/lib"
export CPPFLAGS="-I${COOKBOOK_SYSROOT}/include"
"${REDOX_MAKE}" all -j"$(${NPROC})"

View File

@ -38,7 +38,7 @@ export bindir="${prefix}/games"
export icondir="/ui/icons/apps"
export gamesdir="${prefix}/share/games"
if ! [[ -n "${COOKBOOK_PREFER_STATIC}" ]]; then
if [ "${COOKBOOK_DYNAMIC}" == "1" ]; then
LDFLAGS+=" -lstdc++"
fi

View File

@ -39,7 +39,7 @@ export USE_SDL2=1
export USE_CODEC_MP3=0
export DO_USERDIRS=1
if ! [[ -n "${COOKBOOK_PREFER_STATIC}" ]]; then
if [ "${COOKBOOK_DYNAMIC}" == "1" ]; then
LDFLAGS+=" -lstdc++"
fi

View File

@ -10,8 +10,7 @@ dependencies = [
"libiconv",
]
script = """
export CFLAGS="-I${COOKBOOK_SYSROOT}/include -I${COOKBOOK_SYSROOT}/include/SDL"
export LDFLAGS="-L${COOKBOOK_SYSROOT}/lib -static"
export CFLAGS="${CFLAGS} -I${COOKBOOK_SYSROOT}/include/SDL"
export LIBS="-lSDL -lorbital" # TODO: Uses sdl-config instead of pkg-config
# For some reason, cook_configure breaks spectacularly on this

View File

@ -4,6 +4,6 @@ git = "https://gitlab.freedesktop.org/xdg/default-icon-theme.git"
[build]
template = "custom"
script = """
meson setup -Dprefix=/usr . "${COOKBOOK_SOURCE}"
meson setup --reconfigure -Dprefix=/usr . "${COOKBOOK_SOURCE}"
env DESTDIR="${COOKBOOK_STAGE}" meson install
"""

View File

@ -9,12 +9,8 @@ autotools_recursive_regenerate
[build]
template = "custom"
script = """
DYNAMIC_INIT
COOKBOOK_CONFIGURE_FLAGS=(
--host="${GNU_TARGET}"
--prefix="/usr"
--enable-shared
--enable-static
DYNAMIC_STATIC_INIT
COOKBOOK_CONFIGURE_FLAGS+=(
--without-docbook
--without-examples
--without-tests

View File

@ -9,6 +9,6 @@ dependencies = [
"zlib"
]
script = """
DYNAMIC_INIT
cookbook_meson -Ddefault_library=both
DYNAMIC_STATIC_INIT
cookbook_meson
"""

View File

@ -1,6 +1,20 @@
diff -ruwN '--exclude=subprojects' glib-2.82.5/gio/glocalfile.c source/gio/glocalfile.c
--- glib-2.82.5/gio/glocalfile.c 2025-02-20 06:08:16.000000000 -0700
+++ source/gio/glocalfile.c 2025-09-08 15:00:09.240010601 -0600
@@ -77,6 +77,10 @@
#include "glib-private.h"
+#if defined(__redox__)
+#undef AT_FDCWD
+#endif
+
#ifdef G_OS_WIN32
#include <windows.h>
#include <io.h>
diff -ruwN '--exclude=subprojects' glib-2.82.5/gio/gnetworking.h.in source/gio/gnetworking.h.in
--- glib-2.82.5/gio/gnetworking.h.in 2025-02-20 06:08:16.000000000 -0700
+++ source/gio/gnetworking.h.in 2025-04-10 14:12:46.307891418 -0600
+++ source/gio/gnetworking.h.in 2025-04-21 14:36:14.671018625 -0600
@@ -40,13 +40,17 @@
#include <netdb.h>
#include <netinet/in.h>
@ -19,9 +33,42 @@ diff -ruwN '--exclude=subprojects' glib-2.82.5/gio/gnetworking.h.in source/gio/g
@NAMESER_COMPAT_INCLUDE@
#ifndef __GI_SCANNER__
diff -ruwN '--exclude=subprojects' glib-2.82.5/gio/gsocket.c source/gio/gsocket.c
--- glib-2.82.5/gio/gsocket.c 2025-02-20 06:08:16.000000000 -0700
+++ source/gio/gsocket.c 2025-06-16 09:52:49.595949295 -0600
@@ -487,6 +487,7 @@
if (!g_socket_get_option (socket, SOL_SOCKET, SO_TYPE, &value, NULL))
{
errsv = get_socket_errno ();
+ fprintf(stderr, "%s:%d\n", __FILE__, __LINE__);
goto err;
}
@@ -513,6 +514,7 @@
if (getsockname (fd, &address.sa, &addrlen) != 0)
{
errsv = get_socket_errno ();
+ fprintf(stderr, "%s:%d\n", __FILE__, __LINE__);
goto err;
}
@@ -531,11 +533,13 @@
if (!g_socket_get_option (socket, SOL_SOCKET, SO_DOMAIN, &family, NULL))
{
errsv = get_socket_errno ();
+ fprintf(stderr, "%s:%d\n", __FILE__, __LINE__);
goto err;
}
#else
/* This will translate to G_IO_ERROR_FAILED on either unix or windows */
errsv = -1;
+ fprintf(stderr, "%s:%d\n", __FILE__, __LINE__);
goto err;
#endif
}
diff -ruwN '--exclude=subprojects' glib-2.82.5/gio/gthreadedresolver.c source/gio/gthreadedresolver.c
--- glib-2.82.5/gio/gthreadedresolver.c 2025-02-20 06:08:16.000000000 -0700
+++ source/gio/gthreadedresolver.c 2025-04-10 15:19:32.649611384 -0600
+++ source/gio/gthreadedresolver.c 2025-04-21 14:36:14.672018626 -0600
@@ -579,8 +579,26 @@
return g_task_propagate_pointer (G_TASK (result), error);
}
@ -64,7 +111,7 @@ diff -ruwN '--exclude=subprojects' glib-2.82.5/gio/gthreadedresolver.c source/gi
len = res_query (rrname, C_IN, rrtype, answer->data, answer->len);
diff -ruwN '--exclude=subprojects' glib-2.82.5/gio/gunixmounts.c source/gio/gunixmounts.c
--- glib-2.82.5/gio/gunixmounts.c 2025-02-20 06:08:16.000000000 -0700
+++ source/gio/gunixmounts.c 2025-04-10 14:57:29.342807607 -0600
+++ source/gio/gunixmounts.c 2025-04-21 14:36:14.672018626 -0600
@@ -1135,6 +1135,37 @@
return NULL;
}
@ -134,7 +181,7 @@ diff -ruwN '--exclude=subprojects' glib-2.82.5/gio/gunixmounts.c source/gio/guni
}
diff -ruwN '--exclude=subprojects' glib-2.82.5/gio/meson.build source/gio/meson.build
--- glib-2.82.5/gio/meson.build 2025-02-20 06:08:16.000000000 -0700
+++ source/gio/meson.build 2025-04-10 14:06:57.909467382 -0600
+++ source/gio/meson.build 2025-04-21 14:36:14.672018626 -0600
@@ -18,7 +18,7 @@
gnetworking_h_nameser_compat_include = ''
@ -155,7 +202,7 @@ diff -ruwN '--exclude=subprojects' glib-2.82.5/gio/meson.build source/gio/meson.
int main (int argc, char ** argv) {
diff -ruwN '--exclude=subprojects' glib-2.82.5/gio/xdgmime/xdgmimecache.c source/gio/xdgmime/xdgmimecache.c
--- glib-2.82.5/gio/xdgmime/xdgmimecache.c 2025-02-20 06:08:16.000000000 -0700
+++ source/gio/xdgmime/xdgmimecache.c 2025-04-10 14:11:44.020815595 -0600
+++ source/gio/xdgmime/xdgmimecache.c 2025-04-21 14:36:14.673018628 -0600
@@ -22,7 +22,7 @@
#include <fnmatch.h>
#include <assert.h>

View File

@ -13,12 +13,6 @@ autotools_recursive_regenerate -I$(realpath ./m4)
[build]
template = "custom"
script = """
DYNAMIC_INIT
COOKBOOK_CONFIGURE_FLAGS=(
--host="${GNU_TARGET}"
--prefix="/usr"
--enable-shared
--enable-static
)
DYNAMIC_STATIC_INIT
cookbook_configure
"""

View File

@ -19,12 +19,8 @@ autotools_recursive_regenerate -I$(realpath ./m4) -I$(realpath ./srcm4)
[build]
template = "custom"
script = """
DYNAMIC_INIT
COOKBOOK_CONFIGURE_FLAGS=(
--host="${GNU_TARGET}"
--prefix="/usr"
--enable-shared
--enable-static
DYNAMIC_STATIC_INIT
COOKBOOK_CONFIGURE_FLAGS+=(
ac_cv_have_decl_program_invocation_name=no
)
cookbook_configure

View File

@ -6,6 +6,6 @@ blake3 = "3efc14da55c56fc0a6a50f109d9e1ee8a91f5ae7dd17a21d3aebe04a65f3ee96"
[build]
template = "custom"
script = """
DYNAMIC_INIT
DYNAMIC_STATIC_INIT
cookbook_cmake
"""

View File

@ -1,12 +1,8 @@
[source]
tar = "https://github.com/xiph/ogg/releases/download/v1.3.3/libogg-1.3.3.tar.xz"
blake3 = "8220c0e4082fa26c07b10bfe31f641d2e33ebe1d1bb0b20221b7016bc8b78a3a"
patches = [
"redox.patch"
]
tar = "https://github.com/xiph/ogg/releases/download/v1.3.4/libogg-1.3.4.tar.xz"
blake3 = "1cffbe7c498555ddfdb1390d7a38179c4bead6129ea37b1b1d54f3a76b816304"
script = """
DYNAMIC_INIT
GNU_CONFIG_GET config.sub
autotools_recursive_regenerate
"""

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@ git = "https://gitlab.redox-os.org/redox-os/liborbital.git"
[build]
template = "custom"
script = """
DYNAMIC_INIT
DYNAMIC_STATIC_INIT
rsync -av --delete "${COOKBOOK_SOURCE}/" ./
"${COOKBOOK_CARGO}" build --release
"${COOKBOOK_MAKE}" install HOST="${TARGET}" DESTDIR="${COOKBOOK_STAGE}"

View File

@ -12,12 +12,6 @@ autotools_recursive_regenerate
template = "custom"
dependencies = ["zlib"]
script = """
DYNAMIC_INIT
COOKBOOK_CONFIGURE_FLAGS=(
--host="${GNU_TARGET}"
--prefix="/usr"
--enable-shared
--enable-static
)
DYNAMIC_STATIC_INIT
cookbook_configure
"""

View File

@ -8,7 +8,7 @@ template = "custom"
script = """
DYNAMIC_INIT
COOKBOOK_CMAKE_FLAGS=(
COOKBOOK_CMAKE_FLAGS+=(
-DBUILD_TESTING=Off
)
cookbook_cmake

View File

@ -13,12 +13,8 @@ dependencies = [
"zlib"
]
script = """
DYNAMIC_INIT
COOKBOOK_CONFIGURE_FLAGS=(
--host="${GNU_TARGET}"
--prefix="/usr"
--enable-shared
--enable-static
DYNAMIC_STATIC_INIT
COOKBOOK_CONFIGURE_FLAGS+=(
--without-python
)
cookbook_configure

View File

@ -17,27 +17,19 @@ export CFLAGS+=" -DHAVE_PTHREAD=1"
export CPPFLAGS+=" -DHAVE_PTHREAD=1"
export LLVM_CONFIG="${TARGET}-llvm-config"
if [[ -n "${COOKBOOK_PREFER_STATIC}" ]]; then
export LDFLAGS+=" --static"
export DEFAULTLIB="static"
export LLVMSHARED="disabled"
if [ "${COOKBOOK_DYNAMIC}" == "1" ]; then
COOKBOOK_MESON_FLAGS+=(-Dshared-llvm=enabled)
else
export DEFAULTLIB="shared"
export LLVMSHARED="enabled"
COOKBOOK_MESON_FLAGS+=(-Dshared-llvm=disabled)
fi
COOKBOOK_MESON_FLAGS=(
-Ddefault_library="${DEFAULTLIB}"
-Dglx=disabled
-Dllvm=enabled
-Dosmesa=true
-Dplatforms=
-Dshader-cache=disabled
-Dshared-llvm="${LLVMSHARED}"
cookbook_meson \
-Dglx=disabled \
-Dllvm=enabled \
-Dosmesa=true \
-Dplatforms= \
-Dshader-cache=disabled \
-Dshared-glapi=disabled
)
cookbook_meson
# Hack to add LLVM libs
#TODO: only add necessary LLVM libs, not all of them

View File

@ -14,7 +14,7 @@ COOKBOOK_CONFIGURE_FLAGS=(
"redox-${ARCH}"
--prefix="/"
)
export CC="${CC_WRAPPER} ${TARGET}-gcc"
export CC="${CC_WRAPPER} ${GNU_TARGET}-gcc"
"${COOKBOOK_CONFIGURE}" "${COOKBOOK_CONFIGURE_FLAGS[@]}"
"${COOKBOOK_MAKE}" -j"${COOKBOOK_MAKE_JOBS}"
"${COOKBOOK_MAKE}" install_sw install_ssldirs DESTDIR="${COOKBOOK_STAGE}"

View File

@ -12,12 +12,6 @@ patches = [
[build]
template = "custom"
script = """
DYNAMIC_INIT
COOKBOOK_CONFIGURE_FLAGS=(
--host="${GNU_TARGET}"
--prefix="/usr"
--enable-shared
--enable-static
)
DYNAMIC_STATIC_INIT
cookbook_configure
"""

View File

@ -9,12 +9,6 @@ autotools_recursive_regenerate
[build]
template = "custom"
script = """
DYNAMIC_INIT
COOKBOOK_CONFIGURE_FLAGS=(
--host="${GNU_TARGET}"
--prefix="/usr"
--enable-shared
--enable-static
)
DYNAMIC_STATIC_INIT
cookbook_configure
"""

View File

@ -14,9 +14,6 @@ dependencies = [
"libiconv",
]
script = """
export CFLAGS="-I${COOKBOOK_SYSROOT}/include"
export LDFLAGS="-L${COOKBOOK_SYSROOT}/lib"
COOKBOOK_CONFIGURE_FLAGS=(
--prefix=/
--build="$(gcc -dumpmachine)"

View File

@ -16,8 +16,7 @@ dependencies = [
"zlib",
]
script = """
export CFLAGS="-I${COOKBOOK_SYSROOT}/include -I${COOKBOOK_SYSROOT}/include/freetype2"
export LDFLAGS="-L${COOKBOOK_SYSROOT}/lib"
export CFLAGS="${CFLAGS} -I${COOKBOOK_SYSROOT}/include/freetype2"
COOKBOOK_CONFIGURE_FLAGS=(
--prefix=/

View File

@ -12,7 +12,7 @@ dependencies = [
]
script = """
DYNAMIC_INIT
export LDFLAGS="$LDFLAGS -lorbital -lOSMesa -lstdc++"
export LDFLAGS="${LDFLAGS} -lorbital -lOSMesa -lstdc++"
COOKBOOK_CONFIGURE_FLAGS+=(
--disable-pulseaudio
--disable-video-x11

View File

@ -6,9 +6,20 @@ blake3 = "ec1abc6f672a7a6ee6f49ba544cc9529f73121b478310473be44fee22a140ebf"
template = "custom"
script = """
DYNAMIC_INIT
COOKBOOK_CONFIGURE_FLAGS=(--prefix="/usr")
if [ "${COOKBOOK_DYNAMIC}" == "1" ]
then
COOKBOOK_CONFIGURE_FLAGS+=(--shared)
else
COOKBOOK_CONFIGURE_FLAGS+=(--static)
fi
# See https://stackoverflow.com/questions/21396988/zlib-build-not-configuring-properly-with-cross-compiler-ignores-ar.
CHOST="${TARGET}" "${COOKBOOK_CONFIGURE}" --prefix="/usr"
env CHOST="${TARGET}" "${COOKBOOK_CONFIGURE}" "${COOKBOOK_CONFIGURE_FLAGS[@]}"
"${COOKBOOK_MAKE}" -j "$(nproc)"
"${COOKBOOK_MAKE}" install DESTDIR="${COOKBOOK_STAGE}"
patchelf --set-soname 'libz.so.1.3' "${COOKBOOK_STAGE}/usr/lib/libz.so.1.3"
solib="${COOKBOOK_STAGE}/usr/lib/libz.so.1.3"
if [ -e "${solib}" ]
then
patchelf --set-soname 'libz.so.1.3' "${solib}"
fi
"""

View File

@ -0,0 +1,12 @@
[source]
tar = "https://download.samba.org/pub/rsync/src/rsync-3.4.1.tar.gz"
patches = ["redox.patch"]
[build]
template = "configure"
dependencies = [
"zstd",
"lz4",
"openssl1",
"xxhash",
]

View File

@ -0,0 +1,25 @@
diff -ruwN source/rsync.h source-new/rsync.h
--- source/rsync.h 2025-01-16 02:21:54.000000000 +0700
+++ source-new/rsync.h 2025-09-08 12:18:06.427647717 +0700
@@ -483,6 +483,21 @@
#include <sys/sysmacros.h>
#endif
+#ifdef __redox__
+
+// no sys/sysmacros.h, probably no problem
+#include <sys/types.h>
+#define major(dev) (0)
+#define minor(dev) (0)
+#define makedev(maj, min) (0)
+
+// no openat yet
+#undef O_NOFOLLOW
+#undef O_DIRECTORY
+#undef AT_FDCWD
+
+#endif
+
#ifdef MAKEDEV_TAKES_3_ARGS
#define MAKEDEV(devmajor,devminor) makedev(0,devmajor,devminor)
#else

View File

@ -8,7 +8,7 @@ script = """
rsync -av --delete "${COOKBOOK_SOURCE}/" ./
pushd tests
export CARGO_TEST="${COOKBOOK_CARGO}"
export NATIVE_RELIBC=1
export NATIVE_RELIBC=0 # set 0 to link against relibc
"${COOKBOOK_MAKE}" -j "${COOKBOOK_MAKE_JOBS}" all bins_verify/relibc-tests
popd
mkdir -pv "${COOKBOOK_STAGE}/share/relibc"

View File

@ -23,10 +23,8 @@ dependencies = [
"libiconv"
]
script = """
DYNAMIC_INIT
DYNAMIC_STATIC_INIT
COOKBOOK_CONFIGURE_FLAGS+=(
--enable-static
--enable-shared
ac_cv_have_decl_program_invocation_name=no
gt_cv_locale_fr=false
gt_cv_locale_fr_utf8=false

View File

@ -14,8 +14,7 @@ dependencies = [
"libiconv",
]
script = """
export CFLAGS="-I${COOKBOOK_SYSROOT}/include -I${COOKBOOK_SYSROOT}/include/SDL"
export LDFLAGS="-L${COOKBOOK_SYSROOT}/lib -static"
export CFLAGS="${CFLAGS} -I${COOKBOOK_SYSROOT}/include/SDL"
export SDL_CONFIG="${COOKBOOK_SYSROOT}/bin/sdl-config"
COOKBOOK_CONFIGURE_FLAGS=(

View File

@ -9,16 +9,12 @@ autotools_recursive_regenerate
[build]
template = "custom"
script = """
DYNAMIC_INIT
COOKBOOK_CONFIGURE_FLAGS=(
--host="${GNU_TARGET}"
--prefix="/usr"
DYNAMIC_STATIC_INIT
COOKBOOK_CONFIGURE_FLAGS+=(
--disable-lzmadec
--disable-lzmainfo
--disable-xz
--disable-xzdec
--enable-shared=yes
--enable-static=yes
--enable-threads=no
)
cookbook_configure

View File

@ -10,8 +10,7 @@ dependencies = [
script = """
rsync -av --delete --exclude='.git' "${COOKBOOK_SOURCE}/" ./
export CFLAGS="-I${COOKBOOK_SYSROOT}/include -I${COOKBOOK_SYSROOT}/include/ncursesw"
export LDFLAGS="-L${COOKBOOK_SYSROOT}/lib"
export CFLAGS="${CFLAGS} -I${COOKBOOK_SYSROOT}/include/ncursesw"
"${COOKBOOK_MAKE}" -j"$(${NPROC})"

View File

@ -11,8 +11,6 @@ dependencies = [
]
script = """
rsync -av --delete --exclude='.git' "${COOKBOOK_SOURCE}/" ./
export CPPFLAGS="-I${COOKBOOK_SYSROOT}/include"
export LDFLAGS="-L${COOKBOOK_SYSROOT}/lib -static"
"${COOKBOOK_MAKE}" -j"$(${NPROC})"
mkdir -pv "${COOKBOOK_STAGE}/bin"

View File

@ -27,8 +27,8 @@ DYNAMIC_INIT
rsync -av --delete "${COOKBOOK_SOURCE}/" ./
export TARGET="framebuffer"
export CFLAGS="-I${COOKBOOK_SYSROOT}/include -I${PWD}/inst-${TARGET}/include"
export LDFLAGS="-L${COOKBOOK_SYSROOT}/lib -L${PWD}/inst-${TARGET}/lib -Wl,--allow-multiple-definition -Wl,-rpath-link,${COOKBOOK_SYSROOT}/lib"
export CFLAGS="${CFLAGS} -I${PWD}/inst-${TARGET}/include"
export LDFLAGS="${LDFLAGS} -L${COOKBOOK_SYSROOT}/lib -L${PWD}/inst-${TARGET}/lib -Wl,--allow-multiple-definition -Wl,-rpath-link,${COOKBOOK_SYSROOT}/lib"
# nghttp2 is not linked for some reason
export LDFLAGS="${LDFLAGS} -lcurl -lnghttp2"

View File

@ -0,0 +1,8 @@
#TODO not compiled or tested
[source]
git = "https://github.com/mehrantsi/FeOxDB"
[build]
template = "custom"
script = """
cookbook_cargo_examples basic_usage deterministic_test
"""

View File

@ -0,0 +1,8 @@
#TODO not compiled or tested
[source]
git = "https://git.sr.ht/~ireas/genpdf-rs"
[build]
template = "custom"
script = """
cookbook_cargo_examples demo
"""

View File

@ -0,0 +1,9 @@
#TODO not compiled or tested
# the protobuf compiler needs to be installed
[source]
git = "https://github.com/BeechatNetworkSystemsLtd/Reticulum-rs"
[build]
template = "custom"
script = """
cookbook_cargo_examples tcp_client kaonic_client
"""

View File

@ -1,4 +1,4 @@
#TODO: Can be built, but ends in breakpoint trap
#TODO compiling, not tested further
[source]
git = "https://github.com/willnode/go"
branch = "go-1.25-redox"

View File

@ -1,20 +1,22 @@
#TODO probably wrong script, see https://github.com/ziglang/zig/wiki/Building-Zig-From-Source
#TODO compiling, not tested further
[source]
tar = "https://ziglang.org/download/0.10.1/zig-0.10.1.tar.xz"
git = "https://github.com/willnode/zig"
branch = "zig-0.15-redox"
[build]
template = "custom"
script = """
COOKBOOK_CONFIGURE="cmake"
COOKBOOK_CONFIGURE_FLAGS=(
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_CROSSCOMPILING=True
-DCMAKE_EXE_LINKER_FLAGS="-static"
-DCMAKE_INSTALL_PREFIX="/"
-DCMAKE_PREFIX_PATH="${COOKBOOK_SYSROOT}"
-DCMAKE_SYSTEM_NAME=Generic
-DCMAKE_SYSTEM_PROCESSOR="$(echo "${TARGET}" | cut -d - -f1)"
-DCMAKE_VERBOSE_MAKEFILE=On
"${COOKBOOK_SOURCE}"
)
cookbook_configure
DYNAMIC_INIT
rsync -av --delete "${COOKBOOK_SOURCE}"/* ./
export ZIG_HOST_TARGET_CFLAGS="$CFLAGS"
export ZIG_HOST_TARGET_LDFLAGS="$LDFLAGS"
export ZIG_HOST_TARGET_CC="${TARGET}-gcc"
export ZIG_HOST_TARGET_TRIPLE="${TARGET%%-*}-redox"
unset AR AS CC CXX LD LDFLAGS NM OBJCOPY OBJDUMP RANLIB READELF RUSTFLAGS STRIP
cc bootstrap.c -o ./bootstrap
./bootstrap
mkdir -p "${COOKBOOK_STAGE}"/usr/bin
cp ./zig2 "${COOKBOOK_STAGE}"/usr/bin/zig
"""

View File

@ -13,7 +13,7 @@ dependencies = [
]
script = """
DYNAMIC_INIT
COOKBOOK_CMAKE_FLAGS=(
COOKBOOK_CMAKE_FLAGS+=(
-Dprotobuf_BUILD_TESTS=OFF
)
cookbook_cmake

View File

@ -1,5 +1,11 @@
#TODO compilation error
[source]
tar = "https://mpg123.de/download/mpg123-1.31.3.tar.bz2"
tar = "https://mpg123.de/download/mpg123-1.33.2.tar.bz2"
blake3 = "1e604dc14160a8852ef6b880643e3534f44e410af1fd5ba29a80ff960a54e834"
script = """
DYNAMIC_INIT
autotools_recursive_regenerate
"""
[build]
template = "configure"

View File

@ -1,4 +1,3 @@
#TODO probably wrong script, see https://openal-soft.org/#installing
[source]
tar = "https://openal-soft.org/openal-releases/openal-soft-1.24.1.tar.bz2"
blake3 = "8aeaa8307d3e14331ad20761c537ffebe70975cb7c3343e8d5c0c0ed7bc16eab"
@ -17,46 +16,22 @@ dependencies = [
"zlib",
]
script = """
export CFLAGS="${CFLAGS} -I${COOKBOOK_SYSROOT}/include -I${COOKBOOK_SYSROOT}/include/SDL2"
export CXXFLAGS="${CXXFLAGS} -I${COOKBOOK_SYSROOT}/include -I${COOKBOOK_SYSROOT}/include/SDL2"
cat > redox.cmake <<EOF
# the name of the target operating system
set(CMAKE_SYSTEM_NAME Generic)
set(CMAKE_SYSTEM_PROCESSOR "${TARGET%%-*}")
# which compilers to use for C and C++
set(CMAKE_C_COMPILER "${TARGET}-gcc")
set(CMAKE_CXX_COMPILER "${TARGET}-g++")
# where is the target environment located
set(CMAKE_FIND_ROOT_PATH "${COOKBOOK_SYSROOT}")
# adjust the default behavior of the FIND_XXX() commands:
# search programs in the host environment
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
# search headers, libraries, and packages in the target environment
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
EOF
COOKBOOK_CONFIGURE="cmake"
COOKBOOK_CONFIGURE_FLAGS=(
-DCMAKE_BUILD_TYPE=Release
-DCMAKE_INSTALL_PREFIX="/usr"
-DCMAKE_PREFIX_PATH="${COOKBOOK_SYSROOT}"
-DCMAKE_TOOLCHAIN_FILE=redox.cmake
-DCMAKE_VERBOSE_MAKEFILE=ON
DYNAMIC_INIT
export CFLAGS="${CFLAGS} -I${COOKBOOK_SYSROOT}/include/SDL2"
export CXXFLAGS="${CXXFLAGS} -I${COOKBOOK_SYSROOT}/include/SDL2"
COOKBOOK_CMAKE_FLAGS+=(
-DALSOFT_EXAMPLES=OFF
-DALSOFT_INSTALL_EXAMPLES=OFF
-DALSOFT_INSTALL_UTILS=OFF
-DALSOFT_UTILS=OFF
-DLIBTYPE=STATIC
-DALSOFT_BACKEND_SDL2=ON
-DALSOFT_REQUIRE_SDL2=ON
"${COOKBOOK_SOURCE}"
)
cookbook_configure
if [ "${COOKBOOK_DYNAMIC}" == "1" ]
then
COOKBOOK_CMAKE_FLAGS+=(-DLIBTYPE=SHARED)
else
COOKBOOK_CMAKE_FLAGS+=(-DLIBTYPE=STATIC)
fi
cookbook_cmake
"""

View File

@ -16,10 +16,6 @@ dependencies = [
# "zstd",
]
script = """
export CFLAGS="${CFLAGS} -I${COOKBOOK_SYSROOT}/include"
export CPPFLAGS="${CPPFLAGS} ${CFLAGS}"
export LDFLAGS="-L${COOKBOOK_SYSROOT}/lib --static"
BOOST_ROOT="${COOKBOOK_STAGE}/usr"
mkdir -p "${BOOST_ROOT}"

View File

@ -9,11 +9,6 @@ dependencies = [
]
template = "custom"
script = """
export CFLAGS="-I${COOKBOOK_SYSROOT}/include"
export CPPFLAGS="-I${COOKBOOK_SYSROOT}/include"
export CXXFLAGS="-I${COOKBOOK_SYSROOT}/include"
export LDFLAGS="-L${COOKBOOK_SYSROOT}/lib"
cat > redox.cmake <<EOF
# the name of the target operating system
set(CMAKE_SYSTEM_NAME Generic)

View File

@ -1,13 +1,18 @@
#TODO the redox target is not supported on the configure script
[source]
tar = "http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2"
tar = "http://downloads.xiph.org/releases/theora/libtheora-1.2.0.tar.gz"
blake3 = "b2413d6a29669063c30679eb46e09bd55b47d51e1516282bd1f5a752a8ecae91"
script = """
GNU_CONFIG_GET config.sub
DYNAMIC_INIT
autotools_recursive_regenerate
"""
[build]
template = "configure"
template = "custom"
dependencies = [
"libogg",
"libvorbis",
]
script = """
DYNAMIC_INIT
cookbook_configure
"""

View File

@ -1,6 +1,11 @@
#TODO missing script for building, lacking build instructions
#TODO promote
[source]
git = "https://github.com/Cyan4973/xxHash"
rev = "bbb27a5efb85b92a0486cf361a8635715a53f6ba"
rev = "bab7e27f4c6ae4efbb83dd99ae8a554423571635" # 0.8.3-dev (cmake support)
[build]
template = "custom"
script = """
DYNAMIC_INIT
COOKBOOK_SOURCE="${COOKBOOK_SOURCE}"/build/cmake
cookbook_cmake
"""

View File

@ -0,0 +1,8 @@
#TODO not compiled or tested
[source]
git = "https://github.com/jasonwitty/socktop"
[build]
template = "custom"
script = """
cookbook_cargo_packages socktop socktop_agent
"""

View File

@ -0,0 +1,5 @@
#TODO not compiled or tested
[source]
git = "https://github.com/pg3uk/AngryEtherRust"
[build]
template = "cargo"

View File

@ -1,12 +0,0 @@
#TODO make all dependencies work
[source]
tar = "https://download.samba.org/pub/rsync/src/rsync-3.2.7.tar.gz"
[build]
template = "configure"
dependencies = [
"zstd",
"zlib",
"lz4",
"popt",
"xxhash",
]

View File

@ -0,0 +1,5 @@
#TODO not compiled or tested
[source]
git = "https://github.com/abdoufermat5/bayesian-ssh"
[build]
template = "cargo"

View File

@ -0,0 +1,5 @@
#TODO not compiled or tested
[source]
git = "https://github.com/mehrantsi/feox-server"
[build]
template = "cargo"

View File

@ -0,0 +1,5 @@
#TODO not compiled or tested
[source]
git = "https://github.com/bgreenwell/doxx"
[build]
template = "cargo"

View File

@ -0,0 +1,5 @@
#TODO not compiled or tested
[source]
git = "https://github.com/Canop/safecloset"
[build]
template = "cargo"

View File

@ -0,0 +1,5 @@
#TODO not compiled or tested
[source]
git = "https://github.com/FedeCarollo/jukebox-cli"
[build]
template = "cargo"

View File

@ -1,6 +1,7 @@
#TODO compiled but not tested
#TODO lack of utmpx.h and resolv.h, expect dns not working
#TODO maybe actually implement utmpx.h in relibc?
#TODO lack of resolv.h, expect dns not working
#TODO lack of utmpx.h, expect no way to track login in sshd
#TODO lack of an equivalent to shadow.h, expect sshd password not working
#TODO lack of openssl support, use only ssh-keygen from redox
[source]
tar = "https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-9.8p1.tar.gz"
patches = [
@ -9,12 +10,33 @@ patches = [
[build]
template = "custom"
dependencies = [
"openssl1",
"zlib",
]
script = """
DYNAMIC_INIT
COOKBOOK_CONFIGURE_FLAGS+=(
--disable-strip
# requires openssl 1.1.1, result in libcrypto error otherwise
--without-openssl
--sysconfdir=/etc/ssh
)
cookbook_configure
mv "${COOKBOOK_STAGE}"/usr/sbin/sshd "${COOKBOOK_STAGE}"/usr/bin/sshd
rmdir "${COOKBOOK_STAGE}"/usr/sbin
# Extracted from `make host-key-force`
# TODO: Very insecure! but there's no postscript yet
ssh-keygen -t dsa -f "${COOKBOOK_STAGE}"/etc/ssh/ssh_host_dsa_key -N ""
ssh-keygen -t rsa -f "${COOKBOOK_STAGE}"/etc/ssh/ssh_host_rsa_key -N ""
ssh-keygen -t ed25519 -f "${COOKBOOK_STAGE}"/etc/ssh/ssh_host_ed25519_key -N ""
ssh-keygen -t ecdsa -f "${COOKBOOK_STAGE}"/etc/ssh/ssh_host_ecdsa_key -N ""
CONFIG_FILE="${COOKBOOK_STAGE}"/etc/ssh/sshd_config
# ipv6 is not working yet
sed -i "s/#AddressFamily any/AddressFamily inet/g" "${CONFIG_FILE}"
# hardcoded to 0.0.0.0 in patches
sed -i "s/#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/g" "${CONFIG_FILE}"
# will never work
sed -i "s/#PasswordAuthentication yes/PasswordAuthentication no/g" "${CONFIG_FILE}"
"""

View File

@ -1,6 +1,20 @@
diff -ruwN source/configure source-new/configure
--- source/configure 2024-07-01 11:36:28.000000000 +0700
+++ source-new/configure 2025-09-06 23:54:58.147442355 +0700
@@ -12606,6 +12606,10 @@
printf "%s\n" "#define BROKEN_POLL 1" >>confdefs.h
;;
+*-*-redox)
+
+ # todo
+ ;;
mips-sony-bsd|mips-sony-newsos4)
printf "%s\n" "#define NEED_SETPGRP 1" >>confdefs.h
diff -ruwN source/defines.h source-new/defines.h
--- source/defines.h 2024-07-01 11:36:28.000000000 +0700
+++ source-new/defines.h 2025-08-20 13:37:45.820728226 +0700
+++ source-new/defines.h 2025-09-07 01:35:40.209700338 +0700
@@ -52,6 +52,18 @@
#define IPPORT_RESERVED 0
#endif
@ -51,7 +65,7 @@ diff -ruwN source/defines.h source-new/defines.h
#define _PATH_XAUTH XAUTH_PATH
diff -ruwN source/hostfile.c source-new/hostfile.c
--- source/hostfile.c 2024-07-01 11:36:28.000000000 +0700
+++ source-new/hostfile.c 2025-08-20 11:51:28.964103232 +0700
+++ source-new/hostfile.c 2025-09-06 21:09:36.555438339 +0700
@@ -44,7 +44,9 @@
#include <netinet/in.h>
@ -64,7 +78,7 @@ diff -ruwN source/hostfile.c source-new/hostfile.c
#include <stdlib.h>
diff -ruwN source/loginrec.c source-new/loginrec.c
--- source/loginrec.c 2024-07-01 11:36:28.000000000 +0700
+++ source-new/loginrec.c 2025-08-20 13:43:02.970560664 +0700
+++ source-new/loginrec.c 2025-09-06 21:09:36.556438304 +0700
@@ -1033,7 +1033,7 @@
return (0);
}
@ -76,7 +90,7 @@ diff -ruwN source/loginrec.c source-new/loginrec.c
}
diff -ruwN source/loginrec.h source-new/loginrec.h
--- source/loginrec.h 2024-07-01 11:36:28.000000000 +0700
+++ source-new/loginrec.h 2025-08-20 13:39:08.570682776 +0700
+++ source-new/loginrec.h 2025-09-06 21:09:36.556438304 +0700
@@ -30,6 +30,7 @@
**/
@ -85,9 +99,55 @@ diff -ruwN source/loginrec.h source-new/loginrec.h
struct ssh;
diff -ruwN source/misc.c source-new/misc.c
--- source/misc.c 2024-07-01 11:36:28.000000000 +0700
+++ source-new/misc.c 2025-09-07 01:21:42.201992304 +0700
@@ -2843,7 +2843,6 @@
error("%s: dup2: %s", tag, strerror(errno));
_exit(1);
}
- closefrom(STDERR_FILENO + 1);
if (geteuid() == 0 &&
initgroups(pw->pw_name, pw->pw_gid) == -1) {
diff -ruwN source/monitor.c source-new/monitor.c
--- source/monitor.c 2024-07-01 11:36:28.000000000 +0700
+++ source-new/monitor.c 2025-09-07 00:46:23.435378053 +0700
@@ -484,18 +484,19 @@
pfd[0].events = POLLIN;
pfd[1].fd = pmonitor->m_log_recvfd;
pfd[1].events = pfd[1].fd == -1 ? 0 : POLLIN;
- if (poll(pfd, pfd[1].fd == -1 ? 1 : 2, -1) == -1) {
+ // redox can't handle timeout -1 (the poll stuck)
+ if (poll(pfd, pfd[1].fd == -1 ? 1 : 2, 1000) == -1) {
if (errno == EINTR || errno == EAGAIN)
continue;
fatal_f("poll: %s", strerror(errno));
}
if (pfd[1].revents) {
+
/*
* Drain all log messages before processing next
* monitor request.
*/
monitor_read_log(pmonitor);
- continue;
}
if (pfd[0].revents)
break; /* Continues below */
@@ -1577,7 +1578,8 @@
res = pty_allocate(&s->ptyfd, &s->ttyfd, s->tty, sizeof(s->tty));
if (res == 0)
goto error;
- pty_setowner(authctxt->pw, s->tty);
+ // non sense in redox
+ // pty_setowner(authctxt->pw, s->tty);
if ((r = sshbuf_put_u32(m, 1)) != 0 ||
(r = sshbuf_put_cstring(m, s->tty)) != 0)
diff -ruwN source/openbsd-compat/bsd-statvfs.h source-new/openbsd-compat/bsd-statvfs.h
--- source/openbsd-compat/bsd-statvfs.h 2024-07-01 11:36:28.000000000 +0700
+++ source-new/openbsd-compat/bsd-statvfs.h 2025-08-20 13:37:42.000730245 +0700
+++ source-new/openbsd-compat/bsd-statvfs.h 2025-09-06 21:09:36.556438304 +0700
@@ -37,13 +37,6 @@
typedef unsigned long fsfilcnt_t;
#endif
@ -104,7 +164,7 @@ diff -ruwN source/openbsd-compat/bsd-statvfs.h source-new/openbsd-compat/bsd-sta
unsigned long f_bsize; /* File system block size. */
diff -ruwN source/openbsd-compat/getrrsetbyname.c source-new/openbsd-compat/getrrsetbyname.c
--- source/openbsd-compat/getrrsetbyname.c 2024-07-01 11:36:28.000000000 +0700
+++ source-new/openbsd-compat/getrrsetbyname.c 2025-08-20 13:51:15.020299084 +0700
+++ source-new/openbsd-compat/getrrsetbyname.c 2025-09-06 21:09:36.556438304 +0700
@@ -67,6 +67,52 @@
#endif
#define _THREAD_PRIVATE(a,b,c) (c)
@ -232,7 +292,7 @@ diff -ruwN source/openbsd-compat/getrrsetbyname.c source-new/openbsd-compat/getr
free_dns_rr(head);
diff -ruwN source/openbsd-compat/getrrsetbyname.h source-new/openbsd-compat/getrrsetbyname.h
--- source/openbsd-compat/getrrsetbyname.h 2024-07-01 11:36:28.000000000 +0700
+++ source-new/openbsd-compat/getrrsetbyname.h 2025-08-20 11:51:00.744118526 +0700
+++ source-new/openbsd-compat/getrrsetbyname.h 2025-09-06 21:09:36.557438268 +0700
@@ -54,9 +54,13 @@
#include <sys/types.h>
@ -249,7 +309,7 @@ diff -ruwN source/openbsd-compat/getrrsetbyname.h source-new/openbsd-compat/getr
#define HFIXEDSZ 12
diff -ruwN source/openbsd-compat/inet_ntop.c source-new/openbsd-compat/inet_ntop.c
--- source/openbsd-compat/inet_ntop.c 2024-07-01 11:36:28.000000000 +0700
+++ source-new/openbsd-compat/inet_ntop.c 2025-08-20 11:39:15.244488902 +0700
+++ source-new/openbsd-compat/inet_ntop.c 2025-09-06 21:09:36.557438268 +0700
@@ -26,7 +26,9 @@
#include <sys/socket.h>
#include <netinet/in.h>
@ -262,7 +322,7 @@ diff -ruwN source/openbsd-compat/inet_ntop.c source-new/openbsd-compat/inet_ntop
#include <stdio.h>
diff -ruwN source/openbsd-compat/openbsd-compat.h source-new/openbsd-compat/openbsd-compat.h
--- source/openbsd-compat/openbsd-compat.h 2024-07-01 11:36:28.000000000 +0700
+++ source-new/openbsd-compat/openbsd-compat.h 2025-08-20 13:15:22.721439992 +0700
+++ source-new/openbsd-compat/openbsd-compat.h 2025-09-06 21:09:36.557438268 +0700
@@ -36,6 +36,8 @@
#include <stddef.h> /* for wchar_t */
@ -274,7 +334,7 @@ diff -ruwN source/openbsd-compat/openbsd-compat.h source-new/openbsd-compat/open
#include "sigact.h"
diff -ruwN source/openbsd-compat/utmpx.c source-new/openbsd-compat/utmpx.c
--- source/openbsd-compat/utmpx.c 1970-01-01 07:00:00.000000000 +0700
+++ source-new/openbsd-compat/utmpx.c 2025-08-20 13:13:54.971486065 +0700
+++ source-new/openbsd-compat/utmpx.c 2025-09-06 21:09:36.557438268 +0700
@@ -0,0 +1,13 @@
+#include "utmpx.h"
+#include <stddef.h> // For NULL
@ -292,7 +352,7 @@ diff -ruwN source/openbsd-compat/utmpx.c source-new/openbsd-compat/utmpx.c
\ No newline at end of file
diff -ruwN source/openbsd-compat/utmpx.h source-new/openbsd-compat/utmpx.h
--- source/openbsd-compat/utmpx.h 1970-01-01 07:00:00.000000000 +0700
+++ source-new/openbsd-compat/utmpx.h 2025-08-20 13:13:07.201511825 +0700
+++ source-new/openbsd-compat/utmpx.h 2025-09-06 21:09:36.557438268 +0700
@@ -0,0 +1,69 @@
+#ifndef _COMPAT_UTMPX_H
+#define _COMPAT_UTMPX_H
@ -364,9 +424,31 @@ diff -ruwN source/openbsd-compat/utmpx.h source-new/openbsd-compat/utmpx.h
+#endif /* __redox__ */
+#endif /* _COMPAT_UTMPX_H */
\ No newline at end of file
diff -ruwN source/readconf.c source-new/readconf.c
--- source/readconf.c 2024-07-01 11:36:28.000000000 +0700
+++ source-new/readconf.c 2025-09-07 01:21:42.201992304 +0700
@@ -554,7 +554,6 @@
if (stdfd_devnull(1, 1, 0) == -1)
fatal_f("stdfd_devnull failed");
- closefrom(STDERR_FILENO + 1);
argv[0] = shell;
argv[1] = "-c";
diff -ruwN source/readpass.c source-new/readpass.c
--- source/readpass.c 2024-07-01 11:36:28.000000000 +0700
+++ source-new/readpass.c 2025-09-07 01:21:42.201992304 +0700
@@ -278,7 +278,6 @@
if (pid == 0) {
if (stdfd_devnull(1, 1, 0) == -1)
fatal_f("stdfd_devnull failed");
- closefrom(STDERR_FILENO + 1);
setenv("SSH_ASKPASS_PROMPT", "none", 1); /* hint to UI */
execlp(askpass, askpass, prompt, (char *)NULL);
error_f("exec(%s): %s", askpass, strerror(errno));
diff -ruwN source/regress/netcat.c source-new/regress/netcat.c
--- source/regress/netcat.c 2024-07-01 11:36:28.000000000 +0700
+++ source-new/regress/netcat.c 2025-08-20 11:50:49.164126484 +0700
+++ source-new/regress/netcat.c 2025-09-06 21:09:36.558438233 +0700
@@ -1384,7 +1384,9 @@
#include <stdlib.h>
#include <string.h>
@ -377,9 +459,54 @@ diff -ruwN source/regress/netcat.c source-new/regress/netcat.c
#define SOCKS_PORT "1080"
#define HTTP_PROXY_PORT "3128"
diff -ruwN source/servconf.c source-new/servconf.c
--- source/servconf.c 2024-07-01 11:36:28.000000000 +0700
+++ source-new/servconf.c 2025-09-07 01:38:08.219942429 +0700
@@ -857,7 +857,8 @@
hints.ai_socktype = SOCK_STREAM;
hints.ai_flags = (addr == NULL) ? AI_PASSIVE : 0;
snprintf(strport, sizeof strport, "%d", port);
- if ((gaierr = getaddrinfo(addr, strport, &hints, &aitop)) != 0)
+ // redox don't accept addr == NULL yet
+ if ((gaierr = getaddrinfo("0.0.0.0", strport, &hints, &aitop)) != 0)
fatal("bad addr or host: %s (%s)",
addr ? addr : "<NULL>",
ssh_gai_strerror(gaierr));
diff -ruwN source/session.c source-new/session.c
--- source/session.c 2024-07-01 11:36:28.000000000 +0700
+++ source-new/session.c 2025-09-07 01:22:43.637928015 +0700
@@ -1365,10 +1365,12 @@
exit(1);
}
/* Initialize the group list. */
+#ifndef __redox__
if (initgroups(pw->pw_name, pw->pw_gid) < 0) {
perror("initgroups");
exit(1);
}
+#endif
endgrent();
#endif
@@ -1490,7 +1492,6 @@
* initgroups, because at least on Solaris 2.3 it leaves file
* descriptors open.
*/
- closefrom(STDERR_FILENO + 1);
}
/*
@@ -1624,7 +1625,6 @@
exit(1);
}
- closefrom(STDERR_FILENO + 1);
do_rc_files(ssh, s, shell);
diff -ruwN source/sshbuf-misc.c source-new/sshbuf-misc.c
--- source/sshbuf-misc.c 2024-07-01 11:36:28.000000000 +0700
+++ source-new/sshbuf-misc.c 2025-08-20 11:51:17.444108963 +0700
+++ source-new/sshbuf-misc.c 2025-09-06 21:09:36.559438198 +0700
@@ -28,7 +28,9 @@
#include <stdio.h>
#include <limits.h>
@ -390,9 +517,112 @@ diff -ruwN source/sshbuf-misc.c source-new/sshbuf-misc.c
#include <ctype.h>
#include <unistd.h>
diff -ruwN source/ssh.c source-new/ssh.c
--- source/ssh.c 2024-07-01 11:36:28.000000000 +0700
+++ source-new/ssh.c 2025-09-07 01:22:43.638928030 +0700
@@ -689,7 +689,6 @@
* Discard other fds that are hanging around. These can cause problem
* with backgrounded ssh processes started by ControlPersist.
*/
- closefrom(STDERR_FILENO + 1);
__progname = ssh_get_progname(av[0]);
diff -ruwN source/sshconnect2.c source-new/sshconnect2.c
--- source/sshconnect2.c 2024-07-01 11:36:28.000000000 +0700
+++ source-new/sshconnect2.c 2025-09-07 01:22:58.683157171 +0700
@@ -2057,7 +2057,6 @@
sock = STDERR_FILENO + 1;
if (fcntl(sock, F_SETFD, 0) == -1) /* keep the socket on exec */
debug3_f("fcntl F_SETFD: %s", strerror(errno));
- closefrom(sock + 1);
debug3_f("[child] pid=%ld, exec %s",
(long)getpid(), _PATH_SSH_KEY_SIGN);
diff -ruwN source/sshd.c source-new/sshd.c
--- source/sshd.c 2024-07-01 11:36:28.000000000 +0700
+++ source-new/sshd.c 2025-09-07 01:39:34.681252169 +0700
@@ -1222,7 +1222,7 @@
debug("setgroups(): %.200s", strerror(errno));
/* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
- sanitise_stdfd();
+ // sanitise_stdfd();
/* Initialize configuration options to their default values. */
initialize_server_options(&options);
@@ -1344,7 +1344,6 @@
if (!test_flag && !do_dump_cfg && !path_absolute(av[0]))
fatal("sshd requires execution with an absolute path");
- closefrom(STDERR_FILENO + 1);
/* Reserve fds we'll need later for reexec things */
if ((devnull = open(_PATH_DEVNULL, O_RDWR)) == -1)
@@ -1482,13 +1481,13 @@
options.host_key_files[i]);
key->sk_flags &= ~SSH_SK_USER_PRESENCE_REQD;
}
- if (r == 0 && key != NULL &&
- (r = sshkey_shield_private(key)) != 0) {
- do_log2_r(r, ll, "Unable to shield host key \"%s\"",
- options.host_key_files[i]);
- sshkey_free(key);
- key = NULL;
- }
+ // if (r == 0 && key != NULL &&
+ // (r = sshkey_shield_private(key)) != 0) {
+ // do_log2_r(r, ll, "Unable to shield host key \"%s\"",
+ // options.host_key_files[i]);
+ // sshkey_free(key);
+ // key = NULL;
+ // }
if ((r = sshkey_load_public(options.host_key_files[i],
&pubkey, NULL)) != 0 && r != SSH_ERR_SYSTEM_ERROR)
do_log2_r(r, ll, "Unable to load host key \"%s\"",
@@ -1600,8 +1599,7 @@
}
/* Ensure privsep directory is correctly configured. */
- need_chroot = ((getuid() == 0 || geteuid() == 0) ||
- options.kerberos_authentication);
+ need_chroot = 0;// ((getuid() == 0 || geteuid() == 0) || options.kerberos_authentication);
if ((getpwnam(SSH_PRIVSEP_USER)) == NULL && need_chroot) {
fatal("Privilege separation user %s does not exist",
SSH_PRIVSEP_USER);
@@ -1773,7 +1771,7 @@
close(startup_pipe);
}
log_redirect_stderr_to(NULL);
- closefrom(REEXEC_MIN_FREE_FD);
+ // closefrom(REEXEC_MIN_FREE_FD);
ssh_signal(SIGHUP, SIG_IGN); /* avoid reset to SIG_DFL */
execv(rexec_argv[0], rexec_argv);
diff -ruwN source/sshd-session.c source-new/sshd-session.c
--- source/sshd-session.c 2024-07-01 11:36:28.000000000 +0700
+++ source-new/sshd-session.c 2025-09-06 21:15:43.796191268 +0700
@@ -1031,7 +1031,7 @@
if (!rexeced_flag)
fatal("sshd-session should not be executed directly");
- closefrom(REEXEC_MIN_FREE_FD);
+ // closefrom(REEXEC_MIN_FREE_FD);
seed_rng();
@@ -1073,7 +1073,7 @@
options.timing_secret = timing_secret;
/* Store privilege separation user for later use if required. */
- privsep_chroot = (getuid() == 0 || geteuid() == 0);
+ privsep_chroot = 0;// (getuid() == 0 || geteuid() == 0);
if ((privsep_pw = getpwnam(SSH_PRIVSEP_USER)) == NULL) {
if (privsep_chroot || options.kerberos_authentication)
fatal("Privilege separation user %s does not exist",
diff -ruwN source/sshkey.c source-new/sshkey.c
--- source/sshkey.c 2024-07-01 11:36:28.000000000 +0700
+++ source-new/sshkey.c 2025-08-20 11:50:36.114133643 +0700
+++ source-new/sshkey.c 2025-09-06 21:09:36.567437916 +0700
@@ -43,7 +43,9 @@
#include <stdio.h>
#include <stdlib.h>
@ -403,3 +633,67 @@ diff -ruwN source/sshkey.c source-new/sshkey.c
#include <time.h>
#ifdef HAVE_UTIL_H
#include <util.h>
diff -ruwN source/ssh-sk-client.c source-new/ssh-sk-client.c
--- source/ssh-sk-client.c 2024-07-01 11:36:28.000000000 +0700
+++ source-new/ssh-sk-client.c 2025-09-07 01:21:42.201992304 +0700
@@ -91,7 +91,6 @@
}
close(pair[0]);
close(pair[1]);
- closefrom(STDERR_FILENO + 1);
debug_f("starting %s %s", helper,
verbosity == NULL ? "" : verbosity);
execlp(helper, helper, verbosity, (char *)NULL);
diff -ruwN source/ssh-sk-helper.c source-new/ssh-sk-helper.c
--- source/ssh-sk-helper.c 2024-07-01 11:36:28.000000000 +0700
+++ source-new/ssh-sk-helper.c 2025-09-07 01:22:43.638928030 +0700
@@ -303,7 +303,6 @@
* Rearrange our file descriptors a little; we don't trust the
* providers not to fiddle with stdin/out.
*/
- closefrom(STDERR_FILENO + 1);
if ((in = dup(STDIN_FILENO)) == -1 || (out = dup(STDOUT_FILENO)) == -1)
fatal("%s: dup: %s", __progname, strerror(errno));
close(STDIN_FILENO);
diff -ruwN source/uidswap.c source-new/uidswap.c
--- source/uidswap.c 2024-07-01 11:36:28.000000000 +0700
+++ source-new/uidswap.c 2025-09-07 00:01:52.531094834 +0700
@@ -37,7 +37,7 @@
* POSIX saved uids or not.
*/
-#if defined(_POSIX_SAVED_IDS) && !defined(BROKEN_SAVED_UIDS)
+#if !defined(BROKEN_SAVED_UIDS)
/* Lets assume that posix saved ids also work with seteuid, even though that
is not part of the posix specification. */
#define SAVED_IDS_WORK_WITH_SETEUID
@@ -83,6 +83,9 @@
privileged = 1;
temporarily_use_uid_effective = 1;
+ // getgroups broken in redox
+#ifndef __redox__
+
saved_egroupslen = getgroups(0, NULL);
if (saved_egroupslen == -1)
fatal("getgroups: %.100s", strerror(errno));
@@ -119,6 +122,7 @@
/* Set the effective uid to the given (unprivileged) uid. */
if (setgroups(user_groupslen, user_groups) == -1)
fatal("setgroups: %.100s", strerror(errno));
+#endif
#ifndef SAVED_IDS_WORK_WITH_SETEUID
/* Propagate the privileged gid to all of our gids. */
if (setgid(getegid()) == -1)
@@ -168,8 +172,11 @@
fatal("%s: setgid failed: %s", __func__, strerror(errno));
#endif /* SAVED_IDS_WORK_WITH_SETEUID */
+ // setgroups broken in redox
+#ifndef __redox__
if (setgroups(saved_egroupslen, saved_egroups) == -1)
fatal("setgroups: %.100s", strerror(errno));
+#endif
temporarily_use_uid_effective = 0;
}

View File

@ -0,0 +1,5 @@
#TODO not compiled or tested
[source]
git = "https://github.com/0l3d/ffetch"
[build]
template = "cargo"

View File

@ -30,7 +30,7 @@ dependencies = [
template = "custom"
script = """
DYNAMIC_INIT
export CFLAGS="-I${COOKBOOK_SYSROOT}/usr/include/freetype2"
export CFLAGS="${CFLAGS} -I${COOKBOOK_SYSROOT}/usr/include/freetype2"
#TODO: why are LIBS not automatic?
export LIBS="-lXaw7 -lXmu -lXpm -lXt -lSM -lICE -lXft -lfreetype -lfontconfig -lXrender -lXext -lX11 -lxcb -lXau -lpcre2-8 -lexpat -lpng -lz"
cookbook_configure \

91
repo.sh
View File

@ -12,100 +12,23 @@ do
if [ "$arg" == "--appstream" ]
then
APPSTREAM="1"
elif [ "$arg" == "--debug" ]
then
DEBUG=--debug
elif [ "$arg" == "--with-package-deps" ]
then
COOK_OPT=--with-package-deps
COOK_OPT+=" --with-package-deps"
elif [ "$arg" == "--nonstop" ]
then
set +e
COOK_OPT+=" --nonstop"
elif [ "$arg" == "--offline" ]
then
export COOKBOOK_OFFLINE="1"
COOK_OPT+=" --offline"
else
recipes+=" $arg"
fi
done
if [ "$recipes" == "" ]
then
recipes="$(target/release/list_recipes)"
fi
target/release/cook $COOK_OPT $recipes
# All $recipes that are in the new TOML format.
toml_recipes=""
repo="$ROOT/repo/$TARGET"
mkdir -p "$repo"
for recipe in $recipes
do
recipe_path=`target/release/find_recipe $recipe`
COOKBOOK_RECIPE="$recipe_path"
TARGET_DIR="${COOKBOOK_RECIPE}/target/${TARGET}"
COOKBOOK_BUILD="${TARGET_DIR}/build"
COOKBOOK_STAGE="${TARGET_DIR}/stage"
COOKBOOK_SOURCE="${COOKBOOK_RECIPE}/source"
COOKBOOK_SYSROOT="${TARGET_DIR}/sysroot"
if [ -e "${COOKBOOK_RECIPE}/recipe.toml" ]
then
toml_recipes+=" $recipe"
target/release/cook $COOK_OPT "$recipe"
continue
fi
if [ ! -d "${COOKBOOK_SOURCE}" ]
then
echo -e "\033[01;38;5;155mrepo - fetching $recipe\033[0m" >&2
./cook.sh "$recipe" fetch
fi
if [ ! -d "${COOKBOOK_BUILD}" ]
then
echo -e "\033[01;38;5;155mrepo - preparing $recipe\033[0m" >&2
./cook.sh "$recipe" prepare
elif [ ! -d "${COOKBOOK_SYSROOT}" ]
then
echo -e "\033[01;38;5;155mrepo - repreparing $recipe\033[0m" >&2
./cook.sh "$recipe" unprepare prepare
else
TIME_SOURCE="$($FIND "${COOKBOOK_SOURCE}" -type f -not -path '*/.git*' -printf "%Ts\n" | sort -nr | head -n 1)"
TIME_BUILD="$($FIND "${COOKBOOK_BUILD}" -type f -not -path '*/.git*' -printf "%Ts\n" | sort -nr | head -n 1)"
if [ "$TIME_SOURCE" -gt "$TIME_BUILD" ]
then
echo -e "\033[01;38;5;155mrepo - repreparing $recipe\033[0m" >&2
./cook.sh "$recipe" unprepare prepare
fi
fi
if [ ! -f "${COOKBOOK_STAGE}.pkgar" ]
then
echo -e "\033[01;38;5;155mrepo - building $recipe\033[0m" >&2
./cook.sh "$recipe" build stage pkg $DEBUG
else
TIME_BUILD="$($FIND "${COOKBOOK_BUILD}" -type f -not -path '*/.git*' -printf "%Ts\n" | sort -nr | head -n 1)"
TIME_STAGE="$($STAT -c "%Y" "${COOKBOOK_STAGE}.pkgar")"
TIME_RECIPE="$($FIND "${COOKBOOK_RECIPE}"/{recipe.sh,*.patch} -printf '%Ts\n' | sort -nr | head -n 1)"
if [ "$TIME_BUILD" -gt "$TIME_STAGE" -o "$TIME_RECIPE" -gt "$TIME_STAGE" ]
then
echo -e "\033[01;38;5;155mrepo - rebuilding $recipe\033[0m" >&2
./cook.sh "$recipe" untar unstage build stage pkg $DEBUG
else
echo -e "\033[01;38;5;155mrepo - $recipe up to date\033[0m" >&2
fi
fi
done
mkdir -p "$REPO"
declare -A APPSTREAM_SOURCES
# Currently, we only support runtime dependencies for recipes in the new TOML
# format. Runtime dependencies include both `[package.dependencies]` and
# dynamically linked packages discovered by auto_deps.
#
# The following adds the package dependencies of the recipes to the repo as
# well.
recipes="$recipes $(target/release/pkg_deps $toml_recipes)"
target/release/repo_builder "$REPO" $recipes
target/release/repo_builder "$repo" $recipes

View File

@ -203,29 +203,77 @@ fn serialize_and_write<T: Serialize>(file_path: &Path, content: &T) -> Result<()
}
static SHARED_PRESCRIPT: &str = r#"
# Build dynamically
function DYNAMIC_INIT {
COOKBOOK_AUTORECONF="autoreconf"
autotools_recursive_regenerate() {
for f in $(find . -name configure.ac -o -name configure.in -type f | sort); do
echo "* autotools regen in '$(dirname $f)'..."
( cd "$(dirname "$f")" && "${COOKBOOK_AUTORECONF}" -fvi "$@" -I${COOKBOOK_HOST_SYSROOT}/share/aclocal )
done
}
COOKBOOK_AUTORECONF="autoreconf"
autotools_recursive_regenerate() {
for f in $(find . -name configure.ac -o -name configure.in -type f | sort); do
echo "* autotools regen in '$(dirname $f)'..."
( cd "$(dirname "$f")" && "${COOKBOOK_AUTORECONF}" -fvi "$@" -I${COOKBOOK_HOST_SYSROOT}/share/aclocal )
done
}
echo "DEBUG: Program is being compiled dynamically."
if [ "${TARGET}" != "x86_64-unknown-redox" ]
then
echo "WARN: ${TARGET} does not support dynamic linking." >&2
return
fi
COOKBOOK_CONFIGURE_FLAGS=(
--host="${GNU_TARGET}"
--prefix="/usr"
--enable-shared
--disable-static
)
echo "DEBUG: Program is being compiled dynamically."
# TODO: check paths for spaces
export LDFLAGS="-L${COOKBOOK_SYSROOT}/lib"
export LDFLAGS="-Wl,-rpath-link,${COOKBOOK_SYSROOT}/lib $LDFLAGS"
export RUSTFLAGS="-C target-feature=-crt-static"
export COOKBOOK_DYNAMIC=1
COOKBOOK_CONFIGURE_FLAGS=(
--host="${GNU_TARGET}"
--prefix="/usr"
--enable-shared
--disable-static
)
COOKBOOK_CMAKE_FLAGS=(
-DBUILD_SHARED_LIBS=True
-DENABLE_SHARED=True
-DENABLE_STATIC=False
)
COOKBOOK_MESON_FLAGS=(
--buildtype release
--wrap-mode nofallback
--strip
-Ddefault_library=shared
-Dprefix=/usr
)
# TODO: check paths for spaces
export LDFLAGS="-Wl,-rpath-link,${COOKBOOK_SYSROOT}/lib -L${COOKBOOK_SYSROOT}/lib"
export RUSTFLAGS="-C target-feature=-crt-static"
export COOKBOOK_DYNAMIC=1
}
# Build both dynamically and statically
function DYNAMIC_STATIC_INIT {
DYNAMIC_INIT
if [ "${COOKBOOK_DYNAMIC}" == "1" ]
then
COOKBOOK_CONFIGURE_FLAGS=(
--host="${GNU_TARGET}"
--prefix="/usr"
--enable-shared
--enable-static
)
COOKBOOK_CMAKE_FLAGS=(
-DBUILD_SHARED_LIBS=True
-DENABLE_SHARED=True
-DENABLE_STATIC=True
)
COOKBOOK_MESON_FLAGS=(
--buildtype release
--wrap-mode nofallback
--strip
-Ddefault_library=both
-Dprefix=/usr
)
fi
}
function GNU_CONFIG_GET {
@ -890,24 +938,29 @@ function cookbook_configure {
COOKBOOK_CMAKE="cmake"
COOKBOOK_NINJA="ninja"
COOKBOOK_CMAKE_FLAGS=(
-DBUILD_SHARED_LIBS=False
-DENABLE_SHARED=False
-DENABLE_STATIC=True
)
function cookbook_cmake {
cat > cross_file.cmake <<EOF
set(CMAKE_AR ${TARGET}-ar)
set(CMAKE_CXX_COMPILER ${TARGET}-g++)
set(CMAKE_C_COMPILER ${TARGET}-gcc)
set(CMAKE_AR ${GNU_TARGET}-ar)
set(CMAKE_CXX_COMPILER ${GNU_TARGET}-g++)
set(CMAKE_C_COMPILER ${GNU_TARGET}-gcc)
set(CMAKE_FIND_ROOT_PATH ${COOKBOOK_SYSROOT})
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1)
set(CMAKE_PREFIX_PATH, ${COOKBOOK_SYSROOT})
set(CMAKE_RANLIB ${TARGET}-ranlib)
set(CMAKE_RANLIB ${GNU_TARGET}-ranlib)
set(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-soname,")
set(CMAKE_SYSTEM_NAME UnixPaths)
set(CMAKE_SYSTEM_PROCESSOR $(echo "${TARGET}" | cut -d - -f1))
EOF
if [ -n "$CC_WRAPPER" ]
if [ -n "${CC_WRAPPER}" ]
then
echo "set(CMAKE_C_COMPILER_LAUNCHER ${CC_WRAPPER})" >> cross_file.cmake
echo "set(CMAKE_CXX_COMPILER_LAUNCHER ${CC_WRAPPER})" >> cross_file.cmake
@ -922,13 +975,11 @@ EOF
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_SBINDIR=bin \
-DCMAKE_TOOLCHAIN_FILE=cross_file.cmake \
-DBUILD_SHARED_LIBS=True \
-DENABLE_STATIC=False \
-GNinja \
-Wno-dev \
"${COOKBOOK_CMAKE_FLAGS[@]}" \
"$@"
"${COOKBOOK_NINJA}" -j"${COOKBOOK_MAKE_JOBS}"
DESTDIR="${COOKBOOK_STAGE}" "${COOKBOOK_NINJA}" install -j"${COOKBOOK_MAKE_JOBS}"
}
@ -938,6 +989,7 @@ COOKBOOK_MESON_FLAGS=(
--buildtype release
--wrap-mode nofallback
--strip
-Ddefault_library=static
-Dprefix=/usr
)
function cookbook_meson {
@ -996,7 +1048,7 @@ function cookbook_meson {
let post_script = r#"# Common post script
# Strip binaries
for dir in "${COOKBOOK_STAGE}/bin" "${COOKBOOK_STAGE}/usr/bin"
for dir in "${COOKBOOK_STAGE}/bin" "${COOKBOOK_STAGE}/usr/bin"
do
if [ -d "${dir}" ] && [ -z "${COOKBOOK_NOSTRIP}" ]
then
@ -1005,7 +1057,7 @@ do
done
# Remove libtool files
for dir in "${COOKBOOK_STAGE}/lib" "${COOKBOOK_STAGE}/usr/lib"
for dir in "${COOKBOOK_STAGE}/lib" "${COOKBOOK_STAGE}/usr/lib"
do
if [ -d "${dir}" ]
then
@ -1237,12 +1289,12 @@ fn cook(
name: &PackageName,
recipe: &Recipe,
fetch_only: bool,
is_offline: bool,
) -> Result<(), String> {
if recipe.build.kind == BuildKind::None {
return cook_meta(recipe_dir, name, recipe, fetch_only);
}
let is_offline = env::var("COOKBOOK_OFFLINE").unwrap_or("".to_string()) == "1";
let source_dir = match is_offline {
true => fetch_offline(recipe_dir, &recipe.source),
false => fetch(recipe_dir, &recipe.source),
@ -1282,6 +1334,8 @@ fn main() {
let mut fetch_only = false;
let mut with_package_deps = false;
let mut quiet = false;
let mut nonstop = false;
let mut is_offline = false;
let mut recipe_names = Vec::new();
for arg in env::args().skip(1) {
match arg.as_str() {
@ -1290,6 +1344,8 @@ fn main() {
"--with-package-deps" if matching => with_package_deps = true,
"--fetch-only" if matching => fetch_only = true,
"-q" | "--quiet" if matching => quiet = true,
"--nonstop" => nonstop = true,
"--offline" => is_offline = true,
_ => recipe_names.push(arg.try_into().expect("Invalid package name")),
}
}
@ -1344,7 +1400,13 @@ fn main() {
}
Ok(())
} else {
cook(&recipe.dir, &recipe.name, &recipe.recipe, fetch_only)
cook(
&recipe.dir,
&recipe.name,
&recipe.recipe,
fetch_only,
is_offline,
)
};
match res {
@ -1370,7 +1432,9 @@ fn main() {
style::Reset,
err,
);
process::exit(1);
if !nonstop {
process::exit(1);
}
}
}
}

View File

@ -1,22 +0,0 @@
use std::env::args;
use pkg::{
package::{Package, PackageError},
PackageName,
};
use cookbook::WALK_DEPTH;
fn main() -> Result<(), PackageError> {
let names: Vec<PackageName> = args()
.skip(1)
.map(PackageName::new)
.collect::<Result<_, _>>()?;
let packages = Package::new_recursive(&names, WALK_DEPTH)?;
for package in packages {
println!("{}", package.name);
}
Ok(())
}

View File

@ -1,164 +1,177 @@
use pkg::recipes;
use std::collections::{BTreeMap, HashMap};
use std::env;
use std::fs::{self, File};
use std::io::{Read, Write};
use std::path::{Path, PathBuf};
use std::process::Command;
use toml::Value;
fn is_newer(src: &Path, dst: &Path) -> bool {
match (fs::metadata(src), fs::metadata(dst)) {
(Ok(src_meta), Ok(dst_meta)) => match (src_meta.modified(), dst_meta.modified()) {
(Ok(src_time), Ok(dst_time)) => src_time > dst_time,
(Ok(_), Err(_)) => true,
_ => false,
},
(Ok(_), Err(_)) => true,
_ => false,
}
}
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut args = env::args().skip(1);
let repo_dir = args
.next()
.expect("Usage: repo_builder <REPO_DIR> <recipe1> <recipe2> ...");
let recipe_list: Vec<String> = args.collect();
let repo_path = Path::new(&repo_dir);
let mut appstream_sources: HashMap<String, PathBuf> = HashMap::new();
let mut packages: BTreeMap<String, String> = BTreeMap::new();
// === 1. Push recipes in list ===
for recipe in &recipe_list {
let Some(recipe_path) = recipes::find(recipe) else {
eprintln!("recipe {} not found", recipe);
continue;
};
let cookbook_recipe = Path::new(&recipe_path);
let target = env::var("TARGET").unwrap_or_else(|_| "x86_64-unknown-linux-gnu".into());
let stage_dir = cookbook_recipe.join("target").join(&target).join("stage");
let pkgar_src = stage_dir.with_extension("pkgar");
let pkgar_dst = repo_path.join(format!("{}.pkgar", recipe));
let toml_src = stage_dir.with_extension("toml");
let toml_dst = repo_path.join(format!("{}.toml", recipe));
if is_newer(&toml_src, &toml_dst) {
eprintln!("\x1b[01;38;5;155mrepo - publishing {}\x1b[0m", recipe);
if fs::exists(&pkgar_src)? {
fs::copy(&pkgar_src, &pkgar_dst)?;
}
fs::copy(&toml_src, &toml_dst)?;
}
if stage_dir.join("usr/share/metainfo").exists() {
appstream_sources.insert(recipe.clone(), stage_dir.clone());
}
}
// === 2. Optional AppStream generation ===
if env::var("APPSTREAM").ok().as_deref() == Some("1") {
eprintln!("\x1b[01;38;5;155mrepo - generating appstream data\x1b[0m");
let root = env::var("ROOT").unwrap_or_else(|_| ".".into());
let target = env::var("TARGET").unwrap_or_else(|_| "x86_64-unknown-linux-gnu".into());
let appstream_root = Path::new(&root)
.join("build")
.join(&target)
.join("appstream");
let appstream_pkg = repo_path.join("appstream.pkgar");
fs::remove_dir_all(&appstream_root).ok();
fs::remove_file(&appstream_pkg).ok();
fs::create_dir_all(&appstream_root)?;
if !appstream_sources.is_empty() {
let mut compose_cmd = Command::new("appstreamcli");
compose_cmd
.arg("compose")
.arg("--origin=pkgar")
.arg(format!("--result-root={}", appstream_root.display()));
for (_recipe, source_path) in &appstream_sources {
compose_cmd.arg(source_path);
}
compose_cmd
.status()?
.success()
.then_some(())
.ok_or("appstreamcli failed")?;
Command::new("pkgar")
.arg("create")
.arg("--archive")
.arg(&appstream_pkg)
.arg("--skey")
.arg(format!("{}/build/id_ed25519.toml", root))
.arg(&appstream_root)
.status()?
.success()
.then_some(())
.ok_or("pkgar create failed")?;
}
}
eprintln!("\x1b[01;38;5;155mrepo - generating repo.toml\x1b[0m");
// === 3. Read and update repo.toml ===
let repo_toml_path = repo_path.join("repo.toml");
if repo_toml_path.exists() {
let mut file = File::open(&repo_toml_path)?;
let mut contents = String::new();
file.read_to_string(&mut contents)?;
let parsed: Value = toml::from_str(&contents)?;
if let Some(pkg_table) = parsed.get("packages").and_then(|v| v.as_table()) {
for (k, v) in pkg_table {
if let Some(s) = v.as_str() {
packages.insert(k.clone(), format!("\"{}\"", s));
} else {
packages.insert(k.clone(), v.to_string());
}
}
}
}
for entry in fs::read_dir(&repo_path)? {
let entry = entry?;
let path = entry.path();
if path.extension().and_then(|s| s.to_str()) != Some("toml") {
continue;
}
if path.file_stem().and_then(|s| s.to_str()) == Some("repo") {
continue;
}
let content = fs::read_to_string(&path)?;
let parsed: Value = toml::from_str(&content)?;
if let Some(version_val) = parsed.get("version") {
let version_str = version_val.to_string(); // includes quotes
let package_name = path.file_stem().unwrap().to_string_lossy().to_string();
packages.insert(package_name, version_str);
} else {
eprintln!("Warning: no [version] found in {:?}", path);
}
}
// FIXME: Use proper TOML serializer
let mut output = String::from("[packages]\n");
for (name, version) in &packages {
output.push_str(&format!("{name} = {version}\n"));
}
let mut output_file = File::create(&repo_toml_path)?;
output_file.write_all(output.as_bytes())?;
Ok(())
}
use cookbook::WALK_DEPTH;
use pkg::{recipes, Package, PackageName};
use std::collections::{BTreeMap, HashMap};
use std::env;
use std::fs::{self, File};
use std::io::{Read, Write};
use std::path::{Path, PathBuf};
use std::process::Command;
use toml::Value;
fn is_newer(src: &Path, dst: &Path) -> bool {
match (fs::metadata(src), fs::metadata(dst)) {
(Ok(src_meta), Ok(dst_meta)) => match (src_meta.modified(), dst_meta.modified()) {
(Ok(src_time), Ok(dst_time)) => src_time > dst_time,
(Ok(_), Err(_)) => true,
_ => false,
},
(Ok(_), Err(_)) => true,
_ => false,
}
}
fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut args = env::args().skip(1);
let repo_dir = args
.next()
.expect("Usage: repo_builder <REPO_DIR> <recipe1> <recipe2> ...");
let repo_path = Path::new(&repo_dir);
// Runtime dependencies include both `[package.dependencies]` and dynamically
// linked packages discovered by auto_deps.
//
// The following adds the package dependencies of the recipes to the repo as
// well.
let recipe_list = Package::new_recursive(
&args.map(PackageName::new).collect::<Result<Vec<_>, _>>()?,
WALK_DEPTH,
)?
.into_iter()
.map(|pkg| pkg.name.as_str().to_owned())
.collect::<Vec<_>>();
let mut appstream_sources: HashMap<String, PathBuf> = HashMap::new();
let mut packages: BTreeMap<String, String> = BTreeMap::new();
// === 1. Push recipes in list ===
for recipe in &recipe_list {
let Some(recipe_path) = recipes::find(recipe) else {
eprintln!("recipe {} not found", recipe);
continue;
};
let cookbook_recipe = Path::new(&recipe_path);
let target = env::var("TARGET").unwrap_or_else(|_| "x86_64-unknown-linux-gnu".into());
let stage_dir = cookbook_recipe.join("target").join(&target).join("stage");
let pkgar_src = stage_dir.with_extension("pkgar");
let pkgar_dst = repo_path.join(format!("{}.pkgar", recipe));
let toml_src = stage_dir.with_extension("toml");
let toml_dst = repo_path.join(format!("{}.toml", recipe));
if is_newer(&toml_src, &toml_dst) {
eprintln!("\x1b[01;38;5;155mrepo - publishing {}\x1b[0m", recipe);
if fs::exists(&pkgar_src)? {
fs::copy(&pkgar_src, &pkgar_dst)?;
}
fs::copy(&toml_src, &toml_dst)?;
}
if stage_dir.join("usr/share/metainfo").exists() {
appstream_sources.insert(recipe.clone(), stage_dir.clone());
}
}
// === 2. Optional AppStream generation ===
if env::var("APPSTREAM").ok().as_deref() == Some("1") {
eprintln!("\x1b[01;38;5;155mrepo - generating appstream data\x1b[0m");
let root = env::var("ROOT").unwrap_or_else(|_| ".".into());
let target = env::var("TARGET").unwrap_or_else(|_| "x86_64-unknown-linux-gnu".into());
let appstream_root = Path::new(&root)
.join("build")
.join(&target)
.join("appstream");
let appstream_pkg = repo_path.join("appstream.pkgar");
fs::remove_dir_all(&appstream_root).ok();
fs::remove_file(&appstream_pkg).ok();
fs::create_dir_all(&appstream_root)?;
if !appstream_sources.is_empty() {
let mut compose_cmd = Command::new("appstreamcli");
compose_cmd
.arg("compose")
.arg("--origin=pkgar")
.arg(format!("--result-root={}", appstream_root.display()));
for (_recipe, source_path) in &appstream_sources {
compose_cmd.arg(source_path);
}
compose_cmd
.status()?
.success()
.then_some(())
.ok_or("appstreamcli failed")?;
Command::new("pkgar")
.arg("create")
.arg("--archive")
.arg(&appstream_pkg)
.arg("--skey")
.arg(format!("{}/build/id_ed25519.toml", root))
.arg(&appstream_root)
.status()?
.success()
.then_some(())
.ok_or("pkgar create failed")?;
}
}
eprintln!("\x1b[01;38;5;155mrepo - generating repo.toml\x1b[0m");
// === 3. Read and update repo.toml ===
let repo_toml_path = repo_path.join("repo.toml");
if repo_toml_path.exists() {
let mut file = File::open(&repo_toml_path)?;
let mut contents = String::new();
file.read_to_string(&mut contents)?;
let parsed: Value = toml::from_str(&contents)?;
if let Some(pkg_table) = parsed.get("packages").and_then(|v| v.as_table()) {
for (k, v) in pkg_table {
if let Some(s) = v.as_str() {
packages.insert(k.clone(), format!("\"{}\"", s));
} else {
packages.insert(k.clone(), v.to_string());
}
}
}
}
for entry in fs::read_dir(&repo_path)? {
let entry = entry?;
let path = entry.path();
if path.extension().and_then(|s| s.to_str()) != Some("toml") {
continue;
}
if path.file_stem().and_then(|s| s.to_str()) == Some("repo") {
continue;
}
let content = fs::read_to_string(&path)?;
let parsed: Value = toml::from_str(&content)?;
if let Some(version_val) = parsed.get("version") {
let version_str = version_val.to_string(); // includes quotes
let package_name = path.file_stem().unwrap().to_string_lossy().to_string();
packages.insert(package_name, version_str);
} else {
eprintln!("Warning: no [version] found in {:?}", path);
}
}
// FIXME: Use proper TOML serializer
let mut output = String::from("[packages]\n");
for (name, version) in &packages {
output.push_str(&format!("{name} = {version}\n"));
}
let mut output_file = File::create(&repo_toml_path)?;
output_file.write_all(output.as_bytes())?;
Ok(())
}

View File

@ -5,12 +5,16 @@ source config.sh
if [ $# = 0 ]
then
recipes="$(target/release/list_recipes)"
recipes="$(target/release/list_recipes --short)"
else
recipes="$@"
fi
for recipe_path in $recipes
for recipe_name in $recipes
do
./cook.sh "$recipe_path" unfetch
recipe_path=`target/release/find_recipe $recipe_name`
echo -e "\033[01;38;5;215mcook - unfetch $recipe_name\033[0m"
rm -rfv "$recipe_path"/source "$recipe_path"/source.tar
done