File xdoclet.spec of Package xdoclet

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


%define with()          %{expand:%%{?with_%{1}:1}%%{!?with_%{1}:0}}
%define without()       %{expand:%%{?with_%{1}:0}%%{!?with_%{1}:1}}
%define bcond_with()    %{expand:%%{?_with_%{1}:%%global with_%{1} 1}}
%define bcond_without() %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}}
%define _with_repolib 1
# If you want repolib package to be built,
# issue the following: 'rpmbuild --with repolib'
%define with_repolib %{?_with_repolib:1}%{!?_with_repolib:0}
%define without_repolib %{!?_with_repolib:1}%{?_with_repolib:0}
%define repo    %{_javadir}/repository.jboss.com
%define repodir %{repo}/xdoclet/1.2.3-brew
%define repodirlib %{repodir}/lib
%define repodirsrc %{repodir}/src
# If you don't want to build with maven, and use straight ant instead,
# give rpmbuild option '--without maven'
%define with_maven %{!?_without_maven:1}%{?_without_maven:0}
%define without_maven %{?_without_maven:1}%{!?_without_maven:0}
%define with_maven 0
%define section free

Name:           xdoclet
Version:        1.2.3
Release:        4
Summary:        XDoclet Attribute Orientated Programming Framework
# BSD-style, see <http://xdoclet.sourceforge.net/xdoclet/licenses/xdoclet-license.html>
License:        BSD
Group:          Development/Libraries/Java
Url:            http://xdoclet.sourceforge.net
Source0:        %{name}-src-%{version}.tar.bz2
Source1:        %{name}-modules-objectweb-4.6.tar.bz2
Source2:        %{name}-component-info.xml
Patch0:         xdoclet-build_xml.patch
Patch1:         xdoclet-XDocletModulesEjbMessages.patch
Patch2:         xdoclet-ant.not-required.patch
Patch3:         xdoclet-WebLogicSubTask.patch
Patch4:         xdoclet-project_xml.patch
Patch5:         xdoclet-AbstractProgramElementTagsHandler.patch
Patch6:         xdoclet-build_docs_xml.patch
Patch7:         xdoclet-maven-plugin-project.patch
Patch8:         xdoclet-maven-plugin-template.patch
BuildRequires:  java-devel >= 1.4.2
BuildRequires:  jpackage-utils >= 1.6
BuildRequires:  ant >= 1.6
BuildRequires:  ant-nodeps
BuildRequires:  ant-trax
%if %{with_maven}
BuildRequires:  maven >= 1.1
%endif
BuildRequires:  junit
BuildRequires:  javacc
BuildRequires:  jrefactory
BuildRequires:  bsf
BuildRequires:  jakarta-commons-collections
BuildRequires:  jakarta-commons-lang
BuildRequires:  jakarta-commons-logging
BuildRequires:  jakarta-commons-net
BuildRequires:  log4j
BuildRequires:  mockobjects
BuildRequires:  struts
BuildRequires:  velocity
BuildRequires:  xalan-j2 >= 2.7.0
BuildRequires:  xml-commons-apis
BuildRequires:  xjavadoc >= 1.1
#%if %{with_repolib}
#BuildRequires:  xjavadoc-repolib >= 1.1
#%endif
Requires:       bsf
Requires:       jakarta-commons-collections
Requires:       jakarta-commons-logging
Requires:       log4j
Requires:       mockobjects
Requires:       velocity
Requires:       xalan-j2 >= 2.7.0
Requires:       xml-commons-apis
Requires:       xjavadoc = 1.1
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
This package contains the XDoclet Attribute Orientated Programming Framework



%package javadoc
License:        BSD
Summary:        XDoclet Javadoc
Group:          Development/Libraries/Java
Requires(post): /bin/rm /bin/ln
Requires(postun): /bin/rm

%description javadoc
This package contains XDoclet javadoc

%package manual
License:        BSD
Summary:        XDoclet Sample Manuals and Documentation
Group:          Development/Libraries/Java

%description manual
This package contains XDoclet documentation



%prep
%setup -q
find . -name "*.jar" | xargs %{__rm}
# Replace JOnAS specific tasks with code blessed by ObjectWeb
# FIXME: (dwalluck) use %%setup here
pushd modules
mv objectweb objectweb.orig
tar xf %{SOURCE1}
popd
for j in xjavadoc-1.1 jrefactory javacc junit bsf commons-collections commons-logging log4j velocity xalan-j2 xjavadoc xml-commons-apis mockobjects-core; do
        ln -s $(build-classpath $j) lib || :
done
#% if %{with_demo}
#for j in servletapi4 struts velocity webwork-migration xwork geronimo-ejb-2.1-api myfaces/myfaces-jsf-api geronimo-jms-1.1-api; do
#        ln -s $(build-classpath $j) samples/lib
#done
#for j in mx4j/mx4j-jmx mx4j/mx4j-tools; do
#        i=$(build-classpath $j)
#        ln -s $(build-classpath $j) samples/lib
#done
#% endif
%patch0 -b .sav
%patch1 -b .sav
%patch2
%patch3 -b .sav
%patch4 -b .sav
%patch5 -b .sav
%patch6 -b .sav
%patch7
%patch8 -b .sav

