File libcamera.spec of Package libcamera
%define realname libcamera
%define srcext tar.bz2
%define so_ver 0
# turn off the generation of debuginfo rpm (RH9) ??
%global debug_package %{nil}
# Common info
Name: %{realname}%{?so_ver}
Version: 0
Release: wiz%{?extraver:0.}1%{?dist}
License: LGPL-2.1+
Group: System/Libraries
URL: https://libcamera.org/
Summary: An open source camera stack
# Install-time parameters
Provides: libcamera-base%{?so_ver} = %{version}-%{release}
Provides: libcamera = %{version}-%{release}
Obsoletes: libcamera < %{version}-%{release}
# Build-time parameters
BuildRequires: gcc-c++
BuildRequires: pkg-config
BuildRequires: meson >= 0.55
BuildRequires: ninja
BuildRequires: openssl
BuildRequires: boost-devel
BuildRequires: pkgconfig(yaml-0.1)
BuildRequires: pkgconfig(libjpeg)
# for the libcamera core: [required]
BuildRequires: python3-PyYAML python3-ply
# for cam: [optional]
BuildRequires: pkgconfig(libevent_pthreads)
BuildRequires: pkgconfig(libdrm)
# for qcam: [optional]
#BuildRequires: pkgconfig(Qt5Core) pkgconfig(Qt5Gui) pkgconfig(Qt5Widgets)
# for gstreamer: [optional]
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(gstreamer-video-1.0) >= 1.14.0
BuildRequires: pkgconfig(gstreamer-allocators-1.0) >= 1.14.0
# for device hotplug enumeration: [optional]
BuildRequires: pkgconfig(libudev)
# Docs
### BuildRequires: python3-Sphinx
%if 0%{?suse_version}
BuildRequires: python3-Jinja2
%else
BuildRequires: python3-jinja2
%endif
BuildRoot: %{_tmppath}/%{name}-root
Source: %{realname}-%{version}%{?extraver}.%{srcext}
%description
Cameras are complex devices that need heavy hardware image processing operations.
Control of the processing is based on advanced algorithms that must run on a
programmable processor. This has traditionally been implemented in a dedicated
MCU in the camera, but in embedded devices algorithms have been moved to the main
CPU to save cost. Blurring the boundary between camera devices and Linux often
left the user with no other option than a vendor-specific closed-source solution.
To address this problem the Linux media community is collaborating with the
industry to develop a camera stack that is open-source-friendly while still
protecting vendor core IP. libcamera was born out of that collaboration and
offers modern camera support to Linux-based systems, including traditional Linux
distributions, ChromeOS and Android.
%package -n %{realname}-devel
Group: Development/Languages/C and C++
Summary: Development files for %{name}
Requires: %{name} = %{version}-%{release}
Provides: %{name}-devel = %{version}-%{release}
%description -n %{realname}-devel
Development files for %{name}
%package -n gstreamer-plugin-%{realname}
Group: System/Libraries
Summary: Gstreamer Plugin for %{realname}
%description -n gstreamer-plugin-%{realname}
Gstreamer Plugin for %{realname}.
# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{version}%{?extraver}
%build
_CFLAGS='%{optflags} -Wno-error=unused-parameter'
_LDFLAGS='-Wl,--strip-all -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro'
meson setup build \
--buildtype=release \
--strip \
\
--prefix=%{_prefix} \
--libexecdir=%{_libexecdir} \
--default-library=shared \
\
-Dtest=false \
-Dv4l2=true \
\
-Db_lto=true \
-Db_ndebug=if-release \
-Dc_args="$_CFLAGS" \
-Dc_link_args="$_LDFLAGS" \
-Dcpp_args="$_CFLAGS" \
-Dcpp_link_args="$_LDFLAGS"
ninja -v -C build %{?_smp_mflags}
%install
DESTDIR=%{buildroot} ninja -C build install
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
%files
%defattr(-,root,root)
%license COPYING.rst
%doc README.rst
%{_bindir}/cam
%{_bindir}/libcamerify
%{_libdir}/*.so.%{?so_ver}*
%{_libdir}/%{realname}/
%{_libexecdir}/%{realname}/
%{_datadir}/%{realname}/
# Development stuff
%files -n %{realname}-devel
%defattr(-,root,root)
%{_libdir}/pkgconfig/*.pc
%{_libdir}/*.so
%{_includedir}/%{realname}/
# GStreamer plugin
%files -n gstreamer-plugin-%{realname}
%defattr(-,root,root)
%dir %{_libdir}/gstreamer-1.0
%{_libdir}/gstreamer-1.0/libgstlibcamera.so
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%changelog