From d6ee968663f3c206f1edf45a4ab5b76bc2f518ee Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Tue, 30 Jan 2024 11:06:25 +0200 Subject: libcamera: move to pkgs/by-name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The CI check complains about a new attribute introduced that's not using the by-name pattern, even though it's using the same .nix file. It seems using callPackage ../by-name/… from toplevel for the alternative toplevel attribute seems to be others do this, so using the same pattern here. --- pkgs/by-name/li/libcamera/package.nix | 114 +++++++++++++++++++++++ pkgs/development/libraries/libcamera/default.nix | 114 ----------------------- pkgs/top-level/all-packages.nix | 4 +- 3 files changed, 115 insertions(+), 117 deletions(-) create mode 100644 pkgs/by-name/li/libcamera/package.nix delete mode 100644 pkgs/development/libraries/libcamera/default.nix diff --git a/pkgs/by-name/li/libcamera/package.nix b/pkgs/by-name/li/libcamera/package.nix new file mode 100644 index 0000000000000..a6a0fe8fa7c35 --- /dev/null +++ b/pkgs/by-name/li/libcamera/package.nix @@ -0,0 +1,114 @@ +{ stdenv +, fetchgit +, lib +, fetchpatch +, meson +, ninja +, pkg-config +, makeFontsConf +, openssl +, libdrm +, libevent +, libyaml +, lttng-ust +, gst_all_1 +, gtest +, graphviz +, doxygen +, python3 +, python3Packages +, systemd # for libudev +, withQcam ? false +, qt5 # withQcam +, libtiff # withQcam +}: + +stdenv.mkDerivation rec { + pname = "libcamera"; + version = "0.2.0"; + + src = fetchgit { + url = "https://git.libcamera.org/libcamera/libcamera.git"; + rev = "v${version}"; + hash = "sha256-x0Im9m9MoACJhQKorMI34YQ+/bd62NdAPc2nWwaJAvM="; + }; + + outputs = [ "out" "dev" "doc" ]; + + postPatch = '' + patchShebangs utils/ + ''; + + strictDeps = true; + + buildInputs = [ + # IPA and signing + openssl + + # gstreamer integration + gst_all_1.gstreamer + gst_all_1.gst-plugins-base + + # cam integration + libevent + libdrm + + # hotplugging + systemd + + # lttng tracing + lttng-ust + + # yamlparser + libyaml + + gtest + ] ++ lib.optionals withQcam [ libtiff qt5.qtbase qt5.qttools ]; + + nativeBuildInputs = [ + meson + ninja + pkg-config + python3 + python3Packages.jinja2 + python3Packages.pyyaml + python3Packages.ply + python3Packages.sphinx + graphviz + doxygen + openssl + ] ++ lib.optional withQcam qt5.wrapQtAppsHook; + + mesonFlags = [ + "-Dv4l2=true" + "-Dqcam=${if withQcam then "enabled" else "disabled"}" + "-Dlc-compliance=disabled" # tries unconditionally to download gtest when enabled + # Avoid blanket -Werror to evade build failures on less + # tested compilers. + "-Dwerror=false" + ]; + + # Fixes error on a deprecated declaration + env.NIX_CFLAGS_COMPILE = "-Wno-error=deprecated-declarations"; + + # Silence fontconfig warnings about missing config + FONTCONFIG_FILE = makeFontsConf { fontDirectories = [ ]; }; + + # 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 + ''; + + 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 ]; + }; +} diff --git a/pkgs/development/libraries/libcamera/default.nix b/pkgs/development/libraries/libcamera/default.nix deleted file mode 100644 index a6a0fe8fa7c35..0000000000000 --- a/pkgs/development/libraries/libcamera/default.nix +++ /dev/null @@ -1,114 +0,0 @@ -{ stdenv -, fetchgit -, lib -, fetchpatch -, meson -, ninja -, pkg-config -, makeFontsConf -, openssl -, libdrm -, libevent -, libyaml -, lttng-ust -, gst_all_1 -, gtest -, graphviz -, doxygen -, python3 -, python3Packages -, systemd # for libudev -, withQcam ? false -, qt5 # withQcam -, libtiff # withQcam -}: - -stdenv.mkDerivation rec { - pname = "libcamera"; - version = "0.2.0"; - - src = fetchgit { - url = "https://git.libcamera.org/libcamera/libcamera.git"; - rev = "v${version}"; - hash = "sha256-x0Im9m9MoACJhQKorMI34YQ+/bd62NdAPc2nWwaJAvM="; - }; - - outputs = [ "out" "dev" "doc" ]; - - postPatch = '' - patchShebangs utils/ - ''; - - strictDeps = true; - - buildInputs = [ - # IPA and signing - openssl - - # gstreamer integration - gst_all_1.gstreamer - gst_all_1.gst-plugins-base - - # cam integration - libevent - libdrm - - # hotplugging - systemd - - # lttng tracing - lttng-ust - - # yamlparser - libyaml - - gtest - ] ++ lib.optionals withQcam [ libtiff qt5.qtbase qt5.qttools ]; - - nativeBuildInputs = [ - meson - ninja - pkg-config - python3 - python3Packages.jinja2 - python3Packages.pyyaml - python3Packages.ply - python3Packages.sphinx - graphviz - doxygen - openssl - ] ++ lib.optional withQcam qt5.wrapQtAppsHook; - - mesonFlags = [ - "-Dv4l2=true" - "-Dqcam=${if withQcam then "enabled" else "disabled"}" - "-Dlc-compliance=disabled" # tries unconditionally to download gtest when enabled - # Avoid blanket -Werror to evade build failures on less - # tested compilers. - "-Dwerror=false" - ]; - - # Fixes error on a deprecated declaration - env.NIX_CFLAGS_COMPILE = "-Wno-error=deprecated-declarations"; - - # Silence fontconfig warnings about missing config - FONTCONFIG_FILE = makeFontsConf { fontDirectories = [ ]; }; - - # 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 - ''; - - 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 ]; - }; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index dd9c57c583160..ddcbd4bcd94d3 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -22463,9 +22463,7 @@ with pkgs; libcacard = callPackage ../development/libraries/libcacard { }; - libcamera = callPackage ../development/libraries/libcamera { }; - - libcamera-qcam = callPackage ../development/libraries/libcamera { withQcam = true; }; + libcamera-qcam = callPackage ../by-name/li/libcamera/package.nix { withQcam = true; }; libcanberra = callPackage ../development/libraries/libcanberra { inherit (darwin.apple_sdk.frameworks) Carbon CoreServices AppKit; -- cgit 1.4.1