Skip to content
Merged
Show file tree
Hide file tree
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
100 changes: 100 additions & 0 deletions mingw-w64-rustup/PKGBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
_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')
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=(
"git"
"${MINGW_PACKAGE_PREFIX}-rust"
"${MINGW_PACKAGE_PREFIX}-rust-bindgen"
"${MINGW_PACKAGE_PREFIX}-cmake"
"${MINGW_PACKAGE_PREFIX}-nasm"
Comment thread
500-internal-server-error marked this conversation as resolved.
)
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#tag=aws-lc-sys/v0.27.1"
"git+https://github.com/aws/aws-lc.git"
"aws-lc-clang-build.patch" # taken from https://github.com/msys2/MINGW-packages/blob/911c06155de002672b27b3c8bbe893615250b6bf/mingw-w64-zed/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" -Np1 -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
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.
ln "${pkgdir}/${MINGW_PREFIX}/bin/rustup.exe" "${pkgdir}/${MINGW_PREFIX}/lib/${_realname}/bin/rust-analyzer.exe"

install -Dm644 "${srcdir}/rustup-profile.sh" "${pkgdir}/${MINGW_PREFIX}/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"
}
46 changes: 46 additions & 0 deletions mingw-w64-rustup/aws-lc-clang-build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index fcb8c928e..d283a6ed4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -399,7 +399,7 @@ if(GCC OR CLANG)
set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wno-deprecated-declarations")
else()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wextra")
- set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wall -fvisibility=hidden -fno-common")
+ set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wall -fvisibility=hidden -fno-common -fms-extensions")
set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -Wno-newline-eof")
endif()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunused -Wcomment -Wchar-subscripts -Wuninitialized -Wshadow")
diff --git a/crypto/internal.h b/crypto/internal.h
index 4e42bb5b5..cb74fac23 100644
--- a/crypto/internal.h
+++ b/crypto/internal.h
@@ -141,7 +141,7 @@
#endif

#if defined(OPENSSL_THREADS) && \
- (!defined(OPENSSL_WINDOWS) || defined(__MINGW32__))
+ (!defined(OPENSSL_WINDOWS) || defined(__MINGW32__) && !defined(__clang__))
#include <pthread.h>
#define OPENSSL_PTHREADS
#endif
diff --git a/crypto/thread_win.c b/crypto/thread_win.c
index 9a1f8045e..0606e6db0 100644
--- a/crypto/thread_win.c
+++ b/crypto/thread_win.c
@@ -146,6 +146,7 @@ static void NTAPI thread_local_destructor(PVOID module, DWORD reason,
// optimization from discarding the variable.
//
// Note, in the prefixed build, |p_thread_callback_boringssl| may be a macro.
+#ifdef _MSC_VER
#define STRINGIFY(x) #x
#define EXPAND_AND_STRINGIFY(x) STRINGIFY(x)
#ifdef _WIN64
@@ -157,6 +158,7 @@ __pragma(comment(linker, "/INCLUDE:__tls_used"))
__pragma(comment(
linker, "/INCLUDE:_" EXPAND_AND_STRINGIFY(p_thread_callback_boringssl)))
#endif
+#endif

// .CRT$XLA to .CRT$XLZ is an array of PIMAGE_TLS_CALLBACK pointers that are
// called automatically by the OS loader code (not the CRT) when the module is
8 changes: 8 additions & 0 deletions mingw-w64-rustup/post.install
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
post_install() {
echo "You may need to run 'rustup update stable'"
echo "and possibly also 'rustup self upgrade-data'"
}

post_upgrade() {
echo "You may need to run 'rustup self upgrade-data'"
}
7 changes: 7 additions & 0 deletions mingw-w64-rustup/rustup-profile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
case ":$PATH" in
*:"${MINGW_PREFIX}/lib/rustup/bin":*)
;;
*)
PATH="${PATH:+$PATH:}${MINGW_PREFIX}/lib/rustup/bin"
esac
export PATH