WIP: security/ghidra: Update to 12.0.1 - need help
The short version: The current status is that it builds, packages, launches
and what I've tested so far works except for the debugger. I need help with
the python parts of launching egdb. It currently fails it what seems like a
disconnect with it wanting things installed via pip and I have installed
them from packages. Not exactly sure what is going on there.
tl:dr: Upstream explains how to build the downloaded dependencies in
preparation for an offline build. I have adapted those instructions to
download what's needed and provide a second distfile for them. This is
somewhat different than the prior approach but has the benefit of being
supported upstream.
There are two main exceptions: jna and protobufs. Both of these can't be
downloaded because upstream does not distribute prebuilt binaries for
OpenBSD. So we need to use our ports built ones instead. Many of the
source patches are to get control of the version numbers used in the source
and to use our versions instead. I built out OpenBSD pty support by copying
Linux source files and then patching them for OpenBSD. The combination of
these three things gets me pretty far into launching the debugger.
This is a massive application with tons of features and I have only touched
the surface of what it can do. I'm sure there are areas besides the debugger
that may need additional attention. I'm not sure if I have all the build and
run depends recorded as well. Let's collaborate.
-Kurt
Index: Makefile
===================================================================
RCS file: /cvs/ports/security/ghidra/Makefile,v
diff -u -p -u -r1.13 Makefile
--- Makefile 25 Sep 2023 17:07:36 -0000 1.13
+++ Makefile 23 Jan 2026 03:30:17 -0000
@@ -1,13 +1,9 @@
-BROKEN = non-trivial to update to the latest version
-
-# bundled jython has amd64 components for OpenBSD
-ONLY_FOR_ARCHS = amd64
+ONLY_FOR_ARCHS = amd64 aarch64
COMMENT = software reverse engineering (SRE) framework
-VERSION = 9.1.2
-GHIDRA_DATE = 20200212
-REVISION = 1
+VERSION = 12.0.1
+GHIDRA_DATE = 20260114
GH_ACCOUNT = NationalSecurityAgency
GH_PROJECT = ghidra
@@ -25,64 +21,71 @@ PERMIT_PACKAGE = Yes
WANTLIB += c m ${COMPILER_LIBCXX}
-SITES.a = ${HOMEPAGE}
-SITES.b = https://sourceforge.net/projects/yajsw/files/yajsw/yajsw-stable-${YAJSW_VER}/
-SITES.c = https://repo.maven.apache.org/maven2/
-SITES.d = https://dlcdn.apache.org/logging/log4j/${LOG4J_VER}/
-
-EXTRACT_SUFX = .zip
-
-ST4_VER = 4.1
-HAMCREST_VER = 1.3
-JAVACC_VER = 5.0
-JMOCKIT_VER = 1.44
-JSON_SIMPLE_VER = 1.1.1
-JUNIT_VER = 4.12
-YAJSW_VER = 12.12
-LOG4J_VER = 2.17.0
-
-# Note that ST4-${ST4_VER}.jar is only needed during build for antlr; it is not
-# needed at runtime and therefore does not need to be packed.
-JAR_DISTFILES += ST4{org/antlr/ST4/${ST4_VER}/ST4}-${ST4_VER}.jar
-JAR_DISTFILES += hamcrest{org/hamcrest/hamcrest-all/${HAMCREST_VER}/hamcrest}-all-${HAMCREST_VER}.jar
-JAR_DISTFILES += javacc{net/java/dev/javacc/javacc/${JAVACC_VER}/javacc}-${JAVACC_VER}.jar
-JAR_DISTFILES += jmockit{org/jmockit/jmockit/${JMOCKIT_VER}/jmockit}-${JMOCKIT_VER}.jar
-JAR_DISTFILES += json-simple{com/googlecode/json-simple/json-simple/${JSON_SIMPLE_VER}/json-simple}-${JSON_SIMPLE_VER}.jar
-JAR_DISTFILES += junit{junit/junit/${JUNIT_VER}/junit}-${JUNIT_VER}.jar
-
-DISTFILES = ${DISTNAME}.tar.gz
-DISTFILES.a += ghidra_${VERSION}_PUBLIC_${GHIDRA_DATE}${EXTRACT_SUFX}
-DISTFILES.b += yajsw-stable-${YAJSW_VER}${EXTRACT_SUFX}
-DISTFILES.c += ${JAR_DISTFILES}
-DISTFILES.d += apache-log4j-${LOG4J_VER}-bin.tar.gz
+SITES.a = https://www.intricatesoftware.com/distfiles/
-EXTRACT_ONLY = ${DISTFILES} ${DISTFILES.d}
+JNA_VER = 5.18.1
+PROTOBUF_VER = 6.33.4
+PROTOBUF_JAVA_VER = 4.33.4
-COMPILER = base-clang ports-clang
+DISTFILES.a += ghidra-Ghidra_${VERSION}_build_dependencies${EXTRACT_SUFX}
-MODULES = java
-MODJAVA_VER = 11+
+MODULES = java lang/python
+MODJAVA_VER = 21+
BUILD_DEPENDS = archivers/unzip \
devel/bison \
+ devel/protobuf>=${PROTOBUF_VER} \
+ devel/py-pip \
java/gradle \
+ java/jna>=${JNA_VER} \
shells/bash
-RUN_DEPENDS = shells/bash \
- java/javaPathHelper
+RUN_DEPENDS = devel/gdb \
+ devel/py-protobuf \
+ java/javaPathHelper \
+ shells/bash \
+ sysutils/py-psutil
+
+MAKE_ENV += JDK_JAVA_OPTIONS="-Duser.home='${WRKSRC}/home'"
+
+.if ${MACHINE_ARCH} == "amd64"
+GHIDRA_ARCH = openbsd_x86_64
+.else
+GHIDRA_ARCH = openbsd_arm_64
+.endif
NO_TEST = Yes
-SUBST_VARS += CXX GHIDRA_DATE VERSION WRKDIR
+SUBST_VARS += CXX GHIDRA_DATE GHIDRA_ARCH VERSION WRKDIR \
+ JNA_VER PROTOBUF_VER PROTOBUF_JAVA_VER
-JAR_DIRS += Features-FileFormats
-JAR_DIRS += Features-Python
-JAR_DIRS += Framework-Docking
-JAR_DIRS += Framework-FileSystem
-JAR_DIRS += Framework-Generic
-JAR_DIRS += Framework-Graph
-JAR_DIRS += Framework-Project
-JAR_DIRS += Framework-SoftwareModeling
+EXTENSIONS = BSimElasticPlugin GnuDisassembler Lisa \
+ MachineLearning SampleTablePlugin SleighDevTools \
+ SymbolicSummaryZ3 bundle_examples sample
+
+# Building the dependencies dir and distfile adapted from the instructions here:
+# https://github.com/NationalSecurityAgency/ghidra/blob/master/DevGuide.md#offline-development-environment
+
+# After 'make configure'
+# cd ${WRKDIR}
+# doas chown -R username ghidra-Ghidra_${VERSION}_build/
+#
+# cd ${WRKSRC}
+# env HOME='/ghidra-$VERSION}_writes_to_HOME' JAVA_HOME=/usr/local/jdk-21 \
+# gradle --no-daemon --stacktrace \
+# -g ${WRKDIST}/dependencies/gradle \
+# -I ${WRKDIST}/gradle/support/fetchDependencies.gradle
+# env HOME='/ghidra-${VERSION}_writes_to_HOME' JAVA_HOME=/usr/local/jdk-21 \
+# gradle --no-daemon --stacktrace \
+# -g ${WRKDIST}/dependencies/gradle \
+# prepDev
+# rm -rf dependencies/downloads
+# find dependencies -path '*/.tmp*' -o -name '*.log' -delete
+# find dependencies -name net.java.dev.jna -exec rm -rf {} \;
+#
+# cd ${WRKDIR}
+# tar czf ~/ghidra-Ghidra_${VERSION}_build_dependencies.tar.gz \
+# ghidra-Ghidra_${VERSION}_build/dependencies
post-extract:
@perl -pi -e 's,#!/bin/bash,#!${LOCALBASE}/bin/bash,' \
@@ -93,47 +96,37 @@ post-extract:
${WRKSRC}/Ghidra/RuntimeScripts/Linux/support/launch.sh
@perl -pi -e 's,(application.version)=.*,\1=${VERSION},' \
${WRKSRC}/Ghidra/application.properties
-
-# Steps derived from:
-# https://github.com/NationalSecurityAgency/ghidra/blob/master/DevGuide.md
-pre-build:
- cp ${FILESDIR}/repos.gradle ${WRKDIR}
- ${SUBST_CMD} ${WRKDIR}/repos.gradle \
- ${WRKSRC}/GPL/nativeBuildProperties.gradle \
- ${WRKSRC}/Ghidra/Framework/Help/src/main/java/help/GHelpBuilder.java
- mkdir ${WRKDIR}/{gradle,home}
- mkdir ${WRKSRC}/flatRepo
-.for dir in ${JAR_DIRS}
- unzip -j ${DISTDIR}/ghidra_${VERSION}_PUBLIC_${GHIDRA_DATE}.zip \
- -d ${WRKSRC}/flatRepo \
- ghidra_${VERSION}_PUBLIC/Ghidra/${dir:C/-.*$//}/${dir:C/^.*-//}/lib/*.jar \
- -x ghidra_${VERSION}_PUBLIC/Ghidra/${dir:C/-.*$//}/${dir:C/^.*-//}/lib/${dir:C/^.*-//}.jar
-.endfor
-.for name in csframework hfsx_dmglib hfsx iharder-base64
- cp ${WRKSRC}/GPL/DMG/data/lib/catacombae_${name}.jar \
- ${WRKSRC}/flatRepo/${name}.jar
-.endfor
-.for jar_file in ${JAR_DISTFILES:C/{.*}//}
- cp ${DISTDIR}/${jar_file} ${WRKSRC}/flatRepo
-.endfor
- mkdir -p ${WRKDIR}/ghidra.bin/Ghidra/Features/GhidraServer
- cp ${DISTDIR}/yajsw-stable-${YAJSW_VER}.zip \
- ${WRKDIR}/ghidra.bin/Ghidra/Features/GhidraServer
- cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} gradle -g ${WRKDIR}/gradle \
- --no-daemon --offline --stacktrace -I ${WRKDIR}/repos.gradle \
- yajswDevUnpack
+ @cp ${TRUEPREFIX}/share/java/classes/jna.jar \
+ ${WRKSRC}/dependencies/flatRepo/jna-${JNA_VER}.jar
+ @cp ${TRUEPREFIX}/share/java/classes/jna-platform.jar \
+ ${WRKSRC}/dependencies/flatRepo/jna-platform-${JNA_VER}.jar
+ @mkdir -p ${WRKSRC}/Ghidra/Framework/Pty/src/main/java/ghidra/pty/openbsd
+ @cd ${WRKSRC}/Ghidra/Framework/Pty/src/main/java/ghidra/pty/linux/ && \
+ for f in Linux* ; do \
+ cp $$f ../openbsd/OpenBSD$${f#Linux} ; done
+
+pre-configure:
+ ${SUBST_CMD} ${WRKSRC}/gradle.properties \
+ ${WRKSRC}/Ghidra/Framework/Pty/Module.manifest \
+ ${WRKSRC}/Ghidra/Framework/Pty/build.gradle \
+ ${WRKSRC}/Ghidra/Debug/ProposedUtils/Module.manifest \
+ ${WRKSRC}/Ghidra/Debug/Debugger-rmi-trace/Module.manifest \
+ ${WRKSRC}/Ghidra/Debug/Debugger-rmi-trace/build.gradle \
+ ${WRKSRC}/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/dbgeng/rmi/DbgEngConnectorsTest.java \
+ ${WRKSRC}/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/drgn/rmi/DrgnConnectorsTest.java \
+ ${WRKSRC}/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/gdb/rmi/GdbConnectorsTest.java \
+ ${WRKSRC}/Ghidra/Test/DebuggerIntegrationTest/src/test.slow/java/agent/lldb/rmi/LldbConnectorsTest.java
do-build:
- cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} gradle -g ${WRKDIR}/gradle \
- --no-daemon --offline --stacktrace -I ${WRKDIR}/repos.gradle \
- buildGhidra
+ cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} gradle --no-daemon --stacktrace \
+ -g ${WRKSRC}/dependencies/gradle --offline buildGhidra
do-install:
${INSTALL_DATA_DIR} ${PREFIX}/share/java
unzip -d ${PREFIX}/share/java \
- ${WRKSRC}/build/dist/ghidra_${VERSION}_DEV_*_openbsd64.zip
+ ${WRKSRC}/build/dist/ghidra_${VERSION}_DEV_*_${GHIDRA_ARCH}.zip
mv ${PREFIX}/share/java/ghidra_${VERSION}_DEV ${PREFIX}/share/java/ghidra
-.for name in GnuDisassembler SampleTablePlugin SleighDevTools sample
+.for name in ${EXTENSIONS}
mv ${PREFIX}/share/java/ghidra/Extensions/Ghidra/ghidra_${VERSION}_DEV_*_${name}.zip \
${PREFIX}/share/java/ghidra/Extensions/Ghidra/ghidra_${VERSION}_DEV_${GHIDRA_DATE}_${name}.zip
.endfor
@@ -142,10 +135,5 @@ do-install:
ln -s ${TRUEPREFIX}/share/java/ghidra/ghidraRun ${PREFIX}/bin/ghidraRun
${INSTALL_SCRIPT} ${WRKSRC}/Ghidra/RuntimeScripts/Linux/support/launch.sh \
${PREFIX}/share/java/ghidra/support/launch.sh
- rm -f ${PREFIX}/share/java/ghidra/Ghidra/Framework/Generic/lib/log4j-{api,core}-*.jar
- ${INSTALL_DATA} ${WRKDIR}/apache-log4j-${LOG4J_VER}-bin/log4j-api-${LOG4J_VER}.jar \
- ${PREFIX}/share/java/ghidra/Ghidra/Framework/Generic/lib/
- ${INSTALL_DATA} ${WRKDIR}/apache-log4j-${LOG4J_VER}-bin/log4j-core-${LOG4J_VER}.jar \
- ${PREFIX}/share/java/ghidra/Ghidra/Framework/Generic/lib/
.include <bsd.port.mk>
Index: distinfo
===================================================================
RCS file: /cvs/ports/security/ghidra/distinfo,v
diff -u -p -u -r1.6 distinfo
--- distinfo 19 Dec 2021 03:36:25 -0000 1.6
+++ distinfo 23 Jan 2026 03:30:17 -0000
@@ -1,20 +1,4 @@
-SHA256 (ST4-4.1.jar) = ixzK7Z7cVc0lXZwZxNjaR1bZtvy0NWcSkrQ0cLFtddg=
-SHA256 (apache-log4j-2.17.0-bin.tar.gz) = SPnCTXHYhMlZAS87zT0Omp9R26tpknZTh7lLLt+4MzM=
-SHA256 (ghidra-9.1.2.tar.gz) = XIgIIz/xTt43sAHDT69BxR5qBfTlHE0HcPQg46VI91g=
-SHA256 (ghidra_9.1.2_PUBLIC_20200212.zip) = 6+P6Thr9fZdlCZCyd3e7eL0EJ+jnDB0O4EKutS3srGE=
-SHA256 (hamcrest-all-1.3.jar) = SHdnBimrlvNPX5CrKDEl/Nmst+aD5mMZpovm6yzKYN4=
-SHA256 (javacc-5.0.jar) = cRExYbyM9mQVFVQcKBgCi4fHjsLo/6p1MXaG7giWe4k=
-SHA256 (jmockit-1.44.jar) = GXSZN1EzMkhCbdusNwpgSUTt9mXBPUakxelz5N2PqUo=
-SHA256 (json-simple-1.1.1.jar) = TmlpaJK4i0HFXUmrL9zCHurZK/VKzFiMAFBZbDt1GZw=
-SHA256 (junit-4.12.jar) = WXIfCAXiI9hLkGd4h9n/Vn3FNNfFAsqQPAwrF/BcEWo=
-SHA256 (yajsw-stable-12.12.zip) = E5j8sek6uxmZLE+gbX/ldYqrtMRXgdfvMGxvV8p6cyE=
-SIZE (ST4-4.1.jar) = 253043
-SIZE (apache-log4j-2.17.0-bin.tar.gz) = 14991268
-SIZE (ghidra-9.1.2.tar.gz) = 59623429
-SIZE (ghidra_9.1.2_PUBLIC_20200212.zip) = 302233568
-SIZE (hamcrest-all-1.3.jar) = 306578
-SIZE (javacc-5.0.jar) = 298569
-SIZE (jmockit-1.44.jar) = 757982
-SIZE (json-simple-1.1.1.jar) = 23931
-SIZE (junit-4.12.jar) = 314932
-SIZE (yajsw-stable-12.12.zip) = 25051676
+SHA256 (ghidra-12.0.1.tar.gz) = 85Qi2lCntwqx8YMru72+Sbo1r+bKU2AxEFGNwxps68w=
+SHA256 (ghidra-Ghidra_12.0.1_build_dependencies.tar.gz) = eDRE1huftNKa/QPB8JAjVENtbsMkFVS+Ui2SFvAUzrY=
+SIZE (ghidra-12.0.1.tar.gz) = 78575589
+SIZE (ghidra-Ghidra_12.0.1_build_dependencies.tar.gz) = 414328115
Index: patches/patch-GPL_CabExtract_build_gradle
===================================================================
RCS file: patches/patch-GPL_CabExtract_build_gradle
diff -N patches/patch-GPL_CabExtract_build_gradle
--- patches/patch-GPL_CabExtract_build_gradle 11 Mar 2022 19:53:24 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,21 +0,0 @@
-From https://github.com/NationalSecurityAgency/ghidra/pull/490
-
-Index: GPL/CabExtract/build.gradle
---- GPL/CabExtract/build.gradle.orig
-+++ GPL/CabExtract/build.gradle
-@@ -58,7 +58,7 @@ task configureCabExtract (type: Exec) {
- * The cabextract tool requires that its 'configure' script is called before make.
- *********************************************************************************/
- def currentPlatform = getCurrentPlatformName()
--if (['linux64', 'osx64'].contains(currentPlatform)) {
-+if (['linux64', 'osx64', 'openbsd64'].contains(currentPlatform)) {
-
- def makeName = "${currentPlatform}CabExtractMake" // native Make task found automatically
-
-@@ -75,4 +75,4 @@ if (['linux64', 'osx64'].contains(currentPlatform)) {
- delete file("build/unpack/${cabextract}")
- }
- }
--}
-\ No newline at end of file
-+}
Index: patches/patch-GPL_DemanglerGnu_build_gradle
===================================================================
RCS file: /cvs/ports/security/ghidra/patches/patch-GPL_DemanglerGnu_build_gradle,v
diff -u -p -u -r1.3 patch-GPL_DemanglerGnu_build_gradle
--- patches/patch-GPL_DemanglerGnu_build_gradle 11 Mar 2022 19:53:24 -0000 1.3
+++ patches/patch-GPL_DemanglerGnu_build_gradle 23 Jan 2026 03:30:17 -0000
@@ -3,22 +3,21 @@ From https://github.com/NationalSecurity
Index: GPL/DemanglerGnu/build.gradle
--- GPL/DemanglerGnu/build.gradle.orig
+++ GPL/DemanglerGnu/build.gradle
-@@ -32,6 +32,10 @@ model {
- architecture 'x86_64'
- operatingSystem 'osx'
- }
-+ openbsd64 {
-+ architecture 'x86_64'
-+ operatingSystem 'openbsd'
-+ }
- }
- }
-
-@@ -72,6 +76,7 @@ model {
- targetPlatform "win64"
- targetPlatform "linux64"
- targetPlatform "osx64"
-+ targetPlatform "openbsd64"
+@@ -83,6 +83,8 @@ model {
+ targetPlatform "mac_arm_64"
+ targetPlatform "freebsd_x86_64"
+ targetPlatform "freebsd_arm_64"
++ targetPlatform "openbsd_x86_64"
++ targetPlatform "openbsd_arm_64"
+ sources {
+ c {
+ source {
+@@ -106,6 +108,8 @@ model {
+ targetPlatform "mac_arm_64"
+ targetPlatform "freebsd_x86_64"
+ targetPlatform "freebsd_arm_64"
++ targetPlatform "openbsd_x86_64"
++ targetPlatform "openbsd_arm_64"
sources {
c {
source {
Index: patches/patch-GPL_nativeBuildProperties_gradle
===================================================================
RCS file: /cvs/ports/security/ghidra/patches/patch-GPL_nativeBuildProperties_gradle,v
diff -u -p -u -r1.4 patch-GPL_nativeBuildProperties_gradle
--- patches/patch-GPL_nativeBuildProperties_gradle 11 Mar 2022 19:53:24 -0000 1.4
+++ patches/patch-GPL_nativeBuildProperties_gradle 23 Jan 2026 03:30:17 -0000
@@ -1,31 +1,16 @@
-Adapted from https://github.com/NationalSecurityAgency/ghidra/pull/490
-
-Force use of Clang and honor CXX.
+Add OpenBSD
Index: GPL/nativeBuildProperties.gradle
--- GPL/nativeBuildProperties.gradle.orig
+++ GPL/nativeBuildProperties.gradle
-@@ -39,7 +39,23 @@ model {
- architecture 'x86_64'
- operatingSystem 'osx'
+@@ -49,6 +49,10 @@ model {
+ gcc(Gcc).target(current)
+ clang(Clang).target(current)
}
-+ openbsd64 {
-+ architecture 'x86_64'
-+ operatingSystem 'openbsd'
-+ }
- }
-+
-+ toolChains {
-+ // Force use of Clang
-+ clang(Clang) {
-+ eachPlatform { tools ->
-+ tools.cppCompiler.executable = "${CXX}"
-+ tools.linker.executable = "${CXX}"
-+ println "C++ compiler is [${tools.cppCompiler.executable}]"
-+ println "Linker is [${tools.linker.executable}]"
-+ }
++ if (isOpenBSD(current)) {
++ gcc(Gcc).target(current)
++ clang(Clang).target(current)
+ }
-+ }
- }
-
- /*******************************************************************************************
+ if (isWindows(current) && VISUAL_STUDIO_INSTALL_DIR) {
+ // https://github.com/gradle/gradle-native/issues/617#issuecomment-575735288
+ visualCpp(VisualCpp) {
Index: patches/patch-GPL_nativePlatforms_gradle
===================================================================
RCS file: patches/patch-GPL_nativePlatforms_gradle
diff -N patches/patch-GPL_nativePlatforms_gradle
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-GPL_nativePlatforms_gradle 23 Jan 2026 03:30:17 -0000
@@ -0,0 +1,47 @@
+Add support for OpenBSD
+
+Index: GPL/nativePlatforms.gradle
+--- GPL/nativePlatforms.gradle.orig
++++ GPL/nativePlatforms.gradle
+@@ -26,7 +26,9 @@ project.ext.PLATFORMS = [
+ [name: "mac_x86_64", os: "osx", arch: "x86_64"],
+ [name: "mac_arm_64", os: "osx", arch: "arm64"],
+ [name: "freebsd_x86_64", os: "freebsd", arch: "x86_64"],
+- [name: "freebsd_arm_64", os: "freebsd", arch: "arm64"]
++ [name: "freebsd_arm_64", os: "freebsd", arch: "arm64"],
++ [name: "openbsd_x86_64", os: "openbsd", arch: "x86_64"],
++ [name: "openbsd_arm_64", os: "openbsd", arch: "arm64"]
+ ]
+
+ /*********************************************************************************
+@@ -56,6 +58,9 @@ ext.getCurrentPlatformName = {
+ case ~/FreeBSD.*/:
+ os = "freebsd"
+ break
++ case ~/OpenBSD.*/:
++ os = "openbsd"
++ break
+ default:
+ throw new GradleException("Unrecognized platform operating system: $os")
+ }
+@@ -129,6 +134,20 @@ ext.isFreeBSD = { platform_name ->
+ *********************************************************************************/
+ ext.isCurrentFreeBSD = {
+ return isFreeBSD(getCurrentPlatformName())
++}
++
++/*********************************************************************************
++ * Returns true if the given platform is OpenBSD.
++ *********************************************************************************/
++ext.isOpenBSD = { platform_name ->
++ return platform_name.startsWith("openbsd")
++}
++
++/*********************************************************************************
++ * Returns true if the current platform is OpenBSD.
++ *********************************************************************************/
++ext.isCurrentOpenBSD = {
++ return isOpenBSD(getCurrentPlatformName())
+ }
+
+ /*********************************************************************************
Index: patches/patch-GhidraBuild_LaunchSupport_src_main_java_ghidra_launch_AppConfig_java
===================================================================
RCS file: patches/patch-GhidraBuild_LaunchSupport_src_main_java_ghidra_launch_AppConfig_java
diff -N patches/patch-GhidraBuild_LaunchSupport_src_main_java_ghidra_launch_AppConfig_java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-GhidraBuild_LaunchSupport_src_main_java_ghidra_launch_AppConfig_java 23 Jan 2026 03:30:17 -0000
@@ -0,0 +1,13 @@
+Add OpenBSD
+
+Index: GhidraBuild/LaunchSupport/src/main/java/ghidra/launch/AppConfig.java
+--- GhidraBuild/LaunchSupport/src/main/java/ghidra/launch/AppConfig.java.orig
++++ GhidraBuild/LaunchSupport/src/main/java/ghidra/launch/AppConfig.java
+@@ -438,6 +438,7 @@ public class AppConfig {
+ new File(localAppDataDirPath, appName + "/" + userSettingsDirName);
+ break;
+ case LINUX:
++ case OPEN_BSD:
+ userSettingsDir =
+ new File(userHomeDir, ".config/" + appName + "/" + userSettingsDirName);
+ break;
Index: patches/patch-GhidraBuild_LaunchSupport_src_main_java_ghidra_launch_JavaFinder_java
===================================================================
RCS file: patches/patch-GhidraBuild_LaunchSupport_src_main_java_ghidra_launch_JavaFinder_java
diff -N patches/patch-GhidraBuild_LaunchSupport_src_main_java_ghidra_launch_JavaFinder_java
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-GhidraBuild_LaunchSupport_src_main_java_ghidra_launch_JavaFinder_java 23 Jan 2026 03:30:17 -0000
@@ -0,0 +1,24 @@
+Add OpenBSD - still need to create OpenBSDFinder.java
+
+Index: GhidraBuild/LaunchSupport/src/main/java/ghidra/launch/JavaFinder.java
+--- GhidraBuild/LaunchSupport/src/main/java/ghidra/launch/JavaFinder.java.orig
++++ GhidraBuild/LaunchSupport/src/main/java/ghidra/launch/JavaFinder.java
+@@ -36,7 +36,7 @@ public abstract class JavaFinder {
+ * The different supported platforms (operating systems).
+ */
+ public enum Platform {
+- WINDOWS, MACOS, LINUX;
++ WINDOWS, MACOS, LINUX, OPEN_BSD;
+ }
+
+ /**
+@@ -53,6 +53,9 @@ public abstract class JavaFinder {
+ }
+ if (os.contains("mac")) {
+ return Platform.MACOS;
++ }
++ if (os.contains("openbsd")) {
++ return Platform.OPEN_BSD;
+ }
+ }
+ return Platform.LINUX;
Index: patches/patch-Ghidra_Debug_Debugger-agent-lldb_src_main_py_src_ghidralldb_arch_py
===================================================================
RCS file: patches/patch-Ghidra_Debug_Debugger-agent-lldb_src_main_py_src_ghidralldb_arch_py
diff -N patches/patch-Ghidra_Debug_Debugger-agent-lldb_src_main_py_src_ghidralldb_arch_py
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-Ghidra_Debug_Debugger-agent-lldb_src_main_py_src_ghidralldb_arch_py 23 Jan 2026 03:30:17 -0000
@@ -0,0 +1,13 @@
+Add OpenBSD
+
+Index: Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/arch.py
+--- Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/arch.py.orig
++++ Ghidra/Debug/Debugger-agent-lldb/src/main/py/src/ghidralldb/arch.py
+@@ -135,6 +135,7 @@ default_compiler_map: Dict[Optional[str], str] = {
+ 'freebsd': 'gcc',
+ 'linux': 'gcc',
+ 'netbsd': 'gcc',
++ 'openbsd': 'gcc',
+ 'ps4': 'gcc',
+ 'ios': 'gcc',
+ 'macosx': 'gcc',
Index: patches/patch-Ghidra_Debug_Debugger-rmi-trace_Module_manifest
===================================================================
RCS file: patches/patch-Ghidra_Debug_Debugger-rmi-trace_Module_manifest
diff -N patches/patch-Ghidra_Debug_Debugger-rmi-trace_Module_manifest
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-Ghidra_Debug_Debugger-rmi-trace_Module_manifest 23 Jan 2026 03:30:17 -0000
@@ -0,0 +1,11 @@
+Use protobuf provided by ports
+
+Index: Ghidra/Debug/Debugger-rmi-trace/Module.manifest
+--- Ghidra/Debug/Debugger-rmi-trace/Module.manifest.orig
++++ Ghidra/Debug/Debugger-rmi-trace/Module.manifest
+@@ -1,4 +1,4 @@
+-MODULE FILE LICENSE: pypkg/dist/protobuf-6.31.0-py3-none-any.whl BSD-3-GOOGLE
++MODULE FILE LICENSE: pypkg/dist/protobuf-${PROTOBUF_VER}-py3-none-any.whl BSD-3-GOOGLE
+ MODULE FILE LICENSE: pypkg/dist/psutil-5.9.8.tar.gz BSD-3-PSUTIL
+ MODULE FILE LICENSE: pypkg/dist/setuptools-80.9.0-py3-none-any.whl MIT
+ MODULE FILE LICENSE: pypkg/dist/wheel-0.45.1-py3-none-any.whl MIT
Index: patches/patch-Ghidra_Debug_Debugger-rmi-trace_build_gradle
===================================================================
RCS file: patches/patch-Ghidra_Debug_Debugger-rmi-trace_build_gradle
diff -N patches/patch-Ghidra_Debug_Debugger-rmi-trace_build_gradle
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-Ghidra_Debug_Debugger-rmi-trace_build_gradle 23 Jan 2026 03:30:17 -0000
@@ -0,0 +1,14 @@
+Use protobuf provided by ports
+
+Index: Ghidra/Debug/Debugger-rmi-trace/build.gradle
+--- Ghidra/Debug/Debugger-rmi-trace/build.gradle.orig
++++ Ghidra/Debug/Debugger-rmi-trace/build.gradle
+@@ -73,7 +73,7 @@ tasks.assemblePyPackage {
+ }
+ }
+
+-distributePyDep("protobuf-6.31.0-py3-none-any.whl")
++distributePyDep("protobuf-${PROTOBUF_VER}-py3-none-any.whl")
+ distributePyDep("psutil-5.9.8.tar.gz")
+ distributePyDep("setuptools-80.9.0-py3-none-any.whl")
+ distributePyDep("wheel-0.45.1-py3-none-any.whl")
Index: patches/patch-Ghidra_Debug_ProposedUtils_Module_manifest
===================================================================
RCS file: patches/patch-Ghidra_Debug_ProposedUtils_Module_manifest
diff -N patches/patch-Ghidra_Debug_ProposedUtils_Module_manifest
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-Ghidra_Debug_ProposedUtils_Module_manifest 23 Jan 2026 03:30:17 -0000
@@ -0,0 +1,8 @@
+Match OpenBSD protobuf s/6/4/
+
+Index: Ghidra/Debug/ProposedUtils/Module.manifest
+--- Ghidra/Debug/ProposedUtils/Module.manifest.orig
++++ Ghidra/Debug/ProposedUtils/Module.manifest
+@@ -1 +1 @@
+-MODULE FILE LICENSE: lib/protobuf-java-4.31.0.jar BSD-3-GOOGLE
++MODULE FILE LICENSE: lib/protobuf-java-${PROTOBUF_JAVA_VER}.jar BSD-3-GOOGLE
Index: patches/patch-Ghidra_Features_Decompiler_buildNatives_gradle
===================================================================
RCS file: patches/patch-Ghidra_Features_Decompiler_buildNatives_gradle
diff -N patches/patch-Ghidra_Features_Decompiler_buildNatives_gradle
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-Ghidra_Features_Decompiler_buildNatives_gradle 23 Jan 2026 03:30:17 -0000
@@ -0,0 +1,23 @@
+Add OpenBSD
+
+Inde: Ghidra/Features/Decompiler/buildNatives.gradle
+--- Ghidra/Features/Decompiler/buildNatives.gradle.orig
++++ Ghidra/Features/Decompiler/buildNatives.gradle
+@@ -44,6 +44,8 @@ model {
+ targetPlatform "mac_arm_64"
+ targetPlatform "freebsd_x86_64"
+ targetPlatform "freebsd_arm_64"
++ targetPlatform "openbsd_x86_64"
++ targetPlatform "openbsd_arm_64"
+ sources {
+ cpp {
+ // NOTE: The bison/flex generated files are assumed to be up-to-date.
+@@ -154,6 +156,8 @@ model {
+ targetPlatform "mac_arm_64"
+ targetPlatform "freebsd_x86_64"
+ targetPlatform "freebsd_arm_64"
++ targetPlatform "openbsd_x86_64"
++ targetPlatform "openbsd_arm_64"
+ sources {
+ cpp {
+ // NOTE: The bison/flex generated files are assumed to be up-to-date.
Index: patches/patch-Ghidra_Features_Decompiler_build_gradle
===================================================================
RCS file: patches/patch-Ghidra_Features_Decompiler_build_gradle
diff -N patches/patch-Ghidra_Features_Decompiler_build_gradle
--- patches/patch-Ghidra_Features_Decompiler_build_gradle 11 Mar 2022 19:53:24 -0000 1.3
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,48 +0,0 @@
-From https://github.com/NationalSecurityAgency/ghidra/pull/490
-
-Index: Ghidra/Features/Decompiler/build.gradle
---- Ghidra/Features/Decompiler/build.gradle.orig
-+++ Ghidra/Features/Decompiler/build.gradle
-@@ -78,8 +78,10 @@ def installPoint = "$rootDir/GhidraDocs/languages/html
- */
- task buildDecompilerDocumentationPdfs(type: Exec) {
- // Check the OS before enabling task.
-+ String osName = System.getProperty("os.name")
- if (!(org.gradle.internal.os.OperatingSystem.current().isLinux()
-- || org.gradle.internal.os.OperatingSystem.current().isMacOsX())) {
-+ || org.gradle.internal.os.OperatingSystem.current().isMacOsX()
-+ || isOpenBSD(osName))) {
- it.enabled = false
- }
-
-@@ -209,10 +211,12 @@ task buildDecompilerDocumentationHtml(type: Exec) {
-
- // Check the OS before executing command.
- doFirst {
-+ String osName = System.getProperty("os.name")
- if ( !(org.gradle.internal.os.OperatingSystem.current().isLinux()
-- || org.gradle.internal.os.OperatingSystem.current().isMacOsX())) {
-+ || org.gradle.internal.os.OperatingSystem.current().isMacOsX()
-+ || isOpenBSD(osName))) {
- throw new TaskExecutionException( it,
-- new Exception( "The '$it.name' task only works on Linux or Mac Os X" ))
-+ new Exception( "The '$it.name' task only works on Linux or Mac OS X, or OpenBSD" ))
- }
- }
-
-@@ -248,6 +252,7 @@ model {
- targetPlatform "win64"
- targetPlatform "linux64"
- targetPlatform "osx64"
-+ targetPlatform "openbsd64"
- sources {
- cpp {
- source {
-@@ -345,6 +350,7 @@ model {
- targetPlatform "win64"
- targetPlatform "linux64"
- targetPlatform "osx64"
-+ targetPlatform "openbsd64"
- sources {
- cpp {
- source {
Index: patches/patch-Ghidra_Features_Decompiler_src_decompile_cpp_Makefile
===================================================================
RCS file: /cvs/ports/security/ghidra/patches/patch-Ghidra_Features_Decompiler_src_decompile_cpp_Makefile,v
diff -u -p -u -r1.2 patch-Ghidra_Features_Decompiler_src_decompile_cpp_Makefile
--- patches/patch-Ghidra_Features_Decompiler_src_decompile_cpp_Makefile 11 Mar 2022 19:53:24 -0000 1.2
+++ patches/patch-Ghidra_Features_Decompiler_src_decompile_cpp_Makefile 23 Jan 2026 03:30:17 -0000
@@ -3,17 +3,17 @@ From https://github.com/NationalSecurity
Index: Ghidra/Features/Decompiler/src/decompile/cpp/Makefile
--- Ghidra/Features/Decompiler/src/decompile/cpp/Makefile.orig
+++ Ghidra/Features/Decompiler/src/decompile/cpp/Makefile
-@@ -33,6 +33,13 @@ ifeq ($(OS),Darwin)
- OSDIR=osx64
+@@ -35,6 +35,13 @@ ifeq ($(OS),Darwin)
+ OSDIR=mac_x86_64
endif
+ifeq ($(OS),OpenBSD)
-+ifeq ($(ARCH),x86_64)
++ifeq ($(ARCH),amd64)
+ ARCH_TYPE=-m64
-+ OSDIR=openbsd64
++ OSDIR=openbsd_x86_64
+endif
+endif
+
- CC=gcc
- CXX=g++
+ CXX=g++ -std=c++11
+ # Debug flags
Index: patches/patch-Ghidra_Features_Decompiler_src_decompile_cpp_types_h
===================================================================
RCS file: patches/patch-Ghidra_Features_Decompiler_src_decompile_cpp_types_h
diff -N patches/patch-Ghidra_Features_Decompiler_src_decompile_cpp_types_h
--- patches/patch-Ghidra_Features_Decompiler_src_decompile_cpp_types_h 11 Mar 2022 19:53:24 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,15 +0,0 @@
-From https://github.com/NationalSecurityAgency/ghidra/pull/490
-
-Index: Ghidra/Features/Decompiler/src/decompile/cpp/types.h
---- Ghidra/Features/Decompiler/src/decompile/cpp/types.h.orig
-+++ Ghidra/Features/Decompiler/src/decompile/cpp/types.h
-@@ -86,7 +86,8 @@ typedef char int1;
- typedef uint4 uintp;
-
No comments:
Post a Comment