File zotero.spec of Package zotero

#
# spec file for package zotero
#
# Copyright (c) 2022 SUSE LLC
# Copyright (c) 2022 Tejas Guruswamy <tejas.guruswamy@opensuse.org>
#
# 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:           zotero
Version:        7.0.9
Release:        0
Summary:        Tool to help collect, organize, cite, and share research sources
License:        AGPL-3.0-only
Group:          Productivity/Office/Organizers
URL:            https://www.zotero.org
Source:         https://download.zotero.org/client/release/%{version}/Zotero-%{version}_linux-x86_64.tar.bz2
Source1:        policies.json
Source2:        %{name}.desktop
BuildRequires:  desktop-file-utils
BuildRequires:  hicolor-icon-theme
BuildRequires:  update-desktop-files
Requires:       mozilla-nspr
Requires:       mozilla-nss
Provides:       application(zotero.desktop)
Provides:       mimehandler(text/plain)
AutoReqProv:    no
ExclusiveArch:  x86_64

%description
Zotero is a free, easy-to-use tool to help you collect, organize, cite, and share your research sources.

%define source_dir Zotero_linux-x86_64

%prep
%setup -q -cn %{source_dir}

%build

%install
mkdir -p %{buildroot}/%{_bindir} %{buildroot}/%{_datadir}/applications %{buildroot}/%{_libexecdir} 

mkdir -p %{buildroot}/%{_datadir}/icons/hicolor/symbolic/apps %{buildroot}/%{_datadir}/pixmaps

cp -r %{source_dir}/ %{buildroot}/%{_libexecdir}/%{name}
ln -s ../../%{_libexecdir}/%{name}/zotero %{buildroot}/%{_bindir}/%{name}
for i in 32 64 128 ;do mkdir -p %{buildroot}/%{_datadir}/icons/hicolor/${i}x${i}/apps/ && install -Dm644 %{source_dir}/icons/icon${i}.png %{buildroot}/%{_datadir}/icons/hicolor/${i}x${i}/apps/%{name}.png; done
install -Dm644 %{source_dir}/icons/symbolic.svg %{buildroot}/%{_datadir}/icons/hicolor/symbolic/apps/%{name}.svg
install -Dm644 %{source_dir}/icons/updater.png %{buildroot}/%{_datadir}/pixmaps/%{name}-updater.png

# .desktop
desktop-file-install --dir %{buildroot}%{_datadir}/applications %{SOURCE2}
%suse_update_desktop_file %{name}

export NO_BRP_STALE_LINK_ERROR=yes

mkdir -p %{buildroot}/%{_datadir}/%{name}/distribution
install -D %{SOURCE1} %{buildroot}/%{_datadir}/%{name}/distribution/policies.json

%files
%defattr(-,root,root,-)
%{_bindir}/%{name}
%{_libexecdir}/%{name}
%{_datadir}/%{name}
%{_datadir}/%{name}/distribution/policies.json
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/128x128/apps/zotero.png
%{_datadir}/icons/hicolor/32x32/apps/zotero.png
%{_datadir}/icons/hicolor/64x64/apps/zotero.png
%{_datadir}/icons/hicolor/symbolic/apps/zotero.svg
%{_datadir}/pixmaps/zotero-updater.png

%changelog
openSUSE Build Service is sponsored by