@@ -17,7 +17,7 @@ pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}"
17
17
$( [[ ${CARCH} == i686 ]] || echo " ${MINGW_PACKAGE_PREFIX} -rust-wasm" )
18
18
" ${MINGW_PACKAGE_PREFIX} -rust-src" )
19
19
pkgver=1.83.0
20
- pkgrel=3
20
+ pkgrel=4
21
21
pkgdesc=" Systems programming language focused on safety, speed and concurrency (mingw-w64)"
22
22
arch=(' any' )
23
23
mingw_arch=(' mingw32' ' mingw64' ' ucrt64' ' clang64' ' clangarm64' )
@@ -86,15 +86,15 @@ apply_patch_with_msg() {
86
86
# =========================================== #
87
87
88
88
prepare () {
89
- plain " Extracting ${_realname} c-${pkgver} -src.tar.gz"
90
- tar -xzf ${_realname} c-${pkgver} -src.tar.gz || true
89
+ plain " Extracting ${_realname} c-${pkgver} -src.tar.gz to ${MSYSTEM} directory"
90
+ mkdir -p " ${MSYSTEM} " && tar -xzf ${_realname} c-${pkgver} -src.tar.gz -C " ${MSYSTEM} " || true
91
+ cd " ${MSYSTEM} /${_realname} c-${pkgver} -src"
91
92
92
93
# use latest version of psm to fix arm4 build
93
- rm -r ${_realname} c- ${pkgver} -src/ vendor/psm-0.1.23
94
- mv psm-0.1.24 ${_realname} c- ${pkgver} -src/ vendor/psm-0.1.24
94
+ rm -r vendor/psm-0.1.23
95
+ mv ${srcdir} / psm-0.1.24 vendor/psm-0.1.24
95
96
96
97
# 0008-disable-self-contained-for-gnu-targets.patch allows self-contained for non-windows-gnu targets
97
- cd ${_realname} c-${pkgver} -src
98
98
apply_patch_with_msg \
99
99
0001-rustc-llvm-fix-libs.patch \
100
100
0008-disable-self-contained-for-gnu-targets.patch
@@ -109,7 +109,15 @@ prepare() {
109
109
}
110
110
111
111
build () {
112
- mkdir -p " ${MSYSTEM} " && cd " ${MSYSTEM} "
112
+ cd " ${MSYSTEM} /${_realname} c-${pkgver} -src"
113
+
114
+ if [[ $MINGW_PACKAGE_PREFIX == * -clang-* ]]; then
115
+ # We have to do the following because rust doesn't count x86_64-w64-mingw32 as a target triple
116
+ export OSTYPE=" $CARCH -pc-windows-gnullvm"
117
+ else
118
+ # We have to do the following because rust doesn't count x86_64-w64-mingw32 as a target triple
119
+ export OSTYPE=" $CARCH -pc-windows-gnu"
120
+ fi
113
121
114
122
# hack to inject the bootstrap compiler
115
123
if [[ $_bootstrapping != " no" && $MINGW_PACKAGE_PREFIX == * -clang-aarch64 ]]; then
@@ -118,14 +126,9 @@ build() {
118
126
" ${srcdir} /rust-std-${_stage0version} -dev-aarch64-pc-windows-gnullvm.tar.xz" \
119
127
" ${srcdir} /rustc-${_stage0version} -dev-aarch64-pc-windows-gnullvm.tar.xz" \
120
128
" build/cache/${_stage0date} /"
121
- fi
122
-
123
- if [[ $MINGW_PACKAGE_PREFIX == * -clang-* ]]; then
124
- # We have to do the following because rust doesn't count x86_64-w64-mingw32 as a target triple
125
- export OSTYPE=" $CARCH -pc-windows-gnullvm"
126
- else
127
- # We have to do the following because rust doesn't count x86_64-w64-mingw32 as a target triple
128
- export OSTYPE=" $CARCH -pc-windows-gnu"
129
+ elif [[ $_bootstrapping == " no" ]]; then
130
+ mkdir -p " build/$OSTYPE /stage0/bin"
131
+ cp -f " ${MINGW_PREFIX} " /bin/{cargo,rustc}.exe " build/$OSTYPE /stage0/bin"
129
132
fi
130
133
131
134
if [[ $MINGW_PACKAGE_PREFIX != * -clang-aarch64 ]]; then
@@ -153,31 +156,36 @@ build() {
153
156
export MSYS2_ENV_CONV_EXCL=' INSTALL_PREFIX'
154
157
export INSTALL_PREFIX=" ${MINGW_PREFIX} "
155
158
export PKGREL=" ${pkgrel} "
156
- envsubst < .. /config.toml > " ../ ${_realname} c- ${pkgver} -src/ config.toml"
159
+ envsubst < " ${srcdir} /config.toml" > config.toml
157
160
158
161
if [ " ${_bootstrapping} " = " no" ]; then
159
- sed -i ' /^\[build\]/,/^$/ s|^#||g' " ../ ${_realname} c- ${pkgver} -src/ config.toml"
162
+ sed -i ' /^\[build\]/,/^$/ s|^#||g' config.toml
160
163
fi
161
164
# generate debuginfo only for non-i686 targets
162
165
if check_option " debug" " y" && [ " ${CARCH} " != i686 ]; then
163
- sed -i ' s/^#debug/debug/g' " ../ ${_realname} c- ${pkgver} -src/ config.toml"
166
+ sed -i ' s/^#debug/debug/g' config.toml
164
167
fi
165
168
166
169
# Add target wasm32-*
167
170
if [[ ${CARCH} != i686 ]]; then
168
- sed -i ' /target = \[/a\ "wasm32-unknown-unknown", "wasm32-wasip1", "wasm32-wasip1-threads", "wasm32-wasip2",' " ../ ${_realname} c- ${pkgver} -src/ config.toml"
171
+ sed -i ' /target = \[/a\ "wasm32-unknown-unknown", "wasm32-wasip1", "wasm32-wasip1-threads", "wasm32-wasip2",' config.toml
169
172
fi
170
173
171
- # Building out of tree is not officially supported so we have to workaround some things like vendored deps
172
- cp -r ../${_realname} c-${pkgver} -src/.cargo .
173
- sed -i " s|directory = \" vendor\" |directory = \" ../${_realname} c-${pkgver} -src/vendor\" |" .cargo/config.toml
174
-
175
- local -a _rust_build=()
176
- _rust_build+=(" --stage" " 2" )
177
- # _rust_build+=("--verbose")
178
-
179
- # create the install at a temporary directory
180
- DESTDIR=" $PWD " /dest-rust python ../${_realname} c-${pkgver} -src/x.py install " ${_rust_build[@]} "
174
+ if [[ ${CARCH} == x86_64 ]]; then
175
+ # build opt-dist tool which manages PGO build
176
+ python x.py build opt-dist --target=" $OSTYPE "
177
+
178
+ # run opt-dist to get rustc optimized with PGO
179
+ ./build/$OSTYPE /stage0-tools-bin/opt-dist local \
180
+ --target-triple=" $OSTYPE " \
181
+ --checkout-dir=" $PWD " \
182
+ --llvm-dir=" ${MINGW_PREFIX} " \
183
+ --python=" ${MINGW_PREFIX} /bin/python.exe" -- \
184
+ DESTDIR=" $PWD " /dest-rust python x.py install --stage 2
185
+ else
186
+ # create the install at a temporary directory
187
+ DESTDIR=" $PWD " /dest-rust python x.py install --stage 2
188
+ fi
181
189
182
190
if [[ ${CARCH} != i686 ]]; then
183
191
# move wasm32-* targets out of the way for splitting
@@ -192,8 +200,8 @@ build() {
192
200
}
193
201
194
202
check () {
195
- cd " ${MSYSTEM} "
196
- python ../ ${_realname} c- ${pkgver} -src/ x.py test --stage 2 --exclude src/test/debuginfo
203
+ cd " ${MSYSTEM} / ${_realname} c- ${pkgver} -src "
204
+ python x.py test --stage 2 --exclude src/test/debuginfo
197
205
}
198
206
199
207
package_rust () {
@@ -208,7 +216,7 @@ package_rust() {
208
216
conflicts=(" ${MINGW_PACKAGE_PREFIX} -rust-docs" )
209
217
replaces=(" ${MINGW_PACKAGE_PREFIX} -rust-docs" )
210
218
211
- cd " ${MSYSTEM} "
219
+ cd " ${MSYSTEM} / ${_realname} c- ${pkgver} -src "
212
220
213
221
cp -a dest-rust/* " ${pkgdir} "
214
222
@@ -233,21 +241,19 @@ package_rust-wasm() {
233
241
# object files provided for wasm32-* targets can't be stripped with MSYS2 toolchain
234
242
options=(' !strip' )
235
243
236
- cd " ${MSYSTEM} "
244
+ cd " ${MSYSTEM} / ${_realname} c- ${pkgver} -src "
237
245
238
246
cp -a dest-wasm/* " ${pkgdir} "
239
- install -Dm644 ../${_realname} c-${pkgver} -src/LICENSE-{APACHE,MIT} -t \
240
- " ${pkgdir}${MINGW_PREFIX} /share/licenses/${_realname} -wasm/"
247
+ install -Dm644 LICENSE-{APACHE,MIT} -t " ${pkgdir}${MINGW_PREFIX} /share/licenses/${_realname} -wasm/"
241
248
}
242
249
243
250
package_rust-src () {
244
251
pkgdesc=' Source code for the Rust standard library (mingw-w64)'
245
252
depends=(" ${MINGW_PACKAGE_PREFIX} -rust" )
246
253
247
- cd " ${MSYSTEM} "
254
+ cd " ${MSYSTEM} / ${_realname} c- ${pkgver} -src "
248
255
249
- install -Dm644 ../${_realname} c-${pkgver} -src/LICENSE-{APACHE,MIT} -t \
250
- " ${pkgdir}${MINGW_PREFIX} /share/licenses/${_realname} -src/"
256
+ install -Dm644 LICENSE-{APACHE,MIT} -t " ${pkgdir}${MINGW_PREFIX} /share/licenses/${_realname} -src/"
251
257
252
258
install -d " ${pkgdir}${MINGW_PREFIX} /lib/rustlib/"
253
259
cp -a dest-src " ${pkgdir}${MINGW_PREFIX} /lib/rustlib/src"
0 commit comments