aboutsummarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Jung2022-06-25 09:10:31 +0200
committerPeter Jung2022-06-25 09:10:31 +0200
commitcdbce5d46ceaee0ea241f19493ac3c227b8e9874 (patch)
tree48dd5e3d1dee9b17ff37bfbe33bbe60443374c1e
parent3e86fda92226ff9f30608e8dba15611a0e43b122 (diff)
downloadaur-cdbce5d46ceaee0ea241f19493ac3c227b8e9874.tar.gz
update relocs, fix bolt, update readme
-rw-r--r--.SRCINFO34
-rw-r--r--PKGBUILD133
-rw-r--r--README.md22
-rw-r--r--ZZ-lto.sh.in32
-rw-r--r--aocc.sh.in14
-rw-r--r--bolt.sh.in8
-rw-r--r--buildcache.sh.in12
-rw-r--r--compiler.sh.in46
-rw-r--r--graphite.sh.in18
-rw-r--r--lld.sh.in8
-rw-r--r--mold.sh.in8
-rw-r--r--optipng-exec.sh.in10
-rw-r--r--optipng.sh.in24
-rw-r--r--pgo.sh.in62
-rw-r--r--relocs.sh.in15
-rw-r--r--relocsgcc.sh.in25
-rw-r--r--rice.sh.in18
-rw-r--r--svgo-exec.sh.in10
-rw-r--r--svgo.sh.in24
-rw-r--r--upx-exec.sh.in10
-rw-r--r--upx.sh.in40
21 files changed, 311 insertions, 262 deletions
diff --git a/.SRCINFO b/.SRCINFO
index d31e29bef824..3de1ca96f47b 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = makepkg-optimize-mold
pkgdesc = Supplemental build and packaging optimizations for makepkg
- pkgver = 27
+ pkgver = 28
pkgrel = 1
url = https://wiki.archlinux.org/index.php/Makepkg-optimize
arch = any
@@ -27,6 +27,7 @@ pkgbase = makepkg-optimize-mold
source = lld.sh.in
source = aocc.sh.in
source = relocs.sh.in
+ source = relocsgcc.sh.in
source = upx-exec.sh.in
source = optipng-exec.sh.in
source = svgo-exec.sh.in
@@ -43,21 +44,22 @@ pkgbase = makepkg-optimize-mold
source = pkgopts_ext.conf
source = pkgopts-param_ext.conf
source = compress-param_max.conf
- sha1sums = 4c5f0be71638a6ec2f18c01675d99f19eb6dd45d
- sha1sums = 996ed46bddb2898bc8d4a26c019df62721acfea3
- sha1sums = 14cb27e5e45dacf8e59cfb498235036716393014
- sha1sums = d67cd4d15c2f011f7b478c645db70afc5d72dc70
- sha1sums = 1adc3bb98e67336db63fd39baf4daab606870d57
- sha1sums = 22aeaf0766c4de926633f93bfa9aa2ab64bc50f3
- sha1sums = 69beb2d05cf850fcbf8a1127a450424a855ab517
- sha1sums = 64ffc9141af0e2c44d327e019c8d4d4a09585259
- sha1sums = 5a5bc8d8d317ff35b8a26e645bb78e2dbc69a16e
- sha1sums = a893c32f2a3fff8b279025ec60f0c3d88143dc1e
- sha1sums = 9270b5e33d4508a959688a10c20dec3732763937
- sha1sums = 34a33b47a8b667f9dc810737c0f598660b962d4c
- sha1sums = 4def44ef53ba3b579bed40af897d6f0c038ec78d
- sha1sums = 0022423564ed30dfe91bb3faa7f0c03ddcf4f25f
- sha1sums = fbd6ee512b6486320d41a007b9670dcf5a3430b6
+ sha1sums = 1acc26a5a5737804f5aa6cca9d4bbce733e0f429
+ sha1sums = 7556b8a8faff5b943efa5058ce9d8e325c4d35a6
+ sha1sums = d4e8f5ec1c30ebd69cce5121ea7823e1b42c3d27
+ sha1sums = 64ec144a5e6d87c231601c386bf615db8ec36f52
+ sha1sums = f8387e71a8807296fc24824eb16a3e53c7bc9f8a
+ sha1sums = 2374539e56aeed165cc15e790e17fe841fa0970d
+ sha1sums = 06dd363ba4b32811971db823ff4b1cc26f8791bc
+ sha1sums = 28b5ce40ba54198e715d79d97adaa54b67c2c7e5
+ sha1sums = e9bcb9d89b5a28bab77d0f20c9a19b5487acd89a
+ sha1sums = 0f2302c79ac2a05ea5628de0d8b36afbf43684b3
+ sha1sums = e80ee78932db189f8336d55ed27323c4b07d2652
+ sha1sums = 7e9ce9e54959a173c01920644933425ebbe1727b
+ sha1sums = e2fa9aab0925d57720fb527ad8b5aeab9da13981
+ sha1sums = 14492f053f54ef8bbcabe6bf289cade742562311
+ sha1sums = c61e7226d5ea585447ba2bdb9c61f29f177999ce
+ sha1sums = b6d54fd495d26a2c1578b77b678610393d4b1b45
sha1sums = 55170acd48805465d6b0c45b3a29eee2a2523de8
sha1sums = 4cd8012f8946761d7288a198af7edb3ebaf0ece0
sha1sums = df4dea649b6ca775dbd4fa8590fa285517710429
diff --git a/PKGBUILD b/PKGBUILD
index 4afda4650487..b770f9f636ce 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,7 +3,7 @@
# Contributor: bartus ( aur\at\bartus.33mail.com )
pkgname=makepkg-optimize-mold
-pkgver=27
+pkgver=28
pkgrel=1
pkgdesc='Supplemental build and packaging optimizations for makepkg'
arch=('any')
@@ -11,40 +11,41 @@ license=('GPL')
url='https://wiki.archlinux.org/index.php/Makepkg-optimize'
depends=('pacman')
optdepends=("upx: Compress executables"
- "optipng: Optimize PNG files"
- "svgo: Optimize SVG files"
- "openmp: Parallelize loops"
- "polly: Polyhedral model optimization for clang"
- "mold: a modern fast linker"
- "lld: the clang linker"
- "llvm-bolt: use yourself bolted toolchain for compiling"
- "aocc: use amd's llvm compiler for compiling"
- "aocl: use amd's compiler libary for compiling"
- "buildcache: a alternative to ccache")
+ "optipng: Optimize PNG files"
+ "svgo: Optimize SVG files"
+ "openmp: Parallelize loops"
+ "polly: Polyhedral model optimization for clang"
+ "mold: a modern fast linker"
+ "lld: the clang linker"
+ "llvm-bolt: use yourself bolted toolchain for compiling"
+ "aocc: use amd's llvm compiler for compiling"
+ "aocl: use amd's compiler libary for compiling"
+"buildcache: a alternative to ccache")
backup=(etc/makepkg-optimize.conf)
-_buildenv=({pgo,graphite,rice,mold,bolt,buildcache,lld,aocc,relocs}.sh.in)
+_buildenv=({pgo,graphite,rice,mold,bolt,buildcache,lld,aocc,relocs,relocsgcc}.sh.in)
_executable=({upx,optipng,svgo}-exec.sh.in)
_tidy=({upx,optipng,svgo}.sh.in)
_conf=({{c,cxx,make,ld,cmake-}flags,{buildenv,destdirs,pkgopts{,-param}}_ext,compress-param_max}.conf)
source=(${_buildenv[@]}
- ${_executable[@]}
- ${_tidy[@]}
- ${_conf[@]})
-sha1sums=('4c5f0be71638a6ec2f18c01675d99f19eb6dd45d'
- '996ed46bddb2898bc8d4a26c019df62721acfea3'
- '14cb27e5e45dacf8e59cfb498235036716393014'
- 'd67cd4d15c2f011f7b478c645db70afc5d72dc70'
- '1adc3bb98e67336db63fd39baf4daab606870d57'
- '22aeaf0766c4de926633f93bfa9aa2ab64bc50f3'
- '69beb2d05cf850fcbf8a1127a450424a855ab517'
- '64ffc9141af0e2c44d327e019c8d4d4a09585259'
- '5a5bc8d8d317ff35b8a26e645bb78e2dbc69a16e'
- 'a893c32f2a3fff8b279025ec60f0c3d88143dc1e'
- '9270b5e33d4508a959688a10c20dec3732763937'
- '34a33b47a8b667f9dc810737c0f598660b962d4c'
- '4def44ef53ba3b579bed40af897d6f0c038ec78d'
- '0022423564ed30dfe91bb3faa7f0c03ddcf4f25f'
- 'fbd6ee512b6486320d41a007b9670dcf5a3430b6'
+ ${_executable[@]}
+ ${_tidy[@]}
+${_conf[@]})
+sha1sums=('1acc26a5a5737804f5aa6cca9d4bbce733e0f429'
+ '7556b8a8faff5b943efa5058ce9d8e325c4d35a6'
+ 'd4e8f5ec1c30ebd69cce5121ea7823e1b42c3d27'
+ '64ec144a5e6d87c231601c386bf615db8ec36f52'
+ 'f8387e71a8807296fc24824eb16a3e53c7bc9f8a'
+ '2374539e56aeed165cc15e790e17fe841fa0970d'
+ '06dd363ba4b32811971db823ff4b1cc26f8791bc'
+ '28b5ce40ba54198e715d79d97adaa54b67c2c7e5'
+ 'e9bcb9d89b5a28bab77d0f20c9a19b5487acd89a'
+ '0f2302c79ac2a05ea5628de0d8b36afbf43684b3'
+ 'e80ee78932db189f8336d55ed27323c4b07d2652'
+ '7e9ce9e54959a173c01920644933425ebbe1727b'
+ 'e2fa9aab0925d57720fb527ad8b5aeab9da13981'
+ '14492f053f54ef8bbcabe6bf289cade742562311'
+ 'c61e7226d5ea585447ba2bdb9c61f29f177999ce'
+ 'b6d54fd495d26a2c1578b77b678610393d4b1b45'
'55170acd48805465d6b0c45b3a29eee2a2523de8'
'4cd8012f8946761d7288a198af7edb3ebaf0ece0'
'df4dea649b6ca775dbd4fa8590fa285517710429'
@@ -57,58 +58,58 @@ sha1sums=('4c5f0be71638a6ec2f18c01675d99f19eb6dd45d'
'8f54d9798899123aa28085ce74ae9dd34b84c075')
prepare() {
- # Use the current makepkg config as a base
- cp /etc/makepkg.conf ./makepkg-optimize.conf
+ # Use the current makepkg config as a base
+ cp /etc/makepkg.conf ./makepkg-optimize.conf
- # How to check for the unlikely possiblity that the directory was changed?
- sed -i "s|@libmakepkgdir@|/usr/share/makepkg|g" *.sh.in
- for file in *.sh.in; do mv $file ${file%.in}; done
+ # How to check for the unlikely possiblity that the directory was changed?
+ sed -i "s|@libmakepkgdir@|/usr/share/makepkg|g" *.sh.in
+ for file in *.sh.in; do mv $file ${file%.in}; done
- #Extra ricer and debugging CFLAGS
- sed -i "/^CFLAGS/r cflags.conf" makepkg-optimize.conf
+ #Extra ricer and debugging CFLAGS
+ sed -i "/^CFLAGS/r cflags.conf" makepkg-optimize.conf
- #Mirror CFLAGS into CXXFLAGS
- sed -i "/^CXXFLAGS/r cxxflags.conf" makepkg-optimize.conf
+ #Mirror CFLAGS into CXXFLAGS
+ sed -i "/^CXXFLAGS/r cxxflags.conf" makepkg-optimize.conf
- #Extra ricer Makeflags
- sed -i "/^MAKEFLAGS/r makeflags.conf" makepkg-optimize.conf
+ #Extra ricer Makeflags
+ sed -i "/^MAKEFLAGS/r makeflags.conf" makepkg-optimize.conf
- #Extra ricer LDFLAGS
- sed -i "/^LDFLAGS/r ldflags.conf" makepkg-optimize.conf
+ #Extra ricer LDFLAGS
+ sed -i "/^LDFLAGS/r ldflags.conf" makepkg-optimize.conf
- #Debugging flags for make (note, DEBUG_MAKEFLAGS isn't a real thing)
- sed -i "/^DEBUG_CXXFLAGS/r debug-makeflags.conf" makepkg-optimize.conf
+ #Debugging flags for make (note, DEBUG_MAKEFLAGS isn't a real thing)
+ sed -i "/^DEBUG_CXXFLAGS/r debug-makeflags.conf" makepkg-optimize.conf
- #Cmake is a build obfuscation system
- sed -i "/^#DEBUG_MAKEFLAGS/r cmake-flags.conf" makepkg-optimize.conf
+ #Cmake is a build obfuscation system
+ sed -i "/^#DEBUG_MAKEFLAGS/r cmake-flags.conf" makepkg-optimize.conf
- #Additional BUIDENV macros
- sed -i "/^#-- sign/r buildenv_ext.conf" makepkg-optimize.conf
+ #Additional BUIDENV macros
+ sed -i "/^#-- sign/r buildenv_ext.conf" makepkg-optimize.conf
- #Additional DEST directories
- sed -i "/^#*SRCPKGDEST=/r destdirs_ext.conf" makepkg-optimize.conf
+ #Additional DEST directories
+ sed -i "/^#*SRCPKGDEST=/r destdirs_ext.conf" makepkg-optimize.conf
- #Additional OPTIONS macros
- sed -i "/^#-- debug/r pkgopts_ext.conf" makepkg-optimize.conf
+ #Additional OPTIONS macros
+ sed -i "/^#-- debug/r pkgopts_ext.conf" makepkg-optimize.conf
- #Additional OPTIONS parameters
- sed -i "/^#*PURGE_TARGETS=/r pkgopts-param_ext.conf" makepkg-optimize.conf
+ #Additional OPTIONS parameters
+ sed -i "/^#*PURGE_TARGETS=/r pkgopts-param_ext.conf" makepkg-optimize.conf
- #Maximum COMPRESS parameters
- sed -i "/^COMPRESSLZ=/r compress-param_max.conf" makepkg-optimize.conf
+ #Maximum COMPRESS parameters
+ sed -i "/^COMPRESSLZ=/r compress-param_max.conf" makepkg-optimize.conf
}
package() {
- # BUILDENV extension scripts
- install -m644 -D -t ${pkgdir}/usr/share/makepkg/buildenv/ ${_buildenv[@]%.in}
+ # BUILDENV extension scripts
+ install -m644 -D -t ${pkgdir}/usr/share/makepkg/buildenv/ ${_buildenv[@]%.in}
- # Executable finding scripts
- for i in ${_executable[@]%.in}; do
- install -m644 -D -T ${i} ${pkgdir}/usr/share/makepkg/executable/${i//-exec.sh/.sh}; done
+ # Executable finding scripts
+ for i in ${_executable[@]%.in}; do
+ install -m644 -D -T ${i} ${pkgdir}/usr/share/makepkg/executable/${i//-exec.sh/.sh}; done
- # Supplemental Tidy scripts
- install -m644 -D -t ${pkgdir}/usr/share/makepkg/tidy/ ${_tidy[@]%.in}
+ # Supplemental Tidy scripts
+ install -m644 -D -t ${pkgdir}/usr/share/makepkg/tidy/ ${_tidy[@]%.in}
- # Separate config file
- install -m644 -D -t ${pkgdir}/etc/ makepkg-optimize.conf
+ # Separate config file
+ install -m644 -D -t ${pkgdir}/etc/ makepkg-optimize.conf
}
diff --git a/README.md b/README.md
index b256d96c2996..32ff1864459f 100644
--- a/README.md
+++ b/README.md
@@ -50,3 +50,25 @@ Tip: Use fstab to bind these folders at boot.
You can use buildcache if you replace in /usr/share/makepkg/buildenv/compiler.sh with the compiler.sh.in in the repo.
Then you need to exec the buildcache.sh for setting the symlinks.
+
+## Using custom llvm toolchain
+
+Just place your toolchain into ~/Documents/llvm , that it looks then like this:
+```
+ls ~/Documents/llvm
+drwxr-xr-x - ptr1337 23 Jun 13:25  bin
+drwxr-xr-x - ptr1337 23 Jun 13:25  include
+drwxr-xr-x - ptr1337 23 Jun 13:25  lib
+drwxr-xr-x - ptr1337 23 Jun 13:25  share
+```
+After that enable as buildoption options=(bolt) and it will use the toolchain
+
+## Building packages with relocations for the ability to bolt them
+
+If compiling with clang, simply add as buildoption 'relocs' and it will add 'LDFLAGS+="--emit-relocs"'
+If compiling with gcc your target package, add as options 'relocsgcc' these will add -fno-reorder-functions since gcc enables these as default which results into a not bolt able binary
+
+## Using a different linker (lld/mold)
+
+Simply add as option 'lld' or 'mold' and it will add the regarding -fuse-ld='linker'. OM
+
diff --git a/ZZ-lto.sh.in b/ZZ-lto.sh.in
index 6d0972cd9d39..58452c6419de 100644
--- a/ZZ-lto.sh.in
+++ b/ZZ-lto.sh.in
@@ -14,21 +14,21 @@ build_options+=('lto' 'lto-thin' 'lto-clang' 'lto-thin-clang')
buildenv_functions+=('buildenv_lto')
buildenv_lto() {
- if check_buildoption "lto" "y" || check_buildoption "lto-thin" "y" || \
- check_buildoption "lto-clang" "y" || check_buildoption "lto-thin-clang" "y"; then
- ltoflags=" -flto"
- check_buildoption "lto-thin-clang" "y" && ltoflags+="=thin"
- check_buildoption "lto-thin" "y" || check_buildoption "lto" "y" && \
- [[ -f "$(gcc -print-search-dirs | grep install | awk '{print $2 "liblto_plugin.so"}')" ]] && \
- ltoflags+="=auto -fno-fat-lto-objects"
- check_buildoption "lto" "y" && ltoflags+=" -flto-partition=none"
+ if check_buildoption "lto" "y" || check_buildoption "lto-thin" "y" || \
+ check_buildoption "lto-clang" "y" || check_buildoption "lto-thin-clang" "y"; then
+ ltoflags=" -flto"
+ check_buildoption "lto-thin-clang" "y" && ltoflags+="=thin"
+ check_buildoption "lto-thin" "y" || check_buildoption "lto" "y" && \
+ [[ -f "$(gcc -print-search-dirs | grep install | awk '{print $2 "liblto_plugin.so"}')" ]] && \
+ ltoflags+="=auto -fno-fat-lto-objects"
+ check_buildoption "lto" "y" && ltoflags+=" -flto-partition=none"
- 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
+ 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
}
diff --git a/aocc.sh.in b/aocc.sh.in
index e2917110d71a..7c446830bd05 100644
--- a/aocc.sh.in
+++ b/aocc.sh.in
@@ -14,11 +14,11 @@ build_options+=('aocc')
buildenv_functions+=('buildenv_aocc')
buildenv_aocc() {
- if
- check_buildoption "aocc" "y"; then
- source /opt/aocc/setenv_AOCC.sh
- export CC=clang
- export CXX=clang++
- export LD=lld
- fi
+ if
+ check_buildoption "aocc" "y"; then
+ source /opt/aocc/setenv_AOCC.sh
+ export CC=clang
+ export CXX=clang++
+ export LD=lld
+ fi
}
diff --git a/bolt.sh.in b/bolt.sh.in
index 8337afd473ea..dad8cc1ce68b 100644
--- a/bolt.sh.in
+++ b/bolt.sh.in
@@ -14,8 +14,8 @@ build_options+=('bolt')
buildenv_functions+=('buildenv_bolt')
buildenv_bolt() {
- if
- check_buildoption "bolt" "y"; then
- export PATH="/home/ptr1337/Documents/llvm/bin:$PATH"
- fi
+ if
+ check_buildoption "bolt" "y"; then
+ export PATH="~/toolchain/llvm-bolt/bin:$PATH"
+ fi
}
diff --git a/buildcache.sh.in b/buildcache.sh.in
index 1e70da56e1b0..1040557aa8a7 100644
--- a/buildcache.sh.in
+++ b/buildcache.sh.in
@@ -11,10 +11,10 @@ source "$LIBRARY/util/option.sh"
executable_functions+=('executable_buildcache')
executable_buildcache() {
- if check_buildoption "buildcache" "y"; then
- if ! type -p buildcache >/dev/null; then
- error "$(gettext "Cannot find the %s binary required for compiler cache usage.")" "buildcache"
- return 1
- fi
- fi
+ if check_buildoption "buildcache" "y"; then
+ if ! type -p buildcache >/dev/null; then
+ error "$(gettext "Cannot find the %s binary required for compiler cache usage.")" "buildcache"
+ return 1
+ fi
+ fi
}
diff --git a/compiler.sh.in b/compiler.sh.in
index 017a69000d9f..fd630a90c58c 100644
--- a/compiler.sh.in
+++ b/compiler.sh.in
@@ -33,34 +33,34 @@ buildenv_functions+=('buildenv_ccache' 'buildenv_distcc' 'buildenv_buildcache')
using_ccache=0
buildenv_ccache() {
- if check_buildoption "ccache" "y"; then
- if [ -d /usr/lib/ccache/bin ]; then
- export PATH="/usr/lib/ccache/bin:$PATH"
- using_ccache=1
- fi
- fi
+ if check_buildoption "ccache" "y"; then
+ if [ -d /usr/lib/ccache/bin ]; then
+ export PATH="/usr/lib/ccache/bin:$PATH"
+ using_ccache=1
+ fi
+ fi
}
buildenv_distcc() {
- if check_buildoption "distcc" "y"; then
- if (( using_ccache )); then
- if [[ " $CCACHE_PREFIX " != *" distcc "* ]]; then
- export CCACHE_PREFIX="${CCACHE_PREFIX:+$CCACHE_PREFIX }distcc"
- fi
- export CCACHE_BASEDIR="$srcdir"
- elif [[ -d /usr/lib/distcc/bin ]]; then
- export PATH="/usr/lib/distcc/bin:$PATH"
- fi
+ if check_buildoption "distcc" "y"; then
+ if (( using_ccache )); then
+ if [[ " $CCACHE_PREFIX " != *" distcc "* ]]; then
+ export CCACHE_PREFIX="${CCACHE_PREFIX:+$CCACHE_PREFIX }distcc"
+ fi
+ export CCACHE_BASEDIR="$srcdir"
+ elif [[ -d /usr/lib/distcc/bin ]]; then
+ export PATH="/usr/lib/distcc/bin:$PATH"
+ fi
- export DISTCC_HOSTS
- fi
+ export DISTCC_HOSTS
+ fi
}
buildenv_buildcache() {
- if check_buildoption "buildcache" "y"; then
- if [ -d /usr/lib/buildcache/bin ]; then
- export PATH="/usr/lib/buildcache/bin:$PATH"
- using_buildcache=1
- fi
- fi
+ if check_buildoption "buildcache" "y"; then
+ if [ -d /usr/lib/buildcache/bin ]; then
+ export PATH="/usr/lib/buildcache/bin:$PATH"
+ using_buildcache=1
+ fi
+ fi
}
diff --git a/graphite.sh.in b/graphite.sh.in
index 2e288e748921..b4e333615300 100644
--- a/graphite.sh.in
+++ b/graphite.sh.in
@@ -14,14 +14,14 @@ build_options+=('graphite' 'polly')
buildenv_functions+=('buildenv_graphite')
buildenv_graphite() {
- if check_buildoption "graphite" "y" || check_buildoption "polly" "y"; then
- graphiteflags=" -lgomp -mllvm -polly -mllvm -polly-num-threads=$(getconf _NPROCESSORS_ONLN) -mllvm -polly-parallel"
- check_buildoption "polly" "y" && \
- graphiteflags+=" -Xclang -load -Xclang LLVMPolly.so"
- check_buildoption "graphite" "y" && \
- graphiteflags=" -fgraphite-identity -floop-interchange -floop-nest-optimize -floop-parallelize-all -ftree-loop-distribution -ftree-parallelize-loops=$(getconf _NPROCESSORS_ONLN) -ftree-vectorize"
+ if check_buildoption "graphite" "y" || check_buildoption "polly" "y"; then
+ graphiteflags=" -lgomp -mllvm -polly -mllvm -polly-num-threads=$(getconf _NPROCESSORS_ONLN) -mllvm -polly-parallel"
+ check_buildoption "polly" "y" && \
+ graphiteflags+=" -Xclang -load -Xclang LLVMPolly.so"
+ check_buildoption "graphite" "y" && \
+ graphiteflags=" -fgraphite-identity -floop-interchange -floop-nest-optimize -floop-parallelize-all -ftree-loop-distribution -ftree-parallelize-loops=$(getconf _NPROCESSORS_ONLN) -ftree-vectorize"
- CFLAGS+="$graphiteflags"
- CXXFLAGS+="$graphiteflags"
- fi
+ CFLAGS+="$graphiteflags"
+ CXXFLAGS+="$graphiteflags"
+ fi
}
diff --git a/lld.sh.in b/lld.sh.in
index c7dc3868319e..1912ecec22ff 100644
--- a/lld.sh.in
+++ b/lld.sh.in
@@ -14,8 +14,8 @@ build_options+=('lld')
buildenv_functions+=('buildenv_lld')
buildenv_lld() {
- if
- check_buildoption "lld" "y"; then
- export LDFLAGS="${LDFLAGS} -fuse-ld=lld"
- fi
+ if
+ check_buildoption "lld" "y"; then
+ LDFLAGS+="${LDFLAGS} -fuse-ld=lld"
+ fi
}
diff --git a/mold.sh.in b/mold.sh.in
index f4a0ef99c9f4..49ded956bceb 100644
--- a/mold.sh.in
+++ b/mold.sh.in
@@ -14,8 +14,8 @@ build_options+=('mold')
buildenv_functions+=('buildenv_mold')
buildenv_mold() {
- if
- check_buildoption "mold" "y"; then
- LDFLAGS="${LDFLAGS} -fuse-ld=mold"
- fi
+ if
+ check_buildoption "mold" "y"; then
+ LDFLAGS+="${LDFLAGS} -fuse-ld=mold"
+ fi
}
diff --git a/optipng-exec.sh.in b/optipng-exec.sh.in
index 3c56d3eed5a4..ccc47db4dacc 100644
--- a/optipng-exec.sh.in
+++ b/optipng-exec.sh.in
@@ -13,10 +13,10 @@ source "$LIBRARY/util/option.sh"
executable_functions+=('executable_optipng')
executable_optipng() {
- if check_option "optipng" "y"; then
- if ! type -p optipng >/dev/null; then
- error "$(gettext "Cannot find the %s binary required for optimizing PNG image files.")" "optipng"
- ret=1
+ if check_option "optipng" "y"; then
+ if ! type -p optipng >/dev/null; then
+ error "$(gettext "Cannot find the %s binary required for optimizing PNG image files.")" "optipng"
+ ret=1
+ fi
fi
- fi
}
diff --git a/optipng.sh.in b/optipng.sh.in
index d82008556b54..583807954263 100644
--- a/optipng.sh.in
+++ b/optipng.sh.in
@@ -15,16 +15,16 @@ packaging_options+=('optipng')
tidy_modify+=('tidy_optipng')
tidy_optipng() {
- if check_option "optipng" "y"; then
- msg2 "$(gettext "Optimizing PNG images...")"
- local png
- find . -type f -iname "*.png" 2>/dev/null | while read -r png ; do
- [ $(jobs -p|wc -l) -gt $(getconf _NPROCESSORS_ONLN) ] && wait -n
- if [[ $(file --brief --mime-type "$png") = 'image/png' ]]; then
- { optipng "${OPTIPNGFLAGS[@]}" "$png" &>/dev/null ||
- warning "$(gettext "Could not optimize PNG image : %s")" "${png/$pkgdir\//}"; } &
- fi
- done
- wait
- fi
+ if check_option "optipng" "y"; then
+ msg2 "$(gettext "Optimizing PNG images...")"
+ local png
+ find . -type f -iname "*.png" 2>/dev/null | while read -r png ; do
+ [ $(jobs -p|wc -l) -gt $(getconf _NPROCESSORS_ONLN) ] && wait -n
+ if [[ $(file --brief --mime-type "$png") = 'image/png' ]]; then
+ { optipng "${OPTIPNGFLAGS[@]}" "$png" &>/dev/null ||
+ warning "$(gettext "Could not optimize PNG image : %s")" "${png/$pkgdir\//}"; } &
+ fi
+ done
+ wait
+ fi
}
diff --git a/pgo.sh.in b/pgo.sh.in
index f2686c89fc53..27a91835b35c 100644
--- a/pgo.sh.in
+++ b/pgo.sh.in
@@ -15,34 +15,34 @@ 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
- pgoflags=" -fprofile-generate -fprofile-dir=$PROFDEST/$pkgbase.gen"
- pgoldflags=" -lgcov --coverage"
- msg2 "Profile data will be generated."
- else
- [[ -d $PROFDEST/$pkgbase.used ]] && rm -rf $PROFDEST/$pkgbase.used
- mv $PROFDEST/$pkgbase.{gen,used}
- pgoflags=" -fprofile-correction -fprofile-use -fprofile-dir=$PROFDEST/$pkgbase.used"
- pgoldflags=" -lgcov"
- msg2 "Profile data will be applied."
- fi
-
- CFLAGS+="$pgoflags"
- CXXFLAGS+="$pgoflags"
- LDFLAGS+="$pgoldflags"
-
- 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"
+ msg2 "Profile data will be generated."
+ else
+ [[ -d $PROFDEST/$pkgbase.used ]] && rm -rf $PROFDEST/$pkgbase.used
+ mv $PROFDEST/$pkgbase.{gen,used}
+ pgoflags=" -fprofile-correction -fprofile-use -fprofile-dir=$PROFDEST/$pkgbase.used"
+ pgoldflags=" -lgcov"
+ msg2 "Profile data will be applied."
+ fi
+
+ CFLAGS+="$pgoflags"
+ CXXFLAGS+="$pgoflags"
+ LDFLAGS+="$pgoldflags"
+
+ fi
+ }
diff --git a/relocs.sh.in b/relocs.sh.in
index 1295992d92a1..97a3e6d65ca1 100644
--- a/relocs.sh.in
+++ b/relocs.sh.in
@@ -10,15 +10,14 @@ LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
source "$LIBRARY/util/option.sh"
-build_options+=('relocs' 'relocs-gcc')
+build_options+=('relocs')
buildenv_functions+=('buildenv_relocs')
buildenv_relocs() {
- if check_buildoption "relocs" "y" || check_buildoption "relocs-gcc" "y"; then
- CFLAGS+=" -fno-reorder-blocks-and-partition"
- CXXFLAGS+=" -fno-reorder-blocks-and-partition"
- LDFLAGS+=" -Wl,--emit-relocs"
- check_buildoption "relocs" "y" && \
- LDFLAGS+=" -Wl,--emit-relocs"
- fi
+ if check_buildoption "relocs" "y";then
+
+ relocsldflags=" -Wl,--emit-relocs"
+ LDFLAGS+="$relocsldflags"
+ fi
}
+
diff --git a/relocsgcc.sh.in b/relocsgcc.sh.in
new file mode 100644
index 000000000000..32a6f2fb299e
--- /dev/null
+++ b/relocsgcc.sh.in
@@ -0,0 +1,25 @@
+#!/usr/bin/bash
+#
+# Enable relocations at the linker for give llvm-bolt the possibility to reorder functions
+#
+
+[[ -n "$LIBMAKEPKG_BUILDENV_RELOCSGCC_SH" ]] && return
+LIBMAKEPKG_BUILDENV_RELOCSGCC_SH=1
+
+LIBRARY=${LIBRARY:-'/usr/share/makepkg'}
+
+source "$LIBRARY/util/option.sh"
+
+build_options+=('relocsgcc')
+buildenv_functions+=('buildenv_relocsgcc')
+
+buildenv_relocsgcc() {
+ if check_buildoption "relocsgcc" "y";then
+ relocsldflags=" -Wl,--emit-relocs"
+ relocsflags=" -fno-reorder-blocks-and-partition"
+
+ CFLAGS+="$relocsflags"
+ CXXFLAGS+="$relocsflags"
+ LDFLAGS+="$relocsldflags"
+ fi
+}
diff --git a/rice.sh.in b/rice.sh.in
index 5946791b1394..b1923807decc 100644
--- a/rice.sh.in
+++ b/rice.sh.in
@@ -14,14 +14,14 @@ build_options+=('rice' 'rice-clang')
buildenv_functions+=('buildenv_rice')
buildenv_rice() {
- if check_buildoption "rice" "y" || check_buildoption "rice-clang" "y"; then
- riceflags=" -Ofast -fdata-sections -ffloat-store -fgcse-las -fgcse-sm -fmodulo-sched -fmodulo-sched-allow-regmoves -funsafe-math-optimizations -fno-threadsafe-statics -fomit-frame-pointer -fopenmp -fPIC -fshort-wchar -fvariable-expansion-in-unroller -Wno-sizeof-pointer-memaccess -pthread" #
- check_buildoption "rice" "y" && \
- riceflags+=" -fbranch-target-load-optimize2 -fcx-fortran-rules -fipa-pta -fno-enforce-eh-specs -fnothrow-opt -fno-var-tracking-assignments -freg-struct-return -freschedule-modulo-scheduled-loops -fsched-pressure -fsched-spec-load -fsched-spec-load-dangerous -fsched-stalled-insns=0 -fsched2-use-superblocks -fselective-scheduling -fselective-scheduling2 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops -ftree-lrs -maccumulate-outgoing-args" # -fmerge-all-constants
+ if check_buildoption "rice" "y" || check_buildoption "rice-clang" "y"; then
+ riceflags=" -Ofast -fdata-sections -ffloat-store -fgcse-las -fgcse-sm -fmodulo-sched -fmodulo-sched-allow-regmoves -funsafe-math-optimizations -fno-threadsafe-statics -fomit-frame-pointer -fopenmp -fPIC -fshort-wchar -fvariable-expansion-in-unroller -Wno-sizeof-pointer-memaccess -pthread" #
+ check_buildoption "rice" "y" && \
+ riceflags+=" -fbranch-target-load-optimize2 -fcx-fortran-rules -fipa-pta -fno-enforce-eh-specs -fnothrow-opt -fno-var-tracking-assignments -freg-struct-return -freschedule-modulo-scheduled-loops -fsched-pressure -fsched-spec-load -fsched-spec-load-dangerous -fsched-stalled-insns=0 -fsched2-use-superblocks -fselective-scheduling -fselective-scheduling2 -fsel-sched-pipelining -fsel-sched-pipelining-outer-loops -ftree-lrs -maccumulate-outgoing-args" # -fmerge-all-constants
- riceldflags=" -lpthread -lgomp" # -shared
- CFLAGS+="$riceflags"
- CXXFLAGS+="$riceflags"
- LDFLAGS+="$riceldflags"
- fi
+ riceldflags=" -lpthread -lgomp" # -shared
+ CFLAGS+="$riceflags"
+ CXXFLAGS+="$riceflags"
+ LDFLAGS+="$riceldflags"
+ fi
}
diff --git a/svgo-exec.sh.in b/svgo-exec.sh.in
index b4a7e4ed8b8a..98b8977864c8 100644
--- a/svgo-exec.sh.in
+++ b/svgo-exec.sh.in
@@ -13,10 +13,10 @@ source "$LIBRARY/util/option.sh"
executable_functions+=('executable_svgo')
executable_svgo() {
- if check_option "svgo" "y"; then
- if ! type -p svgo >/dev/null; then
- error "$(gettext "Cannot find the %s binary required for optimizing SVG image files.")" "svgo"
- ret=1
+ if check_option "svgo" "y"; then
+ if ! type -p svgo >/dev/null; then
+ error "$(gettext "Cannot find the %s binary required for optimizing SVG image files.")" "svgo"
+ ret=1
+ fi
fi
- fi
}
diff --git a/svgo.sh.in b/svgo.sh.in
index 9b306236ba1a..853f3d8b8b43 100644
--- a/svgo.sh.in
+++ b/svgo.sh.in
@@ -15,16 +15,16 @@ packaging_options+=('svgo')
tidy_modify+=('tidy_svgo')
tidy_svgo() {
- if check_option "svgo" "y"; then
- msg2 "$(gettext "Optimizing SVG images...")"
- local svg
- find . -type f -iname "*.svg" 2>/dev/null | while read -r svg ; do
- [ $(jobs -p|wc -l) -gt $(getconf _NPROCESSORS_ONLN) ] && wait -n
- if [[ $(file --brief --mime-type "$svg") = 'image/svg' ]]; then
- { svgo "${SVGOFLAGS[@]}" "$svg" &>/dev/null ||
- warning "$(gettext "Could not optimize SVG image : %s")" "${svg/$pkgdir\//}"; } &
- fi
- done
- wait
- fi
+ if check_option "svgo" "y"; then
+ msg2 "$(gettext "Optimizing SVG images...")"
+ local svg
+ find . -type f -iname "*.svg" 2>/dev/null | while read -r svg ; do
+ [ $(jobs -p|wc -l) -gt $(getconf _NPROCESSORS_ONLN) ] && wait -n
+ if [[ $(file --brief --mime-type "$svg") = 'image/svg' ]]; then
+ { svgo "${SVGOFLAGS[@]}" "$svg" &>/dev/null ||
+ warning "$(gettext "Could not optimize SVG image : %s")" "${svg/$pkgdir\//}"; } &
+ fi
+ done
+ wait
+ fi
}
diff --git a/upx-exec.sh.in b/upx-exec.sh.in
index ce2ecf56d25e..119e55b5c4a2 100644
--- a/upx-exec.sh.in
+++ b/upx-exec.sh.in
@@ -13,10 +13,10 @@ source "$LIBRARY/util/option.sh"
executable_functions+=('executable_upx')
executable_upx() {
- if check_option "upx" "y"; then
- if ! type -p upx >/dev/null; then
- error "$(gettext "Cannot find the %s binary required for compressing binaries.")" "upx"
- ret=1
+ if check_option "upx" "y"; then
+ if ! type -p upx >/dev/null; then
+ error "$(gettext "Cannot find the %s binary required for compressing binaries.")" "upx"
+ ret=1
+ fi
fi
- fi
}
diff --git a/upx.sh.in b/upx.sh.in
index cbe3c8e6dd65..f749d1707dea 100644
--- a/upx.sh.in
+++ b/upx.sh.in
@@ -15,24 +15,24 @@ packaging_options+=('upx')
tidy_modify+=('tidy_upx')
tidy_upx() {
- if check_option "upx" "y"; then
- msg2 "$(gettext "Compressing binaries with %s...")" "UPX"
- local binary
- find . -type f -perm -u+w 2>/dev/null | while read -r binary ; do
- [ $(jobs -p|wc -l) -gt $(getconf _NPROCESSORS_ONLN) ] && wait -n
- case "$(file -S --brief --mime-type "$binary")" in
- application/x-executable | application/x-dosexec | \
- application/x-pie-executable | application/x-sharedlib )
- { upx "${UPXFLAGS[@]}" "$binary" &>/dev/null &&
- info "$(gettext "Compressed binary : %s")" "${binary/$pkgdir\//}" ||
- warning "$(gettext "Could not compress binary : %s")" "${binary/$pkgdir\//}"; } &
- ;;
- #application* )
- # warning "$(gettext "Not compressing %s, $(file --brief --mime-type "$binary")")" \
- # "${binary/$pkgdir\//}"
- # ;;
- esac
- done
- wait
- fi
+ if check_option "upx" "y"; then
+ msg2 "$(gettext "Compressing binaries with %s...")" "UPX"
+ local binary
+ find . -type f -perm -u+w 2>/dev/null | while read -r binary ; do
+ [ $(jobs -p|wc -l) -gt $(getconf _NPROCESSORS_ONLN) ] && wait -n
+ case "$(file -S --brief --mime-type "$binary")" in
+ application/x-executable | application/x-dosexec | \
+ application/x-pie-executable | application/x-sharedlib )
+ { upx "${UPXFLAGS[@]}" "$binary" &>/dev/null &&
+ info "$(gettext "Compressed binary : %s")" "${binary/$pkgdir\//}" ||
+ warning "$(gettext "Could not compress binary : %s")" "${binary/$pkgdir\//}"; } &
+ ;;
+ #application* )
+ # warning "$(gettext "Not compressing %s, $(file --brief --mime-type "$binary")")" \
+ # "${binary/$pkgdir\//}"
+ # ;;
+ esac
+ done
+ wait
+ fi
}