From 52f5ebf62b8dc23faaab3f67de97de3b818589d8 Mon Sep 17 00:00:00 2001 From: Wildan M Date: Sat, 14 Mar 2026 07:41:03 +0700 Subject: [PATCH] Port boost, partially port mariadb --- recipes/wip/db/mariadb/recipe.toml | 43 +++++- recipes/wip/db/mariadb/redox.patch | 13 ++ recipes/wip/libs/other/boost/recipe.toml | 65 +++++---- recipes/wip/libs/other/boost/redox.patch | 139 ++++++++++++++++++++ recipes/wip/libs/other/libaio/recipe.toml | 6 +- recipes/wip/libs/other/libevent/recipe.toml | 14 +- recipes/wip/libs/other/libevent/redox.patch | 26 ---- 7 files changed, 238 insertions(+), 68 deletions(-) create mode 100644 recipes/wip/db/mariadb/redox.patch create mode 100644 recipes/wip/libs/other/boost/redox.patch delete mode 100644 recipes/wip/libs/other/libevent/redox.patch diff --git a/recipes/wip/db/mariadb/recipe.toml b/recipes/wip/db/mariadb/recipe.toml index 1ebf6c886..5c69d1539 100644 --- a/recipes/wip/db/mariadb/recipe.toml +++ b/recipes/wip/db/mariadb/recipe.toml @@ -1,19 +1,50 @@ -#TODO not compiled or tested -# build instructions: -# https://mariadb.com/kb/en/generic-build-instructions/ -# https://mariadb.com/kb/en/cross-compiling-mariadb/ +#TODO need openat (patched), posix_spawn [source] tar = "https://dlm.mariadb.com/4509471/MariaDB/mariadb-12.1.2/source/mariadb-12.1.2.tar.gz" +blake3 = "749a293e1c4fd13be936fbda33de38b1ccc8c737c30a55c187c028d3ce74f70c" +patches = [ + "redox.patch" +] [build] -template = "cmake" +template = "custom" dependencies = [ "ncurses", + "bzip2", + "curl", "zlib", + "pcre2", + "lz4", "libevent", "openssl3", "curl", "libxml2", "boost", - "libaio", ] +dev-dependencies = [ + "host:ncurses", + "boost.dev" +] +script = """ +DYNAMIC_INIT +# see https://mariadb.com/kb/en/cross-compiling-mariadb/ +mkdir -p host +pushd host +# todo: should use native generate_cookbook_cmake_file if possible +(unset CC CXX AR && cmake ${COOKBOOK_SOURCE} -DWITH_SSL=system -DCMAKE_CROSSCOMPILING=False -DCMAKE_FIND_ROOT_PATH=${COOKBOOK_TOOLCHAIN}) +make import_executables +popd + +export LDFLAGS+=" -lcurl -lnghttp2 -lssl -lcrypto" +COOKBOOK_CMAKE_FLAGS+=( + -DWITH_UNIT_TESTS=OFF + -DSTACK_DIRECTION=-1 + -DHAVE_IB_GCC_ATOMIC_BUILTINS=-1 + -DCONC_DEFAULT_CHARSET=utf8mb4 + -DPLUGIN_AWS_KEY_MANAGEMENT=NO + -DPLUGIN_COLUMNSTORE=NO + -DWITHOUT_ROCKSDB=1 + -DIMPORT_EXECUTABLES="${COOKBOOK_BUILD}/host/import_executables.cmake" +) +cookbook_cmake +""" diff --git a/recipes/wip/db/mariadb/redox.patch b/recipes/wip/db/mariadb/redox.patch new file mode 100644 index 000000000..59e6273d6 --- /dev/null +++ b/recipes/wip/db/mariadb/redox.patch @@ -0,0 +1,13 @@ +diff -ruwN source/mysys/mysys_priv.h source-new/mysys/mysys_priv.h +--- source/mysys/mysys_priv.h 2025-11-14 00:00:49.000000000 +0700 ++++ source-new/mysys/mysys_priv.h 2026-03-14 05:20:38.369176577 +0700 +@@ -142,7 +142,7 @@ + #endif + #endif + +-#ifdef O_PATH ++#if defined(O_PATH) && !defined(__redox__) /* need openat */ + #define HAVE_OPEN_PARENT_DIR_NOSYMLINKS + const char *my_open_parent_dir_nosymlinks(const char *pathname, int *pdfd); + #define NOSYMLINK_FUNCTION_BODY(AT,NOAT) \ + diff --git a/recipes/wip/libs/other/boost/recipe.toml b/recipes/wip/libs/other/boost/recipe.toml index d4903267e..2c53b2b9b 100644 --- a/recipes/wip/libs/other/boost/recipe.toml +++ b/recipes/wip/libs/other/boost/recipe.toml @@ -1,34 +1,53 @@ -# TODO: -# * Some libraries require openat or have deps that require openat -# * wchar.h needs some work before Boost is usable - +# TODO: Compiled, not tested [source] -tar = "https://archives.boost.io/release/1.87.0/source/boost_1_87_0.tar.gz" -blake3 = "9c6eb6bb7866aeb595e14279fcc5a5c7f2279dd41e946e14e2c3d5c1fb8358d3" +tar = "https://archives.boost.io/release/1.90.0/source/boost_1_90_0.tar.gz" +blake3 = "1c1b0fe7596e3f72dba529b2d0bc6d330cc00610f8d3b3e3b6f20bad43fc388d" +patches = [ + "redox.patch" +] [build] template = "custom" dependencies = [ - # "libicu", - # "liblzma", - # "bzip2", - # "zlib", - # "zstd", + # "libiconv", # TODO: more locale functions, relibc locales are stubs anyway + # "openssl3", # TODO: not linked + # "zstd", # TODO: not linked ] script = """ -BOOST_ROOT="${COOKBOOK_STAGE}/usr" -mkdir -p "${BOOST_ROOT}" +DYNAMIC_INIT +case "${TARGET}" in + i586-unknown-redox) ADDRESS_MODEL=32 ARCHITECTURE=x86 ABI=sysv;; + x86_64-unknown-redox) ADDRESS_MODEL=64 ARCHITECTURE=x86 ABI=sysv;; + aarch64-unknown-redox) ADDRESS_MODEL=64 ARCHITECTURE=arm ABI=aapcs;; + riscv64gc-unknown-redox) ADDRESS_MODEL=64 ARCHITECTURE=riscv ABI=sysv;; +esac + +# See https://beta.boost.org/build/doc/html/bbv2/reference/tools.html#bbv2.reference.tools.compiler.gcc +echo "using gcc : : ${CXX} : \"${CFLAGS} ${CPPFLAGS}\" \"${CXXFLAGS} ${CPPFLAGS}\" \"${LDFLAGS}\" \"shared\" ; " > ./user-config.jam +# echo "using openssl ; " >> ./user-config.jam +# echo "using zstd ; " >> ./user-config.jam + +skip_libraries=( + stacktrace # requires dlsym(RTLD_NEXT) + python # TODO +) + +export OPENSSL_ROOT="${COOKBOOK_SYSROOT}/usr" pushd "${COOKBOOK_SOURCE}" - -# Help the bootstrap tool detect our cross compilers -# See: https://www.boost.org/build/doc/html/bbv2/overview/configuration.html -# I'm not entirely sure which directory to place it in, so I put the conf in both -echo "using gcc : : ${TARGET}-gcc ;" >| user-config.jam -cp -v user-config.jam tools/build/src/ - -./bootstrap.sh --prefix="${BOOST_ROOT}" --with-toolset=gcc -./b2 -d2 install - +./bootstrap.sh --without-libraries=$(IFS=, ; echo "${skip_libraries[*]}") \ + --with-toolset=gcc --with-libraries=all --prefix=${COOKBOOK_STAGE}/usr +# TODO: add "-sICONV_PATH=${COOKBOOK_SYSROOT}" when locales work +# TODO: implement target-os=redox +./b2 "--user-config=${COOKBOOK_BUILD}/user-config.jam" target-os=linux pch=off \ + "--build-dir=${COOKBOOK_BUILD}" toolset=gcc architecture=${ARCHITECTURE} address-model=${ADDRESS_MODEL} abi=${ABI} binary-format=elf install popd """ + +[[optional-packages]] +name = "dev" +files = [ + "usr/include/**", + "usr/lib/*.a", + "usr/lib/cmake/**", +] diff --git a/recipes/wip/libs/other/boost/redox.patch b/recipes/wip/libs/other/boost/redox.patch new file mode 100644 index 000000000..24a894acf --- /dev/null +++ b/recipes/wip/libs/other/boost/redox.patch @@ -0,0 +1,139 @@ +diff -ruwN source/boost/asio/detail/config.hpp source-new/boost/asio/detail/config.hpp +--- source/boost/asio/detail/config.hpp 2025-12-03 20:46:38.000000000 +0700 ++++ source-new/boost/asio/detail/config.hpp 2026-03-13 20:55:39.534429549 +0700 +@@ -1395,7 +1395,7 @@ + # if defined(__linux__) + # define BOOST_ASIO_HAS_MSG_NOSIGNAL 1 + # elif defined(_POSIX_VERSION) +-# if (_POSIX_VERSION >= 200809L) ++# if (_POSIX_VERSION >= 200809L) && !defined(__redox__) + # define BOOST_ASIO_HAS_MSG_NOSIGNAL 1 + # endif // _POSIX_VERSION >= 200809L + # endif // defined(_POSIX_VERSION) +diff -ruwN source/boost/config/detail/select_platform_config.hpp source-new/boost/config/detail/select_platform_config.hpp +--- source/boost/config/detail/select_platform_config.hpp 2025-12-03 20:46:39.000000000 +0700 ++++ source-new/boost/config/detail/select_platform_config.hpp 2026-03-13 20:45:55.392659272 +0700 +@@ -69,6 +69,10 @@ + // QNX: + # define BOOST_PLATFORM_CONFIG "boost/config/platform/qnxnto.hpp" + ++#elif defined(__redox__) ++// Redox: ++# define BOOST_PLATFORM_CONFIG "boost/config/platform/redox.hpp" ++ + #elif defined(__VXWORKS__) + // vxWorks: + # define BOOST_PLATFORM_CONFIG "boost/config/platform/vxworks.hpp" +@@ -135,6 +139,7 @@ + # include "boost/config/platform/aix.hpp" + # include "boost/config/platform/amigaos.hpp" + # include "boost/config/platform/qnxnto.hpp" ++# include "boost/config/platform/redox.hpp" + # include "boost/config/platform/vxworks.hpp" + # include "boost/config/platform/symbian.hpp" + # include "boost/config/platform/cray.hpp" +diff -ruwN source/boost/config/platform/redox.hpp source-new/boost/config/platform/redox.hpp +--- source/boost/config/platform/redox.hpp 1970-01-01 07:00:00.000000000 +0700 ++++ source-new/boost/config/platform/redox.hpp 2026-03-14 02:47:45.335839093 +0700 +@@ -0,0 +1,23 @@ ++// (C) Copyright Jim Douglas 2005. ++// Use, modification and distribution are subject to the ++// Boost Software License, Version 1.0. (See accompanying file ++// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) ++ ++// See http://www.boost.org for most recent version. ++ ++// REDOX specific config options: ++ ++#define BOOST_PLATFORM "REDOX" ++ ++#undef BOOST_HAS_LOG1P ++#undef BOOST_HAS_EXPM1 ++ ++#define BOOST_HAS_PTHREADS ++ ++#define BOOST_HAS_GETTIMEOFDAY ++#define BOOST_HAS_CLOCK_GETTIME ++#define BOOST_HAS_SCHED_YIELD ++ ++// boilerplate code: ++#define BOOST_HAS_UNISTD_H ++#include +diff -ruwN source/boost/interprocess/detail/workaround.hpp source-new/boost/interprocess/detail/workaround.hpp +--- source/boost/interprocess/detail/workaround.hpp 2025-12-03 20:46:42.000000000 +0700 ++++ source-new/boost/interprocess/detail/workaround.hpp 2026-03-13 20:53:19.211459550 +0700 +@@ -41,7 +41,7 @@ + ////////////////////////////////////////////////////// + //Check for XSI shared memory objects. They are available in nearly all UNIX platforms + ////////////////////////////////////////////////////// +- #if !defined(__QNXNTO__) && !defined(__ANDROID__) && !defined(__HAIKU__) && !(__VXWORKS__) && !(__EMSCRIPTEN__) ++ #if !defined(__QNXNTO__) && !defined(__ANDROID__) && !defined(__HAIKU__) && !defined(__redox__) && !(__VXWORKS__) && !(__EMSCRIPTEN__) + #define BOOST_INTERPROCESS_XSI_SHARED_MEMORY_OBJECTS + #endif + +diff -ruwN source/boost/interprocess/mapped_region.hpp source-new/boost/interprocess/mapped_region.hpp +--- source/boost/interprocess/mapped_region.hpp 2025-12-03 20:46:42.000000000 +0700 ++++ source-new/boost/interprocess/mapped_region.hpp 2026-03-13 21:29:41.935220888 +0700 +@@ -816,7 +816,7 @@ + } + int ret = -1; + switch(mode){ +- #if defined(POSIX_MADV_NORMAL) ++ #if defined(POSIX_MADV_NORMAL) && !defined(__redox__) + case mode_padv: + { + ret = posix_madvise(this->priv_map_address(), this->priv_map_size(), unix_advice); +diff -ruwN source/boost/process/v2/detail/environment_posix.hpp source-new/boost/process/v2/detail/environment_posix.hpp +--- source/boost/process/v2/detail/environment_posix.hpp 2025-12-03 20:46:45.000000000 +0700 ++++ source-new/boost/process/v2/detail/environment_posix.hpp 2026-03-14 03:07:36.937337542 +0700 +@@ -19,7 +19,7 @@ + # if !defined(environ) + # define environ (*_NSGetEnviron()) + # endif +-#elif defined(__MACH__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__sun) ++#elif defined(__MACH__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__sun) || defined(__redox__) + extern "C" { extern char **environ; } + #endif + +diff -ruwN source/boost/process/v2/posix/default_launcher.hpp source-new/boost/process/v2/posix/default_launcher.hpp +--- source/boost/process/v2/posix/default_launcher.hpp 2025-12-03 20:46:45.000000000 +0700 ++++ source-new/boost/process/v2/posix/default_launcher.hpp 2026-03-14 03:07:38.549349038 +0700 +@@ -35,7 +35,7 @@ + # if !defined(environ) + # define environ (*_NSGetEnviron()) + # endif +-#elif defined(__MACH__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__sun) ++#elif defined(__MACH__) || defined(__FreeBSD__) || defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__sun) || defined(__redox__) + extern "C" { extern char **environ; } + #endif + +diff -ruwN source/libs/process/src/shell.cpp source-new/libs/process/src/shell.cpp +--- source/libs/process/src/shell.cpp 2025-12-03 20:46:45.000000000 +0700 ++++ source-new/libs/process/src/shell.cpp 2026-03-14 03:24:59.034513769 +0700 +@@ -19,7 +19,7 @@ + #if defined(BOOST_PROCESS_V2_WINDOWS) + #include + #include +-#elif !defined(__OpenBSD__) && !defined(__ANDROID__) ++#elif !defined(__OpenBSD__) && !defined(__ANDROID__) && !defined(__redox__) + #include + #endif + +@@ -30,7 +30,7 @@ + { + return system_category(); + } +-#elif !defined(__OpenBSD__) && !defined(__ANDROID__) ++#elif !defined(__OpenBSD__) && !defined(__ANDROID__) && !defined(__redox__) + + struct shell_category_t final : public error_category + { +@@ -99,7 +99,7 @@ + return input_.c_str(); + } + +-#elif !defined(__OpenBSD__) && !defined(__ANDROID__) ++#elif !defined(__OpenBSD__) && !defined(__ANDROID__) && !defined(__redox__) + + void shell::parse_() + { diff --git a/recipes/wip/libs/other/libaio/recipe.toml b/recipes/wip/libs/other/libaio/recipe.toml index 60911d075..e2710c1e6 100644 --- a/recipes/wip/libs/other/libaio/recipe.toml +++ b/recipes/wip/libs/other/libaio/recipe.toml @@ -1,5 +1,9 @@ -#TODO missing script for "make", see https://pagure.io/libaio/blob/master/f/INSTALL +#TODO linux specific [source] tar = "https://releases.pagure.org/libaio/libaio-0.3.113.tar.gz" [build] template = "custom" +script = """ +DYNAMIC_INIT +make -C ${COOKBOOK_SOURCE} +""" diff --git a/recipes/wip/libs/other/libevent/recipe.toml b/recipes/wip/libs/other/libevent/recipe.toml index 669ef8eb2..113bd2114 100644 --- a/recipes/wip/libs/other/libevent/recipe.toml +++ b/recipes/wip/libs/other/libevent/recipe.toml @@ -1,19 +1,9 @@ #TODO compiles, not tested [source] tar = "https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz" -patches = [ - "redox.patch" -] [build] -template = "custom" +template = "cmake" dependencies = [ - "openssl1", + "openssl3", ] -script = """ -DYNAMIC_INIT -# Can't call `cookbook_configure` because it sets DESTDIR (which causes an error) -"${COOKBOOK_CONFIGURE}" "${COOKBOOK_CONFIGURE_FLAGS[@]}" -"${COOKBOOK_MAKE}" -j "${COOKBOOK_MAKE_JOBS}" -"${COOKBOOK_MAKE}" install -""" diff --git a/recipes/wip/libs/other/libevent/redox.patch b/recipes/wip/libs/other/libevent/redox.patch deleted file mode 100644 index 5fbd6844f..000000000 --- a/recipes/wip/libs/other/libevent/redox.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff -u --recursive orig/event_tagging.c modified/event_tagging.c ---- orig/event_tagging.c 2019-02-10 21:26:04.000000000 +0000 -+++ modified/event_tagging.c 2024-11-17 14:14:19.474910364 +0000 -@@ -54,9 +54,6 @@ - #include - #include - #include --#ifndef _WIN32 --#include --#endif - #ifdef EVENT__HAVE_UNISTD_H - #include - #endif -diff -u --recursive orig/http.c modified/http.c ---- orig/http.c 2020-07-05 13:01:34.000000000 +0100 -+++ modified/http.c 2024-11-17 14:14:10.834742812 +0000 -@@ -83,9 +83,6 @@ - #include - #include - #include --#ifndef _WIN32 --#include --#endif /* !_WIN32 */ - #include - #ifdef EVENT__HAVE_UNISTD_H - #include