Build cargo in rust recipe

This commit is contained in:
Wildan M 2025-12-30 17:21:20 +07:00
parent fe9e3f9567
commit 573bb50cca
No known key found for this signature in database
GPG Key ID: 01AC53185C679C79
5 changed files with 27 additions and 15 deletions

View File

@ -33,7 +33,6 @@ ca-certificates = {}
cairo = {}
#cairodemo = {} # linking errors
#calculator = {}
cargo = {}
cleye = {}
#cmatrix = {} # needs ncursesw now
composer = {}

View File

@ -55,7 +55,6 @@ winit = {}
# dev
autoconf = {}
automake = {}
cargo = {}
cookbook = {}
gcc13 = {}
gnu-binutils = {}

View File

@ -1,4 +1,4 @@
#TODO: use sed to replace hardcoded paths into env
# Note: this file is not tracked by cookbook, run `make c.rust` after change.
[llvm]
download-ci-llvm = false
static-libstdcpp = false
@ -8,9 +8,11 @@ experimental-targets = ""
[build]
host = ["x86_64-unknown-redox"]
target = ["x86_64-unknown-redox"]
docs = false
submodules = false
tools = ["src"]
# TODO: enable rustdoc and others
docs = false
tools = ["cargo", "clippy", "rustfmt", "src"]
extended = true
verbose = 1
[install]
@ -28,10 +30,10 @@ ar = "x86_64-unknown-redox-ar"
linker = "x86_64-unknown-redox-gcc"
rpath = false
crt-static = false
llvm-config = "/mnt/redox/recipes/dev/rust/target/x86_64-unknown-redox/sysroot/bin/llvm-config"
llvm-config = "COOKBOOK_SYSROOT/bin/llvm-config"
[target.aarch64-unknown-linux-gnu]
llvm-config = "/mnt/redox/recipes/dev/rust/target/x86_64-unknown-redox/toolchain/bin/llvm-config"
llvm-config = "COOKBOOK_TOOLCHAIN/bin/llvm-config"
[target.x86_64-unknown-linux-gnu]
llvm-config = "/mnt/redox/recipes/dev/rust/target/x86_64-unknown-redox/toolchain/bin/llvm-config"
llvm-config = "COOKBOOK_TOOLCHAIN/bin/llvm-config"

View File

@ -8,6 +8,8 @@ template = "custom"
dependencies = [
"llvm21",
"zlib",
"curl",
"openssl1",
]
dev-dependencies = [
"llvm21.dev",
@ -36,20 +38,31 @@ export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUSTFLAGS="${RUSTFLAGS_BOOTSTRAP}"
# Don't poison the stage1 compiler (host -> host)
unset AR AS CC CXX LD LDFLAGS NM OBJCOPY OBJDUMP RANLIB READELF RUSTFLAGS STRIP
# modify config.toml to correct path, only do this once as it trigger full rebuild
if [ ! -f config.toml ]; then
cat ${COOKBOOK_RECIPE}/config.toml > config.toml
sed -i "s|COOKBOOK_SYSROOT|${COOKBOOK_SYSROOT}|g" config.toml
sed -i "s|COOKBOOK_TOOLCHAIN|${COOKBOOK_TOOLCHAIN}|g" config.toml
fi
python3 "${COOKBOOK_SOURCE}/x.py" install \
--config "${COOKBOOK_RECIPE}/config.toml" \
--config config.toml \
--jobs $(nproc)
mkdir -p "${COOKBOOK_STAGE}"/usr
rsync -av --delete "${COOKBOOK_BUILD}"/install/* "${COOKBOOK_STAGE}"/usr/
# TODO: rustdoc
rm -rf "${COOKBOOK_STAGE}"/usr/lib/rustlib/*.log
"""
[package]
dependencies = [
"cargo"
]
# TODO: Not implemented
# version_script = """
# printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
# """
[[optional-packages]]
name = "doc"
files = [
"usr/share/doc/**",
]

View File

@ -2,7 +2,6 @@
dependencies = [
"autoconf",
"automake",
"cargo",
"gcc13",
"gcc13.cxx",
"llvm21",