forked from jeroen/autobrew-old
-
Notifications
You must be signed in to change notification settings - Fork 0
/
protobuf
34 lines (28 loc) · 1.24 KB
/
protobuf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
export HOMEBREW_NO_ANALYTICS=1
export HOMEBREW_NO_AUTO_UPDATE=1
# Offical Homebrew no longer supports El-Capitain
UPSTREAM_ORG="autobrew"
if [ "$DISABLE_AUTOBREW" ]; then return 0; fi
AUTOBREW=${TMPDIR-/tmp}
export HOMEBREW_TEMP="$AUTOBREW/hbtmp"
BREWDIR="$AUTOBREW/build-$PKG_BREW_NAME"
BREW="$BREWDIR/bin/brew"
rm -Rf $BREWDIR
mkdir -p $BREWDIR
echo "$(date): Auto-brewing $PKG_BREW_NAME in $BREWDIR..."
curl -fsSL https://github.com/$UPSTREAM_ORG/brew/tarball/master | tar xz --strip 1 -C $BREWDIR
export HOMEBREW_CACHE="$AUTOBREW"
$BREW deps -n $PKG_BREW_NAME 2>/dev/null
BREW_DEPS=$($BREW deps -n $PKG_BREW_NAME)
$BREW install --force-bottle $BREW_DEPS $PKG_BREW_NAME 2>&1 | perl -pe 's/Warning/Note/gi'
# 2017-03-15: there's a bug in protoc not finding dylibs
mv $BREWDIR/opt/$PKG_BREW_NAME/lib/*.dylib $BREWDIR/opt/$PKG_BREW_NAME/bin/
export DYLD_LIBRARY_PATH="$BREWDIR/opt/$PKG_BREW_NAME/bin"
# Prevent CRAN builder from linking against old libs in /usr/local/lib
for FILE in $BREWDIR/lib/*.a; do
BASENAME=$(basename $FILE)
LIBNAME=$(echo "${BASENAME%.*}" | cut -c4-)
DESTFILE="$BREWDIR/opt/$PKG_BREW_NAME/lib/libbrew$LIBNAME.a"
cp -f $FILE $DESTFILE && echo "created $DESTFILE"
PKG_LIBS=$(echo $PKG_LIBS | sed "s/-l$LIBNAME/-lbrew$LIBNAME/g")
done