don't really care about pgo for rust

This commit is contained in:
2025-12-21 11:26:05 -06:00
parent 71c7266661
commit 200d4c4a6c
2 changed files with 14 additions and 9 deletions

View File

@@ -26,6 +26,7 @@ set_compile_opts() {
FFMPEG_EXTRA_FLAGS FFMPEG_EXTRA_FLAGS
CARGO_CINSTALL_FLAGS CARGO_CINSTALL_FLAGS
LTO_FLAG LTO_FLAG
PGO_FLAG
LIB_SUFF LIB_SUFF
BUILD_TYPE BUILD_TYPE
) )
@@ -169,13 +170,13 @@ exec \"${realT}\" ${addFlag} \"\$@\"" >"${compilerDir}/${genericT}"
# second run will be to use generated profdata # second run will be to use generated profdata
if [[ ${PGO} == 'ON' ]]; then if [[ ${PGO} == 'ON' ]]; then
if [[ ${PGO_RUN} == 'generate' ]]; then if [[ ${PGO_RUN} == 'generate' ]]; then
local pgoFlag="-fprofile-generate" PGO_FLAG="-fprofile-generate"
CFLAGS_ARR+=("${pgoFlag}") CFLAGS_ARR+=("${PGO_FLAG}")
LDFLAGS_ARR+=("${pgoFlag}") LDFLAGS_ARR+=("${PGO_FLAG}")
else else
local pgoFlag="-fprofile-use=${PGO_PROFDATA}" PGO_FLAG="-fprofile-use=${PGO_PROFDATA}"
CFLAGS_ARR+=("${pgoFlag}") CFLAGS_ARR+=("${PGO_FLAG}")
LDFLAGS_ARR+=("${pgoFlag}") LDFLAGS_ARR+=("${PGO_FLAG}")
fi fi
fi fi
@@ -661,8 +662,11 @@ del_pkgconfig_gcc_s() {
### RUST ### ### RUST ###
meta_cargoc_build() { meta_cargoc_build() {
local destdir="${PWD}/fb-local-install" local destdir="${PWD}/fb-local-install"
# let rust handle its own lto # let rust handle its own lto/pgo
CFLAGS="${CFLAGS//${LTO_FLAG}/}" cargo cinstall \ local newCflags="${CFLAGS//${LTO_FLAG}/}"
newCflags="${newCflags//${PGO_FLAG}/}"
CFLAGS="${newCflags}" cargo cinstall \
--destdir "${destdir}" \ --destdir "${destdir}" \
"${CARGO_CINSTALL_FLAGS[@]}" || return 1 "${CARGO_CINSTALL_FLAGS[@]}" || return 1
# cargo cinstall destdir prepends with entire prefix # cargo cinstall destdir prepends with entire prefix

View File

@@ -13,8 +13,9 @@ gen_profdata() {
# make fhd preset 2 # make fhd preset 2
line_contains "${vid}" 'fhd' && args+=(-P 2) line_contains "${vid}" 'fhd' && args+=(-P 2)
echo_info "encoding pgo vid: ${vid}"
LLVM_PROFILE_FILE="${PGO_DIR}/default_%p.profraw" \ LLVM_PROFILE_FILE="${PGO_DIR}/default_%p.profraw" \
encode -i "${vid}" "${args[@]}" "encoded-${vid}" || return 1 echo_if_fail encode -i "${vid}" "${args[@]}" "encoded-${vid}" || return 1
done done
# merge profraw into profdata # merge profraw into profdata