forked from iovisor/bcc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-release-rpm.sh
executable file
·47 lines (33 loc) · 998 Bytes
/
build-release-rpm.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
#!/bin/bash
set -x
set -e
TMP=$(mktemp -d /tmp/rpmbuild.XXXXXX)
function cleanup() {
[[ -d $TMP ]] && rm -rf $TMP
}
trap cleanup EXIT
mkdir $TMP/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
llvmver=3.7.1
# populate submodules
git submodule update --init --recursive
. scripts/git-tag.sh
git archive HEAD --prefix=bcc/ --format=tar -o $TMP/SOURCES/bcc.tar
# archive submodules
pushd src/cc/libbpf
git archive HEAD --prefix=bcc/src/cc/libbpf/ --format=tar -o $TMP/SOURCES/bcc_libbpf.tar
popd
# merge all archives into $git_tag_latest.tar.gz
pushd $TMP/SOURCES
tar -A -f bcc.tar bcc_libbpf.tar
gzip -c bcc.tar > $git_tag_latest.tar.gz
popd
wget -P $TMP/SOURCES https://llvm.org/releases/$llvmver/{cfe,llvm}-$llvmver.src.tar.xz
sed \
-e "s/^\(Version:\s*\)@REVISION@/\1$revision/" \
-e "s/^\(Release:\s*\)@GIT_REV_COUNT@/\1$release/" \
SPECS/bcc+clang.spec > $TMP/SPECS/bcc.spec
pushd $TMP
rpmbuild --define "_topdir `pwd`" -ba SPECS/bcc.spec
popd
cp $TMP/RPMS/*/*.rpm .
cp $TMP/SRPMS/*.rpm .