buildjre8: improvements (#19)

* .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

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/

* .github: actions runner: update to ubuntu-22.04

a bit of future-proofing wont hurt... right?

* fixup! .github: java setup: its 7 not 1.7

i retartded

---------

Signed-off-by: fukiame <fukiame@proton.me>
This commit is contained in:
fukiame 2024-01-16 23:33:23 +07:00 committed by GitHub
parent 11a8b4b1b5
commit a753e0e862
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 47 additions and 46 deletions

View File

@ -15,18 +15,23 @@ jobs:
fail-fast: false
name: "Build for Android ${{matrix.arch}}"
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: set up JDK 1.7
uses: actions/setup-java@v1
uses: actions/setup-java@v4
with:
java-version: 1.7
java-version: 7
distribution: zulu
- name: Install build dependencies
run: |
sudo apt update
sudo apt -y install autoconf python3 python-is-python3 unzip zip systemtap-sdt-dev gcc-multilib g++-multilib libxtst-dev libasound2-dev libelf-dev libfontconfig1-dev libx11-dev
- name: Build with CI build script
run: bash "ci_build_arch_${{matrix.arch}}.sh"
- name: Upload JDK build output
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: "jdk8-${{matrix.arch}}"
path: jdk8*.tar.xz
@ -36,46 +41,46 @@ jobs:
uses: mxschmitt/action-tmate@v3
- name: Upload JRE build output
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: 'jre8-${{matrix.arch}}'
path: jre8*.tar.xz
- name: Upload JRE debuginfo build output
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: "jre8-debuginfo-${{matrix.arch}}"
path: dizout
pojav:
needs: build_android
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Get jre8-aarch32
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: jre8-aarch32
path: pojav
- name: Get jre8-aarch64
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: jre8-aarch64
path: pojav
- name: Get jre8-x86
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: jre8-x86
path: pojav
- name: Get jre8-x86_64
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: jre8-x86_64
path: pojav
- name: Repack JRE
run: bash "repackjre.sh" $GITHUB_WORKSPACE/pojav $GITHUB_WORKSPACE/pojav/jre8-pojav
- name: Upload artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: jre8-pojav
path: pojav/jre8-pojav/*

View File

@ -2,7 +2,7 @@
set -e
. setdevkitpath.sh
if [ "$TARGET_JDK" == "arm" ]
if [[ "$TARGET_JDK" == "arm" ]]
then
export TARGET_JDK=aarch32
export TARGET_PHYS=aarch32-linux-androideabi
@ -15,7 +15,7 @@ export FREETYPE_DIR=$PWD/freetype-$BUILD_FREETYPE_VERSION/build_android-$TARGET_
export CUPS_DIR=$PWD/cups-2.2.4
export CFLAGS+=" -DLE_STANDALONE" # -I$FREETYPE_DIR -I$CUPS_DI
# if [ "$TARGET_JDK" == "aarch32" ] || [ "$TARGET_JDK" == "aarch64" ]
# if [[ "$TARGET_JDK" == "aarch32" ]] || [[ "$TARGET_JDK" == "aarch64" ]]
# then
# export CFLAGS+=" -march=armv7-a+neon"
# fi
@ -26,7 +26,7 @@ export CFLAGS+=" -DLE_STANDALONE" # -I$FREETYPE_DIR -I$CUPS_DI
# cp -R /usr/include/X11 $ANDROID_INCLUDE/
# cp -R /usr/include/fontconfig $ANDROID_INCLUDE/
if [ "$BUILD_IOS" != "1" ]; then
if [[ "$BUILD_IOS" != "1" ]]; then
export CFLAGS+=" -O3 -D__ANDROID__"
ln -s -f /usr/include/X11 $ANDROID_INCLUDE/
@ -35,7 +35,6 @@ if [ "$BUILD_IOS" != "1" ]; then
export LDFLAGS+=" -L`pwd`/dummy_libs"
sudo apt -y install systemtap-sdt-dev gcc-multilib g++-multilib libxtst-dev libasound2-dev libelf-dev libfontconfig1-dev libx11-dev
# Create dummy libraries so we won't have to remove them in OpenJDK makefiles
mkdir -p dummy_libs
ar cru dummy_libs/libpthread.a
@ -61,15 +60,15 @@ ln -s -f $CUPS_DIR/cups $ANDROID_INCLUDE/
cd openjdk
# Apply patches
if [ "$BUILD_IOS" != "1" ]; then
if [[ "$BUILD_IOS" != "1" ]]; then
git reset --hard
git apply --reject --whitespace=fix ../patches/jdk8u_android.diff || echo "git apply failed (universal patch set)"
if [ "$TARGET_JDK" != "aarch32" ]; then
if [[ "$TARGET_JDK" != "aarch32" ]]; then
git apply --reject --whitespace=fix ../patches/jdk8u_android_main.diff || echo "git apply failed (main non-universal patch set)"
else
git apply --reject --whitespace=fix ../patches/jdk8u_android_aarch32.diff || echo "git apply failed (aarch32 non-universal patch set)"
fi
if [ "$TARGET_JDK" == "x86" ]; then
if [[ "$TARGET_JDK" == "x86" ]]; then
git apply --reject --whitespace=fix ../patches/jdk8u_android_page_trap_fix.diff || echo "git apply failed (x86 page trap fix)"
fi
fi
@ -102,7 +101,7 @@ bash ./configure \
--x-libraries=/usr/lib \
$platform_args || \
error_code=$?
if [ "$error_code" -ne 0 ]; then
if [[ "$error_code" -ne 0 ]]; then
echo "\n\nCONFIGURE ERROR $error_code , config.log:"
cat config.log
exit $error_code
@ -111,7 +110,7 @@ fi
cd build/${JVM_PLATFORM}-${TARGET_JDK}-normal-${JVM_VARIANTS}-${JDK_DEBUG_LEVEL}
make JOBS=4 images || \
error_code=$?
if [ "$error_code" -ne 0 ]; then
if [[ "$error_code" -ne 0 ]]; then
echo "Build failure, exited with code $error_code. Trying again."
make JOBS=4 images
fi

View File

@ -5,7 +5,7 @@ cd freetype-$BUILD_FREETYPE_VERSION
echo "Building Freetype"
if [ "$BUILD_IOS" == "1" ]; then
if [[ "$BUILD_IOS" == "1" ]]; then
LDFLAGS=-"arch arm64 -isysroot $thesysroot -miphoneos-version-min=12.0"
export CC=$thecc
@ -34,7 +34,7 @@ else
--with-harfbuzz=no $EXTRA_ARGS \
|| error_code=$?
fi
if [ "$error_code" -ne 0 ]; then
if [[ "$error_code" -ne 0 ]]; then
echo "\n\nCONFIGURE ERROR $error_code , config.log:"
cat config.log
exit $error_code
@ -43,6 +43,6 @@ fi
CFLAGS=-fno-rtti CXXFLAGS=-fno-rtti make -j4
make install
if [ -f "${namefreetype}.a" ]; then
if [[ -f "${namefreetype}.a" ]]; then
clang -fPIC -shared $LDFLAGS -lbz2 -Wl,-all_load ${namefreetype}.a -o ${namefreetype}.dylib
fi

View File

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

View File

@ -4,10 +4,7 @@ set -e
export JDK_DEBUG_LEVEL=release
if [ "$BUILD_IOS" != "1" ]; then
sudo apt update
sudo apt -y install autoconf python unzip zip
if [[ "$BUILD_IOS" != "1" ]]; then
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
./maketoolchain.sh

View File

@ -1,8 +1,8 @@
#!/bin/bash
set -e
if [ "$TARGET_JDK" == "arm" ]; then
if [[ "$TARGET_JDK" == "arm" ]]; then
git clone --depth 1 https://github.com/openjdk/aarch32-port-jdk8u openjdk
elif [ "$BUILD_IOS" == "1" ]; then
elif [[ "$BUILD_IOS" == "1" ]]; then
git clone --depth 1 --branch ios https://github.com/PojavLauncherTeam/openjdk-multiarch-jdk8u openjdk
else
# Use aarch32 repo because it also has aarch64

View File

@ -1,7 +1,7 @@
#!/bin/bash
set -e
if [ "$TARGET_JDK" == "arm" ]; then
if [[ "$TARGET_JDK" == "arm" ]]; then
export TARGET_JDK=aarch32
fi
@ -13,7 +13,7 @@ mkdir dizout
cp -r $imagespath/j2re-image jreout
cp -r $imagespath/j2sdk-image jdkout
if [ "$TARGET_JDK" == "x86" ]; then
if [[ "$TARGET_JDK" == "x86" ]]; then
export TARGET_JDK=i386
fi
@ -29,7 +29,7 @@ mv jreout/lib/libfreetype.dylib.6 jreout/lib/libfreetype.dylib || echo "Move exi
find jreout -name "*.diz" -delete
find jdkout -name "*.diz" -exec mv {} dizout/ \;
if [ "$BUILD_IOS" == "1" ]; then
if [[ "$BUILD_IOS" == "1" ]]; then
install_name_tool -id @rpath/libfreetype.dylib jdkout/jre/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/jre/lib/libfontmanager.dylib

View File

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

View File

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

View File

@ -1,10 +1,10 @@
#!/bin/bash
set -e
if [ "$BUILD_IOS" != "1" ]; then
if [[ "$BUILD_IOS" != "1" ]]; then
unset AR AS CC CXX LD OBJCOPY RANLIB STRIP CPPFLAGS LDFLAGS
git clone https://github.com/termux/termux-elf-cleaner
git clone --depth 1 -b 'v2.2.0' https://github.com/termux/termux-elf-cleaner
cd termux-elf-cleaner
autoreconf --install
bash configure