Blob Blame History Raw
# Copyright (c) 2000-2005, JPackage Project
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the
#    distribution.
# 3. Neither the name of the JPackage Project nor the names of its
#    contributors may be used to endorse or promote products derived
#    from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

%define _with_gcj_support 1

%define gcj_support %{?_with_gcj_support:1}%{!?_with_gcj_support:%{?_without_gcj_support:0}%{!?_without_gcj_support:%{?_gcj_support:%{_gcj_support}}%{!?_gcj_support:0}}}

%define with_tests %{?_with_tests:1}%{!?_without_tests:0}

%define base_name  validator
%define short_name commons-%{base_name}
%define section    free

Summary:        Jakarta Commons Validator
Name:           jakarta-%{short_name}
Version:        1.1.4
Release:        6.4%{?dist}
Epoch:          0
License:        ASL 2.0
Group:          Development/Libraries/Java
Source0:        http://www.apache.org/dist/jakarta/commons/validator/source/commons-validator-%{version}-src.tar.gz
Source1:        %{name}.catalog
# FIXME DTDs are not in the source tarball anymore (conf directory missing)
# Obtainable from:
# http://svn.apache.org/repos/asf/jakarta/commons/proper/validator/tags/VALIDATOR_1_1_4/conf/
Source2:        commons-validator-%{version}-conf.tar.gz
Patch1:         jakarta-commons-validator-%{version}-build.patch
URL:            http://jakarta.apache.org/commons/validator/
BuildRequires:  jpackage-utils >= 0:1.5
BuildRequires:  ant >= 1.6.2
BuildRequires:  jakarta-commons-beanutils >= 0:1.5
BuildRequires:  jakarta-commons-collections >= 0:2.1
BuildRequires:  jakarta-commons-digester >= 0:1.3
BuildRequires:  jakarta-commons-logging >= 0:1.0.2
BuildRequires:  oro >= 0:2.0.6
BuildRequires:  junit >= 0:3.7
BuildRequires:  xml-commons-apis
Requires:       jakarta-commons-beanutils >= 0:1.5
Requires:       jakarta-commons-collections >= 0:2.1
Requires:       jakarta-commons-digester >= 0:1.3
Requires:       jakarta-commons-logging >= 0:1.0.2
Requires:       oro >= 0:2.0.6
Requires:       xml-commons-apis
%if ! %{gcj_support}
BuildArch:      noarch
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Provides:       %{short_name}
Obsoletes:      %{short_name}

%if %{gcj_support}
BuildRequires:		java-gcj-compat-devel
Requires(post):		java-gcj-compat
Requires(postun):	java-gcj-compat
%endif

%description
A common issue when receiving data either electronically or from user
input is verifying the integrity of the data. This work is repetitive
and becomes even more complicated when different sets of validation
rules need to be applied to the same set of data based on locale for
example. Error messages may also vary by locale. This package attempts
to address some of these issues and speed development and maintenance
of validation rules.

%package javadoc
Summary:        Javadoc for %{name}
Group:          Development/Documentation
# for /bin/rm and /bin/ln
Requires(post):   coreutils
Requires(postun): coreutils

%description javadoc
Javadoc for %{name}.

# -----------------------------------------------------------------------------

%prep
%setup -q -n %{short_name}-%{version}

# remove all binary libs
find . -name "*.jar" -exec rm -f {} \;

tar xzvf %{SOURCE2}
cp -p %{SOURCE1} conf/share/catalog

%patch1

# -----------------------------------------------------------------------------

%build
export CLASSPATH=$(build-classpath \
xml-commons-apis oro junit jakarta-commons-logging jakarta-commons-digester \
jakarta-commons-beanutils jakarta-commons-collections)

%if %{with_tests}
ant -Dbuild.sysclasspath=first test
%endif

ant -Dbuild.sysclasspath=first dist

# -----------------------------------------------------------------------------

%install
rm -rf $RPM_BUILD_ROOT

# jars
mkdir -p $RPM_BUILD_ROOT%{_javadir}
cp -p dist/%{short_name}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-%{version}.jar
(cd $RPM_BUILD_ROOT%{_javadir} && for jar in *-%{version}*; do ln -sf ${jar} `echo $jar| sed "s|jakarta-||g"`; done)
(cd $RPM_BUILD_ROOT%{_javadir} && for jar in *-%{version}*; do ln -sf ${jar} `echo $jar| sed "s|-%{version}||g"`; done)

# dtds and catalog
mkdir -p $RPM_BUILD_ROOT%{_datadir}/sgml/%{name}
cp -p conf/share/{*.dtd,catalog} $RPM_BUILD_ROOT%{_datadir}/sgml/%{name}

# javadoc
mkdir -p $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
cp -pr dist/docs/api/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}

