summarylogtreecommitdiffstats
path: root/lto.sh.in
diff options
context:
space:
mode:
authorQue Quotion2019-07-10 19:36:34 +0900
committerQue Quotion2019-07-10 19:36:34 +0900
commit0d3062da404b6a2e6bc94328e79fc54a8f5329cf (patch)
tree83df56907795abd9aa1a14b66946100f269e1e2c /lto.sh.in
parenta6fd22e346fc502bb625139d55704e6741facecf (diff)
downloadaur-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 'lto.sh.in')
-rw-r--r--lto.sh.in40
1 files changed, 18 insertions, 22 deletions
diff --git a/lto.sh.in b/lto.sh.in
index 126a9fc175d1..c8dc62397d90 100644
--- a/lto.sh.in
+++ b/lto.sh.in
@@ -14,28 +14,24 @@ build_options+=('lto' 'lto-thin')
buildenv_functions+=('buildenv_lto')
buildenv_lto() {
- if check_buildoption "lto" "y" || check_buildoption "lto-thin" "y" && \
- [[ -f "$(gcc -print-search-dirs | grep install | awk '{print $2 "liblto_plugin.so"}')" ]]; then
- [[ "$CC" == "clang" ]] && \
- CFLAGS+=" -flto" || \
- CFLAGS+=" -flto=$(getconf _NPROCESSORS_ONLN) -flto-partition=none -fno-fat-lto-objects"
- [[ "$CXX" == "clang++" ]] && \
- CXXFLAGS+=" -flto" || \
- CXXFLAGS+=" -flto=$(getconf _NPROCESSORS_ONLN) -flto-partition=none -fno-fat-lto-objects"
+ if check_buildoption "lto" "y" || check_buildoption "lto-thin" "y" && \
+ [[ -f "$(gcc -print-search-dirs | grep install | awk '{print $2 "liblto_plugin.so"}')" ]]; then
+ [[ "$CC" == "clang" || "$CXX" == "clang++" ]] && \
+ ltoflags=" -flto" || \
+ ltoflags=" -flto=$(getconf _NPROCESSORS_ONLN) -flto-partition=none -fno-fat-lto-objects"
- if check_buildoption "lto-thin" "y"; then
- [[ "$CC" == "clang" ]] && \
- CFLAGS="${CFLAGS// -flto / -flto=thin }" || \
- CFLAGS="${CFLAGS// -flto-partition=none / }"
- [[ "$CXX" == "clang++" ]] && \
- CXXFLAGS="${CXXFLAGS// -flto / -flto=thin }" || \
- CXXFLAGS="${CXXFLAGS// -flto-partition=none / }"
- fi
+ if check_buildoption "lto-thin" "y"; then
+ [[ "$CC" == "clang" || "$CXX" == "clang++" ]] && \
+ ltoflags="${ltoflags// -flto/ -flto=thin}" || \
+ ltoflags="${ltoflags// -flto-partition=none / }"
+ fi
- LDFLAGS+=" -fuse-linker-plugin $CFLAGS $CXXFLAGS"
- LTOPLUGIN="$(gcc -print-search-dirs | grep install | awk '{print $2 "liblto_plugin.so"}')"
- ARFLAGS+=" --plugin $LTOPLUGIN"
- RANLIBFLAGS+=" --plugin $LTOPLUGIN"
- NMFLAGS+=" --plugin $LTOPLUGIN"
- fi
+ CFLAGS+="$ltoflags"
+ CXXFLAGS+="$ltoflags"
+ LDFLAGS+=" -fuse-linker-plugin $CFLAGS $CXXFLAGS"
+ ltoplugin="$(gcc -print-search-dirs | grep install | awk '{print $2 "liblto_plugin.so"}')"
+ ARFLAGS+=" --plugin $ltoplugin"
+ RANLIBFLAGS+=" --plugin $ltoplugin"
+ NMFLAGS+=" --plugin $ltoplugin"
+ fi
}