-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrpmbuild.sh
executable file
·77 lines (67 loc) · 1.17 KB
/
rpmbuild.sh
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
#!/bin/bash
set -e
# Use half of CPU cores
np=$(( $(nproc) / 2 ))
pie=
without_capstone=
without_libunwind=
nodebuginfo=
__usage__() {
echo -e "
--pie [ON|OFF]
--without-capstone build without capstone
--without-libunwind build without libunwind
--nodebuginfo skip debuginfo and debugsource packages
-h, --help print this info
"
exit ${1-0}
}
TEMP=$( getopt --options h \
--long help \
--long pie: \
--long without-capstone \
--long without-libunwind \
--long nodebuginfo \
--name rpmbuild-ulpatch -- "$@" )
test $? != 0 && __usage__ 1
eval set -- "${TEMP}"
while true ; do
case $1 in
-h | --help)
shift
__usage__
;;
--pie)
shift
pie=$1
shift
;;
--without-capstone)
shift
without_capstone=YES
;;
--without-libunwind)
shift
without_libunwind=YES
;;
--nodebuginfo)
shift
nodebuginfo=YES
;;
--)
shift
break
;;
esac
done
PIE=
[[ ${pie} == ON ]] && PIE=ON
rpmbuild -ba \
--define "_topdir $PWD" \
--define "_sourcedir $PWD" \
--define "_smp_mflags -j${np}" \
${without_capstone:+--without capstone} \
${without_libunwind:+--without libunwind} \
${nodebuginfo:+--nodebuginfo} \
${PIE:+--define "pie 1"} \
ulpatch.spec