svn commit: r505315 - in head/devel: . ghidra ghidra/files

Kurt Jaeger pi at FreeBSD.org
Sat Jun 29 00:17:53 UTC 2019


Author: pi
Date: Sat Jun 29 00:17:47 2019
New Revision: 505315
URL: https://svnweb.freebsd.org/changeset/ports/505315

Log:
  New port: devel/ghidra
  
  Ghidra is a software reverse engineering (SRE) framework created
  and maintained by the National Security Agency Research Directorate
  of the United States of America.
  
  This framework includes a suite of full-featured, high-end software
  analysis tools that enable users to analyze compiled code on a
  variety of platforms including Windows, macOS, and Linux. Capabilities
  include disassembly, assembly, decompilation, graphing, and scripting,
  along with hundreds of other features. Ghidra supports a wide variety
  of processor instruction sets and executable formats and can be run
  in both user-interactive and automated modes. Users may also develop
  their own Ghidra plug-in components and/or scripts using Java or
  Python.
  
  WWW: https://ghidra-sre.org/
  
  PR:		237211
  Submitted by:	Tamas Szakaly <sghctoma at gmail.com>
  Reviewed by:	koobs, yuri, rgrimes

Added:
  head/devel/ghidra/
  head/devel/ghidra/Makefile   (contents, props changed)
  head/devel/ghidra/distinfo   (contents, props changed)
  head/devel/ghidra/files/
  head/devel/ghidra/files/patch-GPL_CabExtract_build.gradle   (contents, props changed)
  head/devel/ghidra/files/patch-GPL_DemanglerGnu_build.gradle   (contents, props changed)
  head/devel/ghidra/files/patch-GPL_build.gradle   (contents, props changed)
  head/devel/ghidra/files/patch-GPL_nativeBuildProperties.gradle   (contents, props changed)
  head/devel/ghidra/files/patch-GhidraBuild_Skeleton_certification.manifest   (contents, props changed)
  head/devel/ghidra/files/patch-GhidraBuild_Skeleton_os_freebsd64_README.txt   (contents, props changed)
  head/devel/ghidra/files/patch-Ghidra_Features_Decompiler_build.gradle   (contents, props changed)
  head/devel/ghidra/files/patch-Ghidra_Features_Decompiler_src_decompile_cpp_Makefile   (contents, props changed)
  head/devel/ghidra/files/patch-Ghidra_Features_Decompiler_src_decompile_cpp_loadimage__bfd.hh   (contents, props changed)
  head/devel/ghidra/files/patch-Ghidra_Features_Decompiler_src_decompile_cpp_types.h   (contents, props changed)
  head/devel/ghidra/files/patch-Ghidra_Features_FunctionID_build.gradle   (contents, props changed)
  head/devel/ghidra/files/patch-Ghidra_Framework_Generic_src_main_java_ghidra_framework_Platform.java   (contents, props changed)
  head/devel/ghidra/files/patch-Ghidra_Framework_Utility_src_main_java_ghidra_framework_OperatingSystem.java   (contents, props changed)
  head/devel/ghidra/files/patch-Ghidra_RuntimeScripts_Linux_support_launch.sh   (contents, props changed)
  head/devel/ghidra/files/patch-build.gradle   (contents, props changed)
  head/devel/ghidra/files/patch-gradleScripts_distribution.gradle   (contents, props changed)
  head/devel/ghidra/files/patch-gradleScripts_ip.gradle   (contents, props changed)
  head/devel/ghidra/pkg-descr   (contents, props changed)
Modified:
  head/devel/Makefile

Modified: head/devel/Makefile
==============================================================================
--- head/devel/Makefile	Fri Jun 28 23:51:49 2019	(r505314)
+++ head/devel/Makefile	Sat Jun 29 00:17:47 2019	(r505315)
@@ -780,6 +780,7 @@
     SUBDIR += gettext-runtime
     SUBDIR += gettext-tools
     SUBDIR += gflags
+    SUBDIR += ghidra
     SUBDIR += ghq
     SUBDIR += ghub
     SUBDIR += gindent

