Blob Blame History Raw
# Copyright (c) 2000-2005, JPackage Project
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the
#    distribution.
# 3. Neither the name of the JPackage Project nor the names of its
#    contributors may be used to endorse or promote products derived
#    from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#

%define with_maven 1

%define namedversion 1.0-alpha-10

Name:           maven-doxia
Version:        1.0
Release:        0.8.a10.1%{?dist}
Epoch:          0
Summary:        Content generation framework
License:        ASL 2.0
Group:          Development/Java
URL:            http://maven.apache.org/doxia/

# svn export http://svn.apache.org/repos/asf/maven/doxia/doxia/tags/doxia-1.0-alpha-10 \
#       maven-doxia/
# tar czf maven-doxia-1.0-a10-src.tar.gz maven-doxia/
Source0:        %{name}-%{version}-a10-src.tar.gz

Source1:        %{name}-decoration-model-build.xml
Source2:        %{name}-core-build.xml
Source3:        %{name}-sink-api-build.xml
Source4:        %{name}-site-renderer-build.xml

# These files are taken from the doxia build itself, done with maven2
# To regenerate, build above tarball with upstream maven
Source5:        %{name}-autogenerated-files.tar.gz

# Build against iText 2.x
# http://jira.codehaus.org/browse/DOXIA-53
Patch0:         %{name}-itext2.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildArch:      noarch

BuildRequires:  java >= 1:1.6.0
BuildRequires:  jpackage-utils >= 0:1.7.2
BuildRequires:  ant, ant-nodeps
BuildRequires:  itext >= 2.1.7-4
BuildRequires:  plexus-cli >= 1.2-8
%if %{with_maven}
BuildRequires:  maven2 >= 0:2.0.4-9
BuildRequires:  maven2-plugin-compiler
BuildRequires:  maven2-plugin-install
BuildRequires:  maven2-plugin-jar
BuildRequires:  maven2-plugin-javadoc
BuildRequires:  maven2-plugin-resources
BuildRequires:  maven2-plugin-site
BuildRequires:  maven2-plugin-surefire
BuildRequires:  plexus-maven-plugin >= 0:1.2-2
BuildRequires:  modello-maven-plugin >= 0:1.0-0.a8.3
BuildRequires:  plexus-xmlrpc >= 0:1.0-0.b4.3
BuildRequires:  tomcat5-servlet-2.4-api
BuildRequires:  tomcat5
%endif
BuildRequires:  classworlds
BuildRequires:  jakarta-commons-collections
BuildRequires:  jakarta-commons-logging
BuildRequires:  jakarta-commons-validator
BuildRequires:  junit
BuildRequires:  oro
BuildRequires:  plexus-container-default
BuildRequires:  plexus-i18n
BuildRequires:  plexus-utils
BuildRequires:  plexus-velocity
BuildRequires:  velocity

Requires:       classworlds
Requires:       jakarta-commons-collections
Requires:       jakarta-commons-logging
Requires:       jakarta-commons-validator
Requires:       junit
Requires:       oro
Requires:       plexus-container-default
Requires:       plexus-i18n
Requires:       plexus-utils
Requires:       plexus-velocity
Requires:       velocity

Requires:         java >= 1:1.6.0
Requires:         jpackage-utils
Requires(post):   jpackage-utils >= 0:1.7.2
Requires(postun): jpackage-utils >= 0:1.7.2

%description
Doxia is a content generation framework which aims to provide its
users with powerful techniques for generating static and dynamic
content. Doxia can be used to generate static sites in addition to
being incorporated into dynamic content generation systems like blogs,
wikis and content management systems.

%if %{with_maven}
%package javadoc
Summary:        Javadoc for %{name}
Group:          Development/Documentation

%description javadoc
API documentation for %{name}.
%endif

%prep
%setup -q -n %{name}
%patch0 -p0

%if ! %{with_maven}
cp -p %{SOURCE1} doxia-decoration-model/build.xml
cp -p %{SOURCE2} doxia-core/build.xml
cp -p %{SOURCE3} doxia-sink-api/build.xml
cp -p %{SOURCE4} doxia-site-renderer/build.xml
%endif

%build
export MAVEN_REPO_LOCAL=$(pwd)/.m2/repository
mkdir -p $MAVEN_REPO_LOCAL

%if %{with_maven}

    mvn-jpp \
        -e \
        -Dmaven.repo.local=$MAVEN_REPO_LOCAL \
        -Dmaven.test.failure.ignore=true \
        install javadoc:javadoc

%else

mkdir lib
build-jar-repository -s -p lib/ \
                        commons-collections \
                        commons-logging-api \
                        classworlds \
                        junit \
                        oro \
                        plexus/container-default \
                        plexus/i18n \
                        plexus/utils \
                        plexus/velocity \
                        velocity

# Extract autogenerated (by maven) files
tar xzf %{SOURCE5}

