Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] WIP: New package: ghidra-9.0.4
@ 2019-10-30 14:20 voidlinux-github
  2019-11-01  0:00 ` voidlinux-github
  0 siblings, 1 reply; 2+ messages in thread
From: voidlinux-github @ 2019-10-30 14:20 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 480 bytes --]

There is a new pull request by knusbaum against master on the void-packages repository

https://github.com/knusbaum/void-packages new_ghidra
https://github.com/void-linux/void-packages/pull/15958

WIP: New package: ghidra-9.0.4
Now that openjdk11 is in, we can package this.
I'm looking for comments on this template because it's kind of messy. I haven't found a prettier way to do it.


A patch file from https://github.com/void-linux/void-packages/pull/15958.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-new_ghidra-15958.patch --]
[-- Type: text/x-diff, Size: 5396 bytes --]

From 60eb92eb5e85b1c7ecbed11e1b6bdd1577d5e7f4 Mon Sep 17 00:00:00 2001
From: Kyle Nusbaum <kylenusbaum@granular.ag>
Date: Tue, 3 Sep 2019 14:57:04 -0500
Subject: [PATCH] New package: ghidra-9.0.4

---
 .../ghidra/patches/gradle_version_check.patch | 11 +++
 srcpkgs/ghidra/patches/wayland_ui.patch       | 15 ++++
 srcpkgs/ghidra/template                       | 80 +++++++++++++++++++
 3 files changed, 106 insertions(+)
 create mode 100644 srcpkgs/ghidra/patches/gradle_version_check.patch
 create mode 100644 srcpkgs/ghidra/patches/wayland_ui.patch
 create mode 100644 srcpkgs/ghidra/template

diff --git a/srcpkgs/ghidra/patches/gradle_version_check.patch b/srcpkgs/ghidra/patches/gradle_version_check.patch
new file mode 100644
index 00000000000..b6bea1a57a8
--- /dev/null
+++ b/srcpkgs/ghidra/patches/gradle_version_check.patch
@@ -0,0 +1,11 @@
+--- ghidra-Ghidra_9.0.4_build/build.gradle	2019-08-01 14:38:35.228473377 -0500
++++ ghidra-Ghidra_9.0.4_build/build.gradle	2019-08-01 14:38:16.382472910 -0500
+@@ -6,7 +6,7 @@
+ /***************************************************************************************
+  * Make sure the correct version of gradle is being used
+  ***************************************************************************************/
+-if (gradle.gradleVersion != "5.0") {
++if (!gradle.gradleVersion.matches("5\\.(.*)")) {
+ 	throw new GradleException("Requires Gradle 5.0, but was run with $gradle.gradleVersion")
+ }
+ 
diff --git a/srcpkgs/ghidra/patches/wayland_ui.patch b/srcpkgs/ghidra/patches/wayland_ui.patch
new file mode 100644
index 00000000000..e60e9c3a713
--- /dev/null
+++ b/srcpkgs/ghidra/patches/wayland_ui.patch
@@ -0,0 +1,15 @@
+*** ghidra-Ghidra_9.0.4_build/Ghidra/RuntimeScripts/Linux/ghidraRun	2019-05-16 14:36:27.000000000 -0500
+--- ghidra-Ghidra_9.0.4_build/Ghidra/RuntimeScripts/Linux/ghidraRun.new	2019-08-29 12:24:32.300079737 -0500
+***************
+*** 15,19 ****
+--- 15,24 ----
+  SCRIPT_FILE="$(readlink -f "$0" 2>/dev/null || readlink "$0" 2>/dev/null || echo "$0")"
+  SCRIPT_DIR="${SCRIPT_FILE%/*}"
+  
++ ## Make Ghidra's UI work on wayland
++ if [ "$XDG_SESSION_TYPE" = "wayland" ]; then
++     export _JAVA_AWT_WM_NONREPARENTING=1
++ fi
++ 
+  # Launch Ghidra
+  "${SCRIPT_DIR}"/support/launch.sh bg Ghidra "${MAXMEM}" "" ghidra.GhidraRun "$@"
diff --git a/srcpkgs/ghidra/template b/srcpkgs/ghidra/template
new file mode 100644
index 00000000000..5b1b1d46f49
--- /dev/null
+++ b/srcpkgs/ghidra/template
@@ -0,0 +1,80 @@
+# Template file for 'ghidra'
+pkgname=ghidra
+version=9.0.4
+revision=1
+wrksrc=ghidra
+create_wrksrc=yes
+hostmakedepends="gradle curl unzip bison flex openjdk-11"
+makedepends=""
+depends="openjdk-11"
+short_desc="Software reverse engineering (SRE) framework"
+maintainer="Kyle Nusbaum <knusbaum+void@sdf.org>"
+license="Apache-2.0"
+homepage="https://www.nsa.gov/resources/everyone/ghidra"
+distfiles="https://github.com/NationalSecurityAgency/ghidra/archive/Ghidra_${version}_build.tar.gz
+https://github.com/pxb1988/dex2jar/releases/download/2.0/dex-tools-2.0.zip
+https://sourceforge.net/projects/catacombae/files/HFSExplorer/0.21/hfsexplorer-0_21-bin.zip
+https://sourceforge.net/projects/yajsw/files/yajsw/yajsw-stable-12.12/yajsw-stable-12.12.zip
+https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/android4me/AXMLPrinter2.jar"
+checksum="e24593fb4cf3e1d1b7a8dfeae85edfba9fd9d446b360c7a5d12e9640438735e3
+ 7907eb4d6e9280b6e17ddce7ee0507eae2ef161ee29f70a10dbc6944fdca75bc
+ 90c9b54798abca5b12f4a678db7d0a4c970f4702cb153c11919536d0014dedbf
+ 1398fcb1e93abb19992c4fa06d7fe5758aabb4c45781d7ef306c6f57ca7a7321
+ 00ed038eb6abaf6ddec8d202a3ed7a81b521458f4cd459948115cfd02ff59d6d"
+skip_extraction="AXMLPrinter2.jar"
+nopie=true
+
+do_configure() {
+	mkdir -p ~/.gradle/init.d
+	mkdir -p ~/flatRepo
+	cat <<EOF > ~/.gradle/init.d/repos.gradle
+ext.HOME = System.getProperty('user.home')
+
+allprojects {
+	repositories {
+		mavenCentral()
+		jcenter()
+		flatDir name:'flat', dirs:["$HOME/flatRepo"]
+	}
+}
+EOF
+}
+
+pre_build() {
+
+	# Place `AXMLPrinter2.jar` in `~/flatRepo`:
+	cp ${XBPS_SRCDISTDIR}/${pkgname}-${version}/AXMLPrinter2.jar ~/flatRepo/
+
+	## Copy Other Dependencies:
+	cp lib/csframework.jar lib/hfsx_dmglib.jar lib/hfsx.jar lib/iharder-base64.jar ~/flatRepo/
+	cp dex2jar-2.0/lib/dex-*.jar ~/flatRepo/
+
+	# Building the GhidraServer requires "Yet another Java service wrapper" (yajsw) version 12.12.
+	# Download `yajsw-stable-12.12.zip` from their project on www.sourceforge.net, and place it in a directory named:
+	# `ghidra.bin/Ghidra/Features/GhidraServer/`. Note that `ghidra.bin` must be a sibling of `ghidra`
+	# Unfortunately this seems to be a fairly hard requirement of the build, so we just follow the instructions.
+	pushd /tmp
+	mkdir -p ${wrksrc}/ghidra.bin/Ghidra/Features/GhidraServer/
+	cp ${XBPS_SRCDISTDIR}/${pkgname}-${version}/yajsw-stable-12.12.zip ${wrksrc}/ghidra.bin/Ghidra/Features/GhidraServer/
+	popd
+
+	cd ghidra-Ghidra_9.0.4_build
+	gradle yajswDevUnpack
+}
+
+do_build() {
+	cd ghidra-Ghidra_9.0.4_build
+	gradle buildGhidra
+}
+
+do_install() {
+	vlicense LICENSE.txt
+
+	mkdir ghidra_dist
+	cd ghidra_dist
+	unzip "../ghidra-Ghidra_${version}_build/build/dist/ghidra*.zip"
+	vmkdir usr/lib/ghidra
+	vmkdir usr/bin
+	vcopy "ghidra*/*" usr/lib/ghidra/
+	ln -s /usr/lib/ghidra/ghidraRun ${DESTDIR}/usr/bin/ghidra
+}

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: WIP: New package: ghidra-9.0.4
  2019-10-30 14:20 [PR PATCH] WIP: New package: ghidra-9.0.4 voidlinux-github
@ 2019-11-01  0:00 ` voidlinux-github
  0 siblings, 0 replies; 2+ messages in thread
From: voidlinux-github @ 2019-11-01  0:00 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 257 bytes --]

New comment by Johnnynator on void-packages repository

https://github.com/void-linux/void-packages/pull/15958#issuecomment-548615318

Comment:
Add `archs="x86_64*"` gradle errors out for anything else (`/ghidra/ghidra-Ghidra_9.0.4_build/build.gradle:283`)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-11-01  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-30 14:20 [PR PATCH] WIP: New package: ghidra-9.0.4 voidlinux-github
2019-11-01  0:00 ` voidlinux-github

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).