File sitemesh.spec of Package sitemesh
#
# spec file for package sitemesh
#
# Copyright (c) 2013 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/
#
Summary: A web layout and application integration framework
Name: sitemesh
Source9999: version
Version: 2.1
Release: 0.<RELEASE8>
License: Apache-2.0
Group: Development/Libraries/Java
Url: http://www.opensymphony.com/sitemesh/
Source0: %{name}-%{version}-sources.zip
Patch0: sitemesh-2.1-sources-fix-author.patch
Patch1: sitemesh-2.1-jdk11.patch
Patch2: no-velocity.patch
Patch3: javax2jakarta.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: apache-commons-collections
BuildRequires: xerces-j2 junit
BuildRequires: jakarta-servlet >= 6.1.0
BuildRequires: jakarta-pages >= 4.0
BuildRequires: ant-junit
BuildRequires: fdupes
BuildRequires: java-devel
%if 0%{?rhel}
BuildRequires: java-11-openjdk-devel
%endif
BuildRequires: unzip
BuildArch: noarch
%description
SiteMesh is a web-page layout and decoration framework and web-
application integration framework to aid in creating large sites
consisting of many pages for which a consistent look/feel, navigation
and layout scheme is required.
%package javadoc
License: Apache-2.0
Summary: Javadoc for sitemesh
Group: Development/Documentation
%description javadoc
Javadoc for sitemesh.
%prep
mkdir sitemesh
cd sitemesh
unzip %{SOURCE0}
%patch -P0 -p1
%patch -P1 -p0
%patch -P2 -p1
%patch -P3 -p1
# Remove the jars that shipped with it to replace with jpackage jars
rm -Rfv lib/*.jar
build-jar-repository -p lib/ commons-collections xerces-j2 junit jakarta-servlet jakarta-pages
# Remove freemarker dirs, which contain the code that depends on freemarker.
find . -name freemarker -type d | xargs rm -Rfv
%build
cd sitemesh
ls -l lib
%if 0%{?rhel}
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk/
%endif
%if 0%{?suse_version}
ant -Dant.build.javac.source=11 -Dant.build.javac.target=11
%else
ant
%endif
%install
rm -rf $RPM_BUILD_ROOT
# jar
install -d -m 755 $RPM_BUILD_ROOT%{_javadir}
install -m 644 sitemesh/dist/sitemesh-%{version}.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|-%{version}||g"`; done)
# javadoc
install -d -m 755 $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
cp -pr sitemesh/dist/docs/api/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
%fdupes -s $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
%clean
rm -rf $RPM_BUILD_ROOT
%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)
%{_javadir}/*
%files javadoc
%defattr(0644,root,root,0755)
%{_javadocdir}/%{name}-%{version}
%changelog