Package openjpa: Specfile

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
Packager: Igor Vlasenko <viy@altlinux.ru>
%define _without_maven 1
BuildRequires: /proc
BuildRequires: jpackage-1.5.0-compat
# Copyright (c) 2000-2008, 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 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}

## If you don't want to wait for tests
## give rpmbuild option '--without tests'

%define with_tests %{!?_without_tests:1}%{?_without_tests:0}
%define without_tests %{?_without_tests:1}%{!?_without_tests:0}


Name:           openjpa
Version:        1.0.2
Release:        alt5_1jpp5
Epoch:          0
Summary:        Apache OpenJPA
License:        Apache License 2.0
Url:            http://openjpa.apache.org/
Group:          Development/Java
Source0:        http://www.apache.org/dist/openjpa/1.0.2/apache-openjpa-1.0.2-source.zip
Source1:        %{name}-settings.xml
Source2:        %{name}-%{version}-jpp-depmap.xml
Source3:        %{name}-autogenerated-files.tar.gz
Source4:        %{name}-autogenerated-files-notests.tar.gz
Patch0:         openjpa-1.0.2-TestSQLDateId.patch
Patch1:         openjpa-1.0.2-TestSQLBigDecimalId.patch 
Patch2:         openjpa-1.0.2-TestSQLBigIntegerId.patch
Patch3:         openjpa-1.0.2-pom.patch
Patch4:         openjpa-1.0.2-project-pom.patch
Patch5:         openjpa-1.0.2-site_xml.patch

BuildRequires: jpackage-utils >= 0:1.7.4
BuildRequires: ant >= 0:1.6.5
BuildRequires: ant-nodeps
BuildRequires: ant-junit
BuildRequires: junit
BuildRequires: derby
BuildRequires: hsqldb
BuildRequires: javacc
%if %{with_maven}
BuildRequires: docbkx
BuildRequires: docbook-xml
BuildRequires: maven2-common-poms
BuildRequires: maven2 >= 0:2.0.7
BuildRequires: maven2-default-skin
BuildRequires: maven2-plugin-ant
BuildRequires: maven2-plugin-antrun
BuildRequires: maven2-plugin-compiler
BuildRequires: maven2-plugin-idea
BuildRequires: maven2-plugin-install
BuildRequires: maven2-plugin-jar
BuildRequires: maven2-plugin-javadoc
BuildRequires: maven2-plugin-jxr
BuildRequires: maven2-plugin-pmd
BuildRequires: maven2-plugin-project-info-reports
BuildRequires: maven2-plugin-resources
BuildRequires: maven2-plugin-site
BuildRequires: maven-surefire-plugin
BuildRequires: maven2-plugin-surefire-report
BuildRequires: mojo-maven2-plugin-cobertura
BuildRequires: mojo-maven2-plugin-javacc
BuildRequires: mojo-maven2-plugin-taglist
BuildRequires: jetty6-maven2-plugins
%endif


BuildRequires: jakarta-commons-collections
BuildRequires: jakarta-commons-dbcp
BuildRequires: jakarta-commons-lang
BuildRequires: jakarta-commons-logging
BuildRequires: jakarta-commons-pool
BuildRequires: jaxb_2_1_api
BuildRequires: jms_1_1_api
BuildRequires: jpa_3_0_api
BuildRequires: jta_1_1_api
BuildRequires: log4j
BuildRequires: regexp
BuildRequires: serp
BuildRequires: stax_1_0_api

Requires: hsqldb
Requires: jakarta-commons-collections
Requires: jakarta-commons-dbcp
Requires: jakarta-commons-lang
Requires: jakarta-commons-logging
Requires: jakarta-commons-pool
Requires: jaxb_2_1_api
Requires: jms_1_1_api
Requires: jpa_3_0_api
Requires: jta_1_1_api
Requires: log4j
Requires: regexp
Requires: serp
Requires: stax_1_0_api

BuildArch:      noarch

