Skip to content

Commit

Permalink
rust: build with PGO in CLANG64
Browse files Browse the repository at this point in the history
  • Loading branch information
ognevny committed Dec 9, 2024
1 parent 076480b commit dd7fab9
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion 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 @@ -176,6 +176,16 @@ build() {
_rust_build+=("--stage" "2")
#_rust_build+=("--verbose")

# compile rustc at first to generate PGO profile
if [[ ${MSYSTEM} == CLANG64 ]]; then
python ../${_realname}c-${pkgver}-src/x.py build "${_rust_build[@]}" \
--target="$OSTYPE" \
--rust-profile-generate="$PWD"/rust-pgo

llvm-profdata merge "$PWD"/rust-pgo/*.profraw --output="$PWD"/rust.profdata
_rust_build+=("--rust-profile-use=$PWD/rust.profdata")
fi

# create the install at a temporary directory
DESTDIR="$PWD"/dest-rust python ../${_realname}c-${pkgver}-src/x.py install "${_rust_build[@]}"

Expand Down

0 comments on commit dd7fab9

Please sign in to comment.