Package apache-commons-jci: 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
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
BuildRequires: /proc jetty6-servlet-2.5-api mojo-maven2-plugin-jdepend mojo-maven2-plugin-rat velocity14
BuildRequires: jpackage-compat
# Copyright (c) 2000-2010, 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()          %{expand:%%{?with_%{1}:1}%%{!?with_%{1}:0}}
%define without()       %{expand:%%{?with_%{1}:0}%%{!?with_%{1}:1}}
%define bcond_with()    %{expand:%%{?_with_%{1}:%%global with_%{1} 1}}
%define bcond_without() %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}}

%bcond_without maven
#def_with gcj_support
%bcond_with gcj_support
%bcond_without repolib

%define repodir %{_javadir}/repository.jboss.com/apache-%{base_name}/%{version}-brew
%define repodirlib %{repodir}/lib
%define repodirres %{repodir}/resources
%define repodirsrc %{repodir}/src

%if %with gcj_support
%define gcj_support 0
%else
%define gcj_support 0
%endif

%define base_name jci
%define short_name commons-%{base_name}

Name:           apache-commons-jci
Version:        1.1
Release:	alt1_0.r831715.4jpp6
Epoch:          0
Summary:        Apache Commons Java Compiler Interface
License:        ASL 2.0
Url:            http://commons.apache.org/jci/
Group:          Development/Java
Source0:        commons-jci-1.1-src.tar.gz
# svn export http://svn.apache.org/repos/asf/commons/proper/jci/trunk commons-jci-1.1-src
Source1:        %{name}-settings.xml
Source2:        %{name}-jpp-depmap.xml
Source3:        %{name}-component-info.xml
Source4:        %{short_name}-autogenerated-files.tar.gz
Patch0:         apache-commons-jci-core-pom.patch
Patch1:         commons-jci-1.1-JaninoCompilationProblem.patch
Patch2:         commons-jci-1.1-JavacClassLoader.patch
Patch3:         apache-commons-jci-pom.patch
BuildRequires: jpackage-utils >= 0:1.7.5
BuildRequires: fonts-ttf-liberation
BuildRequires: ant >= 0:1.7
BuildRequires: ant-junit
BuildRequires: junit
%if %with maven
BuildRequires: apache-commons-parent >= 0:12
BuildRequires: maven2-common-poms
BuildRequires: maven2 >= 0:2.0.8
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-maven-plugin
BuildRequires: maven-surefire-provider-junit
BuildRequires: maven-surefire-report-maven-plugin
BuildRequires: maven2-default-skin
BuildRequires: mojo-maven2-plugin-cobertura
BuildRequires: mojo-maven2-plugin-taglist
BuildRequires: jetty6-maven2-plugins
%endif
BuildRequires: asm2
BuildRequires: apache-commons-cli
BuildRequires: apache-commons-io
BuildRequires: apache-commons-lang
BuildRequires: jakarta-commons-logging
BuildRequires: groovy15
BuildRequires: ecj
BuildRequires: janino
BuildRequires: rhino
BuildRequires: geronimo-servlet-2.5-api
BuildRequires: geronimo-jsp-2.0-api
BuildRequires: vafer-dependency
%if %{gcj_support}
BuildRequires: java-gcj-compat-devel
%else
BuildArch:      noarch
%endif
Requires(post): jpackage-utils >= 0:1.7.5
Requires(postun): jpackage-utils >= 0:1.7.5

Requires: apache-commons-io
Requires: apache-commons-lang
Requires: jakarta-commons-logging
Provides:       jakarta-%{short_name} = %{epoch}:%{version}-%{release}
Obsoletes:      jakarta-%{short_name} < %{epoch}:%{version}-%{release}
Provides:       %{short_name} = %{epoch}:%{version}-%{release}
Obsoletes:      %{short_name} < %{epoch}:%{version}-%{release}
Source44: import.info

%description
JCI is a java compiler interface featuring a compiling classloader.
The current implementation supports compilation via the following 
compilers:
* eclipse
* janino
* javac
* groovy15
* rhino

%package compiler-eclipse
Summary:        ECJ Module for %{name}
Group:          Development/Java
Requires: %{name} = %{epoch}:%{version}-%{release}
Requires: ecj
Provides:       jakarta-%{short_name}-compiler-eclipse = %{epoch}:%{version}-%{release}
Obsoletes:      jakarta-%{short_name}-compiler-eclipse < %{epoch}:%{version}-%{release}
Provides:       %{short_name}-compiler-eclipse = %{epoch}:%{version}-%{release}
Obsoletes:      %{short_name}-compiler-eclipse < %{epoch}:%{version}-%{release}

