File v4l2loopback.spec of Package v4l2loopback
#
# spec file for package v4l2loopback
#
# Copyright (c) 2025 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
%if 0%{?suse_version} < 1550 && 0%{?sle_version} <= 150300
# systemd-rpm-macros is wrong in 15.3 and below
%define _modprobedir /lib/modprobe.d
%endif
%ifarch x86_64
%if 0%{?suse_version} > 1600
%define kmp_longterm 1
%endif
%endif
%global modprobe_d_files 98-v4l2loopback.conf
%{!?_modulesloaddir: %define _modulesloaddir /usr/lib/modules-load.d/}
Name: v4l2loopback
Version: 0.14.0
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
Source: %{name}-%{version}.tar.xz
Source1: preamble
Source2: modprobe.d_98-v4l2loopback.conf
Source3: modules-load.d_v4l2loopback.conf
BuildRequires: %{kernel_module_package_buildreqs}
%if 0%{?kmp_longterm}
BuildRequires: kernel-syms-longterm
%endif
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)
%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
%pre
# Avoid restoring outdated stuff in posttrans
for _f in %{?modprobe_d_files}; do
[ ! -f "/etc/modprobe.d/${_f}.rpmsave" ] || \
mv -f "/etc/modprobe.d/${_f}.rpmsave" "/etc/modprobe.d/${_f}.rpmsave.old" || :
done
%posttrans
# Migration of modprobe.conf files to _modprobedir
for _f in %{?modprobe_d_files}; do
[ ! -f "/etc/modprobe.d/${_f}.rpmsave" ] || \
mv -fv "/etc/modprobe.d/${_f}.rpmsave" "/etc/modprobe.d/${_f}" || :
done
%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