2021-08-12 14:41:47 +00:00
|
|
|
{ stdenv
|
|
|
|
, fetchgit
|
|
|
|
, lib
|
|
|
|
, meson
|
|
|
|
, ninja
|
|
|
|
, pkg-config
|
2022-01-13 20:06:32 +00:00
|
|
|
, makeFontsConf
|
2021-08-12 14:41:47 +00:00
|
|
|
, openssl
|
2022-01-13 20:06:32 +00:00
|
|
|
, libdrm
|
2021-08-12 14:41:47 +00:00
|
|
|
, libevent
|
2022-08-12 12:06:08 +00:00
|
|
|
, libyaml
|
2021-08-12 14:41:47 +00:00
|
|
|
, gst_all_1
|
|
|
|
, gtest
|
|
|
|
, graphviz
|
|
|
|
, doxygen
|
|
|
|
, python3
|
|
|
|
, python3Packages
|
2022-01-13 20:06:32 +00:00
|
|
|
, systemd # for libudev
|
2024-06-20 14:57:18 +00:00
|
|
|
, withTracing ? lib.meta.availableOn stdenv.hostPlatform lttng-ust
|
|
|
|
, lttng-ust # withTracing
|
2024-02-29 20:09:43 +00:00
|
|
|
, withQcam ? false
|
|
|
|
, qt5 # withQcam
|
|
|
|
, libtiff # withQcam
|
2021-08-12 14:41:47 +00:00
|
|
|
}:
|
|
|
|
|
2022-11-21 17:40:18 +00:00
|
|
|
stdenv.mkDerivation rec {
|
2021-08-12 14:41:47 +00:00
|
|
|
pname = "libcamera";
|
2024-07-27 06:49:29 +00:00
|
|
|
version = "0.3.0";
|
2021-08-12 14:41:47 +00:00
|
|
|
|
|
|
|
src = fetchgit {
|
2021-10-04 12:37:57 +00:00
|
|
|
url = "https://git.libcamera.org/libcamera/libcamera.git";
|
2022-11-21 17:40:18 +00:00
|
|
|
rev = "v${version}";
|
2024-07-27 06:49:29 +00:00
|
|
|
hash = "sha256-eCtOtdjpwn0S56ZyRVdG1QCBk1KGPh8YTXD50xev7Bc=";
|
2021-08-12 14:41:47 +00:00
|
|
|
};
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
outputs = [ "out" "dev" ];
|
2023-02-16 17:41:37 +00:00
|
|
|
|
2021-08-12 14:41:47 +00:00
|
|
|
postPatch = ''
|
2024-07-27 06:49:29 +00:00
|
|
|
patchShebangs src/py/ utils/
|
2021-08-12 14:41:47 +00:00
|
|
|
'';
|
|
|
|
|
2024-06-05 15:53:02 +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. For reproducibility, we use a static private key.
|
|
|
|
#
|
|
|
|
# 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).
|
|
|
|
preBuild = ''
|
|
|
|
ninja src/ipa-priv-key.pem
|
|
|
|
install -D ${./ipa-priv-key.pem} src/ipa-priv-key.pem
|
|
|
|
'';
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
strictDeps = true;
|
|
|
|
|
2021-08-12 14:41:47 +00:00
|
|
|
buildInputs = [
|
|
|
|
# IPA and signing
|
2022-09-30 11:47:45 +00:00
|
|
|
openssl
|
2021-08-12 14:41:47 +00:00
|
|
|
|
|
|
|
# gstreamer integration
|
|
|
|
gst_all_1.gstreamer
|
|
|
|
gst_all_1.gst-plugins-base
|
|
|
|
|
|
|
|
# cam integration
|
|
|
|
libevent
|
2022-01-13 20:06:32 +00:00
|
|
|
libdrm
|
|
|
|
|
|
|
|
# hotplugging
|
|
|
|
systemd
|
2021-08-12 14:41:47 +00:00
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
# yamlparser
|
|
|
|
libyaml
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
gtest
|
2024-06-20 14:57:18 +00:00
|
|
|
] ++ lib.optionals withTracing [ lttng-ust ]
|
|
|
|
++ lib.optionals withQcam [ libtiff qt5.qtbase qt5.qttools ];
|
2021-08-12 14:41:47 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
meson
|
|
|
|
ninja
|
|
|
|
pkg-config
|
|
|
|
python3
|
|
|
|
python3Packages.jinja2
|
2024-07-27 06:49:29 +00:00
|
|
|
python3Packages.pybind11
|
2021-08-12 14:41:47 +00:00
|
|
|
python3Packages.pyyaml
|
|
|
|
python3Packages.ply
|
|
|
|
python3Packages.sphinx
|
|
|
|
graphviz
|
|
|
|
doxygen
|
2021-12-06 16:07:01 +00:00
|
|
|
openssl
|
2024-02-29 20:09:43 +00:00
|
|
|
] ++ lib.optional withQcam qt5.wrapQtAppsHook;
|
2021-08-12 14:41:47 +00:00
|
|
|
|
2022-01-13 20:06:32 +00:00
|
|
|
mesonFlags = [
|
|
|
|
"-Dv4l2=true"
|
2024-06-20 14:57:18 +00:00
|
|
|
(lib.mesonEnable "tracing" withTracing)
|
|
|
|
(lib.mesonEnable "qcam" withQcam)
|
2022-01-13 20:06:32 +00:00
|
|
|
"-Dlc-compliance=disabled" # tries unconditionally to download gtest when enabled
|
2022-11-21 17:40:18 +00:00
|
|
|
# Avoid blanket -Werror to evade build failures on less
|
|
|
|
# tested compilers.
|
|
|
|
"-Dwerror=false"
|
2024-06-05 15:53:02 +00:00
|
|
|
# Documentation breaks binary compatibility.
|
|
|
|
# Given that upstream also provides public documentation,
|
|
|
|
# we can disable it here.
|
|
|
|
"-Ddocumentation=disabled"
|
2024-02-29 20:09:43 +00:00
|
|
|
];
|
2021-08-12 14:41:47 +00:00
|
|
|
|
|
|
|
# Fixes error on a deprecated declaration
|
2023-03-04 12:14:45 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = "-Wno-error=deprecated-declarations";
|
2021-08-12 14:41:47 +00:00
|
|
|
|
2022-01-13 20:06:32 +00:00
|
|
|
# Silence fontconfig warnings about missing config
|
2024-02-29 20:09:43 +00:00
|
|
|
FONTCONFIG_FILE = makeFontsConf { fontDirectories = [ ]; };
|
2022-01-13 20:06:32 +00:00
|
|
|
|
2021-08-12 14:41:47 +00:00
|
|
|
meta = with lib; {
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "Open source camera stack and framework for Linux, Android, and ChromeOS";
|
2021-08-12 14:41:47 +00:00
|
|
|
homepage = "https://libcamera.org";
|
2024-07-27 06:49:29 +00:00
|
|
|
changelog = "https://git.libcamera.org/libcamera/libcamera.git/tag/?h=${src.rev}";
|
2021-08-12 14:41:47 +00:00
|
|
|
license = licenses.lgpl2Plus;
|
|
|
|
maintainers = with maintainers; [ citadelcore ];
|
2024-06-05 15:53:02 +00:00
|
|
|
badPlatforms = [
|
|
|
|
# Mandatory shared libraries.
|
|
|
|
lib.systems.inspect.platformPatterns.isStatic
|
|
|
|
];
|
2021-08-12 14:41:47 +00:00
|
|
|
};
|
|
|
|
}
|