%description compiler-eclipse
%{summary}.

%package compiler-groovy
Summary:        Groovy JSR Module for %{name}
Group:          Development/Java
Requires: %{name} = %{epoch}:%{version}-%{release}
Requires: groovy15
Provides:       jakarta-%{short_name}-compiler-groovy = %{epoch}:%{version}-%{release}
Obsoletes:      jakarta-%{short_name}-compiler-groovy < %{epoch}:%{version}-%{release}
Provides:       %{short_name}-compiler-groovy = %{epoch}:%{version}-%{release}
Obsoletes:      %{short_name}-compiler-groovy < %{epoch}:%{version}-%{release}

%description compiler-groovy
%{summary}.

%package compiler-janino
Summary:        Janino Module for %{name}
Group:          Development/Java
Requires: %{name} = %{epoch}:%{version}-%{release}
Requires: janino
Provides:       jakarta-%{short_name}-compiler-janino = %{epoch}:%{version}-%{release}
Obsoletes:      jakarta-%{short_name}-compiler-janino < %{epoch}:%{version}-%{release}
Provides:       %{short_name}-compiler-janino = %{epoch}:%{version}-%{release}
Obsoletes:      %{short_name}-compiler-janino < %{epoch}:%{version}-%{release}

%description compiler-janino
%{summary}.

%package compiler-rhino
Summary:        Rhino Module for %{name}
Group:          Development/Java
Requires: %{name} = %{epoch}:%{version}-%{release}
Requires: rhino
Provides:       jakarta-%{short_name}-compiler-rhino = %{epoch}:%{version}-%{release}
Obsoletes:      jakarta-%{short_name}-compiler-rhino < %{epoch}:%{version}-%{release}
Provides:       %{short_name}-compiler-rhino = %{epoch}:%{version}-%{release}
Obsoletes:      %{short_name}-compiler-rhino < %{epoch}:%{version}-%{release}

%description compiler-rhino
%{summary}.

%package javadoc
Summary:        Javadoc for %{name}
Group:          Development/Documentation
Provides:       jakarta-%{short_name}-javadoc = %{epoch}:%{version}-%{release}
Obsoletes:      jakarta-%{short_name}-javadoc < %{epoch}:%{version}-%{release}
Provides:       %{short_name}-javadoc = %{epoch}:%{version}-%{release}
Obsoletes:      %{short_name}-javadoc < %{epoch}:%{version}-%{release}
BuildArch: noarch

%description javadoc
%{summary}.

%if %with repolib
%package repolib
Summary:        Artifacts to be uploaded to a repository library
Group:          Development/Java
Provides:       jakarta-%{short_name}-repolib = %{epoch}:%{version}-%{release}
Obsoletes:      jakarta-%{short_name}-repolib < %{epoch}:%{version}-%{release}
Provides:       %{short_name}-repolib = %{epoch}:%{version}-%{release}
Obsoletes:      %{short_name}-repolib < %{epoch}:%{version}-%{release}

%description repolib
Artifacts to be uploaded to a repository library.
This package is not meant to be installed but so its contents
can be extracted through rpm2cpio.
%endif

%if %with maven
%package manual
Summary:        Documents for %{name}
Group:          Development/Documentation
Provides:       jakarta-%{short_name}-manual = %{epoch}:%{version}-%{release}
Obsoletes:      jakarta-%{short_name}-manual < %{epoch}:%{version}-%{release}
Provides:       %{short_name}-manual = %{epoch}:%{version}-%{release}
Obsoletes:      %{short_name}-manual < %{epoch}:%{version}-%{release}
BuildArch: noarch

%description manual
%{summary}.
%endif

%package demo
Summary:        Examples for %{name}
Group:          Development/Java
Requires: %{name} = %{epoch}:%{version}-%{release}
Requires: %{name}-compiler-eclipse = %{epoch}:%{version}-%{release}
Requires: apache-commons-cli
Requires: servlet_2_4_api
Provides:       jakarta-%{short_name}-demo = %{epoch}:%{version}-%{release}
Obsoletes:      jakarta-%{short_name}-demo < %{epoch}:%{version}-%{release}
Provides:       %{short_name}-demo = %{epoch}:%{version}-%{release}
Obsoletes:      %{short_name}-demo < %{epoch}:%{version}-%{release}

%description demo
%{summary}.

%prep
%setup -q -n %{short_name}-%{version}-src

