File pdftk.spec of Package pdftk

#
# spec file for package pdftk
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2012 B1 Systems GmbH, Vohburg, Germany.
#
# 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/
#


Name:           pdftk
Version:        1.44
Release:        0
Summary:        A handy tool for manipulating PDF
License:        GPL-2.0+
Group:          Productivity/Publishing/PDF
Url:            http://www.pdflabs.com/
Source0:        %{name}-%{version}-src.zip
Source1:        Makefile.SUSE
Patch0:         bug-427046_pdftk.cc.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  unzip

# BuildRequires package version suffix : "41" for "gcc41-java"
%define pkgv %nil
# gcc/gcj binaries version suffix : "-4.1" for "gcj-4.1"
%define gxxv %nil

# openSUSE 11.0 and SLE_11 are odd cases.
# %jarv is still correct from above for both
%if 0%{?suse_version} == 1100 || 0%{?sles_version} == 11
# "Nothing provides libgcj"
%define pkgv 43
# "gcj command not found", "gcjh command not found"
%define gxxv -4.3
%endif

BuildRequires:  gcc%{pkgv}-c++
BuildRequires:  gcc%{pkgv}-java
BuildRequires:  libgcj%{pkgv}
BuildRequires:  libgcj%{pkgv}-devel

# after 10.0 java-gcj was separated from gcj-java
%if 0%{suse_version} > 1000
BuildRequires:  java-gcj
%endif

%if 0%{?suse_version} > 1010 || 0%{?sles_version} == 10
BuildRequires:  fastjar
%endif

%description
If PDF is electronic paper, then pdftk is an electronic staple-remover,
hole-punch, binder, secret-decoder-ring, and X-Ray-glasses.
Pdftk is a simple tool for doing everyday things with PDF documents.

Use it to:
  * Merge PDF Documents
  * Split PDF Pages into a New Document
  * Rotate PDF Documents or Pages
  * Decrypt Input as Necessary (Password Required)
  * Encrypt Output as Desired
  * Fill PDF Forms with X/FDF Data and/or Flatten Forms
  * Generate FDF Data Stencil from PDF Forms
  * Apply a Background Watermark or a Foreground Stamp
  * Report PDF Metrics such as Metadata and Bookmarks
  * Update PDF Metadata
  * Attach Files to PDF Pages or the PDF Document
  * Unpack PDF Attachments
  * Burst a PDF Document into Single Pages
  * Uncompress and Re-Compress Page Streams
  * Repair Corrupted PDF (Where Possible)

%prep
%setup -q -n %{name}-%{version}-dist
%patch0 -p1
%__cp %{S:1} pdftk/Makefile
%__sed -i 's/\r$//' changelog.txt license_gpl_pdftk/*.txt license_gpl_pdftk/*/*.txt

%build
%__make -C pdftk CXXFLAGS="%optflags" LIBGCJ= GXXV=%gxxv
%__strip pdftk/%name

%install
%__install -Dm 0755 pdftk/%name %{buildroot}%{_bindir}/%name
%__install -Dpm 0644 %{name}.1 %{buildroot}%{_mandir}/man1/%{name}.1

%clean
%__rm -rf %buildroot

%files
%defattr(-,root,root)
%{_bindir}/%name
%{_mandir}/man1/%{name}.*
%doc changelog.txt license_gpl_pdftk/*.txt license_gpl_pdftk/*/*.txt

%changelog