File v4l2loopback.spec of Package v4l2loopback

#
# spec file for package v4l2loopback
#
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
# needssslcertforbuild


%{!?_modprobedir: %define _modprobedir /lib/modprobe.d/} 
%{!?_modulesloaddir: %define _modulesloaddir /usr/lib/modules-load.d/} 

Name:           v4l2loopback
Version:        0.12.5
Release:        0
Summary:        A kernel module to create V4L2 loopback devices
License:        GPL-2.0-or-later
URL:            https://github.com/umlaeute/v4l2loopback
Source:         https://github.com/umlaeute/v4l2loopback/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source1:        preamble
Source2:        modprobe.d_98-v4l2loopback.conf
Source3:        modules-load.d_v4l2loopback.conf
# PATCH-FIX-OPENSUSE v4l2loopback-include_header.patch
Patch0:         v4l2loopback-include_header.patch
# PATCH-FIX-SECURITY v4l2loopback-explicit-format-CVE-2022-2652.patch bsc1202156 CVE-2022-2652 sbrabec@suse.com -- Fix string format vulnerability.
Patch1:         v4l2loopback-explicit-format-CVE-2022-2652.patch
BuildRequires:  %{kernel_module_package_buildreqs}
BuildRequires:  help2man

%if 0%{?is_opensuse}
%kernel_module_package -p %{_sourcedir}/preamble
%else
%kernel_module_package -c %_sourcedir/_projectcert.crt -p %{_sourcedir}/preamble
%endif

%description
This module allows you to create "virtual video devices". Normal (v4l2)
applications will read these devices as if they were ordinary video
devices, but the video will not be read from e.g. a capture card but
instead it is generated by another application.

%package autoload
Summary:        Autoload driver for V4L2 loopback devices
Supplements:    kmod(v4l2loopback.ko)
BuildArch:      noarch
Requires:       systemd

%description autoload
Configuration files to autoload the module during system startup.

%package utils
Summary:        Utils for V4L2 loopback devices
Requires:       v4l-utils
Recommends:     gstreamer:/usr/bin/gst-launch-1.0
Supplements:    kmod(v4l2loopback.ko)
BuildArch:      noarch

%description utils
v4l2loopback-ctl for controlling FPS, placeholder image and image format.

%prep
%autosetup
set -- *
mkdir source
mv "$@" source/
mkdir obj

%build
for flavor in %{flavors_to_build}; do
	rm -rf obj/$flavor
	cp -r source obj/$flavor
	make V=1 %{?_smp_mflags} -C %{kernel_source $flavor} %{?linux_make_arch} modules M=$PWD/obj/$flavor
done

%install
export INSTALL_MOD_PATH=%{buildroot}
export INSTALL_MOD_DIR='%{kernel_module_package_moddir}'
for flavor in %{flavors_to_build}; do
	make V=1 -C %{kernel_source $flavor} modules_install M=$PWD/obj/$flavor
	make V=1 -C obj/$flavor install-utils DESTDIR=%{?buildroot:%{buildroot}} PREFIX=%{_prefix}
	make V=1 -C obj/$flavor install-man DESTDIR=%{?buildroot:%{buildroot}} PREFIX=%{_prefix}
done

export BRP_PESIGN_FILES='*.ko'

install -D -m 0644 %{SOURCE2} %{buildroot}%{_modprobedir}/98-v4l2loopback.conf
install -D -m 0644 %{SOURCE3} %{buildroot}%{_modulesloaddir}/v4l2loopback.conf

%files utils
%attr(0755,root,root) %{_bindir}/v4l2loopback-ctl
%attr(0644,root,root) %{_mandir}/man1/v4l2loopback-ctl.1.gz

%files autoload
%dir %{_modprobedir}
%{_modprobedir}/98-v4l2loopback.conf
%dir %{_modulesloaddir}
%{_modulesloaddir}/v4l2loopback.conf

%changelog
openSUSE Build Service is sponsored by