Commit fbe94ddb authored by Yonghong Song's avatar Yonghong Song

get submodules in cmake and package build

If the target directory src/cc/libbpf/ does not exist,
the top level CMakeLists.txt is changed to fetch
submodules with the following command
  git submodule update --init --recursive

The dev/rpm build scripts are also changed
to do git submodule update.
Signed-off-by: default avatarYonghong Song <yhs@fb.com>
parent bf5b9a5b
......@@ -9,6 +9,12 @@ endif()
enable_testing()
# populate submodules (libbpf)
if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/cc/libbpf/src)
execute_process(COMMAND git submodule update --init --recursive
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
endif()
include(cmake/GetGitRevisionDescription.cmake)
include(cmake/version.cmake)
include(CMakeDependentOption)
......
......@@ -16,11 +16,24 @@ function cleanup() {
}
trap cleanup EXIT
# populate submodules
git submodule update --init --recursive
. scripts/git-tag.sh
git archive HEAD --prefix=bcc/ --format=tar.gz -o $TMP/bcc_$revision.orig.tar.gz
git archive HEAD --prefix=bcc/ --format=tar -o $TMP/bcc_$revision.orig.tar
# archive submodules
pushd src/cc/libbpf
git archive HEAD --prefix=bcc/src/cc/libbpf/ --format=tar -o $TMP/bcc_libbpf_$revision.orig.tar
popd
pushd $TMP
# merge all archives into bcc_$revision.orig.tar.gz
tar -A -f bcc_$revision.orig.tar bcc_libbpf_$revision.orig.tar
gzip bcc_$revision.orig.tar
tar xf bcc_$revision.orig.tar.gz
cd bcc
......
......@@ -14,9 +14,24 @@ 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.gz -o $TMP/SOURCES/$git_tag_latest.tar.gz
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 http://llvm.org/releases/$llvmver/{cfe,llvm}-$llvmver.src.tar.xz
sed \
......
......@@ -14,9 +14,23 @@ 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.gz -o $TMP/SOURCES/bcc.tar.gz
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 bcc.tar.gz
pushd $TMP/SOURCES
tar -A -f bcc.tar bcc_libbpf.tar
gzip bcc.tar
popd
sed \
-e "s/^\(Version:\s*\)@REVISION@/\1$revision/" \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment