1 # $Id: macros.in,v 1.56 2000/05/01 17:50:35 jbj Exp $
2 #==============================================================================
3 # Macro naming conventions (preliminary):
5 # Macros that begin with an underscore are "local" in the sense that
6 # they (if used) will not be exported in rpm headers. Some macros
7 # that don't start with an underscore (but look like they should)
8 # are compatible with macros generated by rpm-2.5.x and will be made
9 # more consistent in a future release.
12 #==============================================================================
13 # ---- A macro that expands to nothing.
17 #==============================================================================
18 # ---- filesystem macros.
24 #==============================================================================
25 # ---- Generally useful path macros.
38 %__install @__INSTALL@
53 #==============================================================================
54 # ---- Build system path macros.
61 %__objcopy @__OBJCOPY@
62 %__objdump @__OBJDUMP@
67 # XXX avoid failures if tools are not installed when rpm is built.
68 %__libtoolize libtoolize
70 %__autoheader autoheader
74 #==============================================================================
75 # ---- Required rpmrc macros.
76 # Macros that used to be initialized as a side effect of rpmrc parsing.
77 # These are the default values that can be overridden by other
78 # (e.g. per-platform, per-system, per-packager, per-package) macros.
80 %_builddir %{_topdir}/BUILD
83 %_dbpath %{_var}/lib/rpm
84 %_rebuilddbpath %{_dbpath}
85 %_dbpath_rebuild %{_dbpath}
86 %_defaultdocdir %{_usr}/doc
88 %__find_provides @FINDPROVIDES@
89 %__find_requires @FINDREQUIRES@
91 #%__find_conflicts ???
92 #%__find_obsoletes ???
94 # XXX fixowner, fixgroup, and fixperms are run at the end of hardcoded setup
96 %__chown_Rhf @__CHOWN_RHF@
97 %__chgrp_Rhf @__CHGRP_RHF@
98 %_fixowner [ `%{__id_u}` = '0' ] && %{__chown_Rhf} root
99 %_fixgroup [ `%{__id_u}` = '0' ] && %{__chgrp_Rhf} @ROOT_GROUP@
100 %_fixperms %{__chmod} -Rf @FIXPERMS@
105 %_rpmdir %{_topdir}/RPMS
107 # XXX Note escaped %% for use in headerSprintf
108 %_rpmfilename %%{ARCH}/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
110 %_sourcedir %{_topdir}/SOURCES
111 %_specdir %{_topdir}/SPECS
112 %_srcrpmdir %{_topdir}/SRPMS
113 %_tmppath %{_var}/tmp
114 %_topdir %{_usrsrc}/redhat
116 #==============================================================================
117 # ---- Optional rpmrc macros.
118 # Macros that are initialized as a side effect of rpmrc and/or spec
121 # Configurable build root path, same as BuildRoot: in a specfile.
122 # (Note: the configured macro value will override the spec file value).
126 # The sub-directory (relative to %{_builddir}) where sources are compiled.
127 # This macro is set after processing %setup, either explicitly from the
128 # value given to -n or the default name-version.
132 # Configurable distribution information, same as Distribution: in a
137 # Boolean (i.e. 1 == "yes", 0 == "no") that controls whether files
138 # marked as %doc should be installed.
141 # The port and machine name of a FTP proxy host running TIS firewall.
146 # The signature to use and the location of configuration files for
147 # signing packages with GNU gpg.
152 # The port and machine name of an HTTP proxy host.
157 # The PATH put into the environment before running %pre/%post et al.
159 %_install_script_path /sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin
161 # A colon separated list of desired locales to be installed;
162 # "all" means install all locale specific files.
170 # A colon separated list of paths where files should *not* be installed.
171 # Usually, these are network file system mount points.
175 # Configurable packager information, same as Packager: in a specfile.
179 # Compression type and level for package payloads.
180 # "w9.gzdio" gzip level 9 (default).
181 # "w9.bzdio" bzip2 level 9 (experimental, at your own risk).
183 #%_payload_compression w9.gzdio
185 # The signature to use and the location of configuration files for
186 # signing packages with PGP.
191 # Configurable virtual provides (unimplemented, use Provides: ...
200 # Configurable vendor information, same as Vendor: in a specfile.
204 #==============================================================================
205 # ---- Database configuration macros.
206 # Macros used to configure Berkley db parameters.
208 # Choose db interface:
210 # 1 native db1 interface (e.g. linux glibc libdb1 routines).
211 # 2 native db2 interface.
212 # 3 native db3 interface.
213 # -1 db3 -> db2 -> db1 (as available).
215 # There are two macros so that --rebuilddb can convert db1 -> db3
220 # token Berkeley db flag or value
221 # =================================================
223 # recover_fatal DB_RECOVER_FATAL
225 # lockdown DB_LOCKDOWN
229 # mpool DB_INIT_MPOOL
233 # shared DB_SYSTEM_MEM
235 # txn_nosync DB_TXN_NOSYNC
238 # See http://www.sleepycat.com for Berkeley db-3.0.55 configuration.
240 # The (intended) default value for rpm-3.1 on Red Hat Linux is
241 # db3:hash:mpool:cdb:usecursors:mp_mmapsize=8Mb:mp_size=8Mb:pagesize=512
243 # Additional rpm specific configuration:
244 # usecursors Should DB3 cursors be used in get/put/del ?
246 %__dbi_major db%{_dbapi}
248 %__dbi_flags mpool:cdb
249 %__dbi_other usecursors
250 %__dbi_verbose verbose
251 %__dbi_mp_mmapsize mp_mmapsize=16Mb
252 %__dbi_mp_size mp_size=512Kb
253 %__dbi_pagesize pagesize=512
254 %__dbi_perms perms=0644
256 # This is a colon (or white space) separated list of tokens for Berkeley
264 %{__dbi_mp_mmapsize}\
270 # The list of tags for which indices will be built.
271 %_dbi_indices Packages:Name:Basenames:Group:Requirename:Providename:Conflictname:Triggername:Depends
273 # "Depends" is a per-transaction cache of known dependency resolutions.
274 %_dbi_config_Depends %{_dbi_config}:temporary
276 #==============================================================================
277 # ---- per-platform macros.
278 # Macros that are specific to an individual platform. The values here
279 # will be used if the per-platform macro file does not exist..
281 %_arch @RPMCANONARCH@
282 %_vendor @RPMCANONVENDOR@
284 %_target_platform %{_target_cpu}-%{_vendor}-%{_target_os}
286 # XXX use the rpmrc instantiated macro for now
289 %__arch_install_post %{nil}
290 %__os_install_post %{___build_post}
292 #==============================================================================
293 # ---- Scriptlet template templates.
294 # Global defaults used for building scriptlet templates.
296 # XXX legacy configuration, this will be eliminated after rpm-3.0.4.
297 %_preScriptEnvironment \
298 RPM_SOURCE_DIR=\"%{_sourcedir}\"\
299 RPM_BUILD_DIR=\"%{_builddir}\"\
300 RPM_OPT_FLAGS=\"%{optflags}\"\
301 RPM_ARCH=\"%{_arch}\"\
303 export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
304 RPM_DOC_DIR=\"%{_docdir}\"\
306 RPM_PACKAGE_NAME=\"%{name}\"\
307 RPM_PACKAGE_VERSION=\"%{version}\"\
308 RPM_PACKAGE_RELEASE=\"%{release}\"\
309 export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
310 %{?buildroot:RPM_BUILD_ROOT=\"%{buildroot}\"\
311 export RPM_BUILD_ROOT}
313 %___build_shell %{?_buildshell:%{_buildshell}}%{!?_buildshell:/bin/sh}
315 %___build_cmd %{?_sudo:%{_sudo} }%{?_remsh:%{_remsh} %{_remhost} }%{?_remsudo:%{_remsudo} }%{?_remchroot:%{_remchroot} %{_remroot} }%{___build_shell} %{___build_args}
317 RPM_SOURCE_DIR=\"%{u2p:%{_sourcedir}}\"\
318 RPM_BUILD_DIR=\"%{u2p:%{_builddir}}\"\
319 RPM_OPT_FLAGS=\"%{optflags}\"\
320 RPM_ARCH=\"%{_arch}\"\
322 export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
323 RPM_DOC_DIR=\"%{_docdir}\"\
325 RPM_PACKAGE_NAME=\"%{name}\"\
326 RPM_PACKAGE_VERSION=\"%{version}\"\
327 RPM_PACKAGE_RELEASE=\"%{release}\"\
328 export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
329 %{?buildroot:RPM_BUILD_ROOT=\"%{u2p:%{buildroot}}\"\
330 export RPM_BUILD_ROOT}\
332 %{verbose:set -x}%{!verbose:exec > /dev/null}\
334 cd %{u2p:%{_builddir}}\
337 #%___build_body %{nil}
338 %___build_post exit 0
340 %___build_template #!%{___build_shell}\
348 #==============================================================================
349 # ---- Scriptlet templates.
350 # Macro(s) that expand to a command and script that is executed.
351 # CAVEAT: All macro expansions must fit in a BUFSIZ (8192 byte) buffer.
353 %__spec_prep_shell %{___build_shell}
354 %__spec_prep_args %{___build_args}
355 %__spec_prep_cmd %{___build_cmd}
356 %__spec_prep_pre %{___build_pre}
357 %__spec_prep_body %{___build_body}
358 %__spec_prep_post %{___build_post}
359 %__spec_prep_template #!%{__spec_prep_shell}\
363 #%{__spec_prep_body}\
364 #%{__spec_prep_post}\
367 %__spec_build_shell %{___build_shell}
368 %__spec_build_args %{___build_args}
369 %__spec_build_cmd %{___build_cmd}
370 %__spec_build_pre %{___build_pre}
371 %__spec_build_body %{___build_body}
372 %__spec_build_post %{___build_post}
373 %__spec_build_template #!%{__spec_build_shell}\
377 #%{__spec_build_body}\
378 #%{__spec_build_post}\
381 %__spec_install_shell %{___build_shell}
382 %__spec_install_args %{___build_args}
383 %__spec_install_cmd %{___build_cmd}
384 %__spec_install_pre %{___build_pre}
385 %__spec_install_body %{___build_body}
386 %__spec_install_post\
387 %{__arch_install_post}\
388 %{__os_install_post}\
390 %__spec_install_template #!%{__spec_install_shell}\
391 %{__spec_install_pre}\
394 #%{__spec_install_body}\
395 #%{__spec_install_post}\
398 #%__spec_autodep_shell %{___build_shell}
399 #%__spec_autodep_args %{___build_args}
400 #%__spec_autodep_cmd %{___build_cmd}
401 #%__spec_autodep_pre %{___build_pre}
402 #%__spec_autodep_body %{___build_body}
403 #%__spec_autodep_post %{___build_post}
404 #%__spec_autodep_template #!%{__spec_autodep_shell}\
405 #%{__spec_autodep_pre}\
408 #%{__spec_autodep_body}\
409 #%{__spec_autodep_post}\
412 %__spec_clean_shell %{___build_shell}
413 %__spec_clean_args %{___build_args}
414 %__spec_clean_cmd %{___build_cmd}
415 %__spec_clean_pre %{___build_pre}
416 %__spec_clean_body %{___build_body}
417 %__spec_clean_post %{___build_post}
418 %__spec_clean_template #!%{__spec_clean_shell}\
422 #%{__spec_clean_body}\
423 #%{__spec_clean_post}\
426 %__spec_rmbuild_shell %{___build_shell}
427 %__spec_rmbuild_args %{___build_args}
428 %__spec_rmbuild_cmd %{___build_cmd}
429 %__spec_rmbuild_pre %{___build_pre}
430 %__spec_rmbuild_body %{___build_body}
431 %__spec_rmbuild_post %{___build_post}
432 %__spec_rmbuild_template #!%{__spec_rmbuild_shell}\
433 %{__spec_rmbuild_pre}\
436 #%{__spec_rmbuild_body}\
437 #%{__spec_rmbuild_post}\
440 # XXX We don't expand pre/post install scriptlets (yet).
441 #%__spec_pre_pre %{nil}
442 #%__spec_pre_post %{nil}
443 #%__spec_post_pre %{nil}
444 #%__spec_post_post %{nil}
445 #%__spec_preun_pre %{nil}
446 #%__spec_preun_post %{nil}
447 #%__spec_postun_pre %{nil}
448 #%__spec_postun_post %{nil}
449 #%__spec_triggerpostun_pre %{nil}
450 #%__spec_triggerpostun_post %{nil}
451 #%__spec_triggerun_pre %{nil}
452 #%__spec_triggerun_post %{nil}
453 #%__spec_triggerin_pre %{nil}
454 #%__spec_triggerin_post %{nil}
456 #==============================================================================
457 # ---- configure macros.
458 # Macro(s) slavishly copied from autoconf's config.status.
461 %_exec_prefix %{_prefix}
462 %_bindir %{_exec_prefix}/bin
463 %_sbindir %{_exec_prefix}/sbin
464 %_libexecdir %{_exec_prefix}/libexec
465 %_datadir %{_prefix}/share
466 %_sysconfdir %{_prefix}/etc
467 %_sharedstatedir %{_prefix}/com
468 %_localstatedir %{_prefix}/var
470 %_libdir %{_exec_prefix}/%{_lib}
471 %_includedir %{_prefix}/include
472 %_oldincludedir /usr/include
473 %_infodir %{_prefix}/info
474 %_mandir %{_prefix}/man
476 #==============================================================================
477 # ---- config.guess platform macros.
478 # Macro(s) similar to the tokens used by configure.
481 %_build_alias %{_host_alias}
482 %_build_cpu %{_host_cpu}
483 %_build_vendor %{_host_vendor}
484 %_build_os %{_host_os}
486 %_host_alias @host_alias@
487 %_host_cpu @host_cpu@
488 %_host_vendor @host_vendor@
491 %_target_alias %{_host_alias}
492 %_target_cpu %{_host_cpu}
493 %_target_vendor %{_host_vendor}
494 %_target_os %{_host_os}
496 #==============================================================================
497 # ---- specfile macros.
498 # Macro(s) here can be used reliably for reproducible builds.
499 # (Note: Above is the goal, below are the macros under development)
501 # The configure macro does the following:
502 # optionally change to a subdirectory (not implemented).
503 # attempt to update config.guess and config.sub.
504 # run configure with correct prefix, platform, and CFLAGS.
505 # optionally restore current directory (not implemented).
506 # The configure macro should be invoked as %configure (rather than %{configure})
507 # because the rest of the arguments will be expanded using %*. Another
508 # gotcha is that arguments, if present, should be on the same line as the
512 %{?__libtoolize:[ -f configure.in ] && %{__libtoolize} --copy --force} \
513 CFLAGS="%{optflags}" ./configure %{_target_platform} --prefix=%{_prefix}
515 #------------------------------------------------------------------------------
516 # This is an improved version of %configure that may replace the above
517 # macro at some point (from PLD team).
519 #%configure { CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
520 # CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
521 # FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS ; \
522 # ./configure %{_target_platform} \
523 # --prefix=%{_prefix} \
524 # --exec-prefix=%{_exec_prefix} \
525 # --bindir=%{_bindir} \
526 # --sbindir=%{_sbindir} \
527 # --sysconfdir=%{_sysconfdir} \
528 # --datadir=%{_datadir} \
529 # --includedir=%{_includedir} \
530 # --libdir=%{_libdir} \
531 # --libexecdir=%{_libexecdir} \
532 # --localstatedir=%{_localstatedir} \
533 # --sharedstatedir=%{_sharedstatedir} \
534 # --mandir=%{_mandir} \
535 # --infodir=%{_infodir} }
537 #------------------------------------------------------------------------------
538 # The GNUconfigure macro does the following:
539 # update config.guess and config.sub.
540 # regenerate all autoconf/automake files
541 # optionally change to a directory (make the directory if requested).
542 # run configure with correct prefix, platform, and CFLAGS.
543 # optionally restore current directory.
545 # Based on autogen.sh from GNOME and orginal GNUconfigure
547 %GNUconfigure(MCs:) \
548 CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS; \
549 LDFLAGS="${LDFLAGS:-'%{-s:-s}'}" ; export LDFLAGS; \
550 %{-C:_mydir="`pwd`"; %{-M: %{__mkdir} -p %{-C*};} cd %{-C*}} \
551 dirs="`find ${_mydir} -name configure.in -print`"; export dirs; \
552 for coin in `echo ${dirs}` \
554 dr=`dirname ${coin}`; \
555 if test -f ${dr}/NO-AUTO-GEN; then \
558 macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < ${coin}`; \
560 aclocalinclude="${ACLOCAL_FLAGS}"; \
561 for k in ${macrodirs}; do \
562 if test -d ${k}; then \
563 aclocalinclude="${aclocalinclude} -I ${k}"; \
565 ## echo "**Warning**: No such directory \`${k}'. Ignored." \
568 if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then \
569 if grep "sed.*POTFILES" configure.in >/dev/null; then \
570 : do nothing -- we still have an old unmodified configure.in \
572 test -r ${dr}/aclocal.m4 || touch ${dr}/aclocal.m4; \
573 echo "no" | gettextize --force --copy; \
574 test -r ${dr}/aclocal.m4 && %{__chmod} u+w ${dr}/aclocal.m4; \
577 if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then \
578 %{__libtoolize} --force --copy; \
580 aclocal ${aclocalinclude}; \
581 if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then \
584 echo "Running automake --gnu ${am_opt} ..."; \
585 %{__automake} --add-missing --gnu ${am_opt}; \
590 %{-C:${_mydir}}%{!-C:.}/configure %{_target_platform} --prefix=%{_prefix} --exec-prefix=%{_exec_prefix} --bindir=%{_bindir} --sbindir=%{_sbindir} --sysconfdir=%{_sysconfdir} --datadir=%{_datadir} --includedir=%{_includedir} --libdir=%{_libdir} --libexecdir=%{_libexecdir} --localstatedir=%{_localstatedir} --sharedstatedir=%{_sharedstatedir} --mandir=%{_mandir} --infodir=%{_infodir} %* ; \
591 %{-C:cd ${_mydir}; unset _mydir}
593 #------------------------------------------------------------------------------
594 # Useful perl macros (from Artur Frysiak <wiget@t17.ds.pwr.wroc.pl>)
596 # For example, these can be used as (from ImageMagick.spec from PLD site)
601 # Summary: libraries and modules for access to ImageMagick from perl
602 # Group: Development/Languages/Perl
603 # Requires: %{name} = %{version}
607 # rm -fr $RPM_BUILD_ROOT
608 # install -d $RPM_BUILD_ROOT/%{perl_sitearch}
611 # %defattr(644,root,root,755)
612 # %{perl_sitearch}/Image
613 # %dir %{perl_sitearch}/auto/Image
615 %requires_eq() %(LC_ALL="C" rpm -q --queryformat 'Requires:%%{NAME} = %%{VERSION}' %1| grep -v "is not")
616 %perl_sitearch %(eval "`perl -V:installsitearch`"; echo $installsitearch)
617 %perl_archlib %(eval "`perl -V:installarchlib`"; echo $installarchlib)
619 #------------------------------------------------------------------------------
620 # arch macro for all Intel i?86 compatibile processors
621 # (Note: This macro (and it's analogues) will probably be obsoleted when
622 # rpm can use regular expressions against target platforms in macro
623 # conditionals. This change will be introduced after rpm-3.0.4).
625 %ix86 i386 i486 i586 i686 i786 i886 i986
627 #------------------------------------------------------------------------
628 # Use in %install to generate locale specific file lists. For example,
634 # %files -f %{name}.lang
636 %find_lang @RPMCONFIGDIR@/find-lang.sh %{buildroot}