Support recipe builds for Linux

This commit is contained in:
Jeremy Soller 2025-11-20 12:42:05 -07:00
parent 12f1f1701f
commit 8893328119
No known key found for this signature in database
GPG Key ID: 670FDFB5428E05CA
5 changed files with 34 additions and 21 deletions

View File

@ -20,3 +20,7 @@ rustflags = []
[env]
CFLAGS_riscv64gc_unknown_redox="-march=rv64gc -mabi=lp64d"
[target.x86_64-unknown-linux-gnu]
linker = "x86_64-linux-gnu-gcc"
rustflags = []

22
Cargo.lock generated
View File

@ -1067,9 +1067,9 @@ dependencies = [
[[package]]
name = "hashbrown"
version = "0.16.0"
version = "0.16.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5419bdc4f6a9207fbeba6d11b604d481addf78ecd10c11ad51e76c2f6482748d"
checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"
[[package]]
name = "heck"
@ -1367,7 +1367,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f"
dependencies = [
"equivalent",
"hashbrown 0.16.0",
"hashbrown 0.16.1",
]
[[package]]
@ -1821,7 +1821,7 @@ version = "0.2.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9"
dependencies = [
"zerocopy 0.8.27",
"zerocopy 0.8.28",
]
[[package]]
@ -2163,9 +2163,9 @@ dependencies = [
[[package]]
name = "redoxer"
version = "0.2.57"
version = "0.2.60"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2495808593af68ef1267347d23b5c95e682e0260c9512bd7295d6806d0f9237a"
checksum = "2ef2d308648e7006723774da783dd5d9a6c931387b3dc7f903a10fa1c2026d0d"
dependencies = [
"anyhow",
"dirs 6.0.0",
@ -3567,11 +3567,11 @@ dependencies = [
[[package]]
name = "zerocopy"
version = "0.8.27"
version = "0.8.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0894878a5fa3edfd6da3f88c4805f4c8558e2b996227a3d864f47fe11e38282c"
checksum = "43fa6694ed34d6e57407afbccdeecfa268c470a7d2a5b0cf49ce9fcc345afb90"
dependencies = [
"zerocopy-derive 0.8.27",
"zerocopy-derive 0.8.28",
]
[[package]]
@ -3587,9 +3587,9 @@ dependencies = [
[[package]]
name = "zerocopy-derive"
version = "0.8.27"
version = "0.8.28"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88d2b8d9c68ad2b9e4340d7832716a4d21a22a1154777ad56ea55c51a9cf3831"
checksum = "c640b22cd9817fae95be82f0d2f90b11f7605f6c319d16705c459b27ac2cbc26"
dependencies = [
"proc-macro2",
"quote",

View File

@ -38,7 +38,7 @@ pkgar-core = { path = "pkgar/pkgar-core" }
pkgar-keys = { path = "pkgar/pkgar-keys" }
redox-pkg = "0.2.8"
redox_installer = "0.2.37"
redoxer = "0.2.57"
redoxer = "0.2.60"
regex = "1.11"
serde = { version = "=1.0.197", features = ["derive"] }
termion = "4"

View File

@ -344,6 +344,7 @@ pub fn build(
command.current_dir(&cookbook_build);
command.env("COOKBOOK_BUILD", &cookbook_build);
command.env("COOKBOOK_NAME", name.as_str());
command.env("COOKBOOK_HOST_TARGET", redoxer::host_target());
command.env("COOKBOOK_RECIPE", &cookbook_recipe);
command.env("COOKBOOK_ROOT", &cookbook_root);
command.env("COOKBOOK_STAGE", &cookbook_stage);

View File

@ -9,11 +9,16 @@ function DYNAMIC_INIT {
done
}
if [ "${TARGET}" != "x86_64-unknown-redox" ]
then
[ -z "${COOKBOOK_VERBOSE}" ] || echo "WARN: ${TARGET} does not support dynamic linking." >&2
return
fi
case "${TARGET}" in
"x86_64-unknown-redox")
;;
"x86_64-unknown-linux-gnu")
;;
*)
[ -z "${COOKBOOK_VERBOSE}" ] || echo "WARN: ${TARGET} does not support dynamic linking." >&2
return
;;
esac
[ -z "${COOKBOOK_VERBOSE}" ] || echo "DEBUG: Program is being compiled dynamically."
@ -97,10 +102,13 @@ export CPPFLAGS="-I${COOKBOOK_SYSROOT}/include"
export LDFLAGS="-L${COOKBOOK_SYSROOT}/lib --static"
# These ensure that pkg-config gets the right flags from the 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}"
if [ "${TARGET}" != "${COOKBOOK_HOST_TARGET}" ]
then
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}"
fi
# To build the debug version of a Cargo program, add COOKBOOK_DEBUG=true, and
# to not strip symbols from the final package, add COOKBOOK_NOSTRIP=true to the recipe