about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/science/electronics/degate/default.nix
blob: 2aa20aec650365a9ce2996786b3d146c383d3fa6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{ lib
, stdenv
, fetchFromGitHub
, fetchpatch
, cmake
, boost
, qtbase
, qtimageformats
, qttools
, wrapQtAppsHook
}:

let
  boost_static = boost.override { enableStatic = true; };

in stdenv.mkDerivation rec {
  pname = "degate";
  version = "2.0.0";

  src = fetchFromGitHub {
    owner = "DegateCommunity";
    repo = "Degate";
    rev = "refs/tags/v${version}";
    hash = "sha256-INoA3Z6ya03ZMn6E+nOCkXZLoxoo2WgPDw9v5miI09A=";
  };

  patches = [
    # bump bundled catch2 to avoid incompatibility with modern glibc
    (fetchpatch {
      name = "catch2-2.13.9.patch";
      url = "https://github.com/DegateCommunity/Degate/commit/06346dde4312cbb867854899eacf58679d6ac7e2.patch";
      includes = [ "tests/catch2/catch.hpp" ];
      hash = "sha256-SbSA813QI8RRVy1lvAOGMGAC2KUQKjwYR2imqX40pvU=";
    })
  ];

  postPatch = ''
    sed -i -E '/(_OUTPUT_DIRECTORY|DESTINATION)/s|\bout/||g' CMakeLists.txt
  '';

  nativeBuildInputs = [
    cmake
    qttools
    wrapQtAppsHook
  ];

  buildInputs = [
    boost_static
    qtbase
  ];

  doCheck = true;
  checkPhase = ''
    runHook preCheck

    (
      cd tests/out/bin

      # provide qtimageformats plugin to allow tests to read tiff files
      export QT_PLUGIN_PATH="${qtimageformats}/${qtbase.qtPluginPrefix}"

      ./DegateTests
    )

    runHook postCheck
  '';

  meta = with lib; {
    description = "A modern and open-source cross-platform software for chips reverse engineering";
    homepage = "https://degate.readthedocs.io/";
    license = licenses.gpl3;
    platforms = platforms.unix;
    maintainers = with maintainers; [ ris ];
  };
}