1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 fetchpatch,
6 cmake,
7 boost183,
8 qtbase,
9 qtimageformats,
10 qttools,
11 wrapQtAppsHook,
12}:
13
14let
15 boost_static = boost183.override { enableStatic = true; };
16
17in
18stdenv.mkDerivation rec {
19 pname = "degate";
20 version = "2.0.0";
21
22 src = fetchFromGitHub {
23 owner = "DegateCommunity";
24 repo = "Degate";
25 tag = "v${version}";
26 hash = "sha256-INoA3Z6ya03ZMn6E+nOCkXZLoxoo2WgPDw9v5miI09A=";
27 };
28
29 patches = [
30 # bump bundled catch2 to avoid incompatibility with modern glibc
31 (fetchpatch {
32 name = "catch2-2.13.9.patch";
33 url = "https://github.com/DegateCommunity/Degate/commit/06346dde4312cbb867854899eacf58679d6ac7e2.patch";
34 includes = [ "tests/catch2/catch.hpp" ];
35 hash = "sha256-SbSA813QI8RRVy1lvAOGMGAC2KUQKjwYR2imqX40pvU=";
36 })
37 ];
38
39 postPatch = ''
40 sed -i -E '/(_OUTPUT_DIRECTORY|DESTINATION)/s|\bout/||g' CMakeLists.txt
41 '';
42
43 nativeBuildInputs = [
44 cmake
45 qttools
46 wrapQtAppsHook
47 ];
48
49 buildInputs = [
50 boost_static
51 qtbase
52 ];
53
54 doCheck = true;
55 checkPhase = ''
56 runHook preCheck
57
58 (
59 cd tests/out/bin
60
61 # provide qtimageformats plugin to allow tests to read tiff files
62 export QT_PLUGIN_PATH="${qtimageformats}/${qtbase.qtPluginPrefix}"
63
64 ./DegateTests
65 )
66
67 runHook postCheck
68 '';
69
70 meta = with lib; {
71 description = "Modern and open-source cross-platform software for chips reverse engineering";
72 mainProgram = "Degate";
73 homepage = "https://degate.readthedocs.io/";
74 license = licenses.gpl3;
75 platforms = platforms.unix;
76 maintainers = with maintainers; [ ris ];
77 };
78}