%description
Apache OpenJPA, a Java EE persistence project of the Apache
Software Foundation. It is a feature-rich implementation of
the persistence part of Enterprise Java Beans 3.0, also known 
as the Java Persistence API (JPA), and is available under the 
terms of the Apache Software License. OpenJPA can be used as 
a stand-alone POJO persistence layer, or it can be integrated 
into any EJB3.0 compliant container and many lightweight frameworks.

%package javadoc
Summary:        Javadoc for %{name}
Group:          Development/Documentation
BuildArch: noarch

%description javadoc
%{summary}.

%if %{with_maven}
%package manual
Summary:        Documents for %{name}
Group:          Development/Documentation
BuildArch: noarch

%description manual
%{summary}.
%endif

%prep
%setup -q -n apache-%{name}-%{version}-source
#find . -name "*.jar" -exec rm -f {} \;
for j in $(find . -name "*.jar"); do
    mv $j $j.no
done
%if %{without_maven}
%if %{with_tests}
gzip -dc %{SOURCE3} | tar xf -
%else
gzip -dc %{SOURCE4} | tar xf -
%endif
%endif

%patch0 -b .sav0
%patch1 -b .sav1
%patch2 -b .sav2
%patch3 -b .sav3
%patch4 -b .sav4
%patch5 -b .sav5

sed -i -e 's,target="1.4",target="1.5",g' */*.xml
sed -i -e 's,source="1.4",source="1.5",g' */*.xml

cp %{SOURCE1} 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

cp src/site/site.xml openjpa-project/src/site

%build

%if %{with_maven}
export MAVEN_REPO_LOCAL=$(pwd)/.m2/repository
mkdir -p $MAVEN_REPO_LOCAL/org/apache/maven/skins/maven-default-skin/1.1/
ln -sf $(build-classpath maven2/default-skin) $MAVEN_REPO_LOCAL/org/apache/maven/skins/maven-default-skin/1.1/maven-default-skin-1.1.jar

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

export M2_SETTINGS=$(pwd)/settings.xml
mvn-jpp -Dmaven.compile.target=1.5 -Dmaven.javadoc.source=1.5  \
        -e \
        -s $M2_SETTINGS \
%if %{with_tests}
        -P test-derby \
%else
        -Dtest=false \
%endif
        -Dmaven.test.failure.ignore=true \
        -Dmaven2.jpp.depmap.file=%{SOURCE2} \
        -Dmaven.repo.local=$MAVEN_REPO_LOCAL \
        install
mvn-jpp -Dmaven.compile.target=1.5 -Dmaven.javadoc.source=1.5  \
        -e \
        -s $M2_SETTINGS \
        -Pjavadoc-profile \
        -Dtest=false \
        -Dmaven2.jpp.depmap.file=%{SOURCE2} \
        -Dmaven.repo.local=$MAVEN_REPO_LOCAL \
        javadoc:javadoc site
export MAVEN_OPTS="-Xmx512m"
mvn-jpp -Dmaven.compile.target=1.5 -Dmaven.javadoc.source=1.5  \
        -e \
        -s $M2_SETTINGS \
        -Pdocbook-profile \
        -Dtest=false \
        -Dmaven2.jpp.depmap.file=%{SOURCE2} \
        -Dmaven.repo.local=$MAVEN_REPO_LOCAL \
        process-resources

%else
#[INFO] Reactor build order:
#[INFO]   OpenJPA
#[INFO]   OpenJPA Utilities
#[INFO]   OpenJPA Kernel
#[INFO]   OpenJPA JDBC
#[INFO]   OpenJPA XML Store
#[INFO]   OpenJPA JDBC 1.5
#[INFO]   OpenJPA Utilities 1.5
#[INFO]   OpenJPA Kernel 1.5
#[INFO]   OpenJPA JPA
#[INFO]   OpenJPA JPA JDBC
#[INFO]   OpenJPA Aggregate Jar
#[INFO]   OpenJPA Distribution
#[INFO]   OpenJPA Integration Tests
#[INFO]   OpenJPA Examples Integration Tests
#[INFO]   OpenJPA JPA TCK Integration Tests
#[INFO]   OpenJPA Persistence Examples

