Compare commits

...

47 Commits

Author SHA1 Message Date
Andrea Cavalli
73d66386ea Update tdlight-java 2020-10-09 21:01:28 +02:00
Andrea Cavalli
00e0a81a22 Static compilation 2020-10-09 21:00:14 +02:00
8c4b8b5727 Update 'pom.xml' 2020-10-09 10:27:42 +02:00
2d6f334f24 Update 'pom.xml' 2020-10-09 10:26:14 +02:00
3d703d7bc0 Update 'jenkins/scripts/setup_variables.sh' 2020-10-09 10:25:42 +02:00
a80c43f324 Update 'jenkins/scripts/cross_compile.sh' 2020-10-09 10:24:50 +02:00
d0d6c04c54 Update 'jenkins/scripts/setup_variables.sh' 2020-10-09 10:23:28 +02:00
1baccd90d4 Update 'Jenkinsfile' 2020-10-09 10:21:03 +02:00
Andrea Cavalli
eb104518a8 Update cross_compile.sh 2020-10-09 03:28:53 +02:00
Andrea Cavalli
f02cec5fac Update dockerfile and cross_compile.sh 2020-10-09 02:29:37 +02:00
Andrea Cavalli
48551961e8 Update cross_compile.sh 2020-10-08 20:24:45 +02:00
Andrea Cavalli
694dcbf44a Add missing libraries 2020-10-08 19:43:03 +02:00
Andrea Cavalli
7eacaa9d17 Update pom.xml 2020-10-08 12:25:36 +02:00
Andrea Cavalli
4b53d66c3c Update cross_compile.sh 2020-10-08 04:34:13 +02:00
Andrea Cavalli
9a8b3d6e82 Update dockerfile and cross_compile.sh 2020-10-08 03:44:13 +02:00
Andrea Cavalli
2d541afbd0 Update dockerfile 2020-10-08 02:46:38 +02:00
Andrea Cavalli
25bf2e6c5c Fix permissions 2020-10-08 02:25:28 +02:00
Andrea Cavalli
6ee2c6b1fb Reduce load 2020-10-08 01:49:40 +02:00
Andrea Cavalli
b32870dc56 Update cross_compile.sh 2020-10-08 01:34:48 +02:00
Andrea Cavalli
19d15fc42c Update dockerfile 2020-10-08 01:29:22 +02:00
Andrea Cavalli
20ae110c54 Update dockerfile 2020-10-08 01:27:59 +02:00
Andrea Cavalli
7d94fd59ea Update .gitmodules 2020-10-08 01:18:39 +02:00
Andrea Cavalli
9960c756c4 Update Jenkinsfile
Conflicts:
	Jenkinsfile
2020-10-08 01:07:19 +02:00
Andrea Cavalli
7451213d78 Update Jenkinsfile, dockerfile, and 6 more files... 2020-10-08 01:02:27 +02:00
Andrea Cavalli
b5f8fe0ed2 Update seedjob.groovy 2020-10-07 20:27:44 +02:00
Andrea Cavalli
7f7ccf3955 Update tdlight-java 2020-10-07 20:27:19 +02:00
Andrea Cavalli
277b7f1275 Update Jenkinsfile, deliver.sh, and 2 more files... 2020-10-03 12:00:11 +02:00
Andrea Cavalli
4b83967b7a Update .gitmodules and tdlight-java 2020-10-03 11:59:01 +02:00
Andrea Cavalli
8929cc489d Updated native library 2020-10-02 17:58:13 +00:00
Andrea Cavalli
99bb5dbcfe Updated native library 2020-09-08 15:08:02 +00:00
Andrea Cavalli
6cffda4b1c Updated native library 2020-09-05 16:01:51 +00:00
Andrea Cavalli
b5d4d1a35c Updated native library 2020-09-01 16:16:50 +00:00
Andrea Cavalli
fb957862bd Updated native library 2020-08-31 18:22:47 +00:00
Andrea Cavalli
c0884c043e Updated native library 2020-08-31 16:14:23 +00:00
Andrea Cavalli
b5261109fd Updated native library 2020-08-31 14:01:58 +00:00
Andrea Cavalli
82e8632437 Updated native library 2020-08-31 10:22:25 +00:00
Andrea Cavalli
8f93f666c0 Updated native library 2020-08-28 18:21:51 +00:00
Andrea Cavalli
3aaac77312 Updated native library 2020-08-23 20:17:55 +00:00
Andrea Cavalli
23fcdbcc2b Updated native library 2020-08-23 17:16:25 +00:00
Andrea Cavalli
b12e143e88 Updated native library 2020-08-23 12:54:02 +00:00
Andrea Cavalli
110cb3033c Update pom.xml 2020-08-23 13:34:20 +02:00
Andrea Cavalli
b1b730b1a2 Updated native library 2020-08-20 23:27:11 +02:00
Andrea Cavalli
fb45b8f925 Updated native library 2020-08-20 23:16:24 +02:00
Andrea Cavalli
15bdd268a6 Updated native library 2020-08-20 20:27:56 +00:00
Andrea Cavalli
c6456d4422 Update pom.xml 2020-08-20 22:22:46 +02:00
5d8e18d7c7 Update 'pom.xml' 2020-08-20 22:17:04 +02:00
Andrea Cavalli
e6234cb8b5 Updated native library 2020-08-20 19:44:04 +00:00
13 changed files with 566 additions and 51 deletions

