redox/recipes/dev/rust/recipe.toml
Konstantin Shabanov 9b1932db7f recipes: rust: Set SSL_CERT_FILE explicitly
Otherwise, rust recipe fails to download using curl:

+ python3 /mnt/redox/recipes/dev/rust/source/x.py install --config config.toml --jobs 32
downloading https://static.rust-lang.org/dist/2026-04-14/rust-std-beta-x86_64-unknown-linux-gnu.tar.xz
running: curl --progress-bar --retry-all-errors --location \
--speed-time 30 --speed-limit 10 --connect-timeout 30 \
--output /tmp/nix-shell.LcAteo/tmpuv1ls9sy --continue-at - \
--retry 3 --show-error --remote-time --fail \
https://static.rust-lang.org/dist/2026-04-14/rust-std-beta-x86_64-unknown-linux-gnu.tar.xz
curl: (60) SSL certificate OpenSSL verify result: unable to get local issuer certificate (20)
More details here: https://curl.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the webpage mentioned above.
Warning: Problem (retrying all errors). Retrying in 1 second. 3 retries left.
curl: (60) SSL certificate OpenSSL verify result: unable to get local issuer certificate (20)
More details here: https://curl.se/docs/sslcerts.html
2026-07-30 23:15:44 +07:00

84 lines
2.8 KiB
TOML

[source]
git = "https://gitlab.redox-os.org/redox-os/rust.git"
branch = "redox-2026-05-24"
shallow_clone = true
[build]
template = "custom"
dependencies = [
"llvm21",
"zlib",
"curl",
"openssl3",
]
dev-dependencies = [
"llvm21.dev",
"llvm21.runtime",
"lld21",
]
script = """
if [ "${COOKBOOK_HOST_SYSROOT}" = "/usr" ]; then
cat ${COOKBOOK_RECIPE}/config-cross.toml > config.toml
sed -i "s|COOKBOOK_TOOLCHAIN|${COOKBOOK_TOOLCHAIN}|g" config.toml
sed -i "s|COOKBOOK_TARGET|${COOKBOOK_CROSS_TARGET}|g" config.toml
sed -i "s|COOKBOOK_GNU_TARGET|${COOKBOOK_CROSS_GNU_TARGET}|g" config.toml
sed -i "s|TARGET|${TARGET}|g" config.toml
else
DYNAMIC_INIT
# Linker flags for stage2 compiler (host -> target)
ARCH="${TARGET%%-*}"
export CARGO_TARGET_${ARCH^^}_UNKNOWN_REDOX_RUSTFLAGS="${RUSTFLAGS}" # Rust
# Hack for Rust errorneusly running `llvm-config --version` on cross compiled llvm-config
cat "${COOKBOOK_ROOT}/bin/${TARGET}-llvm-config" > "${COOKBOOK_SYSROOT}/bin/llvm-config"
# Hack for Rust stage1 being dynamically linked with LLVM in prefix toolchain
export LD_LIBRARY_PATH="${COOKBOOK_HOST_SYSROOT}/lib:${LD_LIBRARY_PATH}"
# Linker flags for stage1 compiler (host -> host)
export RUSTFLAGS_BOOTSTRAP="\
-Clink-args=-L${COOKBOOK_HOST_SYSROOT}/lib \
-Clink-args=-Wl,-rpath-link,${COOKBOOK_HOST_SYSROOT}/lib"
export CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS="${RUSTFLAGS_BOOTSTRAP}"
export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUSTFLAGS="${RUSTFLAGS_BOOTSTRAP}"
cat ${COOKBOOK_RECIPE}/config.toml > config.toml
sed -i "s|COOKBOOK_SYSROOT|${COOKBOOK_SYSROOT}|g" config.toml
sed -i "s|COOKBOOK_TOOLCHAIN|${COOKBOOK_HOST_SYSROOT}|g" config.toml
sed -i "s|COOKBOOK_TARGET|${TARGET}|g" config.toml
sed -i "s|COOKBOOK_GNU_TARGET|${GNU_TARGET}|g" config.toml
fi
# Don't poison the stage1 compiler (host -> host)
unset AR AS CC CXX LD LDFLAGS NM OBJCOPY OBJDUMP RANLIB READELF RUSTFLAGS CARGO_ENCODED_RUSTFLAGS STRIP
SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt" \
python3 "${COOKBOOK_SOURCE}/x.py" install \
--config config.toml \
--jobs ${COOKBOOK_MAKE_JOBS}
mkdir -p "${COOKBOOK_STAGE}"/usr
rsync -av --delete "${COOKBOOK_BUILD}"/install/* "${COOKBOOK_STAGE}"/usr/
rm -rf "${COOKBOOK_STAGE}"/usr/lib/rustlib/*.log
# workaround for rust.lld, needed by e.g. compiling bootloader
# https://github.com/rust-lang/rust/issues/143076#issuecomment-3011710678
LLD_DIR="${COOKBOOK_STAGE}/usr/lib/rustlib/$TARGET/bin"
mkdir -p $LLD_DIR/gcc-ld
cp ${COOKBOOK_SYSROOT}/usr/bin/lld $LLD_DIR/rust-lld
ln -s rust-lld $LLD_DIR/wasm-component-ld
ln -s ../rust-lld $LLD_DIR/gcc-ld/ld.lld
ln -s ../rust-lld $LLD_DIR/gcc-ld/ld64.lld
ln -s ../rust-lld $LLD_DIR/gcc-ld/lld-link
ln -s ../rust-lld $LLD_DIR/gcc-ld/wasm-ld
ln -s ../../../libLLVM.so.21.1 $LLD_DIR/../lib/libLLVM.so.21.1
"""
[[optional-packages]]
name = "doc"
files = [
"usr/share/doc/**",
]