export OPT_JAR_LIST="ant/ant-nodep ant/ant-junit junit"
export CLASSPATH=$(build-classpath \
commons-collections \
commons-lang \
commons-logging \
log4j \
regexp \
serp \
)
CLASSPATH=$CLASSPATH:target/classes:target/test-classes
pushd openjpa-lib
ant -Dant.build.javac.source=1.5 -Dant.build.javac.target=1.5 -Dmaven.settings.offline=true -Dbuild.sysclasspath=only jar javadoc
popd
export CLASSPATH=$(build-classpath \
commons-collections \
commons-lang \
commons-pool \
jms_1_1_api \
jta_1_1_api \
regexp \
serp \
)
CLASSPATH=$CLASSPATH:$(pwd)/openjpa-lib/target/openjpa-lib-%{version}.jar
CLASSPATH=$CLASSPATH:target/classes:target/test-classes
pushd openjpa-kernel
jjtree -BUILD_NODE_FILES=false -OUTPUT_DIRECTORY=target/generated-sources/jjtree/org/apache/openjpa/kernel/jpql/ src/main/jjtree/org/apache/openjpa/kernel/jpql/JPQL.jjt 
javacc -OUTPUT_DIRECTORY=target/generated-sources/javacc/org/apache/openjpa/kernel/jpql/ target/generated-sources/jjtree/org/apache/openjpa/kernel/jpql/JPQL.jj 
rm target/generated-sources/javacc/org/apache/openjpa/kernel/jpql/ParseException.java
ant -Dant.build.javac.source=1.5 -Dant.build.javac.target=1.5 -Dmaven.settings.offline=true -Dbuild.sysclasspath=only jar
$JAVA_HOME/bin/java org.apache.openjpa.ee.WASManagedRuntime
$JAVA_HOME/bin/java org.apache.openjpa.util.ProxyManagerImpl -utils 5
ant -Dant.build.javac.source=1.5 -Dant.build.javac.target=1.5 -Dmaven.settings.offline=true -Dbuild.sysclasspath=only jar javadoc
popd
export CLASSPATH=$(build-classpath \
commons-collections \
commons-lang \
hsqldb \
jta_1_1_api \
serp \
)
CLASSPATH=$CLASSPATH:$(pwd)/openjpa-lib/target/openjpa-lib-%{version}.jar
CLASSPATH=$CLASSPATH:$(pwd)/openjpa-kernel/target/openjpa-kernel-%{version}.jar
CLASSPATH=$CLASSPATH:target/classes:target/test-classes
pushd openjpa-jdbc
ant -Dant.build.javac.source=1.5 -Dant.build.javac.target=1.5 -Dmaven.settings.offline=true -Dbuild.sysclasspath=only jar javadoc
popd
export CLASSPATH=$(build-classpath \
commons-collections \
serp \
)
CLASSPATH=$CLASSPATH:$(pwd)/openjpa-lib/target/openjpa-lib-%{version}.jar
CLASSPATH=$CLASSPATH:$(pwd)/openjpa-kernel/target/openjpa-kernel-%{version}.jar
CLASSPATH=$CLASSPATH:$(pwd)/openjpa-jdbc/target/openjpa-jdbc-%{version}.jar
CLASSPATH=$CLASSPATH:target/classes:target/test-classes
pushd openjpa-xmlstore
ant -Dant.build.javac.source=1.5 -Dant.build.javac.target=1.5 -Dmaven.settings.offline=true -Dbuild.sysclasspath=only jar javadoc
popd
export CLASSPATH=$(build-classpath \
commons-collections \
jaxb_2_1_api \
stax_1_0_api \
)
CLASSPATH=$CLASSPATH:$(pwd)/openjpa-lib/target/openjpa-lib-%{version}.jar
CLASSPATH=$CLASSPATH:$(pwd)/openjpa-kernel/target/openjpa-kernel-%{version}.jar
CLASSPATH=$CLASSPATH:$(pwd)/openjpa-jdbc/target/openjpa-jdbc-%{version}.jar
CLASSPATH=$CLASSPATH:target/classes:target/test-classes
pushd openjpa-jdbc-5
ant -Dant.build.javac.source=1.5 -Dant.build.javac.target=1.5 -Dmaven.settings.offline=true -Dbuild.sysclasspath=only jar javadoc
popd
export CLASSPATH=$(build-classpath \
serp \
)
CLASSPATH=$CLASSPATH:$(pwd)/openjpa-lib/target/openjpa-lib-%{version}.jar
CLASSPATH=$CLASSPATH:target/classes:target/test-classes
pushd openjpa-lib-5
ant -Dant.build.javac.source=1.5 -Dant.build.javac.target=1.5 -Dmaven.settings.offline=true -Dbuild.sysclasspath=only jar javadoc
popd
export CLASSPATH=$(build-classpath \
commons-collections \
serp \
)
CLASSPATH=$CLASSPATH:$(pwd)/openjpa-lib/target/openjpa-lib-%{version}.jar
CLASSPATH=$CLASSPATH:$(pwd)/openjpa-kernel/target/openjpa-kernel-%{version}.jar
CLASSPATH=$CLASSPATH:$(pwd)/openjpa-jdbc/target/openjpa-jdbc-%{version}.jar
CLASSPATH=$CLASSPATH:target/classes:target/test-classes
pushd openjpa-kernel-5
ant -Dant.build.javac.source=1.5 -Dant.build.javac.target=1.5 -Dmaven.settings.offline=true -Dbuild.sysclasspath=only jar javadoc
popd
export CLASSPATH=$(build-classpath \
commons-collections \
commons-lang \
jpa_3_0_api \
jta_1_1_api \
serp \
)
CLASSPATH=$CLASSPATH:$(pwd)/openjpa-lib/target/openjpa-lib-%{version}.jar
CLASSPATH=$CLASSPATH:$(pwd)/openjpa-kernel/target/openjpa-kernel-%{version}.jar
CLASSPATH=$CLASSPATH:$(pwd)/openjpa-jdbc/target/openjpa-jdbc-%{version}.jar
CLASSPATH=$CLASSPATH:$(pwd)/openjpa-lib-5/target/openjpa-lib-5-%{version}.jar
CLASSPATH=$CLASSPATH:$(pwd)/openjpa-kernel-5/target/openjpa-kernel-5-%{version}.jar
CLASSPATH=$CLASSPATH:$(pwd)/openjpa-jdbc-5/target/openjpa-jdbc-5-%{version}.jar
CLASSPATH=$CLASSPATH:target/classes:target/test-classes
pushd openjpa-persistence
ant -Dant.build.javac.source=1.5 -Dant.build.javac.target=1.5 -Dmaven.settings.offline=true -Dbuild.sysclasspath=only jar javadoc
popd
export CLASSPATH=$(build-classpath \
commons-collections \
commons-dbcp \
commons-lang \
commons-pool \
derby/derby \
jaxb_2_1_api \
jpa_3_0_api \
jta_1_1_api \
log4j \
serp \
stax_1_0_api \
)
CLASSPATH=$CLASSPATH:$(pwd)/openjpa-lib/target/openjpa-lib-%{version}.jar
CLASSPATH=$CLASSPATH:$(pwd)/openjpa-kernel/target/openjpa-kernel-%{version}.jar
CLASSPATH=$CLASSPATH:$(pwd)/openjpa-jdbc/target/openjpa-jdbc-%{version}.jar
CLASSPATH=$CLASSPATH:$(pwd)/openjpa-lib-5/target/openjpa-lib-5-%{version}.jar
CLASSPATH=$CLASSPATH:$(pwd)/openjpa-kernel-5/target/openjpa-kernel-5-%{version}.jar
CLASSPATH=$CLASSPATH:$(pwd)/openjpa-jdbc-5/target/openjpa-jdbc-5-%{version}.jar
CLASSPATH=$CLASSPATH:$(pwd)/openjpa-persistence/target/openjpa-persistence-%{version}.jar
CLASSPATH=$CLASSPATH:target/classes:target/test-classes
pushd openjpa-persistence-jdbc
ant -Dant.build.javac.source=1.5 -Dant.build.javac.target=1.5 -Dmaven.settings.offline=true -Dbuild.sysclasspath=only jar javadoc
popd
export CLASSPATH=
pushd openjpa-all
ant -Dant.build.javac.source=1.5 -Dant.build.javac.target=1.5 -Dmaven.settings.offline=true -Dbuild.sysclasspath=only 
popd
export CLASSPATH=$(build-classpath \
commons-collections \
jpa_3_0_api \
)
CLASSPATH=$CLASSPATH:$(pwd)/openjpa-kernel/target/openjpa-kernel-%{version}.jar
CLASSPATH=$CLASSPATH:$(pwd)/openjpa-jdbc/target/openjpa-jdbc-%{version}.jar
CLASSPATH=$CLASSPATH:target/classes:target/test-classes
pushd openjpa-examples
ant -Dant.build.javac.source=1.5 -Dant.build.javac.target=1.5 -Dmaven.settings.offline=true -Dbuild.sysclasspath=only jar javadoc
popd

