]> git.pld-linux.org Git - packages/rpm-build-macros.git/blame - rpm.macros
- tabs
[packages/rpm-build-macros.git] / rpm.macros
CommitLineData
397b586d 1# $Revision$, $Date$
d54662bf
AF
2# PLD rpm macros
3
e05017c1 4%epoch 0
3241033b 5%x8664 x86_64 amd64 ia32e
9c404149 6
ba1fdedc 7# kernel compiler
345d14e5 8%kgcc %{__cc}
d2e1bc22 9%kgcc_package gcc
ba1fdedc 10
3241033b
ER
11%_source_payload w9.gzdio
12%_binary_payload w9.bzdio
13
33040789 14# Build system path macros.
15#
bddadece
JB
16%__autoconf autoconf %{?debug:-Wall}
17%__automake automake -a -c -f --foreign
f93109a0 18%__autopoint autopoint --force
19
83094b62 20%__gettextize { \
3241033b 21if ! gettextize --version | grep -q '0\.10\.' ; then \
8a995cff 22 if grep -qs 'AM_GNU_GETTEXT.*external' configure.{ac,in} ; then \
3241033b 23 gettextize --copy --force --no-changelog; \
97589b6e 24 else \
3241033b 25 gettextize --copy --force --no-changelog --intl; \
8a995cff
JB
26 fi; \
27 if [ ! -f po/Makevars ]; then \
3241033b 28 cp -f po/Makevars{.template,}; \
8a995cff 29 fi; \
3241033b 30else \
8a995cff 31 gettextize --copy --force; \
3241033b 32fi; \
8a995cff 33}
f93109a0 34
35%__glib_gettextize glib-gettextize --copy --force
36%__gnome_doc_common gnome-doc-common --copy
37%__gtkdocize gtkdocize --copy
38%__intltoolize intltoolize --copy --force
39%__libtoolize libtoolize --copy --force
33040789 40
81e450f7
ER
41# The number of cvs changelog entries kept when building package.
42%_buildchangelogtruncate 20
43
6a5eda77 44%dependencytracking %{nil}
3241033b 45
e5da9169
ER
46# Relations between package names that cause dependency loops
47# with legacy packages that cannot be fixed. Relations are
48# specified as
49# p>q
50# where package p has a Requires: on something that package q Provides:
51#
52# XXX Note: that there cannot be any whitespace within the string "p>q",
53# and that both p and q are package names (i.e. no version/release).
54%_dependency_whiteout %{nil}
55
9c404149 56#-----------------------------------------------------------------
9f4ce098 57%configure2_13 { \
9c404149
AM
58 if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \
59 LDFLAGS="${LDFLAGS:-%rpmldflags}" ; export LDFLAGS ; \
60 CFLAGS="${CFLAGS:-%rpmcflags}" ; export CFLAGS ; \
f4cc8832 61 CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" ; export CXXFLAGS ; \
9c404149 62 FFLAGS="${FFLAGS:-%rpmcflags}" ; export FFLAGS ; \
8ec1a12b 63 CPPFLAGS="${CPPFLAGS:-}" ; export CPPFLAGS ; \
8983c4c4
AM
64 %{?__cc:CC="%{__cc}" ; export CC ; } \
65 %{?__cxx:CXX="%{__cxx}" ; export CXX ; } \
8f74418b 66 %{?configuredir:%{configuredir}}%{!?configuredir:.}/configure \
2a7cfd3f 67 --host=%{_target_platform} \
9c404149
AM
68 --prefix=%{_prefix} \
69 --exec-prefix=%{_exec_prefix} \
70 --bindir=%{_bindir} \
71 --sbindir=%{_sbindir} \
72 --sysconfdir=%{_sysconfdir} \
73 --datadir=%{_datadir} \
74 --includedir=%{_includedir} \
75 --libdir=%{_libdir} \
76 --libexecdir=%{_libexecdir} \
77 --localstatedir=%{_localstatedir} \
78 --sharedstatedir=%{_sharedstatedir} \
79 --mandir=%{_mandir} \
80 --infodir=%{_infodir} \
b6c5da52 81 --x-libraries=%{?_x_libraries}%{!?_x_libraries:%{_libdir}} \
93059874 82 %{dependencytracking} \
9c404149
AM
83}
84
39b9534b
ER
85%cmake { \
86CC="%{__cc}" \
87CXX="%{__cxx}" \
88CFLAGS="%{rpmcflags}" \
89CXXFLAGS="%{rpmcxxflags}" \
90cmake \
91}
92
4a6b0d54 93#----------------------------------------------------------------
73f832b3 94%global configure_cache 0
fe6c4bdd 95%configure_cache_file %{buildroot}.configure.cache
73f832b3 96
57f4166d 97%configure {./configure \
4a6b0d54
AF
98 LDFLAGS="${LDFLAGS:-%rpmldflags}" \
99 CFLAGS="${CFLAGS:-%rpmcflags}" \
f4cc8832 100 CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" \
4a6b0d54 101 FFLAGS="${FFLAGS:-%rpmcflags}" \
a2bd5992 102 CPPFLAGS="${CPPFLAGS:-}" \
8983c4c4
AM
103 %{?__cc:CC="%{__cc}"} \
104 %{?__cxx:CXX="%{__cxx}"} \
8e4cb85a 105 --host=%{_target_platform} \
4a6b0d54
AF
106 --build=%{_target_platform} \
107 --prefix=%{_prefix} \
108 --exec-prefix=%{_exec_prefix} \
109 --bindir=%{_bindir} \
110 --sbindir=%{_sbindir} \
111 --sysconfdir=%{_sysconfdir} \
112 --datadir=%{_datadir} \
113 --includedir=%{_includedir} \
114 --libdir=%{_libdir} \
115 --libexecdir=%{_libexecdir} \
116 --localstatedir=%{_localstatedir} \
117 --sharedstatedir=%{_sharedstatedir} \
118 --mandir=%{_mandir} \
119 --infodir=%{_infodir} \
b6c5da52 120 --x-libraries=%{?_x_libraries}%{!?_x_libraries:%{_libdir}} \
93059874 121 %{dependencytracking} \
73f832b3 122 %{?configure_cache:--cache-file=%{configure_cache_file:-%{buildroot}.configure.cache}} \
4a6b0d54
AF
123}
124
7dbab518 125# ------------------------------------------------------------------------
c80506a3
AM
126# Overloading of some basic macros
127%prep \
128%%prep\
129LANG=C\
130export LANG\
14e77e64 131unset DISPLAY ||:\
6db5639d 132unset LINGUAS ||:\
c80506a3
AM
133%{nil}
134
135%build %%build\
136LANG=C\
137export LANG\
14e77e64 138unset DISPLAY ||:\
6db5639d 139unset LINGUAS ||:\
c80506a3
AM
140%{nil}
141
b4e3d367
ER
142%install \
143%if 0%{?_enable_debug_packages}\
144%{?buildsubdir:%{debug_package}}\
145%endif\
c80506a3
AM
146%%install\
147LANG=C\
148export LANG\
14e77e64 149unset DISPLAY ||:\
6db5639d 150unset LINGUAS ||:\
c80506a3
AM
151%{nil}
152
9c404149
AM
153# Location of autoconf macros
154%_aclocaldir %(aclocal --print-ac-dir)
155
e2804f99
AM
156# Location of omf files
157%_omf_dest_dir %(scrollkeeper-config --omfdir)
158
e987a186 159# Location of pkgconfig files
9a4e877a 160%_pkgconfigdir /usr/%{_lib}/pkgconfig
e987a186 161
486b0b5f 162# Location of desktop files
163%_desktopdir /usr/share/applications
86dff2d0 164%_applnkdir ERROR:_applnkdir_is_obsolete_use_desktopdir_instead
486b0b5f 165
481463e9 166# Location of pixmaps for applnk/desktop files
e1f0a822 167%_pixmapsdir /usr/share/pixmaps
9c404149 168
481463e9 169# Location of themable icons for applnk/desktop files
b36c8e2a 170%_iconsdir /usr/share/icons
171
e987a186
JB
172# Location of fonts directories
173%_fontsdir /usr/share/fonts
174
b3282f3f 175# Location of Gtk and associated libraries documentation
fe6c4bdd 176%_gtkdocdir %{_defaultdocdir}/gtk-doc/html
b3282f3f 177
fc4d7771 178# Location of KDE documentation
fe6c4bdd 179%_kdedocdir %{_defaultdocdir}/kde/HTML
fc4d7771 180
5869828c 181# unsermake script
182%__unsermake /usr/share/unsermake/unsermake
183
9c404149
AM
184# Current date
185%date %(LC_ALL="C" date +"%a %b %d %Y")
186
187# tmp directory
188%tmpdir %(echo "${TMPDIR:-/tmp}")
189
190# Example files, programs, scripts...
191%_examplesdir /usr/src/examples
192
c8f7e820 193# Alternative kernel type/version
194%alt_kernel %{nil}%{?_alt_kernel:-%{?_alt_kernel}}
195
8377d27d 196# The directory holding Linux kernel sources
c8f7e820 197%_kernelsrcdir /usr/src/linux%{alt_kernel}
8377d27d 198
9c404149 199# If non-empty "debug" macro defined, add "dbg" suffix to release number
8f74418b 200%_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}%{?debug:dbg}.%%{ARCH}.rpm
9c404149 201
8f74418b 202# Requires name = version-release
ec4e8b11 203%requires_releq() %(echo '%*' | LC_ALL="C" xargs -r rpm -q --qf 'Requires: %%{name} = %%{epoch}:%%{version}-%%{release}\\n' | sed -e 's/ (none):/ /' | grep -v "is not")
8bf3719d 204
fe6c4bdd
ER
205%releq_kernel_up() %((LC_ALL="C" rpm -qf --qf '%%{name}-up = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h 2>/dev/null || echo ERROR) | sed -e 's/ (none):/ /' | sed -e 's:-headers::' | grep -vE "(is not|no such)")
206%releq_kernel_smp() %((LC_ALL="C" rpm -qf --qf '%%{name}-smp = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h 2>/dev/null || echo ERROR) | sed -e 's/ (none):/ /' | sed -e 's:-headers::' | grep -vE "(is not|no such)")
207%requires_releq_kernel_up(s:) Requires%{-s:(%{-s*})}: %releq_kernel_up
a0bbe604 208%requires_releq_kernel_smp(s:) Requires%{-s:(%{-s*})}: %releq_kernel_smp
8bf3719d 209
47935449 210%requires_eq() %(echo '%*' | LC_ALL="C" xargs -r rpm -q --qf 'Requires: %%{name} = %%{epoch}:%%{version}\\n' | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -v "is not")
16cb1d91 211%requires_eq_to() %(LC_ALL="C" rpm -q --qf 'Requires: %1 = %%{epoch}:%%{version}\\n' %2 | sed -e 's/ (none):/ /' | grep -v "is not")
01a9f990 212
c0b2771b 213%apache_modules_api %(awk '/#define MODULE_MAGIC_NUMBER_MAJOR/ {print $3}' /usr/include/apache/ap_mmn.h 2>/dev/null || echo ERROR)
b9d5d440 214
215# kernel version-release handling
3241033b
ER
216%__kernel_ver %([ -f %{_kernelsrcdir}/include/linux/version.h ] && (grep UTS_RELEASE %{_kernelsrcdir}/include/linux/version.h 2>/dev/null | head -n 1 | cut -d'"' -f2) || (awk '/^VERSION/ { ver = $0; gsub(/VERSION.*=/, NIL, ver); } /^PATCHLEVEL/ { plev = $0; gsub(/PATCHLEVEL.*=/, NIL, plev); } /^SUBLEVEL/ { slev = $0; gsub(/SUBLEVEL.*=/, NIL, slev); } /^EXTRAVERSION/ { ever = $0; gsub(/EXTRAVERSION.*=/, NIL, ever); gsub(/ /, NIL, ever); } END { printf("%d.%d.%d%s", ver, plev, slev, ever); }' %{_kernelsrcdir}/Makefile 2> /dev/null))
217%__kernel_rel %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/fs.h 2>/dev/null --qf "%{RELEASE}" | grep -v "is not")
fe6c4bdd 218%__kernel_rpmvr %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/fs.h 2>/dev/null --qf "%{VERSION}-%{RELEASE}" | grep -v "is not")
3241033b 219%_kernel_ver %{__kernel_ver}%{?with_dist_kernel:%(echo %{__kernel_ver} | grep -q -e - || echo -%{__kernel_rel})}
f62e856d 220%_kernel_ver_str %(echo %{!?_without_dist_kernel:%{__kernel_rpmvr}}%{?_without_dist_kernel:%{__kernel_ver}} | sed -e 's/-/_/g')
87be1cf0 221
e00dd7f6 222# sgml macros
3241033b
ER
223%xmlcat_add() /usr/bin/xmlcatalog --noout --add nextCatalog \"\" %1 /etc/xml/catalog ;
224%xmlcat_del() /usr/bin/xmlcatalog --noout --del %1 /etc/xml/catalog ;
225%xmlcat_add_rewrite /usr/bin/xmlcatalog --noout --add rewriteSystem
226%xmlcat_create() /usr/bin/xmlcatalog --noout --create %1 ;
227%sgmlcat_add() /usr/bin/install-catalog --add %1 %2 > /dev/null ;
228%sgmlcat_del() /usr/bin/install-catalog --remove %1 %2 > /dev/null ;
e00dd7f6 229%docbook_sgmlcat_fix() { for l in \
230'' \
231' -- default decl --' \
232'DTDDECL "-//OASIS//DTD DocBook XML V%2//EN" "../../xml.dcl"' \
233' -- hacks for opensp --' \
234'SYSTEM "file://%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \
235'SYSTEM "http://www.oasis-open.org/docbook/xml/%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \
236'' \
237; do echo $l; done >> %1 \
238}
239
9c404149
AM
240#-----------------------------------------------------------------
241# find and gzip all files in %{_mandir} and %{infodir}
242#
243# Requires: xargs, find
244#
245#%no_install_post_compress_docs 1
246%__spec_install_post_compress_docs { \
53d5af13 247%{!?no_install_post_compress_docs:__spec_install_post_compress_docs() { \
822d4d81 248 echo "Compress man and info pages."; \
9c404149
AM
249 for i in /usr/share/man /usr/X11R6/man /usr/share/info; do \
250 if [ -d "$RPM_BUILD_ROOT$i" ]; then \
251 find "$RPM_BUILD_ROOT$i" -name \*.bz2 -print | xargs -r %{__bzip2} -df; \
252 find "$RPM_BUILD_ROOT$i" -name \*.gz -print | xargs -r %{__gzip} -dnf; \
253 find "$RPM_BUILD_ROOT$i" -type f -print | xargs -r %{__gzip} -9nf; \
254 fi; \
255 done; \
53d5af13 256}; __spec_install_post_compress_docs } }
9c404149
AM
257
258#-----------------------------------------------------------------
259# Strip executable binaries and shared object files
260#
261# Requires: find, awk, strip, cut, xargs
262#
263#%no_install_post_strip 1
264%__spec_install_post_strip {%{!?debug: \
53d5af13 265%{!?no_install_post_strip:__spec_install_post_strip() { \
3241033b 266 if [ -d "$RPM_BUILD_ROOT" ]; then \
8f74418b 267 echo "Strip executable binaries, archives and shared object files."; \
b4e3d367 268 filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" ! -regex ".*/usr/lib[0-9]*/debug/.*\.debug" %{?_noautostrip:! -regex "%{_noautostrip}"}`; \
9c404149
AM
269 elfexelist=`echo $filelist | xargs -r file | \
270 awk '/ELF.*executable/ {print $1}' | cut -d: -f1`; \
271 elfsharedlist=`echo $filelist | xargs -r file | \
272 awk '/LF.*shared object/ {print $1}' | cut -d: -f1`; \
8f74418b
MM
273 elfarchiveslist=`echo $filelist | xargs -r file | \
274 awk '/current ar archive/ {print $1}' | cut -d: -f1`; \
9c404149 275 if [ -n "$elfexelist" ]; then \
fe6c4bdd 276 %{__strip} --remove-section=.note --remove-section=.comment $elfexelist; \
9c404149
AM
277 fi; \
278 if [ -n "$elfsharedlist" ]; then \
fe6c4bdd 279 %{__strip} --strip-unneeded --remove-section=.note --remove-section=.comment $elfsharedlist; \
8f74418b
MM
280 fi; \
281 if [ -n "$elfarchiveslist" ]; then \
fe6c4bdd 282 %{__strip} --strip-debug --remove-section=.note --remove-section=.comment $elfarchiveslist; \
9f0d4f36 283 fi; \
53d5af13 284fi; }; __spec_install_post_strip } } }
3241033b 285
fc5d7e20 286#-----------------------------------------------------------------
287# remove all RPATH from executable binaries and shared object files
288#
289# Requires: find, awk, cut, xargs, chrpath, uname
290#
291#%no_install_post_chrpath 1
292%__spec_install_post_chrpath {%{!?debug: \
53d5af13 293%{!?no_install_post_chrpath: __spec_install_post_chrpath() { \
9f0d4f36 294if [ -d "$RPM_BUILD_ROOT" ]; then \
fc5d7e20 295echo "Remove RPATH from executable binaries and shared object files."; \
adb39da4 296find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" ! -regex ".*/usr/lib[0-9]*/debug/.*" %{?_noautochrpath:! -regex "%{_noautochrpath}"} | xargs -r file | \
5bed2bb7 297 awk '/ELF.*(executable.*dynamically linked|shared object)/ {print $1}' | cut -d: -f1 | \
fc5d7e20 298while read file ; do \
299 rpath= ; \
300 chmod u+w "$file"; \
301 for dir in `chrpath -l "$file" | \
3241033b 302 awk '/RPATH=/ { gsub(/.*RPATH=/,""); gsub(/:/," "); print $0 }'` ; do \
fc5d7e20 303 case $dir in \
494e368c 304 /home/* | /tmp/* | /usr/lib | /usr/lib64 | /lib | /lib64 | /usr/local/lib | /usr/local/lib64 | /usr/X11R6/lib | /usr/X11R6/lib64 ) \
fc5d7e20 305 echo "remove-rpath: $dir in $file"; \
306 ;; \
307 * ) \
308 if [ "$rpath" = "" ] ; then rpath="$dir" ; \
309 else rpath="$rpath:$dir" ; fi ; \
310 ;; \
311 esac ; \
312 done ; \
313 if [ "$rpath" = "" ] ; then chrpath -d "$file" > /dev/null ; \
314 else chrpath -r "$rpath" "$file" > /dev/null ; fi ; \
9f0d4f36 315done; \
53d5af13 316fi; }; __spec_install_post_chrpath } } }
3241033b 317
d72c185f 318#-----------------------------------------------------------------
ccb8ae8d 319# Find and gzip all kernel modules
320#
321# Requires: find
322#
fe6c4bdd 323#%no_install_post_compress_modules 1
ccb8ae8d 324%__spec_install_post_compress_modules { \
53d5af13 325%{!?no_install_post_compress_modules: __spec_install_post_compress_modules() { \
3241033b
ER
326 if [ -d "$RPM_BUILD_ROOT" ]; then \
327 echo "Compress kernel modules if any."; \
328 if test -d $RPM_BUILD_ROOT/lib/modules ; then \
329 find $RPM_BUILD_ROOT/lib/modules -name \*o -type f -print | \
330 xargs -r %{__gzip} -9nf; \
fe6c4bdd
ER
331 find $RPM_BUILD_ROOT/lib/modules -name \*o -type l -printf "%p %l\n" | \
332 while read a b; do ln -sf $b.gz $a.gz; rm -f $a; done; \
3241033b
ER
333 fi; \
334 fi; \
53d5af13 335}; __spec_install_post_compress_modules } }
9c404149 336
ef64802f
ER
337# Remove common Perl files we don't package
338%__spec_install_post_perl_clean {\
339%{!?no_install_post_perl_clean: \
340%{?pdir:rm -f $RPM_BUILD_ROOT{%{perl_archlib}/perllocal.pod,%{perl_vendorarch}/auto/%{pdir}%{?pnam:/%(echo %{pnam} | tr - /)}/.packlist}} \
341} }
342
83094b62 343#-----------------------------------------------------------------
0e4cb4dd 344# Update GConf2 schemas
83094b62 345#
346# Requires: GConf2
347#
46885239 348%gconf_schema_install() \
3241033b
ER
349 umask 022; \
350 GCONF_CONFIG_SOURCE="xml:readwrite:/etc/gconf/gconf.xml.defaults" /usr/bin/gconftool-2 --makefile-install-rule /etc/gconf/schemas/%{?1}%{!?1:*.schemas} > /dev/null \
351 %{nil}
46885239 352
353%gconf_schema_uninstall() \
f93109a0 354if [ $1 = 0 ]; then \
3241033b
ER
355 umask 022; \
356 GCONF_CONFIG_SOURCE="xml:readwrite:/etc/gconf/gconf.xml.defaults" /usr/bin/gconftool-2 --makefile-uninstall-rule /etc/gconf/schemas/%{?1} > /dev/null \
f93109a0 357fi \
358%{nil}
359
360#-----------------------------------------------------------------
361# Update desktop MIME database
c0a4caa0 362# requires: desktop-file-utils
f93109a0 363#
820792a9 364%update_desktop_database_post() {{ \
f93109a0 365 umask 022; \
366 /usr/bin/update-desktop-database; \
4565b525 367}}
f93109a0 368
09e3522b 369%update_desktop_database_postun() {{ \
f93109a0 370if [ $1 = 0 ]; then \
371 umask 022; \
372 /usr/bin/update-desktop-database; \
373fi \
4565b525 374}}
f93109a0 375
376#-----------------------------------------------------------------
377# Update scrollkeeper database
378# requires: scrollkeeper
379#
380%scrollkeeper_update_post() \
f93109a0 381 /usr/bin/scrollkeeper-update -q; \
382 %{nil}
383
384%scrollkeeper_update_postun() \
385if [ $1 = 0 ]; then \
f93109a0 386 /usr/bin/scrollkeeper-update -q; \
387fi \
388%{nil}
389
390#-----------------------------------------------------------------
391# Run ldconfig after installing/deinstalling libraries
392#
393%ldconfig_post() \
394 /sbin/ldconfig; \
395 %{nil}
396
397%ldconfig_postun() \
f93109a0 398 /sbin/ldconfig; \
b430f866 399 %{nil}
83094b62 400
9c404149
AM
401#-----------------------------------------------------------------
402# post %install sequence:
403# - autodeps exceptions
404# - compress all man and info pages,
405# - strip all ELF executables and ELF shared objects if not %debug.
8f74418b 406# - compress kernel modules if any
9c404149
AM
407
408###################################################################
409# Requires/Provides automation
410# exceptions system by Jacek Konieczny <jajcus@pld.org.pl>
338726a6 411#
2892b5df
JB
412%__noautoreqfiles %(sed -e s'/#.*//' /etc/rpm/noautoreqfiles)%{?_noautoreqfiles: %{_noautoreqfiles}}
413%__noautoprovfiles %(sed -e s'/#.*//' /etc/rpm/noautoprovfiles)%{?_noautoprovfiles: %{_noautoprovfiles}}
414%__noautoreq %(sed -e s'/#.*//' /etc/rpm/noautoreq)%{?_noautoreq: %{_noautoreq}}
415%__noautoreqdep %(sed -e s'/#.*//' /etc/rpm/noautoreqdep)%{?_noautoreqdep: %{_noautoreqdep}}
416%__noautoprov %(sed -e s'/#.*//' /etc/rpm/noautoprov)%{?_noautoprov: %{_noautoprov}}
338726a6
JB
417#%_noautocompressdoc %{nil}
418#
8f74418b
MM
419%_missing_doc_files_terminate_build 1%{nil}
420%_unpackaged_files_terminate_build %{nil}
8781dc74 421# (X)emacs support
d77dcb61 422%___emacs_lispdir_helper -batch -q -eval '(while load-path (princ (concat (car load-path) "\\n")) (setq load-path (cdr load-path)))' 2> /dev/null|sed -n '/\\(.*\\/x\\?emacs\\/site-lisp\\)\\/\\?$/{s,,\\1,p;q;}'
8781dc74
AF
423%_emacs_lispdir %(emacs %___emacs_lispdir_helper)
424%_xemacs_lispdir %(xemacs %___emacs_lispdir_helper)
25043cd4 425
02b58f60
JK
426%__php_provides %{nil}
427%__php_requires %{nil}
428%__perl_provides %{nil}
429%__perl_requires %{nil}
fa3497cd 430%__mono_provides %{nil}
431%__mono_requires %{nil}
25043cd4
AF
432
433# Perl specific macro definitions.
34f59add
ER
434%perl_privlib %(eval "`%{__perl} -V:installprivlib`"; echo $installprivlib)
435%perl_archlib %(eval "`%{__perl} -V:installarchlib`"; echo $installarchlib)
436%perl_vendorlib %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib)
c853f847 437%perl_vendorarch %(eval "`%{__perl} -V:installvendorarch`"; echo $installvendorarch)
34f59add
ER
438%perl_sitelib %(eval "`%{__perl} -V:installsitelib`"; echo $installsitelib)
439%perl_sitearch %(eval "`%{__perl} -V:installsitearch`"; echo $installsitearch)
25043cd4 440
45c00b39 441# Ruby
c5472d67
ER
442%ruby_archdir %(ruby -r rbconfig -e 'print Config::CONFIG["archdir"]' 2>/dev/null || echo ERROR)
443%ruby_ridir %(ruby -r rbconfig -e 'include Config; print File.join(CONFIG["datadir"], "ri", CONFIG["ruby_version"], "system")' 2>/dev/null || echo ERROR)
444%ruby_rubylibdir %(ruby -r rbconfig -e 'print Config::CONFIG["rubylibdir"]' 2>/dev/null || echo ERROR)
445%ruby_sitearchdir %(ruby -r rbconfig -e 'print Config::CONFIG["sitearchdir"]' 2>/dev/null || echo ERROR)
446%ruby_sitelibdir %(ruby -r rbconfig -e 'print Config::CONFIG["sitelibdir"]' 2>/dev/null || echo ERROR)
447%ruby_version %(ruby -r rbconfig -e 'print Config::CONFIG["ruby_version"]' 2>/dev/null || echo ERROR)
669604db
ER
448%ruby_ver_requires_eq Requires: ruby(ver) = %ruby_version
449%ruby_mod_ver_requires_eq Requires: ruby-modules(ver) = %ruby_version
45c00b39 450
c853f847 451%php_pear_dir %{_datadir}/pear
25043cd4 452
c1b2705c
ER
453# directory where php includes are installed on system.
454%__php_includedir /usr/include/php
0c5d1b9b 455# extract php/zend api versions
e9b6395a 456%php_major_version %(awk '/#define PHP_MAJOR_VERSION/{print $3}' %{__php_includedir}/main/php_version.h 2>/dev/null || echo ERROR)
c1b2705c 457%php_api_version %(awk '/#define PHP_API_VERSION/{print $3}' %{__php_includedir}/main/php.h 2>/dev/null || echo ERROR)
934c685f 458%php_pdo_api_version %(awk '/#define PDO_DRIVER_API/{print $3}' %{__php_includedir}/ext/pdo/php_pdo_driver.h 2>/dev/null || echo ERROR)
68b68193 459%php_debug %(awk '/#define ZEND_DEBUG/{print $3}' %{__php_includedir}/main/php_config.h 2>/dev/null || echo ERROR)
c1b2705c
ER
460%zend_module_api %(awk '/#define ZEND_MODULE_API_NO/{print $3}' %{__php_includedir}/Zend/zend_modules.h 2>/dev/null || echo ERROR)
461%zend_extension_api %(awk '/#define ZEND_EXTENSION_API_NO/{print $3}' %{__php_includedir}/Zend/zend_extensions.h 2>/dev/null || echo ERROR)
c0ac7203 462%zend_zts %(Z=$(grep -sc '^#define ZTS 1' %{__php_includedir}/main/php_config.h); echo ${Z:-ERROR})
c1b2705c
ER
463
464# helper macro
f952c0f3 465%__php_api_requires(v:) Requires: php%{-v*}(%{expand:%1}) = %{expand:%{%{!?2:%{1}}%{?2}}}
c1b2705c
ER
466
467# macros for public use
468# for php extensions (php-pecl)
68b68193 469%requires_php_extension %{__php_api_requires modules_api php_api_version} \
f952c0f3
ER
470%{__php_api_requires -v %php_major_version debug php_debug} \
471%{__php_api_requires -v %php_major_version thread-safety zend_zts}
68b68193 472
c1b2705c
ER
473# for zend extensions
474%requires_zend_extension %{__php_api_requires zend_module_api} \
68b68193 475%{__php_api_requires zend_extension_api} \
f952c0f3
ER
476%{__php_api_requires -v %php_major_version debug php_debug} \
477%{__php_api_requires -v %php_major_version thread-safety zend_zts}
c1b2705c 478
934c685f
ER
479# for php pdo modules (php-pecl-PDO_*)
480%requires_php_pdo_module %{__php_api_requires PDO_API php_pdo_api_version}
481
25043cd4
AF
482# Python specific macro definitions.
483# python main version
3241033b 484%py_ver %(python -c "import sys; print sys.version[:3]")
25043cd4
AF
485
486# directories
3241033b
ER
487%py_prefix %(python -c "import sys; print sys.prefix")
488%py_libdir %{py_prefix}/%{_lib}/python%{py_ver}
ef7ec0a8 489%py_scriptdir %{py_prefix}/share/python%{py_ver}
3241033b 490%py_incdir /usr/include/python%{py_ver}
ef7ec0a8
JK
491%py_sitedir %{py_libdir}/site-packages
492%py_sitescriptdir %{py_scriptdir}/site-packages
3241033b 493%py_dyndir %{py_libdir}/lib-dynload
25043cd4
AF
494
495# pure python modules compilation
3241033b 496%py_comp python -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])"
25043cd4 497
3241033b 498%py_ocomp python -O -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])"
25043cd4
AF
499
500# Software written in Python language require Python with main version
e63cd81d 501%pyrequires_eq() Requires: %1
25043cd4 502
f12c2314
AF
503# Hardlink binary identical .pyc and .pyo files
504# (idea by glen <at> pld-linux <dot> org)
505%__spec_install_post_py_hardlink {\
53d5af13 506%{!?no_install_post_py_hardlink: __spec_install_post_py_hardlink() { \
f12c2314
AF
507[ ! -d "$RPM_BUILD_ROOT" ] || find "$RPM_BUILD_ROOT" -name '*.pyc' | while read a; do \
508 b="$(echo $a|sed -e 's/.pyc$/.pyo/')"; \
509 if cmp -s "$a" "$b"; then \
510 ln -f "$a" "$b"; \
511 fi; \
512done \
53d5af13 513}; __spec_install_post_py_hardlink } }
f12c2314 514
9227b3f9 515# remove python sources, so that check-files won't complain
f12c2314
AF
516# (idea by glen <at> pld-linux <dot> org)
517%py_postclean() \
0f82e280 518for d in %{py_sitescriptdir} %{py_sitedir} %*; do \
820792a9 519 [ ! -d "$RPM_BUILD_ROOT$d" ] || find "$RPM_BUILD_ROOT$d" -name '*.py' -print0 | xargs -0r -l512 rm;\
f12c2314
AF
520done \
521%{nil}
522
0fc5cff8 523# depmod macro
524%depmod() { \
f6148427 525umask 022; \
0fc5cff8 526if [ -e /boot/System.map-%1 ]; then \
3241033b 527 /sbin/depmod -a -F /boot/System.map-%1 %1; \
0fc5cff8 528else \
3241033b
ER
529 if [ -e /boot/System.map ]; then \
530 /sbin/depmod -a -F /boot/System.map %1; \
531 else \
532 /sbin/depmod -a %1; \
533 fi \
0fc5cff8 534fi; \
535}
536
2afc6e64 537# XMMS specific macros
3241033b
ER
538%xmms_prefix %(xmms-config --prefix 2>/dev/null)
539%xmms_exec_prefix %(xmms-config --exec-prefix 2>/dev/null)
540%xmms_version %(xmms-config --version 2>/dev/null)
541%xmms_datadir %(xmms-config --data-dir 2>/dev/null)
542%xmms_plugindir %(xmms-config --plugin-dir 2>/dev/null)
543%xmms_visualization_plugindir %(xmms-config --visualization-plugin-dir 2>/dev/null)
544%xmms_input_plugindir %(xmms-config --input-plugin-dir 2>/dev/null)
545%xmms_output_plugindir %(xmms-config --output-plugin-dir 2>/dev/null)
546%xmms_effect_plugindir %(xmms-config --effect-plugin-dir 2>/dev/null)
547%xmms_general_plugindir %(xmms-config --general-plugin-dir 2>/dev/null)
2afc6e64 548
d1537778
PS
549%_target_base_arch %(echo %{_target_cpu} | sed 's/i.86/i386/;s/athlon/i386/;s/pentium./i386/;s/amd64/x86_64/;s/ia32e/x86_64/')
550
848c0d68 551# user/group checking macros
552#
553# Usage:
554# %userremove myuser
555#
556%userremove /usr/lib/rpm/user_group.sh user del
557%groupremove /usr/lib/rpm/user_group.sh group del
558#
559# Usage:
560# if %usertestrm myuser; then
561# /usr/sbin/userdel -r myuser
562# Note:
563# use these macros only if you need to call userdel/groupdel with
564# a non-standard option or take an extra action; otherwise use the
565# %userremove/%groupremove macros
566#
567%usertestrm /usr/lib/rpm/user_group.sh user testrm
568%grouptestrm /usr/lib/rpm/user_group.sh group testrm
08d9b1f6
JK
569# user group membership management macros
570#
571# Usage:
572# %addusertogroup myuser agroup
573#
574%addusertogroup /usr/lib/rpm/user_group.sh user addtogroup
72fcfcb3 575
576# banner support (useful in {pre,post}{,un} and triggers)
577#
578# Usage:
aa41c920 579# %banner name [-a] [-e] [-n] [-tn] <<EOF
72fcfcb3 580# the banner text, the banner text
aa41c920
ER
581# the banner text, and following line
582#EOF
583# You can use any form of here-document, <<'EOF' <<-EOT will do.
584# NOTE: if your use "<<-EOF", then You can actually indent inside here-document.
585#
72fcfcb3 586# -a - append to the banner
a8b9562a 587# -e - send to stderr instead of stdout
628754cb 588# -n - no show banner (overrides -t)
589# -t - show only, if RPM_SCRIPTVERBOSITY >= n; default n=5
aa41c920 590%banner(aent:) \
1b334fe4 591RPM_SCRIPTVERBOSITY=5 \
592[ -r /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm \
593if [ -x /usr/bin/banner.sh ]; then \
aa41c920 594 CMD="/usr/bin/banner.sh %{-e:--stderr} %{!-n:$([ $RPM_SCRIPTVERBOSITY -ge %{-t:%{-t*}}%{!-t:5} ] && echo -s)} %{!-a:-m}%{-a:-M} %1" \
1b334fe4 595else \
a8b9562a 596 CMD="cat%{-e: >&2}" \
1b334fe4 597fi \
c2e886e1 598eval $CMD %2%{?3: %3} \
72fcfcb3 599%nil
628754cb 600
90627280
ER
601# useradd/groupadd macros written by glen@pld-linux.org.
602# All rights reserved. Permission to copy is hereby granted.. yada, yada, yada
603#
604# Usage:
605# %useradd [-P package] [-u uid] [-d home_dir] [-s shell] [-c comment]
606# [-g initial_group] [-G group[,...]] login
607#
608# -u uid. REQUIRED
609# -g gid/group. REQUIRED
610# -s defaults to /bin/false
611# -d defaults to /usr/share/empty
612# -c No default
613# -r is accepted but ignored (it's always set)
6bd4c218 614# -k skeleton dir. defaults to /usr/share/empty
90627280
ER
615# rpm specific flags
616# -P package name. defaults to %{name}
617#
90627280 618%useradd(c:d:e:f:g:G:Mmk:op:s:u:rP:) \
9ba02ba9
ER
619%{!-u:%{error:useradd: Required argument -u missing}} \
620%{!-g:%{error:useradd: Required argument -g missing}} \
621%{!?1:%{error:useradd: Required parameter login missing}} \
90627280
ER
622if [ -n "`/bin/id -u %{expand:%{%{#}}} 2>/dev/null`" ]; then \
623 if [ "`/bin/id -u %{expand:%{%{#}}}`" != "%{-u*}" ]; then \
624 echo "Error: user %{expand:%{%{#}}} doesn't have uid=%{-u*}. Correct this before installing %{-P*}%{!?-P:%{name}}." 1>&2 \
625 exit 1 \
626 fi \
627else \
628 echo "Adding user %{expand:%{%{#}}} UID=%{-u*}." \
629 /usr/sbin/useradd \\\
b5a7d552 630 %{-m:-m -k %{-k*}%{!-k:/usr/share/empty}} \\\
90627280
ER
631 -u %{-u*} \\\
632 -r \\\
633 -d %{-d*}%{!-d:/usr/share/empty} \\\
634 -s %{-s*}%{!-s:/bin/false} \\\
840e7b00 635 %{-c:-c "%(set -- %{-c*} %{*}; echo $1)"}\\\
90627280
ER
636 -g %{-g*} \\\
637 %{-M} \\\
638 %{-G:-G %{-G*}} \\\
1aac682a
ER
639 %{expand:%{%{#}}} 1>&2 || exit $? \
640 [ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i passwd \
90627280
ER
641fi;
642
90627280
ER
643# Usage:
644# %groupadd [-P package] [-g gid] group
645#
646# -g gid. REQUIRED
647#
648# Sample:
649# %groupadd -P %{name}-base -g %{gid} %{name}
650
651%groupadd(g:P:rfo) \
9ba02ba9
ER
652%{!-g:%{error:groupadd: Required argument -g missing}} \
653%{!?1:%{error:groupadd: Required parameter group missing}} \
90627280
ER
654if [ -n "`/usr/bin/getgid %{1}`" ]; then \
655 if [ "`/usr/bin/getgid %{1}`" != "%{-g*}" ]; then \
656 echo "Error: group %{1} doesn't have gid=%{-g*}. Correct this before installing %{-P*}%{!?-P:%{name}}." 1>&2 \
657 exit 1 \
658 fi \
659else \
660 echo "Adding group %{1} GID=%{-g*}." \
1aac682a
ER
661 /usr/sbin/groupadd -g %{-g*} -r %{1} 1>&2 || exit $? \
662 [ ! -x /usr/sbin/nscd ] || /usr/sbin/nscd -i group \
90627280 663fi;
7cb77741
ER
664
665# apache_config_{install/uninstall} macros written by glen@pld-linux.org.
666# All rights reserved. Permission to copy is hereby granted.. yada, yada, yada
667#
a0bbe604
ER
668# You should use webapp macros instead. these are here until single piece of them is gone from specs ;)
669#
7cb77741
ER
670# The config is installed/removed inside trigger, this means that you can any
671# time install apache1 or apache package and the configuration file is updated.
672# if you don't need the config for various reason for specific apache, just
673# remove the symlink from apache config directory. the trigger will not put the
674# config again to that version of apache. In other words the config is linked
675# to apache config directory on first install of PACKAGE or apache.
676#
677# should be called in trigger body:
678# %triggerin -- apache1 >= 1.3.33-2
679# %apache_config_install -v 1
680#
681# Add package's apache config to apache config.
682#
683# Usage:
684# %apache_config_install -v {1|2} -c %{_sysconfdir}/apache-%{name}.conf -n 99
685#
686# -v REQUIRED: specify apache version. can be 1 or 2.
687# -c OPTIONAL: specify full path to PACKAGE's config. Defaults to %{_sysconfdir}/apache-%{name}.conf.
688# -n OPTIONAL: specify config "slot". defaults to 99
13ee223c 689# -f OPTIONAL: force symlink creation regardless if package was upraded. useful in triggers
7cb77741
ER
690#
691# Internal macros. don't use ;).
692# expands apache config dir by apache version at build time.
693%__apache_confdir() %(if [ %{1} = 1 ]; then echo /etc/apache/conf.d; elif [ %{1} = 2 ]; then echo /etc/httpd/httpd.conf; else echo >&2 Unknown apache version specified; fi)
694# expands apache service name by apache version at build time.
695%__apache_svcname() %(if [ %{1} = 1 ]; then echo apache; elif [ %{1} = 2 ]; then echo httpd; else echo >&2 Unknown apache version specified; fi)
696
13ee223c 697%apache_config_install(fv:c:n:) \
7cb77741
ER
698%{!-v:%{error:apache_config_install: Required argument -v missing}} \
699%{?debug:set -x; echo "apache_config_install:%{-v*} %{name}-%{version}-%{release} 1:[$1]; 2:[$2]"} \
13ee223c 700if [ -n "%{-f:1}" ] || ([ "$1" = "1" ] && [ "$2" = "1" ]) && [ -d %{__apache_confdir %{-v*}} ]; then\
7cb77741
ER
701 ln -sf %{-c*}%{!-c:%{_sysconfdir}/apache-%{name}.conf} %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf\
702fi\
e5a1a393 703# reload apache if the config symlink is there\
de11f042 704if [ -L %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf ]; then\
ab251261
ER
705 # additionally don't reload if target package (the webserver) is upgraded, as webserver is restarted anyway in %post \
706 if [ "$2" != "2" ] && [ -f /var/lock/subsys/%{__apache_svcname %{-v*}} ]; then\
e5a1a393 707 /etc/rc.d/init.d/%{__apache_svcname %{-v*}} reload 1>&2\
7cb77741
ER
708 fi\
709fi\
710%{nil}
711
712# Remove package's apache config from apache config.
713#
714# Usage:
715# %apache_config_uninstall -v {1|2} -n 99
716#
717# -v REQUIRED: specify apache version. can be 1 or 2.
718# -n OPTIONAL: specify config "slot". defaults to 99
719%apache_config_uninstall(v:n:) \
720%{!-v:%{error:apache_config_uninstall: Required argument -v missing}} \
721%{?debug:set -x; echo "apache_config_uninstall:%{-v*} %{name}-%{version}-%{release}: 1:[$1]; 2:[$2]"} \
feb15ceb 722# remove link if either of the packages are gone \
7cb77741
ER
723if [ "$1" = "0" ] || [ "$2" = "0" ]; then \
724 if [ -L %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf ]; then \
725 rm -f %{__apache_confdir %{-v*}}/%{-n*}%{!-n:99}_%{name}.conf \
726 if [ -f /var/lock/subsys/%{__apache_svcname %{-v*}} ]; then \
e5a1a393 727 /etc/rc.d/init.d/%{__apache_svcname %{-v*}} reload 1>&2 \
7cb77741
ER
728 fi \
729 fi \
730fi \
731%{nil}
732
7c50f037 733# webapp macros
35663282
ER
734#
735# The config is installed/removed inside trigger, this means that you can any
736# time install apache1/apache/lighttpd package and the configuration file is
fe6c4bdd 737# updated. if you don't need the config for various reason for specific
35663282
ER
738# webserver, just remove the symlink from config directory using webapp
739# program. the trigger will not recreate the symlink on upgrades. In other
740# words the config is linked to webserver config directory on first install of
741# PACKAGE or WEBSERVER.
742#
7c50f037
ER
743# Add package's webserver config to webserver webapps dir.
744# Usage:
df979130 745# %webapp_register WEBSERVER WEBAPP
35663282
ER
746#
747%webapp_register() \
748%{?debug:set -x; echo "webapp_register: %{name}-%{version}-%{release} 1:[$1]; 2:[$2]"} \
749if [ "$1" = "1" ] && [ "$2" = "1" ]; then\
750 /usr/sbin/webapp register %1 %2\
751fi\
694a8f2e 752# reload webserver if the config symlink is there and skip reload if webserver is upgraded\
6ec4309e 753if [ -L /etc/%1/webapps.d/%2.conf ] && [ "$2" -lt "2" ]; then\
16897aea 754 %{expand:%service -q %%1 reload}\
35663282
ER
755fi\
756%{nil}
757
758# Remove package's config from webserver webapps dir.
35663282 759# Usage:
531c0efc
ER
760# %webapp_register [-f] WEBSERVER WEBAPP
761%webapp_unregister(f) \
35663282
ER
762%{?debug:set -x; echo "webapp_unregister: %{name}-%{version}-%{release}: 1:[$1]; 2:[$2]"} \
763# remove link if either of the packages are gone \
531c0efc 764if [ -n "%{-f:1}" ] || [ "$1" = "0" ] || [ "$2" = "0" ] && [ -L /etc/%1/webapps.d/%2.conf ]; then \
df979130 765 /usr/sbin/webapp unregister %1 %2\
16897aea 766 %{expand:%service -q %%1 reload}\
35663282
ER
767fi \
768%{nil}
769
d87a3f0b
ER
770# see browser-plugins.spec / template-browser-plugin.spec
771# written by glen@pld-linux.org.
bba6d017 772%nsplugin_install(d:f) { \
d87a3f0b 773# create link if it's first install of either of the packages \
bba6d017 774if [ -n "%{-f:1}" ] || ([ "$1" = "1" ] && [ "$2" = "1" ] && [ -d %{-d*} ]); then \
d87a3f0b
ER
775( \
776%( \
777 for file in %{*}; do \
778 echo echo Installing $file to %{-d*}; \
779 echo "ln -sf %{_libdir}/browser-plugins/$file %{-d*};"; \
780 done ) \
781) | ( %banner -t 5 -e %{name}-in ); fi; \
782}
783
933139a5 784%nsplugin_uninstall(d:) { \
d87a3f0b
ER
785# remove link if either of the packages are gone \
786if [ "$1" = "0" ] || [ "$2" = "0" ]; then \
787( \
788%( \
789 for file in %{*}; do \
790 echo echo Removing $file from %{-d*}; \
791 echo "rm -f %{-d*}/$file;"; \
792 done ) \
793) | ( %banner -t 5 -e %{name}-un ); fi; \
794}
462b26fa
ER
795
796# service macro.
797#
798# calls usual service restart on package %post, but skips the restart if
799# administrator has disabled automatic service restarts in either global
800# /etc/sysconfig/rpm or per service /etc/sysconfig/SERVICE file.
801#
802# written by glen@pld-linux.org.
803# All rights reserved. Permission to copy is hereby granted.. yada, yada, yada
804#
805# Usage:
3e913a30 806# %service [-q] SERVICE ACTION ["SERVICE NICE DESCRIPTION"]
462b26fa 807#
a0bbe604 808# -q be silent when service isn't started (for scriplets restaring other package's services)
462b26fa 809#
8b781cff 810%service(q) {{%(export quiet=%{-q:1}; /usr/lib/rpm/service_generator.sh %{*}) };}
6aedae62
ER
811
812
813# java macros. based on jpackage macros.java
fe6c4bdd
ER
814%_jvmdir %{_prefix}/lib/jvm
815%_jvmjardir %{_prefix}/lib/jvm-exports
816%_jvmprivdir %{_prefix}/lib/jvm-private
817%_jvmlibdir %{_prefix}/lib/jvm
818%_jvmdatadir %{_datadir}/jvm
819%_jvmsysconfdir %{_sysconfdir}/jvm
6aedae62
ER
820%_jvmcommonlibdir %{_prefix}/lib/jvm-commmon
821%_jvmcommondatadir %{_datadir}/jvm-commmon
822%_jvmcommonsysconfdir %{_sysconfdir}/jvm-commmon
fe6c4bdd
ER
823%_javadir %{_datadir}/java
824%_jnidir %{_prefix}/lib/java
825%_javadocdir %{_datadir}/javadoc
826%java_home %(unset JAVA_HOME; . %{_javadir}-utils/java-functions; set_jvm; echo $JAVA_HOME)
6aedae62 827
fe6c4bdd
ER
828%ant JAVA_HOME=%{java_home} ant
829%jar %{java_home}/bin/jar
830%java %(unset JAVACMD; . %{_javadir}-utils/java-functions; set_javacmd; echo $JAVACMD)
831%javac %{java_home}/bin/javac
832%javadoc %{java_home}/bin/javadoc
6aedae62 833
fe6c4bdd 834%add_jvm_extension JAVA_LIBDIR=%{buildroot}/%{_javadir} %{_bindir}/jvmjar -l
6aedae62
ER
835
836%jpackage_script() \
837install -d -m 755 $RPM_BUILD_ROOT%{_bindir}\
838cat > $RPM_BUILD_ROOT%{_bindir}/%5 << EOF \
839#!/bin/sh\
840#\
841# %{name} script\
842# JPackage Project <http://www.jpackage.org/>\
843\
844# Source functions library\
845. %{_javadir}-utils/java-functions\
846\
847# Source system prefs\
848if [ -f %{_sysconfdir}/java/%{name}.conf ] ; then\
fe6c4bdd 849 . %{_sysconfdir}/java/%{name}.conf\
6aedae62
ER
850fi\
851\
852# Source user prefs\
853if [ -f \\$HOME/.%{name}rc ] ; then\
fe6c4bdd 854 . \\$HOME/.%{name}rc\
6aedae62
ER
855fi\
856\
857# Configuration\
858MAIN_CLASS=%1\
859BASE_FLAGS=%2\
860BASE_OPTIONS=%3\
861BASE_JARS="%(echo %4 | sed -e 's,:, ,g')"\
862\
863# Set parameters\
864set_jvm\
865set_classpath \\$BASE_JARS\
866set_flags \\$BASE_FLAGS\
867set_options \\$BASE_OPTIONS\
868\
869# Let's start\
870run "\\$@"\
871EOF
872
fe6c4bdd 873# vim:ts=8 sw=8 noet
This page took 0.273663 seconds and 4 git commands to generate.