for project in doxia-decoration-model \
           doxia-sink-api \
           doxia-core \
           doxia-site-renderer; do

       pushd $project

           ant -Dmaven.mode.offline=true -Dmaven.repo.local=$MAVEN_REPO_LOCAL

           # Copy over the jar
           cp -p target/*jar ../lib/$project.jar
       popd
done

%endif

%install
rm -rf $RPM_BUILD_ROOT

# jars/poms
install -d -m 755 $RPM_BUILD_ROOT%{_javadir}/%{name}
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/maven2/poms

for targetdir in `find -type d -name target`; do

    targetdir=`echo $targetdir | sed -e s:^\./::g`

    modulename=`echo $targetdir | awk -F / '{print $(NF-1)}'`
    strippedmodulename=`echo $modulename | sed -e s:^doxia-::g`

    # Does the module have a jar?
    if [ -f $targetdir/$modulename-%{namedversion}.jar ]; then
        cp -p $targetdir/$modulename-%{namedversion}.jar \
                $RPM_BUILD_ROOT%{_javadir}/%{name}/$strippedmodulename-%{namedversion}.jar
    fi


    # Skip parent pom
    if [ ! -z $strippedmodulename ]; then
        cp -p $targetdir/../pom.xml \
                $RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP.%{name}-$strippedmodulename.pom

        %add_to_maven_depmap org.apache.maven.doxia $modulename %{namedversion} JPP/maven-doxia $strippedmodulename
    fi
    
done

# Install parent pom
install -pm 644 pom.xml $RPM_BUILD_ROOT/%{_datadir}/maven2/poms/JPP.maven-doxia-doxia.pom
%add_to_maven_depmap org.apache.maven.doxia doxia %{namedversion} JPP/maven-doxia doxia

# Install parent javadocs
(cd $RPM_BUILD_ROOT%{_javadir}/%{name} && for jar in *-%{namedversion}*; \
  do ln -sf ${jar} `echo $jar| sed  "s|-%{namedversion}||g"`; done)

# javadoc (all javadocs are contained in the main module docs dir used below)
install -d -m 755 $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{namedversion}
cp -pr target/site/apidocs/* \
         $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{namedversion}/
ln -s %{name}-%{namedversion} $RPM_BUILD_ROOT%{_javadocdir}/%{name}


%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%{_javadir}/%{name}
%{_datadir}/maven2
%{_mavendepmapfragdir}

%if %{with_maven}
%files javadoc
%defattr(-,root,root,-)
%doc %{_javadocdir}/*
%endif

%changelog
* Tue Sep 01 2009 Andrew Overholt <overholt@redhat.com> 0:1.0-0.8.a10.1
- Add tomcat5 BR

* Tue Sep 01 2009 Andrew Overholt <overholt@redhat.com> 0:1.0-0.8.a10
- Add tomcat5-servlet-2.4-api BR

* Tue Sep 01 2009 Andrew Overholt <overholt@redhat.com> 0:1.0-0.7.a10
- Fix plexus-cli BR version

* Mon Aug 31 2009 Andrew Overholt <overholt@redhat.com> 0:1.0-0.6.a10
- Add itext and plexus-cli BRs

* Wed Aug 26 2009 Andrew Overholt <overholt@redhat.com> 0:1.0-0.5.a10
- Update to 1.0 alpha 10 courtesy of Deepak Bhole
- Remove gcj support
- Add patch to build against iText 2.x (with back-ported XML classes)

* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0:1.0-0.4.a7.2.10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0:1.0-0.3.a7.2.10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Wed Aug 13 2008 Deepak Bhole <dbhole@redhat.com> 1.0-0.2.a7.2.10
- Fix broken release tag

* Wed Aug 13 2008 Deepak Bhole <dbhole@redhat.com> 1.0-0.2.a7.2.9
- Build for ppc64

* Wed Jul  9 2008 Tom "spot" Callaway <tcallawa@redhat.com> 1.0-0.2.a7.2.8
- drop repotag

* Thu May 29 2008 Tom "spot" Callaway <tcallawa@redhat.com> 1.0-0.2.a7.2jpp.7
- fix license tag

* Thu Feb 28 2008 Deepak Bhole <dbhole@redhat.com> 1.0-0.2.a7.2jpp.6
- Rebuild

* Fri Sep 21 2007 Deepak Bhole <dbhole@redhat.com> 1.0-0.1.a7.3jpp.5
- Build with maven
- ExcludeArch ppc64

* Sat Sep 01 2007 Deepak Bhole <dbhole@redhat.com> 0:1.0-0.1.a7.3jpp.4
- Rebuild without maven (fpr initial ppc build)

* Tue Mar 20 2007 Deepak Bhole <dbhole@redhat.com> 0:1.0-0.1.a7.3jpp.3
- Added switch to ignore failures for the time being

* Tue Mar 20 2007 Deepak Bhole <dbhole@redhat.com> 0:1.0-0.1.a7.3jpp.2
- Build with maven

* Tue Feb 27 2007 Tania Bento <tbento@redhat.com> 0:1.0-0.1.a7.3jpp.1
- Fixed %%Release.
- Fixed %%BuildRoot.
- Removed %%Vendor.
- Removed %%Distribution.
- Removed %%post and %%postun sections for javadoc.
- Fixed instructios on how to generate source drop.
- Fixed %%Summary.
- Added gcj support option.
- Marked configuration file as %%config(noreplace) in %%files section.

* Tue Oct 17 2006 Deepak Bhole <dbhole@redhat.com> 1.0-0.a7.3jpp
- Update for maven2 9jpp

* Fri Jun 23 2006 Deepak Bhole <dbhole@redhat.com> - 0:1.0-0.a7.2jpp
- Fix versions in the depmap

* Wed Mar 15 2006 Deepak Bhole <dbhole@redhat.com> - 0:1.0-0.a7.1jpp
- Initial build