Subversion Repositories configs

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3 - 1
#
2
# RPM macros for Java applications.
3
#
4
# JPackage Project  <http://www.jpackage.org/>
5
#   David Walluck   <david@jpackage.org>
6
#   Ville Skyttä    <scop at jpackage.org>
7
#   Nicolas Mailhot <Nicolas.Mailhot@laPoste.net>
8
#
9
 
10
#==============================================================================
11
# ---- default Java directories
12
 
13
#
14
# Root directory where all Java VMs/SDK/JREs are installed.
15
#
16
%_jvmdir	%{_prefix}/lib/jvm
17
 
18
#
19
# Root directory where all Java VMs/SDK/JREs expose their jars
20
#
21
%_jvmjardir	%{_prefix}/lib/jvm-exports
22
 
23
#
24
# Root directory for all Java VM/SDK/JRE's private things.
25
#
26
%_jvmprivdir	%{_prefix}/lib/jvm-private
27
 
28
#
29
# Root directory for all architecture dependent parts of Java VM/SDK/JRE's
30
#
31
%_jvmlibdir	%{_prefix}/lib/jvm
32
 
33
#
34
# Root directory for all architecture independent parts of Java VM/SDK/JRE's
35
#
36
%_jvmdatadir	%{_datadir}/jvm
37
 
38
#
39
# Root directory for all configurations parts of Java VM/SDK/JRE's
40
#
41
%_jvmsysconfdir	%{_sysconfdir}/jvm
42
 
43
#
44
# Root directory for all common architecture dependent parts of Java VM/SDK/JRE's
45
#
46
%_jvmcommonlibdir	%{_prefix}/lib/jvm-commmon
47
 
48
#
49
# Root directory for all common architecture independent parts of Java VM/SDK/JRE's
50
#
51
%_jvmcommondatadir	%{_datadir}/jvm-commmon
52
 
53
#
54
# Root directory for all common configurations parts of Java VM/SDK/JRE's
55
#
56
%_jvmcommonsysconfdir	%{_sysconfdir}/jvm-commmon
57
 
58
#
59
# Directory where arch and version independent jars are installed.
60
# This has already been integrated in RH macros following our request.
61
#
62
# By extension:
63
# %{_javadir}-ext:
64
#   - version dependent jars
65
# %{_javadir}-x.y.z:
66
#   - jars for Java standard x.y.z (usually symlinks to  %{_javadir}-ext)
67
# %{_javadir}-utils:
68
#   - Java-related scripts
69
#
70
# To simplify things only %{_javadir} is defined.
71
#
72
%_javadir        %{_datadir}/java
73
 
74
#
75
# Directory where arch-specific (JNI) version-independent jars are installed.
76
#
77
# By extension:
78
# %{_jnidir}-ext:
79
#   - version dependent jars
80
# %{_jnidir}-x.y.z:
81
#   - jars for Java standard x.y.z (usually symlinks to  %{_jnidir}-ext)
82
# To simplify things only %{_jnidir} is defined.
83
#
84
%_jnidir        %{_prefix}/lib/java
85
 
86
#
87
# Root directory where all javadoc is installed. Also already in RH macros.
88
#
89
%_javadocdir     %{_datadir}/javadoc
90
 
91
# Directory for maven poms
92
%_mavenpomdir %{_datadir}/maven2/poms
93
 
94
#
95
# Directory for maven depmaps
96
#
97
%_mavendepmapdir %{_sysconfdir}/maven
98
%_mavendepmapfragdir %{_sysconfdir}/maven/fragments
99
 
100
#
101
# Current default JVM home.
102
#
103
%java_home      %(. %{_javadir}-utils/java-functions; set_jvm; echo $JAVA_HOME)
104
 
105
#==============================================================================
106
# ---- default Java commands
107
 
108
%ant            JAVA_HOME=%{java_home} ant
109
%jar            %{java_home}/bin/jar
110
%java           %(. %{_javadir}-utils/java-functions; set_javacmd; echo $JAVACMD)
111
%javac          %{java_home}/bin/javac
112
%javadoc        %{java_home}/bin/javadoc
113
 
114
#==============================================================================
115
# ---- Java extension handling macros
116
 
