Newer
Older
XinYang_IOS / Carthage / Checkouts / OpenVPNAdapter / Sources / OpenVPN3 / deps / snappy / build-snappy
@zhangfeng zhangfeng on 7 Dec 2023 1 KB 1.8.0
#!/usr/bin/env bash

set -e
if [ -z "$O3" ]; then
    echo O3 var must point to ovpn3 tree
    exit 1
fi
if [ -z "$TARGET" ]; then
    echo TARGET var must be defined
    exit 1
fi

[ -z "$DL" ] && DL=~/Downloads

# source vars
. $O3/core/vars/vars-${TARGET}
. $O3/core/deps/lib-versions

[ "$GCC_CMD" ] && export CC=$GCC_CMD
[ "$GPP_CMD" ] && export CXX=$GPP_CMD
[ "$LD_CMD" ] && export LD=$LD_CMD
[ "$AR_CMD" ] && export AR=$AR_CMD
[ "$RANLIB_CMD" ] && export RANLIB=$RANLIB_CMD

case $PLATFORM in
android*)
  echo PLATFORM android
  host=arm
  target=arm
  ;;
ios*)
  echo PLATFORM ios
  host="x86_64-apple-darwin"
  target=arm
  ;;
*)
  host=""
  target=""
  ;;
esac

if [ "$target" ]; then
    targ_opt="--target=$target"
fi

if [ "$host" ]; then
    host_opt="--host=$host"
fi

if [ "$NO_WIPE" != "1" ]; then
    rm -rf $SNAPPY_VERSION
    tar xfz $DL/$SNAPPY_VERSION.tar.gz
fi

DIST=$(pwd)/snappy/snappy-$PLATFORM
rm -rf $DIST
mkdir -p $DIST
cd $SNAPPY_VERSION
echo 'OPTIONS' CC=$CC LD=$LD AR=$AR RANLIB=$RANLIB host_opt=$host_opt targ_opt=$targ_opt
export CFLAGS="$PLATFORM_FLAGS $OTHER_COMPILER_FLAGS $LIB_OPT_LEVEL $LIB_FPIC"
echo 'CFLAGS' $CFLAGS
export CXXFLAGS="$CFLAGS $CXX_COMPILER_FLAGS"
./configure --prefix=$DIST $host_opt $targ_opt --enable-static --disable-shared
make
make install
exit 0