1 |
# Copyright (c) 2000-2007, JPackage Project |
2 |
# All rights reserved. |
3 |
# |
4 |
# Redistribution and use in source and binary forms, with or without |
5 |
# modification, are permitted provided that the following conditions |
6 |
# are met: |
7 |
# |
8 |
# 1. Redistributions of source code must retain the above copyright |
9 |
# notice, this list of conditions and the following disclaimer. |
10 |
# 2. Redistributions in binary form must reproduce the above copyright |
11 |
# notice, this list of conditions and the following disclaimer in the |
12 |
# documentation and/or other materials provided with the |
13 |
# distribution. |
14 |
# 3. Neither the name of the JPackage Project nor the names of its |
15 |
# contributors may be used to endorse or promote products derived |
16 |
# from this software without specific prior written permission. |
17 |
# |
18 |
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
19 |
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
20 |
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
21 |
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
22 |
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
23 |
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
24 |
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
25 |
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
26 |
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
27 |
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
28 |
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 |
# |
30 |
|
31 |
%define _with_gcj_support 1 |
32 |
%define gcj_support %{?_with_gcj_support:1}%{!?_with_gcj_support:%{?_without_gcj_support:0}%{!?_without_gcj_support:%{?_gcj_support:%{_gcj_support}}%{!?_gcj_support:0}}} |
33 |
|
34 |
# If you don't want to build with maven, and use straight ant instead, |
35 |
# give rpmbuild option '--without maven' |
36 |
|
37 |
%define _without_maven 1 |
38 |
%define with_maven %{!?_without_maven:1}%{?_without_maven:0} |
39 |
%define without_maven %{?_without_maven:1}%{!?_without_maven:0} |
40 |
|
41 |
%define base_name portlet-1.0-api |
42 |
|
43 |
%define section free |
44 |
|
45 |
Name: apache-portlet-1.0-api |
46 |
Version: 1.0 |
47 |
Release: %mkrel 6 |
48 |
Epoch: 0 |
49 |
Summary: Portlet API 1.0 from Jetspeed2 |
50 |
License: Apache License |
51 |
Url: http://portals.apache.org/jetspeed-2/ |
52 |
Group: Development/Java |
53 |
Source0: apache-portlet-1.0-api.tar.gz |
54 |
# svn export http://svn.apache.org/repos/asf/portals/jetspeed-2/tags/JETSPEED-RELEASE-2.0/portlet-api/ |
55 |
Source1: apache-portlet-1.0-api-pom.xml |
56 |
Source2: apache-portlet-1.0-api-LICENSE.TXT |
57 |
Source3: apache-portlet-1.0-api-build.xml |
58 |
BuildRequires: java-rpmbuild >= 0:1.7.2 |
59 |
BuildRequires: java-devel >= 0:1.4 |
60 |
BuildRequires: ant >= 0:1.6 |
61 |
%if %{with_maven} |
62 |
BuildRequires: maven2 >= 2.0.4-9 |
63 |
BuildRequires: maven2-plugin-compiler |
64 |
BuildRequires: maven2-plugin-install |
65 |
BuildRequires: maven2-plugin-jar |
66 |
BuildRequires: maven2-plugin-javadoc |
67 |
BuildRequires: maven2-plugin-release |
68 |
BuildRequires: maven2-plugin-resources |
69 |
BuildRequires: maven2-plugin-surefire |
70 |
%endif |
71 |
Requires(post): jpackage-utils >= 0:1.7.2 |
72 |
Requires(postun): jpackage-utils >= 0:1.7.2 |
73 |
|
74 |
Provides: portlet = %{epoch}:%{version} |
75 |
Provides: portlet-1.0-api = %{epoch}:%{version} |
76 |
|
77 |
%if ! %{gcj_support} |
78 |
BuildArch: noarch |
79 |
%endif |
80 |
BuildRoot: %{_tmppath}/%{name}-%{version}-buildroot |
81 |
%if %{gcj_support} |
82 |
BuildRequires: java-gcj-compat-devel |
83 |
%endif |
84 |
|
85 |
%description |
86 |
Java Standard Portlet API accoring to JSR-168, from Jetspeed-2 |
87 |
|
88 |
%prep |
89 |
%setup -q -n %{name} |
90 |
# remove all binary libs |
91 |
find . -name "*.jar" -exec rm -f {} \; |
92 |
cp %{SOURCE1} pom.xml |
93 |
cp %{SOURCE3} build.xml |
94 |
|
95 |
|
96 |
%build |
97 |
%if %{with_maven} |
98 |
export MAVEN_REPO_LOCAL=$(pwd)/.m2/repository |
99 |
mvn-jpp -e \ |
100 |
-Dmaven.repo.local=$MAVEN_REPO_LOCAL \ |
101 |
install javadoc:javadoc |
102 |
%else |
103 |
export CLASSPATH= |
104 |
%{ant} jar javadoc |
105 |
%endif |
106 |
|
107 |
%install |
108 |
rm -rf $RPM_BUILD_ROOT |
109 |
install -d -m 755 $RPM_BUILD_ROOT%{_javadir} |
110 |
|
111 |
install -m 0644 target/portlet-api-1.0.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-%{version}.jar |
112 |
(cd $RPM_BUILD_ROOT%{_javadir} && ln -sf %{name}-%{version}.jar %{base_name}-%{version}.jar) |
113 |
|
114 |
%add_to_maven_depmap javax.portlet portlet-api 1.0 JPP %{base_name} |
115 |
# create unversioned symlinks |
116 |
(cd $RPM_BUILD_ROOT%{_javadir} && for jar in *-%{version}.jar; do ln -sf ${jar} $(echo $jar | sed -e 's+-%{version}\.jar+.jar+'); done) |
117 |
|
118 |
#poms |
119 |
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/maven2/poms |
120 |
install -pm 644 pom.xml $RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP.portlet-api.pom |
121 |
|
122 |
install -d -m 755 $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version} |
123 |
cp -pr target/site/apidocs/* \ |
124 |
$RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version} |
125 |
ln -s %{name}-%{version} $RPM_BUILD_ROOT%{_javadocdir}/%{name} # ghost symlink |
126 |
|
127 |
install -d -m 755 $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version} |
128 |
cp %{SOURCE2} $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}/LICENSE.TXT |
129 |
|
130 |
%if %{gcj_support} |
131 |
%{_bindir}/aot-compile-rpm |
132 |
%endif |
133 |
|
134 |
%clean |
135 |
rm -rf $RPM_BUILD_ROOT |
136 |
|
137 |
%post |
138 |
%update_maven_depmap |
139 |
%if %{gcj_support} |
140 |
%{update_gcjdb} |
141 |
%endif |
142 |
|
143 |
%postun |
144 |
%update_maven_depmap |
145 |
%if %{gcj_support} |
146 |
%{clean_gcjdb} |
147 |
%endif |
148 |
|
149 |
%files |
150 |
%defattr(0644,root,root,0755) |
151 |
%doc %{_docdir}/%{name}-%{version}/LICENSE.TXT |
152 |
%{_javadir}/%{name}*.jar |
153 |
%{_javadir}/%{base_name}*.jar |
154 |
%{_datadir}/maven2 |
155 |
%config(noreplace) %{_mavendepmapfragdir}/* |
156 |
%if %{gcj_support} |
157 |
%dir %{_libdir}/gcj/%{name} |
158 |
%attr(-,root,root) %{_libdir}/gcj/%{name}/%{name}-%{version}.jar.* |
159 |
%endif |
160 |
|