1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
# Maintainer: Que Quotion ( quequotion@bugmenot.com )
pkgname=makepkg-optimize
pkgver=21
pkgrel=1
pkgdesc='Supplemental build and packaging optimizations for makepkg'
arch=('any')
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")
backup=(etc/makepkg-optimize.conf)
_buildenv=({pgo,graphite,rice}.sh.in)
_executable=({upx,optipng,svgo}-exec.sh.in)
_tidy=({upx,optipng,svgo}.sh.in)
_conf=({{c,cxx,make,ld,debug-make,cmake-}flags,{buildenv,destdirs,pkgopts{,-param}}_ext,compress-param_max}.conf)
source=(${_buildenv[@]}
${_executable[@]}
${_tidy[@]}
${_conf[@]})
sha1sums=('4c5f0be71638a6ec2f18c01675d99f19eb6dd45d'
'81547a110d9e28897e41f2f8accabb7721dbcc19'
'14cb27e5e45dacf8e59cfb498235036716393014'
'a893c32f2a3fff8b279025ec60f0c3d88143dc1e'
'9270b5e33d4508a959688a10c20dec3732763937'
'34a33b47a8b667f9dc810737c0f598660b962d4c'
'cf79c015d16f839ef8014cc45944613972552dc9'
'0022423564ed30dfe91bb3faa7f0c03ddcf4f25f'
'fbd6ee512b6486320d41a007b9670dcf5a3430b6'
'4d11331aeff1c1ec3de3759710acc060769ef274'
'83a6d62b19184cac1de02c957cd4ea7bbdac9ddb'
'dea4d727d81ac040846555e59ac7c34eb0978233'
'eef21d80145bf64133206beba26fd7fab5a8f5bc'
'2e2cd8c680a86518652543fda9092bf2ab594660'
'981eab856abb43c5e093620cdf4d8bfa2d690805'
'bce04a9513419bc70ae9b61bb70aa40528334eca'
'efb3ed7d7d5516259709149d7bcd6ec208c07593'
'1fc8035e64b739e20c70fbb4eaa5cb7aa1c63c90'
'5d0cde13b50641371e4ec4d813d6b2dfae493889'
'5be1195c15c33c477910bca83b29ade3b10a2b10')
prepare() {
# 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
#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
#Extra ricer Makeflags
sed -i "/^MAKEFLAGS/r makeflags.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
#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 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 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
}
package() {
# 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
# 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
}
|