git: 0bb4cd46bfad - main - java/jextract: new port
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 16 Sep 2026 08:18:13 UTC
The branch main has been updated by michaelo:
URL: https://cgit.FreeBSD.org/ports/commit/?id=0bb4cd46bfad146e5d1b7183c687a6edb3c2b668
commit 0bb4cd46bfad146e5d1b7183c687a6edb3c2b668
Author: Igor Kolesnik <igor@kolesnik.es>
AuthorDate: 2025-03-05 16:15:14 +0000
Commit: Michael Osipov <michaelo@FreeBSD.org>
CommitDate: 2026-09-16 08:14:30 +0000
java/jextract: new port
jextract is a tool which mechanically generates Java bindings from
native library headers. This tools leverages the clang C API in order
to parse the headers associated with a given native library, and the
generated Java bindings build upon the Foreign Function & Memory API.
Co-authored-by: Michael Osipov <michaelo@FreeBSD.org>
PR: 285159
---
java/Makefile | 1 +
java/jextract/Makefile | 43 ++++++++++++++++++++++++++++++++++
java/jextract/distinfo | 3 +++
java/jextract/files/jextract.in | 6 +++++
java/jextract/files/patch-build.gradle | 10 ++++++++
java/jextract/pkg-descr | 4 ++++
java/jextract/pkg-plist | 2 ++
7 files changed, 69 insertions(+)
diff --git a/java/Makefile b/java/Makefile
index da8b8482dcfa..c906f0188037 100644
--- a/java/Makefile
+++ b/java/Makefile
@@ -54,6 +54,7 @@
SUBDIR += jd-gui-duo
SUBDIR += jdk11-doc
SUBDIR += jdk8-doc
+ SUBDIR += jextract
SUBDIR += jflex
SUBDIR += jfreechart
SUBDIR += jgraph
diff --git a/java/jextract/Makefile b/java/jextract/Makefile
new file mode 100644
index 000000000000..5159f7942f47
--- /dev/null
+++ b/java/jextract/Makefile
@@ -0,0 +1,43 @@
+PORTNAME= jextract
+DISTVERSION= g20260826
+CATEGORIES= java devel
+
+MAINTAINER= igor@kolesnik.es
+COMMENT= Generate Java bindings from native library headers
+WWW= https://openjdk.org/projects/code-tools/
+
+LICENSE= GPLv2
+
+BUILD_DEPENDS= gradle:devel/gradle
+
+USES= java llvm:build,run
+
+USE_GITHUB= yes
+GH_ACCOUNT= openjdk
+GH_TAGNAME= 2aaa694aa6d241f4704f5ac69c1f8d898e7cfcc8
+JAVA_VERSION= 25+
+
+NO_ARCH= yes
+SUB_FILES= jextract
+SUB_LIST= JAVA=${JAVA} LLVM_PREFIX=${LLVM_PREFIX} JAVAJARDIR=${JAVAJARDIR}
+
+_GRADLE_ENV= GRADLE_USER_HOME=${WRKDIR}/gradle-home \
+ JAVA_VERSION=${JAVA_VERSION}
+# JPMS module versions must start with a digit; strip the leading "g".
+MODULE_VERSION= ${DISTVERSION:C/^g//}
+
+do-build:
+ cd ${WRKSRC} && \
+ ${SETENV} ${_GRADLE_ENV} gradle --no-daemon \
+ -Pjdk_home=${JAVA_HOME} \
+ -Pllvm_home=${LLVM_PREFIX} \
+ -Pversion=${MODULE_VERSION} \
+ clean jar
+
+do-install:
+ ${MKDIR} ${STAGEDIR}${JAVAJARDIR}
+ ${INSTALL_SCRIPT} ${WRKDIR}/jextract ${STAGEDIR}${PREFIX}/bin
+ ${INSTALL_DATA} ${WRKSRC}/build/libs/org.openjdk.jextract-${MODULE_VERSION}.jar \
+ ${STAGEDIR}${JAVAJARDIR}/org.openjdk.jextract.jar
+
+.include <bsd.port.mk>
diff --git a/java/jextract/distinfo b/java/jextract/distinfo
new file mode 100644
index 000000000000..816c07dd7ae0
--- /dev/null
+++ b/java/jextract/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1788986768
+SHA256 (openjdk-jextract-g20260826-2aaa694aa6d241f4704f5ac69c1f8d898e7cfcc8_GH0.tar.gz) = 13a539e7b557a3615786be1ec357adfb35f53e60857fe51e0401b139026b2de9
+SIZE (openjdk-jextract-g20260826-2aaa694aa6d241f4704f5ac69c1f8d898e7cfcc8_GH0.tar.gz) = 299287
diff --git a/java/jextract/files/jextract.in b/java/jextract/files/jextract.in
new file mode 100644
index 000000000000..4631d80eea6b
--- /dev/null
+++ b/java/jextract/files/jextract.in
@@ -0,0 +1,6 @@
+#!/bin/sh
+%%JAVA%% $JEXTRACT_JAVA_OPTIONS \
+ -Djava.library.path=%%LLVM_PREFIX%%/lib \
+ --module-path %%JAVAJARDIR%%/org.openjdk.jextract.jar \
+ --enable-native-access=org.openjdk.jextract \
+ -m org.openjdk.jextract/org.openjdk.jextract.JextractTool "$@"
diff --git a/java/jextract/files/patch-build.gradle b/java/jextract/files/patch-build.gradle
new file mode 100644
index 000000000000..76c31c360554
--- /dev/null
+++ b/java/jextract/files/patch-build.gradle
@@ -0,0 +1,10 @@
+--- build.gradle.orig 2026-09-09 20:52:51 UTC
++++ build.gradle
+@@ -63,6 +63,7 @@ compileJava {
+ options.release = 23
+ options.fork = true
+ options.forkOptions.executable = "${jdk_home}/bin/javac${os_exe_suffix}"
++ options.javaModuleVersion = project.version
+ }
+
+ jar {
diff --git a/java/jextract/pkg-descr b/java/jextract/pkg-descr
new file mode 100644
index 000000000000..342fe337959f
--- /dev/null
+++ b/java/jextract/pkg-descr
@@ -0,0 +1,4 @@
+jextract is a tool which mechanically generates Java bindings from
+native library headers. This tools leverages the clang C API in order
+to parse the headers associated with a given native library, and the
+generated Java bindings build upon the Foreign Function & Memory API.
diff --git a/java/jextract/pkg-plist b/java/jextract/pkg-plist
new file mode 100644
index 000000000000..bab8f62904a3
--- /dev/null
+++ b/java/jextract/pkg-plist
@@ -0,0 +1,2 @@
+bin/jextract
+%%JAVAJARDIR%%/org.openjdk.jextract.jar