2021-01-05 17:05:55 +00:00
|
|
|
{ stdenv
|
|
|
|
, fetchzip
|
|
|
|
, lib
|
|
|
|
, makeWrapper
|
|
|
|
, autoPatchelfHook
|
2022-11-21 17:40:18 +00:00
|
|
|
, openjdk17
|
2021-01-05 17:05:55 +00:00
|
|
|
, pam
|
|
|
|
, makeDesktopItem
|
|
|
|
, icoutils
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
pkg_path = "$out/lib/ghidra";
|
|
|
|
|
|
|
|
desktopItem = makeDesktopItem {
|
|
|
|
name = "ghidra";
|
|
|
|
exec = "ghidra";
|
|
|
|
icon = "ghidra";
|
|
|
|
desktopName = "Ghidra";
|
|
|
|
genericName = "Ghidra Software Reverse Engineering Suite";
|
2022-03-05 16:20:37 +00:00
|
|
|
categories = [ "Development" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2020-11-24 20:58:05 +00:00
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
pname = "ghidra";
|
2022-11-21 17:40:18 +00:00
|
|
|
version = "10.2.2";
|
|
|
|
versiondate = "20221115";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchzip {
|
2021-06-28 23:13:55 +00:00
|
|
|
url = "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_${version}_build/ghidra_${version}_PUBLIC_${versiondate}.zip";
|
2022-11-21 17:40:18 +00:00
|
|
|
sha256 = "sha256-0OcSdCN8vWUgTgFdgNtiI0OfHmfa/WD9IoaJUl+llqI=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
|
|
|
icoutils
|
2021-01-05 17:05:55 +00:00
|
|
|
]
|
|
|
|
++ lib.optionals stdenv.isLinux [ autoPatchelfHook ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
stdenv.cc.cc.lib
|
|
|
|
pam
|
|
|
|
];
|
|
|
|
|
|
|
|
dontStrip = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p "${pkg_path}"
|
|
|
|
mkdir -p "${pkg_path}" "$out/share/applications"
|
|
|
|
cp -a * "${pkg_path}"
|
|
|
|
ln -s ${desktopItem}/share/applications/* $out/share/applications
|
|
|
|
|
|
|
|
icotool -x "${pkg_path}/support/ghidra.ico"
|
|
|
|
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;
|
|
|
|
'';
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
mkdir -p "$out/bin"
|
2021-10-04 12:37:57 +00:00
|
|
|
ln -s "${pkg_path}/ghidraRun" "$out/bin/ghidra"
|
|
|
|
|
|
|
|
wrapProgram "${pkg_path}/support/launch.sh" \
|
2022-11-21 17:40:18 +00:00
|
|
|
--prefix PATH : ${lib.makeBinPath [ openjdk17 ]}
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "A software reverse engineering (SRE) suite of tools developed by NSA's Research Directorate in support of the Cybersecurity mission";
|
2021-12-30 13:39:12 +00:00
|
|
|
homepage = "https://github.com/NationalSecurityAgency/ghidra";
|
2021-01-05 17:05:55 +00:00
|
|
|
platforms = [ "x86_64-linux" "x86_64-darwin" ];
|
2022-06-16 17:23:12 +00:00
|
|
|
sourceProvenance = with sourceTypes; [ binaryBytecode ];
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.asl20;
|
2021-04-25 03:57:28 +00:00
|
|
|
maintainers = with maintainers; [ ck3d govanify mic92 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|