Files
RedBear-OS/local/recipes/dev/gcc-native/recipe.toml
T
vasilito 7706617e7f cub: full AUR package manager + Phase 1-5 native build tools
cub redesign (local/recipes/system/cub/):
- AUR RPC v5 client (serde_json) with search/info
- ~/.cub/ user-local recipe/source/repo storage
- Enhanced PKGBUILD parser: optdepends, .SRCINFO, split packages, 19 linuxism patterns
- Recipe generation: host: prefix on dev-deps, shallow_clone, cargopath, installs, optional-packages
- Dependency resolver: scans build errors for missing commands/headers/libs/pkgconfig, maps to packages
- Dependency installation: checks installed packages, fetches AUR deps, interactive prompt
- ~110 Arc→Redox dependency mappings
- ratatui TUI: search, info, install, build, query views
- 14 Arch-style CLI switches (-S/-Si/-Syu/-G/-R/-Q/-Qi/-Ql)
- 65 tests, 0 failures, clean build

Phase 1-5 native build tools (local/recipes/dev/):
- P1 Substrate: tar, m4, diffutils (gnulib bypass), mkfifo kernel patch (1085 lines)
- P2 Build Systems: bison, flex, meson (standalone wrapper), ninja-build, libtool
- P3 Native GCC: gcc-native, binutils-native (cross-compiled for redox host)
- P4 Native LLVM: llvm-native (clang + lld from monorepo)
- P5 Native Rust: rust-native (rustc + cargo)
- Groups: build-essential-native, dev-essential expanded

Config:
- redbear-mini: +7 tools (diffutils, tar, bison, flex, meson, ninja, m4)
- redbear-full: +4 native tools (gcc, binutils, llvm, rust)
- All recipes moved to local/ with symlinks for cookbook discovery (Red Bear policy)

Docs:
- BUILD-TOOLS-PORTING-PLAN.md: phased porting roadmap
- CUB-WORKFLOW-ASSESSMENT.md: gap analysis and integration assessment
2026-05-08 00:13:31 +01:00

97 lines
3.1 KiB
TOML

# Native GCC 13.2.0 for Red Bear OS
# Produces GCC that RUNS on x86_64-unknown-redox and TARGETS x86_64-unknown-redox.
# Built via cross-compilation from the host using the existing cross-compiler in prefix/.
#
# This is Strategy A from BUILD-TOOLS-PORTING-PLAN.md: pre-built native toolchain
# produced by cross-compilation, avoiding the multi-stage self-hosting bootstrap.
#
# To use: repo cook local/recipes/dev/gcc-native
# The resulting gcc binary runs inside Red Bear OS.
[source]
same_as = "../../../../recipes/dev/gcc13"
[build]
template = "custom"
dependencies = [
"gcc13",
"gcc13.cxx",
"gnu-binutils",
"libgmp",
"libmpfr",
"mpc",
]
script = """
DYNAMIC_INIT
# Use the cross-compiler to produce native redox binaries
export CC="${COOKBOOK_TARGET}-gcc"
export CXX="${COOKBOOK_TARGET}-g++"
export AR="${COOKBOOK_TARGET}-ar"
export RANLIB="${COOKBOOK_TARGET}-ranlib"
export LD="${COOKBOOK_TARGET}-ld"
export NM="${COOKBOOK_TARGET}-nm"
export STRIP="${COOKBOOK_TARGET}-strip"
# Configure for native compilation: host AND target are both redox
COOKBOOK_CONFIGURE_FLAGS+=(
--host="${GNU_TARGET}"
--target="${GNU_TARGET}"
--prefix=/usr
--with-sysroot="${COOKBOOK_SYSROOT}"
--with-gmp="${COOKBOOK_SYSROOT}/usr"
--with-mpfr="${COOKBOOK_SYSROOT}/usr"
--with-mpc="${COOKBOOK_SYSROOT}/usr"
--with-linker-hash-style=gnu
--enable-languages=c,c++,lto
--enable-initfini-array
--disable-nls
--disable-multilib
--enable-host-shared
--enable-threads=posix
--enable-libstdcxx-threads
--disable-bootstrap
--with-bugurl="https://gitlab.redox-os.org/redox-os/gcc/-/issues"
)
"${COOKBOOK_CONFIGURE}" "${COOKBOOK_CONFIGURE_FLAGS[@]}"
"${COOKBOOK_MAKE}" -j "${COOKBOOK_MAKE_JOBS}" all-gcc all-target-libgcc all-target-libstdc++-v3
"${COOKBOOK_MAKE}" install-gcc install-target-libgcc install-target-libstdc++-v3 DESTDIR="${COOKBOOK_STAGE}"
# Native GCC doesn't need the target prefix
for tool in gcc g++ c++ cpp gcc-ar gcc-nm gcc-ranlib gcov gcov-dump gcov-tool gfortran; do
if [ -f "${COOKBOOK_STAGE}/usr/bin/${GNU_TARGET}-${tool}" ]; then
ln -sf "${GNU_TARGET}-${tool}" "${COOKBOOK_STAGE}/usr/bin/${tool}"
fi
done
# Provide cc symlink
ln -sf gcc "${COOKBOOK_STAGE}/usr/bin/cc"
# Remove libtool archives
rm -f "${COOKBOOK_STAGE}"/usr/lib/libgcc_s.so* "${COOKBOOK_STAGE}"/usr/lib/libstdc++.so*
rm -f "${COOKBOOK_STAGE}"/usr/lib/*.la
# Copy libgcc and libstdc++ into target lib dir
mkdir -p "${COOKBOOK_STAGE}/usr/lib/${GNU_TARGET}"
cp -a "${COOKBOOK_STAGE}"/usr/lib/gcc/${GNU_TARGET}/13.2.0/libgcc.a "${COOKBOOK_STAGE}/usr/lib/${GNU_TARGET}/" || true
cp -a "${COOKBOOK_STAGE}"/usr/lib/gcc/${GNU_TARGET}/13.2.0/libgcc_eh.a "${COOKBOOK_STAGE}/usr/lib/${GNU_TARGET}/" || true
"""
[package]
description = "Native GCC 13.2.0 compiler for Red Bear OS (runs on redox, targets redox)"
dependencies = ["gnu-binutils"]
[[optional-packages]]
name = "cxx"
dependencies = []
files = [
"usr/bin/*c++",
"usr/bin/*g++",
"usr/bin/g++",
"usr/include/c++/**",
"usr/lib/*c++*",
"usr/libexec/gcc/**/cc1plus",
"usr/share/gcc-*/python/libstdcxx/**",
]