File umu-launcher.spec of Package umu-launcher

#
# spec file for package umu-launcher
#
# 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/
#


%global apparmor_profile_name bwrap-userns-restrict
%if %{pkg_vcmp apparmor-profiles >= 4}
%bcond_with    apparmor4
%else
%bcond_with    apparmor4
%endif

%if 0%{?suse_version} == 1500
%global primary_python python311
%endif

Name:           umu-launcher
Version:        1.2.5
Release:        0
Summary:        A tool for launching non-steam games with proton
License:        GPL-3.0-only
URL:            https://github.com/Open-Wine-Components/umu-launcher
Source0:        %{name}-%{version}.tar.zst
Source1:        _service
Source2:        _servicedata
Source3:        umu-launcher.obsinfo
Source4:        series
Source5:        vendor.tar.zst
Patch1:         no-git-for-version.patch
BuildRequires:  %{primary_python}-build
BuildRequires:  %{primary_python}-devel
BuildRequires:  %{primary_python}-filelock
BuildRequires:  %{primary_python}-hatchling
BuildRequires:  %{primary_python}-installer
BuildRequires:  %{primary_python}-pyzstd >= 0.16.2
BuildRequires:  %{primary_python}-urllib3 >= 2.0
BuildRequires:  %{primary_python}-xlib >= 0.33
BuildRequires:  apparmor-profiles
BuildRequires:  apparmor-rpm-macros
BuildRequires:  cargo-packaging
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  man
BuildRequires:  meson >= 0.54.0
BuildRequires:  ninja
BuildRequires:  python-rpm-macros
BuildRequires:  python3
BuildRequires:  scdoc
BuildRequires:  zstd
BuildRequires:  (%{primary_python}-cbor2 >= 5.4.6 with %{primary_python}-cbor2 < 6)
BuildRequires:  (%{primary_python}-xxhash >= 3.2.0 with %{primary_python}-xxhash < 4)
Requires:       %{primary_python}
Requires:       %{primary_python}-filelock
Requires:       %{primary_python}-pyzstd >= 0.16.2
Requires:       %{primary_python}-truststore
Requires:       %{primary_python}-urllib3 >= 2.0
Requires:       %{primary_python}-xlib >= 0.33
Requires:       (%{primary_python}-cbor2 >= 5.4.6 with %{primary_python}-cbor2 < 6)
Requires:       (%{primary_python}-xxhash >= 3.2.0 with %{primary_python}-xxhash < 4)
%if %{with apparmor4}
Requires:       apparmor-profiles
%endif
BuildArch:      noarch

%description
This is a unified launcher for Windows games on Linux. It is essentially a copy
of the Steam Runtime Tools and Steam Linux Runtime that Valve uses for Proton,
with some modifications made so that it can be used outside of Steam.

%prep
%autosetup -p1 -a5

%build
./configure.sh --prefix=%{_prefix} --use-system-pyzstd --use-system-urllib
%make_build UMU_VERSION=%{version}

%install
%make_install PYTHONDIR=%{python3_sitelib} UMU_VERSION=%{version}
%{python3_fix_shebang}
%python3_fix_shebang_path %{buildroot}%{python3_sitelib}/umu/umu_run.py

%if %{with apparmor4}
# install -D -m 0644 packaging/deb/debian/apparmor/bwrap %{buildroot}%{apparmor_profilesdir}/%{apparmor_profile_name}
install -D -d -m 0755 %{buildroot}%{apparmor_profilesdir}/
ln -s /usr/share/apparmor/extra-profiles/bwrap-userns-restrict %{buildroot}%{apparmor_profilesdir}/%{apparmor_profile_name}

%pre
%apparmor_reload %{apparmor_profilesdir}/%{apparmor_profile_name}
%endif

%files
%license LICENSE
%doc *.md
%if %{with apparmor4}
%config %{apparmor_profilesdir}/%{apparmor_profile_name}
%endif
%{_bindir}/umu-run
%{_mandir}/man*/umu*
%{python3_sitelib}/umu/
%{python3_sitelib}/umu_launcher-%{version}.dist-info
# TODO: should ensure it uses the same values as the steam package?
%dir %{_datadir}/steam/
%dir %{_datadir}/steam/compatibilitytools.d/
#/ TODO
%{_datadir}/steam/compatibilitytools.d/umu-launcher/

%changelog
openSUSE Build Service is sponsored by