File epubcheck.spec of Package epubcheck

#
# spec file for package epubcheck
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, 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:           epubcheck
Version:        5.0.0
Release:        0
Summary:        Validates IDPF EPub Files
License:        BSD-3-Clause
Group:          Productivity/Publishing/XML
URL:            https://github.com/IDPF/epubcheck
Source0:        https://github.com/IDPF/epubcheck/releases/download/v%{version}/epubcheck-%{version}.zip
Source1:        %{name}.script
Source2:        %{name}.xml
BuildRequires:  ant
BuildRequires:  docbook-xsl-stylesheets
BuildRequires:  docbook_4
BuildRequires:  dos2unix
BuildRequires:  java-devel >= 1.8
BuildRequires:  jing
BuildRequires:  libxslt
BuildRequires:  libzio-devel
BuildRequires:  saxon10
BuildRequires:  unzip
Requires:       java
BuildArch:      noarch

%description
EpubCheck is a tool to validate IDPF Epub files. It can
detect many types of errors in Epub. OCF container
structure, OPF and OPS mark-up, and internal reference
consistency are checked. EpubCheck can be run as a
standalone command-line tool, installed as a web application
or used as a library.

%define EPUBCHECK_HOME %{_datadir}/%{name}

%prep

%setup -q
# Replace placeholder strings:
cp %{SOURCE1} %{name}
cp %{SOURCE2} .
sed -i "s=@HOME@=%{EPUBCHECK_HOME}=" %{name}
sed -i "s=@VERSION@=%{version}=" %{name}.xml

%build
xsltproc %{_datadir}/xml/docbook/stylesheet/nwalsh/current/manpages/docbook.xsl %{name}.xml
gzip -9 %{name}.1

%install
mkdir -p %{buildroot}%{_mandir}/man1 \
         %{buildroot}%{_javadir} \
         %{buildroot}%{_bindir} \
         %{buildroot}%{EPUBCHECK_HOME}/lib
install -m 755 %{name}            %{buildroot}%{_bindir}

cp %{name}.1.gz %{buildroot}%{_mandir}/man1
cp %{name}.jar %{buildroot}%{EPUBCHECK_HOME}/%{name}-%{version}.jar
cp -a lib/*.jar %{buildroot}%{EPUBCHECK_HOME}/lib

pushd %{buildroot}%{_javadir}
ln -s %{EPUBCHECK_HOME}/%{name}-%{version}.jar %{name}-%{version}.jar
ln -s %{name}-%{version}.jar %{name}.jar
popd

%files
%license LICENSE.txt THIRD-PARTY.txt
%doc README.txt
%{_mandir}/man1/%{name}*
%dir %{EPUBCHECK_HOME}
%{EPUBCHECK_HOME}/*
%{_javadir}/%{name}*.jar
%{_bindir}/%{name}

%changelog
openSUSE Build Service is sponsored by