diff --git a/pkgs/by-name/li/libcamera/package.nix b/pkgs/by-name/li/libcamera/package.nix index 403a2f70c0bf..ccc88e65e3c5 100644 --- a/pkgs/by-name/li/libcamera/package.nix +++ b/pkgs/by-name/li/libcamera/package.nix @@ -1,6 +1,8 @@ { stdenv, - fetchgit, + fetchFromGitLab, + testers, + nix-update-script, lib, meson, ninja, @@ -13,13 +15,14 @@ libyuv, gst_all_1, gtest, - graphviz, - doxygen, python3, python3Packages, udev, libpisp, libglvnd, + enableDocumentation ? false, + graphviz, + doxygen, withTracing ? lib.meta.availableOn stdenv.hostPlatform lttng-ust, lttng-ust, # withTracing withSoftispGPU ? true, # software ISP GPU acceleration @@ -31,13 +34,15 @@ SDL2, }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "libcamera"; version = "0.7.2"; - src = fetchgit { - url = "https://git.libcamera.org/libcamera/libcamera.git"; - rev = "v${version}"; + src = fetchFromGitLab { + domain = "gitlab.freedesktop.org"; + owner = "camera"; + repo = "libcamera"; + tag = "v${finalAttrs.version}"; hash = "sha256-vhFkeT1j2KKm+CVvGrtH5BEYJSEdaX7N7DRdA0a9EWk="; }; @@ -112,36 +117,43 @@ stdenv.mkDerivation rec { python3Packages.jinja2 python3Packages.pyyaml python3Packages.ply + openssl + ] + ++ lib.optionals enableDocumentation [ python3Packages.sphinx graphviz doxygen - openssl ] ++ lib.optional withQcam qt6.wrapQtAppsHook; - mesonFlags = [ - (lib.mesonEnable "v4l2" true) - (lib.mesonEnable "tracing" withTracing) - (lib.mesonEnable "qcam" withQcam) - (lib.mesonEnable "apps-output-dng" withQcam) - (lib.mesonEnable "cam-output-sdl2" withQcam) - (lib.mesonEnable "cam-jpeg" withQcam) - (lib.mesonEnable "softisp-gpu" withSoftispGPU) - (lib.mesonEnable "libunwind" false) - (lib.mesonEnable "libdw" false) - (lib.mesonEnable "lc-compliance" false) # tries unconditionally to download gtest when enabled - # Avoid blanket -Werror to evade build failures on less - # tested compilers. - (lib.mesonBool "werror" false) - # Documentation breaks binary compatibility. - # Given that upstream also provides public documentation, - # we can disable it here. - (lib.mesonEnable "documentation" false) - ] - ++ lib.optionals stdenv.hostPlatform.isAarch [ - # we don't have tensorflow-lite to build this - (lib.mesonEnable "rpi-awb-nn" false) - ]; + mesonFlags = + lib.mapAttrsToList lib.mesonEnable { + v4l2 = true; + tracing = true; + pycamera = true; + qcam = withQcam; + apps-output-dng = withQcam; + cam-output-sdl2 = withQcam; + cam-jpeg = withQcam; + softisp-gpu = withSoftispGPU; + libunwind = false; + libdw = false; + lc-compliance = true; + + # Documentation breaks binary compatibility. + # Given that upstream also provides public documentation, + # we can disable it here. + documentation = enableDocumentation; + + rpi-awb-nn = false; + } + ++ [ + (lib.mesonBool "test" finalAttrs.finalPackage.doCheck) + + # Avoid blanket -Werror to evade build failures on less + # tested compilers. + (lib.mesonBool "werror" false) + ]; env = { # Fixes error on a deprecated declaration @@ -151,16 +163,30 @@ stdenv.mkDerivation rec { FONTCONFIG_FILE = makeFontsConf { fontDirectories = [ ]; }; }; + passthru = { + updateScript = nix-update-script { }; + + tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; + }; + meta = { description = "Open source camera stack and framework for Linux, Android, and ChromeOS"; homepage = "https://libcamera.org"; - changelog = "https://git.libcamera.org/libcamera/libcamera.git/tag/?h=${src.rev}"; + downloadPage = "https://gitlab.freedesktop.org/camera/libcamera"; + changelog = "https://gitlab.freedesktop.org/camera/libcamera/-/releases/${finalAttrs.src.tag}"; license = lib.licenses.lgpl2Plus; - maintainers = with lib.maintainers; [ citadelcore ]; + pkgConfigModules = [ + "libcamera" + "libcamera-base" + ]; + maintainers = with lib.maintainers; [ + citadelcore + tmarkus + ]; platforms = lib.platforms.linux; badPlatforms = [ # Mandatory shared libraries. lib.systems.inspect.platformPatterns.isStatic ]; }; -} +})