Update build.sh, linux.sh, and win.sh
This commit is contained in:
parent
c80db14499
commit
e8ef6a2fe5
2
build.sh
2
build.sh
@ -17,8 +17,6 @@ echo "TD_BIN_DIR=${TD_BIN_DIR}"
|
|||||||
echo "JAVA_SRC_DIR=${JAVA_SRC_DIR}"
|
echo "JAVA_SRC_DIR=${JAVA_SRC_DIR}"
|
||||||
|
|
||||||
# ====== Cleanup
|
# ====== Cleanup
|
||||||
rm $JAVA_SRC_DIR/it/tdlight/tdnatives/TdApi.java || true
|
|
||||||
rm $JAVA_SRC_DIR/it/tdlight/tdnatives/new_TdApi.java || true
|
|
||||||
|
|
||||||
# ====== Environment setup
|
# ====== Environment setup
|
||||||
mkdir $TD_BUILD_DIR || true
|
mkdir $TD_BUILD_DIR || true
|
||||||
|
@ -1,10 +1,27 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
mkdir $TRAVIS_BUILD_DIR/out
|
# ====== Variables
|
||||||
cd src/main/jni
|
export TD_SRC_DIR=${PWD}/dependencies/tdlight
|
||||||
|
export TD_BIN_DIR=${PWD}/bin-td
|
||||||
|
export TDNATIVES_BIN_DIR=${PWD}/bin-tdnatives
|
||||||
|
export TDNATIVES_CPP_SRC_DIR=${PWD}/src/tdnatives-cpp
|
||||||
|
export TDNATIVES_DOCS_BIN_DIR=${PWD}/bin-docs
|
||||||
|
export TD_BUILD_DIR=${PWD}/build-td
|
||||||
|
export TDNATIVES_CPP_BUILD_DIR=${PWD}/build-tdnatives
|
||||||
|
export JAVA_SRC_DIR=${PWD}/src/tdnatives-java
|
||||||
|
export TDLIB_SERIALIZER_DIR=${PWD}/dependencies/tdlib-serializer
|
||||||
|
|
||||||
sudo apt install openjdk-11-jdk-headless
|
# ====== Print variables
|
||||||
|
echo "TD_SRC_DIR=${TD_SRC_DIR}"
|
||||||
|
echo "TD_BIN_DIR=${TD_BIN_DIR}"
|
||||||
|
echo "JAVA_SRC_DIR=${JAVA_SRC_DIR}"
|
||||||
|
|
||||||
|
# ====== Environment setup
|
||||||
|
mkdir $TD_BUILD_DIR || true
|
||||||
|
mkdir $TDNATIVES_CPP_BUILD_DIR || true
|
||||||
|
|
||||||
|
# Install java and fix java paths
|
||||||
|
sudo apt install --reinstall openjdk-11-jdk-headless
|
||||||
if [ "$TRAVIS_CPU_ARCH" = "arm64" ]; then
|
if [ "$TRAVIS_CPU_ARCH" = "arm64" ]; then
|
||||||
export TRAVIS_CPU_ARCH_STANDARD="aarch64"
|
export TRAVIS_CPU_ARCH_STANDARD="aarch64"
|
||||||
else
|
else
|
||||||
@ -15,33 +32,14 @@ export PATH="$PATH:/usr/lib/jvm/java-11-openjdk-$TRAVIS_OS_NAME_STANDARD/bin"
|
|||||||
export JAVA_HOME="/usr/lib/jvm/java-11-openjdk-$TRAVIS_OS_NAME_STANDARD"
|
export JAVA_HOME="/usr/lib/jvm/java-11-openjdk-$TRAVIS_OS_NAME_STANDARD"
|
||||||
export JAVA_INCLUDE_PATH="/usr/lib/jvm/java-11-openjdk-$TRAVIS_OS_NAME_STANDARD/include"
|
export JAVA_INCLUDE_PATH="/usr/lib/jvm/java-11-openjdk-$TRAVIS_OS_NAME_STANDARD/include"
|
||||||
|
|
||||||
export TD_SRC_DIR=${PWD}/td
|
# ====== Build Td
|
||||||
export TD_BIN_DIR=${PWD}/jtdlib/td
|
cd $TD_BUILD_DIR
|
||||||
export JAVA_SRC_DIR=$(dirname `pwd`)/java
|
|
||||||
cd jtdlib
|
|
||||||
mkdir jnibuild || true
|
|
||||||
mkdir build || true
|
|
||||||
echo "TD_SRC_DIR=${TD_SRC_DIR}"
|
|
||||||
echo "TD_BIN_DIR=${TD_BIN_DIR}"
|
|
||||||
echo "JAVA_SRC_DIR=${JAVA_SRC_DIR}"
|
|
||||||
cd jnibuild
|
|
||||||
#export OPENSSL_ROOT_DIR=/snap/gitkraken/143/lib/x86_64-linux-gnu
|
|
||||||
#export JAVA_HOME=/usr/lib/jvm/java-1.13.0-openjdk-amd64
|
|
||||||
#export JAVA_INCLUDE_PATH=/usr/lib/jvm/java-1.13.0-openjdk-amd64/include/
|
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release -DTD_ENABLE_JNI=ON -DCMAKE_INSTALL_PREFIX:PATH=${TD_BIN_DIR} ${TD_SRC_DIR}
|
cmake -DCMAKE_BUILD_TYPE=Release -DTD_ENABLE_JNI=ON -DCMAKE_INSTALL_PREFIX:PATH=${TD_BIN_DIR} ${TD_SRC_DIR}
|
||||||
cmake --build . --target install -- -j3
|
cmake --build $TD_BUILD_DIR --target install -- -j3
|
||||||
|
|
||||||
cd ../../../../../
|
# ====== Build TdNatives
|
||||||
#mvn install -X
|
cd $TDNATIVES_CPP_BUILD_DIR
|
||||||
|
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
|
||||||
|
cmake --build $TDNATIVES_CPP_BUILD_DIR --target install -- -j3
|
||||||
|
|
||||||
cd src/main/jni/jtdlib/build
|
mv $TDNATIVES_BIN_DIR/libtdjni.so $TRAVIS_BUILD_DIR/out
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release -DTd_DIR=${TD_BIN_DIR}/lib/cmake/Td -DJAVA_SRC_DIR=${JAVA_SRC_DIR} -DCMAKE_INSTALL_PREFIX:PATH=.. ..
|
|
||||||
cmake --build . --target install -- -j3
|
|
||||||
cd ..
|
|
||||||
#rm -r jnibuild
|
|
||||||
#rm -r build
|
|
||||||
rm -r td
|
|
||||||
[ -e ../bin ] && rm -r ../bin
|
|
||||||
mkdir ../bin
|
|
||||||
mv docs ../bin
|
|
||||||
mv bin/libtdjni.so $TRAVIS_BUILD_DIR/out
|
|
||||||
|
@ -1,78 +1,55 @@
|
|||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
mkdir $TRAVIS_BUILD_DIR/out
|
# ====== Variables
|
||||||
|
export TD_SRC_DIR=${PWD}/dependencies/tdlight
|
||||||
|
export TD_BIN_DIR=${PWD}/bin-td
|
||||||
|
export TDNATIVES_BIN_DIR=${PWD}/bin-tdnatives
|
||||||
|
export TDNATIVES_CPP_SRC_DIR=${PWD}/src/tdnatives-cpp
|
||||||
|
export TDNATIVES_DOCS_BIN_DIR=${PWD}/bin-docs
|
||||||
|
export TD_BUILD_DIR=${PWD}/build-td
|
||||||
|
export TDNATIVES_CPP_BUILD_DIR=${PWD}/build-tdnatives
|
||||||
|
export JAVA_SRC_DIR=${PWD}/src/tdnatives-java
|
||||||
|
export TDLIB_SERIALIZER_DIR=${PWD}/dependencies/tdlib-serializer
|
||||||
|
|
||||||
# Setup variables
|
# ====== Print variables
|
||||||
|
echo "TD_SRC_DIR=${TD_SRC_DIR}"
|
||||||
|
echo "TD_BIN_DIR=${TD_BIN_DIR}"
|
||||||
|
echo "JAVA_SRC_DIR=${JAVA_SRC_DIR}"
|
||||||
|
|
||||||
|
# ====== OS Variables
|
||||||
export PATH="$PATH:/c/Program Files/OpenJDK/openjdk-11.0.8_10/bin:/c/ProgramData/chocolatey/lib/maven/apache-maven-3.6.3/bin:/c/ProgramData/chocolatey/lib/base64/tools"
|
export PATH="$PATH:/c/Program Files/OpenJDK/openjdk-11.0.8_10/bin:/c/ProgramData/chocolatey/lib/maven/apache-maven-3.6.3/bin:/c/ProgramData/chocolatey/lib/base64/tools"
|
||||||
export JAVA_HOME="/c/Program Files/OpenJDK/openjdk-11.0.8_10"
|
export JAVA_HOME="/c/Program Files/OpenJDK/openjdk-11.0.8_10"
|
||||||
# End setup variables
|
|
||||||
|
|
||||||
# Build deps
|
# ====== Cleanup
|
||||||
|
rm $JAVA_SRC_DIR/it/tdlight/tdnatives/TdApi.java || true
|
||||||
|
rm $JAVA_SRC_DIR/it/tdlight/tdnatives/new_TdApi.java || true
|
||||||
|
|
||||||
|
# ====== Environment setup
|
||||||
|
mkdir $TRAVIS_BUILD_DIR/out
|
||||||
|
mkdir $TD_BUILD_DIR || true
|
||||||
|
mkdir $TDNATIVES_CPP_BUILD_DIR || true
|
||||||
choco install openjdk11 --version=11.0.8.10
|
choco install openjdk11 --version=11.0.8.10
|
||||||
choco install maven --version=3.6.3
|
choco install maven --version=3.6.3
|
||||||
choco install base64
|
choco install base64
|
||||||
choco install gperf
|
choco install gperf
|
||||||
choco install strawberryperl
|
choco install strawberryperl
|
||||||
|
|
||||||
|
# Install OpenSSL and ZLib
|
||||||
cd $TRAVIS_BUILD_DIR
|
cd $TRAVIS_BUILD_DIR
|
||||||
git clone https://github.com/Microsoft/vcpkg.git
|
git clone https://github.com/Microsoft/vcpkg.git
|
||||||
cd vcpkg
|
cd vcpkg
|
||||||
./bootstrap-vcpkg.bat
|
./bootstrap-vcpkg.bat
|
||||||
travis_wait 30 ./vcpkg.exe install openssl:x64-windows zlib:x64-windows
|
./vcpkg.exe install openssl:x64-windows zlib:x64-windows
|
||||||
cd ..
|
|
||||||
|
|
||||||
# openssl
|
# ====== Build Td
|
||||||
mkdir $TRAVIS_BUILD_DIR/openssl-root
|
cd $TD_BUILD_DIR
|
||||||
git clone https://github.com/openssl/openssl.git -b OpenSSL_1_1_1-stable
|
cmake -A x64 -DCMAKE_BUILD_TYPE=Release -DTD_ENABLE_JNI=ON -DCMAKE_INSTALL_PREFIX:PATH=${TD_BIN_DIR} -DCMAKE_TOOLCHAIN_FILE:FILEPATH=$TRAVIS_BUILD_DIR\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake ${TD_SRC_DIR}
|
||||||
cd openssl
|
cmake --build $TD_BUILD_DIR --target install
|
||||||
perl Configure enable-static-engine enable-capieng no-ssl2 -utf-8 VC-WIN64A --prefix=$TRAVIS_BUILD_DIR/openssl-root --openssldir=$TRAVIS_BUILD_DIR/openssl-root no-shared
|
|
||||||
nmake
|
|
||||||
nmake install
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
# zlib
|
# ====== Build TdNatives
|
||||||
mkdir $TRAVIS_BUILD_DIR/zlib-root
|
cd $TDNATIVES_CPP_BUILD_DIR
|
||||||
git clone https://github.com/madler/zlib.git -b v1.2.11
|
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=$TRAVIS_BUILD_DIR\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake $TDNATIVES_CPP_SRC_DIR
|
||||||
cd zlib
|
cmake --build $TDNATIVES_CPP_BUILD_DIR --target install
|
||||||
cmake -DCMAKE_INSTALL_PREFIX:PATH=$TRAVIS_BUILD_DIR/zlib-root -DSKIP_BUILD_EXAMPLES=ON .
|
|
||||||
cmake --build . --target install
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
ls $TRAVIS_BUILD_DIR/openssl-root
|
# ====== Copy output
|
||||||
ls $TRAVIS_BUILD_DIR/zlib-root
|
mv $TDNATIVES_BIN_DIR/libtdjni.dll $TRAVIS_BUILD_DIR/out
|
||||||
|
|
||||||
# Dirs
|
|
||||||
cd src/main/jni
|
|
||||||
|
|
||||||
export TD_SRC_DIR=${PWD}/td
|
|
||||||
export TD_BIN_DIR=${PWD}/jtdlib/td
|
|
||||||
export JAVA_SRC_DIR=$(dirname `pwd`)/java
|
|
||||||
cd jtdlib
|
|
||||||
mkdir build
|
|
||||||
mkdir jnibuild
|
|
||||||
echo "TD_SRC_DIR=${TD_SRC_DIR}"
|
|
||||||
echo "TD_BIN_DIR=${TD_BIN_DIR}"
|
|
||||||
echo "JAVA_SRC_DIR=${JAVA_SRC_DIR}"
|
|
||||||
cd jnibuild
|
|
||||||
|
|
||||||
# Setup env
|
|
||||||
export JAVA_HOME="C:\\Program Files\\OpenJDK\\openjdk-11.0.8_10"
|
|
||||||
|
|
||||||
# Build
|
|
||||||
cmake -A x64 -DCMAKE_BUILD_TYPE=Release -DTD_ENABLE_JNI=ON -DCMAKE_INSTALL_PREFIX:PATH=${TD_BIN_DIR} -DCMAKE_TOOLCHAIN_FILE:FILEPATH=$TRAVIS_BUILD_DIR\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake ${TD_SRC_DIR}
|
|
||||||
cmake --build . --target install
|
|
||||||
|
|
||||||
|
|
||||||
cd ../../../../../
|
|
||||||
#mvn install -X
|
|
||||||
|
|
||||||
cd src/main/jni/jtdlib/build
|
|
||||||
cmake -A x64 -DCMAKE_BUILD_TYPE=Release -DTd_DIR=${TD_BIN_DIR}/lib/cmake/Td -DJAVA_SRC_DIR=${JAVA_SRC_DIR} -DCMAKE_INSTALL_PREFIX:PATH=.. -DCMAKE_TOOLCHAIN_FILE:FILEPATH=$TRAVIS_BUILD_DIR\\vcpkg\\scripts\\buildsystems\\vcpkg.cmake ..
|
|
||||||
cmake --build . --target install
|
|
||||||
|
|
||||||
cd ..
|
|
||||||
rm -r td
|
|
||||||
|
|
||||||
|
|
||||||
# Copy artifacts
|
|
||||||
cp bin/libtdjni.dll $TRAVIS_BUILD_DIR/out
|
|
||||||
|
Loading…
Reference in New Issue
Block a user