Newer
Older
XinYang_IOS / Carthage / Checkouts / OpenVPNAdapter / Sources / OpenVPN3 / deps / lzo / build-lzo
@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 "$DEP_DIR" ]; then
    echo DEP_DIR var must point to dependency build folder
    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

# source helper functions
. $O3/core/deps/functions.sh

FNAME=${LZO_VERSION}.tar.gz
PN=${LZO_VERSION#*-}
URL=http://www.oberhumer.com/opensource/lzo/download/${LZO_VERSION}.tar.gz
CSUM=${LZO_CSUM}

download

CC=cc
LD=ld
AR=ar
RANLIB=ranlib
[ "$GCC_CMD" ] && CC=$GCC_CMD
[ "$LD_CMD" ] && LD=$LD_CMD
[ "$AR_CMD" ] && AR=$AR_CMD
[ "$RANLIB_CMD" ] && 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 $LZO_VERSION
    tar xfz $DL/$LZO_VERSION.tar.gz
fi

DIST=$(pwd)/lzo/lzo-$PLATFORM
rm -rf $DIST
mkdir -p $DIST
cd $LZO_VERSION
echo 'OPTIONS' $CC $LD $AR $RANLIB $host_opt $targ_opt
CFLAGS="$PLATFORM_FLAGS $OTHER_COMPILER_FLAGS $LIB_OPT_LEVEL $LIB_FPIC" ./configure --prefix=$DIST $host_opt $targ_opt
make
make install
exit 0