2020-12-31 15:06:54 +00:00
|
|
|
{ stdenv
|
|
|
|
, fetchzip
|
|
|
|
, lib
|
|
|
|
, makeWrapper
|
|
|
|
, autoPatchelfHook
|
|
|
|
, openjdk11
|
|
|
|
, pam
|
|
|
|
, makeDesktopItem
|
|
|
|
, icoutils
|
|
|
|
}:
|
|
|
|
|
|
|
|
let
|
2019-03-06 12:00:07 +00:00
|
|
|
|
|
|
|
pkg_path = "$out/lib/ghidra";
|
|
|
|
|
2019-12-07 18:46:14 +00:00
|
|
|
desktopItem = makeDesktopItem {
|
|
|
|
name = "ghidra";
|
|
|
|
exec = "ghidra";
|
|
|
|
icon = "ghidra";
|
|
|
|
desktopName = "Ghidra";
|
|
|
|
genericName = "Ghidra Software Reverse Engineering Suite";
|
|
|
|
categories = "Development;";
|
|
|
|
};
|
|
|
|
|
2020-11-13 23:26:24 +00:00
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
pname = "ghidra";
|
2021-12-10 23:02:21 +00:00
|
|
|
version = "10.1";
|
|
|
|
versiondate = "20211210";
|
2019-03-06 12:00:07 +00:00
|
|
|
|
2020-04-10 18:14:45 +00:00
|
|
|
src = fetchzip {
|
2021-06-26 01:13:40 +00:00
|
|
|
url = "https://github.com/NationalSecurityAgency/ghidra/releases/download/Ghidra_${version}_build/ghidra_${version}_PUBLIC_${versiondate}.zip";
|
2021-12-10 23:02:21 +00:00
|
|
|
sha256 = "0b4wn2nwxp96dpg3xpabqh74xxv0fhwmqq04wgfjgdh6bavqk86b";
|
2019-03-06 12:00:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
2020-04-10 18:14:45 +00:00
|
|
|
icoutils
|
2020-12-31 15:06:54 +00:00
|
|
|
]
|
|
|
|
++ lib.optionals stdenv.isLinux [ autoPatchelfHook ];
|
2019-03-06 12:00:07 +00:00
|
|
|
|
2019-03-13 21:03:40 +00:00
|
|
|
buildInputs = [
|
|
|
|
stdenv.cc.cc.lib
|
|
|
|
pam
|
|
|
|
];
|
2019-03-06 12:00:07 +00:00
|
|
|
|
2019-03-13 21:03:40 +00:00
|
|
|
dontStrip = true;
|
2019-03-06 12:00:07 +00:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p "${pkg_path}"
|
2019-12-07 18:46:14 +00:00
|
|
|
mkdir -p "${pkg_path}" "$out/share/applications"
|
2019-03-06 12:00:07 +00:00
|
|
|
cp -a * "${pkg_path}"
|
2019-12-07 18:46:14 +00:00
|
|
|
ln -s ${desktopItem}/share/applications/* $out/share/applications
|
2020-04-10 18:14:45 +00:00
|
|
|
|
2019-12-07 18:46:14 +00:00
|
|
|
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;
|
2019-03-06 12:00:07 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
mkdir -p "$out/bin"
|
2021-10-01 19:49:49 +00:00
|
|
|
ln -s "${pkg_path}/ghidraRun" "$out/bin/ghidra"
|
|
|
|
|
|
|
|
wrapProgram "${pkg_path}/support/launch.sh" \
|
2019-03-06 12:00:07 +00:00
|
|
|
--prefix PATH : ${lib.makeBinPath [ openjdk11 ]}
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "A software reverse engineering (SRE) suite of tools developed by NSA's Research Directorate in support of the Cybersecurity mission";
|
|
|
|
homepage = "https://ghidra-sre.org/";
|
2020-12-31 15:06:54 +00:00
|
|
|
platforms = [ "x86_64-linux" "x86_64-darwin" ];
|
2019-03-06 12:00:07 +00:00
|
|
|
license = licenses.asl20;
|
2021-04-23 15:42:33 +00:00
|
|
|
maintainers = with maintainers; [ ck3d govanify mic92 ];
|
2019-03-06 12:00:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|