buildjre17: improvements (#20)

* .github: move apt commands to workflow

the scripts are capable of running on other distros, so "let the host cook"
also explicitly use Python 3 here as the build env do not use Python 2

* treewide: use bash [[

./buildlibs.sh: line 18: [: : integer expression expected
...
./buildjdk.sh: line 53: [: : integer expression expected
...

all scripts has bash shebang anyways,
replace all single brackets [ with bash's double brackets [[

* [hack] tarjdk: force termux-elf-cleaner v2.2.0

g++: error: unrecognized command line option ‘-std=c++20’; did you mean ‘-std=c++2a’?

caused by a mix of our outdated toolchains and an upstream commit [1]
downgrade the version of termux-elf-cleaner we use to the latest stable tag to workaround the issue

[1]: 9578f2c4bc

Test: presubmit
Signed-off-by: fukiame <fukiame@proton.me>

* .github: update actions and runner image

The following actions uses node12 which is deprecated and will be forced to run on node16: actions/checkout@v2, actions/setup-java@v1, actions/upload-artifact@v2. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/

* Revert "[hack] tarjdk: force termux-elf-cleaner v2.2.0"

this branch doesnt serm to be affected by the error...
i dont get it

This reverts commit 40f4b1a5fb28042c57bbaec826eea4cce9fdc8b9.

---------

Signed-off-by: fukiame <fukiame@proton.me>
This commit is contained in:
fukiame 2024-03-10 01:20:51 +07:00 committed by GitHub
parent 0e55fd2fc9
commit 3c2f8fe40e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 47 additions and 47 deletions

View File

@ -15,28 +15,33 @@ jobs:
fail-fast: false fail-fast: false
name: "Build for Android ${{matrix.arch}}" name: "Build for Android ${{matrix.arch}}"
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v2 uses: actions/checkout@v4
- name: set up JDK 1.17 - name: set up JDK 1.17
uses: actions/setup-java@v1 uses: actions/setup-java@v4
with: with:
java-version: 1.17 java-version: 17
distribution: temurin
- name: Install build dependencies
run: |
sudo apt update
sudo apt -y install autoconf python3 python-is-python3 unzip zip systemtap-sdt-dev libxtst-dev libasound2-dev libelf-dev libfontconfig1-dev libx11-dev libxext-dev libxrandr-dev libxrender-dev libxtst-dev libxt-dev
- name: Build with CI build script - name: Build with CI build script
run: bash "ci_build_arch_${{matrix.arch}}.sh" run: bash "ci_build_arch_${{matrix.arch}}.sh"
- name: Upload JDK build output - name: Upload JDK build output
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v4
with: with:
name: "jdk17-${{matrix.arch}}" name: "jdk17-${{matrix.arch}}"
path: jdk17*.tar.xz path: jdk17*.tar.xz
- name: Upload JRE build output - name: Upload JRE build output
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v4
with: with:
name: 'jre17-${{matrix.arch}}' name: 'jre17-${{matrix.arch}}'
path: jre17*.tar.xz path: jre17*.tar.xz
- name: Upload JRE debuginfo build output - name: Upload JRE debuginfo build output
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v4
with: with:
name: "jre17-debuginfo-${{matrix.arch}}" name: "jre17-debuginfo-${{matrix.arch}}"
path: dizout path: dizout
@ -47,7 +52,7 @@ jobs:
continue-on-error: true continue-on-error: true
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v2 uses: actions/checkout@v4
- name: Build with CI build script - name: Build with CI build script
run: | run: |
@ -57,53 +62,53 @@ jobs:
bash "ci_build_arch_aarch64.sh" bash "ci_build_arch_aarch64.sh"
- name: Upload JDK build output - name: Upload JDK build output
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v4
with: with:
name: "jdk17-ios-aarch64" name: "jdk17-ios-aarch64"
path: jdk17*.tar.xz path: jdk17*.tar.xz
- name: Upload JRE build output - name: Upload JRE build output
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v4
with: with:
name: 'jre17-ios-aarch64' name: 'jre17-ios-aarch64'
path: jre17*.tar.xz path: jre17*.tar.xz
- name: Upload JRE debuginfo build output - name: Upload JRE debuginfo build output
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v4
with: with:
name: "jre17-ios-debuginfo-aarch64" name: "jre17-ios-debuginfo-aarch64"
path: dizout path: dizout
pojav: pojav:
needs: build_android needs: build_android
runs-on: ubuntu-20.04 runs-on: ubuntu-22.04
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v2 uses: actions/checkout@v4
- name: Get jre17-aarch32 - name: Get jre17-aarch32
uses: actions/download-artifact@v2 uses: actions/download-artifact@v4
with: with:
name: jre17-aarch32 name: jre17-aarch32
path: pojav path: pojav
- name: Get jre17-aarch64 - name: Get jre17-aarch64
uses: actions/download-artifact@v2 uses: actions/download-artifact@v4
with: with:
name: jre17-aarch64 name: jre17-aarch64
path: pojav path: pojav
- name: Get jre17-x86 - name: Get jre17-x86
uses: actions/download-artifact@v2 uses: actions/download-artifact@v4
with: with:
name: jre17-x86 name: jre17-x86
path: pojav path: pojav
- name: Get jre17-x86_64 - name: Get jre17-x86_64
uses: actions/download-artifact@v2 uses: actions/download-artifact@v4
with: with:
name: jre17-x86_64 name: jre17-x86_64
path: pojav path: pojav
- name: Repack JRE - name: Repack JRE
run: bash "repackjre.sh" $GITHUB_WORKSPACE/pojav $GITHUB_WORKSPACE/pojav/jre17-pojav run: bash "repackjre.sh" $GITHUB_WORKSPACE/pojav $GITHUB_WORKSPACE/pojav/jre17-pojav
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v4
with: with:
name: jre17-pojav name: jre17-pojav
path: pojav/jre17-pojav/* path: pojav/jre17-pojav/*

View File

@ -5,18 +5,18 @@ set -e
export FREETYPE_DIR=$PWD/freetype-$BUILD_FREETYPE_VERSION/build_android-$TARGET_SHORT export FREETYPE_DIR=$PWD/freetype-$BUILD_FREETYPE_VERSION/build_android-$TARGET_SHORT
export CUPS_DIR=$PWD/cups-2.2.4 export CUPS_DIR=$PWD/cups-2.2.4
export CFLAGS+=" -DLE_STANDALONE" # -I$FREETYPE_DIR -I$CUPS_DI export CFLAGS+=" -DLE_STANDALONE" # -I$FREETYPE_DIR -I$CUPS_DI
if [ "$TARGET_JDK" == "arm" ] # || [ "$BUILD_IOS" == "1" ] if [[ "$TARGET_JDK" == "arm" ]] # || [[ "$BUILD_IOS" == "1" ]]
then then
export CFLAGS+=" -O3 -D__thumb__" export CFLAGS+=" -O3 -D__thumb__"
else else
if [ "$TARGET_JDK" == "x86" ]; then if [[ "$TARGET_JDK" == "x86" ]]; then
export CFLAGS+=" -O3 -mstackrealign" export CFLAGS+=" -O3 -mstackrealign"
else else
export CFLAGS+=" -O3" export CFLAGS+=" -O3"
fi fi
fi fi
# if [ "$TARGET_JDK" == "aarch32" ] || [ "$TARGET_JDK" == "aarch64" ] # if [[ "$TARGET_JDK" == "aarch32" ]] || [[ "$TARGET_JDK" == "aarch64" ]]
# then # then
# export CFLAGS+=" -march=armv7-a+neon" # export CFLAGS+=" -march=armv7-a+neon"
# fi # fi
@ -27,7 +27,7 @@ fi
# cp -R /usr/include/X11 $ANDROID_INCLUDE/ # cp -R /usr/include/X11 $ANDROID_INCLUDE/
# cp -R /usr/include/fontconfig $ANDROID_INCLUDE/ # cp -R /usr/include/fontconfig $ANDROID_INCLUDE/
if [ "$BUILD_IOS" != "1" ]; then if [[ "$BUILD_IOS" != "1" ]]; then
chmod +x android-wrapped-clang chmod +x android-wrapped-clang
chmod +x android-wrapped-clang++ chmod +x android-wrapped-clang++
ln -s -f /usr/include/X11 $ANDROID_INCLUDE/ ln -s -f /usr/include/X11 $ANDROID_INCLUDE/
@ -41,8 +41,6 @@ if [ "$BUILD_IOS" != "1" ]; then
export CFLAGS+=" -DANDROID" export CFLAGS+=" -DANDROID"
export LDFLAGS+=" -L$PWD/dummy_libs" export LDFLAGS+=" -L$PWD/dummy_libs"
sudo apt -y install systemtap-sdt-dev libxtst-dev libasound2-dev libelf-dev libfontconfig1-dev libx11-dev libxext-dev libxrandr-dev libxrender-dev libxtst-dev libxt-dev
# Create dummy libraries so we won't have to remove them in OpenJDK makefiles # Create dummy libraries so we won't have to remove them in OpenJDK makefiles
mkdir -p dummy_libs mkdir -p dummy_libs
ar cru dummy_libs/libpthread.a ar cru dummy_libs/libpthread.a
@ -52,7 +50,7 @@ else
ln -s -f /opt/X11/include/X11 $ANDROID_INCLUDE/ ln -s -f /opt/X11/include/X11 $ANDROID_INCLUDE/
ln -sfn $themacsysroot/System/Library/Frameworks/CoreAudio.framework/Headers $ANDROID_INCLUDE/CoreAudio ln -sfn $themacsysroot/System/Library/Frameworks/CoreAudio.framework/Headers $ANDROID_INCLUDE/CoreAudio
ln -sfn $themacsysroot/System/Library/Frameworks/IOKit.framework/Headers $ANDROID_INCLUDE/IOKit ln -sfn $themacsysroot/System/Library/Frameworks/IOKit.framework/Headers $ANDROID_INCLUDE/IOKit
if [ "$(uname -p)" == "arm" ]; then if [[ "$(uname -p)" == "arm" ]]; then
ln -s -f /opt/homebrew/include/fontconfig $ANDROID_INCLUDE/ ln -s -f /opt/homebrew/include/fontconfig $ANDROID_INCLUDE/
else else
ln -s -f /usr/local/include/fontconfig $ANDROID_INCLUDE/ ln -s -f /usr/local/include/fontconfig $ANDROID_INCLUDE/
@ -77,7 +75,7 @@ cd openjdk
# Apply patches # Apply patches
git reset --hard git reset --hard
if [ "$BUILD_IOS" != "1" ]; then if [[ "$BUILD_IOS" != "1" ]]; then
git apply --reject --whitespace=fix ../patches/jdk17u_android.diff || echo "git apply failed (Android patch set)" git apply --reject --whitespace=fix ../patches/jdk17u_android.diff || echo "git apply failed (Android patch set)"
else else
git apply --reject --whitespace=fix ../patches/jdk17u_ios.diff || echo "git apply failed (iOS patch set)" git apply --reject --whitespace=fix ../patches/jdk17u_ios.diff || echo "git apply failed (iOS patch set)"
@ -114,7 +112,7 @@ bash ./configure \
--x-libraries=/usr/lib \ --x-libraries=/usr/lib \
$platform_args || \ $platform_args || \
error_code=$? error_code=$?
if [ "$error_code" -ne 0 ]; then if [[ "$error_code" -ne 0 ]]; then
echo "\n\nCONFIGURE ERROR $error_code , config.log:" echo "\n\nCONFIGURE ERROR $error_code , config.log:"
cat config.log cat config.log
exit $error_code exit $error_code
@ -122,14 +120,14 @@ fi
jobs=4 jobs=4
if [ "$BUILD_IOS" == "1" ]; then if [[ "$BUILD_IOS" == "1" ]]; then
jobs=$(sysctl -n hw.ncpu) jobs=$(sysctl -n hw.ncpu)
fi fi
cd build/${JVM_PLATFORM}-${TARGET_JDK}-${JVM_VARIANTS}-${JDK_DEBUG_LEVEL} cd build/${JVM_PLATFORM}-${TARGET_JDK}-${JVM_VARIANTS}-${JDK_DEBUG_LEVEL}
make JOBS=$jobs images || \ make JOBS=$jobs images || \
error_code=$? error_code=$?
if [ "$error_code" -ne 0 ]; then if [[ "$error_code" -ne 0 ]]; then
echo "Build failure, exited with code $error_code. Trying again." echo "Build failure, exited with code $error_code. Trying again."
make JOBS=$jobs images make JOBS=$jobs images
fi fi

View File

@ -5,7 +5,7 @@ cd freetype-$BUILD_FREETYPE_VERSION
echo "Building Freetype" echo "Building Freetype"
if [ "$BUILD_IOS" != "1" ]; then if [[ "$BUILD_IOS" != "1" ]]; then
export PATH=$TOOLCHAIN/bin:$PATH export PATH=$TOOLCHAIN/bin:$PATH
./configure \ ./configure \
--host=$TARGET \ --host=$TARGET \
@ -15,7 +15,7 @@ if [ "$BUILD_IOS" != "1" ]; then
--with-harfbuzz=no $EXTRA_ARGS \ --with-harfbuzz=no $EXTRA_ARGS \
|| error_code=$? || error_code=$?
if [ "$error_code" -ne 0 ]; then if [[ "$error_code" -ne 0 ]]; then
echo "\n\nCONFIGURE ERROR $error_code , config.log:" echo "\n\nCONFIGURE ERROR $error_code , config.log:"
cat ${PWD}/builds/unix/config.log cat ${PWD}/builds/unix/config.log
exit $error_code exit $error_code

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
set -e set -e
if [ "$BUILD_IOS" == "1" ]; then if [[ "$BUILD_IOS" == "1" ]]; then
export TARGET=aarch64-apple-ios export TARGET=aarch64-apple-ios
else else
export TARGET=aarch64-linux-android export TARGET=aarch64-linux-android

View File

@ -4,10 +4,7 @@ set -e
export JDK_DEBUG_LEVEL=release export JDK_DEBUG_LEVEL=release
if [ "$BUILD_IOS" != "1" ]; then if [[ "$BUILD_IOS" != "1" ]]; then
sudo apt update
sudo apt -y install autoconf python unzip zip
wget -nc -nv -O android-ndk-$NDK_VERSION-linux-x86_64.zip "https://dl.google.com/android/repository/android-ndk-$NDK_VERSION-linux-x86_64.zip" wget -nc -nv -O android-ndk-$NDK_VERSION-linux-x86_64.zip "https://dl.google.com/android/repository/android-ndk-$NDK_VERSION-linux-x86_64.zip"
./extractndk.sh ./extractndk.sh
./maketoolchain.sh ./maketoolchain.sh

View File

@ -8,7 +8,7 @@ imagespath=openjdk/build/${JVM_PLATFORM}-${TARGET_JDK}-${JVM_VARIANTS}-${JDK_DEB
rm -rf dizout jreout jdkout dSYM-temp rm -rf dizout jreout jdkout dSYM-temp
mkdir -p dizout dSYM-temp/{lib,bin} mkdir -p dizout dSYM-temp/{lib,bin}
if [ "$BUILD_IOS" != "1" ]; then if [[ "$BUILD_IOS" != "1" ]]; then
cp freetype-$BUILD_FREETYPE_VERSION/build_android-$TARGET_SHORT/lib/libfreetype.so $imagespath/jdk/lib/ cp freetype-$BUILD_FREETYPE_VERSION/build_android-$TARGET_SHORT/lib/libfreetype.so $imagespath/jdk/lib/
fi fi
@ -22,7 +22,7 @@ cp -r $imagespath/jdk jdkout
export EXTRA_JLINK_OPTION= export EXTRA_JLINK_OPTION=
if [ "$TARGET_JDK" == "aarch64" ] || [ "$TARGET_JDK" == "x86_64" ]; then if [[ "$TARGET_JDK" == "aarch64" ]] || [[ "$TARGET_JDK" == "x86_64" ]]; then
echo "Building for aarch64 or x86_64, introducing JVMCI module" echo "Building for aarch64 or x86_64, introducing JVMCI module"
export EXTRA_JLINK_OPTION=,jdk.internal.vm.ci export EXTRA_JLINK_OPTION=,jdk.internal.vm.ci
fi fi
@ -38,7 +38,7 @@ jlink \
--release-info=jdkout/release \ --release-info=jdkout/release \
--compress=0 --compress=0
if [ "$BUILD_IOS" != "1" ]; then if [[ "$BUILD_IOS" != "1" ]]; then
cp freetype-$BUILD_FREETYPE_VERSION/build_android-$TARGET_SHORT/lib/libfreetype.so jreout/lib/ cp freetype-$BUILD_FREETYPE_VERSION/build_android-$TARGET_SHORT/lib/libfreetype.so jreout/lib/
fi fi
@ -53,7 +53,7 @@ find jdkout -name "*.dSYM" | xargs -- rm -rf
#TODO: fix .dSYM stuff #TODO: fix .dSYM stuff
if [ "$BUILD_IOS" == "1" ]; then if [[ "$BUILD_IOS" == "1" ]]; then
install_name_tool -id @rpath/libfreetype.dylib jdkout/lib/libfreetype.dylib install_name_tool -id @rpath/libfreetype.dylib jdkout/lib/libfreetype.dylib
install_name_tool -id @rpath/libfreetype.dylib jreout/lib/libfreetype.dylib install_name_tool -id @rpath/libfreetype.dylib jreout/lib/libfreetype.dylib
install_name_tool -change build_android-arm64/lib/libfreetype.dylib @rpath/libfreetype.dylib jdkout/lib/libfontmanager.dylib install_name_tool -change build_android-arm64/lib/libfreetype.dylib @rpath/libfreetype.dylib jdkout/lib/libfontmanager.dylib

View File

@ -68,7 +68,7 @@ makearch i386 x86
makearch amd64 x86_64 makearch amd64 x86_64
# if running under GitHub Actions, write commit sha, else formatted system date # if running under GitHub Actions, write commit sha, else formatted system date
if [ -n "$GITHUB_SHA" ] if [[ -n "$GITHUB_SHA" ]]
then then
echo $GITHUB_SHA>"$out"/version echo $GITHUB_SHA>"$out"/version
else else

View File

@ -2,29 +2,29 @@
# https://github.com/PojavLauncherTeam/openjdk-multiarch-jdk8u/blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.c # https://github.com/PojavLauncherTeam/openjdk-multiarch-jdk8u/blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/native/sun/java2d/loops/GraphicsPrimitiveMgr.c
export NDK_VERSION=r21 export NDK_VERSION=r21
if [ -z "$BUILD_FREETYPE_VERSION" ] if [[ -z "$BUILD_FREETYPE_VERSION" ]]
then then
export BUILD_FREETYPE_VERSION="2.10.0" export BUILD_FREETYPE_VERSION="2.10.0"
fi fi
if [ -z "$JDK_DEBUG_LEVEL" ] if [[ -z "$JDK_DEBUG_LEVEL" ]]
then then
export JDK_DEBUG_LEVEL=release export JDK_DEBUG_LEVEL=release
fi fi
if [ "$TARGET_JDK" == "aarch64" ] if [[ "$TARGET_JDK" == "aarch64" ]]
then then
export TARGET_SHORT=arm64 export TARGET_SHORT=arm64
else else
export TARGET_SHORT=$TARGET_JDK export TARGET_SHORT=$TARGET_JDK
fi fi
if [ -z "$JVM_VARIANTS" ] if [[ -z "$JVM_VARIANTS" ]]
then then
export JVM_VARIANTS=server export JVM_VARIANTS=server
fi fi
if [ "$BUILD_IOS" == "1" ]; then if [[ "$BUILD_IOS" == "1" ]]; then
export JVM_PLATFORM=macosx export JVM_PLATFORM=macosx
export thecc=$(xcrun -find -sdk iphoneos clang) export thecc=$(xcrun -find -sdk iphoneos clang)

View File

@ -2,7 +2,7 @@
set -e set -e
. setdevkitpath.sh . setdevkitpath.sh
if [ "$BUILD_IOS" != "1" ]; then if [[ "$BUILD_IOS" != "1" ]]; then
unset AR AS CC CXX LD OBJCOPY RANLIB STRIP CPPFLAGS LDFLAGS unset AR AS CC CXX LD OBJCOPY RANLIB STRIP CPPFLAGS LDFLAGS
git clone https://github.com/termux/termux-elf-cleaner || true git clone https://github.com/termux/termux-elf-cleaner || true