aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/init.sh
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/init.sh')
-rwxr-xr-xscripts/init.sh255
1 files changed, 135 insertions, 120 deletions
diff --git a/scripts/init.sh b/scripts/init.sh
index 26e8394b..5bd4deca 100755
--- a/scripts/init.sh
+++ b/scripts/init.sh
@@ -15,14 +15,12 @@
#!/bin/bash
-set -e
-
+set -ex
ABI=$1
-
INSTALLATION_DIR=$2
OS=`echo $OS | tr '[:upper:]' '[:lower:]'`
-BASE_DIR=`pwd`
-echo "SDK_PATH ${SDK}"
+export BASE_DIR=`pwd`
+
if [ -z ${SDK_PATH} ]; then
mkdir -p sdk
cd sdk
@@ -31,17 +29,19 @@ if [ -z ${SDK_PATH} ]; then
if [ ! -f android-sdk_r24.4.1-macosx.zip ]; then
wget http://dl.google.com/android/android-sdk_r24.4.1-macosx.zip
fi
+
+ echo "unzip android-sdk"
unzip -q android-sdk_r24.4.1-macosx.zip
mv android-sdk-macosx sdk
else
- if [ ! -f android-sdk_r24.4.1-linux.zip ]; then
+ if [ ! -f android-sdk_r24.4.1-linux.tgz ]; then
wget http://dl.google.com/android/android-sdk_r24.4.1-linux.tgz
fi
+ echo "untar android-sdk"
tar zxf android-sdk_r24.4.1-linux.tgz
mv android-sdk-linux sdk
fi
mkdir -p sdk/licenses
- mkdir -p sdk/licenses
echo "\nd56f5187479451eabf01fb78af6dfcb131a6481e" > "sdk/licenses/android-sdk-license"
echo "\n84831b9409646a918e30573bab4c9c91346d8abd" > "sdk/licenses/android-sdk-preview-license"
echo "y" | ./sdk/tools/android update sdk --filter platform-tools,build-tools-23.0.2,android-23,extra-android-m2repository,extra-google-m2repository --no-ui --all --force
@@ -55,39 +55,38 @@ if [ -z ${NDK_PATH} ]; then
mkdir -p sdk
cd sdk
if [ ! -d ndk-bundle ]; then
- if [ ! -f android-ndk-r14b-${OS}-${ARCH}.zip ]; then
- wget https://dl.google.com/android/repository/android-ndk-r14b-${OS}-${ARCH}.zip
+ if [ ! -f android-ndk-r15c-${OS}-${ARCH}.zip ]; then
+ wget https://dl.google.com/android/repository/android-ndk-r15c-${OS}-${ARCH}.zip
fi
- unzip -q android-ndk-r14b-${OS}-${ARCH}.zip
- mv android-ndk-r14b ndk-bundle
+
+ echo "unzip android-ndk"
+ unzip -q android-ndk-r15c-${OS}-${ARCH}.zip
+ mv android-ndk-r15c ndk-bundle
+ cp $BASE_DIR/external/glob.h ndk-bundle/sysroot/usr/include/
fi
cd ..
fi
-if [ -z ${CMAKE_PATH} ]; then
- mkdir -p sdk
- cd sdk
- if [ ! -d cmake ]; then
- if [ ! -f cmake-3.6.3155560-${OS}-${ARCH}.zip ]; then
- wget https://dl.google.com/android/repository/cmake-3.6.3155560-${OS}-${ARCH}.zip
- fi
- unzip -q cmake-3.6.3155560-${OS}-${ARCH}.zip -d cmake
- fi
- cd ..
+export TOOLCHAIN=$BASE_DIR/sdk/toolchain_$ABI
+
+if [ ! -d $TOOLCHAIN ];then
+ echo "creating toolchain"
+ $NDK/build/tools/make_standalone_toolchain.py --arch $ABI --api 26 --install-dir $TOOLCHAIN
fi
mkdir -p src
cd src
-if [ ! -d ccnxlibs ]; then
- echo "ccnxlibs not found"
- git clone -b ccnxlibs/master https://gerrit.fd.io/r/cicn ccnxlibs
-fi
if [ ! -d cframework ]; then
echo "cframework not found"
git clone -b cframework/master https://gerrit.fd.io/r/cicn cframework
fi
+if [ ! -d ccnxlibs ]; then
+ echo "ccnxlibs not found"
+ git clone -b ccnxlibs/master https://gerrit.fd.io/r/cicn ccnxlibs
+fi
+
if [ ! -d sb-forwarder ]; then
echo "sb-forwarder not found"
git clone -b sb-forwarder/master https://gerrit.fd.io/r/cicn sb-forwarder
@@ -101,123 +100,139 @@ if [ ! -d viper ]; then
git clone -b viper/master https://gerrit.fd.io/r/cicn viper
fi
+if [ ! -d http-server ]; then
+ echo "http-server not found"
+ git clone -b http-server/master https://gerrit.fd.io/r/cicn http-server
+fi
+
+if [ ! -d libxml2 ]; then
+ echo "libxml2 not found"
+ git clone https://github.com/GNOME/libxml2.git
+ cp $BASE_DIR/external/libxml2/CMakeLists.txt libxml2
+ cp $BASE_DIR/external/libxml2/xmlversion.h libxml2/include/libxml
+ cp $BASE_DIR/external/libxml2/config.h libxml2
+ if [ $OS = darwin ]; then
+ sed -i '' '1s/^/#include <errno.h>/' libxml2/triodef.h
+ else
+ sed -i '1s/^/#include <errno.h>/' libxml2/triodef.h
+ fi
+fi
+
+if [ ! -d libevent ]; then
+ echo "libevent not found"
+ git clone https://github.com/libevent/libevent.git
+ cp $BASE_DIR/external/libevent/AddEventLibrary.cmake libevent/cmake/
+fi
+
+if [ ! -d jsoncpp ]; then
+ echo "jsoncpp not found"
+ git clone https://github.com/open-source-parsers/jsoncpp.git
+ cp $BASE_DIR/external/jsoncpp/CMakeLists.txt jsoncpp/
+fi
+
cd ../
-cd external
+echo ${INSTALLATION_DIR}
mkdir -p ${INSTALLATION_DIR}
mkdir -p ${INSTALLATION_DIR}/include
mkdir -p ${INSTALLATION_DIR}/lib
+
if [ ! -d ${INSTALLATION_DIR}/include/openssl ]; then
echo "OpenSSL Libs not found!"
- if [ ! -d openssl-1.0.2k ]; then
- echo "OpenSSL Directory not found"
- if [ ! -f openssl-1.0.2k.tar.gz ]; then
- echo "OpenSSL Archive not found"
- wget https://www.openssl.org/source/openssl-1.0.2k.tar.gz
- fi
- tar -xzf openssl-1.0.2k.tar.gz
+ if [ "$ABI" = "arm" ]; then
+ bash scripts/build-openssl4android.sh android-armeabi
+ cp external/install_openssl/libs/armeabi-v7a/lib/*.a $INSTALLATION_DIR/lib/
+ cp -rf external/install_openssl/libs/armeabi-v7a/include/openssl $INSTALLATION_DIR/include/
+ elif [ "$ABI" = "arm64" ]; then
+ bash scripts/build-openssl4android.sh android64-aarch64
+ cp external/install_openssl/libs/arm64-v8a/lib/*.a $INSTALLATION_DIR/lib/
+ cp -rf external/install_openssl/libs/arm64-v8a/include/openssl $INSTALLATION_DIR/include/
+ elif [ "$ABI" = "x86" ]; then
+ bash scripts/build-openssl4android.sh android-x86
+ cp external/install_openssl/libs/x86/lib/*.a $INSTALLATION_DIR/lib/
+ cp -rf external/install_openssl/libs/x86/include/openssl $INSTALLATION_DIR/include/
+ else
+ bash scripts/build-openssl4android.sh android64
+ cp external/install_openssl/libs/x86_64/lib/*.a $INSTALLATION_DIR/lib/
+ cp -rf external/install_openssl/libs/x86_64/include/openssl $INSTALLATION_DIR/include/
fi
- echo "Compile OpenSSL"
- if [ ! -d ${NDK}/sources/openssl/1.0.2 ]; then
- export ANDROID_NDK_ROOT=$NDK
- bash ${BASE_DIR}/scripts/tools/build-target-openssl.sh --abis=$ABI openssl-1.0.2k --ndk-dir=${NDK}
+fi
+
+
+if [ ! -d ${INSTALLATION_DIR}/include/curl ]; then
+ echo "Curl Libs not found!"
+ if [ "$ABI" = "arm" ]; then
+ bash scripts/build-curl4android.sh android-armeabi
+ cp external/install_curl/libs/armeabi-v7a/lib/*.a $INSTALLATION_DIR/lib/
+ cp -rf external/install_curl/libs/armeabi-v7a/include/curl $INSTALLATION_DIR/include/
+ elif [ "$ABI" = "arm64" ]; then
+ bash scripts/build-curl4android.sh android64-aarch64
+ cp external/install_curl/libs/arm64-v8a/lib/*.a $INSTALLATION_DIR/lib/
+ cp -rf external/install_curl/libs/arm64-v8a/include/curl $INSTALLATION_DIR/include/
+ elif [ "$ABI" = "x86" ]; then
+ bash scripts/build-curl4android.sh android-x86
+ cp external/install_curl/libs/x86/lib/*.a $INSTALLATION_DIR/lib/
+ cp -rf external/install_curl/libs/x86/include/curl $INSTALLATION_DIR/include/
+ else
+ bash scripts/build-curl4android.sh android64
+ cp external/install_curl/libs/x86_64/lib/*.a $INSTALLATION_DIR/lib/
+ cp -rf external/install_curl/libs/x86_64/include/curl $INSTALLATION_DIR/include/
fi
- echo "Copy libssl and libcrypto in workspace"
- cp -rf ${NDK}/sources/openssl/1.0.2k/include/* ${INSTALLATION_DIR}/include/
- cp -f ${INSTALLATION_DIR}/include/openssl/opensslconf_armeabi_v7a.h ${INSTALLATION_DIR}/include/openssl/opensslconf_armeabi.h
- cp -f ${NDK}/sources/openssl/1.0.2k/libs/${ABI}/*.a ${INSTALLATION_DIR}/lib/
- rm -rf ${NDK}/sources/openssl/1.0.2k
+
fi
+cd external
if [ ! -d ${INSTALLATION_DIR}/include/boost ]; then
echo "Boost Libs not found!"
- if [ ! -d boost_1_63_0 ]; then
+ if [ ! -d boost_1_66_0 ]; then
echo "Boost Directory not found"
- if [ ! -f boost_1_63_0.tar.gz ]; then
+ if [ ! -f boost_1_66_0.tar.gz ]; then
echo "Boost Archive not found"
- wget https://sourceforge.net/projects/boost/files/boost/1.63.0/boost_1_63_0.tar.gz
+ wget https://dl.bintray.com/boostorg/release/1.66.0/source/boost_1_66_0.tar.gz
fi
- tar -xzf boost_1_63_0.tar.gz
+ tar -xzf boost_1_66_0.tar.gz
fi
- cd boost_1_63_0
+ cd boost_1_66_0
+ rm -rf install_boost
if [ ! -d install_boost ]; then
echo "Compile Boost"
- ./bootstrap.sh
- echo "import option ;" > project-config.jam
- if [ $ABI = armeabi-v7a ]; then
- echo "using gcc : arm : arm-linux-androideabi-g++ ;" >> project-config.jam
- export PATH=$PATH:${NDK}/toolchains/arm-linux-androideabi-4.9/prebuilt/${OS}-${ARCH}/bin
- elif [ $ABI = x86 ]; then
- echo "using gcc : x86 : i686-linux-android-g++ ;" >> project-config.jam
- export PATH=$PATH:${NDK}/toolchains/x86-4.9/prebuilt/${OS}-${ARCH}/bin
- elif [ $ABI = x86_64 ]; then
- echo "using gcc : x86_64 : x86_64-linux-android-g++ ;" >> project-config.jam
- export PATH=$PATH:${NDK}/toolchains/x86_64-4.9/prebuilt/${OS}-${ARCH}/bin
+
+ rm -rf stage/lib
+ rm -f bjam
+ rm -f index.htmproject-config.jam.1
+ rm -f project-config.jam.2
+ rm -f bootstrap.log
+ rm -f b2
+ rm -rf bin.v2/
+ rm -f project-config.jam
+ PREFIX=`pwd`/install_boost
+ ./bootstrap.sh --with-toolset=clang
+
+ if [ "$ABI" = "arm" ]; then
+ PATH=$TOOLCHAIN/bin:$PATH ./b2 toolset=clang link=static threading=multi threadapi=pthread target-os=android --with-system --with-filesystem --with-regex abi=aapcs binary-format=elf define=BOOST_MATH_DISABLE_FLOAT128 --prefix=$PREFIX install
+ cp -rf $PREFIX/include/boost $INSTALLATION_DIR/include
+ PATH=$TOOLCHAIN/bin:$PATH arm-linux-androideabi-ranlib $PREFIX/lib/*
+ cp -rf $PREFIX/lib/* $INSTALLATION_DIR/lib
+ elif [ "$ABI" = "arm64" ]; then
+ PATH=$TOOLCHAIN/bin:$PATH ./b2 -d+2 toolset=clang-arm64 link=static threading=multi threadapi=pthread target-os=android --with-system --with-filesystem --with-regex binary-format=elf define=BOOST_MATH_DISABLE_FLOAT128 --prefix=$PREFIX install
+ cp -rf $PREFIX/include/boost $INSTALLATION_DIR/include
+ PATH=$TOOLCHAIN/bin:$PATH aarch64-linux-android-ranlib $PREFIX/lib/*
+ cp -rf $PREFIX/lib/* $INSTALLATION_DIR/lib
+ elif [ "$ABI" = "x86" ]; then
+ PATH=$TOOLCHAIN/bin:$PATH ./b2 -d+2 toolset=clang-x86 link=static threading=multi threadapi=pthread target-os=android --with-system --with-filesystem --with-regex binary-format=elf define=BOOST_MATH_DISABLE_FLOAT128 --prefix=$PREFIX install
+ cp -rf $PREFIX/include/boost $INSTALLATION_DIR/include
+ PATH=$TOOLCHAIN/bin:$PATH i686-linux-android-ranlib $PREFIX/lib/*
+ cp -rf $PREFIX/lib/* $INSTALLATION_DIR/lib
else
- echo "using gcc : arm64-v8a : aarch64-linux-android-g++ ;" >> project-config.jam
- export PATH=$PATH:${NDK}/toolchains/aarch64-4.9/prebuilt/${OS}-${ARCH}/bin
+ PATH=$TOOLCHAIN/bin:$PATH ./b2 toolset=clang-x86_64 link=static threading=multi threadapi=pthread target-os=android --with-system --with-filesystem --with-regex abi=aapcs binary-format=elf define=BOOST_MATH_DISABLE_FLOAT128 --prefix=$PREFIX install
+ cp -rf $PREFIX/include/boost $INSTALLATION_DIR/include
+ PATH=$TOOLCHAIN/bin:$PATH x86_64-linux-android-ranlib $PREFIX/lib/*
+ cp -rf $PREFIX/lib/* $INSTALLATION_DIR/lib
fi
- echo "option.set keep-going : false ;" >> project-config.jam
- echo "before compile"
- bash ${BASE_DIR}/scripts/build-boost.sh
- echo "after compile"
- fi
- echo "Copy boost libs in workspace"
- cp -rf install_boost/include/* ${INSTALLATION_DIR}/include/
- cp -rf install_boost/lib/* ${INSTALLATION_DIR}/lib/
- cd ..
-fi
-
-echo "Create libevent"
-
-if [ ! -d ${INSTALLATION_DIR}/include/event2 ]; then
- if [ ! -d libevent ]; then
- git clone -b nougat-release https://android.googlesource.com/platform/external/libevent
- fi
- cd libevent
- cp -rf ../libevent_files/* .
- ${NDK}/ndk-build NDK_APPLICATION_MK=`pwd`/Application.mk
- echo "Copy libevent in workspace"
- cp -rf include/event2 ${INSTALLATION_DIR}/include/
- cp -rf android/event2/* ${INSTALLATION_DIR}/include/event2/
- cp -f obj/local/${ABI}/libevent.a ${INSTALLATION_DIR}/lib/
- cd ..
-fi
-
-echo "Create libdash dependencies"
-
-if [ ! -d ${INSTALLATION_DIR}/include/curl ]; then
- cd libcurl_android
- ${NDK}/ndk-build
- echo "Copy libcurl in workspace"
- cp -rf jni/libcurl/include/curl ${INSTALLATION_DIR}/include/
- cp -f obj/local/${ABI}/libcurl*.a ${INSTALLATION_DIR}/lib/
- cd ..
-fi
-
-if [ ! -d ${INSTALLATION_DIR}/include/libxml ]; then
- if [ ! -d libxml2 ]; then
- git clone git://git.gnome.org/libxml2
+
+
fi
- cd libxml2
- mkdir -p ../libxml2_android/jni/libxml2/include/libxml
- find . -maxdepth 1 -name "*.[c|h]" -exec cp {} ../libxml2_android/jni/libxml2/ \;
- cp -rf include/libxml ../libxml2_android/jni/libxml2/include/
- cp -rf include/win32config.h ../libxml2_android/jni/libxml2/include/
- cp -rf include/wsockcompat.h ../libxml2_android/jni/libxml2/include/
- cp -rf ../libxml2_files/config.h ../libxml2_android/jni/
- cp -rf ../libxml2_files/xmlversion.h ../libxml2_android/jni/libxml2/include/libxml
- cd ..
- echo `pwd`
- cd libxml2_android
- ${NDK}/ndk-build
- echo "Copy libxml2 in workspace"
- cp -rf jni/libxml2/include/* ${INSTALLATION_DIR}/include/
- cp -f obj/local/${ABI}/libxml2.a ${INSTALLATION_DIR}/lib/
- cd ..
-fi
-
-cd ..
+fi \ No newline at end of file