117
#
118
# add_jvm_extension should be used in %install by extension packages to declare
119
# what extension jars they provide.
120
#
121
# For example a package that provides foo.jar which is the bar extension
122
# under java 1.2 and 1.3 should do a:
123
#
124
#   %install
125
#   ... # create foo.jar in %{javadir}-ext
126
#   %add_jvm_extension  foo bar 1.2 1.3
127
#
128
#   %files
129
#   %{javadir}-ext/foo.jar
130
#   %{javadir}-*/bar.jar
131
#
132
%add_jvm_extension JAVA_LIBDIR=%{buildroot}/%{_javadir}	%{_bindir}/jvmjar -l
133
 
134
#==============================================================================
135
#
136
# add_to_depmap adds an entry to the depmap. The arguments are:
137
#
138
# %1 the original groupid
139
# %2 the original artifact id
140
# %3 the version
141
# %4 the new groupid
142
# %5 the new artifactid
143
#
144
 
145
%add_to_maven_depmap() \
146
install -dm 755 $RPM_BUILD_ROOT/%{_mavendepmapfragdir}\
147
cat >>$RPM_BUILD_ROOT/%{_mavendepmapfragdir}/%{name}<< EOF\
148
<dependency>\
149
    <maven>\
150
        <groupId>%1</groupId>\
151
        <artifactId>%2</artifactId>\
152
        <version>%3</version>\
153
    </maven>\
154
    <jpp>\
155
        <groupId>%4</groupId>\
156
        <artifactId>%5</artifactId>\
157
        <version>%3</version>\
158
    </jpp>\
159
</dependency>\
160
\
161
EOF\
162
%{nil}
163
 
