File struts.spec of Package struts

#
# spec file for package struts
#
# Copyright (c) 2014 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

%if 0%{?sle_version} > 150100 || 0%{?rhel}
%define commons_digester apache-commons-digester
%else
%define commons_digester jakarta-commons-digester
%endif

Name:           struts
BuildRequires:  ant-apache-oro
BuildRequires:  ant-apache-regexp
%if 0%{?suse_Version}
BuildRequires:  ant-nodeps
BuildRequires:  ant-trax
%endif
BuildRequires:  antlr
BuildRequires:  javapackages-tools
BuildRequires:  apache-commons-beanutils
BuildRequires:  %{commons_digester}
BuildRequires:  apache-commons-fileupload2-core
BuildRequires:  apache-commons-fileupload2-javax
BuildRequires:  apache-commons-io
BuildRequires:  apache-commons-logging
BuildRequires:  (jakarta-commons-validator or apache-commons-validator)
BuildRequires:  apache-commons-collections
BuildRequires:  (oro or jakarta-oro)
BuildRequires:  servletapi5
BuildRequires:  unzip
%if 0%{?suse_version}
BuildRequires:  update-alternatives
%else
BuildRequires:  chkconfig
%endif
BuildRequires:  xalan-j2
BuildRequires:  java-devel >= 1.6.0
BuildRequires:  fdupes
%define name		struts
%define full_name	jakarta-%{name}
%define version		1.2.9
%define release		2jpp
%define tomcatdir	tomcat
%if 0%{?rhel}
%global tomcatrootdir   %{_datadir}/%{tomcatdir}
%else
%global tomcatrootdir   /srv/%{tomcatdir}
%endif
%global tomcatappsdir  %{tomcatrootdir}/webapps
%define tomcatctxdir   %{_sysconfdir}/%{tomcatdir}/Catalina/localhost
%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:        162.<RELEASE33>
Summary:        Web application framework
License:        Apache-2.0
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
Patch2:         bug-875455_struts-1.2.9-CVE-2014-0114.patch
Patch3:         struts-1.2.9-javac-encoding.patch
Patch4:         fileupload2upgrade.patch
Url:            http://jakarta.apache.org/struts/
Requires:       servlet
Recommends:     jdbc-stdext
Requires:       (apache-commons-beanutils or jakarta-commons-beanutils >= 1.6.1)
Requires:       %{commons_digester} >= 1.5
Requires:       apache-commons-fileupload2-core
Requires:       apache-commons-fileupload2-javax
Requires:       apache-commons-io
Requires:       (apache-commons-validator or jakarta-commons-validator >= 1.0.2)
Requires:       (oro >= 2.0.7 or jakarta-oro)
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.

%prep
rm -rf %{buildroot}
%setup -n %{name}-%{version}-src -q
%patch -P0 -p1
%patch -P1 -p1
%patch -P2 -p1
%patch -P3 -p1
%patch -P4 -p1

%build
%if 0%{?rhel}
export JAVA_HOME=%{_jvmdir}/java-11
%endif

mkdir lib
CLASSPATH=$(build-classpath          \
              xml-commons-apis       \
              jaxp_parser_impl       \
              jaxp_transform_impl    \
              xalan-j2-serializer    \
              glibj                  \
              servletapi5            \
              apache-commons-collections \
              jspapi               ) \
  ant -Dcommons-beanutils.jar=$( build-classpath commons-beanutils  ) \
      -Dcommons-collections.jar=$( build-classpath apache-commons-collections  ) \
      -Dcommons-digester.jar=$(  build-classpath %{commons_digester}   ) \
      -Dcommons-fileupload2-core.jar=$(build-classpath apache-commons-fileupload2-core ) \
      -Dcommons-fileupload2-javax.jar=$(build-classpath apache-commons-fileupload2-javax ) \
      -Dcommons-io.jar=$(build-classpath apache-commons-io) \
      -Dcommons-logging.jar=$(   build-classpath 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 -Dfile.encoding="UTF-8"              \
      compile.library

%install
# jars
install -d -m 755 %{buildroot}%{_javadir}
install -m 644 target/library/%{name}.jar %{buildroot}%{_javadir}/%{name}-%{version}.jar
(cd %{buildroot}%{_javadir} && for jar in *-%{version}*; do ln -sf ${jar} ${jar/-%{version}/}; done)
# data
install -d -m 755 %{buildroot}%{_datadir}/%{name}
install -m 644 target/library/*.tld %{buildroot}%{_datadir}/%{name}
install -m 644 target/library/*.dtd %{buildroot}%{_datadir}/%{name}

%fdupes -s %{buildroot}


%clean
rm -rf %{buildroot}

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

%changelog
openSUSE Build Service is sponsored by