File struts.spec of Package struts

#
# spec file for package struts (Version 1.2.9)
#
# 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/
#

# norootforbuild
# icecream 0


Name:           struts
BuildRequires:  ant-apache-oro ant-apache-regexp ant-nodeps ant-trax antlr classpath jakarta-commons-beanutils jakarta-commons-digester jakarta-commons-fileupload jakarta-commons-logging jakarta-commons-validator oro servletapi5 unzip update-alternatives xalan-j2
BuildRequires:  java-1_4_2-gcj-compat-devel
BuildRequires:  fdupes
%define name		struts
%define full_name	jakarta-%{name}
%define version		1.2.9
%define release		2jpp
%define tomcat6dir	tomcat6
#%define tomcat5dir	tomcat55
#%define tomcat3appsdir	%{_localstatedir}/tomcat3/webapps
#%define tomcat4appsdir	%{_localstatedir}/lib/tomcat4/webapps
%define tomcat6appsdir  /srv/%{tomcat6dir}/webapps
%define tomcat6ctxroot  %{_localstatedir}/cache/%{tomcat6dir}/Catalina
%define tomcat6ctxdir   %{tomcat6ctxroot}/localhost
%define tomcat6ctxlink  %{_sysconfdir}/%{tomcat6dir}/Catalina
%define section		free
%define webapps		blank documentation example examples tiles-documentation
%define webapplibs commons-beanutils commons-digester commons-fileupload commons-validator oro struts
%define jdkmajorver 1.4
%define legacyver 1.0
Version:        1.2.9
Release:        273
Summary:        Web application framework
License:        Apache Software License ..
Group:          Development/Libraries/Java
Source0:        struts-1.2.9-src.tar.bz2
Source3:        tomcat5-context-allowlinking.xml
Patch0:         build-webapps.xml-entity-lookup.patch
Patch1:         jakarta-struts-CVE-2008-2025.patch
Url:            http://jakarta.apache.org/struts/
Requires:       servlet
Recommends:     jdbc-stdext
Requires:       jakarta-commons-beanutils >= 1.6.1
Requires:       jakarta-commons-digester >= 1.5
Requires:       jakarta-commons-fileupload >= 1.0
Requires:       jakarta-commons-validator >= 1.0.2
Requires:       oro >= 2.0.7
Group:          Development/Libraries/Java
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
Welcome to the Struts Framework! The goal of this project is to provide
an open source framework useful in building web applications with Java
Servlet and JavaServer Pages (JSP) technology. Struts encourages
application architectures based on the Model-View-Controller (MVC)
design paradigm, colloquially known as Model 2 in discussions on
various servlet and JSP related mailing lists. Struts includes the
following primary areas of functionality: A controller servlet that
dispatches requests to appropriate Action classes provided by the
application developer. JSP custom tag libraries, and associated support
in the controller servlet, that assists developers in creating
interactive form-based applications. Utility classes to support XML
parsing, automatic population of JavaBeans properties based on the Java
reflection APIs, and internationalization of prompts and messages.
Struts is part of the Jakarta Project, sponsored by the Apache Software
Foundation.



%package manual
License:        Apache Software License ..
Summary:        Maual for struts
Group:          Development/Libraries/Java

%description manual
Welcome to the Struts Framework! The goal of this project is to provide
an open source framework useful in building web applications with Java
Servlet and JavaServer Pages (JSP) technology.

This package contains the manual for Struts.



%package javadoc
License:        Apache Software License ..
Summary:        Javadoc for struts
Group:          Development/Libraries/Java

%description javadoc
Welcome to the Struts Framework! The goal of this project is to provide
an open source framework useful in building web applications with Java
Servlet and JavaServer Pages (JSP) technology.

This package contains the javadoc documentation for Struts.



%package webapps-tomcat6
License:        Apache Software License ..
Summary:        Sample struts webapps for tomcat6
Group:          Development/Libraries/Java
Requires:       %{name} = %{version}-%{release}
Requires:       tomcat6
PreReq:         /usr/sbin/useradd, /usr/sbin/groupadd

%description webapps-tomcat6
Welcome to the Struts Framework! The goal of this project is to provide
an open source framework useful in building web applications with Java
Servlet and JavaServer Pages (JSP) technology.

This package contains sample webapps built with Struts for the Jakarta
Tomcat web application server.



%prep
%setup -n %{name}-%{version}-src -q
%patch0 -p1
%patch1 -p1

%build
GC_MAXIMUM_HEAP_SIZE="134217728"
export LC_ALL="en_US.UTF-8"
mkdir lib
CLASSPATH=$(build-classpath          \
              xml-commons-apis       \
              jaxp_parser_impl       \
              jaxp_transform_impl    \
              xalan-j2-serializer    \
              glibj                  \
              servletapi5            \
              jspapi               ) \
  ant -Dcommons-beanutils.jar=$( build-classpath jakarta-commons-beanutils  ) \
      -Dcommons-digester.jar=$(  build-classpath jakarta-commons-digester   ) \
      -Dcommons-fileupload.jar=$(build-classpath jakarta-commons-fileupload ) \
      -Dcommons-logging.jar=$(   build-classpath jakarta-commons-logging    ) \
      -Dcommons-validator.jar=$( build-classpath commons-validator          ) \
      -Djakarta-oro.jar=$(       build-classpath oro                        ) \
      -Dantlr.jar=$(             build-classpath antlr                      ) \
      -Dstruts.el.home=contrib/struts-el                                      \
    all compile.javadoc                

