]> git.pld-linux.org Git - packages/rpm-build-macros.git/blame - rpm.macros
- well, tests have shown too many important apps get broken by -as-needed
[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
82656cfe
JB
22%rpmcflags %{?debug:%debugcflags}%{!?debug:%optflags}%{?debuginfocflags}
23%rpmcxxflags %{rpmcflags} -fvisibility-inlines-hidden
d23d3883
MM
24%rpmldflags %{nil}
25# %rpmldflags -Wl,--as-needed
9c404149 26
ba1fdedc 27# kernel compiler
d2e1bc22 28%kgcc gcc
29%kgcc_package gcc
ba1fdedc 30
33040789 31# Build system path macros.
32#
f93109a0 33%__autoconf autoconf %{?debug:-Wall}
34%__automake automake -a -c -f --foreign
35%__autopoint autopoint --force
36
83094b62 37%__gettextize { \
afff6d37 38 if ! gettextize --version | grep -q '0\.10\.' ; then \
8a995cff
JB
39 if grep -qs 'AM_GNU_GETTEXT.*external' configure.{ac,in} ; then \
40 gettextize --copy --force --no-changelog; \
97589b6e 41 else \
8a995cff
JB
42 gettextize --copy --force --no-changelog --intl; \
43 fi; \
44 if [ ! -f po/Makevars ]; then \
45 cp -f po/Makevars{.template,}; \
46 fi; \
47 else \
48 gettextize --copy --force; \
83094b62 49 fi; \
8a995cff 50}
f93109a0 51
52%__glib_gettextize glib-gettextize --copy --force
53%__gnome_doc_common gnome-doc-common --copy
54%__gtkdocize gtkdocize --copy
55%__intltoolize intltoolize --copy --force
56%__libtoolize libtoolize --copy --force
33040789 57
6a5eda77 58%dependencytracking %{nil}
9c404149 59#-----------------------------------------------------------------
9f4ce098 60%configure2_13 { \
9c404149
AM
61 if [ -n "$LINGUAS" ]; then unset LINGUAS; fi; \
62 LDFLAGS="${LDFLAGS:-%rpmldflags}" ; export LDFLAGS ; \
63 CFLAGS="${CFLAGS:-%rpmcflags}" ; export CFLAGS ; \
f4cc8832 64 CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" ; export CXXFLAGS ; \
9c404149 65 FFLAGS="${FFLAGS:-%rpmcflags}" ; export FFLAGS ; \
8ec1a12b 66 CPPFLAGS="${CPPFLAGS:-}" ; export CPPFLAGS ; \
8983c4c4
AM
67 %{?__cc:CC="%{__cc}" ; export CC ; } \
68 %{?__cxx:CXX="%{__cxx}" ; export CXX ; } \
8f74418b 69 %{?configuredir:%{configuredir}}%{!?configuredir:.}/configure \
2a7cfd3f 70 --host=%{_target_platform} \
9c404149
AM
71 --prefix=%{_prefix} \
72 --exec-prefix=%{_exec_prefix} \
73 --bindir=%{_bindir} \
74 --sbindir=%{_sbindir} \
75 --sysconfdir=%{_sysconfdir} \
76 --datadir=%{_datadir} \
77 --includedir=%{_includedir} \
78 --libdir=%{_libdir} \
79 --libexecdir=%{_libexecdir} \
80 --localstatedir=%{_localstatedir} \
81 --sharedstatedir=%{_sharedstatedir} \
82 --mandir=%{_mandir} \
83 --infodir=%{_infodir} \
c0d1b3ad 84 --x-libraries=/usr/X11R6/%{_lib} \
93059874 85 %{dependencytracking} \
9c404149
AM
86}
87
4a6b0d54 88#----------------------------------------------------------------
57f4166d 89%configure {./configure \
4a6b0d54
AF
90 LDFLAGS="${LDFLAGS:-%rpmldflags}" \
91 CFLAGS="${CFLAGS:-%rpmcflags}" \
f4cc8832 92 CXXFLAGS="${CXXFLAGS:-%rpmcxxflags}" \
4a6b0d54 93 FFLAGS="${FFLAGS:-%rpmcflags}" \
a2bd5992 94 CPPFLAGS="${CPPFLAGS:-}" \
8983c4c4
AM
95 %{?__cc:CC="%{__cc}"} \
96 %{?__cxx:CXX="%{__cxx}"} \
4a6b0d54
AF
97 --build=%{_target_platform} \
98 --prefix=%{_prefix} \
99 --exec-prefix=%{_exec_prefix} \
100 --bindir=%{_bindir} \
101 --sbindir=%{_sbindir} \
102 --sysconfdir=%{_sysconfdir} \
103 --datadir=%{_datadir} \
104 --includedir=%{_includedir} \
105 --libdir=%{_libdir} \
106 --libexecdir=%{_libexecdir} \
107 --localstatedir=%{_localstatedir} \
108 --sharedstatedir=%{_sharedstatedir} \
109 --mandir=%{_mandir} \
110 --infodir=%{_infodir} \
c0d1b3ad 111 --x-libraries=/usr/X11R6/%{_lib} \
93059874 112 %{dependencytracking} \
4a6b0d54
AF
113}
114
7dbab518 115# ------------------------------------------------------------------------
c80506a3
AM
116# Overloading of some basic macros
117%prep \
118%%prep\
119LANG=C\
120export LANG\
14e77e64 121unset DISPLAY ||:\
6db5639d 122unset LINGUAS ||:\
c80506a3
AM
123%{nil}
124
125%build %%build\
126LANG=C\
127export LANG\
14e77e64 128unset DISPLAY ||:\
6db5639d 129unset LINGUAS ||:\
c80506a3
AM
130%{nil}
131
132%install %{?_enable_debug_packages:%{?buildsubdir:%{debug_package}}}\
133%%install\
134LANG=C\
135export LANG\
14e77e64 136unset DISPLAY ||:\
6db5639d 137unset LINGUAS ||:\
c80506a3
AM
138%{nil}
139
140# ------------------------------------------------------------------------
7dbab518
MM
141# Conditional build stuff.
142
143# Check if symbol is defined.
144# Example usage: %if %{defined with_foo} && %{undefined with_bar} ...
145%defined() %{expand:%%{?%{1}:1}%%{!?%{1}:0}}
146%undefined() %{expand:%%{?%{1}:0}%%{!?%{1}:1}}
147
566fa098
MM
148# Shorthand for %{defined with_...}
149%with() %{expand:%%{?with_%{1}:1}%%{!?with_%{1}:0}}
150%without() %{expand:%%{?with_%{1}:0}%%{!?with_%{1}:1}}
151
7dbab518
MM
152# Handle conditional builds. %bcond_with is for case when feature is
153# default off and needs to be activated with --with ... command line
154# switch. %bcond_without is for the dual case.
155#
156# %bcond_with foo defines symbol with_foo if --with foo was specified on
157# command line.
158# %bcond_without foo defines symbol with_foo if --without foo was *not*
159# specified on command line.
160#
161# For example:
162#
163# %bcond_with extra_fonts
164# %bcond_without static
f52f9976 165# %if %{with extra_fonts}
7dbab518
MM
166# ...
167# %endif
f52f9976 168# %ifdef %{with static}
7dbab518
MM
169# ...
170# %endif
171# %{?with_static: ... }
172# %{!?with_static: ... }
173# %{?with_extra_fonts: ... }
174# %{!?with_extra_fonts: ... }
175#
176# The bottom line: never use without_foo, _with_foo nor _without_foo, only
177# with_foo. This way changing default set of bconds for given spec is just
178# a matter of changing single line in it and syntax is more readable.
179%bcond_with() %{expand:%%{?_with_%{1}:%%global with_%{1} 1}}
180%bcond_without() %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}}
181# ------------------------------------------------------------------------
182
9c404149
AM
183# Location of autoconf macros
184%_aclocaldir %(aclocal --print-ac-dir)
185
e2804f99
AM
186# Location of omf files
187%_omf_dest_dir %(scrollkeeper-config --omfdir)
188
e987a186 189# Location of pkgconfig files
9a4e877a 190%_pkgconfigdir /usr/%{_lib}/pkgconfig
e987a186 191
486b0b5f 192# Location of desktop files
193%_desktopdir /usr/share/applications
86dff2d0 194%_applnkdir ERROR:_applnkdir_is_obsolete_use_desktopdir_instead
486b0b5f 195
481463e9 196# Location of pixmaps for applnk/desktop files
e1f0a822 197%_pixmapsdir /usr/share/pixmaps
9c404149 198
481463e9 199# Location of themable icons for applnk/desktop files
b36c8e2a 200%_iconsdir /usr/share/icons
201
e987a186
JB
202# Location of fonts directories
203%_fontsdir /usr/share/fonts
204
b3282f3f 205# Location of Gtk and associated libraries documentation
6eed6d84 206%_gtkdocdir %{_defaultdocdir}/gtk-doc/html
b3282f3f 207
fc4d7771 208# Location of KDE documentation
209%_kdedocdir %{_defaultdocdir}/kde/HTML
210
5869828c 211# unsermake script
212%__unsermake /usr/share/unsermake/unsermake
213
9c404149
AM
214# Current date
215%date %(LC_ALL="C" date +"%a %b %d %Y")
216
217# tmp directory
218%tmpdir %(echo "${TMPDIR:-/tmp}")
219
220# Example files, programs, scripts...
221%_examplesdir /usr/src/examples
222
8377d27d 223# The directory holding Linux kernel sources
224%_kernelsrcdir /usr/src/linux
225
9c404149 226# If non-empty "debug" macro defined, add "dbg" suffix to release number
8f74418b 227%_rpmfilename %%{NAME}-%%{VERSION}-%%{RELEASE}%{?debug:dbg}.%%{ARCH}.rpm
9c404149 228
8f74418b 229# Requires name = version-release
16cb1d91 230%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 231
16cb1d91
JB
232%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)")
233%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)")
234%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)")
235%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 236
16cb1d91 237%requires_eq_to() %(LC_ALL="C" rpm -q --qf 'Requires: %1 = %%{epoch}:%%{version}\\n' %2 | sed -e 's/ (none):/ /' | grep -v "is not")
01a9f990 238
179fcc7f 239%apache_modules_api %(awk '/#define MODULE_MAGIC_NUMBER_MAJOR/ {print $3}' /usr/include/apache/ap_mmn.h 2>/dev/null || echo ERROR)
b9d5d440 240
241# kernel version-release handling
541d11fe 242%__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 243%__kernel_rel %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/fs.h --queryformat "%{RELEASE}" | grep -v "is not")
16cb1d91
JB
244%__kernel_rpmvr %(LC_ALL="C" rpm -qf %{_kernelsrcdir}/include/linux/fs.h --queryformat "%{VERSION}-%{RELEASE}" | grep -v "is not")
245%_kernel_ver %{__kernel_ver}%{?with_dist_kernel:%(echo %{__kernel_ver} | grep -q -e - || echo -%{__kernel_rel})}
f62e856d 246%_kernel_ver_str %(echo %{!?_without_dist_kernel:%{__kernel_rpmvr}}%{?_without_dist_kernel:%{__kernel_ver}} | sed -e 's/-/_/g')
87be1cf0 247
e00dd7f6 248# sgml macros
741b471b 249%xmlcat_add() /usr/bin/xmlcatalog --noout --add nextCatalog \"\" %1 /etc/xml/catalog ;
250%xmlcat_del() /usr/bin/xmlcatalog --noout --del %1 /etc/xml/catalog ;
847db862 251%xmlcat_add_rewrite /usr/bin/xmlcatalog --noout --add rewriteSystem
741b471b 252%xmlcat_create() /usr/bin/xmlcatalog --noout --create %1 ;
253%sgmlcat_add() /usr/bin/install-catalog --add %1 %2 > /dev/null ;
254%sgmlcat_del() /usr/bin/install-catalog --remove %1 %2 > /dev/null ;
e00dd7f6 255%docbook_sgmlcat_fix() { for l in \
256'' \
257' -- default decl --' \
258'DTDDECL "-//OASIS//DTD DocBook XML V%2//EN" "../../xml.dcl"' \
259' -- hacks for opensp --' \
260'SYSTEM "file://%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \
261'SYSTEM "http://www.oasis-open.org/docbook/xml/%2/docbookx.dtd" "%{_datadir}/sgml/docbook/xml-dtd-%2/docbookx.dtd"' \
262'' \
263; do echo $l; done >> %1 \
264}
265
9c404149
AM
266#-----------------------------------------------------------------
267# find and gzip all files in %{_mandir} and %{infodir}
268#
269# Requires: xargs, find
270#
271#%no_install_post_compress_docs 1
272%__spec_install_post_compress_docs { \
9c404149 273%{!?no_install_post_compress_docs: \
822d4d81 274 echo "Compress man and info pages."; \
9c404149
AM
275 %{?verbose:set -x;} \
276 for i in /usr/share/man /usr/X11R6/man /usr/share/info; do \
277 if [ -d "$RPM_BUILD_ROOT$i" ]; then \
278 find "$RPM_BUILD_ROOT$i" -name \*.bz2 -print | xargs -r %{__bzip2} -df; \
279 find "$RPM_BUILD_ROOT$i" -name \*.gz -print | xargs -r %{__gzip} -dnf; \
280 find "$RPM_BUILD_ROOT$i" -type f -print | xargs -r %{__gzip} -9nf; \
281 fi; \
282 done; \
283} }
284
285#-----------------------------------------------------------------
286# Strip executable binaries and shared object files
287#
288# Requires: find, awk, strip, cut, xargs
289#
290#%no_install_post_strip 1
291%__spec_install_post_strip {%{!?debug: \
292%{!?no_install_post_strip: \
9f0d4f36
JB
293 %{?verbose:set -x;} \
294 if [ -d "$RPM_BUILD_ROOT" ]; then \
8f74418b 295 echo "Strip executable binaries, archives and shared object files."; \
60ad88f2 296 filelist=`find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" %{?_noautostrip:! -regex "%{_noautostrip}"}`; \
9c404149
AM
297 elfexelist=`echo $filelist | xargs -r file | \
298 awk '/ELF.*executable/ {print $1}' | cut -d: -f1`; \
299 elfsharedlist=`echo $filelist | xargs -r file | \
300 awk '/LF.*shared object/ {print $1}' | cut -d: -f1`; \
8f74418b
MM
301 elfarchiveslist=`echo $filelist | xargs -r file | \
302 awk '/current ar archive/ {print $1}' | cut -d: -f1`; \
9c404149 303 if [ -n "$elfexelist" ]; then \
60ad88f2 304 %{__strip} --remove-section=.note --remove-section=.comment $elfexelist; \
9c404149
AM
305 fi; \
306 if [ -n "$elfsharedlist" ]; then \
60ad88f2 307 %{__strip} --strip-unneeded --remove-section=.note --remove-section=.comment $elfsharedlist; \
8f74418b
MM
308 fi; \
309 if [ -n "$elfarchiveslist" ]; then \
60ad88f2 310 %{__strip} --strip-debug --remove-section=.note --remove-section=.comment $elfarchiveslist; \
9f0d4f36
JB
311 fi; \
312 fi; } \
9c404149 313} }
fc5d7e20 314#-----------------------------------------------------------------
315# remove all RPATH from executable binaries and shared object files
316#
317# Requires: find, awk, cut, xargs, chrpath, uname
318#
319#%no_install_post_chrpath 1
320%__spec_install_post_chrpath {%{!?debug: \
321%{!?no_install_post_chrpath: \
322 %{?verbose:set -x;} \
9f0d4f36 323if [ -d "$RPM_BUILD_ROOT" ]; then \
fc5d7e20 324echo "Remove RPATH from executable binaries and shared object files."; \
adb39da4 325find $RPM_BUILD_ROOT -type f ! -regex ".*ld-[0-9.]*so.*" ! -regex ".*/usr/lib[0-9]*/debug/.*" %{?_noautochrpath:! -regex "%{_noautochrpath}"} | xargs -r file | \
5bed2bb7 326 awk '/ELF.*(executable.*dynamically linked|shared object)/ {print $1}' | cut -d: -f1 | \
fc5d7e20 327while read file ; do \
328 rpath= ; \
329 chmod u+w "$file"; \
330 for dir in `chrpath -l "$file" | \
331 awk '/RPATH=/ { gsub(/.*RPATH=/,""); gsub(/:/," "); print $0 }'` ; do \
332 case $dir in \
494e368c 333 /home/* | /tmp/* | /usr/lib | /usr/lib64 | /lib | /lib64 | /usr/local/lib | /usr/local/lib64 | /usr/X11R6/lib | /usr/X11R6/lib64 ) \
fc5d7e20 334 echo "remove-rpath: $dir in $file"; \
335 ;; \
336 * ) \
337 if [ "$rpath" = "" ] ; then rpath="$dir" ; \
338 else rpath="$rpath:$dir" ; fi ; \
339 ;; \
340 esac ; \
341 done ; \
342 if [ "$rpath" = "" ] ; then chrpath -d "$file" > /dev/null ; \
343 else chrpath -r "$rpath" "$file" > /dev/null ; fi ; \
9f0d4f36
JB
344done; \
345fi; } \
fc5d7e20 346} }
d72c185f 347#-----------------------------------------------------------------
ccb8ae8d 348# Find and gzip all kernel modules
349#
350# Requires: find
351#
352#%no_install_post_compress_modules 1
353%__spec_install_post_compress_modules { \
ccb8ae8d 354%{!?no_install_post_compress_modules: \
355 %{?verbose:set -x;} \
9f0d4f36
JB
356 if [ -d "$RPM_BUILD_ROOT" ]; then \
357echo "Compress kernel modules if any."; \
d618340e 358 if test -d $RPM_BUILD_ROOT/lib/modules ; then \
16cb1d91
JB
359 find $RPM_BUILD_ROOT/lib/modules -name \*o -type f -print | \
360 xargs -r %{__gzip} -9nf; \
a33b1418 361 find $RPM_BUILD_ROOT/lib/modules -name \*o -type l -printf "%p %l\n" | \
03b234a5 362 while read a b; do ln -sf $b.gz $a.gz; rm -f $a; done; \
d618340e 363 fi; \
9f0d4f36 364 fi; \
ccb8ae8d 365} }
9c404149
AM
366
367%_source_payload w9.gzdio
368%_binary_payload w9.bzdio
369
83094b62 370#-----------------------------------------------------------------
0e4cb4dd 371# Update GConf2 schemas
83094b62 372#
373# Requires: GConf2
374#
46885239 375%gconf_schema_install() \
376 umask 022; \
f93109a0 377 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 \
46885239 378 %{nil}
379
380%gconf_schema_uninstall() \
f93109a0 381if [ $1 = 0 ]; then \
46885239 382 umask 022; \
f93109a0 383 GCONF_CONFIG_SOURCE="xml:readwrite:/etc/gconf/gconf.xml.defaults" /usr/bin/gconftool-2 --makefile-uninstall-rule /etc/gconf/schemas/%{?1} > /dev/null \
384fi \
385%{nil}
386
387#-----------------------------------------------------------------
388# Update desktop MIME database
389# requries: desktop-file-utils
390#
391%update_desktop_database_post() \
392 umask 022; \
393 /usr/bin/update-desktop-database; \
394 %{nil}
395
396%update_desktop_database_postun() \
397if [ $1 = 0 ]; then \
398 umask 022; \
399 /usr/bin/update-desktop-database; \
400fi \
401%{nil}
402
403#-----------------------------------------------------------------
404# Update scrollkeeper database
405# requires: scrollkeeper
406#
407%scrollkeeper_update_post() \
f93109a0 408 /usr/bin/scrollkeeper-update -q; \
409 %{nil}
410
411%scrollkeeper_update_postun() \
412if [ $1 = 0 ]; then \
f93109a0 413 /usr/bin/scrollkeeper-update -q; \
414fi \
415%{nil}
416
417#-----------------------------------------------------------------
418# Run ldconfig after installing/deinstalling libraries
419#
420%ldconfig_post() \
421 /sbin/ldconfig; \
422 %{nil}
423
424%ldconfig_postun() \
425if [ $1 = 0 ]; then \
426 /sbin/ldconfig; \
427fi \
428%{nil}
83094b62 429
9c404149
AM
430#-----------------------------------------------------------------
431# post %install sequence:
432# - autodeps exceptions
433# - compress all man and info pages,
434# - strip all ELF executables and ELF shared objects if not %debug.
8f74418b 435# - compress kernel modules if any
9c404149
AM
436
437###################################################################
438# Requires/Provides automation
439# exceptions system by Jacek Konieczny <jajcus@pld.org.pl>
338726a6 440#
2892b5df
JB
441%__noautoreqfiles %(sed -e s'/#.*//' /etc/rpm/noautoreqfiles)%{?_noautoreqfiles: %{_noautoreqfiles}}
442%__noautoprovfiles %(sed -e s'/#.*//' /etc/rpm/noautoprovfiles)%{?_noautoprovfiles: %{_noautoprovfiles}}
443%__noautoreq %(sed -e s'/#.*//' /etc/rpm/noautoreq)%{?_noautoreq: %{_noautoreq}}
444%__noautoreqdep %(sed -e s'/#.*//' /etc/rpm/noautoreqdep)%{?_noautoreqdep: %{_noautoreqdep}}
445%__noautoprov %(sed -e s'/#.*//' /etc/rpm/noautoprov)%{?_noautoprov: %{_noautoprov}}
338726a6
JB
446#%_noautocompressdoc %{nil}
447#
8f74418b
MM
448%_missing_doc_files_terminate_build 1%{nil}
449%_unpackaged_files_terminate_build %{nil}
8781dc74 450# (X)emacs support
d77dcb61 451%___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
452%_emacs_lispdir %(emacs %___emacs_lispdir_helper)
453%_xemacs_lispdir %(xemacs %___emacs_lispdir_helper)
25043cd4 454
02b58f60
JK
455%__php_provides %{nil}
456%__php_requires %{nil}
457%__perl_provides %{nil}
458%__perl_requires %{nil}
25043cd4
AF
459
460# Perl specific macro definitions.
c853f847
AF
461%perl_privlib %(eval "`%{__perl} -V:installprivlib`"; echo $installprivlib)
462%perl_archlib %(eval "`%{__perl} -V:installarchlib`"; echo $installarchlib)
463%perl_vendorlib %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib)
464%perl_vendorarch %(eval "`%{__perl} -V:installvendorarch`"; echo $installvendorarch)
465%perl_sitelib %(eval "`%{__perl} -V:installsitelib`"; echo $installsitelib)
466%perl_sitearch %(eval "`%{__perl} -V:installsitearch`"; echo $installsitearch)
25043cd4 467
c853f847 468%php_pear_dir %{_datadir}/pear
25043cd4
AF
469
470# Python specific macro definitions.
471# python main version
c853f847 472%py_ver %(echo `python -c "import sys; print sys.version[:3]"`)
25043cd4
AF
473
474# directories
c853f847 475%py_prefix %(echo `python -c "import sys; print sys.prefix"`)
aadb0079 476%py_libdir %{py_prefix}/%{_lib}/python%{py_ver}
ef7ec0a8 477%py_scriptdir %{py_prefix}/share/python%{py_ver}
c853f847 478%py_incdir /usr/include/python%{py_ver}
ef7ec0a8
JK
479%py_sitedir %{py_libdir}/site-packages
480%py_sitescriptdir %{py_scriptdir}/site-packages
c853f847 481%py_dyndir %{py_libdir}/lib-dynload
25043cd4
AF
482
483# pure python modules compilation
c853f847 484%py_comp python -c "import compileall; import sys; compileall.compile_dir(sys.argv[1], ddir=sys.argv[1][len('$RPM_BUILD_ROOT'):])"
25043cd4 485
c853f847 486%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
487
488# Software written in Python language require Python with main version
e63cd81d 489%pyrequires_eq() Requires: %1
25043cd4 490
f12c2314
AF
491
492# Hardlink binary identical .pyc and .pyo files
493# (idea by glen <at> pld-linux <dot> org)
494%__spec_install_post_py_hardlink {\
d56b7e24 495%{!?no_install_post_py_hardlink: \
f12c2314
AF
496[ ! -d "$RPM_BUILD_ROOT" ] || find "$RPM_BUILD_ROOT" -name '*.pyc' | while read a; do \
497 b="$(echo $a|sed -e 's/.pyc$/.pyo/')"; \
498 if cmp -s "$a" "$b"; then \
499 ln -f "$a" "$b"; \
500 fi; \
501done \
502} }
503
504# remove python sources, so that check-files won't complain
505# (idea by glen <at> pld-linux <dot> org)
506%py_postclean() \
507for d in %{py_sitescriptdir} %{py_sitedir}; do \
508 [ ! -d "$RPM_BUILD_ROOT$d" ] || find "$RPM_BUILD_ROOT$d" -name '*.py' -exec rm {} \; ;\
509done \
510%{nil}
511
0fc5cff8 512# depmod macro
513%depmod() { \
f6148427 514umask 022; \
0fc5cff8 515if [ -e /boot/System.map-%1 ]; then \
516 /sbin/depmod -a -F /boot/System.map-%1 %1; \
517else \
518 if [ -e /boot/System.map ]; then \
519 /sbin/depmod -a -F /boot/System.map %1; \
520 else \
521 /sbin/depmod -a %1; \
522 fi \
523fi; \
524}
525
2afc6e64 526# XMMS specific macros
2d372986
JB
527%xmms_prefix %(xmms-config --prefix)
528%xmms_exec_prefix %(xmms-config --exec-prefix)
529%xmms_version %(xmms-config --version)
530%xmms_datadir %(xmms-config --data-dir)
531%xmms_plugindir %(xmms-config --plugin-dir)
532%xmms_visualization_plugindir %(xmms-config --visualization-plugin-dir)
533%xmms_input_plugindir %(xmms-config --input-plugin-dir)
534%xmms_output_plugindir %(xmms-config --output-plugin-dir)
535%xmms_effect_plugindir %(xmms-config --effect-plugin-dir)
536%xmms_general_plugindir %(xmms-config --general-plugin-dir)
2afc6e64 537
1fc7dde4 538%_target_base_arch %(echo %{_target_cpu} | sed 's/i.86/i386/;s/athlon/i386/;s/pentium./i386/;s/amd64/x86_64/')
848c0d68 539
540# user/group checking macros
541#
542# Usage:
543# %userremove myuser
544#
545%userremove /usr/lib/rpm/user_group.sh user del
546%groupremove /usr/lib/rpm/user_group.sh group del
547#
548# Usage:
549# if %usertestrm myuser; then
550# /usr/sbin/userdel -r myuser
551# Note:
552# use these macros only if you need to call userdel/groupdel with
553# a non-standard option or take an extra action; otherwise use the
554# %userremove/%groupremove macros
555#
556%usertestrm /usr/lib/rpm/user_group.sh user testrm
557%grouptestrm /usr/lib/rpm/user_group.sh group testrm
08d9b1f6
JK
558# user group membership management macros
559#
560# Usage:
561# %addusertogroup myuser agroup
562#
563%addusertogroup /usr/lib/rpm/user_group.sh user addtogroup
72fcfcb3 564
565# banner support (useful in {pre,post}{,un} and triggers)
566#
567# Usage:
aa41c920 568# %banner name [-a] [-e] [-n] [-tn] <<EOF
72fcfcb3 569# the banner text, the banner text
aa41c920
ER
570# the banner text, and following line
571#EOF
572# You can use any form of here-document, <<'EOF' <<-EOT will do.
573# NOTE: if your use "<<-EOF", then You can actually indent inside here-document.
574#
72fcfcb3 575# -a - append to the banner
a8b9562a 576# -e - send to stderr instead of stdout
628754cb 577# -n - no show banner (overrides -t)
578# -t - show only, if RPM_SCRIPTVERBOSITY >= n; default n=5
aa41c920 579%banner(aent:) \
1b334fe4 580RPM_SCRIPTVERBOSITY=5 \
581[ -r /etc/sysconfig/rpm ] && . /etc/sysconfig/rpm \
582if [ -x /usr/bin/banner.sh ]; then \
aa41c920 583 CMD="/usr/bin/banner.sh %{-e:--stderr} %{!-n:$([ $RPM_SCRIPTVERBOSITY -ge %{-t:%{-t*}}%{!-t:5} ] && echo -s)} %{!-a:-m}%{-a:-M} %1" \
1b334fe4 584else \
a8b9562a 585 CMD="cat%{-e: >&2}" \
1b334fe4 586fi \
aa41c920 587$CMD %2%{?3: %3} \
72fcfcb3 588%nil
628754cb 589
840e7b00
ER
590# fatal macro. produces recursion and therefore stops rpm build.
591# until there's no legal way of stopping rpmbuild from macros, this is used by
592# %useradd/%groupadd to notify user of wrong usage. glen@pld-linux.org
593%fatal() { %{*} %fatal }
594
90627280
ER
595# useradd/groupadd macros written by glen@pld-linux.org.
596# All rights reserved. Permission to copy is hereby granted.. yada, yada, yada
597#
598# Usage:
599# %useradd [-P package] [-u uid] [-d home_dir] [-s shell] [-c comment]
600# [-g initial_group] [-G group[,...]] login
601#
602# -u uid. REQUIRED
603# -g gid/group. REQUIRED
604# -s defaults to /bin/false
605# -d defaults to /usr/share/empty
606# -c No default
607# -r is accepted but ignored (it's always set)
608# rpm specific flags
609# -P package name. defaults to %{name}
610#
90627280 611%useradd(c:d:e:f:g:G:Mmk:op:s:u:rP:) \
840e7b00
ER
612%{!-u:%fatal -- useradd: Required argument -u missing} \
613%{!-g:%fatal -- useradd: Required argument -g missing} \
614%{!?1:%fatal -- useradd: Required parameter login missing} \
90627280
ER
615if [ -n "`/bin/id -u %{expand:%{%{#}}} 2>/dev/null`" ]; then \
616 if [ "`/bin/id -u %{expand:%{%{#}}}`" != "%{-u*}" ]; then \
617 echo "Error: user %{expand:%{%{#}}} doesn't have uid=%{-u*}. Correct this before installing %{-P*}%{!?-P:%{name}}." 1>&2 \
618 exit 1 \
619 fi \
620else \
621 echo "Adding user %{expand:%{%{#}}} UID=%{-u*}." \
622 /usr/sbin/useradd \\\
623 -u %{-u*} \\\
624 -r \\\
625 -d %{-d*}%{!-d:/usr/share/empty} \\\
626 -s %{-s*}%{!-s:/bin/false} \\\
840e7b00 627 %{-c:-c "%(set -- %{-c*} %{*}; echo $1)"}\\\
90627280
ER
628 -g %{-g*} \\\
629 %{-M} \\\
630 %{-G:-G %{-G*}} \\\
840e7b00 631 %{expand:%{%{#}}} 1>&2 \
90627280
ER
632fi;
633
90627280
ER
634# Usage:
635# %groupadd [-P package] [-g gid] group
636#
637# -g gid. REQUIRED
638#
639# Sample:
640# %groupadd -P %{name}-base -g %{gid} %{name}
641
642%groupadd(g:P:rfo) \
840e7b00
ER
643%{!-g:%fatal -- groupadd: Required argument -g missing} \
644%{!?1:%fatal -- groupadd: Required parameter group missing} \
90627280
ER
645if [ -n "`/usr/bin/getgid %{1}`" ]; then \
646 if [ "`/usr/bin/getgid %{1}`" != "%{-g*}" ]; then \
647 echo "Error: group %{1} doesn't have gid=%{-g*}. Correct this before installing %{-P*}%{!?-P:%{name}}." 1>&2 \
648 exit 1 \
649 fi \
650else \
651 echo "Adding group %{1} GID=%{-g*}." \
840e7b00 652 /usr/sbin/groupadd -g %{-g*} -r %{1} 1>&2 \
90627280 653fi;
This page took 0.214903 seconds and 4 git commands to generate.