Build jdk17 for iOS

This commit is contained in:
khanhduytran0 2022-08-16 12:26:27 +07:00
parent ebf9aff0c1
commit 87441e69ce
8 changed files with 65 additions and 19 deletions

View File

@ -1,4 +1,4 @@
name: Build OpenJDK 17 for Android name: Build OpenJDK 17 for Android and iOS
on: [push, pull_request, workflow_dispatch] on: [push, pull_request, workflow_dispatch]
@ -36,6 +36,42 @@ jobs:
name: "jre17-debuginfo-${{matrix.arch}}" name: "jre17-debuginfo-${{matrix.arch}}"
path: dizout path: dizout
build_iosport:
name: "Build for iOS aarch64"
runs-on: macOS-latest
continue-on-error: true
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: set up JDK 1.16
uses: actions/setup-java@v1
with:
java-version: 1.16
- name: Build with CI build script
run: |
export BUILD_IOS=1
bash "ci_build_arch_aarch64.sh"
- name: Upload JDK build output
uses: actions/upload-artifact@v2
with:
name: "jdk17-ios-aarch64"
path: jdk17*.tar.xz
- name: Upload JRE build output
uses: actions/upload-artifact@v2
with:
name: 'jre17-ios-aarch64'
path: jre17*.tar.xz
- name: Upload JRE debuginfo build output
uses: actions/upload-artifact@v2
with:
name: "jre17-ios-debuginfo-aarch64"
path: dizout
pojav: pojav:
needs: build_android needs: build_android
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04

View File

@ -4,8 +4,8 @@ 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 -DANDROID" # -I$FREETYPE_DIR -I$CUPS_DI export CFLAGS+=" -DLE_STANDALONE" # -I$FREETYPE_DIR -I$CUPS_DI
if [ "$TARGET_JDK" == "arm" ] if [ "$TARGET_JDK" == "arm" ] # || [ "$BUILD_IOS" == "1" ]
then then
export CFLAGS+=" -O3 -D__thumb__" export CFLAGS+=" -O3 -D__thumb__"
else else
@ -28,8 +28,13 @@ if [ "$BUILD_IOS" != "1" ]; then
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/
ln -s -f /usr/include/fontconfig $ANDROID_INCLUDE/ ln -s -f /usr/include/fontconfig $ANDROID_INCLUDE/
platform_args=--with-toolchain-type=gcc
--with-freetype-include=$FREETYPE_DIR/include/freetype2 \
--with-freetype-lib=$FREETYPE_DIR/lib \
"
AUTOCONF_x11arg="--x-includes=$ANDROID_INCLUDE/X11" AUTOCONF_x11arg="--x-includes=$ANDROID_INCLUDE/X11"
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 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
@ -41,13 +46,17 @@ if [ "$BUILD_IOS" != "1" ]; then
ar cru dummy_libs/libthread_db.a ar cru dummy_libs/libthread_db.a
else else
ln -s -f /opt/X11/include/X11 $ANDROID_INCLUDE/ ln -s -f /opt/X11/include/X11 $ANDROID_INCLUDE/
platform_args=--with-toolchain-type=clang platform_args="--with-toolchain-type=clang --with-sysroot=$(xcrun --sdk iphoneos --show-sdk-path) \
AUTOCONF_x11arg="--with-x=/opt/X11/include/X11 --disable-precompiled-headers --prefix=/usr/lib" --with-boot-jdk=$(/usr/libexec/java_home -v 17) \
sameflags="-arch arm64 -isysroot $thesysroot -miphoneos-version-min=12.0 -DHEADLESS=1 -I$PWD/ios-missing-include -Wno-implicit-function-declaration" --with-freetype=bundled \
"
AUTOCONF_x11arg="--with-x=/opt/X11/include/X11 --prefix=/usr/lib"
sameflags="-arch arm64 -DHEADLESS=1 -I$PWD/ios-missing-include -Wno-implicit-function-declaration -DTARGET_OS_OSX"
export CFLAGS+=" $sameflags" export CFLAGS+=" $sameflags"
export CXXFLAGS="$sameflags" export LDFLAGS+="-arch arm64"
export BUILD_SYSROOT_CFLAGS="-isysroot ${themacsysroot}"
HOMEBREW_NO_AUTO_UPDATE=1 brew install ldid xquartz HOMEBREW_NO_AUTO_UPDATE=1 brew install ldid xquartz autoconf
fi fi
# fix building libjawt # fix building libjawt
@ -58,7 +67,6 @@ cd openjdk
# --with-extra-cxxflags="$CXXFLAGS -Dchar16_t=uint16_t -Dchar32_t=uint32_t" \ # --with-extra-cxxflags="$CXXFLAGS -Dchar16_t=uint16_t -Dchar32_t=uint32_t" \
# --with-extra-cflags="$CPPFLAGS" \ # --with-extra-cflags="$CPPFLAGS" \
# --with-sysroot="$(xcrun --sdk iphoneos --show-sdk-path)" \
bash ./configure \ bash ./configure \
--openjdk-target=$TARGET \ --openjdk-target=$TARGET \
@ -69,15 +77,12 @@ bash ./configure \
--disable-warnings-as-errors \ --disable-warnings-as-errors \
--enable-option-checking=fatal \ --enable-option-checking=fatal \
--enable-headless-only=yes \ --enable-headless-only=yes \
--with-toolchain-type=gcc \
--with-jvm-variants=$JVM_VARIANTS \ --with-jvm-variants=$JVM_VARIANTS \
--with-jvm-features=-dtrace,-zero,-vm-structs,-epsilongc \ --with-jvm-features=-dtrace,-zero,-vm-structs,-epsilongc \
--with-cups-include=$CUPS_DIR \ --with-cups-include=$CUPS_DIR \
--with-devkit=$TOOLCHAIN \ --with-devkit=$TOOLCHAIN \
--with-debug-level=$JDK_DEBUG_LEVEL \ --with-debug-level=$JDK_DEBUG_LEVEL \
--with-fontconfig-include=$ANDROID_INCLUDE \ --with-fontconfig-include=$ANDROID_INCLUDE \
--with-freetype-lib=$FREETYPE_DIR/lib \
--with-freetype-include=$FREETYPE_DIR/include/freetype2 \
$AUTOCONF_x11arg $AUTOCONF_EXTRA_ARGS \ $AUTOCONF_x11arg $AUTOCONF_EXTRA_ARGS \
--x-libraries=/usr/lib \ --x-libraries=/usr/lib \
$platform_args || \ $platform_args || \

