2021-08-12 14:41:47 +00:00
|
|
|
{ stdenv
|
|
|
|
, fetchgit
|
2023-11-16 04:20:00 +00:00
|
|
|
, fetchpatch
|
2021-08-12 14:41:47 +00:00
|
|
|
, 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
|
|
|
, lttng-ust
|
|
|
|
, gst_all_1
|
|
|
|
, gtest
|
|
|
|
, graphviz
|
|
|
|
, doxygen
|
|
|
|
, python3
|
|
|
|
, python3Packages
|
2022-01-13 20:06:32 +00:00
|
|
|
, systemd # for libudev
|
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";
|
2023-05-24 13:37:59 +00:00
|
|
|
version = "0.0.5";
|
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}";
|
2023-05-24 13:37:59 +00:00
|
|
|
hash = "sha256-rd1YIEosg4+H/FJBYCoxdQlV9F0evU5fckHJrSdVPOE=";
|
2021-08-12 14:41:47 +00:00
|
|
|
};
|
|
|
|
|
2023-02-16 17:41:37 +00:00
|
|
|
outputs = [ "out" "dev" "doc" ];
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
|
|
|
# https://git.libcamera.org/libcamera/libcamera.git/commit/?id=6cb92b523bd60bd7718df134cc5b1eff51cf42e5
|
|
|
|
name = "libcamera-sphinx7.0-compat.patch";
|
|
|
|
url = "https://git.libcamera.org/libcamera/libcamera.git/patch/?id=6cb92b523bd60bd7718df134cc5b1eff51cf42e5";
|
|
|
|
hash = "sha256-gs0EiT3gWlmRjDim+o2C0VmnoWqEouP5pNTD4XbNSdE=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2021-08-12 14:41:47 +00:00
|
|
|
postPatch = ''
|
|
|
|
patchShebangs utils/
|
|
|
|
'';
|
|
|
|
|
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
|
|
|
|
|
|
|
# lttng tracing
|
|
|
|
lttng-ust
|
2021-12-06 16:07:01 +00:00
|
|
|
|
2022-08-12 12:06:08 +00:00
|
|
|
# yamlparser
|
|
|
|
libyaml
|
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
gtest
|
2021-08-12 14:41:47 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
meson
|
|
|
|
ninja
|
|
|
|
pkg-config
|
|
|
|
python3
|
|
|
|
python3Packages.jinja2
|
|
|
|
python3Packages.pyyaml
|
|
|
|
python3Packages.ply
|
|
|
|
python3Packages.sphinx
|
|
|
|
graphviz
|
|
|
|
doxygen
|
2021-12-06 16:07:01 +00:00
|
|
|
openssl
|
2021-08-12 14:41:47 +00:00
|
|
|
];
|
|
|
|
|
2022-01-13 20:06:32 +00:00
|
|
|
mesonFlags = [
|
|
|
|
"-Dv4l2=true"
|
|
|
|
"-Dqcam=disabled"
|
|
|
|
"-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"
|
2022-01-13 20:06:32 +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
|
|
|
|
FONTCONFIG_FILE = makeFontsConf { fontDirectories = []; };
|
|
|
|
|
2022-11-21 17:40:18 +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-08-12 14:41:47 +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 ];
|
|
|
|
};
|
|
|
|
}
|