- cannot rely on _libdir macro here
[packages/rpm-build-macros.git] / rpm.macros
CommitLineData
d54662bf
AF
1# PLD rpm macros
2
f633038a 3# other macros
e05017c1 4%epoch 0
f633038a
AM
5%_enable_debug_packages 1
6
8f74418b
MM
7%__id @__ID@
8%__id_u %{__id} -u
9%__chown_Rhf @__CHOWN_RHF@
10%__chgrp_Rhf @__CHGRP_RHF@
11
07163ba3 12%_fixowner [ `%{__id_u}` = '0' ] && %{__chown_Rhf} root:@ROOT_GROUP@
d54662bf 13%_fixgroup true
16cb1d91 14%_fixperms %{__chmod} -Rf @FIXPERMS@
d54662bf 15%_topdir %(echo $HOME)/rpm
9c404149
AM
16#-----------------------------------------------------------------
17# CFLAGS and LDFLAGS used to build
18
7bec8f51 19%debuginfocflags %{expand:%%define __dic_%{?_enable_debug_packages} 1}%{?__dic_1: -ggdb}%{expand:%%undefine __dic_%{?_enable_debug_packages}}
f633038a 20
8f74418b 21%debugcflags -O0 -g -Wall
81082386 22%rpmcflags %{?debug:%debugcflags}%{!?debug:%optflags}%{?debuginfocflags}
f4cc8832 23%rpmcxxflags %{rpmcflags} -fvisibility-inlines-hidden
6f45e5bb 24%rpmldflags %{nil}
9c404149 25
ba1fdedc 26# kernel compiler
d2e1bc22 27%kgcc gcc
28%kgcc_package gcc
ba1fdedc 29
33040789 30# Build system path macros.
31#
32%__libtoolize libtoolize --copy --force
83094b62 33%__gettextize { \
afff6d37 34 if ! gettextize --version | grep -q '0\.10\.' ; then \
8a995cff
JB
35 if grep -qs 'AM_GNU_GETTEXT.*external' configure.{ac,in} ; then \
36 gettextize --copy --force --no-changelog; \
97589b6e 37 else \
8a995cff
JB
38 gettextize --copy --force --no-changelog --intl; \
39 fi; \
40 if [ ! -f po/Makevars ]; then \
41 cp -f po/Makevars{.template,}; \
42 fi; \
43 else \
44 gettextize --copy --force; \
83094b62 45 fi; \
8a995cff
JB
46}
47%__autopoint autopoint --force
bcdab9c2 48%__automake automake -a -c -f --foreign
be3a1985 49%__autoconf autoconf %{?debug:-Wall}
33040789 50
6a5eda77 51%dependencytracking %{nil}
9c404149 52#-----------------------------------------------------------------
9f4ce098 53%configure2_13 { \
9c404149
AM
54 if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \
55 LDFLAGS="${LDFLAGS:-%rpmldflags}" ; export LDFLAGS ; \
56 CFLAGS="${CFLAGS:-%rpmcflags}" ; export CFLAGS ; \
f4cc8832 57 CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" ; export CXXFLAGS ; \
9c404149 58 FFLAGS="${FFLAGS:-%rpmcflags}" ; export FFLAGS ; \
8ec1a12b 59 CPPFLAGS="${CPPFLAGS:-}" ; export CPPFLAGS ; \
8983c4c4
AM
60 %{?__cc:CC="%{__cc}" ; export CC ; } \
61 %{?__cxx:CXX="%{__cxx}" ; export CXX ; } \
8f74418b 62 %{?configuredir:%{configuredir}}%{!?configuredir:.}/configure \
2a7cfd3f 63 --host=%{_target_platform} \
9c404149
AM
64 --prefix=%{_prefix} \
65 --exec-prefix=%{_exec_prefix} \
66 --bindir=%{_bindir} \
67 --sbindir=%{_sbindir} \
68 --sysconfdir=%{_sysconfdir} \
69 --datadir=%{_datadir} \
70 --includedir=%{_includedir} \
71 --libdir=%{_libdir} \
72 --libexecdir=%{_libexecdir} \
73 --localstatedir=%{_localstatedir} \
74 --sharedstatedir=%{_sharedstatedir} \
75 --mandir=%{_mandir} \
76 --infodir=%{_infodir} \
c0d1b3ad 77 --x-libraries=/usr/X11R6/%{_lib} \
93059874 78 %{dependencytracking} \
9c404149
AM
79}
80
4a6b0d54 81#----------------------------------------------------------------
57f4166d 82%configure {./configure \
4a6b0d54
AF
83 LDFLAGS="${LDFLAGS:-%rpmldflags}" \
84 CFLAGS="${CFLAGS:-%rpmcflags}" \
f4cc8832 85 CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" \
4a6b0d54 86 FFLAGS="${FFLAGS:-%rpmcflags}" \
a2bd5992 87 CPPFLAGS="${CPPFLAGS:-}" \
8983c4c4
AM
88 %{?__cc:CC="%{__cc}"} \
89 %{?__cxx:CXX="%{__cxx}"} \
4a6b0d54
AF
90 --build=%{_target_platform} \
91 --prefix=%{_prefix} \
92 --exec-prefix=%{_exec_prefix} \
93 --bindir=%{_bindir} \
94 --sbindir=%{_sbindir} \
95 --sysconfdir=%{_sysconfdir} \
96 --datadir=%{_datadir} \
97 --includedir=%{_includedir} \
98 --libdir=%{_libdir} \
99 --libexecdir=%{_libexecdir} \
100 --localstatedir=%{_localstatedir} \
101 --sharedstatedir=%{_sharedstatedir} \
102 --mandir=%{_mandir} \
103 --infodir=%{_infodir} \
c0d1b3ad 104 --x-libraries=/usr/X11R6/%{_lib} \
93059874 105 %{dependencytracking} \
4a6b0d54
AF
106}
107
7dbab518 108# ------------------------------------------------------------------------
c80506a3
AM
109# Overloading of some basic macros
110%prep \
111%%prep\
112LANG=C\
113export LANG\
14e77e64 114unset DISPLAY ||:\
c80506a3
AM
115%{nil}
116
117%build %%build\
118LANG=C\
119export LANG\
14e77e64 120unset DISPLAY ||:\
c80506a3
AM
121%{nil}
122
123%install %{?_enable_debug_packages:%{?buildsubdir:%{debug_package}}}\
124%%install\
125LANG=C\
126export LANG\
14e77e64 127unset DISPLAY ||:\
c80506a3
AM
128%{nil}
129
130# ------------------------------------------------------------------------
7dbab518
MM
131# Conditional build stuff.
132
133# Check if symbol is defined.
134# Example usage: %if %{defined with_foo} && %{undefined with_bar} ...
135%defined() %{expand:%%{?%{1}:1}%%{!?%{1}:0}}
136%undefined() %{expand:%%{?%{1}:0}%%{!?%{1}:1}}
137
566fa098
MM
138# Shorthand for %{defined with_...}
139%with() %{expand:%%{?with_%{1}:1}%%{!?with_%{1}:0}}
140%without() %{expand:%%{?with_%{1}:0}%%{!?with_%{1}:1}}
141
7dbab518
MM
142# Handle conditional builds. %bcond_with is for case when feature is
143# default off and needs to be activated with --with ... command line
144# switch. %bcond_without is for the dual case.
145#
146# %bcond_with foo defines symbol with_foo if --with foo was specified on
147# command line.
148# %bcond_without foo defines symbol with_foo if --without foo was *not*
149# specified on command line.
150#
151# For example:
152#
153# %bcond_with extra_fonts
154# %bcond_without static
f52f9976 155# %if %{with extra_fonts}
7dbab518
MM
156# ...
157# %endif
f52f9976 158# %ifdef %{with static}
7dbab518
MM
159# ...
160# %endif
161# %{?with_static: ... }
162# %{!?with_static: ... }
163# %{?with_extra_fonts: ... }
164# %{!?with_extra_fonts: ... }
165#
166# The bottom line: never use without_foo, _with_foo nor _without_foo, only
167# with_foo. This way changing default set of bconds for given spec is just
168# a matter of changing single line in it and syntax is more readable.
169%bcond_with() %{expand:%%{?_with_%{1}:%%global with_%{1} 1}}
170%bcond_without() %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}}
171# ------------------------------------------------------------------------
172
9c404149
AM
173# Location of autoconf macros
174%_aclocaldir %(aclocal --print-ac-dir)
175
e2804f99
AM
176# Location of omf files
177%_omf_dest_dir %(scrollkeeper-config --omfdir)
178
e987a186 179# Location of pkgconfig files
9a4e877a 180%_pkgconfigdir /usr/%{_lib}/pkgconfig
e987a186 181
486b0b5f 182# Location of desktop files
183%_desktopdir /usr/share/applications
86dff2d0 184%_applnkdir ERROR:_applnkdir_is_obsolete_use_desktopdir_instead
486b0b5f 185
481463e9 186# Location of pixmaps for applnk/desktop files
e1f0a822 187%_pixmapsdir /usr/share/pixmaps
9c404149 188
481463e9 189# Location of themable icons for applnk/desktop files
b36c8e2a 190%_iconsdir /usr/share/icons
191
e987a186
JB
192# Location of fonts directories
193%_fontsdir /usr/share/fonts
194
b3282f3f 195# Location of Gtk and associated libraries documentation
6eed6d84 196%_gtkdocdir %{_defaultdocdir}/gtk-doc/html
b3282f3f 197
fc4d7771 198# Location of KDE documentation
199%_kdedocdir %{_defaultdocdir}/kde/HTML
200
5869828c 201# unsermake script
202%__unsermake /usr/share/unsermake/unsermake
203
9c404149
AM
204# Current date
205%date %(LC_ALL="C" date +"%a %b %d %Y")
206
207# tmp directory
208%tmpdir %(echo "${TMPDIR:-/tmp}")
209
210# Example files, programs, scripts...
211%_examplesdir /usr/src/examples
212
8377d27d 213# The directory holding Linux kernel sources
214%_kernelsrcdir /usr/src/linux
215
9c404149 216# If non-empty "debug" macro defined, add "dbg" suffix to release number
8f74418b 217%_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}%{?debug:dbg}.%%{ARCH}.rpm
9c404149 218
8f74418b 219# Requires name = version-release
16cb1d91 220%requires_releq() %(LC_ALL="C" echo '%*' | xargs -r rpm -q --qf 'Requires: %%{name} = %%{epoch}:%%{version}-%%{release}\\n' | sed -e 's/ (none):/ /' | grep -v "is not")
8bf3719d 221
16cb1d91
JB
222%releq_kernel_up() %(LC_ALL="C" rpm -qf --qf 'kernel-up = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' | grep -vE "(is not|no such)")
223%releq_kernel_smp() %(LC_ALL="C" rpm -qf --qf 'kernel-smp = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' | grep -vE "(is not|no such)")
224%requires_releq_kernel_up() %(LC_ALL="C" rpm -qf --qf 'PreReq: kernel-up = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' | grep -vE "(is not|no such)")
225%requires_releq_kernel_smp() %(LC_ALL="C" rpm -qf --qf 'PreReq: kernel-smp = %%{epoch}:%%{version}-%%{release}\\n' %{_kernelsrcdir}/include/linux/version.h | sed -e 's/ (none):/ /' | grep -vE "(is not|no such)")
8bf3719d 226
16cb1d91 227%requires_eq_to() %(LC_ALL="C" rpm -q --qf 'Requires: %1 = %%{epoch}:%%{version}\\n' %2 | sed -e 's/ (none):/ /' | grep -v "is not")
01a9f990 228
179fcc7f 229%apache_modules_api %(awk '/#define MODULE_MAGIC_NUMBER_MAJOR/ {print $3}' /usr/include/apache/ap_mmn.h 2>/dev/null || echo ERROR)
b9d5d440 230
231# kernel version-release handling
541d11fe 232%__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))
8fecb226 233%__kernel_rel %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/fs.h --queryformat "%{RELEASE}" | grep -v "is not")
16cb1d91
JB
234%__kernel_rpmvr %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/fs.h --queryformat "%{VERSION}-%{RELEASE}" | grep -v "is not")
235%_kernel_ver %{__kernel_ver}%{?with_dist_kernel:%(echo %{__kernel_ver} | grep -q -e - || echo -%{__kernel_rel})}
f62e856d 236%_kernel_ver_str %(echo %{!?_without_dist_kernel:%{__kernel_rpmvr}}%{?_without_dist_kernel:%{__kernel_ver}} | sed -e 's/-/_/g')
87be1cf0 237
e00dd7f6 238# sgml macros
741b471b 239%xmlcat_add() /usr/bin/xmlcatalog --noout --add nextCatalog \"\" %1 /etc/xml/catalog ;
240%xmlcat_del() /usr/bin/xmlcatalog --noout --del %1 /etc/xml/catalog ;
847db862 241%xmlcat_add_rewrite /usr/bin/xmlcatalog --noout --add rewriteSystem
741b471b 242%xmlcat_create() /usr/bin/xmlcatalog --noout --create %1 ;
243%sgmlcat_add() /usr/bin/install-catalog --add %1 %2 > /dev/null ;
244%sgmlcat_del() /usr/bin/install-catalog --remove %1 %2 > /dev/null ;
e00dd7f6 245%docbook_sgmlcat_fix() { for l in \
246'' \
247' -- default decl --' \
248'DTDDECL "-//OASIS//DTD DocBook XML V%2//EN" "../../xml.dcl"' \
249' -- hacks for opensp --' \
250'SYSTEM "file://%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \
251'SYSTEM "http://www.oasis-open.org/docbook/xml/%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \
252'' \
253; do echo $l; done >> %1 \
254}
255
9c404149
AM
256#-----------------------------------------------------------------
257# find and gzip all files in %{_mandir} and %{infodir}
258#
259# Requires: xargs, find
260#
261#%no_install_post_compress_docs 1
262%__spec_install_post_compress_docs { \
9c404149 263%{!?no_install_post_compress_docs: \
822d4d81 264 echo "Compress man and info pages."; \
9c404149
AM
265 %{?verbose:set -x;} \
266 for i in /usr/share/man /usr/X11R6/man /usr/share/info; do \
267 if [ -d "$RPM_BUILD_ROOT$i" ]; then \
268 find "$RPM_BUILD_ROOT$i" -name \*.bz2 -print | xargs -r %{__bzip2} -df; \
269 find "$RPM_BUILD_ROOT$i" -name \*.gz -print | xargs -r %{__gzip} -dnf; \
270 find "$RPM_BUILD_ROOT$i" -type f -print | xargs -r %{__gzip} -9nf; \
271 fi; \
272 done; \
273} }
274
275#-----------------------------------------------------------------
276# Strip executable binaries and shared object files
277#
278# Requires: find, awk, strip, cut, xargs
279#
280#%no_install_post_strip 1
281%__spec_install_post_strip {%{!?debug: \
282%{!?no_install_post_strip: \
9f0d4f36
JB
283 %{?verbose:set -x;} \
284 if [ -d "$RPM_BUILD_ROOT" ]; then \
8f74418b 285 echo "Strip executable binaries, archives and shared object files."; \
60ad88f2 286 filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" %{?_noautostrip:! -regex "%{_noautostrip}"}`; \
9c404149
AM
287 elfexelist=`echo $filelist | xargs -r file | \
288 awk '/ELF.*executable/ {print $1}' | cut -d: -f1`; \
289 elfsharedlist=`echo $filelist | xargs -r file | \
290 awk '/LF.*shared object/ {print $1}' | cut -d: -f1`; \
8f74418b
MM
291 elfarchiveslist=`echo $filelist | xargs -r file | \
292 awk '/current ar archive/ {print $1}' | cut -d: -f1`; \
9c404149 293 if [ -n "$elfexelist" ]; then \
60ad88f2 294 %{__strip} --remove-section=.note --remove-section=.comment $elfexelist; \
9c404149
AM
295 fi; \
296 if [ -n "$elfsharedlist" ]; then \
60ad88f2 297 %{__strip} --strip-unneeded --remove-section=.note --remove-section=.comment $elfsharedlist; \
8f74418b
MM
298 fi; \
299 if [ -n "$elfarchiveslist" ]; then \
60ad88f2 300 %{__strip} --strip-debug --remove-section=.note --remove-section=.comment $elfarchiveslist; \
9f0d4f36
JB
301 fi; \
302 fi; } \
9c404149 303} }
fc5d7e20 304#-----------------------------------------------------------------
305# remove all RPATH from executable binaries and shared object files
306#
307# Requires: find, awk, cut, xargs, chrpath, uname
308#
309#%no_install_post_chrpath 1
310%__spec_install_post_chrpath {%{!?debug: \
311%{!?no_install_post_chrpath: \
312 %{?verbose:set -x;} \
9f0d4f36 313if [ -d "$RPM_BUILD_ROOT" ]; then \
fc5d7e20 314echo "Remove RPATH from executable binaries and shared object files."; \
adb39da4 315find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" ! -regex ".*/usr/lib[0-9]*/debug/.*" %{?_noautochrpath:! -regex "%{_noautochrpath}"} | xargs -r file | \
5bed2bb7 316 awk '/ELF.*(executable.*dynamically linked|shared object)/ {print $1}' | cut -d: -f1 | \
fc5d7e20 317while read file ; do \
318 rpath= ; \
319 chmod u+w "$file"; \
320 for dir in `chrpath -l "$file" | \
321 awk '/RPATH=/ { gsub(/.*RPATH=/,""); gsub(/:/," "); print $0 }'` ; do \
322 case $dir in \
494e368c 323 /home/* | /tmp/* | /usr/lib | /usr/lib64 | /lib | /lib64 | /usr/local/lib | /usr/local/lib64 | /usr/X11R6/lib | /usr/X11R6/lib64 ) \
fc5d7e20 324 echo "remove-rpath: $dir in $file"; \
325 ;; \
326 * ) \
327 if [ "$rpath" = "" ] ; then rpath="$dir" ; \
328 else rpath="$rpath:$dir" ; fi ; \
329 ;; \
330 esac ; \
331 done ; \
332 if [ "$rpath" = "" ] ; then chrpath -d "$file" > /dev/null ; \
333 else chrpath -r "$rpath" "$file" > /dev/null ; fi ; \
9f0d4f36
JB
334done; \
335fi; } \
fc5d7e20 336} }
d72c185f 337#-----------------------------------------------------------------
ccb8ae8d 338# Find and gzip all kernel modules
339#
340# Requires: find
341#
342#%no_install_post_compress_modules 1
343%__spec_install_post_compress_modules { \
ccb8ae8d 344%{!?no_install_post_compress_modules: \
345 %{?verbose:set -x;} \
9f0d4f36
JB
346 if [ -d "$RPM_BUILD_ROOT" ]; then \
347echo "Compress kernel modules if any."; \
d618340e 348 if test -d $RPM_BUILD_ROOT/lib/modules ; then \
16cb1d91
JB
349 find $RPM_BUILD_ROOT/lib/modules -name \*o -type f -print | \
350 xargs -r %{__gzip} -9nf; \
a33b1418 351 find $RPM_BUILD_ROOT/lib/modules -name \*o -type l -printf "%p %l\n" | \
03b234a5 352 while read a b; do ln -sf $b.gz $a.gz; rm -f $a; done; \
d618340e 353 fi; \
9f0d4f36 354 fi; \
ccb8ae8d 355} }
9c404149
AM
356
357%_source_payload w9.gzdio
358%_binary_payload w9.bzdio
359
83094b62 360#-----------------------------------------------------------------
361# Update all GConf2 schemas
362#
363# Requires: GConf2
364#
7bd8c922 365%gconf_schema_install { umask 022; \
366 GCONF_CONFIG_SOURCE="xml:readwrite:/etc/gconf/gconf.xml.defaults" \
367 /usr/bin/gconftool-2 --makefile-install-rule \
368 /etc/gconf/schemas/*.schemas > /dev/null \
3ee1090a 369}
83094b62 370
9c404149
AM
371#-----------------------------------------------------------------
372# post %install sequence:
373# - autodeps exceptions
374# - compress all man and info pages,
375# - strip all ELF executables and ELF shared objects if not %debug.
8f74418b 376# - compress kernel modules if any
9c404149
AM
377
378###################################################################
379# Requires/Provides automation
380# exceptions system by Jacek Konieczny <jajcus@pld.org.pl>
338726a6 381#
2892b5df
JB
382%__noautoreqfiles %(sed -e s'/#.*//' /etc/rpm/noautoreqfiles)%{?_noautoreqfiles: %{_noautoreqfiles}}
383%__noautoprovfiles %(sed -e s'/#.*//' /etc/rpm/noautoprovfiles)%{?_noautoprovfiles: %{_noautoprovfiles}}
384%__noautoreq %(sed -e s'/#.*//' /etc/rpm/noautoreq)%{?_noautoreq: %{_noautoreq}}
385%__noautoreqdep %(sed -e s'/#.*//' /etc/rpm/noautoreqdep)%{?_noautoreqdep: %{_noautoreqdep}}
386%__noautoprov %(sed -e s'/#.*//' /etc/rpm/noautoprov)%{?_noautoprov: %{_noautoprov}}
338726a6
JB
387#%_noautocompressdoc %{nil}
388#
8f74418b
MM
389%_missing_doc_files_terminate_build 1%{nil}
390%_unpackaged_files_terminate_build %{nil}
8781dc74 391# (X)emacs support
d77dcb61 392%___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
393%_emacs_lispdir %(emacs %___emacs_lispdir_helper)
394%_xemacs_lispdir %(xemacs %___emacs_lispdir_helper)
25043cd4 395
02b58f60
JK
396%__php_provides %{nil}
397%__php_requires %{nil}
398%__perl_provides %{nil}
399%__perl_requires %{nil}
25043cd4
AF
400
401# Perl specific macro definitions.
c853f847
AF
402%perl_privlib %(eval "`%{__perl} -V:installprivlib`"; echo $installprivlib)
403%perl_archlib %(eval "`%{__perl} -V:installarchlib`"; echo $installarchlib)
404%perl_vendorlib %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib)
405%perl_vendorarch %(eval "`%{__perl} -V:installvendorarch`"; echo $installvendorarch)
406%perl_sitelib %(eval "`%{__perl} -V:installsitelib`"; echo $installsitelib)
407%perl_sitearch %(eval "`%{__perl} -V:installsitearch`"; echo $installsitearch)
25043cd4 408
c853f847 409%php_pear_dir %{_datadir}/pear
25043cd4
AF
410
411# Python specific macro definitions.
412# python main version
c853f847 413%py_ver %(echo `python -c "import sys; print sys.version[:3]"`)
25043cd4
AF
414
415# directories
c853f847 416%py_prefix %(echo `python -c "import sys; print sys.prefix"`)
aadb0079 417%py_libdir %{py_prefix}/%{_lib}/python%{py_ver}
ef7ec0a8 418%py_scriptdir %{py_prefix}/share/python%{py_ver}
c853f847 419%py_incdir /usr/include/python%{py_ver}
ef7ec0a8
JK
420%py_sitedir %{py_libdir}/site-packages
421%py_sitescriptdir %{py_scriptdir}/site-packages
c853f847 422%py_dyndir %{py_libdir}/lib-dynload
25043cd4
AF
423
424# pure python modules compilation
c853f847 425%py_comp python -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])"
25043cd4 426
c853f847 427%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
428
429# Software written in Python language require Python with main version
dbd7a41e 430%pyrequires_eq() Requires: python(bytecode) = %py_ver %1
25043cd4 431
0fc5cff8 432# depmod macro
433%depmod() { \
f6148427 434umask 022; \
0fc5cff8 435if [ -e /boot/System.map-%1 ]; then \
436 /sbin/depmod -a -F /boot/System.map-%1 %1; \
437else \
438 if [ -e /boot/System.map ]; then \
439 /sbin/depmod -a -F /boot/System.map %1; \
440 else \
441 /sbin/depmod -a %1; \
442 fi \
443fi; \
444}
445
2afc6e64 446# XMMS specific macros
2d372986
JB
447%xmms_prefix %(xmms-config --prefix)
448%xmms_exec_prefix %(xmms-config --exec-prefix)
449%xmms_version %(xmms-config --version)
450%xmms_datadir %(xmms-config --data-dir)
451%xmms_plugindir %(xmms-config --plugin-dir)
452%xmms_visualization_plugindir %(xmms-config --visualization-plugin-dir)
453%xmms_input_plugindir %(xmms-config --input-plugin-dir)
454%xmms_output_plugindir %(xmms-config --output-plugin-dir)
455%xmms_effect_plugindir %(xmms-config --effect-plugin-dir)
456%xmms_general_plugindir %(xmms-config --general-plugin-dir)
2afc6e64 457
1fc7dde4 458%_target_base_arch %(echo %{_target_cpu} | sed 's/i.86/i386/;s/athlon/i386/;s/pentium./i386/;s/amd64/x86_64/')
848c0d68 459
460# user/group checking macros
461#
462# Usage:
463# %userremove myuser
464#
465%userremove /usr/lib/rpm/user_group.sh user del
466%groupremove /usr/lib/rpm/user_group.sh group del
467#
468# Usage:
469# if %usertestrm myuser; then
470# /usr/sbin/userdel -r myuser
471# Note:
472# use these macros only if you need to call userdel/groupdel with
473# a non-standard option or take an extra action; otherwise use the
474# %userremove/%groupremove macros
475#
476%usertestrm /usr/lib/rpm/user_group.sh user testrm
477%grouptestrm /usr/lib/rpm/user_group.sh group testrm
08d9b1f6
JK
478# user group membership management macros
479#
480# Usage:
481# %addusertogroup myuser agroup
482#
483%addusertogroup /usr/lib/rpm/user_group.sh user addtogroup
72fcfcb3 484
485# banner support (useful in {pre,post}{,un} and triggers)
486#
487# Usage:
a8b9562a 488# %banner name [-a] [-e] [-n] [-tn]
72fcfcb3 489# the banner text, the banner text
490# the banner text, and following line HAVE TO BE:
491# EOF
492# -a - append to the banner
a8b9562a 493# -e - send to stderr instead of stdout
628754cb 494# -n - no show banner (overrides -t)
495# -t - show only, if RPM_SCRIPTVERBOSITY >= n; default n=5
a8b9562a 496%banner(a:e:n:t:) \
1b334fe4 497RPM_SCRIPTVERBOSITY=5 \
498[ -r /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm \
499if [ -x /usr/bin/banner.sh ]; then \
628754cb 500 CMD="/usr/bin/banner.sh %{-e:--stderr} %{!-n:\`[ $RPM_SCRIPTVERBOSITY -ge %{-t:%{-t*}}%{!-t:5} ] && echo '-s'\`} %{!-a:-m}%{-a:-M} %1" \
1b334fe4 501else \
a8b9562a 502 CMD="cat%{-e: >&2}" \
1b334fe4 503fi \
504$CMD << EOF \
72fcfcb3 505%nil
628754cb 506
This page took 0.252484 seconds and 4 git commands to generate.