Skip to content

Commit

Permalink
ghidra: 11.0 -> 11.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
roblabla committed Apr 8, 2024
1 parent 8af8932 commit e989382
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 21 deletions.
37 changes: 29 additions & 8 deletions pkgs/tools/security/ghidra/0001-Use-protobuf-gradle-plugin.patch
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
From ffb6777d58f068db7e14372415154cd93f77766e Mon Sep 17 00:00:00 2001
From: roblabla <[email protected]>
Date: Wed, 31 Jan 2024 13:19:55 +0100
Subject: [PATCH] Use com.google.protobuf:protobuf-gradle-plugin

---
Ghidra/Debug/Debugger-gadp/build.gradle | 7 +-
Ghidra/Debug/Debugger-isf/build.gradle | 8 +-
Ghidra/Debug/Debugger-rmi-trace/build.gradle | 14 +--
build.gradle | 6 ++
gradle/debugger/hasProtobuf.gradle | 94 --------------------
5 files changed, 26 insertions(+), 103 deletions(-)

diff --git a/Ghidra/Debug/Debugger-gadp/build.gradle b/Ghidra/Debug/Debugger-gadp/build.gradle
index 9e1c57faf..3a3242eb5 100644
--- a/Ghidra/Debug/Debugger-gadp/build.gradle
Expand Down Expand Up @@ -43,7 +56,7 @@ index d135294a0..785681ca2 100644
api project(':Framework-AsyncComm')
api project(':Framework-Debugging')
diff --git a/Ghidra/Debug/Debugger-rmi-trace/build.gradle b/Ghidra/Debug/Debugger-rmi-trace/build.gradle
index eec00786e..666cccafc 100644
index 40fbc17ab..7517ffe6e 100644
--- a/Ghidra/Debug/Debugger-rmi-trace/build.gradle
+++ b/Ghidra/Debug/Debugger-rmi-trace/build.gradle
@@ -18,12 +18,17 @@ apply from: "${rootProject.projectDir}/gradle/javaProject.gradle"
Expand All @@ -63,17 +76,23 @@ index eec00786e..666cccafc 100644
+ }
+}
dependencies {
api project(':Pty')
api project(':Debugger')
}
@@ -36,7 +41,7 @@ task generateProtoPy {
@@ -44,12 +49,9 @@ task generateProtoPy {
ext.outdir = file("build/generated/source/proto/main/py")
outputs.dir(outdir)
inputs.files(src)
- dependsOn(configurations.protocArtifact)
+ dependsOn(protobuf.generateProtoTasks.all())
doLast {
def exe = configurations.protocArtifact.first()
if (!isCurrentWindows()) {
- def exe = configurations.protocArtifact.first()
- if (!isCurrentWindows()) {
- exe.setExecutable(true)
- }
+ def exe = protobuf.tools.protoc.path
exec {
commandLine exe, "--python_out=$outdir", "-I$srcdir"
args src
diff --git a/build.gradle b/build.gradle
index b0c717fb1..5f56506a5 100644
--- a/build.gradle
Expand All @@ -92,10 +111,9 @@ index b0c717fb1..5f56506a5 100644
}
else {
diff --git a/gradle/debugger/hasProtobuf.gradle b/gradle/debugger/hasProtobuf.gradle
deleted file mode 100644
index 23b4ce74b..000000000
index 23b4ce74b..e69de29bb 100644
--- a/gradle/debugger/hasProtobuf.gradle
+++ /dev/null
+++ b/gradle/debugger/hasProtobuf.gradle
@@ -1,94 +0,0 @@
-/* ###
- * IP: GHIDRA
Expand Down Expand Up @@ -191,3 +209,6 @@ index 23b4ce74b..000000000
- }
-}
-zipSourceSubproject.dependsOn generateProto
--
2.42.0

16 changes: 3 additions & 13 deletions pkgs/tools/security/ghidra/build.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,18 @@
, icoutils
, xcbuild
, protobuf
, fetchurl
}:

let
pkg_path = "$out/lib/ghidra";
pname = "ghidra";
version = "11.0";
version = "11.0.2";

src = fetchFromGitHub {
owner = "NationalSecurityAgency";
repo = "Ghidra";
rev = "Ghidra_${version}_build";
hash = "sha256-LVtDqgceZUrMriNy6+yK/ruBrTI8yx6hzTaPa1BTGlc=";
hash = "sha256-Q5nolgqBG2LFVoEeEtzEPTt/cAHubPlRIFt3SYX9z1Y=";
};

gradle = gradle_7;
Expand Down Expand Up @@ -92,7 +91,7 @@ HERE
'';
outputHashAlgo = "sha256";
outputHashMode = "recursive";
outputHash = "sha256-KT+XXowCNaNfOiPzYLwbPMaF84omKFobHkkNqZ6oyUA=";
outputHash = "sha256-nKfJiGoZlDEpbCmYVKNZXz2PYIosCd4nPFdy3MfprHc=";
};

in stdenv.mkDerivation {
Expand All @@ -106,13 +105,6 @@ in stdenv.mkDerivation {

patches = [
./0001-Use-protobuf-gradle-plugin.patch
# we use fetchurl since the fetchpatch normalization strips the whole diff
# https://github.com/NixOS/nixpkgs/issues/266556
(fetchurl {
name = "0002-remove-executable-bit.patch";
url = "https://github.com/NationalSecurityAgency/ghidra/commit/e2a945624b74e5d42dc85e9c1f992315dd154db1.diff";
sha256 = "07mjfl7hvag2akk65g4cknp330qlk07dgbmh20dyg9qxzmk91fyq";
})
];

buildPhase = ''
Expand All @@ -124,8 +116,6 @@ in stdenv.mkDerivation {
sed -i "s#mavenLocal()#mavenLocal(); maven { url '${deps}/maven' }#g" build.gradle
rm -v Ghidra/Debug/Debugger-rmi-trace/build.gradle.orig
gradle --offline --no-daemon --info -Dorg.gradle.java.home=${openjdk17} buildGhidra
'';

Expand Down

0 comments on commit e989382

Please sign in to comment.