1{ stdenv
2, fetchgit
3, lib
4, meson
5, ninja
6, pkg-config
7, makeFontsConf
8, openssl
9, libdrm
10, libevent
11, libyaml
12, lttng-ust
13, gst_all_1
14, gtest
15, graphviz
16, doxygen
17, python3
18, python3Packages
19, systemd # for libudev
20}:
21
22stdenv.mkDerivation rec {
23 pname = "libcamera";
24 version = "0.0.5";
25
26 src = fetchgit {
27 url = "https://git.libcamera.org/libcamera/libcamera.git";
28 rev = "v${version}";
29 hash = "sha256-rd1YIEosg4+H/FJBYCoxdQlV9F0evU5fckHJrSdVPOE=";
30 };
31
32 outputs = [ "out" "dev" "doc" ];
33
34 postPatch = ''
35 patchShebangs utils/
36 '';
37
38 strictDeps = true;
39
40 buildInputs = [
41 # IPA and signing
42 openssl
43
44 # gstreamer integration
45 gst_all_1.gstreamer
46 gst_all_1.gst-plugins-base
47
48 # cam integration
49 libevent
50 libdrm
51
52 # hotplugging
53 systemd
54
55 # lttng tracing
56 lttng-ust
57
58 # yamlparser
59 libyaml
60
61 gtest
62 ];
63
64 nativeBuildInputs = [
65 meson
66 ninja
67 pkg-config
68 python3
69 python3Packages.jinja2
70 python3Packages.pyyaml
71 python3Packages.ply
72 python3Packages.sphinx
73 graphviz
74 doxygen
75 openssl
76 ];
77
78 mesonFlags = [
79 "-Dv4l2=true"
80 "-Dqcam=disabled"
81 "-Dlc-compliance=disabled" # tries unconditionally to download gtest when enabled
82 # Avoid blanket -Werror to evade build failures on less
83 # tested compilers.
84 "-Dwerror=false"
85 ];
86
87 # Fixes error on a deprecated declaration
88 env.NIX_CFLAGS_COMPILE = "-Wno-error=deprecated-declarations";
89
90 # Silence fontconfig warnings about missing config
91 FONTCONFIG_FILE = makeFontsConf { fontDirectories = []; };
92
93 # libcamera signs the IPA module libraries at install time, but they are then
94 # modified by stripping and RPATH fixup. Therefore, we need to generate the
95 # signatures again ourselves.
96 #
97 # If this is not done, libcamera will still try to load them, but it will
98 # isolate them in separate processes, which can cause crashes for IPA modules
99 # that are not designed for this (notably ipa_rpi.so).
100 postFixup = ''
101 ../src/ipa/ipa-sign-install.sh src/ipa-priv-key.pem $out/lib/libcamera/ipa_*.so
102 '';
103
104 meta = with lib; {
105 description = "An open source camera stack and framework for Linux, Android, and ChromeOS";
106 homepage = "https://libcamera.org";
107 license = licenses.lgpl2Plus;
108 maintainers = with maintainers; [ citadelcore ];
109 };
110}