3
.gitmodules vendored Normal file
View File

@ -0,0 +1,3 @@
[submodule "tdlight-java"]
path = tdlight-java
url = https://git.ignuranza.net/tdlight-team/tdlight-java.git

116
Jenkinsfile vendored Normal file
View File

@ -0,0 +1,116 @@
#!/usr/bin/env groovy
// see https://jenkins.io/doc/book/pipeline/syntax/
pipeline {
environment {
MVN_SET = credentials('maven_settings')
JAVA_TOOL_OPTIONS = '-Duser.home=/var/maven'
}
agent any
options {
timestamps()
ansiColor("xterm")
}
parameters {
booleanParam(name: "RELEASE",
description: "Build a release from current commit.",
defaultValue: false)
booleanParam(name: "DEBUGINFO",
description: "Build debug binary from current commit.",
defaultValue: false)
}
stages {
stage("Setup workspace") {
agent none
steps {
sh "mkdir -p \"/var/jenkins_cache/.m2\""
sh "chown 1000:1000 -R \"/var/jenkins_cache/.m2\""
sh "mkdir -p \"/var/jenkins_cache/.ccache\""
sh "chown 1000:1000 -R \"/var/jenkins_cache/.ccache\""
sh "mkdir -p \"/var/jenkins_cache/.ccache_arm64\""
sh "chown 1000:1000 -R \"/var/jenkins_cache/.ccache_arm64\""
//sh "mkdir -p \"${workspace}/tdlight-java/src/main\""
//sh "chown 1000:1000 -R \"${workspace}\""
//sh "chmod 771 -R \"${workspace}\""
}
}
stage("Prepare native C++") {
agent {
dockerfile {
dir 'jenkins/docker/native'
filename 'dockerfile'
additionalBuildArgs '--build-arg version=1.0.0 --build-arg UID=1000 --build-arg GID=1000 --build-arg UNAME=jenkins'
args "-v \"${workspace}/src/main:/home/jenkins/output:rw\" -v \"/var/jenkins_cache/.m2:/home/jenkins/.m2:rw\" -v \"/var/jenkins_cache/.ccache:/home/jenkins/.ccache:rw\" -v \"${workspace}:/home/jenkins/work:rw\""
reuseNode true
}
}
steps {
sh "./jenkins/scripts/prepare_cross.sh"
}
}
stage("Cross compile C++") {
agent {
dockerfile {
dir 'jenkins/docker/win64'
filename 'dockerfile'
additionalBuildArgs '--build-arg version=1.0.0 --build-arg UID=1000 --build-arg GID=1000 --build-arg UNAME=jenkins'
args "-v \"${workspace}/src/main:/home/jenkins/output:rw\" -v \"/var/jenkins_cache/.m2:/home/jenkins/.m2:rw\" -v \"/var/jenkins_cache/.ccache_arm64:/home/jenkins/.ccache:rw\" -v \"${workspace}:/home/jenkins/work:rw\""
reuseNode true
}
}
steps {
sh "DEBUGINFO=${params.DEBUGINFO} ./jenkins/scripts/cross_compile.sh"
}
}
stage("Build & Deploy SNAPSHOT") {
agent {
docker {
image 'maven:3.6.3-openjdk-11'
args '-v $HOME:/var/maven'
reuseNode true
}
}
steps {
sh "mvn -s $MVN_SET -B deploy"
}
}
stage("Release") {
agent {
docker {
image 'maven:3.6.3-openjdk-11'
args '-v $HOME:/var/maven'
reuseNode true
}
}
when {
expression { params.RELEASE }
}
steps {
sh "git config user.email \"jenkins@mchv.eu\""
sh "git config user.name \"Jenkins\""
sh "git add --all; git commit -m \"Add generated files\""
sh "mvn -s $MVN_SET -DpushChanges=false -DlocalCheckout=true -DpreparationGoals=initialize release:prepare release:perform -B"
}
}
stage('Deliver') {
agent {
docker {
image 'maven:3.6.3-openjdk-11'
args '-v $HOME:/var/maven'
reuseNode true
}
}
steps {
sh './jenkins/scripts/deliver.sh'
}
}
}
post {
always {
deleteDir()
}
}
}

