From a2e8ccb049acbd51f49ef96ace8eef04c35c944e Mon Sep 17 00:00:00 2001 From: dcvz Date: Thu, 10 Aug 2023 12:48:29 +0200 Subject: [PATCH 1/3] chore(rust): Add src for better IDE support --- projects/rust-lang.org/package.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/projects/rust-lang.org/package.yml b/projects/rust-lang.org/package.yml index 32adfb1bfa..f6719ddf53 100644 --- a/projects/rust-lang.org/package.yml +++ b/projects/rust-lang.org/package.yml @@ -34,6 +34,10 @@ dependencies: #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 @@ -62,6 +66,14 @@ build: for tool in $tools; do ./x.py install $tool done + + # place source for IDEs to use (normally installed via rustup) + # FIXME: this is fragile because directories can change, is there a better way? + mkdir -p {{prefix}}/lib/rustlib/src/rust + mv Cargo.lock {{prefix}}/lib/rustlib/src/rust + mv library {{prefix}}/lib/rustlib/src/rust + mkdir -p {{prefix}}/lib/rustlib/src/rust/src/llvm-project + mv src/llvm-project/libunwind {{prefix}}/lib/rustlib/src/rust/src/llvm-project rm -rf {{prefix}}/share/doc env: From 3415ba38160ac453a368f5cf315cf57f93ad4e06 Mon Sep 17 00:00:00 2001 From: dcvz Date: Thu, 10 Aug 2023 13:14:20 +0200 Subject: [PATCH 2/3] Install src via rustup --- projects/rust-lang.org/package.yml | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/projects/rust-lang.org/package.yml b/projects/rust-lang.org/package.yml index f6719ddf53..ec208bf8ba 100644 --- a/projects/rust-lang.org/package.yml +++ b/projects/rust-lang.org/package.yml @@ -47,6 +47,7 @@ build: 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 @@ -67,14 +68,20 @@ build: ./x.py install $tool done - # place source for IDEs to use (normally installed via rustup) - # FIXME: this is fragile because directories can change, is there a better way? - mkdir -p {{prefix}}/lib/rustlib/src/rust - mv Cargo.lock {{prefix}}/lib/rustlib/src/rust - mv library {{prefix}}/lib/rustlib/src/rust - mkdir -p {{prefix}}/lib/rustlib/src/rust/src/llvm-project - mv src/llvm-project/libunwind {{prefix}}/lib/rustlib/src/rust/src/llvm-project +# # place source for IDEs to use (normally installed via rustup) +# # FIXME: this is fragile because directories can change, is there a better way? +# mkdir -p {{prefix}}/lib/rustlib/src/rust +# mv Cargo.lock {{prefix}}/lib/rustlib/src/rust +# mv library {{prefix}}/lib/rustlib/src/rust +# mkdir -p {{prefix}}/lib/rustlib/src/rust/src/llvm-project +# mv src/llvm-project/libunwind {{prefix}}/lib/rustlib/src/rust/src/llvm-project + # install src via rustup and copy component for IDEs to use + rustup default {{ version }} + rustup component add rust-src + rp -r ~/.rustup/toolchains/*/lib/rustlib/src {{prefix}}/lib/rustlib + + # do cleanup rm -rf {{prefix}}/share/doc env: ARGS: From 5a3c7d5f126035a168fc5d1198de960afc3085fe Mon Sep 17 00:00:00 2001 From: dcvz Date: Thu, 10 Aug 2023 13:17:57 +0200 Subject: [PATCH 3/3] Do complete installation using rustup --- projects/rust-lang.org/package.yml | 55 ++++-------------------------- 1 file changed, 6 insertions(+), 49 deletions(-) diff --git a/projects/rust-lang.org/package.yml b/projects/rust-lang.org/package.yml index ec208bf8ba..71014636a2 100644 --- a/projects/rust-lang.org/package.yml +++ b/projects/rust-lang.org/package.yml @@ -31,8 +31,6 @@ options: dependencies: tea.xyz/gx/cc: c99 - #FIXME ^^ strictly rustc only needs a linker - zlib.net: 1 runtime: env: @@ -40,60 +38,19 @@ runtime: 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 - -# # place source for IDEs to use (normally installed via rustup) -# # FIXME: this is fragile because directories can change, is there a better way? -# mkdir -p {{prefix}}/lib/rustlib/src/rust -# mv Cargo.lock {{prefix}}/lib/rustlib/src/rust -# mv library {{prefix}}/lib/rustlib/src/rust -# mkdir -p {{prefix}}/lib/rustlib/src/rust/src/llvm-project -# mv src/llvm-project/libunwind {{prefix}}/lib/rustlib/src/rust/src/llvm-project - - # install src via rustup and copy component for IDEs to use rustup default {{ version }} + rustup component add rust-analyzer + # used for type checking in IDEs rustup component add rust-src - rp -r ~/.rustup/toolchains/*/lib/rustlib/src {{prefix}}/lib/rustlib + + # 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: |