%build
export CLASSPATH=$(build-classpath xalan-j2-serializer)
export MAVEN_HOME=%{_datadir}/maven
export MAVEN_LOCAL_HOME=$(pwd)/.maven
%if %{with_maven}
ant -Dbuild.sysclasspath=first core modules maven docs l10n
%else
ant -Dbuild.sysclasspath=first core modules docs l10n
%endif
#% if %{with_demo}
# ant samples
#% endif

%install
mkdir -p $RPM_BUILD_ROOT%{_javadir}/%{name}
install -m 644 target/lib/xdoclet*.jar $RPM_BUILD_ROOT%{_javadir}/%{name}
%if %{with_maven}
install -m 644 target/lib/maven-xdoclet*.jar $RPM_BUILD_ROOT%{_javadir}/%{name}
%endif
(cd $RPM_BUILD_ROOT%{_javadir}/%{name} && for jar in *-%{version}.jar; do ln -sf ${jar} `echo $jar| sed "s|-%{version}||g"`; done)
mkdir -p $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
cp -pr target/docs/api/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}
rm -rf target/docs/api
mkdir -p $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
cp -pr target/docs/* $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
ln -s %{name}-%{version} $RPM_BUILD_ROOT%{_javadocdir}/%{name}
#%if %{with_repolib}
#        install -d -m 755 $RPM_BUILD_ROOT%{repodir}
#        install -d -m 755 $RPM_BUILD_ROOT%{repodirlib}
#        install -m 0644 %{SOURCE2} $RPM_BUILD_ROOT%{repodir}/component-info.xml
#        install -d -m 755 $RPM_BUILD_ROOT%{repodirsrc}
#        install -m 0644 %{PATCH1} $RPM_BUILD_ROOT%{repodirsrc}
#        install -m 0644 %{SOURCE0} $RPM_BUILD_ROOT%{repodirsrc}
#        install -m 0644 %{PATCH2} $RPM_BUILD_ROOT%{repodirsrc}
#        install -m 0644 %{PATCH5} $RPM_BUILD_ROOT%{repodirsrc}
#        cp -p $RPM_BUILD_ROOT%{_javadir}/xdoclet/xdoclet-jmx-module.jar $RPM_BUILD_ROOT%{repodirlib}
#        cp -p $RPM_BUILD_ROOT%{_javadir}/xdoclet/xdoclet-web-module.jar $RPM_BUILD_ROOT%{repodirlib}
#        cp -p $RPM_BUILD_ROOT%{_javadir}/xdoclet/xdoclet-java-module.jar $RPM_BUILD_ROOT%{repodirlib}
#        cp -p $RPM_BUILD_ROOT%{_javadir}/xdoclet/xdoclet-portlet-module.jar $RPM_BUILD_ROOT%{repodirlib}
#        cp -p $RPM_BUILD_ROOT%{_javadir}/xdoclet/xdoclet-jboss-module.jar $RPM_BUILD_ROOT%{repodirlib}
#        cp -p $RPM_BUILD_ROOT%{_javadir}/xdoclet/xdoclet.jar $RPM_BUILD_ROOT%{repodirlib}
#        cp -p %{repo}/xjavadoc/1.1-brew/lib/xjavadoc.jar $RPM_BUILD_ROOT%{repodirlib}
#        cp -p $RPM_BUILD_ROOT%{_javadir}/xdoclet/xdoclet-hibernate-module.jar $RPM_BUILD_ROOT%{repodirlib}
#        cp -p $RPM_BUILD_ROOT%{_javadir}/xdoclet/xdoclet-ejb-module.jar $RPM_BUILD_ROOT%{repodirlib}
#        cp -p $RPM_BUILD_ROOT%{_javadir}/xdoclet/xdoclet-xdoclet-module.jar $RPM_BUILD_ROOT%{repodirlib}
#%endif
export NO_BRP_CHECK_BYTECODE_VERSION=true

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(0644,root,root,0755)
%dir %{_javadir}/%{name}
%{_javadir}/%{name}/%{name}*.jar
%doc LICENSE.txt
%if %{with_maven}

%files maven-plugin
%defattr(0644,root,root,0755)
%{_javadir}/%{name}/maven-%{name}*.jar
%endif

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

%files manual
%defattr(0644,root,root,0755)
%doc %{_docdir}/%{name}-%{version}
#%if %{with_repolib}
#%files repolib
#%defattr(0644,root,root,0755)
#%{repodir}
#%dir %{_javadir}/repository.jboss.com/xdoclet
#%dir %{_javadir}/repository.jboss.com
#%endif

%changelog
openSUSE Build Service is sponsored by