git: b42fb59dbcf1 - main - java/openjdk11: fix build on 32 bit arm

From: Ronald Klop <ronald_at_FreeBSD.org>
Date: Fri, 08 Nov 2024 12:50:40 UTC
The branch main has been updated by ronald:

URL: https://cgit.FreeBSD.org/ports/commit/?id=b42fb59dbcf15ee1dd8ca37b805f76671f0da8a1

commit b42fb59dbcf15ee1dd8ca37b805f76671f0da8a1
Author:     MikaelUrankar <mikael.urankar@gmail.com>
AuthorDate: 2024-10-10 15:10:33 +0000
Commit:     Ronald Klop <ronald@FreeBSD.org>
CommitDate: 2024-11-08 12:49:33 +0000

    java/openjdk11: fix build on 32 bit arm
    
    Slightly adjusted the patch of Mikael Urankar to make sure it only
    affects __arm__ builds.
    The patch is similar to what fixed openjdk8 in
    commit e13c81137266603a6a0700810b6bad419f9d98c8.
    
    Not bumping portrevision as nothing changes for existing pkgs.
    
    PR:     255662
    Approved by:    java@ (maintainer timeout)
---
 .../files/patch-make_hotspot_lib_CompileJvm.gmk    | 11 ++++++++
 .../patch-src_hotspot_os_bsd_os__perf__bsd.cpp     | 30 ++++++++++++++++++++++
 ...dk.hotspot.agent_bsd_native_libsaproc_libproc.h | 25 ++++++++++++++++++
 3 files changed, 66 insertions(+)

diff --git a/java/openjdk11/files/patch-make_hotspot_lib_CompileJvm.gmk b/java/openjdk11/files/patch-make_hotspot_lib_CompileJvm.gmk
new file mode 100644
index 000000000000..65490ededb9d
--- /dev/null
+++ b/java/openjdk11/files/patch-make_hotspot_lib_CompileJvm.gmk
@@ -0,0 +1,11 @@
+--- make/hotspot/lib/CompileJvm.gmk.orig	2024-10-04 16:07:55.502680000 +0200
++++ make/hotspot/lib/CompileJvm.gmk	2024-10-04 16:07:03.672629000 +0200
+@@ -109,7 +109,7 @@ ifeq ($(call And, $(call isTargetOs, linux) $(call isT
+ ifeq ($(call And, $(call isTargetOs, linux) $(call isTargetCpu, arm)), true)
+   JVM_EXCLUDE_PATTERNS += arm_64
+ 
+-else ifeq ($(call And, $(call isTargetOs, bsd) $(call isTargetCpu, bsd-arm)), true)
++else ifeq ($(call And, $(call isTargetOs, bsd) $(call isTargetCpu, arm)), true)
+   JVM_EXCLUDE_PATTERNS += arm_64
+ 
+ else ifeq ($(call And, $(call isTargetOs, linux) $(call isTargetCpu, aarch64)), true)
diff --git a/java/openjdk11/files/patch-src_hotspot_os_bsd_os__perf__bsd.cpp b/java/openjdk11/files/patch-src_hotspot_os_bsd_os__perf__bsd.cpp
new file mode 100644
index 000000000000..f6c770aee32b
--- /dev/null
+++ b/java/openjdk11/files/patch-src_hotspot_os_bsd_os__perf__bsd.cpp
@@ -0,0 +1,30 @@
+This patch fixes the following error:
+
+In file included from jdk11u-jdk-11.0.24-8-1/src/hotspot/os/bsd/os_perf_bsd.cpp:47:
+In file included from /usr/include/sys/user.h:51:
+In file included from /usr/include/vm/pmap.h:88:
+In file included from /usr/include/machine/pmap.h:48:
+In file included from /usr/include/sys/systm.h:46:
+/usr/include/machine/cpufunc.h:185:1: error: static declaration of 'breakpoint' follows non-static declaration
+  185 | breakpoint(void)
+      | ^
+/usr/ports/java/openjdk11/work/jdk11u-jdk-11.0.24-8-1/src/hotspot/share/utilities/breakpoint.hpp:31:17: note: previous declaration is here
+   31 | extern "C" void breakpoint();
+
+
+
+--- src/hotspot/os/bsd/os_perf_bsd.cpp.orig	2024-11-08 11:24:38 UTC
++++ src/hotspot/os/bsd/os_perf_bsd.cpp
+@@ -43,6 +43,12 @@
+        * with the same name.
+        */
+       #define _MACHINE_PCB_H_
++      /*
++       * do not redefine breakpoint on armv7
++       */
++      #ifdef __arm__
++        #define _MACHINE_CPUFUNC_H_
++      #endif
+     #endif
+     #include <sys/user.h>
+   #endif
diff --git a/java/openjdk11/files/patch-src_jdk.hotspot.agent_bsd_native_libsaproc_libproc.h b/java/openjdk11/files/patch-src_jdk.hotspot.agent_bsd_native_libsaproc_libproc.h
new file mode 100644
index 000000000000..f0abb17c22c9
--- /dev/null
+++ b/java/openjdk11/files/patch-src_jdk.hotspot.agent_bsd_native_libsaproc_libproc.h
@@ -0,0 +1,25 @@
+This patch fixes the following error:
+
+In file included from /usr/ports/java/openjdk11/work/jdk11u-jdk-11.0.24-8-1/src/jdk.hotspot.agent/bsd/native/libsaproc/ps_proc.c:40:
+In file included from /usr/ports/java/openjdk11/work/jdk11u-jdk-11.0.24-8-1/src/jdk.hotspot.agent/bsd/native/libsaproc/libproc_impl.h:30:
+/usr/ports/java/openjdk11/work/jdk11u-jdk-11.0.24-8-1/src/jdk.hotspot.agent/bsd/native/libsaproc/libproc.h:79:13: error: cannot combine with previous 'int' declaration specifier
+   79 | typedef int bool;
+      |             ^
+/usr/include/stdbool.h:37:14: note: expanded from macro 'bool'
+   37 | #define bool    _Bool
+
+
+--- src/jdk.hotspot.agent/bsd/native/libsaproc/libproc.h.orig	2024-10-07 16:02:52.117023000 +0200
++++ src/jdk.hotspot.agent/bsd/native/libsaproc/libproc.h	2024-10-07 16:02:15.020023000 +0200
+@@ -76,9 +76,11 @@ typedef int bool;
+ 
+ // This C bool type must be int for compatibility with BSD calls and
+ // it would be a mistake to equivalence it to C++ bool on many platforms
++#if defined(__FreeBSD__) && defined(__arm__) && !defined(__bool_true_false_are_defined)
+ typedef int bool;
+ #define true  1
+ #define false 0
++#endif  // __FreeBSD__ && __arm__ && !__bool_true_false_are_defined
+ 
+ #endif // __APPLE__
+