Skip to content

Commit 462dbdf

Browse files
committed
rust: build with PGO
1 parent 076480b commit 462dbdf

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

mingw-w64-rust/PKGBUILD

+17-7
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}"
1717
$([[ ${CARCH} == i686 ]] || echo "${MINGW_PACKAGE_PREFIX}-rust-wasm")
1818
"${MINGW_PACKAGE_PREFIX}-rust-src")
1919
pkgver=1.83.0
20-
pkgrel=3
20+
pkgrel=4
2121
pkgdesc="Systems programming language focused on safety, speed and concurrency (mingw-w64)"
2222
arch=('any')
2323
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64')
@@ -172,12 +172,22 @@ build() {
172172
cp -r ../${_realname}c-${pkgver}-src/.cargo .
173173
sed -i "s|directory = \"vendor\"|directory = \"../${_realname}c-${pkgver}-src/vendor\"|" .cargo/config.toml
174174

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[@]}"
175+
if [[ ${CARCH} == x86_64 ]]; then
176+
# build opt-dist tool which manages PGO build
177+
python ../${_realname}c-${pkgver}-src/x.py build opt-dist
178+
179+
# run opt-dist to get rustc optimized with PGO
180+
./build/$OSTYPE/stage0-tools-bin/opt-dist local \
181+
--target-triple="$OSTYPE" \
182+
--checkout-dir="${srcdir}/${_realname}c-${pkgver}-src" \
183+
--llvm-dir="${MINGW_PREFIX}" \
184+
--python="${MINGW_PREFIX}/bin/python.exe" \
185+
--llvm-shared=no -- \
186+
DESTDIR="$PWD"/dest-rust python ../${_realname}c-${pkgver}-src/x.py install --stage 2
187+
else
188+
# create the install at a temporary directory
189+
DESTDIR="$PWD"/dest-rust python ../${_realname}c-${pkgver}-src/x.py install --stage 2
190+
fi
181191

182192
if [[ ${CARCH} != i686 ]]; then
183193
# move wasm32-* targets out of the way for splitting

0 commit comments

Comments
 (0)