File jakarta-commons-el.spec of Package jakarta-commons-el

#
# spec file for package jakarta-commons-el
#
# Copyright (c) 2012 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/
#

# norootforbuild


Name:           jakarta-commons-el
BuildRequires:  ant java2-devel-packages junit log4j servletapi5
%define base_name       el
%define short_name      commons-%{base_name}
%define name            jakarta-%{short_name}
%define section         free
Version:        1.0
Release:        324
Summary:        The Jakarta Commons Extension Language
License:        Apache-2.0
Group:          Development/Libraries/Java
Url:            http://jakarta.apache.org/commons/el/
Source0:        http://archive.apache.org/dist/jakarta/commons/el/source/commons-el-%{version}-src.tar.gz
Patch0:         %{short_name}-%{version}-license.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
Provides:       %{short_name} = %{version}

%description
An implementation of standard interfaces and abstract classes for
javax.servlet.jsp.el, which is part of the JSP 2.0 specification.



%package        javadoc
License:        Apache-2.0
PreReq:         coreutils
Summary:        Javadoc for jakarta-commons-el
Group:          Development/Libraries/Java
Provides:       %{short_name}-javadoc = %{version}

%description    javadoc
An implementation of standard interfaces and abstract classes for
javax.servlet.jsp.el which is part of the JSP 2.0 specification.

This package contains the javadoc documentation for the Jakarta Commons
Extension Language.



%prep
%setup -q -n %{short_name}-%{version}-src
%patch0 -p1 -b .license
# remove all precompiled stuff
find . -type f -name "*.jar" -exec rm -f {} \;
cat > build.properties <<EOBP
build.compiler=modern
junit.jar=$(build-classpath junit)
servlet-api.jar=$(build-classpath servletapi5)
jsp-api.jar=$(build-classpath jspapi)
servletapi.build.notrequired=true
jspapi.build.notrequired=true
EOBP

%build
if ! grep -q "javac.*source=" build.xml ; then
  perl -p -i -e 's|<javac |<javac source=\"1.4\" |' build.xml
  perl -p -i -e 's|<javadoc |<javadoc source=\"1.4\" |' build.xml
fi
ant \
  -Dfinal.name=%{short_name} \
  -Dj2se.javadoc=%{_javadocdir}/java \
  jar javadoc

%install
# 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)
# javadoc
mkdir -p $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
cp -pr dist/docs/api/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
ln -s %{name}-%{version} $RPM_BUILD_ROOT%{_javadocdir}/%{name} # ghost symlink

%clean
rm -rf $RPM_BUILD_ROOT

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

%files
%defattr(0644,root,root,0755)
%doc LICENSE.txt STATUS.html
%{_javadir}/*

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

%changelog
openSUSE Build Service is sponsored by