mirror of
https://github.com/google/brotli.git
synced 2024-11-24 20:40:13 +00:00
Do not rely on bash arithmetic in bootstrap
(#625)
This commit is contained in:
parent
1ca15159d6
commit
c8c8389ed3
21
bootstrap
21
bootstrap
@ -1,19 +1,24 @@
|
||||
# !/bin/sh -e
|
||||
|
||||
REQUIRED='is required, but not installed.'
|
||||
bc -v >/dev/null 2>&1 || { echo >&2 "'bc' $REQUIRED"; exit 1; }
|
||||
sed --version >/dev/null 2>&1 || { echo >&2 "'sed' $REQUIRED"; exit 1; }
|
||||
autoreconf --version >/dev/null 2>&1 || { echo >&2 "'autoconf' $REQUIRED"; exit 1; }
|
||||
|
||||
mkdir m4 2>/dev/null
|
||||
|
||||
BROTLI_ABI_HEX=`sed -n 's/#define BROTLI_ABI_VERSION 0x//p' c/common/version.h`
|
||||
BROTLI_ABI_INT=`echo $((16#$BROTLI_ABI_HEX))`
|
||||
BROTLI_ABI_CURRENT=$(($BROTLI_ABI_INT >> 24))
|
||||
BROTLI_ABI_REVISION=$((($BROTLI_ABI_INT >> 12) & 4095))
|
||||
BROTLI_ABI_AGE=$(($BROTLI_ABI_INT & 4095))
|
||||
BROTLI_ABI_INT=`echo "ibase=16;$BROTLI_ABI_HEX" | bc`
|
||||
BROTLI_ABI_CURRENT=`expr $BROTLI_ABI_INT / 16777216`
|
||||
BROTLI_ABI_REVISION=`expr $BROTLI_ABI_INT / 4096 % 4096`
|
||||
BROTLI_ABI_AGE=`expr $BROTLI_ABI_INT % 4096`
|
||||
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 $((16#$BROTLI_VERSION_HEX))`
|
||||
BROTLI_VERSION_MAJOR=$(($BROTLI_VERSION_INT >> 24))
|
||||
BROTLI_VERSION_MINOR=$((($BROTLI_VERSION_INT >> 12) & 4095))
|
||||
BROTLI_VERSION_PATCH=$(($BROTLI_VERSION_INT & 4095))
|
||||
BROTLI_VERSION_INT=`echo "ibase=16;$BROTLI_VERSION_HEX" | bc`
|
||||
BROTLI_VERSION_MAJOR=`expr $BROTLI_VERSION_INT / 16777216`
|
||||
BROTLI_VERSION_MINOR=`expr $BROTLI_VERSION_INT / 4096 % 4096`
|
||||
BROTLI_VERSION_PATCH=`expr $BROTLI_VERSION_INT % 4096`
|
||||
BROTLI_VERSION="$BROTLI_VERSION_MAJOR.$BROTLI_VERSION_MINOR.$BROTLI_VERSION_PATCH"
|
||||
|
||||
sed -r "s/[0-9]+:[0-9]+:[0-9]+/$BROTLI_ABI_INFO/" Makefile.am -i
|
||||
|
Loading…
Reference in New Issue
Block a user