mirror of
https://github.com/google/brotli.git
synced 2024-11-21 19:20:09 +00:00
Fix bootstrap on macOS (#965)
* bootstrap: Verify functionality of sed Check for the existence of sed by running a simple substitution rather than using the --version flag. This lets us remove the weird exclusion of FreeBSD from checking the sed requirement, and fixes checking the sed requirement on other systems like macOS that use BSD sed, which doesn't support --version. * bootstrap: Detect flag for sed extended RE Detect whether sed needs -E or -r to enable extended regular expressions. Fixes bootstrap on macOS, whose BSD sed does not support -r. GNU sed has supported -E as a synonym for -r since version 4.2 (2009), initially as an undocumented option for compatibility with BSD sed: http://git.savannah.gnu.org/cgit/sed.git/commit/sed/sed.c?id=3a8e165ab02487c372df217c1989e287625ce0ae and later as a documented option after -E became POSIX: http://git.savannah.gnu.org/cgit/sed.git/commit/sed/sed.c?id=8b65e07904384b529a464c89f3739d2e7e4d5135
This commit is contained in:
parent
f4153a09f8
commit
c9eb85691f
16
bootstrap
16
bootstrap
@ -1,16 +1,14 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
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
|
||||
[ "x`echo hello | sed s/hello/world/ 2>/dev/null`" = "xworld" ] || { echo >&2 "'sed' $REQUIRED"; exit 1; }
|
||||
autoreconf --version >/dev/null 2>&1 || { echo >&2 "'autoconf' $REQUIRED"; exit 1; }
|
||||
|
||||
# Determine which flag sed uses for extended regular expressions.
|
||||
# -E is POSIX. -r is for GNU sed older than 4.2.
|
||||
echo hello | sed -E s/hello/world/ >/dev/null 2>&1 && SED_ERE=-E || SED_ERE=-r
|
||||
|
||||
# If libtool is not installed -> "error: Libtool library used but 'LIBTOOL' is undefined"
|
||||
|
||||
if [ ! -e "./m4" ]; then
|
||||
@ -31,7 +29,7 @@ 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
|
||||
sed -i.bak "$SED_ERE" "s/[0-9]+:[0-9]+:[0-9]+/$BROTLI_ABI_INFO/" Makefile.am
|
||||
sed -i.bak "$SED_ERE" "s/\[[0-9]+\.[0-9]+\.[0-9]+\]/[$BROTLI_VERSION]/" configure.ac
|
||||
|
||||
autoreconf --install --force --symlink || exit $
|
||||
|
Loading…
Reference in New Issue
Block a user