%install
# jars
install -d -m 755 $RPM_BUILD_ROOT%{_javadir}
install -m 644 target/library/%{name}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-%{version}.jar
(cd $RPM_BUILD_ROOT%{_javadir} && for jar in *-%{version}*; do ln -sf ${jar} ${jar/-%{version}/}; done)
# javadoc
install -d -m 755 $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
cp -pr target/documentation/api/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
rm -rf target/documentation/api
# data
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/%{name}
install -m 644 target/library/*.tld $RPM_BUILD_ROOT%{_datadir}/%{name}
install -m 644 target/library/*.dtd $RPM_BUILD_ROOT%{_datadir}/%{name}
## suse: no support for tomcat3. Sorry.
# tomcat 3 webapps
#install -d -m 755 $RPM_BUILD_ROOT%{tomcat3appsdir}
#for webapp in %{webapps}; do
#    cp -pr target/$webapp $RPM_BUILD_ROOT%{tomcat3appsdir}/%{name}-$webapp
#    # tomcat3 doesn't support allowLinking, this might not work
#	# XXX: move to %%post/preun
#	for jar in %{webapplibs}; do
#        (cd $RPM_BUILD_ROOT%{tomcat3appsdir}/%{name}-$webapp/WEB-INF/lib \
#        && ln -sf ../../../../../..%{_javadir}/$jar.jar .)
#	done
#    (cd $RPM_BUILD_ROOT%{tomcat3appsdir}/%{name}-$webapp/WEB-INF \
#    && for tld in ../../../../..%{_datadir}/%{name}/*.tld; do ln -sf $tld `basename $tld`; done)
#done
# suse: no support for tomcat4. sorry.
# tomcat 4 webapps
#install -d -m 755 $RPM_BUILD_ROOT%{tomcat4appsdir}
#for webapp in %{webapps}; do
#    cp -pr target/$webapp $RPM_BUILD_ROOT%{tomcat4appsdir}/%{name}-$webapp
#    cat %{SOURCE2} | sed -e "s/@@@APPNAME@@@/$webapp/g;" > $RPM_BUILD_ROOT%{tomcat4appsdir}/%{name}-$webapp.xml
#	# XXX: move to %%post/preun
#	for jar in %{webapplibs}; do
#        (cd $RPM_BUILD_ROOT%{tomcat4appsdir}/%{name}-$webapp/WEB-INF/lib \
#        && ln -sf ../../../../../../..%{_javadir}/$jar.jar .)
#    done
#    (cd $RPM_BUILD_ROOT%{tomcat4appsdir}/%{name}-$webapp/WEB-INF \
#    && for tld in ../../../../../..%{_datadir}/%{name}/*.tld; do ln -sf $tld `basename $tld`; done)
#done
# tomcat 6 webapps
install -d -m 755 $RPM_BUILD_ROOT%{tomcat6appsdir}
install -d -m 755 $RPM_BUILD_ROOT%{tomcat6ctxdir}
for webapp in %{webapps}; do
    cp -pr target/$webapp $RPM_BUILD_ROOT%{tomcat6appsdir}/%{name}-$webapp
    cat %{SOURCE3} | sed -e "s/@@@APPNAME@@@/$webapp/g;" > $RPM_BUILD_ROOT%{tomcat6ctxdir}/%{name}-$webapp.xml
	# XXX: move to %%post/preun
	for jar in %{webapplibs}; do
        (cd $RPM_BUILD_ROOT%{tomcat6appsdir}/%{name}-$webapp/WEB-INF/lib \
        && ln -sf ../../../../../..%{_javadir}/$jar.jar .)
    done
    (cd $RPM_BUILD_ROOT%{tomcat6appsdir}/%{name}-$webapp/WEB-INF \
    && for tld in ../../../../..%{_datadir}/%{name}/*.tld; do ln -sf $tld `basename $tld`; done)
done
%fdupes -s $RPM_BUILD_ROOT

%posttrans webapps-tomcat6
# restore a /etc/tomcat6/Catalina symlink if not exist
if [ ! -L %{tomcat6ctxlink} ]; then
    rm -rf %{tomcat6ctxlink}
    ln -sf %{tomcat6ctxroot} %{tomcat6ctxlink}
fi

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc INSTALL README
%{_javadir}/*
%{_datadir}/%{name}

%files manual
%defattr(-,root,root)
%doc target/documentation/*.html
%doc target/documentation/*.gif
%doc target/documentation/uml
%doc target/documentation/userGuide
%doc target/documentation/images

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

%files webapps-tomcat6
%defattr(-,tomcat,tomcat)
%dir /srv/%{tomcat6dir}
%dir /srv/%{tomcat6dir}/webapps
%{tomcat6appsdir}/%{name}-blank
%{tomcat6appsdir}/%{name}-documentation
%{tomcat6appsdir}/%{name}-example
%{tomcat6appsdir}/%{name}-examples
%{tomcat6appsdir}/%{name}-tiles-documentation
%{tomcat6ctxdir}/%{name}-*.xml
%{_localstatedir}/cache/tomcat6

%changelog
openSUSE Build Service is sponsored by