maint: changed abi checker script to use git tags instead of tarballs
[barry.git] / maintainer / abi / abi-prepare.sh
blob541c915200ff2c4ef5fa213cd2522f7d08b26e64
1 #!/bin/sh
3 fullpath() {
4 cd "$(dirname "$1")"
5 echo "$(pwd)/$(basename "$1")"
8 if [ -z "$1" -o -z "$2" -o -z "$3" ] ; then
9 echo "Usage: abi-prepare.sh commit abi.xml configure.sh"
10 exit 1
13 COMMIT="$1"
14 XML="$2"
15 CONFIG="$3"
16 VERSION="$(grep -A 1 '<version>' "$XML" | grep -v version | sed "s/^[ ]//")"
18 FULLXML="$(fullpath "$XML")"
19 FULLCONFIG="$(fullpath "$CONFIG")"
21 # enable errors
22 set -e
24 # create target playspace
25 echo "Creating source tree..."
26 mkdir "/tmp/$VERSION" # make sure it doesn't already exist
27 mkdir -p "/tmp/$VERSION/rootdir"
29 # extract the commit... need to prefix rev-parse with ./ since if run
30 # in root of git repo, rev-parse will output an empty string,
31 # which we don't want to pass to cd.
32 (cd "./$(git rev-parse --show-cdup)" && \
33 git archive --prefix="$COMMIT/" "$COMMIT") | \
34 tar -C "/tmp/$VERSION" -xf -
36 # build and install
37 echo "Installing to: /tmp/$VERSION/rootdir..."
38 cd "/tmp/$VERSION/$COMMIT"
39 ./buildgen.sh
40 "$FULLCONFIG" --prefix="/tmp/$VERSION/rootdir"
41 make -j2
42 make install