mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-02-24 05:00:19 +00:00
Merge pull request #314779 from emilytrau/ghidra-desktop
ghidra: improve desktop support
This commit is contained in:
commit
57592d5f5d
@ -4,10 +4,12 @@
|
|||||||
, callPackage
|
, callPackage
|
||||||
, gradle_7
|
, gradle_7
|
||||||
, perl
|
, perl
|
||||||
, makeWrapper
|
, makeBinaryWrapper
|
||||||
, openjdk17
|
, openjdk17
|
||||||
, unzip
|
, unzip
|
||||||
, makeDesktopItem
|
, makeDesktopItem
|
||||||
|
, copyDesktopItems
|
||||||
|
, desktopToDarwinBundle
|
||||||
, icoutils
|
, icoutils
|
||||||
, xcbuild
|
, xcbuild
|
||||||
, protobuf
|
, protobuf
|
||||||
@ -53,15 +55,6 @@ let
|
|||||||
./0003-Remove-build-datestamp.patch
|
./0003-Remove-build-datestamp.patch
|
||||||
];
|
];
|
||||||
|
|
||||||
desktopItem = makeDesktopItem {
|
|
||||||
name = "ghidra";
|
|
||||||
exec = "ghidra";
|
|
||||||
icon = "ghidra";
|
|
||||||
desktopName = "Ghidra";
|
|
||||||
genericName = "Ghidra Software Reverse Engineering Suite";
|
|
||||||
categories = [ "Development" ];
|
|
||||||
};
|
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
# Set name of release (eg. PUBLIC, DEV, etc.)
|
# Set name of release (eg. PUBLIC, DEV, etc.)
|
||||||
sed -i -e 's/application\.release\.name=.*/application.release.name=${releaseName}/' Ghidra/application.properties
|
sed -i -e 's/application\.release\.name=.*/application.release.name=${releaseName}/' Ghidra/application.properties
|
||||||
@ -145,9 +138,28 @@ HERE
|
|||||||
in stdenv.mkDerivation (finalAttrs: {
|
in stdenv.mkDerivation (finalAttrs: {
|
||||||
inherit pname version src patches postPatch;
|
inherit pname version src patches postPatch;
|
||||||
|
|
||||||
|
desktopItems = [
|
||||||
|
(makeDesktopItem {
|
||||||
|
name = "ghidra";
|
||||||
|
exec = "ghidra";
|
||||||
|
icon = "ghidra";
|
||||||
|
desktopName = "Ghidra";
|
||||||
|
genericName = "Ghidra Software Reverse Engineering Suite";
|
||||||
|
categories = [ "Development" ];
|
||||||
|
terminal = false;
|
||||||
|
})
|
||||||
|
];
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
gradle unzip makeWrapper icoutils protobuf
|
gradle
|
||||||
] ++ lib.optional stdenv.isDarwin xcbuild;
|
unzip
|
||||||
|
makeBinaryWrapper
|
||||||
|
copyDesktopItems
|
||||||
|
protobuf
|
||||||
|
] ++ lib.optionals stdenv.isDarwin [
|
||||||
|
xcbuild
|
||||||
|
desktopToDarwinBundle
|
||||||
|
];
|
||||||
|
|
||||||
dontStrip = true;
|
dontStrip = true;
|
||||||
|
|
||||||
@ -169,6 +181,7 @@ in stdenv.mkDerivation (finalAttrs: {
|
|||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
runHook preInstall
|
runHook preInstall
|
||||||
|
|
||||||
mkdir -p "${pkg_path}" "$out/share/applications"
|
mkdir -p "${pkg_path}" "$out/share/applications"
|
||||||
|
|
||||||
ZIP=build/dist/$(ls build/dist)
|
ZIP=build/dist/$(ls build/dist)
|
||||||
@ -178,15 +191,13 @@ in stdenv.mkDerivation (finalAttrs: {
|
|||||||
mv "${pkg_path}"/*/* "${pkg_path}"
|
mv "${pkg_path}"/*/* "${pkg_path}"
|
||||||
rmdir "''${f[@]}"
|
rmdir "''${f[@]}"
|
||||||
|
|
||||||
ln -s ${desktopItem}/share/applications/* $out/share/applications
|
for f in Ghidra/Framework/Gui/src/main/resources/images/GhidraIcon*.png; do
|
||||||
|
res=$(basename "$f" ".png" | cut -d"_" -f3 | cut -c11-)
|
||||||
icotool -x "Ghidra/RuntimeScripts/Windows/support/ghidra.ico"
|
install -Dm444 "$f" "$out/share/icons/hicolor/''${res}x''${res}/apps/ghidra.png"
|
||||||
rm ghidra_4_40x40x32.png
|
|
||||||
for f in ghidra_*.png; do
|
|
||||||
res=$(basename "$f" ".png" | cut -d"_" -f3 | cut -d"x" -f1-2)
|
|
||||||
mkdir -pv "$out/share/icons/hicolor/$res/apps"
|
|
||||||
mv "$f" "$out/share/icons/hicolor/$res/apps/ghidra.png"
|
|
||||||
done;
|
done;
|
||||||
|
# improved macOS icon support
|
||||||
|
install -Dm444 Ghidra/Framework/Gui/src/main/resources/images/GhidraIcon64.png $out/share/icons/hicolor/32x32@2/apps/ghidra.png
|
||||||
|
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
@ -206,7 +217,8 @@ in stdenv.mkDerivation (finalAttrs: {
|
|||||||
};
|
};
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "A software reverse engineering (SRE) suite of tools developed by NSA's Research Directorate in support of the Cybersecurity mission";
|
changelog = "https://htmlpreview.github.io/?https://github.com/NationalSecurityAgency/ghidra/blob/Ghidra_${finalAttrs.version}_build/Ghidra/Configurations/Public_Release/src/global/docs/ChangeHistory.html";
|
||||||
|
description = "Software reverse engineering (SRE) suite of tools";
|
||||||
mainProgram = "ghidra";
|
mainProgram = "ghidra";
|
||||||
homepage = "https://ghidra-sre.org/";
|
homepage = "https://ghidra-sre.org/";
|
||||||
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
{ lib
|
{ lib
|
||||||
|
, stdenv
|
||||||
, callPackage
|
, callPackage
|
||||||
, symlinkJoin
|
, symlinkJoin
|
||||||
, makeBinaryWrapper
|
, makeBinaryWrapper
|
||||||
|
, desktopToDarwinBundle
|
||||||
, ghidra
|
, ghidra
|
||||||
}:
|
}:
|
||||||
|
|
||||||
@ -19,10 +21,14 @@ let
|
|||||||
withExtensions = f: (symlinkJoin {
|
withExtensions = f: (symlinkJoin {
|
||||||
name = "${ghidra.pname}-with-extensions-${lib.getVersion ghidra}";
|
name = "${ghidra.pname}-with-extensions-${lib.getVersion ghidra}";
|
||||||
paths = (f allExtensions);
|
paths = (f allExtensions);
|
||||||
nativeBuildInputs = [ makeBinaryWrapper ];
|
nativeBuildInputs = [ makeBinaryWrapper ]
|
||||||
|
++ lib.optional stdenv.hostPlatform.isDarwin desktopToDarwinBundle;
|
||||||
postBuild = ''
|
postBuild = ''
|
||||||
makeWrapper '${ghidra}/bin/ghidra' "$out/bin/ghidra" \
|
makeWrapper '${ghidra}/bin/ghidra' "$out/bin/ghidra" \
|
||||||
--set NIX_GHIDRAHOME "$out/lib/ghidra/Ghidra"
|
--set NIX_GHIDRAHOME "$out/lib/ghidra/Ghidra"
|
||||||
|
ln -s ${ghidra}/share $out/share
|
||||||
|
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
|
||||||
|
convertDesktopFiles $prefix
|
||||||
'';
|
'';
|
||||||
inherit (ghidra) meta;
|
inherit (ghidra) meta;
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user