View File

@ -0,0 +1,58 @@
FROM debian:stable-slim
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get upgrade -y
RUN apt-get install wget -y
RUN wget https://cdn.azul.com/zulu/bin/zulu11.41.23-ca-jdk11.0.8-linux_amd64.deb -O /tmp/install.deb 2>/dev/null
RUN mkdir -p /usr/share/man/man1
RUN apt-get install /tmp/install.deb -y
RUN apt-get install sudo -y
RUN apt-get install maven -y
RUN apt-get install gcc gperf make cmake ccache -y
#RUN apt-get install clang libc++-dev libc++abi-dev -y
RUN apt-get install libssl-dev:amd64 zlib1g-dev:amd64 -y
RUN apt-get install build-essential -y
RUN apt-get install php-fpm php-cli -y
RUN apt-get install libreadline-dev git -y
ARG UNAME=debian
ARG UID=1000
ARG GID=1000
RUN groupadd -g $GID -o $UNAME
RUN useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME
RUN usermod -a -G sudo $UNAME
RUN echo "$UNAME ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
USER $UNAME
RUN mkdir /home/$UNAME/work
RUN mkdir /home/$UNAME/output
WORKDIR /home/$UNAME/work
ENV CCACHE_DIR=/home/$UNAME/.ccache
ENV JAVA_HOME=/usr/lib/jvm/zulu-11-amd64
ENV JAVA_INCLUDE_PATH=/usr/lib/jvm/zulu-11-amd64/include
ENV JAVA_INCLUDE_PATH2=/usr/lib/jvm/zulu-11-amd64/include/linux
ENV JAVA_AWT_INCLUDE_PATH=/usr/lib/jvm/zulu-11-amd64/include
ENV JAVA_AWT_LIBRARY=/usr/lib/jvm/zulu-11-amd64/lib
ENV JAVA_JVM_LIBRARY=/usr/lib/jvm/zulu-11-amd64/lib
ENV TRAVIS_CPU_ARCH=amd64
ENV TRAVIS_OS_NAME=linux
ENV TRAVIS_BUILD_DIR=/home/$UNAME/work
ENV TRAVIS_OUTPUT_DIR=/home/$UNAME/output
CMD ["bash"]

View File

