Imported Upstream version 4.0
[platform/upstream/ccache.git] / ci / build-and-verify-source-package
1 #!/bin/sh
2 #
3 # Test that it works to build from a source archive exported by "git archive"
4 # outside a Git repository.
5
6 set -eu
7
8 # Ninja builds with relative paths so that ccache can be used to cache the build
9 # without resorting to setting base_dir.
10 export CMAKE_GENERATOR=Ninja
11
12 tmp_dir=$(mktemp -d)
13 trap "rm -rf $tmp_dir" EXIT
14
15 git archive --prefix=ccache/ -o $tmp_dir/ccache.tar.gz HEAD
16 cd $tmp_dir
17 tar xf ccache.tar.gz
18 cd ccache
19 mkdir build
20 cd build
21 cmake ..
22 ninja -v
23 jobs=$(getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1)
24 ctest --output-on-failure -j $jobs