brotli/bootstrap

38 lines
1.5 KiB
Plaintext
Raw Normal View History

2020-08-28 08:14:08 +00:00
#!/bin/sh -e
2020-08-26 15:13:31 +00:00
if [ `uname -s` = "Darwin" ]; then
echo "WARNING: OSX autogen build is not supported"
fi
REQUIRED='is required, but not installed.'
bc -v >/dev/null 2>&1 || { echo >&2 "'bc' $REQUIRED"; exit 1; }
if [ `uname -s` != "FreeBSD" ]; then
sed --version >/dev/null 2>&1 || { echo >&2 "'sed' $REQUIRED"; exit 1; }
fi
autoreconf --version >/dev/null 2>&1 || { echo >&2 "'autoconf' $REQUIRED"; exit 1; }
# If libtool is not installed -> "error: Libtool library used but 'LIBTOOL' is undefined"
2020-08-28 08:14:08 +00:00
if [ ! -e "./m4" ]; then
mkdir m4 2>/dev/null
2020-08-28 08:14:08 +00:00
fi
BROTLI_ABI_HEX=`sed -n 's/#define BROTLI_ABI_VERSION 0x//p' c/common/version.h`
BROTLI_ABI_INT=`echo "ibase=16;$BROTLI_ABI_HEX" | bc`
2020-08-28 08:14:08 +00:00
BROTLI_ABI_CURRENT=`echo "$BROTLI_ABI_INT / 16777216" | bc`
BROTLI_ABI_REVISION=`echo "$BROTLI_ABI_INT / 4096 % 4096" | bc`
BROTLI_ABI_AGE=`echo "$BROTLI_ABI_INT % 4096" | bc`
BROTLI_ABI_INFO="$BROTLI_ABI_CURRENT:$BROTLI_ABI_REVISION:$BROTLI_ABI_AGE"
BROTLI_VERSION_HEX=`sed -n 's/#define BROTLI_VERSION 0x//p' c/common/version.h`
BROTLI_VERSION_INT=`echo "ibase=16;$BROTLI_VERSION_HEX" | bc`
2020-08-28 08:14:08 +00:00
BROTLI_VERSION_MAJOR=`echo "$BROTLI_VERSION_INT / 16777216" | bc`
BROTLI_VERSION_MINOR=`echo "$BROTLI_VERSION_INT / 4096 % 4096" | bc`
BROTLI_VERSION_PATCH=`echo "$BROTLI_VERSION_INT % 4096" | bc`
BROTLI_VERSION="$BROTLI_VERSION_MAJOR.$BROTLI_VERSION_MINOR.$BROTLI_VERSION_PATCH"
sed -i.bak -r "s/[0-9]+:[0-9]+:[0-9]+/$BROTLI_ABI_INFO/" Makefile.am
sed -i.bak -r "s/\[[0-9]+\.[0-9]+\.[0-9]+\]/[$BROTLI_VERSION]/" configure.ac
autoreconf --install --force --symlink || exit $