diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5af2492..b33a210 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build OpenJDK 17 for Android +name: Build OpenJDK 17 for Android and iOS on: [push, pull_request, workflow_dispatch] @@ -36,6 +36,42 @@ jobs: name: "jre17-debuginfo-${{matrix.arch}}" 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: needs: build_android runs-on: ubuntu-20.04 diff --git a/buildjdk.sh b/buildjdk.sh index d12df01..09610cd 100755 --- a/buildjdk.sh +++ b/buildjdk.sh @@ -4,8 +4,8 @@ set -e export FREETYPE_DIR=$PWD/freetype-$BUILD_FREETYPE_VERSION/build_android-$TARGET_SHORT export CUPS_DIR=$PWD/cups-2.2.4 -export CFLAGS+=" -DLE_STANDALONE -DANDROID" # -I$FREETYPE_DIR -I$CUPS_DI -if [ "$TARGET_JDK" == "arm" ] +export CFLAGS+=" -DLE_STANDALONE" # -I$FREETYPE_DIR -I$CUPS_DI +if [ "$TARGET_JDK" == "arm" ] # || [ "$BUILD_IOS" == "1" ] then export CFLAGS+=" -O3 -D__thumb__" else @@ -28,8 +28,13 @@ if [ "$BUILD_IOS" != "1" ]; then chmod +x android-wrapped-clang++ ln -s -f /usr/include/X11 $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" + export CFLAGS+=" -DANDROID" 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 @@ -41,13 +46,17 @@ if [ "$BUILD_IOS" != "1" ]; then ar cru dummy_libs/libthread_db.a else ln -s -f /opt/X11/include/X11 $ANDROID_INCLUDE/ - platform_args=--with-toolchain-type=clang - AUTOCONF_x11arg="--with-x=/opt/X11/include/X11 --disable-precompiled-headers --prefix=/usr/lib" - sameflags="-arch arm64 -isysroot $thesysroot -miphoneos-version-min=12.0 -DHEADLESS=1 -I$PWD/ios-missing-include -Wno-implicit-function-declaration" + platform_args="--with-toolchain-type=clang --with-sysroot=$(xcrun --sdk iphoneos --show-sdk-path) \ + --with-boot-jdk=$(/usr/libexec/java_home -v 17) \ + --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 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 # fix building libjawt @@ -58,7 +67,6 @@ cd openjdk # --with-extra-cxxflags="$CXXFLAGS -Dchar16_t=uint16_t -Dchar32_t=uint32_t" \ # --with-extra-cflags="$CPPFLAGS" \ -# --with-sysroot="$(xcrun --sdk iphoneos --show-sdk-path)" \ bash ./configure \ --openjdk-target=$TARGET \ @@ -69,15 +77,12 @@ bash ./configure \ --disable-warnings-as-errors \ --enable-option-checking=fatal \ --enable-headless-only=yes \ - --with-toolchain-type=gcc \ --with-jvm-variants=$JVM_VARIANTS \ --with-jvm-features=-dtrace,-zero,-vm-structs,-epsilongc \ --with-cups-include=$CUPS_DIR \ --with-devkit=$TOOLCHAIN \ --with-debug-level=$JDK_DEBUG_LEVEL \ --with-fontconfig-include=$ANDROID_INCLUDE \ - --with-freetype-lib=$FREETYPE_DIR/lib \ - --with-freetype-include=$FREETYPE_DIR/include/freetype2 \ $AUTOCONF_x11arg $AUTOCONF_EXTRA_ARGS \ --x-libraries=/usr/lib \ $platform_args || \ diff --git a/ci_build_arch_aarch64.sh b/ci_build_arch_aarch64.sh index a75bd21..524ad64 100755 --- a/ci_build_arch_aarch64.sh +++ b/ci_build_arch_aarch64.sh @@ -1,7 +1,7 @@ #!/bin/bash set -e if [ "$BUILD_IOS" == "1" ]; then - export TARGET=aarch64-apple-darwin18.2 + export TARGET=aarch64-apple-ios else export TARGET=aarch64-linux-android fi diff --git a/ci_build_global.sh b/ci_build_global.sh index 2f75b56..2e262a2 100755 --- a/ci_build_global.sh +++ b/ci_build_global.sh @@ -12,9 +12,6 @@ if [ "$BUILD_IOS" != "1" ]; then ./extractndk.sh ./maketoolchain.sh 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 macos-host-cc diff --git a/clonejdk.sh b/clonejdk.sh index 7fda0a7..939fe42 100755 --- a/clonejdk.sh +++ b/clonejdk.sh @@ -1,4 +1,9 @@ #!/bin/bash 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 diff --git a/ios-arm64-clang b/ios-arm64-clang index 06baae7..0ea2f27 100755 --- a/ios-arm64-clang +++ b/ios-arm64-clang @@ -1 +1,2 @@ -exec $thecc -arch arm64 -isysroot $thesysroot "$@" +#echo $@ +exec $thecc -arch arm64 -isysroot $thesysroot -miphoneos-version-min=12.0 "$@" diff --git a/ios-arm64-clang++ b/ios-arm64-clang++ index 2117d08..612a743 100755 --- a/ios-arm64-clang++ +++ b/ios-arm64-clang++ @@ -1 +1,2 @@ -exec $thecxx -arch arm64 -isysroot $thesysroot "$@" +#echo $0 $@ +exec $thecxx -arch arm64 -isysroot $thesysroot -miphoneos-version-min=12.0 "$@" diff --git a/setdevkitpath.sh b/setdevkitpath.sh index 4245ded..8b42ec9 100755 --- a/setdevkitpath.sh +++ b/setdevkitpath.sh @@ -35,6 +35,7 @@ if [ "$BUILD_IOS" == "1" ]; then export thehostcxx=$PWD/macos-host-cc export CC=$PWD/ios-arm64-clang export CXX=$PWD/ios-arm64-clang++ + export CXXCPP="$CXX -E" export LD=$(xcrun -find -sdk iphoneos ld) export HOTSPOT_DISABLE_DTRACE_PROBES=1