diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..219c462 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/libcamera-*.tar.xz diff --git a/libcamera.spec b/libcamera.spec new file mode 100644 index 0000000..5e858ba --- /dev/null +++ b/libcamera.spec @@ -0,0 +1,196 @@ +%global commit 39c2d5dc95e46b8c1659b721521e4e438ab7d8a3 +%global shortcommit %(c=%{commit}; echo ${c:0:7}) +%global commitdate 20210908 +%global soname_major 0 +%global soname_minor 1 + +Name: libcamera +Version: 0.0.0~git.%{commitdate}.%{shortcommit} +Release: 1%{?dist} +Summary: A library to support complex camera ISPs +# Library is LGPLv2.1+ and the cam tool is GPLv2 +License: LGPLv2+ and GPLv2 +URL: http://libcamera.org/ + +# Upstream is still under development so they are not tagging releases +# yet (https://git.linuxtv.org/libcamera.git). Use the following to do +# a rebase to a new snapshot: +# +# git archive --format=tar --prefix=%%{name}-%%{shortcommit}/ %%{shortcommit} | xz > %%{name}-%%{shortcommit}.tar.xz +Source0: %{name}-%{shortcommit}.tar.xz +Source1: qcam.desktop +Source2: qcam.metainfo.xml + +# Upstream does not have a versioned SONAME yet so a downstream +# .so name versioning is required as mentioned in Fedora docs: +# +# https://docs.fedoraproject.org/en-US/packaging-guidelines/#_downstream_so_name_versioning +Patch0001: meson-Set-a-downstream-.so-name-version.patch + +BuildRequires: doxygen +BuildRequires: gcc-c++ +BuildRequires: gtest-devel +BuildRequires: desktop-file-utils +BuildRequires: meson +BuildRequires: openssl +BuildRequires: ninja-build +BuildRequires: python3-jinja2 +BuildRequires: python3-ply +BuildRequires: python3-pyyaml +BuildRequires: python3-sphinx +BuildRequires: boost-devel +BuildRequires: pkgconfig(glib-2.0) +BuildRequires: gnutls-devel +BuildRequires: libatomic +BuildRequires: libevent-devel +BuildRequires: libtiff-devel +BuildRequires: lttng-ust-devel +BuildRequires: systemd-devel +BuildRequires: pkgconfig(Qt5Core) +BuildRequires: pkgconfig(Qt5Gui) +BuildRequires: pkgconfig(Qt5Widgets) +BuildRequires: pkgconfig(gstreamer-video-1.0) +BuildRequires: pkgconfig(gstreamer-allocators-1.0) + +%description +libcamera is a library that deals with heavy hardware image processing +operations of complex camera devices that are shared between the linux +host all while allowing offload of certain aspects to the control of +complex camera hardware such as ISPs. + +Hardware support includes USB UVC cameras, libv4l cameras as well as more +complex ISPs (Image Signal Processor). + +%package devel +Summary: Development package for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description devel +Files for development with %{name}. + +%package doc +Summary: Documentation for %{name} +BuildArch: noarch + +%description doc +HTML based documentation for %{name} including getting started and API. + +%package ipa +Summary: ISP Image Processing Algorithm Plugins for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description ipa +Image Processing Algorithms plugins for interfacing with device +ISPs for %{name} + +%package tools +Summary: Tools for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description tools +Command line tools for %{name} + +%package qcam +Summary: Graphical QCam application for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description qcam +Graphical QCam application for %{name} + +%package gstreamer +Summary: GSTreamer plugin for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} + +%description gstreamer +GSTreamer plugins for %{name} + +%prep +%autosetup -p1 -n %{name}-%{shortcommit} + +%build +# cam/qcam crash with LTO +%global _lto_cflags %{nil} +export CFLAGS="%{optflags} -Wno-deprecated-declarations" +export CXXFLAGS="%{optflags} -Wno-deprecated-declarations" + +%ifarch ppc64le +# 64-bit POWER LE does not use the IEEE long double ABI but +# instead a custom one by default. This leads to libcamera +# failing to build, use IEEE long double ABI to prevent it. +# +# https://bugzilla.redhat.com/show_bug.cgi?id=1538817 +export CFLAGS="${CFLAGS} -mabi=ieeelongdouble" +export CXXFLAGS="${CXXFLAGS} -mabi=ieeelongdouble" +%endif + +%meson +%meson_build + +%install +%meson_install + +# Install Desktop Entry file +desktop-file-install --dir=%{buildroot}%{_datadir}/applications \ + %SOURCE1 + +# Install AppStream metainfo file +mkdir -p %{buildroot}/%{_metainfodir}/ +cp -a %SOURCE2 %{buildroot}/%{_metainfodir}/ + +# Remove the Sphinx build leftovers +rm -rf ${RPM_BUILD_ROOT}/%{_docdir}/%{name}-*/html/.buildinfo +rm -rf ${RPM_BUILD_ROOT}/%{_docdir}/%{name}-*/html/.doctrees + +%files +%license COPYING.rst LICENSES/LGPL-2.1-or-later.txt +%{_libdir}/libcamera*.so.%{soname_major}.%{soname_minor} + +%files devel +%{_includedir}/%{name}/ +%{_libdir}/libcamera*.so +%{_libdir}/pkgconfig/libcamera-base.pc +%{_libdir}/pkgconfig/libcamera.pc + +%files doc +%doc %{_docdir}/%{name}-*/ + +%files ipa +%{_datadir}/libcamera/ +%{_libdir}/libcamera/ +%{_libexecdir}/libcamera/ + +%files gstreamer +%{_libdir}/gstreamer-1.0/libgstlibcamera.so + +%files qcam +%{_bindir}/qcam +%{_datadir}/applications/qcam.desktop +%{_metainfodir}/qcam.metainfo.xml + +%files tools +%license LICENSES/GPL-2.0-only.txt +%{_bindir}/cam +%{_bindir}/lc-compliance + +%changelog +* Wed Sep 08 2021 Javier Martinez Canillas - 0.0.0~git.20210908.39c2d5d-1 +- Update to snapshot 39c2d5d +- Add snapshot date information to follow the Fedora packaging guidelines +- Use correct license short names to follow the Fedora licensing guidelines +- Remove %%ldconfig_scriptlets that are not needed +- Add a downstream SONAME versioning +- Use %%global instead of %%define +- Fix ppc64le build error caused by not using the IEEE long double ABI +- Remove the Sphinx build leftovers +- Add only the needed license files instead of the whole LICENSE dir +- Ship only the .so.0.n and the .so in the devel sub-package +- Add Desktop and AppStream metainfo files +- Rename docs sub-package to libcamera-doc to silence a package review warning + +* Mon Apr 05 2021 Peter Robinson 0.0.0-0.1.76a5861 +- Update to snapshot 76a5861 +- Enable gstreamer plugin and QCam tool +- More granular packaging + +* Sat Jul 27 2019 Peter Robinson 0.0.0-0.1.36d6229 +- Initial package diff --git a/meson-Set-a-downstream-.so-name-version.patch b/meson-Set-a-downstream-.so-name-version.patch new file mode 100644 index 0000000..4392e15 --- /dev/null +++ b/meson-Set-a-downstream-.so-name-version.patch @@ -0,0 +1,41 @@ +From 022135aec2de6b2978955a0213e7dad2ce0e5fd0 Mon Sep 17 00:00:00 2001 +From: Javier Martinez Canillas +Date: Fri, 10 Sep 2021 12:08:21 +0200 +Subject: [PATCH] meson: Set a downstream .so name version + +The Fedora packaging guidelines says that if upstream doesn't have a +version .so library, a downstream versioning has to be added. + +Signed-off-by: Javier Martinez Canillas +--- + src/libcamera/base/meson.build | 1 + + src/libcamera/meson.build | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/src/libcamera/base/meson.build b/src/libcamera/base/meson.build +index d799c66d8b3..cae6a6e8709 100644 +--- a/src/libcamera/base/meson.build ++++ b/src/libcamera/base/meson.build +@@ -28,6 +28,7 @@ libcamera_base_args = [ '-DLIBCAMERA_BASE_PRIVATE' ] + + libcamera_base_lib = shared_library('libcamera-base', + [libcamera_base_sources, libcamera_base_headers], ++ soversion : '0.1', + name_prefix : '', + install : true, + cpp_args : libcamera_base_args, +diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build +index e9230b983ae..69f19e004ab 100644 +--- a/src/libcamera/meson.build ++++ b/src/libcamera/meson.build +@@ -127,6 +127,7 @@ libcamera_deps = [ + + libcamera = shared_library('libcamera', + libcamera_sources, ++ soversion : '0.1', + name_prefix : '', + install : true, + include_directories : includes, +-- +2.31.1 + diff --git a/qcam.desktop b/qcam.desktop new file mode 100644 index 0000000..0249527 --- /dev/null +++ b/qcam.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Name=QCam +GenericName=Camera Demo App +Comment=Take photos with cameras exposed by libcamera +Exec=qcam +Type=Application +Terminal=false +StartupNotify=true diff --git a/qcam.metainfo.xml b/qcam.metainfo.xml new file mode 100644 index 0000000..833c478 --- /dev/null +++ b/qcam.metainfo.xml @@ -0,0 +1,25 @@ + + + + qcam.desktop + CC0-1.0 + GPLv-2.0 + QCam + Take photos with cameras exposed by libcamera + +

+ The QCam UI is a demo application that allows to take photos + for any camera that is exposed by the libcamera framework. +

+
+ + + https://libcamera.org/_images/libcamera_hero.png + + + https://libcamera.org/ + https://bugs.libcamera.org/ + https://libcamera.org/docs.html/ + javier@dowhile0.org + +
diff --git a/sources b/sources new file mode 100644 index 0000000..755fd53 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (libcamera-39c2d5d.tar.xz) = 012fceb16e0bb00508c314f52e95689c2bd216f935d6164365956b8d8465bbd2f7db8628b1a563a5f70c4fddf93de7695f63a5e383ba2afb96a8d834a8681ea1