%endif

%install

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

%add_to_maven_depmap org.apache.openjpa %{name}-parent %{version} JPP/%{name} parent
install -m 644 pom.xml $RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP.%{name}-parent.pom

install -m 644 %{name}-all/target/%{name}-%{version}.jar \
           $RPM_BUILD_ROOT%{_javadir}/%{name}/all-%{version}.jar
%add_to_maven_depmap org.apache.openjpa %{name} %{version} JPP/%{name} all
install -m 644 %{name}-all/pom.xml $RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP.%{name}-all.pom

install -m 644 %{name}-jdbc-5/target/%{name}-jdbc-5-%{version}.jar \
           $RPM_BUILD_ROOT%{_javadir}/%{name}/jdbc-5-%{version}.jar
%add_to_maven_depmap org.apache.openjpa %{name}-jdbc-5 %{version} JPP/%{name} jdbc-5
install -m 644 %{name}-jdbc-5/pom.xml $RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP.%{name}-jdbc-5.pom

install -m 644 %{name}-jdbc/target/%{name}-jdbc-%{version}.jar \
           $RPM_BUILD_ROOT%{_javadir}/%{name}/jdbc-%{version}.jar
%add_to_maven_depmap org.apache.openjpa %{name}-jdbc %{version} JPP/%{name} jdbc
install -m 644 %{name}-jdbc/pom.xml $RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP.%{name}-jdbc.pom