%patch0 -b .sav0
%patch1 -b .sav1
%patch2 -b .sav2
%patch3 -b .sav3
%if %with maven
cp -p %{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
%else
tar xzf %{SOURCE4}
%endif

%build
%if %with maven
export MAVEN_REPO_LOCAL=$(pwd)/.m2/repository
mkdir -p $MAVEN_REPO_LOCAL/JPP/maven2/default_poms/
cp core/pom.xml $MAVEN_REPO_LOCAL/JPP/maven2/default_poms/JPP-commons-jci-core.pom
cp compilers/eclipse/pom.xml $MAVEN_REPO_LOCAL/JPP/maven2/default_poms/JPP-commons-jci-eclipse.pom

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 \
        -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 \
        -Dmaven.test.failure.ignore=true \
        -Dmaven2.jpp.depmap.file=%{SOURCE2} \
        -Dmaven.repo.local=$MAVEN_REPO_LOCAL \
        site
#       ant:ant site
%else
export OPT_JAR_LIST="ant/ant-junit junit"
export CLASSPATH=$(build-classpath \
commons-io \
commons-lang \
commons-logging-api \
)
CLASSPATH=$CLASSPATH:target/classes:target/test-classes
pushd fam
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 \
objectweb-asm/asm \
commons-io \
commons-lang \
commons-logging-api \
)
CLASSPATH=$CLASSPATH:target/classes:target/test-classes
CLASSPATH=$CLASSPATH:$(pwd)/fam/target/%{short_name}-fam-%{version}.jar
pushd core
ant -Dant.build.javac.source=1.5 -Dant.build.javac.target=1.5 -Dmaven.settings.offline=true -Dbuild.sysclasspath=only jar javadoc
popd

pushd compilers

export CLASSPATH=$(build-classpath \
ecj \
commons-logging-api \
)
CLASSPATH=$CLASSPATH:target/classes:target/test-classes
CLASSPATH=$CLASSPATH:$(pwd)/../core/target/%{short_name}-core-%{version}.jar
CLASSPATH=$CLASSPATH:$(pwd)/../core/target/test-classes
pushd eclipse
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 \
janino \
commons-logging-api \
)
CLASSPATH=$CLASSPATH:target/classes:target/test-classes
CLASSPATH=$CLASSPATH:$(pwd)/../core/target/%{short_name}-core-%{version}.jar
CLASSPATH=$CLASSPATH:$(pwd)/../core/target/test-classes
pushd janino
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 \
groovy15-all \
commons-logging-api \
)
CLASSPATH=$CLASSPATH:target/classes:target/test-classes
CLASSPATH=$CLASSPATH:$(pwd)/../core/target/%{short_name}-core-%{version}.jar
CLASSPATH=$CLASSPATH:$(pwd)/../core/target/test-classes
pushd groovy
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 \
asm2/asm2 \
asm2/asm2-analysis \
asm2/asm2-util \
commons-logging-api \
vafer-dependency \
)
CLASSPATH=$CLASSPATH:target/classes:target/test-classes
CLASSPATH=$CLASSPATH:$(pwd)/../core/target/%{short_name}-core-%{version}.jar
CLASSPATH=$CLASSPATH:$(pwd)/../core/target/test-classes
pushd javac
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-logging-api \
js \
)
CLASSPATH=$CLASSPATH:target/classes:target/test-classes
CLASSPATH=$CLASSPATH:$(pwd)/../core/target/%{short_name}-core-%{version}.jar
CLASSPATH=$CLASSPATH:$(pwd)/../core/target/test-classes
pushd rhino
ant -Dant.build.javac.source=1.5 -Dant.build.javac.target=1.5 -Dmaven.settings.offline=true -Dbuild.sysclasspath=only jar javadoc
popd

popd

export CLASSPATH=$(build-classpath \
commons-cli \
servlet_2_4_api \
)
CLASSPATH=$CLASSPATH:$(pwd)/fam/target/%{short_name}-fam-%{version}.jar
CLASSPATH=$CLASSPATH:$(pwd)/core/target/%{short_name}-core-%{version}.jar
pushd 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

%if %with maven
NAMEDVER=%{version}-SNAPSHOT
%else
NAMEDVER=%{version}
%endif
# jars
install -d -m 755 %{buildroot}%{_javadir}
%add_to_maven_depmap org.apache.commons %{short_name} %{version} JPP %{short_name}

install -m 644 fam/target/%{short_name}-fam-${NAMEDVER}.jar \
           %{buildroot}%{_javadir}/%{name}-fam-%{version}.jar
