2021-07-04 21:40:21 +00:00
|
|
|
{ stdenv
|
|
|
|
, fetchgit
|
|
|
|
, lib
|
2024-01-30 08:53:07 +00:00
|
|
|
, 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
|
2022-07-16 13:12:19 +00:00
|
|
|
, 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
|
2024-01-30 08:53:07 +00:00
|
|
|
, withQcam ? false
|
|
|
|
, qt5 # withQcam
|
|
|
|
, libtiff # withQcam
|
2021-07-04 21:40:21 +00:00
|
|
|
}:
|
|
|
|
|
2022-10-20 00:27:06 +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 {
|
2021-09-25 15:02:10 +00:00
|
|
|
url = "https://git.libcamera.org/libcamera/libcamera.git";
|
2022-10-20 00:27:06 +00:00
|
|
|
rev = "v${version}";
|
2024-01-18 11:16:52 +00:00
|
|
|
hash = "sha256-x0Im9m9MoACJhQKorMI34YQ+/bd62NdAPc2nWwaJAvM=";
|
2021-07-04 21:40:21 +00:00
|
|
|
};
|
|
|
|
|
2023-01-22 13:47:59 +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
|
2022-09-03 12:15:42 +00:00
|
|
|
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
|
|
|
|
2022-07-16 13:12:19 +00:00
|
|
|
# yamlparser
|
|
|
|
libyaml
|
|
|
|
|
2021-11-29 08:17:05 +00:00
|
|
|
gtest
|
2024-01-30 08:53:07 +00:00
|
|
|
] ++ 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
|
2024-01-30 08:53:07 +00:00
|
|
|
] ++ lib.optional withQcam qt5.wrapQtAppsHook;
|
2021-07-04 21:40:21 +00:00
|
|
|
|
2022-01-05 23:32:44 +00:00
|
|
|
mesonFlags = [
|
|
|
|
"-Dv4l2=true"
|
2024-01-30 08:53:07 +00:00
|
|
|
"-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
|
2022-11-02 07:26:49 +00:00
|
|
|
# Avoid blanket -Werror to evade build failures on less
|
|
|
|
# tested compilers.
|
|
|
|
"-Dwerror=false"
|
2024-01-30 08:53:07 +00:00
|
|
|
];
|
2021-07-04 21:40:21 +00:00
|
|
|
|
|
|
|
# Fixes error on a deprecated declaration
|
2023-02-19 19:23:32 +00:00
|
|
|
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
|
2024-01-30 08:53:07 +00:00
|
|
|
FONTCONFIG_FILE = makeFontsConf { fontDirectories = [ ]; };
|
2022-01-05 23:32:44 +00:00
|
|
|
|
2022-09-15 21:46:49 +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 ];
|
|
|
|
};
|
|
|
|
}
|