Skip to content

Commit e52446b

Browse files
iOS aarch64 port of OpenJDK 8 (PojavLauncherTeam#5)
This port is still WIP and may not work.
1 parent f650380 commit e52446b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+6600
-102
lines changed

.github/workflows/build.yml

+71-33
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1+
name: Build OpenJDK 8 for Android and iOS
12

2-
name: Build OpenJDK for Android
33
on: [push, pull_request, workflow_dispatch]
4+
45
jobs:
5-
build:
6+
build_android:
67
strategy:
78
matrix:
89
arch: [ "aarch32", "aarch64", "x86", "x86_64" ]
910
fail-fast: false
10-
name: "Build ${{matrix.arch}}"
11+
12+
name: "Build for Android ${{matrix.arch}}"
1113
runs-on: ubuntu-20.04
1214
steps:
1315
- name: Checkout repository
@@ -33,36 +35,72 @@ jobs:
3335
with:
3436
name: "jre8-debuginfo-${{matrix.arch}}"
3537
path: dizout
38+
39+
build_iosport:
40+
name: "Build for iOS aarch64"
41+
runs-on: macOS-latest
42+
steps:
43+
- name: Checkout repository
44+
uses: actions/checkout@v2
45+
46+
- name: set up JDK 1.7
47+
uses: actions/setup-java@v1
48+
with:
49+
java-version: 1.7
50+
51+
- name: Build with CI build script
52+
run: |
53+
export BUILD_IOS=1
54+
bash "ci_build_arch_aarch64.sh"
55+
56+
- name: Upload JDK build output
57+
uses: actions/upload-artifact@v2
58+
with:
59+
name: "jdk8-ios-aarch64"
60+
path: jdk8*.tar.xz
61+
62+
- name: Upload JRE build output
63+
uses: actions/upload-artifact@v2
64+
with:
65+
name: 'jre8-ios-aarch64'
66+
path: jre8*.tar.xz
67+
68+
- name: Upload JRE debuginfo build output
69+
uses: actions/upload-artifact@v2
70+
with:
71+
name: "jre8-ios-debuginfo-aarch64"
72+
path: dizout
73+
3674
pojav:
37-
needs: build
38-
runs-on: ubuntu-20.04
39-
steps:
40-
- name: Checkout repository
41-
uses: actions/checkout@v2
42-
- name: Get jre8-aarch32
43-
uses: actions/download-artifact@v2
44-
with:
75+
needs: build_android
76+
runs-on: ubuntu-20.04
77+
steps:
78+
- name: Checkout repository
79+
uses: actions/checkout@v2
80+
- name: Get jre8-aarch32
81+
uses: actions/download-artifact@v2
82+
with:
4583
name: jre8-aarch32
4684
path: pojav
47-
- name: Get jre8-aarch64
48-
uses: actions/download-artifact@v2
49-
with:
50-
name: jre8-aarch64
51-
path: pojav
52-
- name: Get jre8-x86
53-
uses: actions/download-artifact@v2
54-
with:
55-
name: jre8-x86
56-
path: pojav
57-
- name: Get jre8-x86_64
58-
uses: actions/download-artifact@v2
59-
with:
60-
name: jre8-x86_64
61-
path: pojav
62-
- name: Repack JRE
63-
run: bash "repackjre.sh" $GITHUB_WORKSPACE/pojav $GITHUB_WORKSPACE/pojav/jre8-pojav
64-
- name: Upload artifact
65-
uses: actions/upload-artifact@v2
66-
with:
67-
name: jre8-pojav
68-
path: pojav/jre8-pojav/*
85+
- name: Get jre8-aarch64
86+
uses: actions/download-artifact@v2
87+
with:
88+
name: jre8-aarch64
89+
path: pojav
90+
- name: Get jre8-x86
91+
uses: actions/download-artifact@v2
92+
with:
93+
name: jre8-x86
94+
path: pojav
95+
- name: Get jre8-x86_64
96+
uses: actions/download-artifact@v2
97+
with:
98+
name: jre8-x86_64
99+
path: pojav
100+
- name: Repack JRE
101+
run: bash "repackjre.sh" $GITHUB_WORKSPACE/pojav $GITHUB_WORKSPACE/pojav/jre8-pojav
102+
- name: Upload artifact
103+
uses: actions/upload-artifact@v2
104+
with:
105+
name: jre8-pojav
106+
path: pojav/jre8-pojav/*

.gitignore

+10-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
1-
cups-2.2.4-source.tar.gz
2-
freetype-2.6.2.tar.bz2
3-
cups-2.2.4
1+
cups-*-source.tar.gz
2+
freetype-*.tar.gz
3+
freetype-*
4+
cups-*
45
dummy_libs
5-
freetype-2.6.2
6-
freetype-2.6.2-x86
6+
freetype-*-x86
77
jdk1.8.0_*
88
openjdk
99
android-ndk-r*
1010
jre.tar.xz
1111
jreout
12+
.DS_Store
13+
.idea
14+
ios-missing-include/cups
15+
ios-missing-include/X11
16+
ios-missing-include/Xm

buildjdk.sh

+48-32
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,9 @@ else
1111
export TARGET_PHYS=$TARGET
1212
fi
1313

14-
sudo apt -y install systemtap-sdt-dev gcc-multilib g++-multilib libxtst-dev libasound2-dev libelf-dev libfontconfig1-dev libx11-dev
15-
16-
export FREETYPE_DIR=`pwd`/freetype-$BUILD_FREETYPE_VERSION/build_android-${TARGET_SHORT}
14+
export FREETYPE_DIR=`pwd`/freetype-$BUILD_FREETYPE_VERSION/build_android-$TARGET_SHORT
1715
export CUPS_DIR=`pwd`/cups-2.2.4
18-
19-
# simplest to force headless:)
20-
export CFLAGS+=" -DDONT_COMPILE_SHENANDOAH -DLE_STANDALONE" # -I$FREETYPE_DIR -I$CUPS_DIR
21-
export LDFLAGS+=" -L`pwd`/dummy_libs -Wl,--warn-unresolved-symbols"
16+
export CFLAGS+=" -DLE_STANDALONE" # -I$FREETYPE_DIR -I$CUPS_DI
2217

2318
# if [ "$TARGET_JDK" == "aarch32" ] || [ "$TARGET_JDK" == "aarch64" ]
2419
# then
@@ -31,44 +26,65 @@ export LDFLAGS+=" -L`pwd`/dummy_libs -Wl,--warn-unresolved-symbols"
3126
# cp -R /usr/include/X11 $ANDROID_INCLUDE/
3227
# cp -R /usr/include/fontconfig $ANDROID_INCLUDE/
3328

34-
ln -s -f /usr/include/X11 $ANDROID_INCLUDE/
35-
ln -s -f /usr/include/fontconfig $ANDROID_INCLUDE/
29+
if [ "$BUILD_IOS" != "1" ]; then
30+
ln -s -f /usr/include/X11 $ANDROID_INCLUDE/
31+
ln -s -f /usr/include/fontconfig $ANDROID_INCLUDE/
32+
AUTOCONF_x11arg="--x-includes=$ANDROID_INCLUDE/X11"
33+
34+
export LDFLAGS+=" -L`pwd`/dummy_libs"
35+
36+
sudo apt -y install systemtap-sdt-dev gcc-multilib g++-multilib libxtst-dev libasound2-dev libelf-dev libfontconfig1-dev libx11-dev
3637

3738
# Create dummy libraries so we won't have to remove them in OpenJDK makefiles
38-
mkdir -p dummy_libs
39-
ar cru dummy_libs/libpthread.a
40-
ar cru dummy_libs/libthread_db.a
39+
mkdir -p dummy_libs
40+
ar cru dummy_libs/libpthread.a
41+
ar cru dummy_libs/libthread_db.a
42+
else
43+
ln -s -f /opt/X11/include/X11 $ANDROID_INCLUDE/
44+
platform_args=--with-toolchain-type=clang
45+
AUTOCONF_x11arg="--with-x=/opt/X11/include/X11"
46+
47+
sameflags="-arch arm64 -isysroot $thesysroot -miphoneos-version-min=12.0 -DHEADLESS=1 -I$PWD/ios-missing-include -Wno-implicit-function-declaration"
48+
export CFLAGS+=" $sameflags"
49+
export CXXFLAGS="$sameflags"
50+
51+
brew install xquartz
52+
fi
53+
54+
# fix building libjawt
55+
ln -s -f $CUPS_DIR/cups $ANDROID_INCLUDE/
4156

4257
cd openjdk
43-
rm -rf build
58+
#rm -rf build
4459

45-
# --with-extra-cxxflags="$CXXFLAGS -Dchar16_t=uint16_t -Dchar32_t=uint32_t" \
46-
# --with-extra-cflags="$CPPFLAGS" \
60+
# --with-extra-cxxflags="$CXXFLAGS -Dchar16_t=uint16_t -Dchar32_t=uint32_t" \
61+
# --with-extra-cflags="$CPPFLAGS" \
62+
# --with-sysroot="$(xcrun --sdk iphoneos --show-sdk-path)" \
4763
bash ./configure \
48-
--with-extra-cflags="$CFLAGS" \
49-
--with-extra-cxxflags="$CFLAGS" \
50-
--with-extra-ldflags="$LDFLAGS" \
51-
--enable-option-checking=fatal \
52-
--openjdk-target=$TARGET_PHYS \
53-
--with-jdk-variant=normal \
54-
--with-jvm-variants=$JVM_VARIANTS \
55-
--with-cups-include=$CUPS_DIR \
56-
--with-devkit=$TOOLCHAIN \
57-
--with-debug-level=$JDK_DEBUG_LEVEL \
58-
--with-fontconfig-include=$ANDROID_INCLUDE \
59-
--with-freetype-lib=$FREETYPE_DIR/lib \
60-
--with-freetype-include=$FREETYPE_DIR/include/freetype2 \
61-
--x-includes=$ANDROID_INCLUDE \
62-
--x-libraries=/usr/lib || \
64+
--openjdk-target=$TARGET_PHYS \
65+
--with-extra-cflags="$CFLAGS" \
66+
--with-extra-cxxflags="$CFLAGS" \
67+
--with-extra-ldflags="$LDFLAGS" \
68+
--enable-option-checking=fatal \
69+
--with-jdk-variant=normal \
70+
--with-jvm-variants=$JVM_VARIANTS \
71+
--with-cups-include=$CUPS_DIR \
72+
--with-devkit=$TOOLCHAIN \
73+
--with-debug-level=$JDK_DEBUG_LEVEL \
74+
--with-fontconfig-include=$ANDROID_INCLUDE \
75+
--with-freetype-lib=$FREETYPE_DIR/lib \
76+
--with-freetype-include=$FREETYPE_DIR/include/freetype2 \
77+
$AUTOCONF_x11arg $AUTOCONF_EXTRA_ARGS \
78+
--x-libraries=/usr/lib \
79+
$platform_args || \
6380
error_code=$?
6481
if [ "$error_code" -ne 0 ]; then
6582
echo "\n\nCONFIGURE ERROR $error_code , config.log:"
6683
cat config.log
6784
exit $error_code
6885
fi
6986

70-
# mkdir -p build/linux-${TARGET_JDK}-normal-${JVM_VARIANTS}-${JDK_DEBUG_LEVEL}
71-
cd build/linux-${TARGET_JDK}-normal-${JVM_VARIANTS}-${JDK_DEBUG_LEVEL}
87+
cd build/${JVM_PLATFORM}-${TARGET_JDK}-normal-${JVM_VARIANTS}-${JDK_DEBUG_LEVEL}
7288
make JOBS=4 images || \
7389
error_code=$?
7490
if [ "$error_code" -ne 0 ]; then

buildlibs.sh

+25-9
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,34 @@
11
#!/bin/bash
22
set -e
33
. setdevkitpath.sh
4-
export PATH=$TOOLCHAIN/bin:$PATH
4+
cd freetype-$BUILD_FREETYPE_VERSION
55

66
echo "Building Freetype"
77

8-
cd freetype-$BUILD_FREETYPE_VERSION
9-
./configure \
10-
--host=$TARGET \
11-
--prefix=`pwd`/build_android-${TARGET_SHORT} \
12-
--without-zlib \
13-
--with-png=no \
14-
--with-harfbuzz=no || \
15-
error_code=$?
8+
if [ "$BUILD_IOS" == "1" ]; then
9+
export CC=$thecc
10+
export CXX=$thecxx
11+
./configure \
12+
--host=$TARGET \
13+
--prefix=`pwd`/build_android-${TARGET_SHORT} \
14+
--without-zlib \
15+
--with-brotli=no \
16+
--with-png=no \
17+
--with-harfbuzz=no \
18+
"CFLAGS=-arch arm64 -pipe -std=c99 -Wno-trigraphs -fpascal-strings -O2 -Wreturn-type -Wunused-variable -fmessage-length=0 -fvisibility=hidden -miphoneos-version-min=12.0 -I$thesysroot/usr/include/libxml2/ -isysroot $thesysroot" \
19+
AR=/usr/bin/ar \
20+
"LDFLAGS=-arch arm64 -isysroot $thesysroot -miphoneos-version-min=12.0" \
21+
|| error_code=$?
22+
else
23+
export PATH=$TOOLCHAIN/bin:$PATH
24+
./configure \
25+
--host=$TARGET \
26+
--prefix=`pwd`/build_android-${TARGET_SHORT} \
27+
--without-zlib \
28+
--with-png=no \
29+
--with-harfbuzz=no $EXTRA_ARGS \
30+
|| error_code=$?
31+
fi
1632
if [ "$error_code" -ne 0 ]; then
1733
echo "\n\nCONFIGURE ERROR $error_code , config.log:"
1834
cat config.log

ci_build_arch_aarch32.sh

100644100755
File mode changed.

ci_build_arch_aarch64.sh

100644100755
+5-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
#!/bin/bash
22
set -e
3-
4-
export TARGET=aarch64-linux-android
3+
if [ "$BUILD_IOS" == "1" ]; then
4+
export TARGET=aarch64-apple-darwin18.2
5+
else
6+
export TARGET=aarch64-linux-android
7+
fi
58
export TARGET_JDK=aarch64
69

710
bash ci_build_global.sh

ci_build_arch_x86.sh

100644100755
File mode changed.

ci_build_arch_x86_64.sh

100644100755
File mode changed.

ci_build_global.sh

100644100755
+13-6
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,25 @@ set -e
33

44
export JDK_DEBUG_LEVEL=release
55

6-
sudo apt-get update
6+
if [ "$BUILD_IOS" != "1" ]; then
7+
sudo apt update
8+
fi
79
. setdevkitpath.sh
810

9-
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"
10-
./extractndk.sh
11-
./getlibs.sh
12-
./maketoolchain.sh
11+
if [ "$BUILD_IOS" == "1" ]; then
12+
chmod +x ios-arm64-clang
13+
chmod +x ios-arm64-clang++
14+
else
15+
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"
16+
./extractndk.sh
17+
./maketoolchain.sh
18+
fi
1319

1420
# Some modifies to NDK to fix
1521

16-
./clonejdk.sh
22+
./getlibs.sh
1723
./buildlibs.sh
24+
./clonejdk.sh
1825
./buildjdk.sh
1926
./removejdkdebuginfo.sh
2027
./tarjdk.sh

cleanarchbuild.sh

100644100755
File mode changed.

getlibs.sh

+7-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
#!/bin/sh
1+
#!/bin/bash
22
# https://github.com/termux/termux-packages/blob/master/disabled-packages/openjdk-9-jre-headless/build.sh
33
set -e
4-
wget https://download.savannah.gnu.org/releases/freetype/freetype-$BUILD_FREETYPE_VERSION.tar.bz2
5-
tar xf freetype-$BUILD_FREETYPE_VERSION.tar.bz2
4+
5+
. setdevkitpath.sh
6+
7+
wget https://downloads.sourceforge.net/project/freetype/freetype2/$BUILD_FREETYPE_VERSION/freetype-$BUILD_FREETYPE_VERSION.tar.gz
8+
tar xf freetype-$BUILD_FREETYPE_VERSION.tar.gz
69
wget https://github.com/apple/cups/releases/download/v2.2.4/cups-2.2.4-source.tar.gz
710
tar xf cups-2.2.4-source.tar.gz
8-
rm cups-2.2.4-source.tar.gz freetype-$BUILD_FREETYPE_VERSION.tar.bz2
11+
rm cups-2.2.4-source.tar.gz freetype-$BUILD_FREETYPE_VERSION.tar.gz

ios-arm64-clang

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
exec $thecc -arch arm64 -isysroot $thesysroot "$@"

ios-arm64-clang++

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
exec $thecxx -arch arm64 -isysroot $thesysroot "$@"

ios-missing-include/Cocoa/Cocoa.h

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#include <Foundation/Foundation.h>
2+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include <objc/runtime.h>
2+
#include <objc/message.h>
3+
4+
#include <jni.h>
5+
6+
#define JNF_COCOA_ENTER(env)
7+
#define JNF_COCOA_EXIT(env)
8+
9+
static inline NSString* JNFJavaToNSString(JNIEnv* env, jstring str) {
10+
NSString *result = NULL;
11+
const char *str_cstr = (*env)->GetStringUTFChars(env, str, 0);
12+
if ((*env)->ExceptionOccurred(env)) { return 0; }
13+
14+
if (str_cstr != NULL) {
15+
result = @(str_cstr);
16+
(*env)->ReleaseStringUTFChars(env, str, str_cstr);
17+
}
18+
19+
return result;
20+
}

ios-missing-include/Security/AuthSession.h

Whitespace-only changes.

0 commit comments

Comments
 (0)