Newer
Older
XinYang_IOS / Carthage / Checkouts / OpenVPNAdapter / Sources / OpenVPN3 / deps / cityhash / build-cityhash
@zhangfeng zhangfeng on 7 Dec 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 "$DL" ]; then
    echo DL var must point to the download folder
    exit 1
fi

if [ -z "$TARGET" ]; then
    echo TARGET var must be defined
    exit 1
fi

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

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

FNAME=cityhash-${CITYHASH_VERSION}.tar.gz
PN=${CITYHASH_VERSION#*-}
URL=https://codeload.github.com/google/cityhash/tar.gz/${CITYHASH_VERSION}
CSUM=${CITYHASH_CSUM}

download

CXX=c++
LD=ld
AR=ar
RANLIB=ranlib
[ "$GPP_CMD" ] && CXX=$GPP_CMD
[ "$LD_CMD" ] && LD=$LD_CMD
[ "$AR_CMD" ] && AR=$AR_CMD
[ "$RANLIB_CMD" ] && RANLIB=$RANLIB_CMD

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

DIST=$(pwd)/cityhash/cityhash-$PLATFORM
rm -rf $DIST
mkdir -p $DIST/include
mkdir $DIST/lib
cd cityhash-$CITYHASH_VERSION

# The autconf tools in cityhash are from 2009 and have no idea what arm64 is and fail.
# The configure otherwise not really useful anyway, as only HAVE_BUILTIN_EXPECT
# and if the arch is big endian is used by cityhash source code
#CMD=./configure
#echo $CMD
# fake config.h
touch config.h

$CMD
CMD="$CXX $CXX_COMPILER_FLAGS $PLATFORM_FLAGS $OTHER_COMPILER_FLAGS $LIB_OPT_LEVEL $LIB_FPIC -DHAVE_BUILTIN_EXPECT=1 -I. -Isrc -c src/city.cc"
echo $CMD
$CMD
$AR rc $DIST/lib/libcityhash.a city.o
$RANLIB $DIST/lib/libcityhash.a
cp src/city.h $DIST/include/
exit 0