File firefoxpwa.spec of Package firefoxpwa
#
# spec file for package firefoxpwa
#
# copyright (c) 2025 munix9@googlemail.com
#
Name: firefoxpwa
Version: 2.17.1
Release: 0
Summary: The native part of the PWAsForFirefox project
License: MPL-2.0
URL: https://pwasforfirefox.filips.si/
Source0: https://github.com/filips123/PWAsForFirefox/archive/v%{version}/PWAsForFirefox-%{version}.tar.gz
Source1: vendor.tar.xz
# based on https://gist.github.com/filips123/29fb511a01ee8016a927a614f32979d3#file-firefoxpwa-runtime-overlayfs-service
Source10: %{name}-runtime-overlayfs.service
Source11: README-OverlayFS.md
BuildRequires: cargo-packaging
BuildRequires: hicolor-icon-theme
BuildRequires: pkgconfig
BuildRequires: pkgconfig(libssl)
Recommends: (firefox or firefox-esr)
Suggests: %{name}-runtime-overlayfs
#Supplements: firefox
#Supplements: firefox-esr
ExclusiveArch: %{rust_tier1_arches}
%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 runtime-overlayfs
Summary: Using PWAsForFirefox with FUSE OverlayFS
Requires: %{name} = %{version}
Requires: firefox
Requires: fuse-overlayfs
Requires: fuse3
BuildArch: noarch
%{?systemd_ordering}
%description runtime-overlayfs
Use FUSE OverlayFS to link your global Firefox installation with the
PWAsForFirefox runtime.
Warning: Using FUSE OverlayFS is not regularly tested and may not
work with all Firefox versions that distributions provide.
https://pwasforfirefox.filips.si/help/faq/#how-to-use-fuse-overlayfs-with-the-app-browser
https://gist.github.com/filips123/29fb511a01ee8016a927a614f32979d3
%prep
%autosetup -n PWAsForFirefox-%{version} -a1 -p1
# set version
sed -e 's/version = "0\.0\.0"/version = "%{version}"/' -i native/Cargo.toml
sed -z 's/\(name = "%{name}"\)\nversion = "0\.0\.0"/\1\nversion = "%{version}"/' \
-i native/Cargo.lock
sed -e "s/DISTRIBUTION_VERSION = '0\.0\.0'/DISTRIBUTION_VERSION = '%{version}'/" \
-i native/userchrome/profile/chrome/pwa/chrome.sys.mjs
# set runtime path
cp -p %{SOURCE10} %{SOURCE11} .
sed -e 's|%%RUNTIME-PATH%%|%{_libdir}/firefox|g' -i %{name}-runtime-overlayfs.service
%build
export CARGO_TARGET_DIR=$PWD/target/
pushd native
%{cargo_build}
popd
%install
install -D -m 0755 -t %{buildroot}%{_bindir} target/release/%{name}
install -D -m 0755 -t %{buildroot}%{_libexecdir} target/release/%{name}-connector
install -D -m 0644 native/manifests/linux.json \
%{buildroot}%{_libdir}/mozilla/native-messaging-hosts/%{name}.json
install -d -m 0755 %{buildroot}%{_datadir}/%{name}
cp -a native/userchrome %{buildroot}%{_datadir}/%{name}
install -D -m 0644 -t %{buildroot}%{_datadir}/metainfo \
native/packages/appstream/si.filips.FirefoxPWA.metainfo.xml
install -D -m 0644 -t %{buildroot}%{_datadir}/icons/hicolor/scalable/apps \
native/packages/appstream/si.filips.FirefoxPWA.svg
install -D -m 0644 target/release/completions/%{name}.bash \
%{buildroot}%{_datadir}/bash-completion/completions/%{name}
install -D -m 0644 -t %{buildroot}%{_datadir}/fish/vendor_completions.d \
target/release/completions/%{name}.fish
install -D -m 0644 -t %{buildroot}%{_datadir}/zsh/site-functions \
target/release/completions/_%{name}
install -m 0644 native/README.md README-NATIVE.md
install -m 0644 extension/README.md README-EXTENSION.md
install -D -m 0644 -t %{buildroot}%{_userunitdir} %{name}-runtime-overlayfs.service
%check
export PATH=%{buildroot}%{_bindir}:$PATH
echo "check that the version has been set correctly in %%prep ..."
%{name} --version | grep "%{name} %{version}"
grep "DISTRIBUTION_VERSION = '%{version}'" \
%{buildroot}%{_datadir}/%{name}/userchrome/profile/chrome/pwa/chrome.sys.mjs
%post
if [ $1 == 1 ] ; then
echo "You have successfully installed the native part of the PWAsForFirefox project"
echo "You should also install the Firefox extension if you haven't already"
echo "Download: https://addons.mozilla.org/firefox/addon/pwas-for-firefox/"
fi
%postun
if [ $1 == 0 ] ; then
echo "Runtime, profiles and web apps are still installed in user directories"
echo "You can remove them manually after this package is uninstalled"
echo "Doing that will remove all installed web apps and their data"
fi
%pre -n %{name}-runtime-overlayfs
%systemd_user_pre %{name}-runtime-overlayfs.service
%post -n %{name}-runtime-overlayfs
%systemd_user_post %{name}-runtime-overlayfs.service
%preun -n %{name}-runtime-overlayfs
%systemd_user_preun %{name}-runtime-overlayfs.service
%postun -n %{name}-runtime-overlayfs
%systemd_user_postun %{name}-runtime-overlayfs.service
%files
%license LICENSE native/packages/deb/copyright
%doc README.md README-NATIVE.md README-EXTENSION.md
%{_bindir}/%{name}
%{_datadir}/%{name}
%{_datadir}/icons/hicolor/scalable/apps/si.filips.FirefoxPWA.svg
%{_datadir}/metainfo/si.filips.FirefoxPWA.metainfo.xml
%dir %{_datadir}/bash-completion
%dir %{_datadir}/bash-completion/completions
%{_datadir}/bash-completion/completions/%{name}
%dir %{_datadir}/fish
%dir %{_datadir}/fish/vendor_completions.d
%{_datadir}/fish/vendor_completions.d/%{name}.fish
%dir %{_datadir}/zsh
%dir %{_datadir}/zsh/site-functions
%{_datadir}/zsh/site-functions/_%{name}
%dir %{_libdir}/mozilla
%dir %{_libdir}/mozilla/native-messaging-hosts
%{_libdir}/mozilla/native-messaging-hosts/%{name}.json
%{_libexecdir}/%{name}-connector
%files runtime-overlayfs
%doc README-OverlayFS.md
%{_userunitdir}/%{name}-runtime-overlayfs.service
%changelog