%add_to_maven_depmap org.apache.commons %{short_name}-fam %{version} JPP %{short_name}-fam
install -m 644 core/target/%{short_name}-core-${NAMEDVER}.jar \
           %{buildroot}%{_javadir}/%{name}-core-%{version}.jar
install -m 644 core/target/%{short_name}-core-${NAMEDVER}-tests.jar \
           %{buildroot}%{_javadir}/%{name}-core-tests-%{version}.jar
%add_to_maven_depmap org.apache.commons %{short_name}-core %{version} JPP %{short_name}-core

install -m 644 compilers/javac/target/%{short_name}-javac-${NAMEDVER}.jar \
           %{buildroot}%{_javadir}/%{name}-javac-%{version}.jar
%add_to_maven_depmap org.apache.commons %{short_name}-javac %{version} JPP %{short_name}-javac
install -m 644 compilers/eclipse/target/%{short_name}-eclipse-${NAMEDVER}.jar \
           %{buildroot}%{_javadir}/%{name}-eclipse-%{version}.jar
%add_to_maven_depmap org.apache.commons %{short_name}-eclipse %{version} JPP %{short_name}-eclipse
install -m 644 compilers/groovy/target/%{short_name}-groovy-${NAMEDVER}.jar \
           %{buildroot}%{_javadir}/%{name}-groovy-%{version}.jar
%add_to_maven_depmap org.apache.commons %{short_name}-groovy %{version} JPP %{short_name}-groovy
install -m 644 compilers/janino/target/%{short_name}-janino-${NAMEDVER}.jar \
           %{buildroot}%{_javadir}/%{name}-janino-%{version}.jar
%add_to_maven_depmap org.apache.commons %{short_name}-janino %{version} JPP %{short_name}-janino
install -m 644 compilers/rhino/target/%{short_name}-rhino-${NAMEDVER}.jar \
           %{buildroot}%{_javadir}/%{name}-rhino-%{version}.jar
%add_to_maven_depmap org.apache.commons %{short_name}-rhino %{version} JPP %{short_name}-rhino
install -m 644 examples/target/%{short_name}-examples-${NAMEDVER}.jar \
           %{buildroot}%{_javadir}/%{name}-examples-%{version}.jar
%add_to_maven_depmap org.apache.commons %{short_name}-examples %{version} JPP %{short_name}-examples

(cd %{buildroot}%{_javadir} && for jar in apache-*; do ln -sf ${jar} $(echo $jar | sed -e 's/apache-/jakarta-/'); done)
(cd %{buildroot}%{_javadir} && for jar in apache-*; do ln -sf ${jar} $(echo $jar | sed -e 's/apache-//'); done)
(cd %{buildroot}%{_javadir} && for jar in *-%{version}*; do ln -sf ${jar} $(echo $jar | sed -e 's/-%{version}//'); done)

# pom
install -d -m 755 %{buildroot}%{_datadir}/maven2/poms
install -m 644 pom.xml %{buildroot}%{_datadir}/maven2/poms/JPP-%{short_name}.pom
install -m 644 fam/pom.xml %{buildroot}%{_datadir}/maven2/poms/JPP-%{short_name}-fam.pom
install -m 644 core/pom.xml %{buildroot}%{_datadir}/maven2/poms/JPP-%{short_name}-core.pom
install -m 644 compilers/javac/pom.xml %{buildroot}%{_datadir}/maven2/poms/JPP-%{short_name}-javac.pom
install -m 644 compilers/eclipse/pom.xml %{buildroot}%{_datadir}/maven2/poms/JPP-%{short_name}-eclipse.pom
install -m 644 compilers/groovy/pom.xml %{buildroot}%{_datadir}/maven2/poms/JPP-%{short_name}-groovy.pom
install -m 644 compilers/janino/pom.xml %{buildroot}%{_datadir}/maven2/poms/JPP-%{short_name}-janino.pom
install -m 644 compilers/rhino/pom.xml %{buildroot}%{_datadir}/maven2/poms/JPP-%{short_name}-rhino.pom