# -----------------------------------------------------------------------------

%if %{gcj_support}
%{_bindir}/aot-compile-rpm
%endif

%clean
rm -rf $RPM_BUILD_ROOT

# -----------------------------------------------------------------------------

%post
# Note that we're using versioned catalog, so this is always ok.
if [ -x %{_bindir}/install-catalog -a -d %{_sysconfdir}/sgml ]; then
  %{_bindir}/install-catalog --add \
    %{_sysconfdir}/sgml/%{name}-%{version}-%{release}.cat \
    %{_datadir}/sgml/%{name}/catalog > /dev/null || :
fi

%if %{gcj_support}
if [ -x %{_bindir}/rebuild-gcj-db ]
then
  %{_bindir}/rebuild-gcj-db
fi
%endif

%postun
# Note that we're using versioned catalog, so this is always ok.
if [ -x %{_bindir}/install-catalog -a -d %{_sysconfdir}/sgml ]; then
  %{_bindir}/install-catalog --remove \
    %{_sysconfdir}/sgml/%{name}-%{version}-%{release}.cat \
    %{_datadir}/sgml/%{name}/catalog > /dev/null || :
fi

%if %{gcj_support}
if [ -x %{_bindir}/rebuild-gcj-db ]
then
  %{_bindir}/rebuild-gcj-db
fi
%endif

%post javadoc
rm -f %{_javadocdir}/%{name}
ln -s %{name}-%{version} %{_javadocdir}/%{name}

%postun javadoc
if [ "$1" = "0" ]; then
    rm -f %{_javadocdir}/%{name}
fi

# -----------------------------------------------------------------------------

%files
%defattr(0644,root,root,0755)
%doc LICENSE.txt NOTICE.txt
%{_javadir}/*
%{_datadir}/sgml/%{name}

%if %{gcj_support}
%attr(-,root,root) %{_libdir}/gcj/%{name}
%endif

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

# -----------------------------------------------------------------------------

%changelog
* Wed Jul  9 2008 Tom "spot" Callaway <tcallawa@redhat.com> - 0:1.1.4-6.4
- drop repotag

* Thu May 29 2008 Tom "spot" Callaway <tcallawa@redhat.com> - 0:1.1.4-6jpp.3
- fix license tag

* Mon Feb 18 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 0:1.1.4-6jpp.2
- Autorebuild for GCC 4.3

* Thu Sep 20 2007 Deepak Bhole <dbhole at redhat.com> -  0:1.1.4-5jpp.2
- Rebuild

* Fri Aug 18 2006 Deepak Bhole <dbhole at redhat.com> -  0:1.1.4-5jpp.1
- Move rebuild-gcj-db to correct postun section

* Tue Aug 15 2006 Deepak Bhole <dbhole at redhat.com> -  0:1.1.4-4jpp.1
- Added missing post/postun for javadoc.

* Tue Jul 25 2006 Deepak Bhole <dbhole at redhat.com> -  0:1.1.4-3jpp_1fc
- Added conditional native compilation.
- Converted spec file to UTF8.

* Wed Apr 26 2006 Fernando Nasser <fnasser at redhat.com> - 0:1.1.4-2jpp
- First JPP 1.7 build

* Tue Jul 26 2005 Fernando Nasser <fnasser at redhat.com> - 0:1.1.4-1jpp
- Upgrade to 1.1.4

* Tue Sep 07 2004 Fernando Nasser <fnasser at redhat.com> - 0:1.1.3-1jpp
- Upgrade to 1.1.3

* Sun Aug 23 2004 Randy Watler <rwatler at finali.com> - 0:1.0.2-3jpp
- Rebuild with ant-1.6.2

* Fri Apr 18 2003 Ville Skyttä <ville.skytta at iki.fi> - 0:1.0.2-2jpp
- Move DTDs from %%{_datadir}/%{name} to %%{_datadir}/sgml/%%{name} for FHS
  compliance, <http://www.pathname.com/fhs/2.2/fhs-4.11.html#4.11.7>.

* Fri Apr 18 2003 Ville Skyttä <ville.skytta at iki.fi> - 0:1.0.2-1jpp
- Update to 1.0.2 and JPackage 1.5.
- Move DTDs from %%doc to %%{_datadir}/%%{name}.
- Include catalog for DTDs, and install it if %%{_bindir}/install-catalog
  is available.

* Mon Dec 16 2002 Ville Skyttä <ville.skytta at iki.fi> - 1.0.1-1jpp
- 1.0.1.
- Include the DTD in the package (as documentation).

* Sat Nov  2 2002 Ville Skyttä <ville.skytta at iki.fi> - 1.0-1jpp
- 1.0, initial JPackage release.