TubeLab-App-Android/frostwire-jlibtorrent/.travis.yml

260 lines
13 KiB
YAML
Raw Normal View History

2021-02-01 18:38:49 +01:00
language: cpp
dist: eoan
matrix:
include:
- env: os_build=android os_arch=arm android_api=19
- env: os_build=android os_arch=arm64 android_api=21
- env: os_build=android os_arch=x86 android_api=19
- env: os_build=android os_arch=x86_64 android_api=21
- env: os_build=linux os_arch=x86
- env: os_build=linux os_arch=x86_64
- env: os_build=windows os_arch=x86
- env: os_build=windows os_arch=x86_64
- os: osx
env: os_build=macosx os_arch=x86_64
osx_image: xcode11.2
branches:
only:
- master
before_install:
- wget -nv -O boost.zip https://dl.bintray.com/boostorg/release/1.73.0/source/boost_1_73_0.zip
- unzip -qq boost.zip
- cd boost_1_73_0
- ls -lth
- ./bootstrap.sh
- ./b2
- cd ..
- export BOOST_ROOT=$PWD/boost_1_73_0
- export BOOST_BUILD_PATH=$BOOST_ROOT
# openssl: download
- wget -nv -O openssl.tar.gz https://www.openssl.org/source/openssl-1.1.1i.tar.gz
- tar xzf openssl.tar.gz
- export OPENSSL_SOURCE=$PWD/openssl-1.1.1i
# fix source code
# avoid GDI dependency in windows, fix double return statement on threads_none.c
- if [ $os_build == "windows" ]; then
sed -i 's/if defined(_WIN32_WINNT) && _WIN32_WINNT>=0x0333/if 0/g' $OPENSSL_SOURCE/crypto/cryptlib.c;
sed -i 's/MessageBox.*//g' $OPENSSL_SOURCE/crypto/cryptlib.c;
sed -i 's/return return 0;/return 0;/g' $OPENSSL_SOURCE/crypto/threads_none.c;
fi
# libtorrent: download and checkout revision
- git clone https://github.com/arvidn/libtorrent
- cd libtorrent
- git checkout 77172672c8db2f6bcef17d867d9a81faae77ec1e
- git submodule init
- git submodule update
- cd ..
- export LIBTORRENT_ROOT=$PWD/libtorrent
# android ndk: download and create toolchain
- if [ $os_build == "android" ]; then
wget -nv -O android-ndk.zip https://dl.google.com/android/repository/android-ndk-r21d-linux-x86_64.zip;
echo "Extracting NDK...wait";
unzip -qq android-ndk.zip;
export NDK=$PWD/android-ndk-r21d;
$NDK/build/tools/make_standalone_toolchain.py --arch $os_arch --api $android_api --stl libc++ --install-dir android-toolchain;
export ANDROID_TOOLCHAIN=$PWD/android-toolchain;
fi
- if [[ $os_build == "linux" || $os_build == "windows" ]]; then
sudo apt-get install -qq g++-7 g++-7-multilib;
fi
- if [[ $os_build == "linux" && $os_arch == "x86" ]]; then
sudo apt-get install -qq libc6-dev-i386;
sudo apt-get install -qq lib32gcc-5-dev;
sudo apt-get install -qq lib32stdc++-5-dev;
sudo ln -s /usr/include/asm-generic /usr/include/asm;
fi
# linux cross compilation tools for windows development
# remove files related to libwinpthread dll
- if [[ $os_build == "windows" && $os_arch == "x86" ]]; then
sudo apt-get install -qq g++-mingw-w64-i686;
fi
- if [[ $os_build == "windows" && $os_arch == "x86_64" ]]; then
sudo apt-get install -qq g++-mingw-w64-x86-64;
fi
# install gradle in macOS to run the unit tests
- if [ $os_build == "macosx" ]; then
brew update > /dev/null && brew install gradle;
fi
# openssl
- 'export OPENSSL_NO_OPTS="no-afalgeng no-async no-autoalginit no-autoerrinit
no-capieng no-cms no-comp no-deprecated no-dgram no-dso no-dtls
no-dynamic-engine no-egd no-engine no-err no-filenames no-gost no-hw
no-makedepend no-multiblock no-nextprotoneg no-posix-io no-psk
no-rdrand no-sctp no-shared no-sock no-srp no-srtp no-static-engine
no-stdio no-threads no-ui-console no-zlib no-zlib-dynamic
-fno-strict-aliasing -fvisibility=hidden -Os"'
# android-arm
- if [[ $os_build == "android" && $os_arch == "arm" ]]; then
export CC=$ANDROID_TOOLCHAIN/bin/arm-linux-androideabi-clang;
export run_openssl_configure="./Configure linux-armv4 ${OPENSSL_NO_OPTS} -march=armv7-a -mfpu=neon -fPIC --prefix=$OPENSSL_SOURCE/../openssl";
fi
# android-arm64
- if [[ $os_build == "android" && $os_arch == "arm64" ]]; then
export CC=$ANDROID_TOOLCHAIN/bin/aarch64-linux-android-clang;
export run_openssl_configure="./Configure linux-aarch64 ${OPENSSL_NO_OPTS} -march=armv8-a+crypto -fPIC --prefix=$OPENSSL_SOURCE/../openssl";
fi
# android-x86
- if [[ $os_build == "android" && $os_arch == "x86" ]]; then
export CC=$ANDROID_TOOLCHAIN/bin/i686-linux-android-clang;
export run_openssl_configure="./Configure linux-elf ${OPENSSL_NO_OPTS} -fPIC -mstackrealign --prefix=$OPENSSL_SOURCE/../openssl";
fi
# android-x86_64
- if [[ $os_build == "android" && $os_arch == "x86_64" ]]; then
export CC=$ANDROID_TOOLCHAIN/bin/x86_64-linux-android-clang;
export run_openssl_configure="./Configure linux-x86_64 ${OPENSSL_NO_OPTS} -fPIC --prefix=$OPENSSL_SOURCE/../openssl";
fi
# linux-x86
- if [[ $os_build == "linux" && $os_arch == "x86" ]]; then
export CC=gcc-7;
export run_openssl_configure="./Configure linux-elf ${OPENSSL_NO_OPTS} -fPIC -m32 --prefix=$OPENSSL_SOURCE/../openssl";
fi
# linux-x86_64
- if [[ $os_build == "linux" && $os_arch == "x86_64" ]]; then
export CC=gcc-7;
export run_openssl_configure="./Configure linux-x86_64 ${OPENSSL_NO_OPTS} -fPIC --prefix=$OPENSSL_SOURCE/../openssl";
fi
# windows-x86
- if [[ $os_build == "windows" && $os_arch == "x86" ]]; then
export CC=i686-w64-mingw32-gcc-posix;
export run_openssl_configure="./Configure mingw ${OPENSSL_NO_OPTS} --prefix=$OPENSSL_SOURCE/../openssl";
fi
# windows-x86_64
- if [[ $os_build == "windows" && $os_arch == "x86_64" ]]; then
export CC=x86_64-w64-mingw32-gcc-posix;
export run_openssl_configure="./Configure mingw64 ${OPENSSL_NO_OPTS} --prefix=$OPENSSL_SOURCE/../openssl";
fi
# macosx
- if [ $os_build == "macosx" ]; then
export run_openssl_configure="./Configure darwin64-x86_64-cc ${OPENSSL_NO_OPTS} --prefix=$OPENSSL_SOURCE/../openssl";
fi
# jlibtorrent
# android-arm
- if [[ $os_build == "android" && $os_arch == "arm" ]]; then
export run_bjam="${BOOST_ROOT}/b2 --user-config=config/android-arm-config.jam variant=release toolset=clang-linux-arm target-os=android location=bin/release/android/armeabi-v7a";
export run_objcopy="${ANDROID_TOOLCHAIN}/bin/arm-linux-androideabi-objcopy --only-keep-debug bin/release/android/armeabi-v7a/libjlibtorrent.so bin/release/android/armeabi-v7a/libjlibtorrent.so.debug";
export run_strip="${ANDROID_TOOLCHAIN}/bin/arm-linux-androideabi-strip --strip-unneeded -x -g bin/release/android/armeabi-v7a/libjlibtorrent.so";
export run_readelf="${ANDROID_TOOLCHAIN}/bin/arm-linux-androideabi-readelf -d bin/release/android/armeabi-v7a/libjlibtorrent.so";
export PATH=$ANDROID_TOOLCHAIN/arm-linux-androideabi/bin:$PATH;
sed -i 's/RANLIB = ranlib/RANLIB = "${ANDROID_TOOLCHAIN}\/bin\/arm-linux-androideabi-ranlib"/g' ${BOOST_ROOT}/tools/build/src/tools/gcc.jam;
fi
# android-arm64
- if [[ $os_build == "android" && $os_arch == "arm64" ]]; then
export run_bjam="${BOOST_ROOT}/b2 --user-config=config/android-arm64-config.jam variant=release toolset=clang-arm64 target-os=android location=bin/release/android/arm64-v8a";
export run_objcopy="${ANDROID_TOOLCHAIN}/bin/aarch64-linux-android-objcopy --only-keep-debug bin/release/android/arm64-v8a/libjlibtorrent.so bin/release/android/arm64-v8a/libjlibtorrent.so.debug";
export run_strip="${ANDROID_TOOLCHAIN}/bin/aarch64-linux-android-strip --strip-unneeded -x bin/release/android/arm64-v8a/libjlibtorrent.so";
export run_readelf="${ANDROID_TOOLCHAIN}/bin/aarch64-linux-android-readelf -d bin/release/android/arm64-v8a/libjlibtorrent.so";
export PATH=$ANDROID_TOOLCHAIN/aarch64-linux-android/bin:$PATH;
sed -i 's/RANLIB = ranlib/RANLIB = "${ANDROID_TOOLCHAIN}\/bin\/aarch64-linux-android-ranlib"/g' ${BOOST_ROOT}/tools/build/src/tools/gcc.jam;
fi
# android-x86
- if [[ $os_build == "android" && $os_arch == "x86" ]]; then
export run_bjam="${BOOST_ROOT}/b2 --user-config=config/android-x86-config.jam variant=release toolset=clang-x86 target-os=android location=bin/release/android/x86";
export run_objcopy="${ANDROID_TOOLCHAIN}/bin/i686-linux-android-objcopy --only-keep-debug bin/release/android/x86/libjlibtorrent.so bin/release/android/x86/libjlibtorrent.so.debug";
export run_strip="${ANDROID_TOOLCHAIN}/bin/i686-linux-android-strip --strip-unneeded -x -g bin/release/android/x86/libjlibtorrent.so";
export run_readelf="${ANDROID_TOOLCHAIN}/bin/i686-linux-android-readelf -d bin/release/android/x86/libjlibtorrent.so";
export PATH=$ANDROID_TOOLCHAIN/i686-linux-android/bin:$PATH;
sed -i 's/RANLIB = ranlib/RANLIB = "${ANDROID_TOOLCHAIN}\/bin\/i686-linux-android-ranlib"/g' ${BOOST_ROOT}/tools/build/src/tools/gcc.jam;
fi
# android-x86_64
- if [[ $os_build == "android" && $os_arch == "x86_64" ]]; then
export run_bjam="${BOOST_ROOT}/b2 --user-config=config/android-x86_64-config.jam variant=release toolset=clang-x86_64 target-os=android location=bin/release/android/x86_64";
export run_objcopy="${ANDROID_TOOLCHAIN}/bin/x86_64-linux-android-objcopy --only-keep-debug bin/release/android/x86_64/libjlibtorrent.so bin/release/android/x86_64/libjlibtorrent.so.debug";
export run_strip="${ANDROID_TOOLCHAIN}/bin/x86_64-linux-android-strip --strip-unneeded -x bin/release/android/x86_64/libjlibtorrent.so";
export run_readelf="${ANDROID_TOOLCHAIN}/bin/x86_64-linux-android-readelf -d bin/release/android/x86_64/libjlibtorrent.so";
export PATH=$ANDROID_TOOLCHAIN/x86_64-linux-android/bin:$PATH;
sed -i 's/RANLIB = ranlib/RANLIB = "${ANDROID_TOOLCHAIN}\/bin\/x86_64-linux-android-ranlib"/g' ${BOOST_ROOT}/tools/build/src/tools/gcc.jam;
fi
# linux-x86
- if [[ $os_build == "linux" && $os_arch == "x86" ]]; then
export run_bjam="${BOOST_ROOT}/b2 --user-config=config/linux-x86-config.jam variant=release toolset=gcc-x86 target-os=linux location=bin/release/linux/x86";
export run_objcopy="objcopy --only-keep-debug bin/release/linux/x86/libjlibtorrent.so bin/release/linux/x86/libjlibtorrent.so.debug";
export run_strip="strip --strip-unneeded -x bin/release/linux/x86/libjlibtorrent.so";
export run_readelf="readelf -d bin/release/linux/x86/libjlibtorrent.so";
fi
# linux-x86_64
- if [[ $os_build == "linux" && $os_arch == "x86_64" ]]; then
export run_bjam="${BOOST_ROOT}/b2 --user-config=config/linux-x86_64-config.jam variant=release toolset=gcc-x86_64 target-os=linux location=bin/release/linux/x86_64";
export run_objcopy="objcopy --only-keep-debug bin/release/linux/x86_64/libjlibtorrent.so bin/release/linux/x86_64/libjlibtorrent.so.debug";
export run_strip="strip --strip-unneeded -x bin/release/linux/x86_64/libjlibtorrent.so";
export run_readelf="readelf -d bin/release/linux/x86_64/libjlibtorrent.so";
fi
# windows-x86
- if [[ $os_build == "windows" && $os_arch == "x86" ]]; then
sed -i 's/ JNICALL Java_com_frostwire/ JNICALL _Java_com_frostwire/g' swig/libtorrent_jni.cpp;
export run_bjam="${BOOST_ROOT}/b2 --user-config=config/windows-x86-config.jam variant=release toolset=gcc-x86 target-os=windows location=bin/release/windows/x86";
export run_strip="i686-w64-mingw32-strip --strip-unneeded -x bin/release/windows/x86/libjlibtorrent.dll";
export run_readelf="eval objdump -p bin/release/windows/x86/jlibtorrent.dll | grep DLL";
fi
# windows-x86_64
- if [[ $os_build == "windows" && $os_arch == "x86_64" ]]; then
export run_bjam="${BOOST_ROOT}/b2 --user-config=config/windows-x86_64-config.jam variant=release toolset=gcc-x86_64 target-os=windows location=bin/release/windows/x86_64";
export run_strip="x86_64-w64-mingw32-strip --strip-unneeded -x bin/release/windows/x86_64/libjlibtorrent.dll";
export run_readelf="eval objdump -p bin/release/windows/x86_64/jlibtorrent.dll | grep DLL";
fi
# macosx
- if [ $os_build == "macosx" ]; then
export run_bjam="${BOOST_ROOT}/b2 --user-config=config/macosx-x86_64-config.jam variant=release toolset=darwin-x86_64 target-os=darwin location=bin/release/macosx/x86_64";
export run_strip="strip -S -x bin/release/macosx/x86_64/libjlibtorrent.dylib";
export run_readelf="otool -L bin/release/macosx/x86_64/libjlibtorrent.dylib";
fi
script:
- cd $OPENSSL_SOURCE
- $run_openssl_configure
- echo "Compiling openssl...(remove &> /dev/null to see output)"
- make #&> /dev/null
- make install_sw &> /dev/null
- cd ..
- export OPENSSL_ROOT=$PWD/openssl
- cd swig
- $run_bjam
- $run_objcopy
- $run_strip
- if [[ $os_build == "windows" && $os_arch == "x86" ]]; then
mv bin/release/windows/x86/libjlibtorrent.dll bin/release/windows/x86/jlibtorrent.dll;
fi
- if [[ $os_build == "windows" && $os_arch == "x86_64" ]]; then
mv bin/release/windows/x86_64/libjlibtorrent.dll bin/release/windows/x86_64/jlibtorrent.dll;
fi
- if [ $os_build == "macosx" ]; then
cd ..;
cp swig/bin/release/macosx/x86_64/libjlibtorrent.dylib .;
gradle test;
cd swig;
fi
- $run_readelf
- cd ..
before_deploy:
- if [ -d swig/bin ]; then
cd swig/bin;
find . -type f | egrep -v '.*\.so$|.*\.dll$|.*\.dylib$|.*\.debug$' | xargs rm;
find . -empty -type d | xargs rm -r;
fi
- cd ../..
deploy:
provider: s3
access_key_id: $S3_ACCESS_KEY
secret_access_key: $S3_SECRET_KEY
bucket: $S3_BUCKET
skip_cleanup: true
local_dir: swig/bin
on:
all_branches: true