#!/bin/sh set -e ./autogen.sh if [ "x$ARCH" = "xnative" ]; then # test autotools ./configure make -j 4 distcheck # make distribution make dist tar zxvf libressl-*.tar.gz cd libressl-* mkdir build-static mkdir build-shared cd build-static # test cmake and ninja if [ `uname` = "Darwin" ]; then cmake .. make make test cd ../build-shared cmake -DBUILD_SHARED_LIBS=ON .. make make test else sudo apt-get update sudo apt-get install -y cmake ninja-build cmake -GNinja .. ninja ninja test cd ../build-shared cmake -GNinja -DBUILD_SHARED_LIBS=ON .. ninja ninja test fi elif [ "x$ARCH" = "xmingw32" -o "x$ARCH" = "xmingw64" ]; then sudo apt-get update sudo apt-get install -y cmake ninja-build CPU=i686 if [ "x$ARCH" = "xmingw64" ]; then CPU=x86_64 fi export CC=$CPU-w64-mingw32-gcc if [ -z $(which $CC) ]; then sudo apt-get update sudo apt-get install -y mingw-w64 make export PATH=$PATH:/opt/$ARCH/bin fi ./configure --host=$CPU-w64-mingw32 make -j ( rm -fr build-static mkdir build-static cd build-static cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=../scripts/$CPU-w64-mingw32.cmake .. ninja ) ( rm -fr build-shared mkdir build-shared cd build-shared cmake -GNinja -DCMAKE_TOOLCHAIN_FILE=../scripts/$CPU-w64-mingw32.cmake -DBUILD_SHARED_LIBS=ON .. ninja ) elif [ "x$ARCH" = "xarm32" -o "x$ARCH" = "xarm64" ]; then sudo apt-get update sudo apt-get install -y qemu-user-static binfmt-support if [ "x$ARCH" = "xarm32" ]; then sudo apt-get install -y g++-arm-linux-gnueabihf sudo ln -s /usr/arm-linux-gnueabihf/lib /lib/arm-linux-gnueabihf sudo ln -s /lib/arm-linux-gnueabihf/ld-2.19.so /lib/ld-linux-armhf.so.3 export CC=arm-linux-gnueabihf-gcc ./configure --host=arm-linux else sudo apt-get install -y g++-aarch64-linux-gnu sudo ln -s /usr/aarch64-linux-gnu/lib/ /lib/aarch64-linux-gnu sudo ln -s /lib/aarch64-linux-gnu/ld-2.19.so /lib/ld-linux-aarch64.so.1 export CC=aarch64-linux-gnu-gcc ./configure --host=aarch64-linux fi make -j 4 check file apps/openssl/.libs/openssl elif [ "x$ARCH" = "xandroid" ]; then echo y | sdkmanager 'ndk-bundle' echo y | sdkmanager 'cmake;3.6.4111459' echo y | sdkmanager 'lldb;3.0' echo y | sdkmanager --update echo y | sdkmanager --licenses export CMAKE=$ANDROID_HOME/cmake/3.6.4111459/bin/cmake export NINJA=$ANDROID_HOME/cmake/3.6.4111459/bin/ninja export ANDROID_NDK_HOME=$ANDROID_HOME/ndk-bundle export TC_FILE=$ANDROID_NDK_HOME/build/cmake/android.toolchain.cmake # get available API level and architecture pdir=$ANDROID_NDK_HOME/platforms level_arch="" level=$MIN_NAL while [ $level -le $MAX_NAL ] do if [ -d $pdir/android-$level ] ; then adir=$pdir/android-$level if [ -d $adir/arch-arm ] ; then level_arch="$level_arch $level;armeabi-v7a" fi if [ -d $adir/arch-arm64 ] ; then level_arch="$level_arch $level;arm64-v8a" fi if [ -d $adir/arch-x86 ] ; then level_arch="$level_arch $level;x86" fi if [ -d $adir/arch-x86_64 ] ; then level_arch="$level_arch $level;x86_64" fi fi level=`expr $level + 1` done # build each API level and architecture for la in $level_arch do NAL=`echo $la | cut -d ';' -f 1` ABI=`echo $la | cut -d ';' -f 2` echo "" echo "##### Date: `date`, Native API level: $NAL, ABI: $ABI" ( build_dir=build_$NAL_$ABI rm -fr $build_dir mkdir $build_dir cd $build_dir $CMAKE -GNinja -DCMAKE_MAKE_PROGRAM=$NINJA \ -DANDROID_NDK=$ANDROID_NDK_HOME \ -DCMAKE_TOOLCHAIN_FILE=$TC_FILE \ -DANDROID_ABI=$ABI -DANDROID_NATIVE_API_LEVEL=$NAL .. $NINJA -j 4 echo "" file apps/openssl/openssl ) done fi