install -m 644 %{name}-kernel-5/target/%{name}-kernel-5-%{version}.jar \
           $RPM_BUILD_ROOT%{_javadir}/%{name}/kernel-5-%{version}.jar
%add_to_maven_depmap org.apache.openjpa %{name}-kernel-5 %{version} JPP/%{name} kernel-5
install -m 644 %{name}-kernel-5/pom.xml $RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP.%{name}-kernel-5.pom

install -m 644 %{name}-kernel/target/%{name}-kernel-%{version}.jar \
           $RPM_BUILD_ROOT%{_javadir}/%{name}/kernel-%{version}.jar
%add_to_maven_depmap org.apache.openjpa %{name}-kernel %{version} JPP/%{name} kernel
install -m 644 %{name}-kernel/pom.xml $RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP.%{name}-kernel.pom

install -m 644 %{name}-lib-5/target/%{name}-lib-5-%{version}.jar \
           $RPM_BUILD_ROOT%{_javadir}/%{name}/lib-5-%{version}.jar
%add_to_maven_depmap org.apache.openjpa %{name}-lib-5 %{version} JPP/%{name} lib-5
install -m 644 %{name}-lib-5/pom.xml $RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP.%{name}-lib-5.pom

install -m 644 %{name}-lib/target/%{name}-lib-%{version}.jar \
           $RPM_BUILD_ROOT%{_javadir}/%{name}/lib-%{version}.jar
%add_to_maven_depmap org.apache.openjpa %{name}-lib %{version} JPP/%{name} lib
install -m 644 %{name}-lib/pom.xml $RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP.%{name}-lib.pom

