diff options
author | Peder Bergebakken Sundt <pbsds@hotmail.com> | 2023-11-18 19:10:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-18 19:10:10 +0100 |
commit | 65dd1cd5a8216b3324a7672581635fba8403ce05 (patch) | |
tree | 1fa3c7d72f7f95391c524a7d75300c21e2113977 /pkgs/tools/security | |
parent | a9f2e71575369875246cb7d8f043393d933104f6 (diff) | |
parent | d1ef3d7089cf8e39672f8ed7be7a394f8fb69c0c (diff) | |
download | nixlib-65dd1cd5a8216b3324a7672581635fba8403ce05.tar nixlib-65dd1cd5a8216b3324a7672581635fba8403ce05.tar.gz nixlib-65dd1cd5a8216b3324a7672581635fba8403ce05.tar.bz2 nixlib-65dd1cd5a8216b3324a7672581635fba8403ce05.tar.lz nixlib-65dd1cd5a8216b3324a7672581635fba8403ce05.tar.xz nixlib-65dd1cd5a8216b3324a7672581635fba8403ce05.tar.zst nixlib-65dd1cd5a8216b3324a7672581635fba8403ce05.zip |
Merge pull request #261924 from roblabla/ghidra-10.4
ghidra: 10.3.3 -> 10.4
Diffstat (limited to 'pkgs/tools/security')
-rw-r--r-- | pkgs/tools/security/ghidra/0001-Use-protobuf-gradle-plugin.patch | 227 | ||||
-rw-r--r-- | pkgs/tools/security/ghidra/build.nix | 39 |
2 files changed, 124 insertions, 142 deletions
diff --git a/pkgs/tools/security/ghidra/0001-Use-protobuf-gradle-plugin.patch b/pkgs/tools/security/ghidra/0001-Use-protobuf-gradle-plugin.patch index 03ddf76e8ffe..7fb7d53e352f 100644 --- a/pkgs/tools/security/ghidra/0001-Use-protobuf-gradle-plugin.patch +++ b/pkgs/tools/security/ghidra/0001-Use-protobuf-gradle-plugin.patch @@ -1,112 +1,129 @@ diff --git a/Ghidra/Debug/Debugger-gadp/build.gradle b/Ghidra/Debug/Debugger-gadp/build.gradle -index f4dbd3cd0..6108e8534 100644 +index 9e1c57faf..3a3242eb5 100644 --- a/Ghidra/Debug/Debugger-gadp/build.gradle +++ b/Ghidra/Debug/Debugger-gadp/build.gradle -@@ -23,42 +23,18 @@ apply from: "${rootProject.projectDir}/gradle/javaTestProject.gradle" +@@ -18,11 +18,16 @@ apply from: "${rootProject.projectDir}/gradle/javaProject.gradle" + apply from: "${rootProject.projectDir}/gradle/jacocoProject.gradle" + apply from: "${rootProject.projectDir}/gradle/javaTestProject.gradle" apply from: "${rootProject.projectDir}/gradle/distributableGhidraModule.gradle" +-apply from: "${rootProject.projectDir}/gradle/debugger/hasProtobuf.gradle" ++apply plugin: 'com.google.protobuf' apply plugin: 'eclipse' -+apply plugin: 'com.google.protobuf' eclipse.project.name = 'Debug Debugger-gadp' --configurations { -- allProtocArtifacts -- protocArtifact --} -- - def platform = getCurrentPlatformName() - --dependencies { -- allProtocArtifacts 'com.google.protobuf:protoc:3.21.8:windows-x86_64@exe' -- allProtocArtifacts 'com.google.protobuf:protoc:3.21.8:linux-x86_64@exe' -- allProtocArtifacts 'com.google.protobuf:protoc:3.21.8:linux-aarch_64@exe' -- allProtocArtifacts 'com.google.protobuf:protoc:3.21.8:osx-x86_64@exe' -- allProtocArtifacts 'com.google.protobuf:protoc:3.21.8:osx-aarch_64@exe' -- -- if (isCurrentWindows()) { -- protocArtifact 'com.google.protobuf:protoc:3.21.8:windows-x86_64@exe' -- } -- if (isCurrentLinux()) { -- if (platform.endsWith("x86_64")) { -- protocArtifact 'com.google.protobuf:protoc:3.21.8:linux-x86_64@exe' -- } -- else { -- protocArtifact 'com.google.protobuf:protoc:3.21.8:linux-aarch_64@exe' -- } -- } -- if (isCurrentMac()) { -- if (platform.endsWith("x86_64")) { -- protocArtifact 'com.google.protobuf:protoc:3.21.8:osx-x86_64@exe' -- } -- else { -- protocArtifact 'com.google.protobuf:protoc:3.21.8:osx-aarch_64@exe' -- } +buildscript { + dependencies { + classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.18' - } ++ } +} - -+dependencies { + dependencies { api project(':Framework-AsyncComm') api project(':Framework-Debugging') - api project(':ProposedUtils') -@@ -73,37 +49,3 @@ dependencies { - } - }*/ - --task generateProto { -- ext.srcdir = file("src/main/proto") -- ext.src = fileTree(srcdir) { -- include "**/*.proto" -- } -- ext.outdir = file("build/generated/source/proto/main/java") -- outputs.dir(outdir) -- inputs.files(src) -- dependsOn(configurations.protocArtifact) -- doLast { -- def exe = configurations.protocArtifact.first() -- if (!isCurrentWindows()) { -- exe.setExecutable(true) -- } -- exec { -- commandLine exe, "--java_out=$outdir", "-I$srcdir" -- args src -- } -- } --} -- --tasks.compileJava.dependsOn(tasks.generateProto) --tasks.eclipse.dependsOn(tasks.generateProto) --rootProject.tasks.prepDev.dependsOn(tasks.generateProto) -- --sourceSets { -- main { -- java { -- srcDir tasks.generateProto.outdir -- } -- } --} --zipSourceSubproject.dependsOn generateProto -- diff --git a/Ghidra/Debug/Debugger-isf/build.gradle b/Ghidra/Debug/Debugger-isf/build.gradle -index 6bf945c2e..3225d095d 100644 +index d135294a0..785681ca2 100644 --- a/Ghidra/Debug/Debugger-isf/build.gradle +++ b/Ghidra/Debug/Debugger-isf/build.gradle -@@ -20,42 +20,18 @@ apply from: "${rootProject.projectDir}/gradle/javaTestProject.gradle" +@@ -18,11 +18,15 @@ apply from: "${rootProject.projectDir}/gradle/javaProject.gradle" + apply from: "${rootProject.projectDir}/gradle/jacocoProject.gradle" + apply from: "${rootProject.projectDir}/gradle/javaTestProject.gradle" apply from: "${rootProject.projectDir}/gradle/distributableGhidraModule.gradle" - - apply plugin: 'eclipse' +-apply from: "${rootProject.projectDir}/gradle/debugger/hasProtobuf.gradle" +- +apply plugin: 'com.google.protobuf' + apply plugin: 'eclipse' eclipse.project.name = 'Debug Debugger-isf' ++buildscript { ++ dependencies { ++ classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.18' ++ } ++} + dependencies { + 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 +--- 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" + apply from: "${rootProject.projectDir}/gradle/jacocoProject.gradle" + apply from: "${rootProject.projectDir}/gradle/javaTestProject.gradle" + apply from: "${rootProject.projectDir}/gradle/distributableGhidraModule.gradle" +-apply from: "${rootProject.projectDir}/gradle/debugger/hasProtobuf.gradle" ++apply plugin: 'com.google.protobuf' + apply from: "${rootProject.projectDir}/gradle/debugger/hasPythonPackage.gradle" + + apply plugin: 'eclipse' + eclipse.project.name = 'Debug Debugger-rmi-trace' + ++buildscript { ++ dependencies { ++ classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.18' ++ } ++} + dependencies { + api project(':Debugger') + } +@@ -36,7 +41,7 @@ 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()) { +diff --git a/build.gradle b/build.gradle +index b0c717fb1..5f56506a5 100644 +--- a/build.gradle ++++ b/build.gradle +@@ -74,6 +74,12 @@ if (flatRepo.isDirectory()) { + jcenter() + flatDir name: "flat", dirs:["$flatRepo"] + } ++ buildscript { ++ repositories { ++ mavenLocal() ++ mavenCentral() ++ } ++ } + } + } + else { +diff --git a/gradle/debugger/hasProtobuf.gradle b/gradle/debugger/hasProtobuf.gradle +deleted file mode 100644 +index 23b4ce74b..000000000 +--- a/gradle/debugger/hasProtobuf.gradle ++++ /dev/null +@@ -1,94 +0,0 @@ +-/* ### +- * IP: GHIDRA +- * +- * Licensed under the Apache License, Version 2.0 (the "License"); +- * you may not use this file except in compliance with the License. +- * You may obtain a copy of the License at +- * +- * http://www.apache.org/licenses/LICENSE-2.0 +- * +- * Unless required by applicable law or agreed to in writing, software +- * distributed under the License is distributed on an "AS IS" BASIS, +- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +- * See the License for the specific language governing permissions and +- * limitations under the License. +- */ +-/*plugins { +- id 'com.google.protobuf' version '0.8.10' +-}*/ +- -configurations { - allProtocArtifacts - protocArtifact -} - - def platform = getCurrentPlatformName() - +-def platform = getCurrentPlatformName() +- +- -dependencies { - allProtocArtifacts 'com.google.protobuf:protoc:3.21.8:windows-x86_64@exe' - allProtocArtifacts 'com.google.protobuf:protoc:3.21.8:linux-x86_64@exe' @@ -132,20 +149,15 @@ index 6bf945c2e..3225d095d 100644 - else { - protocArtifact 'com.google.protobuf:protoc:3.21.8:osx-aarch_64@exe' - } -+buildscript { -+ dependencies { -+ classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.18' - } -+} - -+dependencies { - api project(':Framework-AsyncComm') - api project(':Framework-Debugging') - api project(':ProposedUtils') -@@ -64,40 +40,6 @@ dependencies { - testImplementation project(path: ':Framework-Debugging', configuration: 'testArtifacts') - } - +- } +-} +- +-/*protobuf { +- protoc { +- artifact = 'com.google.protobuf:protoc:3.21.8' +- } +-}*/ +- -task generateProto { - ext.srcdir = file("src/main/proto") - ext.src = fileTree(srcdir) { @@ -179,24 +191,3 @@ index 6bf945c2e..3225d095d 100644 - } -} -zipSourceSubproject.dependsOn generateProto -- - // Include buildable native source in distribution - rootProject.assembleDistribution { - from (this.project.projectDir.toString()) { -diff --git a/build.gradle b/build.gradle -index b0c717fb1..5f56506a5 100644 ---- a/build.gradle -+++ b/build.gradle -@@ -74,6 +74,12 @@ if (flatRepo.isDirectory()) { - jcenter() - flatDir name: "flat", dirs:["$flatRepo"] - } -+ buildscript { -+ repositories { -+ mavenLocal() -+ mavenCentral() -+ } -+ } - } - } - else { diff --git a/pkgs/tools/security/ghidra/build.nix b/pkgs/tools/security/ghidra/build.nix index 16bc1dbe5cd7..50fd64656f4a 100644 --- a/pkgs/tools/security/ghidra/build.nix +++ b/pkgs/tools/security/ghidra/build.nix @@ -10,18 +10,19 @@ , icoutils , xcbuild , protobuf +, fetchurl }: let pkg_path = "$out/lib/ghidra"; pname = "ghidra"; - version = "10.3.3"; + version = "10.4"; src = fetchFromGitHub { owner = "NationalSecurityAgency"; repo = "Ghidra"; rev = "Ghidra_${version}_build"; - hash = "sha256-KDSiZ/JwAqX6Obg9UD8ZQut01l/eMXbioJy//GluXn0="; + hash = "sha256-g0JM6pm1vkCh9yBB5mfrOiNrImqoyWdQcEe2g+AO6LQ="; }; gradle = gradle_7; @@ -36,24 +37,6 @@ let }; # postPatch scripts. - # Tells ghidra to use our own protoc binary instead of the prebuilt one. - fixProtoc = '' - cat >>Ghidra/Debug/Debugger-gadp/build.gradle <<HERE -protobuf { - protoc { - path = '${protobuf}/bin/protoc' - } -} -HERE - cat >>Ghidra/Debug/Debugger-isf/build.gradle <<HERE -protobuf { - protoc { - path = '${protobuf}/bin/protoc' - } -} -HERE - ''; - # Adds a gradle step that downloads all the dependencies to the gradle cache. addResolveStep = '' cat >>build.gradle <<HERE @@ -85,7 +68,7 @@ HERE inherit version src; patches = [ ./0001-Use-protobuf-gradle-plugin.patch ]; - postPatch = fixProtoc + addResolveStep; + postPatch = addResolveStep; nativeBuildInputs = [ gradle perl ] ++ lib.optional stdenv.isDarwin xcbuild; buildPhase = '' @@ -116,13 +99,21 @@ in stdenv.mkDerivation { inherit pname version src; nativeBuildInputs = [ - gradle unzip makeWrapper icoutils + gradle unzip makeWrapper icoutils protobuf ] ++ lib.optional stdenv.isDarwin xcbuild; dontStrip = true; - patches = [ ./0001-Use-protobuf-gradle-plugin.patch ]; - postPatch = fixProtoc; + 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 = '' export HOME="$NIX_BUILD_TOP/home" |