View File

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

View File

@ -12,9 +12,6 @@ if [ "$BUILD_IOS" != "1" ]; then
./extractndk.sh ./extractndk.sh
./maketoolchain.sh ./maketoolchain.sh
else else
# OpenJDK 8 iOS port is still in unusable state, so we need build in debug mode
export JDK_DEBUG_LEVEL=slowdebug
chmod +x ios-arm64-clang chmod +x ios-arm64-clang
chmod +x ios-arm64-clang++ chmod +x ios-arm64-clang++
chmod +x macos-host-cc chmod +x macos-host-cc

View File

@ -1,4 +1,9 @@
#!/bin/bash #!/bin/bash
set -e set -e
git clone --depth 1 https://github.com/PojavLauncherTeam/mobile openjdk # TODO: use jdk17u repo for building for Android
if [ "$BUILD_IOS" != "1" ]; then
git clone --depth 1 https://github.com/PojavLauncherTeam/mobile openjdk
else
git clone --depth 1 https://github.com/PojavLauncherTeam/jdk17u openjdk
fi

View File

@ -1 +1,2 @@
exec $thecc -arch arm64 -isysroot $thesysroot "$@" #echo $@
exec $thecc -arch arm64 -isysroot $thesysroot -miphoneos-version-min=12.0 "$@"

View File

@ -1 +1,2 @@
exec $thecxx -arch arm64 -isysroot $thesysroot "$@" #echo $0 $@
exec $thecxx -arch arm64 -isysroot $thesysroot -miphoneos-version-min=12.0 "$@"

View File

@ -35,6 +35,7 @@ if [ "$BUILD_IOS" == "1" ]; then
export thehostcxx=$PWD/macos-host-cc export thehostcxx=$PWD/macos-host-cc
export CC=$PWD/ios-arm64-clang export CC=$PWD/ios-arm64-clang
export CXX=$PWD/ios-arm64-clang++ export CXX=$PWD/ios-arm64-clang++
export CXXCPP="$CXX -E"
export LD=$(xcrun -find -sdk iphoneos ld) export LD=$(xcrun -find -sdk iphoneos ld)
export HOTSPOT_DISABLE_DTRACE_PROBES=1 export HOTSPOT_DISABLE_DTRACE_PROBES=1