1*387f9dfdSAndroid Build Coastguard Worker#!/bin/bash 2*387f9dfdSAndroid Build Coastguard Worker 3*387f9dfdSAndroid Build Coastguard Workerset -x 4*387f9dfdSAndroid Build Coastguard Workerset -e 5*387f9dfdSAndroid Build Coastguard Worker 6*387f9dfdSAndroid Build Coastguard WorkerTMP=$(mktemp -d /tmp/rpmbuild.XXXXXX) 7*387f9dfdSAndroid Build Coastguard Worker 8*387f9dfdSAndroid Build Coastguard Workerfunction cleanup() { 9*387f9dfdSAndroid Build Coastguard Worker [[ -d $TMP ]] && rm -rf $TMP 10*387f9dfdSAndroid Build Coastguard Worker} 11*387f9dfdSAndroid Build Coastguard Workertrap cleanup EXIT 12*387f9dfdSAndroid Build Coastguard Worker 13*387f9dfdSAndroid Build Coastguard Workermkdir $TMP/{BUILD,RPMS,SOURCES,SPECS,SRPMS} 14*387f9dfdSAndroid Build Coastguard Worker 15*387f9dfdSAndroid Build Coastguard Workerllvmver=7.0.1 16*387f9dfdSAndroid Build Coastguard Worker 17*387f9dfdSAndroid Build Coastguard Worker# populate submodules 18*387f9dfdSAndroid Build Coastguard Workergit submodule update --init --recursive 19*387f9dfdSAndroid Build Coastguard Worker 20*387f9dfdSAndroid Build Coastguard Worker. scripts/git-tag.sh 21*387f9dfdSAndroid Build Coastguard Worker 22*387f9dfdSAndroid Build Coastguard Workergit archive HEAD --prefix=bcc/ --format=tar -o $TMP/SOURCES/bcc.tar 23*387f9dfdSAndroid Build Coastguard Worker 24*387f9dfdSAndroid Build Coastguard Worker# archive submodules 25*387f9dfdSAndroid Build Coastguard Workerpushd src/cc/libbpf 26*387f9dfdSAndroid Build Coastguard Workergit archive HEAD --prefix=bcc/src/cc/libbpf/ --format=tar -o $TMP/SOURCES/bcc_libbpf.tar 27*387f9dfdSAndroid Build Coastguard Workerpopd 28*387f9dfdSAndroid Build Coastguard Worker 29*387f9dfdSAndroid Build Coastguard Worker# merge all archives into $git_tag_latest.tar.gz 30*387f9dfdSAndroid Build Coastguard Workerpushd $TMP/SOURCES 31*387f9dfdSAndroid Build Coastguard Workertar -A -f bcc.tar bcc_libbpf.tar 32*387f9dfdSAndroid Build Coastguard Workergzip -c bcc.tar > $git_tag_latest.tar.gz 33*387f9dfdSAndroid Build Coastguard Workerpopd 34*387f9dfdSAndroid Build Coastguard Worker 35*387f9dfdSAndroid Build Coastguard Workerwget -P $TMP/SOURCES http://llvm.org/releases/$llvmver/{cfe,llvm}-$llvmver.src.tar.xz 36*387f9dfdSAndroid Build Coastguard Worker 37*387f9dfdSAndroid Build Coastguard Workersed \ 38*387f9dfdSAndroid Build Coastguard Worker -e "s/^\(Version:\s*\)@REVISION@/\1$revision/" \ 39*387f9dfdSAndroid Build Coastguard Worker -e "s/^\(Release:\s*\)@GIT_REV_COUNT@/\1$release/" \ 40*387f9dfdSAndroid Build Coastguard Worker SPECS/bcc+clang.spec > $TMP/SPECS/bcc.spec 41*387f9dfdSAndroid Build Coastguard Worker 42*387f9dfdSAndroid Build Coastguard Workerpushd $TMP 43*387f9dfdSAndroid Build Coastguard Workerrpmbuild --define "_topdir `pwd`" -ba SPECS/bcc.spec 44*387f9dfdSAndroid Build Coastguard Workerpopd 45*387f9dfdSAndroid Build Coastguard Worker 46*387f9dfdSAndroid Build Coastguard Workercp $TMP/RPMS/*/*.rpm . 47*387f9dfdSAndroid Build Coastguard Workercp $TMP/SRPMS/*.rpm . 48