File zen-browser.spec of Package zen-browser

%define debug_package %{nil}
%define __os_install_post %{nil}
%define _build b
%define _name zen

Name:          zen-browser
Summary:       Experience tranquillity while browsing the web without people tracking you!

Version:       1.10
License:       MPL-2.0
Release:       1%{?dist}
URL:           https://github.com/zen-browser/desktop
Source0:       %{url}/releases/download/%{version}%{_build}/zen.linux-x86_64.tar.xz
Source1:       policies.json
BuildArch:     x86_64
BuildRequires: coreutils
BuildRequires: mozilla-nss
BuildRequires: mozilla-nss-certs
BuildRequires: mozilla-nspr
Requires:      hunspell hyphen

%description
Zen Browser is a privacy-focused browser that blocks trackers, ads, and other unwanted content while offering the best browsing experience!

%prep
%setup -q -n %{_name}

%build
# Nothing to build

%install
# Create directories
install -d %{buildroot}%{_bindir}
install -d %{buildroot}%{_datadir}/applications
install -d %{buildroot}/opt/%{name}

# Install the browser files to /opt
cp -r %{_builddir}/%{_name}/* %{buildroot}/opt/%{name}

# Install launcher file
install -Dm 755 /dev/stdin %{buildroot}%{_bindir}/%{name} << END
#!/bin/bash

exec /opt/%{name}/%{_name}-bin "\$@"
END

# Install .desktop file
install -Dm 644 /dev/stdin %{buildroot}%{_datadir}/applications/%{_name}.desktop << END
[Desktop Entry]
Name=Zen Browser
Comment=Experience tranquillity while browsing the web without people tracking you!
Exec=/opt/%{name}/%{_name}-bin %u
Icon=%{name}
Type=Application
MimeType=text/html;text/xml;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https;application/x-xpinstall;application/pdf;application/json;
StartupWMClass=%{_name}
Categories=Network;WebBrowser;
StartupNotify=true
Terminal=false
X-MultipleArgs=false
Keywords=Internet;WWW;Browser;Web;Explorer;
Actions=new-window;new-private-window;profilemanager;

[Desktop Action new-window]
Name=Open a New Window
Exec=/opt/%{name}/%{_name}-bin %u

[Desktop Action new-private-window]
Name=Open a New Private Window
Exec=/opt/%{name}/%{_name}-bin --private-window %u

[Desktop Action profilemanager]
Name=Open the Profile Manager
Exec=/opt/%{name}/%{_name}-bin --ProfileManager %u
END

# Install icons
for size in 16x16 32x32 48x48 64x64 128x128; do
    install -d %{buildroot}%{_datadir}/icons/hicolor/${size}/apps/
    ln -s /opt/%{name}/browser/chrome/icons/default/default${size/x*}.png \
          %{buildroot}%{_datadir}/icons/hicolor/${size}/apps/%{name}.png
done

# Use system-provided dictionaries
ln -Ts %{_datadir}/hunspell %{buildroot}/opt/%{name}/dictionaries
ln -Ts %{_datadir}/hyphen %{buildroot}/opt/%{name}/hyphenation

# Use system certificates
ln -sf /usr/lib/libnssckbi.so %{buildroot}/opt/%{name}/libnssckbi.so

# Disable update checks (managed by zypper)
install -d %{buildroot}/opt/%{name}/distribution
install -m 644 %{SOURCE1} %{buildroot}/opt/%{name}/distribution/policies.json

%files
%dir /opt/%{name}
/opt/%{name}/*
%{_bindir}/%{name}
%{_datadir}/applications/%{_name}.desktop
%dir %{_datadir}/icons/hicolor
%dir %{_datadir}/icons/hicolor/128x128
%dir %{_datadir}/icons/hicolor/128x128/apps
%dir %{_datadir}/icons/hicolor/16x16
%dir %{_datadir}/icons/hicolor/16x16/apps
%dir %{_datadir}/icons/hicolor/32x32
%dir %{_datadir}/icons/hicolor/32x32/apps
%dir %{_datadir}/icons/hicolor/48x48
%dir %{_datadir}/icons/hicolor/48x48/apps
%dir %{_datadir}/icons/hicolor/64x64
%dir %{_datadir}/icons/hicolor/64x64/apps
%{_datadir}/icons/hicolor/*/apps/%{name}.png

%changelog
openSUSE Build Service is sponsored by