Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(rust): Install rust via rustup #2796

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
54 changes: 15 additions & 39 deletions projects/rust-lang.org/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,50 +31,26 @@ options:

dependencies:
tea.xyz/gx/cc: c99
#FIXME ^^ strictly rustc only needs a linker
zlib.net: 1

runtime:
env:
RUST_SRC_PATH: ${{prefix}}/lib/rustlib/src/rust/src

build:
dependencies:
tea.xyz/gx/make: '*' #FIXME surely we don’t need make AND ninja
cmake.org: ^3.20
ninja-build.org: ^1.10
python.org: 3
openssl.org: '*' # needed to build openssl-sys
freedesktop.org/pkg-config: ^0.29
crates.io/semverator: 0
rust-lang.org/rustup: '*'
script: |-
# --enable-optimize not available as of 1.63.0
if semverator satisfies '<1.63' {{ version }}; then
export ARGS="$ARGS --enable-optimize"
fi

# 1.68.0 introduced a regression w.r.t. CI builds
# https://github.com/rust-lang/rust/issues/108959
if semverator satisfies '>=1.68<1.70' {{ version }}; then
sed -i.bak -e 's/CiEnv::is_ci()/CiEnv::is_ci() \&\& config.rust_info.is_managed_git_subrepository()/' src/bootstrap/native.rs
rm src/bootstrap/native.rs.bak
fi

./configure $ARGS
make install

for tool in $tools; do
./x.py install $tool
done

rustup default {{ version }}
rustup component add rust-analyzer
# used for type checking in IDEs
rustup component add rust-src

# copy installation
mkdir -p {{ prefix }}
cp -r ~/.rustup/toolchains/*/* {{prefix}}

# do cleanup
rm -rf {{prefix}}/share/doc
env:
ARGS:
- --enable-vendor
- --prefix={{ prefix }}
- --enable-ninja
- --disable-docs # docs are online
- --tools=clippy,rustfmt,analysis
tools:
- clippy
- rustfmt
- rust-analyzer

test:
script: |
Expand Down