Update build scripts

This commit is contained in:
Andrea Cavalli 2022-03-19 19:26:56 +01:00
parent 548d115df5
commit 6693a96138
5 changed files with 28 additions and 13 deletions

View File

@ -4,6 +4,7 @@ ARG REVISION
ARG GH_MATRIX_OS ARG GH_MATRIX_OS
ARG GH_MATRIX_ARCH ARG GH_MATRIX_ARCH
ARG IMPLEMENTATION_NAME ARG IMPLEMENTATION_NAME
ARG CPU_CORES_NUM
ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive

16
scripts/continuous-integration/docker/build-natives.sh Normal file → Executable file
View File

@ -3,6 +3,7 @@ export JAVA_HOME
JAVA_HOME="$(find "/usr/lib/jvm/" -maxdepth 1 -type d -iname "java*jdk*" | head -n 1)/" JAVA_HOME="$(find "/usr/lib/jvm/" -maxdepth 1 -type d -iname "java*jdk*" | head -n 1)/"
export JAVA_INCLUDE_PATH="$JAVA_HOME/include" export JAVA_INCLUDE_PATH="$JAVA_HOME/include"
source ./scripts/continuous-integration/github-workflows/setup-variables.sh source ./scripts/continuous-integration/github-workflows/setup-variables.sh
export CROSS_BUILD_DEPS_DIR="$PWD/cross-build-deps"
# Check variables correctness # Check variables correctness
if [ -z "${CPU_ARCH_DPKG}" ]; then if [ -z "${CPU_ARCH_DPKG}" ]; then
echo "Missing parameter: CPU_ARCH_DPKG" echo "Missing parameter: CPU_ARCH_DPKG"
@ -24,6 +25,7 @@ if [ -n "${CROSS_BUILD_DEPS_DIR}" ]; then
PWD_BEFORE_CROSS_DEPS=$(pwd) PWD_BEFORE_CROSS_DEPS=$(pwd)
if [[ ! -f "$CROSS_BUILD_DEPS_DIR/ok-012" ]]; then if [[ ! -f "$CROSS_BUILD_DEPS_DIR/ok-012" ]]; then
echo "Setting up cross build deps dir"
rm -rf "$CROSS_BUILD_DEPS_DIR" || true rm -rf "$CROSS_BUILD_DEPS_DIR" || true
mkdir -p "$CROSS_BUILD_DEPS_DIR" mkdir -p "$CROSS_BUILD_DEPS_DIR"
cd "$CROSS_BUILD_DEPS_DIR" cd "$CROSS_BUILD_DEPS_DIR"
@ -81,17 +83,27 @@ if [ -n "${CROSS_BUILD_DEPS_DIR}" ]; then
find "$CROSS_BUILD_DEPS_DIR" -lname "/*" \ find "$CROSS_BUILD_DEPS_DIR" -lname "/*" \
-exec sh -c "ln -sf \"\`echo \"$CROSS_BUILD_DEPS_DIR\$(readlink \$0)\"\`\" \"\$0\"" {} \; -exec sh -c "ln -sf \"\`echo \"$CROSS_BUILD_DEPS_DIR\$(readlink \$0)\"\`\" \"\$0\"" {} \;
echo "Cross build deps dir setup finished, testing..."
# Check if openjdk is found # Check if openjdk is found
fix_jdk_path fix_jdk_path
check_jdk_existance check_jdk_existance
touch "$CROSS_BUILD_DEPS_DIR/ok-012" touch "$CROSS_BUILD_DEPS_DIR/ok-012"
fi fi
echo "Cross build deps dir setup done"
fix_jdk_path fix_jdk_path
check_jdk_existance check_jdk_existance
cd "${PWD_BEFORE_CROSS_DEPS}" cd "${PWD_BEFORE_CROSS_DEPS}"
apt install -y "crossbuild-essential-${CPU_ARCH_DPKG}" apt install -y "crossbuild-essential-${CPU_ARCH_DPKG}"
fi fi
source ./scripts/continuous-integration/github-workflows/install-dependencies.sh cd scripts/core
source ./scripts/continuous-integration/github-workflows/build-natives.sh source ./setup-variables.sh
./install-dependencies.sh
./generate_maven_project.sh
./generate_td_tools.sh
./configure_td.sh
./compile_td.sh
./compile_tdjni.sh
./build_generated_maven_project.sh

View File