Added: head/devel/ghidra/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/ghidra/Makefile	Sat Jun 29 00:17:47 2019	(r505315)
@@ -0,0 +1,124 @@
+# $FreeBSD$
+
+PORTNAME=		ghidra
+DISTVERSIONPREFIX=	Ghidra_
+DISTVERSION=	9.0.4
+DISTVERSIONSUFFIX=	_build
+CATEGORIES=		devel security
+MASTER_SITES=	SF/yajsw/yajsw/yajsw-stable-12.12/:yajsw \
+	SF/catacombae/HFSExplorer/0.21/:hfsexplorer \
+	https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/android4me/:axml2printer \
+	https://github.com/pxb1988/dex2jar/releases/download/2.0/:dex2jar
+DISTFILES=		yajsw-stable-12.12.zip:yajsw \
+	hfsexplorer-0_21-bin.zip:hfsexplorer \
+	AXMLPrinter2.jar:axml2printer \
+	dex-tools-2.0.zip:dex2jar
+DIST_SUBDIR=	${PORTNAME}
+EXTRACT_ONLY=	${DISTNAME}${EXTRACT_SUFX}
+
+MAINTAINER=	sghctoma at gmail.com
+COMMENT=	Software reverse engineering (SRE) framework
+
+LICENSE=		APACHE20
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+ONLY_FOR_ARCHS=	amd64
+
+EXTRACT_DEPENDS=	${UNZIP_CMD}:archivers/unzip
+BUILD_DEPENDS=	gradle>=5.0:devel/gradle \
+	bash:shells/bash \
+	flex:textproc/flex \
+	fop:textproc/fop \
+	${LOCALBASE}/share/xsl/docbook/html/docbook.xsl:textproc/docbook-xsl
+RUN_DEPENDS=	bash:shells/bash
+
+USES=	bison shebangfix
+
+OPTIONS_RADIO=	JDK
+OPTIONS_RADIO_JDK=	JDK11 JDK12
+OPTIONS_DEFAULT=	JDK11
+
+JDK11_BUILD_DEPENDS=	${LOCALBASE}/openjdk11/bin/java:java/openjdk11
+JDK11_RUN_DEPENDS=		${LOCALBASE}/openjdk11/bin/java:java/openjdk11
+JDK12_BUILD_DEPENDS=	${LOCALBASE}/openjdk12/bin/java:java/openjdk12
+JDK12_RUN_DEPENDS=		${LOCALBASE}/openjdk12/bin/java:java/openjdk12
+
+SHEBANG_FILES=	Ghidra/RuntimeScripts/Linux/* \
+	Ghidra/RuntimeScripts/Linux/support/* \
+	Ghidra/RuntimeScripts/Linux/server/*
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	NationalSecurityAgency
+
+GRADLE_HOME_BASE=	/tmp	# Gradle cache path must be absolute (see https://github.com/gradle/gradle/issues/1338)
+GRADLE_RUN=	${SETENV} ${MAKE_ENV} gradle \
+			--gradle-user-home ${GRADLE_HOME_BASE}/gradle-${PORTNAME} \
+			--no-daemon
+
+# to rebuild the deps archive:
+#   1. set DEV_UPDATE_MODE=yes
+#   2. make makesum build
+#   3. upload the *-deps archive
+#   4. set DEV_UPDATE_MODE=no
+#   5. make clean makesum
+
+DEV_UPDATE_MODE=	no
+
+.if (${DEV_UPDATE_MODE} == "yes")
+post-build:
+	@cd ${GRADLE_HOME_BASE} && ${TAR} czf ${DISTDIR}/${DIST_SUBDIR}/${PORTNAME}-${DISTVERSION}-deps${EXTRACT_SUFX} gradle-${PORTNAME}
+	@${ECHO} "(!!!) Please upload the Gradle deps archive: ${DISTDIR}/${DIST_SUBDIR}/${PORTNAME}-${DISTVERSION}-deps${EXTRACT_SUFX}"
+.else
+MASTER_SITES+=	https://github.com/sghctoma/ghidra-deps/raw/master/:gradle
+DISTFILES+=		${PORTNAME}-${DISTVERSION}-deps${EXTRACT_SUFX}:gradle
+EXTRACT_ONLY+=	${PORTNAME}-${DISTVERSION}-deps${EXTRACT_SUFX}
+GRADLE_RUN+=	--offline
+.endif
+
+post-extract:
+	@${MKDIR} ${WRKDIR}/flatrepo
+	@${MKDIR} ${WRKDIR}/dummy.home
+	@${CP} ${DISTDIR}/${DIST_SUBDIR}/AXMLPrinter2.jar ${WRKDIR}/flatrepo
+	@${UNZIP_CMD} -j -d ${WRKDIR}/flatrepo ${DISTDIR}/${DIST_SUBDIR}/hfsexplorer-0_21-bin.zip \
+		lib/csframework.jar lib/hfsx_dmglib.jar lib/hfsx.jar lib/iharder-base64.jar
+	@${UNZIP_CMD} -j -d ${WRKDIR}/flatrepo ${DISTDIR}/${DIST_SUBDIR}/dex-tools-2.0.zip "dex2jar-2.0/lib/dex-*.jar"
+	@${MKDIR} ${WRKDIR}/ghidra.bin/Ghidra/Features/GhidraServer/
+	@${CP} ${DISTDIR}/${DIST_SUBDIR}/yajsw-stable-12.12.zip ${WRKDIR}/ghidra.bin/Ghidra/Features/GhidraServer/
+.if (${DEV_UPDATE_MODE} == "no")
+	@${LN} -sf ${WRKDIR}/gradle-${PORTNAME} ${GRADLE_HOME_BASE}
+.endif
+
+post-patch:
+	@${REINPLACE_CMD} -e "s|/usr/share/sgml/docbook/xsl-stylesheets|${LOCALBASE}/share/xsl/docbook/|g" \
+		${WRKSRC}/Ghidra/Features/Decompiler/src/main/doc/*.xsl \
+		${WRKSRC}/Ghidra/Features/FunctionID/src/main/doc/*.xsl
+
+post-patch-JDK11-on:
+	@${ECHO_CMD} "org.gradle.java.home=${LOCALBASE}/openjdk11" > ${WRKSRC}/gradle.properties
+
+post-patch-JDK12-on:
+	@${ECHO_CMD} "org.gradle.java.home=${LOCALBASE}/openjdk12" > ${WRKSRC}/gradle.properties
+
+do-build:
+	cd ${WRKSRC} && ${GRADLE_RUN} yajswDevUnpack
+	cd ${WRKSRC} && ${GRADLE_RUN} buildGhidra
+
+post-build:
+	@${RM} ${GRADLE_HOME_BASE}/gradle-${PORTNAME}
+
+do-install:
+	@${UNZIP_CMD} -d ${STAGEDIR} ${WRKSRC}/build/dist/*.zip
+	@${MV} ${STAGEDIR}/ghidra* ${STAGEDIR}${DATADIR}
+	@${RLN} ${STAGEDIR}/${DATADIR}/ghidraRun ${STAGEDIR}${PREFIX}/bin/ghidra
+	@${RLN} ${STAGEDIR}/${DATADIR}/server/ghidraSvr ${STAGEDIR}${PREFIX}/bin/ghidra-server
+	@${STRIP_CMD} ${STAGEDIR}/${DATADIR}/GPL/DemanglerGnu/os/freebsd64/demangler_gnu
+	@${STRIP_CMD} ${STAGEDIR}/${DATADIR}/Ghidra/Features/Decompiler/os/freebsd64/decompile
+	@${STRIP_CMD} ${STAGEDIR}/${DATADIR}/Ghidra/Features/Decompiler/os/freebsd64/sleigh
+
+post-install:
+	@${FIND} ${STAGEDIR} ! -type d | \
+		${SED} 's,${STAGEDIR}${PREFIX}/,,' >> ${TMPPLIST}
+	@${FIND} -ds ${STAGEDIR}${DATADIR} -type d -empty | \
+		${SED} 's,${STAGEDIR}${PREFIX}/,, ; s,^, at dir ,' >> ${TMPPLIST}
+
+.include <bsd.port.mk>

Added: head/devel/ghidra/distinfo
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/ghidra/distinfo	Sat Jun 29 00:17:47 2019	(r505315)
@@ -0,0 +1,13 @@
+TIMESTAMP = 1561351901
+SHA256 (ghidra/yajsw-stable-12.12.zip) = 1398fcb1e93abb19992c4fa06d7fe5758aabb4c45781d7ef306c6f57ca7a7321
+SIZE (ghidra/yajsw-stable-12.12.zip) = 25051676
+SHA256 (ghidra/hfsexplorer-0_21-bin.zip) = 90c9b54798abca5b12f4a678db7d0a4c970f4702cb153c11919536d0014dedbf
+SIZE (ghidra/hfsexplorer-0_21-bin.zip) = 1473278
+SHA256 (ghidra/AXMLPrinter2.jar) = 00ed038eb6abaf6ddec8d202a3ed7a81b521458f4cd459948115cfd02ff59d6d
+SIZE (ghidra/AXMLPrinter2.jar) = 24552
+SHA256 (ghidra/dex-tools-2.0.zip) = 7907eb4d6e9280b6e17ddce7ee0507eae2ef161ee29f70a10dbc6944fdca75bc
+SIZE (ghidra/dex-tools-2.0.zip) = 2362460
+SHA256 (ghidra/ghidra-9.0.4-deps.tar.gz) = 740f48fb112690a9cfe64993052fc291728b37ee238efdee21234323bf00edb2
+SIZE (ghidra/ghidra-9.0.4-deps.tar.gz) = 58437917
+SHA256 (ghidra/NationalSecurityAgency-ghidra-Ghidra_9.0.4_build_GH0.tar.gz) = e24593fb4cf3e1d1b7a8dfeae85edfba9fd9d446b360c7a5d12e9640438735e3
+SIZE (ghidra/NationalSecurityAgency-ghidra-Ghidra_9.0.4_build_GH0.tar.gz) = 59223815

Added: head/devel/ghidra/files/patch-GPL_CabExtract_build.gradle
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/ghidra/files/patch-GPL_CabExtract_build.gradle	Sat Jun 29 00:17:47 2019	(r505315)
@@ -0,0 +1,11 @@
+--- GPL/CabExtract/build.gradle.orig	2019-04-03 17:38:23 UTC
++++ GPL/CabExtract/build.gradle
+@@ -40,7 +40,7 @@ project.ext.cabextract = "cabextract-1.6"
+  *
+  * The cabextract tool requires that its 'configure' script is called before make.
+  *********************************************************************************/
+-['linux64', 'osx64'].each { platform ->
++['linux64', 'osx64', 'freebsd64'].each { platform ->
+ 		
+ 	def configureName = "${platform}CabExtractConfigure"
+ 	def makeName = "${platform}CabExtractMake" // native Make task found automatically

Added: head/devel/ghidra/files/patch-GPL_DemanglerGnu_build.gradle
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/ghidra/files/patch-GPL_DemanglerGnu_build.gradle	Sat Jun 29 00:17:47 2019	(r505315)
@@ -0,0 +1,31 @@
+--- GPL/DemanglerGnu/build.gradle.orig	2019-04-03 17:38:23 UTC
++++ GPL/DemanglerGnu/build.gradle
+@@ -24,6 +24,10 @@ model {
+ 			architecture 'x86_64'
+ 			operatingSystem 'osx'
+ 		}
++		freebsd64 {
++			architecture 'x86_64'
++			operatingSystem 'freebsd'
++		}
+ 	}	
+ }
+ 
+@@ -64,6 +68,7 @@ model {
+ 			targetPlatform "win64"
+ 			targetPlatform "linux64"
+ 			targetPlatform "osx64"
++			targetPlatform "freebsd64"
+ 			sources {
+ 				c {
+ 					source {
+@@ -80,6 +85,9 @@ model {
+ }
+ 
+ model {
++	toolChains {
++		clang(Clang)
++	}
+ 	binaries {
+ 		all{ b ->
+ 			if (toolChain in Gcc) {

Added: head/devel/ghidra/files/patch-GPL_build.gradle
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/ghidra/files/patch-GPL_build.gradle	Sat Jun 29 00:17:47 2019	(r505315)
@@ -0,0 +1,21 @@
+--- GPL/build.gradle.orig	2019-04-03 17:38:23 UTC
++++ GPL/build.gradle
+@@ -1,5 +1,5 @@
+ project.ext.BIN_REPO = file("${projectDir}/../../ghidra.bin").absolutePath
+-project.ext.set("OS_NAMES", ["osx64", "win32", "win64", "linux64"])
++project.ext.set("OS_NAMES", ["osx64", "win32", "win64", "linux64", "freebsd64"])
+ 
+ /*********************************************************************************
+  * Returns the local platform name.
+@@ -28,6 +28,11 @@ String getCurrentPlatformName() {
+ 	else if (osName.startsWith("Mac OS X")) {
+ 		if (isX86_64) {
+ 			return 'osx64'
++		}
++	}
++	else if (osName.startsWith("FreeBSD")) {
++		if (isX86_64) {
++			return 'freebsd64'
+ 		}
+ 	}
+ 	throw new GradleException("Unrecognized current platform -> osName = $osName, archName = $archName")

Added: head/devel/ghidra/files/patch-GPL_nativeBuildProperties.gradle
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/ghidra/files/patch-GPL_nativeBuildProperties.gradle	Sat Jun 29 00:17:47 2019	(r505315)
@@ -0,0 +1,13 @@
+--- GPL/nativeBuildProperties.gradle.orig	2019-05-16 19:36:27 UTC
++++ GPL/nativeBuildProperties.gradle
+@@ -75,6 +75,10 @@ model {
+ 			architecture 'x86_64'
+ 			operatingSystem 'osx'
+ 		}
++		freebsd64 {
++			architecture 'x86_64'
++			operatingSystem 'freebsd'
++		}
+ 	}	
+ }
+ 

Added: head/devel/ghidra/files/patch-GhidraBuild_Skeleton_certification.manifest
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/ghidra/files/patch-GhidraBuild_Skeleton_certification.manifest	Sat Jun 29 00:17:47 2019	(r505315)
@@ -0,0 +1,10 @@
+--- GhidraBuild/Skeleton/certification.manifest.orig	2019-04-03 17:38:23 UTC
++++ GhidraBuild/Skeleton/certification.manifest
+@@ -17,6 +17,7 @@ extension.properties||GHIDRA||||END|
+ ghidra_scripts/README.txt||GHIDRA||||END|
+ lib/README.txt||GHIDRA||||END|
+ os/linux64/README.txt||GHIDRA||||END|
++os/freebsd64/README.txt||GHIDRA||||END|
+ os/osx64/README.txt||GHIDRA||||END|
+ os/win64/README.txt||GHIDRA||||END|
+ src/main/help/help/TOC_Source.xml||GHIDRA||||END|

Added: head/devel/ghidra/files/patch-GhidraBuild_Skeleton_os_freebsd64_README.txt
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/ghidra/files/patch-GhidraBuild_Skeleton_os_freebsd64_README.txt	Sat Jun 29 00:17:47 2019	(r505315)
@@ -0,0 +1,6 @@
+--- GhidraBuild/Skeleton/os/freebsd64/README.txt.orig	2019-04-08 17:58:11 UTC
++++ GhidraBuild/Skeleton/os/freebsd64/README.txt
+@@ -0,0 +1,3 @@
++The "os/freebsd64" directory is intended to hold FreeBSD native binaries
++which this module is dependent upon.   This directory may be eliminated for a specific 
++module if native binaries are not provided for the corresponding platform.

Added: head/devel/ghidra/files/patch-Ghidra_Features_Decompiler_build.gradle
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/ghidra/files/patch-Ghidra_Features_Decompiler_build.gradle	Sat Jun 29 00:17:47 2019	(r505315)
@@ -0,0 +1,30 @@
+--- Ghidra/Features/Decompiler/build.gradle.orig	2019-04-03 17:38:23 UTC
++++ Ghidra/Features/Decompiler/build.gradle
+@@ -75,8 +75,9 @@ task buildDecompilerDocumentationPdfs(type: Exec) {
+ 
+ 	// Check the OS before enabling task.
+ 	if (!(org.gradle.internal.os.OperatingSystem.current().isLinux() 
+-		|| org.gradle.internal.os.OperatingSystem.current().isMacOsX())) {
+-			println "The '$it.name' task only works on Linux or Mac Os X and is therefore disabled."
++		|| org.gradle.internal.os.OperatingSystem.current().isMacOsX()
++		|| org.gradle.internal.os.OperatingSystem.current().getName().contains("FreeBSD"))) {
++			println "The '$it.name' task only works on Linux, FreeBSD or Mac Os X and is therefore disabled."
+ 			it.enabled = false
+ 	}
+ 
+@@ -245,6 +246,7 @@ model {
+ 			targetPlatform "win64"
+ 			targetPlatform "linux64"
+ 			targetPlatform "osx64"
++			targetPlatform "freebsd64"
+ 			sources {
+ 				cpp {
+ 		            source {
+@@ -342,6 +344,7 @@ model {
+ 			targetPlatform "win64"
+ 			targetPlatform "linux64"
+ 			targetPlatform "osx64"
++			targetPlatform "freebsd64"
+ 			sources {
+ 				cpp {
+ 					source {

Added: head/devel/ghidra/files/patch-Ghidra_Features_Decompiler_src_decompile_cpp_Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/ghidra/files/patch-Ghidra_Features_Decompiler_src_decompile_cpp_Makefile	Sat Jun 29 00:17:47 2019	(r505315)
@@ -0,0 +1,13 @@
+--- Ghidra/Features/Decompiler/src/decompile/cpp/Makefile.orig	2019-04-03 17:38:23 UTC
++++ Ghidra/Features/Decompiler/src/decompile/cpp/Makefile
+@@ -33,8 +33,8 @@ ifeq ($(OS),Darwin)
+   OSDIR=osx64
+ endif
+ 
+-CC=gcc
+-CXX=g++
++CC?=cc
++CXX?=c++
+ 
+ # Debug flags
+ DBG_CXXFLAGS=-g -Wall -Wno-sign-compare

Added: head/devel/ghidra/files/patch-Ghidra_Features_Decompiler_src_decompile_cpp_loadimage__bfd.hh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/ghidra/files/patch-Ghidra_Features_Decompiler_src_decompile_cpp_loadimage__bfd.hh	Sat Jun 29 00:17:47 2019	(r505315)
@@ -0,0 +1,12 @@
+--- Ghidra/Features/Decompiler/src/decompile/cpp/loadimage_bfd.hh.orig	2019-04-03 17:38:23 UTC
++++ Ghidra/Features/Decompiler/src/decompile/cpp/loadimage_bfd.hh
+@@ -21,6 +21,9 @@
+ #define __LOADIMAGE_BFD__
+ 
+ #include "loadimage.hh"
++
++#define PACKAGE
++#define PACKAGE_VERSION
+ #include <bfd.h>
+ 
+ struct ImportRecord {

Added: head/devel/ghidra/files/patch-Ghidra_Features_Decompiler_src_decompile_cpp_types.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/ghidra/files/patch-Ghidra_Features_Decompiler_src_decompile_cpp_types.h	Sat Jun 29 00:17:47 2019	(r505315)
@@ -0,0 +1,39 @@
+--- Ghidra/Features/Decompiler/src/decompile/cpp/types.h.orig	2019-04-03 17:38:23 UTC
++++ Ghidra/Features/Decompiler/src/decompile/cpp/types.h
+@@ -101,6 +101,36 @@ typedef char int1;
+ typedef uint8 uintp;
+ #endif
+ 
++#if defined (__FreeBSD__) && defined (__i386__)
++#define HOST_ENDIAN 0
++typedef unsigned long uintm;
++typedef long intm;
++typedef unsigned long long uint8;
++typedef long long int8;
++typedef unsigned int uint4;
++typedef int int4;
++typedef unsigned short uint2;
++typedef short int2;
++typedef unsigned char uint1;
++typedef char int1;
++typedef uint4 uintp;
++#endif
++
++#if defined (__FreeBSD__) && defined (__x86_64__)
++#define HOST_ENDIAN 0
++typedef unsigned int uintm;
++typedef int intm;
++typedef unsigned long uint8;
++typedef long int8;
++typedef unsigned int uint4;
++typedef int int4;
++typedef unsigned short uint2;
++typedef short int2;
++typedef unsigned char uint1;
++typedef char int1;
++typedef uint8 uintp;
++#endif
++
+ #if defined(_WINDOWS)
+ 
+ #if defined(_WIN64)

Added: head/devel/ghidra/files/patch-Ghidra_Features_FunctionID_build.gradle
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/ghidra/files/patch-Ghidra_Features_FunctionID_build.gradle	Sat Jun 29 00:17:47 2019	(r505315)
@@ -0,0 +1,33 @@
+--- Ghidra/Features/FunctionID/build.gradle.orig	2019-04-03 17:38:23 UTC
++++ Ghidra/Features/FunctionID/build.gradle
+@@ -71,7 +71,7 @@ task buildFidDocumentationPdf(type: Exec) {
+ 		cp $installPoint/topics/FunctionID/images/*.png $buildDir/images
+ 
+ 		echo '** Building FunctionID.fo **'
+-		xsltproc --output $buildDir/fid_withscaling.xml --stringparam profile.condition "withscaling" /usr/share/sgml/docbook/xsl-stylesheets/profiling/profile.xsl fid.xml 2>&1
++		xsltproc --output $buildDir/fid_withscaling.xml --stringparam profile.condition "withscaling" /usr/local/share/xsl/docbook/profiling/profile.xsl fid.xml 2>&1
+ 		xsltproc --output $buildDir/FunctionID.fo fid_pdf.xsl $buildDir/fid_withscaling.xml 2>&1
+ 
+ 		echo '** Building FunctionID.pdf **'
+@@ -94,9 +94,10 @@ task buildFidDocumentationPdf(type: Exec) {
+ 	// Check the OS before executing command.
+ 	doFirst {
+ 		if ( !(org.gradle.internal.os.OperatingSystem.current().isLinux() 
+-			|| org.gradle.internal.os.OperatingSystem.current().isMacOsX())) {
++			|| org.gradle.internal.os.OperatingSystem.current().isMacOsX()
++			|| org.gradle.internal.os.OperatingSystem.current().getName().contains("FreeBSD"))) {
+ 			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, FreeBSD or Mac Os X" ))
+ 		}
+ 	}
+ 
+@@ -138,7 +139,7 @@ task buildFidDocumentationHtml(type: Exec) {
+ 	rm -f $installPoint/topics/FunctionID/*.html
+ 
+ 	echo '** Building html files **'
+-	xsltproc --output $buildDir/fid_noscaling.xml --stringparam profile.condition "noscaling" /usr/share/sgml/docbook/xsl-stylesheets/profiling/profile.xsl fid.xml 2>&1
++	xsltproc --output $buildDir/fid_noscaling.xml --stringparam profile.condition "noscaling" /usr/local/share/xsl/docbook/profiling/profile.xsl fid.xml 2>&1
+ 	xsltproc --stringparam base.dir ${installPoint}/topics/FunctionID/ fid_html.xsl $buildDir/fid_noscaling.xml 2>&1
+ 	sed -i -e '/Frontpage.css/ { p; s/Frontpage.css/languages.css/; }' ${installPoint}/topics/FunctionID/*.html
+ 

Added: head/devel/ghidra/files/patch-Ghidra_Framework_Generic_src_main_java_ghidra_framework_Platform.java
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/ghidra/files/patch-Ghidra_Framework_Generic_src_main_java_ghidra_framework_Platform.java	Sat Jun 29 00:17:47 2019	(r505315)
@@ -0,0 +1,36 @@
+--- Ghidra/Framework/Generic/src/main/java/ghidra/framework/Platform.java.orig	2019-04-03 17:38:23 UTC
++++ Ghidra/Framework/Generic/src/main/java/ghidra/framework/Platform.java
+@@ -70,7 +70,17 @@ public enum Platform {
+ 	 */
+ 	MAC_UNKNOWN(OperatingSystem.MAC_OS_X, Architecture.UNKNOWN, "osx64", ".dylib", ""),
+ 
++ 	/**
++	 * Identifies a FreeBSD OS.
++	 */
++	FREEBSD_32(OperatingSystem.FREEBSD, Architecture.X86, "freebsd32", ".so", ""),
++
+ 	/**
++	 * Identifies a FreeBSD OS.
++	 */
++	FREEBSD_64(OperatingSystem.FREEBSD, Architecture.X86_64, "freebsd64", ".so", ""),
++
++	/**
+ 	 * Identifies an unsupported OS.
+ 	 */
+ 	UNSUPPORTED(OperatingSystem.UNSUPPORTED, Architecture.UNKNOWN, null, null, "");
+@@ -144,6 +154,15 @@ public enum Platform {
+ 			paths.add("/usr/lib");
+ 			paths.add("/usr/X11R6/bin");
+ 			paths.add("/usr/X11R6/lib");
++		}
++		else if (operatingSystem == OperatingSystem.FREEBSD) {
++			paths.add("/bin");
++			paths.add("/lib");
++			paths.add("/usr/bin");
++			paths.add("/usr/lib");
++			paths.add("/usr/local/bin");
++			paths.add("/usr/local/lib");
++			paths.add("/usr/local/lib/compat");
+ 		}
+ 		else if (CURRENT_PLATFORM == WIN_64) {
+ 			String windir = System.getenv("SystemRoot");

Added: head/devel/ghidra/files/patch-Ghidra_Framework_Utility_src_main_java_ghidra_framework_OperatingSystem.java
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/ghidra/files/patch-Ghidra_Framework_Utility_src_main_java_ghidra_framework_OperatingSystem.java	Sat Jun 29 00:17:47 2019	(r505315)
@@ -0,0 +1,10 @@
+--- Ghidra/Framework/Utility/src/main/java/ghidra/framework/OperatingSystem.java.orig	2019-04-03 17:38:23 UTC
++++ Ghidra/Framework/Utility/src/main/java/ghidra/framework/OperatingSystem.java
+@@ -20,6 +20,7 @@ public enum OperatingSystem {
+ 	WINDOWS("Windows"),
+ 	LINUX("Linux"),
+ 	MAC_OS_X("Mac OS X"),
++	FREEBSD("FreeBSD"),
+ 	UNSUPPORTED("Unsupported Operating System");
+ 
+ 	/**

Added: head/devel/ghidra/files/patch-Ghidra_RuntimeScripts_Linux_support_launch.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/ghidra/files/patch-Ghidra_RuntimeScripts_Linux_support_launch.sh	Sat Jun 29 00:17:47 2019	(r505315)
@@ -0,0 +1,10 @@
+--- Ghidra/RuntimeScripts/Linux/support/launch.sh.orig	2019-04-10 09:13:14 UTC
++++ Ghidra/RuntimeScripts/Linux/support/launch.sh
+@@ -88,6 +88,7 @@ else
+ 	DEBUG_LOG4J="${INSTALL_DIR}/Ghidra/RuntimeScripts/Common/support/debug.log4j.xml"
+ fi
+ 
++PATH="/usr/local/openjdk12/bin:/usr/local/openjdk11:"$PATH
+ # Make sure some kind of java is on the path.  It's required to run the LaunchSupport program.
+ if ! [ -x "$(command -v java)" ] ; then
+ 	echo "Java runtime not found.  Please refer to the Ghidra Installation Guide's Troubleshooting section."

Added: head/devel/ghidra/files/patch-build.gradle
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/ghidra/files/patch-build.gradle	Sat Jun 29 00:17:47 2019	(r505315)
@@ -0,0 +1,75 @@
+--- build.gradle.orig	2019-05-16 19:36:27 UTC
++++ build.gradle
+@@ -30,14 +30,31 @@ project.ext.BIN_REPO_PATH = BIN_REPO // TODO make path
+ 
+ /*********************************************************************************
+  *  Prevent forked Java processes from stealing focus
++ *  Prevent writing to the actual home directory
+  *********************************************************************************/
++ext.DUMMY_HOME = file("${projectDir}/../dummy.home").absolutePath
+ allprojects {
+ 	tasks.withType(JavaForkOptions) {
+ 		jvmArgs '-Djava.awt.headless=true'
+ 	}
++	tasks.withType(JavaExec) {
++		jvmArgs "-Duser.home=${DUMMY_HOME}"
++	}
+ }
+ 
+ /*********************************************************************************
++ *  Set Gradle repositories
++ *********************************************************************************/
++ext.FLATREPO = file("${projectDir}/../flatrepo").absolutePath
++allprojects {
++	repositories {
++		mavenCentral()
++		jcenter()
++		flatDir name:'flat', dirs:["${FLATREPO}"]
++	}
++}
++
++/*********************************************************************************
+  *  load properties from Ghidra/application.properties file
+  *********************************************************************************/
+ 
+@@ -58,7 +75,7 @@ apply from: "gradleScripts/setupJacoco.gradle" // Has 
+  *		project.OS_NAMES.each {...}
+  ****************************************************************************/
+ 
+-project.ext.set("OS_NAMES", ["osx64", "win32", "win64", "linux64"])
++project.ext.set("OS_NAMES", ["osx64", "win32", "win64", "linux64", "freebsd64"])
+ 
+ /*********************************************************************************
+  * Imports
+@@ -134,6 +151,19 @@ def isWindows(String platformName) {
+ 	}
+ }
+ 
++/*********************************************************************************
++ * Returns true if the platform is a FreeBSD machine.
++ *********************************************************************************/
++def isFreeBSD(String platformName) {
++
++	if (platformName.startsWith("freebsd")) {
++		return true
++	}
++	else {
++		return false
++	}
++}
++
+ /******************************************************************************************
+  *	Helper method that returns a file that is the same relative location in the bin repo
+  *  as the given project is in its repo.
+@@ -278,6 +308,11 @@ String getCurrentPlatformName() {
+ 	else if (osName.startsWith("Mac OS X")) {
+ 		if (isX86_64) {
+ 			return 'osx64'
++		}
++	}
++	else if (osName.startsWith("FreeBSD")) {
++		if (isX86_64) {
++			return 'freebsd64'
+ 		}
+ 	}
+ 	throw new GradleException("Unrecognized current platform -> osName = $osName, archName = $archName")

Added: head/devel/ghidra/files/patch-gradleScripts_distribution.gradle
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/ghidra/files/patch-gradleScripts_distribution.gradle	Sat Jun 29 00:17:47 2019	(r505315)
@@ -0,0 +1,37 @@
+--- gradleScripts/distribution.gradle.orig	2019-05-16 19:36:27 UTC
++++ gradleScripts/distribution.gradle
+@@ -526,7 +526,7 @@ project.OS_NAMES.each { platform ->
+ 			/////////////////
+ 			// SUPPORT SCRIPTS
+ 			/////////////////
+-			if( isLinux(platform) || isMac(platform) ) {
++			if( isLinux(platform) || isMac(platform) || isFreeBSD(platform) ) {
+ 			    with getMultiRepoCopySpec( "Ghidra/RuntimeScripts/Linux/support", "support" ) 
+ 			}
+ 			if( isWindows(platform) ) {
+@@ -536,7 +536,7 @@ project.OS_NAMES.each { platform ->
+ 			/////////////////
+ 			// SERVER SCRIPTS
+ 			/////////////////
+-			if( isLinux(platform) || isMac(platform) ) {
++			if( isLinux(platform) || isMac(platform) || isFreeBSD(platform) ) {
+ 				from (ROOT_PROJECT_DIR + "/Ghidra/RuntimeScripts/Linux/server") {
+ 					into "server"
+ 				}
+@@ -550,7 +550,7 @@ project.OS_NAMES.each { platform ->
+ 			/////////////////
+ 			// GHIDRA RUN SCRIPT
+ 			/////////////////		
+-			if( isLinux(platform) || isMac(platform) ) {
++			if( isLinux(platform) || isMac(platform) || isFreeBSD(platform) ) {
+ 				from (ROOT_PROJECT_DIR + "/Ghidra/RuntimeScripts/Linux") {
+ 					include "ghidraRun"
+ 				}
+@@ -987,6 +987,7 @@ task createMultiPlatformInstallationZip(type: Zip) { t
+ 	dependsOn ":assemblewin64"
+ 	dependsOn ":assemblelinux64"
+ 	dependsOn ":assembleosx64"
++	dependsOn ":assemblefreebsd64"
+ 	dependsOn ":assembleSourceCommon"
+ 
+ 	addDecompilerPdfsToZip(t)

Added: head/devel/ghidra/files/patch-gradleScripts_ip.gradle
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/ghidra/files/patch-gradleScripts_ip.gradle	Sat Jun 29 00:17:47 2019	(r505315)
@@ -0,0 +1,11 @@
+--- gradleScripts/ip.gradle.orig	2019-04-11 17:48:14 UTC
++++ gradleScripts/ip.gradle
+@@ -125,6 +125,8 @@ def Map<String, List<String>> getIpForModule(Project p
+ 		exclude "**/.settings/**"
+ 		exclude "**/.vs/**"
+ 		exclude "**/*.vcxproj.user"
++		exclude "**/*.orig"
++		exclude "**/*.bak"
+ 	}
+ 	tree.each { file ->
+ 			String ip = getIp(p.projectDir, file)

Added: head/devel/ghidra/pkg-descr
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/ghidra/pkg-descr	Sat Jun 29 00:17:47 2019	(r505315)
@@ -0,0 +1,15 @@
+Ghidra is a software reverse engineering (SRE) framework created
+and maintained by the National Security Agency Research Directorate
+of the United States of America.
+
+This framework includes a suite of full-featured, high-end software
+analysis tools that enable users to analyze compiled code on a
+variety of platforms including Windows, macOS, and Linux. Capabilities
+include disassembly, assembly, decompilation, graphing, and scripting,
+along with hundreds of other features. Ghidra supports a wide variety
+of processor instruction sets and executable formats and can be run
+in both user-interactive and automated modes. Users may also develop
+their own Ghidra plug-in components and/or scripts using Java or
+Python.
+
+WWW: https://ghidra-sre.org/


More information about the svn-ports-all mailing list