File jtidy.spec of Package jtidy

#
# spec file for package jtidy (Version 8.0)
#
# Copyright (c) 2009 SUSE LINUX Products 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/
#


%define with()          %{expand:%%{?with_%{1}:1}%%{!?with_%{1}:0}}
%define without()       %{expand:%%{?with_%{1}:0}%%{!?with_%{1}:1}}
%define bcond_with()    %{expand:%%{?_with_%{1}:%%global with_%{1} 1}}
%define bcond_without() %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}}
%define _without_maven 1
%bcond_with             maven
%define section free

Name:           jtidy
Version:        8.0
Release:        3
Summary:        HTML syntax checker and pretty printer
License:        BSD 3-Clause
Group:          Development/Libraries/Java
Url:            http://jtidy.sourceforge.net/
# svn export -r813 http://svn.sourceforge.net/svnroot/jtidy/trunk/jtidy/ jtidy
# # bnc#501764
# rm jtidy/src/config/clover.license
Source0:        jtidy-r813.tar.bz2
Source1:        %{name}.jtidy.script
Source2:        build.xml
Source3:        maven-build.properties
Source4:        maven-build.xml
Requires:       xerces-j2
Requires:       xml-commons-apis
BuildRequires:  ant >= 1.6
BuildRequires:  ant-junit
BuildRequires:  jpackage-utils >= 1.5
BuildRequires:  xerces-j2
BuildRequires:  xml-commons-apis
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
JTidy is a Java port of HTML Tidy, a HTML syntax checker and pretty
printer. Like its non-Java cousin, JTidy can be used as a tool for
cleaning up malformed and faulty HTML. In addition, JTidy provides a
DOM parser for real-world HTML.



%package javadoc
License:        BSD 3-Clause
Group:          Development/Libraries/Java
Summary:        HTML syntax checker and pretty printer

%description javadoc
JTidy is a Java port of HTML Tidy, a HTML syntax checker and pretty
printer. Like its non-Java cousin, JTidy can be used as a tool for
cleaning up malformed and faulty HTML. In addition, JTidy provides a
DOM parser for real-world HTML.



%package scripts
License:        BSD 3-Clause
Summary:        HTML syntax checker and pretty printer
Group:          Development/Libraries/Java
Requires:       jpackage-utils >= 1.5
Requires:       %{name} = %{version}

%description scripts
JTidy is a Java port of HTML Tidy, a HTML syntax checker and pretty
printer. Like its non-Java cousin, JTidy can be used as a tool for
cleaning up malformed and faulty HTML. In addition, JTidy provides a
DOM parser for real-world HTML.



%prep
%setup -q -n %{name}
%{__cp} -p %{SOURCE2} %{SOURCE3} %{SOURCE4} .

%build
export MAVEN_REPO_LOCAL=$(pwd)/.m2/repository
mkdir -p $MAVEN_REPO_LOCAL
export ANT_OPTS="-Xss1m"
export CLASSPATH=$(build-classpath junit slf4j xerces-j2 xml-commons-jaxp-1.3-apis):`pwd`/target/classes:`pwd`/target/test-classes
export OPT_JAR_LIST="junit ant/ant-junit"
%{ant} \
    -Dbuild.sysclasspath=only \
    -Dmaven.mode.offline=true \
    -Dmaven.repo.local=$MAVEN_REPO_LOCAL \
    -Dmaven.test.skip=true \
    -Dmaven.test.error.ignore=true \
    package javadoc

%install
# jar
%__mkdir_p %{buildroot}%{_javadir}
%__cp -a target/jtidy-8.0-SNAPSHOT.jar %{buildroot}%{_javadir}/%{name}-%{version}.jar
# jar versioning
(cd %{buildroot}%{_javadir} && for jar in *-%{version}.jar; do %__ln_s ${jar} `echo $jar| %__sed "s|-%{version}||g"`; done)
# javadoc
%__mkdir_p %{buildroot}%{_javadocdir}/%{name}-%{version}
%__cp -a target/site/apidocs/* %{buildroot}%{_javadocdir}/%{name}-%{version}
%__ln_s %{name}-%{version} %{buildroot}%{_javadocdir}/%{name}
# shell script
%__mkdir_p %{buildroot}%{_bindir}
%__install -p -m 0755 %{SOURCE1} %{buildroot}%{_bindir}/%{name}
# ant.d
%__mkdir_p %{buildroot}%{_sysconfdir}/ant.d
%__cat > %{buildroot}%{_sysconfdir}/ant.d/%{name} << EOF
jtidy xerces-j2 xml-commons-jaxp-1.3-apis
EOF

%clean
%__rm -rf %{buildroot}

%files
%defattr(0644,root,root,0755)
%doc LICENSE.txt
%{_javadir}/%{name}.jar
%{_javadir}/%{name}-%{version}.jar
%config(noreplace) %{_sysconfdir}/ant.d/%{name}

%files javadoc
%defattr(0644,root,root,0755)
%{_javadocdir}/%{name}-%{version}
%{_javadocdir}/%{name}

%files scripts
%defattr(0755,root,root,0755)
%{_bindir}/*

%changelog
* Wed May 20 2009 mvyskocil@suse.cz
- 'fixed bnc#501764: removed clover.license from source tarball'
* Thu May 07 2009 mvyskocil@suse.cz
- Initial packaging of 8.0 in SUSE (from jpp 5.0)
openSUSE Build Service is sponsored by