nixpkgs/pkgs/by-name/li/libcamera/package.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

115 lines
2.5 KiB
Nix
Raw Normal View History

2021-07-04 21:40:21 +00:00
{ stdenv
, fetchgit
, lib
, fetchpatch
2021-07-04 21:40:21 +00:00
, meson
, ninja
, pkg-config
2022-01-05 23:32:44 +00:00
, makeFontsConf
2021-07-04 21:40:21 +00:00
, openssl
2022-01-05 23:32:44 +00:00
, libdrm
2021-07-04 21:40:21 +00:00
, libevent
, libyaml
2021-07-04 21:40:21 +00:00
, lttng-ust
, gst_all_1
, gtest
, graphviz
, doxygen
, python3
, python3Packages
2022-01-05 23:32:44 +00:00
, systemd # for libudev
, withQcam ? false
, qt5 # withQcam
, libtiff # withQcam
2021-07-04 21:40:21 +00:00
}:
stdenv.mkDerivation rec {
2021-07-04 21:40:21 +00:00
pname = "libcamera";
2024-01-18 11:16:52 +00:00
version = "0.2.0";
2021-07-04 21:40:21 +00:00
src = fetchgit {
url = "https://git.libcamera.org/libcamera/libcamera.git";
rev = "v${version}";
2024-01-18 11:16:52 +00:00
hash = "sha256-x0Im9m9MoACJhQKorMI34YQ+/bd62NdAPc2nWwaJAvM=";
2021-07-04 21:40:21 +00:00
};
outputs = [ "out" "dev" "doc" ];
2021-07-04 21:40:21 +00:00
postPatch = ''
patchShebangs utils/
'';
2021-11-29 08:17:05 +00:00
strictDeps = true;
2021-07-04 21:40:21 +00:00
buildInputs = [
# IPA and signing
openssl
2021-07-04 21:40:21 +00:00
# gstreamer integration
gst_all_1.gstreamer
gst_all_1.gst-plugins-base
# cam integration
libevent
2022-01-05 23:32:44 +00:00
libdrm
# hotplugging
systemd
2021-07-04 21:40:21 +00:00
# lttng tracing
lttng-ust
2021-11-29 08:17:05 +00:00
# yamlparser
libyaml
2021-11-29 08:17:05 +00:00
gtest
] ++ lib.optionals withQcam [ libtiff qt5.qtbase qt5.qttools ];
2021-07-04 21:40:21 +00:00
nativeBuildInputs = [
meson
ninja
pkg-config
python3
python3Packages.jinja2
python3Packages.pyyaml
python3Packages.ply
python3Packages.sphinx
graphviz
doxygen
2021-11-29 08:17:05 +00:00
openssl
] ++ lib.optional withQcam qt5.wrapQtAppsHook;
2021-07-04 21:40:21 +00:00
2022-01-05 23:32:44 +00:00
mesonFlags = [
"-Dv4l2=true"
"-Dqcam=${if withQcam then "enabled" else "disabled"}"
2022-01-05 23:32:44 +00:00
"-Dlc-compliance=disabled" # tries unconditionally to download gtest when enabled
# Avoid blanket -Werror to evade build failures on less
# tested compilers.
"-Dwerror=false"
];
2021-07-04 21:40:21 +00:00
# Fixes error on a deprecated declaration
env.NIX_CFLAGS_COMPILE = "-Wno-error=deprecated-declarations";
2021-07-04 21:40:21 +00:00
2022-01-05 23:32:44 +00:00
# Silence fontconfig warnings about missing config
FONTCONFIG_FILE = makeFontsConf { fontDirectories = [ ]; };
2022-01-05 23:32:44 +00:00
# libcamera signs the IPA module libraries at install time, but they are then
# modified by stripping and RPATH fixup. Therefore, we need to generate the
# signatures again ourselves.
#
# If this is not done, libcamera will still try to load them, but it will
# isolate them in separate processes, which can cause crashes for IPA modules
# that are not designed for this (notably ipa_rpi.so).
postFixup = ''
../src/ipa/ipa-sign-install.sh src/ipa-priv-key.pem $out/lib/libcamera/ipa_*.so
'';
2021-07-04 21:40:21 +00:00
meta = with lib; {
description = "An open source camera stack and framework for Linux, Android, and ChromeOS";
homepage = "https://libcamera.org";
license = licenses.lgpl2Plus;
maintainers = with maintainers; [ citadelcore ];
};
}