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_gcj_support 1
%define gcj_support %{?_with_gcj_support:1}%{!?_with_gcj_support:%{?_without_gcj_support:0}%{!?_without_gcj_support:%{?_gcj_support:%{_gcj_support}}%{!?_gcj_support:0}}}

# 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 namedversion 1.0-alpha-7

Name:           maven-doxia
Version:        1.0
Release:        0.1.a7.3jpp.3%{?dist}
Epoch:          0
Summary:        Content generation framework
License:        Apache Software License
Group:          Development/Java
URL:            http://maven.apache.org/doxia/

# svn export http://svn.apache.org/repos/asf/maven/doxia/tags/doxia-1.0-alpha-7/
#       maven-doxia/
# tar czf maven-doxia-1.0.a7-src.tar.gz maven-doxia/
Source0:        %{name}-%{version}a7.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

Patch0:         %{name}-1.4compile.patch

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

%if ! %{gcj_support}
BuildArch:      noarch
%endif

BuildRequires:  jpackage-utils >= 0:1.7.2
BuildRequires:  ant, ant-nodeps
%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
%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(post):   jpackage-utils >= 0:1.7.2
Requires(postun): jpackage-utils >= 0:1.7.2

%if %{gcj_support}
BuildRequires:    java-gcj-compat-devel
Requires(post):   java-gcj-compat
Requires(postun): java-gcj-compat
%endif

%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
Javadoc for %{name}.
%endif

%prep
%setup -q -n %{name}
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

%patch0 -b .sav

%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 project in decoration-model \
                sink-api \
                core \
                site-renderer \
                module-twiki; do

        if [ -f doxia-$project/target/doxia-$project-%{namedversion}.jar ]; then                  install -pm 644 \
                  doxia-$project/target/doxia-$project-%{namedversion}.jar \
                  $RPM_BUILD_ROOT%{_javadir}/%{name}/$project-%{namedversion}.jar
                  %add_to_maven_depmap org.apache.maven.doxia doxia-$project %{namedversion} JPP/maven-doxia $project

        fi

        # Install pom to groupid-artifactid
        install -pm 644 doxia-$project/pom.xml \
          $RPM_BUILD_ROOT/%{_datadir}/maven2/poms/JPP.maven-doxia-$project.pom
done

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

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

%if %{with_maven}
# javadoc
install -d -m 755 $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}

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

        project=`basename $p`
        install -d -m 755 \
          $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}/$project
        cp -pr $project/target/site/apidocs/* \
          $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}/$project

done
ln -s %{name}-%{version} $RPM_BUILD_ROOT%{_javadocdir}/%{name}
%endif

%if %{gcj_support}
%{_bindir}/aot-compile-rpm
%endif

%clean
rm -rf $RPM_BUILD_ROOT

%if %{gcj_support}
%postun
if [ -x %{_bindir}/rebuild-gcj-db ]
then
  %{_bindir}/rebuild-gcj-db
fi
%endif

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

%if %{gcj_support}
%dir %attr(-,root,root) %{_libdir}/gcj/%{name}
%attr(-,root,root) %{_libdir}/gcj/%{name}/core-1.0-alpha-7.jar.*
%attr(-,root,root) %{_libdir}/gcj/%{name}/decoration-model-1.0-alpha-7.jar.*
%attr(-,root,root) %{_libdir}/gcj/%{name}/sink-api-1.0-alpha-7.jar.*
%attr(-,root,root) %{_libdir}/gcj/%{name}/site-renderer-1.0-alpha-7.jar.*
%endif

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

%changelog
* 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