# javadoc
install -d -m 755 %{buildroot}%{_javadocdir}/%{name}-%{version}
%if %with maven
cp -pr target/site/apidocs/* %{buildroot}%{_javadocdir}/%{name}-%{version}
rm -rf target/site/apidocs
%else
install -d -m 755 \
       %{buildroot}%{_javadocdir}/%{name}-%{version}/fam
cp -pr fam/target/site/apidocs/* \
       %{buildroot}%{_javadocdir}/%{name}-%{version}/fam
install -d -m 755 \
       %{buildroot}%{_javadocdir}/%{name}-%{version}/core
cp -pr core/target/site/apidocs/* \
       %{buildroot}%{_javadocdir}/%{name}-%{version}/core
install -d -m 755 \
       %{buildroot}%{_javadocdir}/%{name}-%{version}/compiler-eclipse
cp -pr compilers/eclipse/target/site/apidocs/* \
       %{buildroot}%{_javadocdir}/%{name}-%{version}/compiler-eclipse
install -d -m 755 \
       %{buildroot}%{_javadocdir}/%{name}-%{version}/compiler-groovy
cp -pr compilers/groovy/target/site/apidocs/* \
       %{buildroot}%{_javadocdir}/%{name}-%{version}/compiler-groovy
install -d -m 755 \
       %{buildroot}%{_javadocdir}/%{name}-%{version}/compiler-janino
cp -pr compilers/janino/target/site/apidocs/* \
       %{buildroot}%{_javadocdir}/%{name}-%{version}/compiler-janino
install -d -m 755 \
       %{buildroot}%{_javadocdir}/%{name}-%{version}/compiler-javac
cp -pr compilers/javac/target/site/apidocs/* \
       %{buildroot}%{_javadocdir}/%{name}-%{version}/compiler-javac
install -d -m 755 \
       %{buildroot}%{_javadocdir}/%{name}-%{version}/compiler-rhino
cp -pr compilers/rhino/target/site/apidocs/* \
       %{buildroot}%{_javadocdir}/%{name}-%{version}/compiler-rhino
%endif
ln -s %{name}-%{version} %{buildroot}%{_javadocdir}/%{name}
ln -s %{name}-%{version} %{buildroot}%{_javadocdir}/%{short_name}
ln -s %{name}-%{version} %{buildroot}%{_javadocdir}/%{short_name}-%{version}
ln -s %{name}-%{version} %{buildroot}%{_javadocdir}/jakarta-%{short_name}
ln -s %{name}-%{version} %{buildroot}%{_javadocdir}/jakarta-%{short_name}-%{version}

## manual
install -d -m 755 %{buildroot}%{_docdir}/%{name}-%{version}
install -m 644 LICENSE.txt %{buildroot}%{_docdir}/%{name}-%{version}
%if %with maven
cp -pr target/site %{buildroot}%{_docdir}/%{name}-%{version}
%endif

%if %with repolib
%{__mkdir_p} %{buildroot}%{repodir}
%{__mkdir_p} %{buildroot}%{repodirlib}
%{__install} -p -m 0644 %{SOURCE3} %{buildroot}%{repodir}/component-info.xml
tag=`/bin/echo %{name}-%{version}-%{release} | %{__sed} 's|\.|_|g'`
%{__sed} -i "s/@TAG@/$tag/g" %{buildroot}%{repodir}/component-info.xml
%{__sed} -i "s/@VERSION@/%{version}-brew/g" %{buildroot}%{repodir}/component-info.xml
%{__mkdir_p} %{buildroot}%{repodirsrc}
%{__install} -p -m 0644 %{PATCH0} %{buildroot}%{repodirsrc}/
%{__install} -p -m 0644 %{SOURCE0} %{buildroot}%{repodirsrc}/
%{__cp} -p %{buildroot}%{_javadir}/*.jar %{buildroot}%{repodirlib}/
%endif

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

%files
%doc %{_docdir}/%{name}-%{version}/LICENSE.txt
%{_javadir}/*fam*.jar
%{_javadir}/*core*.jar
%{_javadir}/*javac*.jar
%{_datadir}/maven2/*
%{_mavendepmapfragdir}/*
%if %{gcj_support}
%dir %{_libdir}/gcj/%{name}
%{_libdir}/gcj/%{name}/apache-commons-lang-%{version}.jar.db
%{_libdir}/gcj/%{name}/apache-commons-lang-%{version}.jar.so
%endif
# hack; explicitly added docdir if not owned
%doc %dir %{_docdir}/%{name}-%{version}

%files compiler-eclipse
%{_javadir}/*eclipse*.jar

%files compiler-groovy
%{_javadir}/*groovy*.jar

%files compiler-janino
%{_javadir}/*janino*.jar

%files compiler-rhino
%{_javadir}/*rhino*.jar

%files javadoc
%{_javadocdir}/*

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

%files demo
%{_javadir}/*examples*.jar

%if %with repolib
%files repolib
%{_javadir}/repository.jboss.com
%endif

%changelog
* Wed Feb 23 2011 Igor Vlasenko <viy@altlinux.ru> 0:1.1-alt1_0.r831715.4jpp6
- new version