File firefoxpwa.spec of Package firefoxpwa
#
# spec file for package firefoxpwa
#
# Copyright (c) 2025 SUSE LLC and contributors
#
# 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/
#
%if 0%{?suse_version} >= 1699
%define RUST_RELEASE_PATH %{_builddir}/%{name}-%{version}/target/release/
%else
%define RUST_RELEASE_PATH %{_builddir}/%{name}-%{version}/native/target/release/
%endif
Name: firefoxpwa
Version: 2.15.0
Release: 0
Summary: The native part of the PWAsForFirefox project
License: MPL-2.0
URL: https://github.com/filips123/PWAsForFirefox
Source0: %{name}-%{version}.tar.gz
Source1: vendor.tar.zst
BuildRequires: cargo >= 1.85
BuildRequires: cargo-packaging
BuildRequires: pkgconfig(openssl)
BuildRequires: bash-completion
BuildRequires: fish
BuildRequires: zsh
Requires: (MozillaFirefox or firefox-esr)
ExcludeArch: %{ix86}
%description
Progressive Web Apps (PWAs) are web apps that use web APIs and features along
with progressive enhancement strategy to bring a native app-like user
experience to cross-platform web applications. Although Firefox supports many
of Progressive Web App APIs, it does not support functionality to install them
as a standalone system app with an app-like experience.
This project creates a custom modified Firefox runtime to allow websites to be
installed as standalone apps and provides a console tool and browser extension
to install, manage and use them.
This package contains only the native part of the PWAsForFirefox project. You
should also install the browser extension if you haven't already. You can
download it from <https://addons.mozilla.org/firefox/addon/pwas-for-firefox/>.
%package -n %{name}-bash-completion
Summary: Bash Completion for %{name}
Group: System/Shells
Requires: %{name} = %{version}
Requires: bash-completion
Supplements: (%{name} and bash-completion)
BuildArch: noarch
%description -n %{name}-bash-completion
Bash command line completion support for %{name}.
%package -n %{name}-fish-completion
Summary: Fish Completion for %{name}
Group: System/Shells
Requires: %{name} = %{version}
Requires: fish
Supplements: (%{name} and fish)
BuildArch: noarch
%description -n %{name}-fish-completion
Fish command line completion support for %{name}.
%package -n %{name}-zsh-completion
Summary: Zsh Completion for %{name}
Group: System/Shells
Requires: %{name} = %{version}
Requires: zsh
Supplements: (%{name} and zsh)
BuildArch: noarch
%description -n %{name}-zsh-completion
zsh command line completion support for %{name}.
%prep
%autosetup -a 1 -p 1
mv .cargo/ vendor native/
%build
cd native/
%{cargo_build}
%install
install -D -d -m 0755 %{buildroot}%{_bindir}
install -m 0755 %{RUST_RELEASE_PATH}%{name} %{buildroot}%{_bindir}/%{name}
install -D -d -m 0755 %{buildroot}%{_libexecdir}
install -m 0755 %{RUST_RELEASE_PATH}%{name}-connector %{buildroot}%{_libexecdir}/
install -D -d -m 0755 %{buildroot}%{_libdir}/mozilla/native-messaging-hosts/
install -m 0644 native/manifests/linux.json %{buildroot}%{_libdir}/mozilla/native-messaging-hosts/%{name}.json
install -D -d -m 0755 %{buildroot}%{_datadir}/%{name}
cp -vr native/userchrome/ %{buildroot}%{_datadir}/%{name}
# copy the bash completion file
mkdir -p %{buildroot}%{_datarootdir}/bash-completion/completions/
install -m 0644 %{RUST_RELEASE_PATH}/completions/%{name}.bash %{buildroot}%{_datarootdir}/bash-completion/completions/%{name}
# copy the fish completion file
mkdir -p %{buildroot}%{_datarootdir}/fish/vendor_completions.d/
install -m 0644 %{RUST_RELEASE_PATH}/completions/%{name}.fish %{buildroot}%{_datarootdir}/fish/vendor_completions.d/%{name}.fish
# copy the zsh completion file
mkdir -p %{buildroot}%{_datarootdir}/zsh/site-functions/
install -m 0644 %{RUST_RELEASE_PATH}/completions/_%{name} %{buildroot}%{_datarootdir}/zsh/site-functions/_%{name}
# READMEs
cp native/README.md README-NATIVE.md
cp extension/README.md README-EXTENSION.md
%check
%{buildroot}%{_bindir}/%{name} --help
%files
%doc README.md README-NATIVE.md README-EXTENSION.md
%license LICENSE native/packages/deb/copyright
%{_bindir}/%{name}
%{_libexecdir}/%{name}-connector
%dir %{_libdir}/mozilla/
%dir %{_libdir}/mozilla/native-messaging-hosts/
%{_libdir}/mozilla/native-messaging-hosts/%{name}.json
%{_datadir}/%{name}
%files -n %{name}-bash-completion
%{_datarootdir}/bash-completion/completions/%{name}
%files -n %{name}-fish-completion
%{_datarootdir}/fish/vendor_completions.d/%{name}.fish
%files -n %{name}-zsh-completion
%{_datarootdir}/zsh/site-functions/_%{name}
%changelog