Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
184 changes: 184 additions & 0 deletions rust-1.89.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
package:
name: rust-1.89
version: "1.89.0"
epoch: 0
description: "Empowering everyone to build reliable and efficient software."
copyright:
- license: Apache-2.0 AND MIT
resources:
cpu: 16
memory: 16Gi
dependencies:
runtime:
- libLLVM-20
provides:
- rust=${{package.full-version}}

environment:
contents:
packages:
- build-base
- busybox
- ca-certificates-bundle
- clang-20
- cmake
- coreutils
- curl-dev
- file
- libLLVM-20
- libssh2-dev
- libxml2-dev
- llvm-20
- llvm-20-dev
- openssl-dev
- patch
- python3
- rustup
- samurai
- wasi-libc
- xz-dev
- zlib-dev

pipeline:
- uses: fetch
with:
uri: https://static.rust-lang.org/dist/rustc-${{package.version}}-src.tar.xz
expected-sha256: 0b9d55610d8270e06c44f459d1e2b7918a5e673809c592abed9b9c600e33d95a
extract: false

- runs: |
tar -xJf rustc-${{package.version}}-src.tar.xz
rm rustc-${{package.version}}-src.tar.xz

- runs: |
# Our rust-1.88 package fails to bootstrap rust 1.89.
# See https://github.com/chainguard-dev/internal-dev/issues/19114 for more details.
rustup toolchain install 1.88.0
export PATH="$HOME/.rustup/toolchains/1.88.0-${{host.triplet.rust}}/bin:$PATH"

export CFLAGS="$CFLAGS -O2 -I/usr/lib/llvm-20/include"
export CXXFLAGS="$CXXFLAGS -O2 -I/usr/lib/llvm-20/include"
export OPENSSL_NO_VENDOR=1
export RUST_BACKTRACE=1
export ARCH=${{host.triplet.rust}}
cd rustc-${{package.version}}-src

# Create a minimal config.toml with necessary options
# This is needed because of upstream changes in Rust 1.87 that removed automatic config.toml creation
cat > config.toml <<EOF
[rust]
deny-warnings = false
EOF

./configure \
--host="${ARCH}" \
--target="${ARCH}" \
--prefix="/usr" \
--release-channel="stable" \
--enable-local-rust \
--local-rust-root="/usr" \
--llvm-root="/usr/lib/llvm-20" \
--llvm-config="/usr/lib/llvm-20/bin/llvm-config" \
--disable-docs \
--enable-extended \
--tools="cargo,src,clippy,rustfmt,rustdoc" \
--enable-llvm-link-shared \
--enable-option-checking \
--enable-locked-deps \
--enable-profiler \
--enable-vendor \
--dist-compression-formats=gz \
--python="python3" \
--set="rust.musl-root=/usr" \
--set="rust.codegen-units=1" \
--set="rust.codegen-units-std=1" \
--set="target.${ARCH}.musl-root=/usr" \
--set="target.${ARCH}.crt-static=false" \
--set="target.${ARCH}.musl-root=/usr" \
--set="target.${ARCH}.crt-static=false" \
--set="build.cargo=$HOME/.rustup/toolchains/1.88.0-${{host.triplet.rust}}/bin/cargo" \
--set="build.rustc=$HOME/.rustup/toolchains/1.88.0-${{host.triplet.rust}}/bin/rustc"

# Configure the bootstrap process not to use Rust's LLD (as we use our
# system LLVM); see
# https://github.com/rust-lang/rust/issues/143076#issuecomment-3018803649
sed -i '/^\[rust\]$/a lld=false' bootstrap.toml

- runs: |
cd rustc-${{package.version}}-src
sed 's|deny(warnings,|deny(|' -i src/bootstrap/src/lib.rs
mkdir -p "${{targets.destdir}}/usr"
unset CARGO_PROFILE_RELEASE_LTO
unset CARGO_PROFILE_RELEASE_OPT_LEVEL
unset CARGO_PROFILE_RELEASE_PANIC
unset CARGO_PROFILE_RELEASE_CODEGEN_UNITS
export CFLAGS="$CFLAGS -O2 -I/usr/lib/llvm-20/include/"
export CXXFLAGS="$CXXFLAGS -O2 -I/usr/lib/llvm-20/include/"
export OPENSSL_NO_VENDOR=1
export RUSTC_BOOTSTRAP=1
export RUST_BACKTRACE=full
DESTDIR=${{targets.destdir}} python3 ./x.py install --jobs $(nproc)

- uses: strip

# delete uneeded files eg uninstalltion
- runs: |
rm ${{targets.destdir}}/usr/lib/rustlib/components
rm ${{targets.destdir}}/usr/lib/rustlib/install.log
rm ${{targets.destdir}}/usr/lib/rustlib/rust-installer-version
rm ${{targets.destdir}}/usr/lib/rustlib/uninstall.sh
rm ${{targets.destdir}}/usr/lib/rustlib/manifest-*

- name: ensure libraries are executable for melange SCA provides generation
runs: |
chmod +x ${{targets.destdir}}/usr/lib/*.so

update:
enabled: true
github:
identifier: rust-lang/rust
use-tag: true
tag-filter: 1.89.

test:
environment:
contents:
packages:
- gcc
- glibc-dev
pipeline:
- name: Verify rustc installation
runs: |
rustc --version || exit 1
cargo --help
cargo-clippy --version
cargo-clippy --help
cargo-fmt --version
cargo-fmt --help
clippy-driver --version
clippy-driver --help
rust-gdbgui --help
rustc --help
rustdoc --help
rustfmt --version
rustfmt --help
- name: Verify cargo installation
runs: |
cargo --version || exit 1
- name: Compile and run Hello World
runs: |
cat <<'EOF' > hello.rs
fn main() {
println!("Hello, World!");
}
EOF
rustc hello.rs
./hello | grep -q "Hello, World!" || exit 1
- name: Cargo project creation and run
runs: |
cargo new hello_cargo --bin
cd hello_cargo
cargo run | grep -q "Hello, world!" || exit 1
- name: Verify rustdoc installation
runs: |
rustdoc --version || exit 1
Loading