-
Notifications
You must be signed in to change notification settings - Fork 1.3k
rustup: new, 1.28.1 #20989
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
rustup: new, 1.28.1 #20989
Conversation
It seems that symlinking issue will be resolved when this gets merged. |
I thought so initially but I'm bot sure if all the tools will handle symlinks properly. This largerly depnds on Cygwin and will require manual testing. |
Until then, would hard linking as this package does be an acceptable solution? It still gains the space savings and still avoids the requiring admin perms problem. |
I think you can try to create symlink in post-install, if it fails then create *.sh and *.cmd. |
I see you didn't apply a patch to properly build aws-lc-sys in clang: https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-zed/aws-lc-clang-build.patch |
Where should I patch it? I don't see an obvious place, the path used that example does not exist here. |
or... use this PKGBUILD: PKGBUILD_realname=rustup
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=1.28.1
pkgrel=1
pkgdesc="The Rust toolchain installer (mingw-w64)"
arch=('x86_64')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://github.com/rust-lang/rustup"
license=('spdx:Apache-2.0 AND MIT')
msys2_references=(
'archlinux: rustup'
)
depends=(
"${MINGW_PACKAGE_PREFIX}-curl"
"${MINGW_PACKAGE_PREFIX}-xz"
"${MINGW_PACKAGE_PREFIX}-zstd"
)
makedepends=(
"${MINGW_PACKAGE_PREFIX}-rust"
"${MINGW_PACKAGE_PREFIX}-cmake"
"${MINGW_PACKAGE_PREFIX}-nasm"
)
optdepends=(
"${MINGW_PACKAGE_PREFIX}-gdb: rust-gdb script"
"${MINGW_PACKAGE_PREFIX}-lldb: rust-lldb script"
)
provides=("${MINGW_PACKAGE_PREFIX}-rust")
conflicts=("${MINGW_PACKAGE_PREFIX}-rust")
install='post.install'
options=("!lto")
source=(
"rustup-${pkgver}.tar.gz::${url}/archive/${pkgver}.tar.gz"
"git+https://github.com/aws/aws-lc-rs.git#tag=aws-lc-sys/v0.27.1"
"git+https://github.com/aws/aws-lc.git"
"aws-lc-clang-build.patch"
"rustup-profile.sh"
)
sha256sums=('2def2f9a0a4a21c80f862c0797c2d76e765e0e7237e1e41f28324722ab912bac'
'5f564de6fb744db858d50ca3a1f0ce737f3d505fea7023c12d3cea3f61eaa20b'
'SKIP'
'2e3d7ef6fdb3ef8a2ec11207e8120ea34553888116ea8a032cb425a8a6261c39'
'dec8fd8b2838e7e5866a0bfbae2be89647c7c70a46c0ada1406accf4017322e9')
_binlinks=('cargo' 'rustc' 'rustdoc' 'rust-gdb' 'rust-lldb' 'rustfmt' 'cargo-fmt' 'cargo-clippy' 'clippy-driver' 'cargo-miri')
prepare() {
(cd aws-lc-rs
git config submodule."aws-lc-sys/aws-lc".url "${srcdir}/aws-lc"
git config submodule."aws-lc-fips-sys/aws-lc".url "${srcdir}/aws-lc"
git -c protocol.file.allow=always submodule update --init --recursive)
if [[ ${CC} == clang ]]; then
patch -d "${srcdir}/aws-lc-rs/aws-lc-sys/aws-lc" -p1 -i "${srcdir}/aws-lc-clang-build.patch"
fi
cd "${_realname}-${pkgver}"
cat >> Cargo.toml <<END
[patch.crates-io]
aws-lc-sys = { path = "../aws-lc-rs/aws-lc-sys" }
END
cargo update -p aws-lc-rs --precise 1.12.6
cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}
build() {
cd "${_realname}-${pkgver}"
cargo build --release --frozen --features no-self-update --bin rustup-init
}
package() {
cd "${_realname}-${pkgver}"
install -d "${pkgdir}/${MINGW_PREFIX}/lib/${_realname}/bin"
install -Dm755 "target/release/rustup-init" "${pkgdir}/${MINGW_PREFIX}/bin/rustup.exe"
for link in "${_binlinks[@]}"; do
MSYS=winsymlinks:native ln "${pkgdir}/${MINGW_PREFIX}/bin/rustup.exe" "${pkgdir}/${MINGW_PREFIX}/bin/${link}.exe"
done
# Special treatment to allow for rust-analyzer to still allow the separate package version to be used.
MSYS=winsymlinks:native ln "${pkgdir}/${MINGW_PREFIX}/bin/rustup.exe" "${pkgdir}/${MINGW_PREFIX}/lib/${_realname}/bin/rust-analyzer.exe"
install -Dm644 "${srcdir}/rustup-profile.sh" "${pkgdir}/etc/profile.d/rustup.sh"
# Generate completion files.
mkdir -p "${pkgdir}/${MINGW_PREFIX}/share/bash-completion/completions"
"${pkgdir}/${MINGW_PREFIX}/bin/rustup" completions bash > "${pkgdir}/${MINGW_PREFIX}/share/bash-completion/completions/rustup"
"${pkgdir}/${MINGW_PREFIX}/bin/rustup" completions bash cargo > "${pkgdir}/${MINGW_PREFIX}/share/bash-completion/completions/cargo"
mkdir -p "${pkgdir}/${MINGW_PREFIX}/share/fish/vendor_completions.d"
"${pkgdir}/${MINGW_PREFIX}/bin/rustup" completions fish > "${pkgdir}/${MINGW_PREFIX}/share/fish/vendor_completions.d/rustup.fish"
mkdir -p "${pkgdir}/${MINGW_PREFIX}/share/zsh/site-functions"
"${pkgdir}/${MINGW_PREFIX}/bin/rustup" completions zsh > "${pkgdir}/${MINGW_PREFIX}/share/zsh/site-functions/_rustup"
"${pkgdir}/${MINGW_PREFIX}/bin/rustup" completions zsh cargo > "${pkgdir}/${MINGW_PREFIX}/share/zsh/site-functions/_cargo"
install -Dm644 LICENSE-MIT "${pkgdir}/${MINGW_PREFIX}/share/licenses/${pkgname}/LICENSE-MIT"
install -Dm644 LICENSE-APACHE "${pkgdir}/${MINGW_PREFIX}/share/licenses/${pkgname}/LICENSE-APACHE"
} but, I wanted to see one more thing changed... I'll leave a review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it possible to just copy rustup.exe to _binlinks
? e.g.
cp "${pkgdir}/${MINGW_PREFIX}/bin/rustup.exe" "${pkgdir}/${MINGW_PREFIX}/bin/${link}.exe"
it's common practice for our packages, gcc example. yes, it will use much disk space, but this is the only option we can use...
Hard links have been around for a very long time ( |
I thoght a bit more about this, I can try the package with hard links. but is environment variable setting required? (I almost had no experience with changing |
Unfortunately I've changed the links to copies, and it'll be a while before I can revert them. But no, no changes required by the end user, only while building the package (I set it to |
I should have rights to edit your branch, so no worries |
ahh, fails like before
|
it seems that having rustup here has no sense... |
looks like for hard links there is no difference, you don't have to set |
I can't reproduce this error, seems fine in CI and my local machine, where does it happen? |
probably because I added ${MINGW_PFEFIX}/bin to global $PATH. I don't know actually... my config is not clean edit: I tried to compile rustup itself |
Hmm, CLANGARM64 CI failed instead of skipping. Though, should this package should support it? There seems to be support for arm64 msvc, but not arm64 gnu/gnullvm. |
for MSVC target it's better to use official rustup distribution IMO |
A bit scared since last time I did a rebase it closed my PR... but I did commit to master instead of a branch so maybe that was why. |
MSYS=winsymlinks:native not needed for hard links
rustup/rustc only supports arm64 msvc anyway, but not arm64 gnu/gnullvm
That happens when you make a mistake when rebasing and remove all the new commits. When GitHub sees a PR that brings no changes, it'll close the PR. |
Is there anything else required for this to be merged? |
so, let it be an another option to use Rust here. but of course it would be better to use common Rust package instead |
🙏 |
it's already in the repo: https://packages.msys2.org/base/mingw-w64-rustup |
Supersedes #20923
Forgot to do the work in a separate branch, updating master on my fork caused merge conflicts :)