1
0
tdlight-java-natives-linux-.../jenkins/scripts/compile.sh
2020-10-04 16:51:00 +02:00

77 lines
4.2 KiB
Bash
Executable File

#!/bin/bash -e
set -e
# ====== Setup environment variables
source ./jenkins/scripts/setup_variables.sh
# ====== Setup workspace
bash ./jenkins/scripts/setup_workspace.sh
# ====== Build Td
echo "JAVA_INCLUDE_PATH:$JAVA_INCLUDE_PATH"
ls -alch $JAVA_INCLUDE_PATH
echo "JAVA_INCLUDE_PATH2:$JAVA_INCLUDE_PATH2"
ls -alch $JAVA_INCLUDE_PATH2
echo "JAVA_AWT_INCLUDE_PATH:$JAVA_AWT_INCLUDE_PATH"
ls -alch $JAVA_AWT_INCLUDE_PATH
# Prepare build
cd $TD_BUILD_DIR
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
nice -n 5 cmake -DCMAKE_BUILD_TYPE=Release -DTD_ENABLE_JNI=ON -DCMAKE_INSTALL_PREFIX:PATH=${TD_BIN_DIR} -DTD_SKIP_BENCHMARK=ON -DTD_SKIP_TEST=OFF -DTD_SKIP_TG_CLI=ON ${TD_SRC_DIR}
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
nice -n 5 cmake -DCMAKE_BUILD_TYPE=Release -DTD_ENABLE_JNI=ON -DCMAKE_INSTALL_PREFIX:PATH=${TD_BIN_DIR} -DTD_SKIP_BENCHMARK=ON -DTD_SKIP_TEST=OFF -DTD_SKIP_TG_CLI=ON -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl/ ${TD_SRC_DIR}
elif [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
nice -n 5 cmake -A x64 -DCMAKE_BUILD_TYPE=Release -DTD_ENABLE_JNI=ON -DCMAKE_INSTALL_PREFIX:PATH=${TD_BIN_DIR} -DTD_SKIP_BENCHMARK=ON -DTD_SKIP_TEST=OFF -DTD_SKIP_TG_CLI=ON -DCMAKE_TOOLCHAIN_FILE:FILEPATH=$VCPKG_DIR/scripts/buildsystems/vcpkg.cmake ${TD_SRC_DIR}
fi
if [ "$TRAVIS_CPU_ARCH" = "arm64" ]; then
while true; do free -h ; sleep 2; done &
fi
# Split sources
#if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
# cmake --build $TD_BUILD_DIR --target prepare_cross_compiling -- -j${TRAVIS_CPU_CORES}
# cd $TD_SRC_DIR
# php SplitSource.php
#fi
# Build
cd $TD_BUILD_DIR
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
nice -n 5 cmake --build $TD_BUILD_DIR --target install --config Release -- -j${TRAVIS_CPU_CORES}
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
nice -n 5 cmake --build $TD_BUILD_DIR --target install --config Release -- -j${TRAVIS_CPU_CORES}
elif [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
nice -n 5 cmake --build $TD_BUILD_DIR --target install --config Release -- -m
fi
# Undo split-sources
#if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
# cd $TD_SRC_DIR
# php SplitSource.php --undo
#fi
# ====== Build TdNatives
cd $TDNATIVES_CPP_BUILD_DIR
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
nice -n 5 cmake -DCMAKE_BUILD_TYPE=Release -DTD_BIN_DIR=${TD_BIN_DIR} -DTDNATIVES_BIN_DIR=${TDNATIVES_BIN_DIR} -DTDNATIVES_DOCS_BIN_DIR=${TDNATIVES_DOCS_BIN_DIR} -DTd_DIR=${TD_BIN_DIR}/lib/cmake/Td -DJAVA_SRC_DIR=${JAVA_SRC_DIR} -DTDNATIVES_CPP_SRC_DIR:PATH=$TDNATIVES_CPP_SRC_DIR $TDNATIVES_CPP_SRC_DIR
nice -n 5 cmake --build $TDNATIVES_CPP_BUILD_DIR --target install --config Release -- -j${TRAVIS_CPU_CORES}
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
nice -n 5 cmake -DCMAKE_BUILD_TYPE=Release -DTD_BIN_DIR=${TD_BIN_DIR} -DTDNATIVES_BIN_DIR=${TDNATIVES_BIN_DIR} -DTDNATIVES_DOCS_BIN_DIR=${TDNATIVES_DOCS_BIN_DIR} -DTd_DIR=${TD_BIN_DIR}/lib/cmake/Td -DJAVA_SRC_DIR=${JAVA_SRC_DIR} -DTDNATIVES_CPP_SRC_DIR:PATH=$TDNATIVES_CPP_SRC_DIR $TDNATIVES_CPP_SRC_DIR
nice -n 5 cmake --build $TDNATIVES_CPP_BUILD_DIR --target install --config Release -- -j${TRAVIS_CPU_CORES}
elif [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
nice -n 5 cmake -A x64 -DCMAKE_BUILD_TYPE=Release -DTD_BIN_DIR=${TD_BIN_DIR} -DTDNATIVES_BIN_DIR=${TDNATIVES_BIN_DIR} -DTDNATIVES_DOCS_BIN_DIR=${TDNATIVES_DOCS_BIN_DIR} -DTd_DIR=${TD_BIN_DIR}/lib/cmake/Td -DJAVA_SRC_DIR=${JAVA_SRC_DIR} -DTDNATIVES_CPP_SRC_DIR:PATH=$TDNATIVES_CPP_SRC_DIR -DCMAKE_TOOLCHAIN_FILE:FILEPATH=$VCPKG_DIR/scripts/buildsystems/vcpkg.cmake $TDNATIVES_CPP_SRC_DIR
nice -n 5 cmake --build $TDNATIVES_CPP_BUILD_DIR --target install --config Release -- -m
fi
# ====== Copy output
cd $TDNATIVES_CPP_BUILD_DIR
if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
mv $TDNATIVES_BIN_DIR/$SRC_TDJNI_LIBNAME $TDLIB_RESOURCES_OUTPUT_DIR/resources/libs/$TRAVIS_OS_NAME_SHORT/$TRAVIS_CPU_ARCH_STANDARD/$DEST_TDJNI_LIBNAME
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
mv $TDNATIVES_BIN_DIR/$SRC_TDJNI_LIBNAME $TDLIB_RESOURCES_OUTPUT_DIR/resources/libs/$TRAVIS_OS_NAME_SHORT/$TRAVIS_CPU_ARCH_STANDARD/$DEST_TDJNI_LIBNAME
elif [[ "$TRAVIS_OS_NAME" == "windows" ]]; then
mv $TDNATIVES_BIN_DIR/$SRC_TDJNI_LIBNAME $TDLIB_RESOURCES_OUTPUT_DIR/resources/libs/$TRAVIS_OS_NAME_SHORT/$TRAVIS_CPU_ARCH_STANDARD/$DEST_TDJNI_LIBNAME
fi