install -m 644 %{name}-persistence-jdbc/target/%{name}-persistence-jdbc-%{version}.jar \
           $RPM_BUILD_ROOT%{_javadir}/%{name}/persistence-jdbc-%{version}.jar
%add_to_maven_depmap org.apache.openjpa %{name}-persistence-jdbc %{version} JPP/%{name} persistence-jdbc
install -m 644 %{name}-persistence-jdbc/pom.xml $RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP.%{name}-persistence-jdbc.pom

install -m 644 %{name}-persistence/target/%{name}-persistence-%{version}.jar \
           $RPM_BUILD_ROOT%{_javadir}/%{name}/persistence-%{version}.jar
%add_to_maven_depmap org.apache.openjpa %{name}-persistence %{version} JPP/%{name} persistence
install -m 644 %{name}-persistence/pom.xml $RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP.%{name}-persistence.pom

install -m 644 %{name}-xmlstore/target/%{name}-xmlstore-%{version}.jar \
           $RPM_BUILD_ROOT%{_javadir}/%{name}/xmlstore-%{version}.jar
%add_to_maven_depmap org.apache.openjpa %{name}-xmlstore %{version} JPP/%{name} xmlstore
install -m 644 %{name}-xmlstore/pom.xml $RPM_BUILD_ROOT%{_datadir}/maven2/poms/JPP.%{name}-xmlstore.pom



(cd $RPM_BUILD_ROOT%{_javadir}/%{name} && for jar in *-%{version}*; do \
ln -sf ${jar} ${jar/-%{version}/}; done)


# javadoc
for module in \
           examples \
           jdbc-5 \
           jdbc \
           kernel-5 \
           kernel \
           lib-5 \
           lib \
           persistence-jdbc \
           persistence \
           xmlstore \
           ; do
    install -d -m 755 $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}/$module
    cp -pr %{name}-$module/target/site/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version}/$module
done
ln -s %{name}-%{version} $RPM_BUILD_ROOT%{_javadocdir}/%{name} # ghost symlink

## manual
install -d -m 755 $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
cp -p LICENSE.txt $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
%if %{with_maven}
cp -pr target/site $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
cp -pr openjpa-project/target/manual $RPM_BUILD_ROOT%{_docdir}/%{name}-%{version}
%endif

%post javadoc
ln -sf %{name}-%{version} %{_javadocdir}/%{name}
 
%postun javadoc
if [ "$1" = "0" ]; then
  rm -f %{_javadocdir}/%{name}
fi

%files
%{_docdir}/%{name}-%{version}/LICENSE.txt
%{_javadir}/%{name}
%{_datadir}/maven2
%{_mavendepmapfragdir}
# hack; explicitly added docdir if not owned
%doc %dir %{_docdir}/%{name}-%{version}

%files javadoc
%doc %{_javadocdir}/%{name}-%{version}
%ghost %{_javadocdir}/%{name}

%if %{with_maven}
%files manual
%doc %{_docdir}/%{name}-%{version}/manual
%doc %{_docdir}/%{name}-%{version}/site
%endif
# hack; explicitly added docdir if not owned
%doc %dir %{_docdir}/%{name}-%{version}

%changelog
* Fri Mar 18 2011 Igor Vlasenko <viy@altlinux.ru> 0:1.0.2-alt5_1jpp5
- fixed build with new javacc5

* Wed May 19 2010 Igor Vlasenko <viy@altlinux.ru> 0:1.0.2-alt4_1jpp5
- selected java5 compiler explicitly

* Sat Jan 10 2009 Igor Vlasenko <viy@altlinux.ru> 0:1.0.2-alt3_1jpp5
- robot now always fixes docdir ownership

* Mon Jan 05 2009 Igor Vlasenko <viy@altlinux.ru> 0:1.0.2-alt2_1jpp5
- fixed docdir ownership

* Fri Dec 05 2008 Igor Vlasenko <viy@altlinux.ru> 0:1.0.2-alt1_1jpp5
- first build