Skip to content

Commit

Permalink
rust: build with PGO
Browse files Browse the repository at this point in the history
  • Loading branch information
ognevny committed Dec 10, 2024
1 parent 076480b commit 462dbdf
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions mingw-w64-rust/PKGBUILD
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}"
$([[ ${CARCH} == i686 ]] || echo "${MINGW_PACKAGE_PREFIX}-rust-wasm")
"${MINGW_PACKAGE_PREFIX}-rust-src")
pkgver=1.83.0
pkgrel=3
pkgrel=4
pkgdesc="Systems programming language focused on safety, speed and concurrency (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clangarm64')
Expand Down Expand Up @@ -172,12 +172,22 @@ build() {
cp -r ../${_realname}c-${pkgver}-src/.cargo .
sed -i "s|directory = \"vendor\"|directory = \"../${_realname}c-${pkgver}-src/vendor\"|" .cargo/config.toml

local -a _rust_build=()
_rust_build+=("--stage" "2")
#_rust_build+=("--verbose")

# create the install at a temporary directory
DESTDIR="$PWD"/dest-rust python ../${_realname}c-${pkgver}-src/x.py install "${_rust_build[@]}"
if [[ ${CARCH} == x86_64 ]]; then
# build opt-dist tool which manages PGO build
python ../${_realname}c-${pkgver}-src/x.py build opt-dist

# run opt-dist to get rustc optimized with PGO
./build/$OSTYPE/stage0-tools-bin/opt-dist local \
--target-triple="$OSTYPE" \
--checkout-dir="${srcdir}/${_realname}c-${pkgver}-src" \
--llvm-dir="${MINGW_PREFIX}" \
--python="${MINGW_PREFIX}/bin/python.exe" \
--llvm-shared=no -- \
DESTDIR="$PWD"/dest-rust python ../${_realname}c-${pkgver}-src/x.py install --stage 2
else
# create the install at a temporary directory
DESTDIR="$PWD"/dest-rust python ../${_realname}c-${pkgver}-src/x.py install --stage 2
fi

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

0 comments on commit 462dbdf

Please sign in to comment.