2019-03-13 22:03:40 +01:00
|
|
|
{ stdenv, fetchurl, unzip, lib, makeWrapper, autoPatchelfHook
|
2019-12-07 19:46:14 +01:00
|
|
|
, openjdk11, pam, makeDesktopItem, icoutils
|
2019-03-06 13:00:07 +01:00
|
|
|
}: let
|
|
|
|
|
|
|
|
pkg_path = "$out/lib/ghidra";
|
|
|
|
|
2019-12-07 19:46:14 +01:00
|
|
|
desktopItem = makeDesktopItem {
|
|
|
|
name = "ghidra";
|
|
|
|
exec = "ghidra";
|
|
|
|
icon = "ghidra";
|
|
|
|
desktopName = "Ghidra";
|
|
|
|
genericName = "Ghidra Software Reverse Engineering Suite";
|
|
|
|
categories = "Development;";
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2019-03-06 13:00:07 +01:00
|
|
|
in stdenv.mkDerivation {
|
|
|
|
|
2019-12-07 19:46:14 +01:00
|
|
|
name = "ghidra-9.1";
|
2019-03-06 13:00:07 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2019-12-07 19:46:14 +01:00
|
|
|
url = https://ghidra-sre.org/ghidra_9.1_PUBLIC_20191023.zip;
|
|
|
|
sha256 = "0pl7s59008gvgwz4mxp7rz3xr3vaa12a6s5zvx2yr9jxx3gk1l99";
|
2019-03-06 13:00:07 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
makeWrapper
|
2019-03-13 22:03:40 +01:00
|
|
|
autoPatchelfHook
|
2019-03-06 13:00:07 +01:00
|
|
|
unzip
|
|
|
|
];
|
|
|
|
|
2019-03-13 22:03:40 +01:00
|
|
|
buildInputs = [
|
|
|
|
stdenv.cc.cc.lib
|
|
|
|
pam
|
2019-12-07 19:46:14 +01:00
|
|
|
icoutils
|
2019-03-13 22:03:40 +01:00
|
|
|
];
|
2019-03-06 13:00:07 +01:00
|
|
|
|
2019-03-13 22:03:40 +01:00
|
|
|
dontStrip = true;
|
2019-03-06 13:00:07 +01:00
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p "${pkg_path}"
|
2019-12-07 19:46:14 +01:00
|
|
|
mkdir -p "${pkg_path}" "$out/share/applications"
|
2019-03-06 13:00:07 +01:00
|
|
|
cp -a * "${pkg_path}"
|
2019-12-07 19:46:14 +01:00
|
|
|
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;
|
2019-03-06 13:00:07 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
mkdir -p "$out/bin"
|
|
|
|
makeWrapper "${pkg_path}/ghidraRun" "$out/bin/ghidra" \
|
|
|
|
--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/";
|
|
|
|
platforms = [ "x86_64-linux" ];
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = [ maintainers.ck3d ];
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|