File osk-sdl.spec of Package osk-sdl
#
# spec file for package osk-sdl
#
# Copyright (c) 2022 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/
#
%define dracutlibdir %{_prefix}/lib/dracut
Name: osk-sdl
Version: 0.67
Release: 0
Summary: Lightweight On-Screen-Keyboard based on SDL2
License: GPL-3.0-or-later
Group: System/Console
URL: https://gitlab.com/postmarketOS/osk-sdl
Source: https://gitlab.com/postmarketOS/osk-sdl/-/archive/%{version}/%{name}-%{version}.tar.bz2
Source1: module-setup.sh
Source2: osk-sdl-ask-password.sh
Source3: osk-sdl-ask-password.path
Source4: osk-sdl-ask-password.service
# Patch from upstream fixing a build error.
Patch0: fix_transform_build_error.patch
BuildRequires: cmake
BuildRequires: gcc-c++
BuildRequires: meson
BuildRequires: scdoc
BuildRequires: pkgconfig(SDL2_ttf)
BuildRequires: pkgconfig(libcryptsetup)
BuildRequires: pkgconfig(sdl2)
BuildRequires: systemd-rpm-macros
Requires: dejavu-fonts
Recommends: (%{name}-dracut if dracut)
%description
This keyboard is used to unlock the encrypted root partition in
postmarketOS and other distributions.
%package dracut
Summary: Dracut integration of osk-sdl
BuildRequires: dracut
Requires: %{name} = %{version}
Requires: dracut
BuildArch: noarch
%description dracut
dracut integration of osk-sdl.
%prep
%setup -q
%patch0 -p1
sed -i 's|fonts/ttf-dejavu/DejaVuSans.ttf|fonts/truetype/DejaVuSans.ttf|g' osk.conf
%build
%meson
%meson_build
%install
%meson_install
install -D -m 0755 %{SOURCE1} %{buildroot}%{dracutlibdir}/modules.d/55osk-sdl/module-setup.sh
install -D -m 0755 %{SOURCE2} %{buildroot}%{dracutlibdir}/modules.d/55osk-sdl/osk-sdl-ask-password.sh
install -D -m 0644 %{SOURCE3} %{buildroot}%{_unitdir}/osk-sdl-ask-password.path
install -D -m 0644 %{SOURCE4} %{buildroot}%{_unitdir}/osk-sdl-ask-password.service
mkdir -p %{buildroot}%{_unitdir}/sysinit.target.wants
ln -s ../osk-sdl-ask-password.path %{buildroot}%{_unitdir}/sysinit.target.wants/
%pre dracut
%service_add_pre osk-sdl-ask-password.path osk-sdl-ask-password.service
%post dracut
%{?regenerate_initrd_post}
%service_add_post osk-sdl-ask-password.path osk-sdl-ask-password.service
%preun dracut
%service_del_preun osk-sdl-ask-password.path osk-sdl-ask-password.service
%postun dracut
%{?regenerate_initrd_post}
%service_del_postun osk-sdl-ask-password.path osk-sdl-ask-password.service
%posttrans dracut
%{?regenerate_initrd_posttrans}
%files
%license LICENSE
%doc README.md
%config %{_sysconfdir}/osk.conf
%{_bindir}/osk-sdl
%{_mandir}/man1/osk-sdl.1%{?ext_man}
%{_mandir}/man5/osk.conf.5%{?ext_man}
%files dracut
%{dracutlibdir}/modules.d/55osk-sdl
%{_unitdir}/osk-sdl-ask-password.*
%{_unitdir}/sysinit.target.wants/osk-sdl-ask-password.path
%changelog