File pdfsam-basic.spec of Package pdfsam-basic

#
# spec file for package pdfsam-basic
#
# Copyright (c) 2020 Linux Kamarada Project, Florianópolis, Brazil.
#
# 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 http://bugs.opensuse.org/
#


# https://docs.fedoraproject.org/en-US/packaging-guidelines/SourceURL/#_git_hosting_services


Name:           pdfsam-basic
Summary:        PDF Split And Merge Basic Edition (PDFsam Basic)
Version:        4.2.10
Release:        1%{?dist}
License:        AGPL-3.0
Group:          Productivity/Text/Utilities
URL:            https://www.pdfsam.org
Source0:        https://github.com/torakiki/pdfsam/releases/download/v%{version}/pdfsam-%{version}-linux.tar.gz
Source1:        https://raw.githubusercontent.com/torakiki/pdfsam/v%{version}/%{name}/src/deb/icon.svg
Source2:        https://raw.githubusercontent.com/torakiki/pdfsam/v%{version}/%{name}/src/deb/%{name}.desktop

BuildArch:      x86_64
BuildRequires:  fdupes
BuildRequires:  unzip
BuildRequires:  update-desktop-files

Requires:       java >= 11

Obsoletes:      pdfsam < %{version}
Provides:       pdfsam = %{version}


%description
Open source desktop application to split, merge, rotate, extract pages and mix PDF files.


%prep
%setup -n pdfsam-%{version}-linux
rm bin/pdfsam.bat
mv bin/pdfsam.sh bin/%{name}
# PDFsam Basic v4.x comes with a Java runtime, not needed if Java is installed
rm -rf runtime


%build


%install
mkdir -p %{buildroot}/opt/%{name}
mv ./* %{buildroot}/opt/%{name}/
mkdir -p %{buildroot}%{_bindir}
ln -s /opt/%{name}/bin/%{name} %{buildroot}%{_bindir}/pdfsam
install -Dm644 %{SOURCE1} %{buildroot}/opt/%{name}/
install -Dm644 %{SOURCE2} %{buildroot}/usr/share/applications/%{name}.desktop

find %{buildroot}/opt/%{name} -type d -exec chmod 755 {} ';'
find %{buildroot}/opt/%{name} -type f -exec chmod 644 {} ';'
chmod 755 %{buildroot}/opt/%{name}/bin/pdfsam-basic

desktop-file-edit --set-generic-name 'PDF Split And Merge' %{buildroot}%{_datadir}/applications/%{name}.desktop
desktop-file-edit --add-category=X-Red-Hat-Base %{buildroot}%{_datadir}/applications/%{name}.desktop
desktop-file-edit --add-category=X-SuSE-Core-Office %{buildroot}%{_datadir}/applications/%{name}.desktop
# Same Categories as LibreOffice (/usr/share/applications/startcenter.desktop)

%fdupes -s %{buildroot}/opt/pdfsam-basic/


%files
%{_bindir}/pdfsam
/opt/pdfsam-basic
%license /opt/pdfsam-basic/LICENSE.txt
%{_datadir}/applications/%{name}.desktop


%changelog
openSUSE Build Service is sponsored by