@ -0,0 +1,89 @@
FROM debian:stable-slim
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get upgrade -y
RUN apt-get install wget -y
RUN wget https://cdn.azul.com/zulu/bin/zulu11.41.23-ca-jdk11.0.8-linux_amd64.deb -O /tmp/install.deb 2>/dev/null
RUN mkdir -p /usr/share/man/man1
RUN apt-get install /tmp/install.deb -y
RUN apt-get install sudo -y
RUN apt-get install maven -y
RUN apt-get install gcc gperf make cmake ccache -y
RUN sudo apt-get install mingw-w64 -y
RUN apt-get install libssl-dev:amd64 zlib1g-dev:amd64 -y
RUN apt-get install python3 -y
RUN apt-get install php-fpm php-cli -y
RUN apt-get install libreadline-dev git -y
RUN apt install unzip -y
ARG UNAME=debian
ARG UID=1000
ARG GID=1000
RUN groupadd -g $GID -o $UNAME
RUN useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME
RUN usermod -a -G sudo $UNAME
RUN echo "$UNAME ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
USER $UNAME
RUN mkdir /home/$UNAME/work
RUN mkdir /home/$UNAME/output
WORKDIR /home/$UNAME/work
ENV CCACHE_DIR=/home/$UNAME/.ccache
ENV JAVA_HOME=/usr/lib/jvm/zulu-11-amd64
ENV JAVA_INCLUDE_PATH=/usr/lib/jvm/zulu-11-amd64/include
ENV JAVA_INCLUDE_PATH2=/usr/lib/jvm/zulu-11-amd64/include/linux
ENV JAVA_AWT_INCLUDE_PATH=/usr/lib/jvm/zulu-11-amd64/include
ENV JAVA_AWT_LIBRARY=/usr/lib/jvm/zulu-11-amd64/lib
ENV JAVA_JVM_LIBRARY=/usr/lib/jvm/zulu-11-amd64/lib
ENV TRAVIS_CPU_ARCH=amd64
ENV TRAVIS_OS_NAME=windows
ENV TRAVIS_BUILD_DIR=/home/$UNAME/work
ENV TRAVIS_OUTPUT_DIR=/home/$UNAME/output
RUN sudo rm -r /home/$UNAME/openssl_cross || true
RUN sudo git clone --depth 1 --branch OpenSSL_1_1_1-stable --single-branch https://github.com/openssl/openssl.git /home/$UNAME/openssl_cross
RUN sudo chown -R $UNAME:$UNAME /home/$UNAME/openssl_cross
RUN sudo rm -r /home/$UNAME/zlib_cross || true
RUN sudo git clone --depth 1 --branch v1.2.11 --single-branch https://github.com/madler/zlib.git /home/$UNAME/zlib_cross
RUN sudo chown -R $UNAME:$UNAME /home/$UNAME/zlib_cross
RUN sudo rm -r /home/$UNAME/java11_cross || true
RUN sudo mkdir /home/$UNAME/java11_cross
RUN sudo chown -R $UNAME:$UNAME /home/$UNAME/java11_cross
RUN cd /home/$UNAME/java11_cross && \
wget https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.8%2B10/OpenJDK11U-jdk_x64_windows_hotspot_11.0.8_10.zip -O /home/$UNAME/java11_cross/jdk.zip 2>/dev/null && \
unzip /home/$UNAME/java11_cross/jdk.zip -d /home/$UNAME/java11_cross/ && \
mv /home/$UNAME/java11_cross/jdk-11.0.8+10/ /home/$UNAME/java11_cross/jdk
RUN cd /home/$UNAME/zlib_cross && \
export CC=x86_64-w64-mingw32-gcc-posix && \
nice -n 5 chrt -b 0 ./configure --prefix=/home/$UNAME/zlib_cross && \
nice -n 5 chrt -b 0 make -f win32/Makefile.gcc BINARY_PATH=/home/$UNAME/zlib_cross/bin INCLUDE_PATH=/home/$UNAME/zlib_cross/include LIBRARY_PATH=/home/$UNAME/zlib_cross/lib PREFIX=x86_64-w64-mingw32- install
RUN cd /home/$UNAME/openssl_cross && \
export CC="" && \
nice -n 5 chrt -b 0 ./Configure --cross-compile-prefix=x86_64-w64-mingw32- --prefix=/home/$UNAME/openssl_cross_dir --openssldir=/home/$UNAME/openssl_cross_dir mingw64 shared no-zlib no-comp && \
nice -n 5 chrt -b 0 make 2>&1 | tee make.log && \
nice -n 5 chrt -b 0 sudo make install
RUN cd /home/$UNAME/work
CMD ["bash"]

View File

