• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2
3set -x
4set -e
5
6TMP=$(mktemp -d /tmp/rpmbuild.XXXXXX)
7
8function cleanup() {
9  [[ -d $TMP ]] && rm -rf $TMP
10}
11trap cleanup EXIT
12
13mkdir $TMP/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
14
15llvmver=7.0.1
16
17# populate submodules
18git submodule update --init --recursive
19
20. scripts/git-tag.sh
21
22git archive HEAD --prefix=bcc/ --format=tar -o $TMP/SOURCES/bcc.tar
23
24# archive submodules
25pushd src/cc/libbpf
26git archive HEAD --prefix=bcc/src/cc/libbpf/ --format=tar -o $TMP/SOURCES/bcc_libbpf.tar
27popd
28
29# merge all archives into $git_tag_latest.tar.gz
30pushd $TMP/SOURCES
31tar -A -f bcc.tar bcc_libbpf.tar
32gzip -c bcc.tar > $git_tag_latest.tar.gz
33popd
34
35wget -P $TMP/SOURCES http://llvm.org/releases/$llvmver/{cfe,llvm}-$llvmver.src.tar.xz
36
37sed \
38  -e "s/^\(Version:\s*\)@REVISION@/\1$revision/" \
39  -e "s/^\(Release:\s*\)@GIT_REV_COUNT@/\1$release/" \
40  SPECS/bcc+clang.spec > $TMP/SPECS/bcc.spec
41
42pushd $TMP
43rpmbuild --define "_topdir `pwd`" -ba SPECS/bcc.spec
44popd
45
46cp $TMP/RPMS/*/*.rpm .
47cp $TMP/SRPMS/*.rpm .
48