diff options
author | Que Quotion | 2018-11-06 01:10:43 +0900 |
---|---|---|
committer | Que Quotion | 2018-11-06 01:29:31 +0900 |
commit | fc511b6f4591738fd17711ae144aa620d8d7919e (patch) | |
tree | bc7af83b1dee9972c020928c411d33e528412e80 /pgo.sh.in | |
parent | 121dacbfc1c5742ce8203dfea425f990448a881d (diff) | |
download | aur-fc511b6f4591738fd17711ae144aa620d8d7919e.tar.gz |
Updated for pacman with extendible buildenv
Diffstat (limited to 'pgo.sh.in')
-rw-r--r-- | pgo.sh.in | 46 |
1 files changed, 17 insertions, 29 deletions
diff --git a/pgo.sh.in b/pgo.sh.in index afd8433bc6a8..7824efcab420 100644 --- a/pgo.sh.in +++ b/pgo.sh.in @@ -2,44 +2,32 @@ # # pgo.sh - Compile with, or utilize profile guided optimization # -# Copyright (c) 2008-2016 Pacman Development Team <pacman-dev@archlinux.org> -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. -# -[[ -n "$LIBMAKEPKG_PGO_SH" ]] && return -LIBMAKEPKG_PGO_SH=1 +[[ -n "$LIBMAKEPKG_BUILDENV_PGO_SH" ]] && return +LIBMAKEPKG_BUILDENV_PGO_SH=1 LIBRARY=${LIBRARY:-'@libmakepkgdir@'} source "$LIBRARY/util/message.sh" source "$LIBRARY/util/option.sh" -extra_buildopts+=('pgo') - -[[ -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 +build_options+=('pgo') +buildenv_functions+=('buildenv_pgo') -pgo() { - [[ "$INFAKEROOT" == 1 ]] && return +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 mkdir "$PROFDEST/$pkgbase.gen" CFLAGS+=" -fprofile-generate -fprofile-dir=$PROFDEST/$pkgbase.gen" |