File jericho-html.spec of Package jericho-html

#
# spec file for package jericho-html
#
# 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 https://bugs.opensuse.org/
#


Name:           jericho-html
Version:        3.3
Release:        0
Summary:        Java library allowing analysis and manipulation of parts of an HTML document
License:        EPL-1.0 AND LGPL-2.1-only AND Apache-2.0
Group:          Development/Libraries/Java
URL:            http://jericho.htmlparser.net/
Source:         http://downloads.sf.net/jerichohtml/%{name}-%{version}.zip
BuildRequires:  apache-commons-logging
BuildRequires:  java-devel >= 1.6
BuildRequires:  jpackage-utils
BuildRequires:  junit
BuildRequires:  log4j
BuildRequires:  slf4j
BuildRequires:  unzip
BuildArch:      noarch

%description
Jericho HTML Parser is a java library allowing analysis and manipulation of
parts of an HTML document, including server-side tags, while reproducing
verbatim any unrecognized or invalid HTML. It also provides high-level HTML
form manipulation functions.

%package javadoc
Summary:        Javadoc for %{name}

%description javadoc
This package contains the API documentation for %{name}.

%prep
%setup -q
# Remove prebuild files
find \( -name '*.class' -o -name '*.[jw]ar' \) -exec rm -f '{}' +
# Convert all source files to unix line ending
find \( -name '*.java' -o -name '*.bat' -o -name '*.txt' -o -name '*.jsp' -o -name '*.css' -o -name '*.xml' \) -exec sed -i 's/\r//' '{}' +
# Fix non ASCII chars
for f in \
src/java/net/htmlparser/jericho/Renderer.java \
src/java/net/htmlparser/jericho/StreamEncodingDetector.java
do
  iconv -f ISO-8859-1 -t UTF-8 "$f" > "$f.utf8"
  mv -v "$f.utf8" "$f"
done

%build
export CLASSPATH=$(build-classpath slf4j/api commons-logging log4j)
%javac -Xlint -g:none -d classes -encoding UTF-8 src/java/net/htmlparser/jericho/*.java src/java/net/htmlparser/jericho/nodoc/*.java
%jar -cf dist/%{name}.jar -C classes .
%javac -Xlint -g -deprecation -classpath dist/%{name}.jar -d samples/console/classes samples/console/src/*.java

%install
install -Dpm 0644 dist/%{name}.jar %{buildroot}%{_javadir}/%{name}.jar

%check
mkdir -p test/classes
export CLASSPATH=classes:samples/console/classes:$(build-classpath junit hamcrest)
%javac -Xlint -g -d test/classes test/src/*.java test/src/samples/*.java test/src/net/htmlparser/jericho/*.java
%java -classpath $CLASSPATH:test/classes -Djava.util.logging.config.file=test/logging.properties org.junit.runner.JUnitCore TestSuite

%files
%license licence-epl-1.0.html licence-lgpl-2.1.txt licence.txt
%{_javadir}/%{name}.jar

%files javadoc
%doc release.txt project-description.txt
%doc docs/

%changelog
openSUSE Build Service is sponsored by