Skip to content

Commit

Permalink
fix(build): update patches, ndk and docker image to build newer versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathias-Boulay committed Oct 5, 2024
1 parent 691cab3 commit 5f86297
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 29 deletions.
8 changes: 4 additions & 4 deletions 6_buildjdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ if [[ "$BUILD_IOS" != "1" ]]; then

AUTOCONF_x11arg="--x-includes=$ANDROID_INCLUDE/X11"

export CFLAGS+=" -mllvm -polly -DANDROID"
export LDFLAGS+=" -L$PWD/dummy_libs"
export CFLAGS+=" -mllvm -polly -DANDROID -Wno-error=implicit-function-declaration -Wno-error=int-conversion"
export LDFLAGS+=" -L$PWD/dummy_libs -Wl,--undefined-version"

# Create dummy libraries so we won't have to remove them in OpenJDK makefiles
mkdir -p dummy_libs
Expand Down Expand Up @@ -88,9 +88,9 @@ cd openjdk-${TARGET_VERSION}
# Apply patches
git reset --hard
if [[ "$BUILD_IOS" != "1" ]]; then
find ../patches/jre_${TARGET_VERSION}/android -name "*.diff" -print0 | xargs -0 -I {} sh -c 'echo "Applying {}" && git apply --reject --whitespace=fix {} || echo "git apply failed (Android patch set)"'
find ../patches/jre_${TARGET_VERSION}/android -name "*.diff" -print0 | xargs -0 -I {} sh -c 'echo "Applying {}" && git apply --reject --whitespace=fix {} || (echo "git apply failed (Android patch set)" && exit 1)'
else
find ../patches/jre_${TARGET_VERSION}/ios -name "*.diff" -print0 | xargs -0 -I {} sh -c 'echo "Applying {}" && git apply --reject --whitespace=fix {} || echo "git apply failed (iOs patch set)"'
find ../patches/jre_${TARGET_VERSION}/ios -name "*.diff" -print0 | xargs -0 -I {} sh -c 'echo "Applying {}" && git apply --reject --whitespace=fix {} || (echo "git apply failed (iOs patch set)" && exit 1)'

# Hack: exclude building macOS stuff
desktop_mac=src/java.desktop/macosx
Expand Down
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:jammy
FROM ubuntu:23.10

RUN apt-get update

Expand Down Expand Up @@ -29,7 +29,9 @@ RUN apt-get install -y \
clang \
git \
file \
make
make \
cmake \
xz-utils

# JDK 17
RUN apt-get install -y openjdk-17-jdk
Expand All @@ -39,7 +41,7 @@ WORKDIR /home


# NDK install
ENV NDK_VERSION r25c
ENV NDK_VERSION r27b
ENV ANDROID_NDK_HOME /home/android-ndk-$NDK_VERSION
RUN \
wget -nc -nv -O android-ndk-$NDK_VERSION-linux-x86_64.zip "https://dl.google.com/android/repository/android-ndk-$NDK_VERSION-linux.zip" \
Expand Down
2 changes: 1 addition & 1 deletion patches/jre_17/android/1_fix_toolchain.diff
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ index 5eed1138f..b4319de67 100644
@@ -374,7 +374,8 @@ AC_DEFUN([FLAGS_SETUP_CFLAGS_HELPER],
#### OS DEFINES, these should be independent on toolchain
if test "x$OPENJDK_TARGET_OS" = xlinux; then
CFLAGS_OS_DEF_JVM="-DLINUX"
CFLAGS_OS_DEF_JVM="-DLINUX -D_FILE_OFFSET_BITS=64"
- CFLAGS_OS_DEF_JDK="-D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
+ # CFLAGS_OS_DEF_JDK="-D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE"
+ CFLAGS_OS_DEF_JDK="-D_GNU_SOURCE -D_REENTRANT -D_LARGEFILE64_SOURCE -D__USE_BSD"
Expand Down
20 changes: 0 additions & 20 deletions patches/jre_21/android/jdk21u_android.diff
Original file line number Diff line number Diff line change
Expand Up @@ -2258,26 +2258,6 @@ index 21ef40688..b8c2520d2 100644
#endif

if (exec_path == NULL) {
diff --git a/src/java.base/unix/native/libnet/net_util_md.c b/src/java.base/unix/native/libnet/net_util_md.c
index 4ec11a136..01b85db4d 100644
--- a/src/java.base/unix/native/libnet/net_util_md.c
+++ b/src/java.base/unix/native/libnet/net_util_md.c
@@ -129,6 +129,7 @@ jint IPv6_supported()
SOCKETADDRESS sa;
socklen_t sa_len = sizeof(SOCKETADDRESS);

+#ifndef __ANDROID__ // ANDROID: skip check, see libcore commit ae218d9b
fd = socket(AF_INET6, SOCK_STREAM, 0) ;
if (fd < 0) {
/*
@@ -172,6 +173,7 @@ jint IPv6_supported()
}
}
#endif
+#endif // !defined __ANDROID__

/*
* OK we may have the stack available in the kernel,
diff --git a/src/java.base/unix/native/libnet/net_util_md.h b/src/java.base/unix/native/libnet/net_util_md.h
index 902cf9673..3b8acd66b 100644
--- a/src/java.base/unix/native/libnet/net_util_md.h
Expand Down
2 changes: 1 addition & 1 deletion setdevkitpath.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Description: Set the environment variables for the build scripts.
export NDK_VERSION=r25c
export NDK_VERSION=r27b

# Target version is either 17 or 21
if [[ -z "$TARGET_VERSION" ]]
Expand Down

0 comments on commit 5f86297

Please sign in to comment.