heroic: use qt6 version of kdialog (#372495)
[NixPkgs.git] / pkgs / by-name / ti / tiscamera / package.nix
blobd3aacec4e45a283f098f389de08fd8a2074aaf8c
2   lib,
3   stdenv,
4   fetchFromGitHub,
5   cmake,
6   pkg-config,
7   runtimeShell,
8   catch2,
9   elfutils,
10   libselinux,
11   libsepol,
12   libunwind,
13   libusb1,
14   libuuid,
15   libzip,
16   orc,
17   pcre,
18   zstd,
19   glib,
20   gobject-introspection,
21   gst_all_1,
22   wrapGAppsHook3,
23   # needs pkg_resources
24   withDoc ? false,
25   sphinx,
26   graphviz,
27   withAravis ? true,
28   aravis,
29   meson,
30   withAravisUsbVision ? withAravis,
31   withGui ? true,
32   qt5,
35 stdenv.mkDerivation rec {
36   pname = "tiscamera";
37   version = "1.1.1";
39   src = fetchFromGitHub {
40     owner = "TheImagingSource";
41     repo = "tiscamera";
42     rev = "v-tiscamera-${version}";
43     hash = "sha256-33U/8CbqNWIRwfDHXCZSN466WEQj9fip+Z5EJ7kIwRM=";
44   };
46   postPatch = ''
47     cp ${catch2}/include/catch2/catch.hpp external/catch/catch.hpp
49     substituteInPlace ./data/udev/80-theimagingsource-cameras.rules.in \
50       --replace "/bin/sh" "${runtimeShell}/bin/sh" \
51       --replace "typically /usr/bin/" "" \
52       --replace "typically /usr/share/theimagingsource/tiscamera/uvc-extension/" ""
53   '';
55   nativeBuildInputs =
56     [
57       cmake
58       pkg-config
59       wrapGAppsHook3
60       gobject-introspection
61     ]
62     ++ lib.optionals withDoc [
63       sphinx
64       graphviz
65     ]
66     ++ lib.optionals withAravis [
67       meson
68     ]
69     ++ lib.optionals withGui [
70       qt5.wrapQtAppsHook
71     ];
73   buildInputs =
74     [
75       elfutils
76       libselinux
77       libsepol
78       libunwind
79       libusb1
80       libuuid
81       libzip
82       orc
83       pcre
84       zstd
85       glib
86       gst_all_1.gstreamer
87       gst_all_1.gst-plugins-base
88       gst_all_1.gst-plugins-good
89       gst_all_1.gst-plugins-bad
90       gst_all_1.gst-plugins-ugly
91     ]
92     ++ lib.optionals withAravis [
93       aravis
94     ]
95     ++ lib.optionals withGui [
96       qt5.qtbase
97     ];
99   hardeningDisable = [ "format" ];
101   cmakeFlags = [
102     "-DTCAM_BUILD_GST_1_0=ON"
103     "-DTCAM_BUILD_TOOLS=ON"
104     "-DTCAM_BUILD_V4L2=ON"
105     "-DTCAM_BUILD_LIBUSB=ON"
106     "-DTCAM_BUILD_TESTS=ON"
107     "-DTCAM_BUILD_ARAVIS=${if withAravis then "ON" else "OFF"}"
108     "-DTCAM_BUILD_DOCUMENTATION=${if withDoc then "ON" else "OFF"}"
109     "-DTCAM_BUILD_WITH_GUI=${if withGui then "ON" else "OFF"}"
110     "-DTCAM_DOWNLOAD_MESON=OFF"
111     "-DTCAM_INTERNAL_ARAVIS=OFF"
112     "-DTCAM_ARAVIS_USB_VISION=${if withAravis && withAravisUsbVision then "ON" else "OFF"}"
113     "-DTCAM_INSTALL_FORCE_PREFIX=ON"
114   ];
116   env.CXXFLAGS = "-include cstdint";
118   doCheck = true;
120   # gstreamer tests requires, besides gst-plugins-bad, plugins installed by this expression.
121   checkPhase = "ctest --force-new-ctest-process -E gstreamer";
123   # wrapGAppsHook3: make sure we add ourselves to the introspection
124   # and gstreamer paths.
125   GI_TYPELIB_PATH = "${placeholder "out"}/lib/girepository-1.0";
126   GST_PLUGIN_SYSTEM_PATH_1_0 = "${placeholder "out"}/lib/gstreamer-1.0";
128   QT_PLUGIN_PATH = lib.optionalString withGui "${qt5.qtbase.bin}/${qt5.qtbase.qtPluginPrefix}";
130   dontWrapQtApps = true;
132   preFixup = ''
133     gappsWrapperArgs+=("''${qtWrapperArgs[@]}")
134   '';
136   meta = with lib; {
137     description = "Linux sources and UVC firmwares for The Imaging Source cameras";
138     homepage = "https://github.com/TheImagingSource/tiscamera";
139     license = with licenses; [ asl20 ];
140     platforms = platforms.linux;
141     maintainers = with maintainers; [ jraygauthier ];
142   };