@ -22,27 +22,25 @@ export GH_OS_NAME
if [[ "$GH_CPU_ARCH" == "arm64" ]]; then if [[ "$GH_CPU_ARCH" == "arm64" ]]; then
export CPU_ARCHITECTURE_NAME="aarch64" export CPU_ARCHITECTURE_NAME="aarch64"
export CPU_CORES_NUM="2"
elif [[ "$GH_CPU_ARCH" == "armhf" ]]; then elif [[ "$GH_CPU_ARCH" == "armhf" ]]; then
export CPU_ARCHITECTURE_NAME="armhf" export CPU_ARCHITECTURE_NAME="armhf"
export CPU_CORES_NUM="2"
elif [[ "$GH_CPU_ARCH" == "s390x" ]]; then elif [[ "$GH_CPU_ARCH" == "s390x" ]]; then
export CPU_ARCHITECTURE_NAME="s390x" export CPU_ARCHITECTURE_NAME="s390x"
export CPU_CORES_NUM="2"
elif [[ "$GH_CPU_ARCH" == "386" ]]; then elif [[ "$GH_CPU_ARCH" == "386" ]]; then
export CPU_ARCHITECTURE_NAME="386" export CPU_ARCHITECTURE_NAME="386"
export CPU_CORES_NUM="2"
elif [[ "$GH_CPU_ARCH" == "amd64" ]]; then elif [[ "$GH_CPU_ARCH" == "amd64" ]]; then
export CPU_ARCHITECTURE_NAME="amd64" export CPU_ARCHITECTURE_NAME="amd64"
export CPU_CORES_NUM="2"
elif [[ "$GH_CPU_ARCH" == "ppc64le" ]]; then elif [[ "$GH_CPU_ARCH" == "ppc64le" ]]; then
export CPU_ARCHITECTURE_NAME="ppc64le" export CPU_ARCHITECTURE_NAME="ppc64le"
export CPU_CORES_NUM="2"
else else
echo "Unrecognized cpu arch: $GH_CPU_ARCH" echo "Unrecognized cpu arch: $GH_CPU_ARCH"
exit 1 exit 1
fi fi
if [ -z "${CPU_CORES_NUM}" ]; then
export CPU_CORES_NUM="2"
fi
if [[ "$GH_OS_NAME" == "windows" ]]; then if [[ "$GH_OS_NAME" == "windows" ]]; then
export OPERATING_SYSTEM_NAME="windows" export OPERATING_SYSTEM_NAME="windows"
export OPERATING_SYSTEM_NAME_SHORT="win" export OPERATING_SYSTEM_NAME_SHORT="win"

View File

@ -72,6 +72,9 @@ if [[ "$OPERATING_SYSTEM_NAME" == "linux" ]]; then
echo "Creating toolchain file..." echo "Creating toolchain file..."
cd "$ROOT_DIR" cd "$ROOT_DIR"
{ {
echo "set(CMAKE_EXE_LINKER_FLAGS \${CMAKE_EXE_LINKER_FLAGS} ${MFLAGS})";
echo "set(CMAKE_C_FLAGS \${CMAKE_C_FLAGS} ${MFLAGS})";
echo "set(CMAKE_CXX_FLAGS \${CMAKE_CXX_FLAGS} ${MFLAGS})";
echo "set(CMAKE_SYSTEM_PROCESSOR ${CPU_ARCH_LINUX})"; echo "set(CMAKE_SYSTEM_PROCESSOR ${CPU_ARCH_LINUX})";
echo "set(CMAKE_C_COMPILER ${CROSS_CC})"; echo "set(CMAKE_C_COMPILER ${CROSS_CC})";
echo "set(CMAKE_C_COMPILER_TARGET ${CLANG_TRIPLE})"; echo "set(CMAKE_C_COMPILER_TARGET ${CLANG_TRIPLE})";

View File

@ -68,12 +68,12 @@ if [[ "$CORE_VARIABLES_SET" != "YES" ]]; then
exit 1 exit 1
fi fi
export CPU_CORES_NUM="2" if [ -z "${CPU_CORES_NUM}" ]; then
export CPU_CORES_NUM="2"
fi
if [[ "$CPU_ARCHITECTURE_NAME" == "armhf" || "$CPU_ARCHITECTURE_NAME" == "386" ]]; then if [[ "$CPU_ARCHITECTURE_NAME" == "386" ]]; then
export CXXFLAGS="$CXXFLAGS -m32" export MFLAGS="-m32"
export CFLAGS="$CFLAGS -m32"
export LDFLAGS="$LDFLAGS -m32"
fi fi
if [[ "$OPERATING_SYSTEM_NAME" == "windows" ]]; then if [[ "$OPERATING_SYSTEM_NAME" == "windows" ]]; then
@ -118,6 +118,7 @@ if [[ "$CORE_VARIABLES_SET" != "YES" ]]; then
echo "CPU_COMPILATION_TOOL=${CPU_COMPILATION_TOOL}" echo "CPU_COMPILATION_TOOL=${CPU_COMPILATION_TOOL}"
echo "CC=${CC}" echo "CC=${CC}"
echo "CXX=${CXX}" echo "CXX=${CXX}"
echo "MFLAGS=${MFLAGS}"
echo "CFLAGS=${CFLAGS}" echo "CFLAGS=${CFLAGS}"
echo "CXXFLAGS=${CXXFLAGS}" echo "CXXFLAGS=${CXXFLAGS}"
echo "CMAKE_EXE_LINKER_FLAGS=${CMAKE_EXE_LINKER_FLAGS}" echo "CMAKE_EXE_LINKER_FLAGS=${CMAKE_EXE_LINKER_FLAGS}"