Пакет cometd-dojox-examples: Specfile

Packager: Igor Vlasenko <viy@altlinux.ru>
BuildRequires: /proc
BuildRequires: jpackage-compat
# Copyright (c) 2000-2009, 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 namedversion   1.0.beta4


Name:           cometd-dojox-examples
Version:        1.0
Release:        alt4_6jpp5
Epoch:          0
Summary:        Cometd DojoX Examples
License:        Apache Software License 2.0
Group:          Development/Java
URL:            http://maven.apache.org/
Source0:        %{name}-%{namedversion}.tar.gz
# svn export http://svn.cometd.com/tags/1.0.beta4/cometd-java/ cometd-java-1.0.beta4


Source1:        %{name}-%{version}-build.xml
Source2:        %{name}-%{version}-jpp-depmap.xml
Source3:        %{name}-%{version}-settings.xml
Source4:        cometd-project.pom
Patch0:         cometd-dojox-examples-1.0-pom.patch

BuildArch:      noarch
BuildRequires: jpackage-utils >= 0:1.7.5
BuildRequires: ant >= 0:1.6.5
BuildRequires: maven2-common-poms
BuildRequires: maven2 >= 0:2.0.7
BuildRequires: maven2-plugin-ant
BuildRequires: maven2-plugin-compiler
BuildRequires: maven2-plugin-install
BuildRequires: maven2-plugin-jar
BuildRequires: maven2-plugin-javadoc
BuildRequires: maven2-plugin-source
BuildRequires: maven2-plugin-war
BuildRequires: maven-release
BuildRequires: jakarta-slide-webdavclient
BuildRequires: jetty6-maven2-plugins
BuildRequires: xpp3-minimal

BuildRequires: dojotoolkit

Requires: dojotoolkit

Requires(post): jpackage-utils >= 0:1.7.5
Requires(postun): jpackage-utils >= 0:1.7.5

%description
Cometd DojoX Examples.

%prep
%setup -q -n %{name}-%{namedversion}
cp %{SOURCE1} build.xml
cp %{SOURCE3} settings.xml
sed -i -e "s|<url>__JPP_URL_PLACEHOLDER__</url>|<url>file://`pwd`/.m2/repository</url>|g" settings.xml
sed -i -e "s|<url>__JAVADIR_PLACEHOLDER__</url>|<url>file://`pwd`/external_repo</url>|g" settings.xml
sed -i -e "s|<url>__MAVENREPO_DIR_PLACEHOLDER__</url>|<url>file://`pwd`/.m2/repository</url>|g" settings.xml
%patch0 -b .sav0
mkdir src/main/java
touch src/main/java/nada.java

%build
export MAVEN_REPO_LOCAL=$(pwd)/.m2/repository
mkdir -p $MAVEN_REPO_LOCAL
mkdir -p $MAVEN_REPO_LOCAL/JPP/maven2/default_poms/
cp %{SOURCE4} $MAVEN_REPO_LOCAL/JPP/maven2/default_poms/org.cometd-cometd-project.pom
# maven208hacks
install -Dm644 %{SOURCE4} $MAVEN_REPO_LOCAL/org/cometd/cometd-project/1.0.beta4/cometd-project-1.0.beta4.pom

mkdir external_repo
ln -s %{_javadir} external_repo/JPP

export M2_SETTINGS=$(pwd)/settings.xml

install -D -m644 $(build-classpath dojotoolkit/dojo-war) $MAVEN_REPO_LOCAL/JPP/dojotoolkit/dojo-war.war

mvn-jpp -Dmaven.compile.target=1.5 -Dmaven.javadoc.source=1.5  \
        -e \
        -s $M2_SETTINGS \
        -Dattach=false \
        -Dmaven.test.failure.ignore=true \
        -Dmaven2.jpp.depmap.file=%{SOURCE2} \
        -Dmaven.repo.local=$MAVEN_REPO_LOCAL \
        war:war

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

%add_to_maven_depmap org.cometd cometd-project %{version} JPP cometd-project
install -m 644 %{SOURCE4} $RPM_BUILD_ROOT/%{_datadir}/maven2/poms/JPP-cometd-project.pom

%add_to_maven_depmap org.cometd.dojox cometd-examples %{version} JPP/cometd-dojox-examples cometd-dojox-examples-war
install -m 644 pom.xml $RPM_BUILD_ROOT/%{_datadir}/maven2/poms/JPP.cometd-dojox-examples-cometd-dojox-examples-war.pom

install -m 644 target/cometd-examples-1.0.beta4.war \
               $RPM_BUILD_ROOT%{_javadir}/%{name}/%{name}-war-%{version}.jar

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

%files
%{_javadir}/%{name}
%{_datadir}/maven2/poms/*
%{_mavendepmapfragdir}/*

%changelog
* Thu Sep 30 2010 Igor Vlasenko <viy@altlinux.ru> 0:1.0-alt4_6jpp5
- fixed build with new maven 2.0.8

* Tue Mar 17 2009 Igor Vlasenko <viy@altlinux.ru> 0:1.0-alt3_6jpp5
- fixed build