@ -0,0 +1,98 @@
#!/bin/bash -e
# ====== Setup workspace
cd $TRAVIS_BUILD_DIR
source ./jenkins/scripts/setup_workspace.sh
export JAVA_HOME=/usr/lib/jvm/zulu-11-amd64
export JAVA_AWT_LIBRARY=/home/jenkins/java11_cross/jdk/lib/jawt.lib
export JAVA_JVM_LIBRARY=/home/jenkins/java11_cross/jdk/lib/jvm.lib
export JAVA_INCLUDE_PATH=/home/jenkins/java11_cross/jdk/include
export JAVA_INCLUDE_PATH2=/home/jenkins/java11_cross/jdk/include/win32
export JAVA_AWT_INCLUDE_PATH=/home/jenkins/java11_cross/jdk/include
export LIBRARY_PATH=$LIBRARY_PATH:/home/jenkins/zlib_cross/:/home/jenkins/openssl_cross_dir/
TOOLCHAIN_FILE=$TRAVIS_BUILD_DIR/toolchain-win64.cmake
# ====== Prepare TdLib
# Cross compilation preparation (also needed for split sources)
cd $TD_BUILD_DIR
nice -n 5 chrt -b 0 \
cmake \
-DCMAKE_CROSSCOMPILING=ON \
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} \
-DJNI_FOUND=True \
-DJNI_LIBRARIES="${JAVA_AWT_LIBRARY} ${JAVA_JVM_LIBRARY}" \
-DJNI_INCLUDE_DIRS="${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2} ${JAVA_AWT_INCLUDE_PATH}" \
-DJAVA_JVM_LIBRARY=${JAVA_JVM_LIBRARY} \
-DJAVA_INCLUDE_PATH=${JAVA_INCLUDE_PATH} \
-DJAVA_INCLUDE_PATH2=${JAVA_INCLUDE_PATH2} \
-DOPENSSL_USE_STATIC_LIBS=True \
-DOPENSSL_ROOT_DIR=/home/jenkins/openssl_cross_dir \
-DZLIB_LIBRARY=/home/jenkins/zlib_cross/lib/libz.a \
-DZLIB_INCLUDE_DIR=/home/jenkins/zlib_cross/include \
\
-DCMAKE_BUILD_TYPE=$BUILDPROFILE \
-DCMAKE_INSTALL_PREFIX:PATH=${TD_BIN_DIR} \
-DTD_ENABLE_JNI=ON \
${TD_SRC_DIR}
# Split sources
cd $TD_SRC_DIR
nice -n 5 chrt -b 0 php SplitSource.php
# Build
cd $TD_BUILD_DIR
nice -n 5 chrt -b 0 cmake --build $TD_BUILD_DIR --target install --parallel ${TRAVIS_CPU_CORES}
# Undo split-sources
cd $TD_SRC_DIR
nice -n 5 chrt -b 0 php SplitSource.php --undo
# -DOPENSSL_FOUND=True \
# -DOPENSSL_INCLUDE_DIR=/home/jenkins/openssl_cross_dir/include \
# -DOPENSSL_CRYPTO_LIBRARY=/home/jenkins/openssl_cross_dir/lib/libcrypto.dll.a \
# -DOPENSSL_SSL_LIBRARY=/home/jenkins/openssl_cross_dir/lib/libssl.dll.a \
# -DZLIB_FOUND=True \
# ====== Build TdNatives
cd $TDNATIVES_CPP_BUILD_DIR
nice -n 5 chrt -b 0 \
cmake \
-DCMAKE_CROSSCOMPILING=ON \
-DCMAKE_TOOLCHAIN_FILE=${TOOLCHAIN_FILE} \
-DJNI_FOUND=True \
-DJNI_LIBRARIES="${JAVA_AWT_LIBRARY} ${JAVA_JVM_LIBRARY}" \
-DJNI_INCLUDE_DIRS="${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH2} ${JAVA_AWT_INCLUDE_PATH}" \
-DJAVA_JVM_LIBRARY=${JAVA_JVM_LIBRARY} \
-DJAVA_INCLUDE_PATH=${JAVA_INCLUDE_PATH} \
-DJAVA_INCLUDE_PATH2=${JAVA_INCLUDE_PATH2} \
-DOPENSSL_USE_STATIC_LIBS=True \
-DOPENSSL_ROOT_DIR=/home/jenkins/openssl_cross_dir \
-DZLIB_LIBRARY=/home/jenkins/zlib_cross/lib/libz.a \
-DZLIB_INCLUDE_DIR=/home/jenkins/zlib_cross/include \
\
-DCMAKE_BUILD_TYPE=$BUILDPROFILE \
-DCMAKE_INSTALL_PREFIX:PATH=${TD_BIN_DIR} \
-DTD_GENERATED_BINARIES_DIR=${TD_CROSS_BIN_DIR}/td/generate \
-DTD_SRC_DIR=${TD_SRC_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 chrt -b 0 cmake --build $TDNATIVES_CPP_BUILD_DIR --target install --parallel ${TRAVIS_CPU_CORES}
# ====== Print results stats
echo "CCACHE statistics:"
ccache -s
# ====== Copy output
cd $TDNATIVES_CPP_BUILD_DIR
mkdir -p $TDLIB_RESOURCES_OUTPUT_DIR
cp $TDNATIVES_BIN_DIR/$SRC_TDJNI_LIBNAME $TDLIB_RESOURCES_OUTPUT_DIR/$DEST_TDJNI_LIBNAME
cp /home/jenkins/zlib_cross/zlib1.dll $TDLIB_RESOURCES_OUTPUT_DIR/zlib1.dll
cp /home/jenkins/openssl_cross_dir/bin/libcrypto-3-x64.dll $TDLIB_RESOURCES_OUTPUT_DIR/libcrypto-3-x64.dll
cp /home/jenkins/openssl_cross_dir/bin/libssl-3-x64.dll $TDLIB_RESOURCES_OUTPUT_DIR/libssl-3-x64.dll
cp /usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll $TDLIB_RESOURCES_OUTPUT_DIR/libwinpthread-1.dll
cp /usr/lib/gcc/x86_64-w64-mingw32/8.3-posix/libstdc++-6.dll $TDLIB_RESOURCES_OUTPUT_DIR/libstdc++-6.dll
cp /usr/lib/gcc/x86_64-w64-mingw32/8.3-posix/libgcc_s_seh-1.dll $TDLIB_RESOURCES_OUTPUT_DIR/libgcc_s_seh-1.dll

3
jenkins/scripts/deliver.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash -e
echo "Delivered."

View File

@ -0,0 +1,14 @@
#!/bin/bash -e
# ====== Setup workspace
cd $TRAVIS_BUILD_DIR
source ./jenkins/scripts/setup_workspace.sh
cd $TD_CROSS_BIN_DIR
nice -n 5 chrt -b 0 cmake \
-DTD_ENABLE_JNI=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX:PATH=${TD_BIN_DIR} \
-DCMAKE_INSTALL_BINDIR:PATH=${TD_BIN_DIR}/bin \
$TD_SRC_DIR
nice -n 5 chrt -b 0 cmake --build . --target prepare_cross_compiling --parallel ${TRAVIS_CPU_CORES}
nice -n 5 chrt -b 0 cmake --build . --target td_generate_java_api --parallel ${TRAVIS_CPU_CORES}

View File

@ -0,0 +1,64 @@
#!/bin/bash -e
# ====== Variables
export TD_SRC_DIR=$TRAVIS_BUILD_DIR/tdlight-java/dependencies/tdlight
export TD_BIN_DIR=$TRAVIS_BUILD_DIR/tdlight-java/bin-td
export TDNATIVES_BIN_DIR=$TRAVIS_BUILD_DIR/tdlight-java/bin-tdlight
export TDNATIVES_CPP_SRC_DIR=$TRAVIS_BUILD_DIR/tdlight-java/src/tdlib-cpp
export TDNATIVES_DOCS_BIN_DIR=$TRAVIS_BUILD_DIR/tdlight-java/bin-docs
export TD_BUILD_DIR=$TRAVIS_BUILD_DIR/tdlight-java/build-td
export TD_CROSS_BIN_DIR=$TD_SRC_DIR/bin-td-cross
export TDNATIVES_CPP_BUILD_DIR=$TRAVIS_BUILD_DIR/tdlight-java/build-tdlight
export JAVA_SRC_DIR=$TRAVIS_BUILD_DIR/tdlight-java/src/tdlib-java
export TDLIB_SERIALIZER_DIR=$TRAVIS_BUILD_DIR/tdlight-java/dependencies/tdlib-serializer
export MAVEN_OPTS="--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/javax.crypto=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED"
export TRAVIS_CPU_ARCH_STANDARD="$(tr '[:upper:]' '[:lower:]'<<<"${TRAVIS_CPU_ARCH}")"
export TRAVIS_CPU_CORES="2"
TRAVIS_OS_NAME_STANDARD="$(tr '[:upper:]' '[:lower:]'<<<"${TRAVIS_OS_NAME}")"
export TRAVIS_OS_NAME_STANDARD
export TRAVIS_OS_NAME_SHORT="win"
export SRC_TDJNI_LIBNAME="libtdjni.dll"
export DEST_TDJNI_LIBNAME="tdjni.dll"
if [[ "$DEBUGINFO" == "true" ]]; then
export BUILDPROFILE="Debug"
else
export BUILDPROFILE="Release"
fi
# ====== OS Variables
TRAVIS_CPU_ARCH_JAVA="$(tr '[:upper:]' '[:lower:]'<<<"${TRAVIS_CPU_ARCH}")"
export TRAVIS_CPU_ARCH_JAVA
export TDLIB_RESOURCES_OUTPUT_DIR="$TRAVIS_OUTPUT_DIR/resources/libs/$TRAVIS_OS_NAME_SHORT/$TRAVIS_CPU_ARCH_STANDARD"
# ====== Print variables
echo "TD_SRC_DIR=${TD_SRC_DIR}"
echo "TD_BIN_DIR=${TD_BIN_DIR}"
echo "TDNATIVES_BIN_DIR=${TDNATIVES_BIN_DIR}"
echo "TDNATIVES_CPP_SRC_DIR=${TDNATIVES_CPP_SRC_DIR}"
echo "TDNATIVES_DOCS_BIN_DIR=${TDNATIVES_DOCS_BIN_DIR}"
echo "TD_BUILD_DIR=${TD_BUILD_DIR}"
echo "TD_CROSS_BIN_DIR=${TD_CROSS_BIN_DIR}"
echo "TDNATIVES_CPP_BUILD_DIR=${TDNATIVES_CPP_BUILD_DIR}"
echo "JAVA_SRC_DIR=${JAVA_SRC_DIR}"
echo "TDLIB_SERIALIZER_DIR=${TDLIB_SERIALIZER_DIR}"
echo "PATH=${PATH}"
echo "JAVA_HOME=${JAVA_HOME}"
echo "JAVA_INCLUDE_PATH=${JAVA_INCLUDE_PATH}"
echo "JAVA_INCLUDE_PATH2=${JAVA_INCLUDE_PATH2}"
echo "JAVA_AWT_INCLUDE_PATH=${JAVA_AWT_INCLUDE_PATH}"
echo "VCPKG_DIR=${VCPKG_DIR}"
echo "MAVEN_OPTS=${MAVEN_OPTS}"
echo "TRAVIS_CPU_ARCH=${TRAVIS_CPU_ARCH}"
echo "TRAVIS_CPU_ARCH_JAVA=${TRAVIS_CPU_ARCH_JAVA}"
echo "TRAVIS_CPU_ARCH_STANDARD=${TRAVIS_CPU_ARCH_STANDARD}"
echo "TRAVIS_OS_NAME=${TRAVIS_OS_NAME}"
echo "TRAVIS_OS_NAME_STANDARD=${TRAVIS_OS_NAME_STANDARD}"
echo "TRAVIS_OS_NAME_SHORT=${TRAVIS_OS_NAME_SHORT}"
echo "SRC_TDJNI_LIBNAME=${SRC_TDJNI_LIBNAME}"
echo "DEST_TDJNI_LIBNAME=${DEST_TDJNI_LIBNAME}"
echo "TDLIB_RESOURCES_OUTPUT_DIR=${TDLIB_RESOURCES_OUTPUT_DIR}"
echo "BUILDPROFILE=${BUILDPROFILE}"
echo "CURRENT DIRECTORY* ($(pwd)):"
ls -alch "$(pwd)"
echo "WORK DIRECTORY CONTENT* (${TRAVIS_BUILD_DIR}):"
ls -alch "$TRAVIS_BUILD_DIR"

View File

@ -0,0 +1,28 @@
#!/bin/bash -e
# ====== Setup environment variables
source ./jenkins/scripts/setup_variables.sh
# ====== Environment setup
[ -d $TD_BUILD_DIR ] || mkdir -p $TD_BUILD_DIR
[ -d $TD_BIN_DIR ] || mkdir -p $TD_BIN_DIR
[ -d $TD_NATIVE_BIN_DIR ] || mkdir -p $TD_NATIVE_BIN_DIR
[ -d $TD_CROSS_BIN_DIR ] || mkdir -p $TD_CROSS_BIN_DIR
[ -d $TDNATIVES_CPP_BUILD_DIR ] || mkdir -p $TDNATIVES_CPP_BUILD_DIR
echo "CCACHE statistics:"
ccache -s
## Fix openssl path
cd $TD_SRC_DIR
#sed -i -e '2i\cmake_policy(SET CMP0074 NEW)\' tdutils/CMakeLists.txt
#sed -i -e '2i\cmake_policy(SET CMP0074 NEW)\' CMakeLists.txt
#sed -i -e '3i\set(OPENSSL_ROOT_DIR /usr/lib/openssl_cross/usr/lib)\' CMakeLists.txt
#sed -i -e '4i\set(OPENSSL_LIBRARIES_DIR /usr/lib/openssl_cross/usr/lib)\' CMakeLists.txt
#sed -i -e '5i\set(OPENSSL_INCLUDE_DIR /usr/lib/openssl_cross/usr/include/openssl)\' CMakeLists.txt
#sed -i -e '6i\set(OPENSSL_CRYPTO_LIBRARY /usr/lib/openssl_cross/usr/lib/libcrypto.so)\' CMakeLists.txt
#sed -i -e '7i\set(OPENSSL_SSL_LIBRARY /usr/lib/openssl_cross/usr/lib/libssl.so)\' CMakeLists.txt
#sed -i -e '8i\set(ZLIB_ROOT /usr/lib/zlib_cross/usr/lib)\' CMakeLists.txt
#sed -i -e '9i\set(ZLIB_LIBRARIES_DIR /usr/lib/zlib_cross/usr/lib)\' CMakeLists.txt
#sed -i -e '10i\set(ZLIB_LIBRARY /usr/lib/zlib_cross/usr/lib/libz.so)\' CMakeLists.txt
#sed -i -e '11i\set(ZLIB_INCLUDE_DIR /usr/lib/zlib_cross/usr/include)\' CMakeLists.txt
#sed -i -e '12i\link_libraries(atomic)\' CMakeLists.txt

128
pom.xml
View File

@ -1,53 +1,79 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>it.tdlight</groupId>
<artifactId>tdlight-natives-windows-amd64</artifactId>
<version>1.1.4</version>
<name>TDLight Natives for Windows (amd64)</name>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>10</maven.compiler.source>
<maven.compiler.target>10</maven.compiler.target>
</properties>
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub TDLight Team Apache Maven Packages</name>
<url>https://maven.pkg.github.com/tdlight-team/tdlight-java</url>
</repository>
</distributionManagement>
<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<modelVersion>4.0.0</modelVersion>
<groupId>it.tdlight</groupId>
<artifactId>tdlight-natives-windows-amd64</artifactId>
<version>2.0.2-SNAPSHOT</version>
<name>TDLight Natives for Windows (amd64)</name>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<distributionManagement>
<repository>
<id>mchv</id>
<name>MCHV Apache Maven Packages</name>
<url>https://mvn.mchv.eu/repository/mchv/</url>
</repository>
<snapshotRepository>
<id>mchv</id>
<name>MCHV Apache Maven Packages</name>
<url>https://mvn.mchv.eu/repository/mchv-snapshot/</url>
</snapshotRepository>
</distributionManagement>
<scm>
<connection>scm:git:git@ssh.git.ignuranza.net:tdlight-team/tdlight-java-natives-windows-amd64.git</connection>
<url>scm:git:git@github.com:user/project.git</url>
<developerConnection>scm:git:git@ssh.git.ignuranza.net:tdlight-team/tdlight-java-natives-windows-amd64.git</developerConnection>
<tag>master</tag>
</scm>
<build>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<encoding>UTF-8</encoding>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>3.0.0-M1</version>
<executions>
<execution>
<id>default</id>
<goals>
<goal>perform</goal>
</goals>
<configuration>
<pomFileName>${project.name}/pom.xml</pomFileName>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>3.0.0-M1</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,9 @@
package it.tdlight.tdlight.win.amd64;
import java.lang.ClassLoader;
public class LoadLibrary {
public static ClassLoader getClassLoader() {
return LoadLibrary.class.getClassLoader();
}
}

1
tdlight-java Submodule

@ -0,0 +1 @@
Subproject commit 6f1cd83927abfc69d0249542b2725f521dbf1189

6
toolchain-win64.cmake Normal file
View File

@ -0,0 +1,6 @@
SET(CMAKE_SYSTEM_NAME Windows)
SET(CMAKE_CROSSCOMPILING 1)
SET(CMAKE_C_COMPILER /usr/bin/x86_64-w64-mingw32-gcc-posix)
SET(CMAKE_CXX_COMPILER /usr/bin/x86_64-w64-mingw32-g++-posix)
SET(CMAKE_LINKER /usr/bin/x86_64-w64-mingw32-ld-posix)
set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES /usr/lib/gcc/x86_64-w64-mingw32/8.3-posix)