diff options
author | Que Quotion | 2019-07-10 19:36:34 +0900 |
---|---|---|
committer | Que Quotion | 2019-07-10 19:36:34 +0900 |
commit | 0d3062da404b6a2e6bc94328e79fc54a8f5329cf (patch) | |
tree | 83df56907795abd9aa1a14b66946100f269e1e2c /pgo.sh.in | |
parent | a6fd22e346fc502bb625139d55704e6741facecf (diff) | |
download | aur-0d3062da404b6a2e6bc94328e79fc54a8f5329cf.tar.gz |
United Maintenance Plan: restructure all libmakepkg scripts (replace tabs with whitespace, reduce complexity, use safer methods to set flags)
Diffstat (limited to 'pgo.sh.in')
-rw-r--r-- | pgo.sh.in | 49 |
1 files changed, 26 insertions, 23 deletions
diff --git a/pgo.sh.in b/pgo.sh.in index 0bb44b80f39b..5cb9c5101247 100644 --- a/pgo.sh.in +++ b/pgo.sh.in @@ -15,27 +15,30 @@ build_options+=('pgo') buildenv_functions+=('buildenv_pgo') buildenv_pgo() { - if check_buildoption "pgo" "y"; then - [[ -n ${PROFDEST} ]] && _PROFDEST=$(canonicalize_path ${PROFDEST}) - PROFDEST=${_PROFDEST:-$PROFDEST} - PROFDEST=${PROFDEST:-$startdir} #default to $startdir if undefined - - if [[ ! -w $PROFDEST ]] ; then - error "$(gettext "You do not have write permission to store profiles in %s.")" "$PROFDEST" - plain "$(gettext "Aborting...")" - exit 1 - fi - - [[ "$INFAKEROOT" == 1 ]] && return - - if [ ! -d "$PROFDEST/$pkgbase.gen" ]; then - CFLAGS+=" -fprofile-generate -fprofile-dir=$PROFDEST/$pkgbase.gen" - CXXFLAGS+=" -fprofile-generate -fprofile-dir=$PROFDEST/$pkgbase.gen" - LDFLAGS+=" -lgcov --coverage" - else - [[ ! -d "$PROFDEST/$pkgbase.used" ]] && mv "$PROFDEST/$pkgbase.gen" "$PROFDEST/$pkgbase.used" - CFLAGS+=" -fprofile-correction -fprofile-use -fprofile-dir=$PROFDEST/$pkgbase.used" - CXXFLAGS+=" -fprofile-correction -fprofile-use -fprofile-dir=$PROFDEST/$pkgbase.used" - fi - fi + if check_buildoption "pgo" "y"; then + [[ -n ${PROFDEST} ]] && _PROFDEST=$(canonicalize_path ${PROFDEST}) + PROFDEST=${_PROFDEST:-$PROFDEST} + PROFDEST=${PROFDEST:-$startdir} #default to $startdir if undefined + + if [[ ! -w $PROFDEST ]] ; then + error "$(gettext "You do not have write permission to store profiles in %s.")" "$PROFDEST" + plain "$(gettext "Aborting...")" + exit 1 + fi + + [[ "$INFAKEROOT" == 1 ]] && return + + if [ ! -d "$PROFDEST/$pkgbase.gen" ]; then + pgoflags=" -fprofile-generate -fprofile-dir=$PROFDEST/$pkgbase.gen" + pgoldflags=" -lgcov --coverage" + else + [[ ! -d "$PROFDEST/$pkgbase.used" ]] && mv "$PROFDEST/$pkgbase.gen" "$PROFDEST/$pkgbase.used" + pgoflags=" -fprofile-correction -fprofile-use -fprofile-dir=$PROFDEST/$pkgbase.used" + fi + + CFLAGS+="$pgoflags" + CXXFLAGS+="$pgoflags" + LDFLAGS+="$pgoldflags" + + fi } |