164
#==============================================================================
165
#
166
# update_maven_depmap updates the main maven depmap
167
#
168
%update_maven_depmap() \
169
echo -e "<dependencies>\\n" > %{_mavendepmapdir}/maven2-depmap.xml\
170
if [ -d %{_mavendepmapfragdir} ] && [ -n "`find %{_mavendepmapfragdir} -type f`" ]; then\
171
cat %{_mavendepmapfragdir}/* >> %{_mavendepmapdir}/maven2-depmap.xml\
172
fi\
173
echo -e "</dependencies>\\n" >> %{_mavendepmapdir}/maven2-depmap.xml\
174
%{nil}
175
 
176
#==============================================================================
177
# ---- GCJ support
178
%_gcj_support 1
179
 
180
#==============================================================================
181
# ---- default icons directories as per the icon theme freedesktop spec
182
 
183
%_iconstheme    hicolor
184
%_iconsbasedir  %{_datadir}/icons/%{_iconstheme}
185
 
186
#
187
# The following is a bit heavy and will be removed
188
#
189
%_icons16dir    %{_iconsbasedir}/16x16/apps
190
%_icons22dir    %{_iconsbasedir}/22x22/apps
191
%_icons48dir    %{_iconsbasedir}/48x48/apps
192
%_icons64dir    %{_iconsbasedir}/64x64/apps
193
%_icons96dir    %{_iconsbasedir}/96x96/apps
194
%_icons192dir   %{_iconsbasedir}/192x192/apps
195
%_iconsscaldir  %{_iconsbasedir}/scalable/apps
196
 
197
#
198
# Mandriva macros for non-Mandriva systems.
199
#
200
%_miconsdir	%{_datadir}/icons/mini
201
%_iconsdir	%{_datadir}/icons
202
%_liconsdir	%{_datadir}/icons/large
203
 
204
 
205
#
206
# Mandriva icons
207
#
208
# %1	the name of the icon (typically the name of the package). Mandriva
209
#	requires 3 icons sizes (48, 32, 16), all should be present.
210
#
211
%mdkicons() \
212
install -D -m 644 %1-48.png $RPM_BUILD_ROOT%{_liconsdir}/%1.png\
213
install -D -m 644 %1-32.png $RPM_BUILD_ROOT%{_iconsdir}/%1.png\
214
install -D -m 644 %1-16.png $RPM_BUILD_ROOT%{_miconsdir}/%1.png\
215
%{nil}
216
 
217
 
218
#
219
# Red Hat icons
220
#
221
# %1	the name of the icon (typically the name of the package). RedHat
222
#	requires 3 icons sizes (48, 32, 16), all should be present.
223
%rhicons() \
224
install -D -m 644 %1-48.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/48x48/apps/%{name}.png\
225
install -D -m 644 %1-32.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/32x32/apps/%{name}.png\
226
install -D -m 644 %1-16.png $RPM_BUILD_ROOT%{_datadir}/icons/hicolor/16x16/apps/%{name}.png\
227
%{nil}
228
 
229
 
230
#==============================================================================
231
# ---- default .desktop directories per the desktop-entry freedesktop.org spec
232
 
233
%_desktopdir    %{_datadir}/applications
234
 
235
#
236
# Mandriva menu dir
237
#
238
%_menudir	%{_prefix}/lib/menu
239
 
240
#
241
# Mandriva menu
242
#
243
# %1	the name of the menu (ex: %{name})
244
# %2	the command to run (ex: %{_bindir}/%{name})
245
# %3	needs (ex: X11)
246
# %4	menu section (ex: Applications/Editors)
247
# %5	mime types (ex: text/html;text/plain)
248
# %6	menu title (ex: %{name})
249
# %7	comment or summary (ex: %{Summary})
250
# %8	icon (ex: %{name}.png)
251
# %9	unused
252
#
253
%mdkmenu() \
254
install -d -m 755 $RPM_BUILD_ROOT%{_menudir}\
255
cat >$RPM_BUILD_ROOT%{_menudir}/%1 <<EOF\
256
\?package(%1):\\
257
 command="%2"\\
258
 needs="%3"\\
259
 section="%4"\\
260
 mimetypes="%5"\\
261
 title="%6"\\
262
 longtitle="%7"\\
263
 icon="%8"\\
264
EOF\
265
%{nil}
266
 
267
%post_mdkmenu\
268
%post mdkmenu\
269
%{update_menus}
270
 
271
%postun_mdkmenu\
272
%postun mdkmenu\
273
%{clean_menus}
274
 
275
#
276
# Legacy menu
277
#
278
# %1	the name of the menu (ex: %{name})
279
# %2	the command to run (ex: %{_bindir}/%{name})
280
# %3	needs (ex: 1)
281
# %4	menu section (ex: Development)
282
# %5	unused
283
# %6	menu title (ex: %{name})
284
# %7	comment or summary (ex: %{Summary})
285
# %8	icon (ex: %{name}.png)
286
# %9	type (ex: Application)
287
#
288
%rhmenu() \
289
install -d -m 755 $RPM_BUILD_ROOT%{_sysconfdir}/X11/applnk/%4\
290
cat >$RPM_BUILD_ROOT%{_sysconfdir}/X11/applnk/%4/%1.desktop <<EOF\
291
[Desktop Entry]\
292
Name=%6\
293
Comment=%7\
294
Exec=%2\
295
Terminal=%3\
296
Type=%9\
297
Icon=%8\
298
EOF\
299
%{nil}
300
 
301
#
302
# Standard JPackage script
303
#
304
# This is kind of tasteless and should be moved to an external template
305
#
306
# %1	main class
307
# %2	flags
308
# %3	options
309
# %4	jars (separated by ':')
310
# %5    the name of script you wish to create
311
#
312
%jpackage_script() \
313
install -d -m 755 $RPM_BUILD_ROOT%{_bindir}\
314
cat > $RPM_BUILD_ROOT%{_bindir}/%5 << EOF \
315
#!/bin/sh\
316
#\
317
# %{name} script\
318
# JPackage Project <http://www.jpackage.org/>\
319
\
320
# Source functions library\
321
. %{_javadir}-utils/java-functions\
322
\
323
# Source system prefs\
324
if [ -f %{_sysconfdir}/java/%{name}.conf ] ; then\
325
  . %{_sysconfdir}/java/%{name}.conf\
326
fi\
327
\
328
# Source user prefs\
329
if [ -f \\$HOME/.%{name}rc ] ; then\
330
  . \\$HOME/.%{name}rc\
331
fi\
332
\
333
# Configuration\
334
MAIN_CLASS=%1\
335
BASE_FLAGS=%2\
336
BASE_OPTIONS=%3\
337
BASE_JARS="%(echo %4 | sed -e 's,:, ,g')"\
338
\
339
# Set parameters\
340
set_jvm\
341
set_classpath \\$BASE_JARS\
342
set_flags \\$BASE_FLAGS\
343
set_options \\$BASE_OPTIONS\
344
\
345
# Let's start\
346
run "\\$@"\
347
EOF\
348
chmod 755 $RPM_BUILD_ROOT%{_bindir}/%5\
349
%{nil}