This commit is contained in:
Andrea Cavalli 2022-02-19 01:25:17 +01:00
parent eb712d6c21
commit f7165ee6b3

View File

@ -8,93 +8,90 @@ if [ -z "${CPU_ARCH_DPKG}" ]; then
echo "Missing parameter: CPU_ARCH_DPKG" echo "Missing parameter: CPU_ARCH_DPKG"
exit 1 exit 1
fi fi
if [ -z "${CROSS_BUILD_DEPS_DIR}" ]; then if [ -n "${CROSS_BUILD_DEPS_DIR}" ]; then
echo "Missing parameter: CROSS_BUILD_DEPS_DIR" CROSS_OPENJDK_PATH=""
exit 1 fix_jdk_path() {
fi # Setup OpenJDK path
CROSS_OPENJDK_PATH=$(find "$CROSS_BUILD_DEPS_DIR/usr/lib/jvm/" -maxdepth 1 -type d -iname "java*jdk*" | head -n 1)
}
CROSS_OPENJDK_PATH="" check_jdk_existance() {
fix_jdk_path() { if [[ ! -d "$CROSS_OPENJDK_PATH" ]]; then
# Setup OpenJDK path echo "Can't find cross OpenJDK at location $CROSS_OPENJDK_PATH"
CROSS_OPENJDK_PATH=$(find "$CROSS_BUILD_DEPS_DIR/usr/lib/jvm/" -maxdepth 1 -type d -iname "java*jdk*" | head -n 1) exit 1
} fi
}
check_jdk_existance() { PWD_BEFORE_CROSS_DEPS=$(pwd)
if [[ ! -d "$CROSS_OPENJDK_PATH" ]]; then if [[ ! -f "$CROSS_BUILD_DEPS_DIR/ok-012" ]]; then
echo "Can't find cross OpenJDK at location $CROSS_OPENJDK_PATH" rm -rf "$CROSS_BUILD_DEPS_DIR" || true
exit 1 mkdir -p "$CROSS_BUILD_DEPS_DIR"
fi cd "$CROSS_BUILD_DEPS_DIR"
}
PWD_BEFORE_CROSS_DEPS=$(pwd) dpkg --add-architecture "${CPU_ARCH_DPKG}"
if [[ ! -f "$CROSS_BUILD_DEPS_DIR/ok-012" ]]; then apt-get update
rm -rf "$CROSS_BUILD_DEPS_DIR" || true
mkdir -p "$CROSS_BUILD_DEPS_DIR"
cd "$CROSS_BUILD_DEPS_DIR"
dpkg --add-architecture "${CPU_ARCH_DPKG}" # LibZ-Dev
apt-get update apt-get download "zlib1g-dev:${CPU_ARCH_DPKG}"
ZLIB1G_DEV_DEB=$(find . -name "zlib1g-dev_*.deb")
dpkg -x "$ZLIB1G_DEV_DEB" "$CROSS_BUILD_DEPS_DIR"
rm "$ZLIB1G_DEV_DEB"
# LibZ
apt-get download "zlib1g:${CPU_ARCH_DPKG}"
ZLIB1G_DEB=$(find . -name "zlib1g_*.deb")
dpkg -x "$ZLIB1G_DEB" "$CROSS_BUILD_DEPS_DIR"
rm "$ZLIB1G_DEB"
# LibSSL-Dev
apt-get download "libssl-dev:${CPU_ARCH_DPKG}"
LIBSSL_DEV_DEB=$(find . -name "libssl-dev_*.deb")
dpkg -x "$LIBSSL_DEV_DEB" "$CROSS_BUILD_DEPS_DIR"
rm "$LIBSSL_DEV_DEB"
# LibSSL
apt-get download "libssl1.1:${CPU_ARCH_DPKG}"
LIBSSL_DEB=$(find . -name "libssl1.1_*.deb")
dpkg -x "$LIBSSL_DEB" "$CROSS_BUILD_DEPS_DIR"
rm "$LIBSSL_DEB"
# Java Common
apt-get download "java-common"
JC_DEB=$(find . -name "java-common_*.deb")
dpkg -x "$JC_DEB" "$CROSS_BUILD_DEPS_DIR"
rm "$JC_DEB"
# OpenJDK-JRE-Headless
apt-get download "openjdk-11-jre-headless:${CPU_ARCH_DPKG}"
OJDKRH_DEB=$(find . -name "openjdk-11-jre-headless_*.deb")
dpkg -x "$OJDKRH_DEB" "$CROSS_BUILD_DEPS_DIR"
rm "$OJDKRH_DEB"
# OpenJDK-JRE
apt-get download "openjdk-11-jre:${CPU_ARCH_DPKG}"
OJDKR_DEB=$(find . -name "openjdk-11-jre_*.deb")
dpkg -x "$OJDKR_DEB" "$CROSS_BUILD_DEPS_DIR"
rm "$OJDKR_DEB"
# OpenJDK-JDK
apt-get download "openjdk-11-jdk-headless:${CPU_ARCH_DPKG}"
OJDKJ_DEB=$(find . -name "openjdk-11-jdk-headless_*.deb")
dpkg -x "$OJDKJ_DEB" "$CROSS_BUILD_DEPS_DIR"
rm "$OJDKJ_DEB"
# OpenJDK-GUI
apt-get download "openjdk-11-jdk:${CPU_ARCH_DPKG}"
OJDKG_DEB=$(find . -name "openjdk-11-jdk_*.deb")
dpkg -x "$OJDKG_DEB" "$CROSS_BUILD_DEPS_DIR"
rm "$OJDKG_DEB"
# LibZ-Dev # Fix symlinks
apt-get download "zlib1g-dev:${CPU_ARCH_DPKG}" find "$CROSS_BUILD_DEPS_DIR" -lname "/*" \
ZLIB1G_DEV_DEB=$(find . -name "zlib1g-dev_*.deb") -exec sh -c "ln -sf \"\`echo \"$CROSS_BUILD_DEPS_DIR\$(readlink \$0)\"\`\" \"\$0\"" {} \;
dpkg -x "$ZLIB1G_DEV_DEB" "$CROSS_BUILD_DEPS_DIR"
rm "$ZLIB1G_DEV_DEB"
# LibZ
apt-get download "zlib1g:${CPU_ARCH_DPKG}"
ZLIB1G_DEB=$(find . -name "zlib1g_*.deb")
dpkg -x "$ZLIB1G_DEB" "$CROSS_BUILD_DEPS_DIR"
rm "$ZLIB1G_DEB"
# LibSSL-Dev
apt-get download "libssl-dev:${CPU_ARCH_DPKG}"
LIBSSL_DEV_DEB=$(find . -name "libssl-dev_*.deb")
dpkg -x "$LIBSSL_DEV_DEB" "$CROSS_BUILD_DEPS_DIR"
rm "$LIBSSL_DEV_DEB"
# LibSSL
apt-get download "libssl1.1:${CPU_ARCH_DPKG}"
LIBSSL_DEB=$(find . -name "libssl1.1_*.deb")
dpkg -x "$LIBSSL_DEB" "$CROSS_BUILD_DEPS_DIR"
rm "$LIBSSL_DEB"
# Java Common
apt-get download "java-common"
JC_DEB=$(find . -name "java-common_*.deb")
dpkg -x "$JC_DEB" "$CROSS_BUILD_DEPS_DIR"
rm "$JC_DEB"
# OpenJDK-JRE-Headless
apt-get download "openjdk-11-jre-headless:${CPU_ARCH_DPKG}"
OJDKRH_DEB=$(find . -name "openjdk-11-jre-headless_*.deb")
dpkg -x "$OJDKRH_DEB" "$CROSS_BUILD_DEPS_DIR"
rm "$OJDKRH_DEB"
# OpenJDK-JRE
apt-get download "openjdk-11-jre:${CPU_ARCH_DPKG}"
OJDKR_DEB=$(find . -name "openjdk-11-jre_*.deb")
dpkg -x "$OJDKR_DEB" "$CROSS_BUILD_DEPS_DIR"
rm "$OJDKR_DEB"
# OpenJDK-JDK
apt-get download "openjdk-11-jdk-headless:${CPU_ARCH_DPKG}"
OJDKJ_DEB=$(find . -name "openjdk-11-jdk-headless_*.deb")
dpkg -x "$OJDKJ_DEB" "$CROSS_BUILD_DEPS_DIR"
rm "$OJDKJ_DEB"
# OpenJDK-GUI
apt-get download "openjdk-11-jdk:${CPU_ARCH_DPKG}"
OJDKG_DEB=$(find . -name "openjdk-11-jdk_*.deb")
dpkg -x "$OJDKG_DEB" "$CROSS_BUILD_DEPS_DIR"
rm "$OJDKG_DEB"
# Fix symlinks # Check if openjdk is found
find "$CROSS_BUILD_DEPS_DIR" -lname "/*" \ fix_jdk_path
-exec sh -c "ln -sf \"\`echo \"$CROSS_BUILD_DEPS_DIR\$(readlink \$0)\"\`\" \"\$0\"" {} \; check_jdk_existance
# Check if openjdk is found touch "$CROSS_BUILD_DEPS_DIR/ok-012"
fi
fix_jdk_path fix_jdk_path
check_jdk_existance check_jdk_existance
cd "${PWD_BEFORE_CROSS_DEPS}"
touch "$CROSS_BUILD_DEPS_DIR/ok-012" apt install -y "crossbuild-essential-${CPU_ARCH_DPKG}"
fi fi
fix_jdk_path
check_jdk_existance
cd "${PWD_BEFORE_CROSS_DEPS}"
source ./scripts/continuous-integration/github-workflows/install-dependencies.sh source ./scripts/continuous-integration/github-workflows/install-dependencies.sh
sudo apt install -y "crossbuild-essential-${CPU_ARCH_DPKG}"
source ./scripts/continuous-integration/github-workflows/build-natives.sh source ./scripts/continuous-integration/github-workflows/build-natives.sh