• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# !/bin/sh -e
2
3if [ `uname -s` = "Darwin" ]; then
4echo "WARNING: OSX autogen build is not supported"
5fi
6
7REQUIRED='is required, but not installed.'
8bc -v >/dev/null 2>&1 || { echo >&2 "'bc' $REQUIRED"; exit 1; }
9if [ `uname -s` != "FreeBSD" ]; then
10sed --version >/dev/null 2>&1 || { echo >&2 "'sed' $REQUIRED"; exit 1; }
11fi
12autoreconf --version >/dev/null 2>&1 || { echo >&2 "'autoconf' $REQUIRED"; exit 1; }
13
14# If libtool is not installed -> "error: Libtool library used but 'LIBTOOL' is undefined"
15
16mkdir m4 2>/dev/null
17
18BROTLI_ABI_HEX=`sed -n 's/#define BROTLI_ABI_VERSION 0x//p' c/common/version.h`
19BROTLI_ABI_INT=`echo "ibase=16;$BROTLI_ABI_HEX" | bc`
20BROTLI_ABI_CURRENT=`expr $BROTLI_ABI_INT / 16777216`
21BROTLI_ABI_REVISION=`expr $BROTLI_ABI_INT / 4096 % 4096`
22BROTLI_ABI_AGE=`expr $BROTLI_ABI_INT % 4096`
23BROTLI_ABI_INFO="$BROTLI_ABI_CURRENT:$BROTLI_ABI_REVISION:$BROTLI_ABI_AGE"
24
25BROTLI_VERSION_HEX=`sed -n 's/#define BROTLI_VERSION 0x//p' c/common/version.h`
26BROTLI_VERSION_INT=`echo "ibase=16;$BROTLI_VERSION_HEX" | bc`
27BROTLI_VERSION_MAJOR=`expr $BROTLI_VERSION_INT / 16777216`
28BROTLI_VERSION_MINOR=`expr $BROTLI_VERSION_INT / 4096 % 4096`
29BROTLI_VERSION_PATCH=`expr $BROTLI_VERSION_INT % 4096`
30BROTLI_VERSION="$BROTLI_VERSION_MAJOR.$BROTLI_VERSION_MINOR.$BROTLI_VERSION_PATCH"
31
32sed -i.bak -r "s/[0-9]+:[0-9]+:[0-9]+/$BROTLI_ABI_INFO/" Makefile.am
33sed -i.bak -r "s/\[[0-9]+\.[0-9]+\.[0-9]+\]/[$BROTLI_VERSION]/" configure.ac
34
35autoreconf --install --force --symlink || exit $
36