File floorp.spec of Package floorp

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

Name:           floorp
Version:        12.7.0
Release:        1%{?dist}
Summary:        Firefox-based privacy-focused browser

License:        MPL-2.0
Group:          Productivity/Networking/Web/Browsers
URL:            https://floorp.app
Source0:        floorp-linux-x86_64.tar.xz
Source1:        floorp.png
Source2:        floorp-private.png
Source3:        floorp.desktop

BuildRequires:  hicolor-icon-theme
BuildRequires:  fdupes
BuildRequires:  desktop-file-utils
BuildRequires:  appstream-glib
BuildRequires:  chrpath
BuildRequires:  execstack

ExclusiveArch:  x86_64
Requires:       gtk3
Provides:       web_browser
Conflicts:      floorp, floorp-browser

%description
Floorp 12 is a Firefox-based browser focused on user privacy and customizability.

%prep
# Nothing to do

%build
# Nothing to build

%install
if [ "$(tar -tf %{SOURCE0} | head -1)" = "floorp/" ]; then
	mkdir -p %{buildroot}/%{_libdir}
	tar -xf %{SOURCE0} -C %{buildroot}/%{_libdir}
else
	mkdir -p %{buildroot}/%{_libdir}/floorp
	tar -xf %{SOURCE0} -C %{buildroot}/%{_libdir}/floorp
fi

# Symlink to /usr/bin
mkdir -p %{buildroot}/%{_bindir}
ln -sf /%{_libdir}/floorp/floorp %{buildroot}/%{_bindir}/floorp

# Desktop file
mkdir -p %{buildroot}/usr/share/applications
install -m 644 %{SOURCE3} \
  %{buildroot}/usr/share/applications/floorp.desktop

# Icon files
mkdir -p %{buildroot}/usr/share/icons/hicolor/48x48/apps
install -m 644 %{SOURCE1} %{buildroot}/usr/share/icons/hicolor/48x48/apps/floorp.png
mkdir -p %{buildroot}/usr/share/icons/hicolor/192x192/apps
install -m 644 %{SOURCE2} %{buildroot}/usr/share/icons/hicolor/192x192/apps/floorp-private.png

# Strip unneeded binary bits
find %{buildroot}/%{_libdir}/floorp -type f -name "*.so*" -exec chrpath --delete {} \; || :
find %{buildroot}/%{_libdir}/floorp -type f -name "*.so*" -exec execstack -c {} \; || :
find %{buildroot}/%{_libdir}/floorp -type f -name "*.so*" -exec strip -s {} \; || :
find %{buildroot}/%{_libdir}/floorp -type f -size 0 -exec rm {} \; || :

# Deduplicate if any files match
%fdupes %{buildroot}/%{_libdir}/floorp

%post
if [ -x /%{_bindir}/update-desktop-database ]; then
    /%{_bindir}/update-desktop-database -q
fi
if [ -x /%{_bindir}/gtk-update-icon-cache ]; then
    /%{_bindir}/gtk-update-icon-cache -q /usr/share/icons/hicolor
fi

%postun
if [ -x /%{_bindir}/update-desktop-database ]; then
    /%{_bindir}/update-desktop-database -q
fi
if [ -x /%{_bindir}/gtk-update-icon-cache ]; then
    /%{_bindir}/gtk-update-icon-cache -q /usr/share/icons/hicolor
fi

%check
# empty

%files
%{_libdir}/floorp
/%{_bindir}/floorp
/usr/share/applications/floorp.desktop
/usr/share/icons/hicolor/48x48/apps/floorp.png
/usr/share/icons/hicolor/192x192/apps/floorp-private.png

%changelog
openSUSE Build Service is sponsored by