1 # $Id: macros.in,v 1.68 2000/09/01 21:15:41 jbj Exp $
3 # This is a global RPM configuration file. All changes made here will
4 # be lost when the rpm package is upgraded. Any per-system configuration
5 # should be added to /etc/rpm/macros, while per-user configuration should
6 # be added to ~/.rpmmacros.
8 #==============================================================================
9 # Macro naming conventions (preliminary):
11 # Macros that begin with an underscore are "local" in the sense that
12 # they (if used) will not be exported in rpm headers. Some macros
13 # that don't start with an underscore (but look like they should)
14 # are compatible with macros generated by rpm-2.5.x and will be made
15 # more consistent in a future release.
18 #==============================================================================
19 # ---- A macro that expands to nothing.
23 #==============================================================================
24 # ---- filesystem macros.
30 #==============================================================================
31 # ---- Generally useful path macros.
44 %__install @__INSTALL@
59 #==============================================================================
60 # ---- Build system path macros.
67 %__objcopy @__OBJCOPY@
68 %__objdump @__OBJDUMP@
73 # XXX avoid failures if tools are not installed when rpm is built.
74 %__libtoolize libtoolize
76 %__autoheader autoheader
80 #==============================================================================
81 # ---- Required rpmrc macros.
82 # Macros that used to be initialized as a side effect of rpmrc parsing.
83 # These are the default values that can be overridden by other
84 # (e.g. per-platform, per-system, per-packager, per-package) macros.
86 %_builddir %{_topdir}/BUILD
89 %_dbpath %{_var}/lib/rpm
90 %_dbpath_rebuild %{_dbpath}
91 %_defaultdocdir %{_usr}/doc
93 %__find_provides @FINDPROVIDES@
94 %__find_requires @FINDREQUIRES@
96 #%__find_conflicts ???
97 #%__find_obsoletes ???
99 # XXX fixowner, fixgroup, and fixperms are run at the end of hardcoded setup
101 %__chown_Rhf @__CHOWN_RHF@
102 %__chgrp_Rhf @__CHGRP_RHF@
103 %_fixowner [ `%{__id_u}` = '0' ] && %{__chown_Rhf} root
104 %_fixgroup [ `%{__id_u}` = '0' ] && %{__chgrp_Rhf} @ROOT_GROUP@
105 %_fixperms %{__chmod} -Rf @FIXPERMS@
110 %_rpmdir %{_topdir}/RPMS
112 # XXX Note escaped %% for use in headerSprintf
113 %_rpmfilename %%{ARCH}/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
115 %_sourcedir %{_topdir}/SOURCES
116 %_specdir %{_topdir}/SPECS
117 %_srcrpmdir %{_topdir}/SRPMS
118 %_tmppath %{_var}/tmp
119 %_topdir %{_usrsrc}/redhat
121 #==============================================================================
122 # ---- Optional rpmrc macros.
123 # Macros that are initialized as a side effect of rpmrc and/or spec
126 # Configurable build root path, same as BuildRoot: in a specfile.
127 # (Note: the configured macro value will override the spec file value).
131 # The sub-directory (relative to %{_builddir}) where sources are compiled.
132 # This macro is set after processing %setup, either explicitly from the
133 # value given to -n or the default name-version.
137 # Configurable distribution information, same as Distribution: tag in a
142 # Configurable distribution URL, same as DistURL: tag in a specfile.
143 # The URL will be used to supply reliable information to tools like
146 # Note: You should not configure with disturl (or build packages with
147 # the DistURL: tag) unless you are willing to supply content in a
148 # yet-to-be-determined format at the URL specified.
152 # Boolean (i.e. 1 == "yes", 0 == "no") that controls whether files
153 # marked as %doc should be installed.
156 # The port and machine name of a FTP proxy host running TIS firewall.
161 # The signature to use and the location of configuration files for
162 # signing packages with GNU gpg.
167 # The port and machine name of an HTTP proxy host.
172 # The PATH put into the environment before running %pre/%post et al.
174 %_install_script_path /sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin
176 # A colon separated list of desired locales to be installed;
177 # "all" means install all locale specific files.
185 # A colon separated list of paths where files should *not* be installed.
186 # Usually, these are network file system mount points.
190 # Configurable packager information, same as Packager: in a specfile.
194 # Compression type and level for source/binary package payloads.
195 # "w9.gzdio" gzip level 9 (default).
196 # "w9.bzdio" bzip2 level 9.
198 #%_source_payload w9.gzdio
199 #%_binary_payload w9.gzdio
201 # The signature to use and the location of configuration files for
202 # signing packages with PGP.
207 # Configurable virtual provides (unimplemented, use Provides: ...
216 # Configurable vendor information, same as Vendor: in a specfile.
220 #==============================================================================
221 # ---- Database configuration macros.
222 # Macros used to configure Berkley db parameters.
224 # Choose db interface:
226 # 1 native db1 interface (e.g. linux glibc libdb1 routines).
227 # 2 native db2 interface (not currently implemented, may never be).
228 # 3 native db3 interface.
229 # -1 db3 -> db2 -> db1 (as available).
231 # There are two macros so that --rebuilddb can convert db1 -> db3.
237 # token Berkeley db flag or value
238 # =================================================
241 # See http://www.sleepycat.com for Berkeley db-3.0.55 documentation.
243 # Additional rpm specific configuration:
244 # usecursors Should DB3 cursors be used in get/put/del ?
245 # lockdbfd Should the file be locked using fcntl shared/exclusive locks?
248 %__dbi_other usecursors
249 %__dbi_perms perms=0644
251 # This is a colon (or white space) separated list of tokens for Berkeley
259 # The list of tags for which indices will be built.
260 %_dbi_tags Packages:Name:Basenames:Group:Requirename:Providename:Conflictname:Triggername:Depends
262 # "Packages" needs fcntl shared/exclusive lock.
263 %_dbi_config_Packages %{_dbi_config}:lockdbfd
265 # "Depends" is a per-transaction cache of known dependency resolutions.
266 %_dbi_config_Depends %{_dbi_config}:temporary
268 #==============================================================================
269 # ---- per-platform macros.
270 # Macros that are specific to an individual platform. The values here
271 # will be used if the per-platform macro file does not exist..
273 %_arch @RPMCANONARCH@
274 %_vendor @RPMCANONVENDOR@
276 %_target_platform %{_target_cpu}-%{_vendor}-%{_target_os}
279 # Define a generic value for optflags. Normally overridden by per-target macros.
283 # Define per-arch and per-os defaults. Normally overridden by per-target macros.
284 %__arch_install_post %{nil}
285 %__os_install_post %{___build_post}
287 #==============================================================================
288 # ---- Scriptlet template templates.
289 # Global defaults used for building scriptlet templates.
291 # XXX legacy configuration, this will be eliminated after rpm-3.0.4.
292 %_preScriptEnvironment \
293 RPM_SOURCE_DIR=\"%{_sourcedir}\"\
294 RPM_BUILD_DIR=\"%{_builddir}\"\
295 RPM_OPT_FLAGS=\"%{optflags}\"\
296 RPM_ARCH=\"%{_arch}\"\
298 export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
299 RPM_DOC_DIR=\"%{_docdir}\"\
301 RPM_PACKAGE_NAME=\"%{name}\"\
302 RPM_PACKAGE_VERSION=\"%{version}\"\
303 RPM_PACKAGE_RELEASE=\"%{release}\"\
304 export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
305 %{?buildroot:RPM_BUILD_ROOT=\"%{buildroot}\"\
306 export RPM_BUILD_ROOT}
308 %___build_shell %{?_buildshell:%{_buildshell}}%{!?_buildshell:/bin/sh}
310 %___build_cmd %{?_sudo:%{_sudo} }%{?_remsh:%{_remsh} %{_remhost} }%{?_remsudo:%{_remsudo} }%{?_remchroot:%{_remchroot} %{_remroot} }%{___build_shell} %{___build_args}
312 RPM_SOURCE_DIR=\"%{u2p:%{_sourcedir}}\"\
313 RPM_BUILD_DIR=\"%{u2p:%{_builddir}}\"\
314 RPM_OPT_FLAGS=\"%{optflags}\"\
315 RPM_ARCH=\"%{_arch}\"\
317 export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
318 RPM_DOC_DIR=\"%{_docdir}\"\
320 RPM_PACKAGE_NAME=\"%{name}\"\
321 RPM_PACKAGE_VERSION=\"%{version}\"\
322 RPM_PACKAGE_RELEASE=\"%{release}\"\
323 export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
324 %{?buildroot:RPM_BUILD_ROOT=\"%{u2p:%{buildroot}}\"\
325 export RPM_BUILD_ROOT}\
327 %{verbose:set -x}%{!verbose:exec > /dev/null}\
329 cd %{u2p:%{_builddir}}\
332 #%___build_body %{nil}
333 %___build_post exit 0
335 %___build_template #!%{___build_shell}\
343 #==============================================================================
344 # ---- Scriptlet templates.
345 # Macro(s) that expand to a command and script that is executed.
346 # CAVEAT: All macro expansions must fit in a BUFSIZ (8192 byte) buffer.
348 %__spec_prep_shell %{___build_shell}
349 %__spec_prep_args %{___build_args}
350 %__spec_prep_cmd %{___build_cmd}
351 %__spec_prep_pre %{___build_pre}
352 %__spec_prep_body %{___build_body}
353 %__spec_prep_post %{___build_post}
354 %__spec_prep_template #!%{__spec_prep_shell}\
358 #%{__spec_prep_body}\
359 #%{__spec_prep_post}\
362 %__spec_build_shell %{___build_shell}
363 %__spec_build_args %{___build_args}
364 %__spec_build_cmd %{___build_cmd}
365 %__spec_build_pre %{___build_pre}
366 %__spec_build_body %{___build_body}
367 %__spec_build_post %{___build_post}
368 %__spec_build_template #!%{__spec_build_shell}\
372 #%{__spec_build_body}\
373 #%{__spec_build_post}\
376 %__spec_install_shell %{___build_shell}
377 %__spec_install_args %{___build_args}
378 %__spec_install_cmd %{___build_cmd}
379 %__spec_install_pre %{___build_pre}
380 %__spec_install_body %{___build_body}
381 %__spec_install_post\
382 %{__arch_install_post}\
383 %{__os_install_post}\
385 %__spec_install_template #!%{__spec_install_shell}\
386 %{__spec_install_pre}\
389 #%{__spec_install_body}\
390 #%{__spec_install_post}\
393 #%__spec_autodep_shell %{___build_shell}
394 #%__spec_autodep_args %{___build_args}
395 #%__spec_autodep_cmd %{___build_cmd}
396 #%__spec_autodep_pre %{___build_pre}
397 #%__spec_autodep_body %{___build_body}
398 #%__spec_autodep_post %{___build_post}
399 #%__spec_autodep_template #!%{__spec_autodep_shell}\
400 #%{__spec_autodep_pre}\
403 #%{__spec_autodep_body}\
404 #%{__spec_autodep_post}\
407 %__spec_clean_shell %{___build_shell}
408 %__spec_clean_args %{___build_args}
409 %__spec_clean_cmd %{___build_cmd}
410 %__spec_clean_pre %{___build_pre}
411 %__spec_clean_body %{___build_body}
412 %__spec_clean_post %{___build_post}
413 %__spec_clean_template #!%{__spec_clean_shell}\
417 #%{__spec_clean_body}\
418 #%{__spec_clean_post}\
421 %__spec_rmbuild_shell %{___build_shell}
422 %__spec_rmbuild_args %{___build_args}
423 %__spec_rmbuild_cmd %{___build_cmd}
424 %__spec_rmbuild_pre %{___build_pre}
425 %__spec_rmbuild_body %{___build_body}
426 %__spec_rmbuild_post %{___build_post}
427 %__spec_rmbuild_template #!%{__spec_rmbuild_shell}\
428 %{__spec_rmbuild_pre}\
431 #%{__spec_rmbuild_body}\
432 #%{__spec_rmbuild_post}\
435 # XXX We don't expand pre/post install scriptlets (yet).
436 #%__spec_pre_pre %{nil}
437 #%__spec_pre_post %{nil}
438 #%__spec_post_pre %{nil}
439 #%__spec_post_post %{nil}
440 #%__spec_preun_pre %{nil}
441 #%__spec_preun_post %{nil}
442 #%__spec_postun_pre %{nil}
443 #%__spec_postun_post %{nil}
444 #%__spec_triggerpostun_pre %{nil}
445 #%__spec_triggerpostun_post %{nil}
446 #%__spec_triggerun_pre %{nil}
447 #%__spec_triggerun_post %{nil}
448 #%__spec_triggerin_pre %{nil}
449 #%__spec_triggerin_post %{nil}
451 #==============================================================================
452 # ---- configure macros.
453 # Macro(s) slavishly copied from autoconf's config.status.
456 %_exec_prefix %{_prefix}
457 %_bindir %{_exec_prefix}/bin
458 %_sbindir %{_exec_prefix}/sbin
459 %_libexecdir %{_exec_prefix}/libexec
460 %_datadir %{_prefix}/share
461 %_sysconfdir %{_prefix}/etc
462 %_sharedstatedir %{_prefix}/com
463 %_localstatedir %{_prefix}/var
465 %_libdir %{_exec_prefix}/%{_lib}
466 %_includedir %{_prefix}/include
467 %_oldincludedir /usr/include
468 %_infodir %{_prefix}/info
469 %_mandir %{_prefix}/man
471 #==============================================================================
472 # ---- config.guess platform macros.
473 # Macro(s) similar to the tokens used by configure.
476 %_build_alias %{_host_alias}
477 %_build_cpu %{_host_cpu}
478 %_build_vendor %{_host_vendor}
479 %_build_os %{_host_os}
481 %_host_alias @host_alias@
482 %_host_cpu @host_cpu@
483 %_host_vendor @host_vendor@
486 %_target_alias %{_host_alias}
487 %_target_cpu %{_host_cpu}
488 %_target_vendor %{_host_vendor}
489 %_target_os %{_host_os}
491 #==============================================================================
492 # ---- specfile macros.
493 # Macro(s) here can be used reliably for reproducible builds.
494 # (Note: Above is the goal, below are the macros under development)
496 # The configure macro does the following:
497 # optionally change to a subdirectory (not implemented).
498 # attempt to update config.guess and config.sub.
499 # run configure with correct prefix, platform, and CFLAGS.
500 # optionally restore current directory (not implemented).
501 # The configure macro should be invoked as %configure (rather than %{configure})
502 # because the rest of the arguments will be expanded using %*. Another
503 # gotcha is that arguments, if present, should be on the same line as the
506 # This is the version of %configure used through rpm-3.0.4.
508 # %{?__libtoolize:[ -f configure.in ] && %{__libtoolize} --copy --force} \
509 # CFLAGS="%{optflags}" ./configure %{_target_platform} --prefix=%{_prefix}
511 #------------------------------------------------------------------------------
512 # This is an improved version of %configure (from PLD team).
514 CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
515 CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
516 FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS ; \
517 %{?__libtoolize:[ -f configure.in ] && %{__libtoolize} --copy --force} ; \
518 ./configure %{_target_platform} \\\
519 --prefix=%{_prefix} \\\
520 --exec-prefix=%{_exec_prefix} \\\
521 --bindir=%{_bindir} \\\
522 --sbindir=%{_sbindir} \\\
523 --sysconfdir=%{_sysconfdir} \\\
524 --datadir=%{_datadir} \\\
525 --includedir=%{_includedir} \\\
526 --libdir=%{_libdir} \\\
527 --libexecdir=%{_libexecdir} \\\
528 --localstatedir=%{_localstatedir} \\\
529 --sharedstatedir=%{_sharedstatedir} \\\
530 --mandir=%{_mandir} \\\
531 --infodir=%{_infodir}
532 #------------------------------------------------------------------------------
533 # The make install analogue of %configure:
536 prefix=%{?buildroot:%{buildroot}}%{_prefix} \\\
537 exec_prefix=%{?buildroot:%{buildroot}}%{_exec_prefix} \\\
538 bindir=%{?buildroot:%{buildroot}}%{_bindir} \\\
539 sbindir=%{?buildroot:%{buildroot}}%{_sbindir} \\\
540 sysconfdir=%{?buildroot:%{buildroot}}%{_sysconfdir} \\\
541 datadir=%{?buildroot:%{buildroot}}%{_datadir} \\\
542 includedir=%{?buildroot:%{buildroot}}%{_includedir} \\\
543 libdir=%{?buildroot:%{buildroot}}%{_libdir} \\\
544 libexecdir=%{?buildroot:%{buildroot}}%{_libexecdir} \\\
545 localstatedir=%{?buildroot:%{buildroot}}%{_localstatedir} \\\
546 sharedstatedir=%{?buildroot:%{buildroot}}%{_sharedstatedir} \\\
547 mandir=%{?buildroot:%{buildroot}}%{_mandir} \\\
548 infodir=%{?buildroot:%{buildroot}}%{_infodir} \\\
551 #------------------------------------------------------------------------------
552 # The GNUconfigure macro does the following:
553 # update config.guess and config.sub.
554 # regenerate all autoconf/automake files
555 # optionally change to a directory (make the directory if requested).
556 # run configure with correct prefix, platform, and CFLAGS.
557 # optionally restore current directory.
559 # Based on autogen.sh from GNOME and orginal GNUconfigure
561 %GNUconfigure(MCs:) \
562 CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS; \
563 LDFLAGS="${LDFLAGS:-'%{-s:-s}'}" ; export LDFLAGS; \
564 %{-C:_mydir="`pwd`"; %{-M: %{__mkdir} -p %{-C*};} cd %{-C*}} \
565 dirs="`find ${_mydir} -name configure.in -print`"; export dirs; \
566 for coin in `echo ${dirs}` \
568 dr=`dirname ${coin}`; \
569 if test -f ${dr}/NO-AUTO-GEN; then \
572 macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < ${coin}`; \
574 aclocalinclude="${ACLOCAL_FLAGS}"; \
575 for k in ${macrodirs}; do \
576 if test -d ${k}; then \
577 aclocalinclude="${aclocalinclude} -I ${k}"; \
579 ## echo "**Warning**: No such directory \`${k}'. Ignored." \
582 if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then \
583 if grep "sed.*POTFILES" configure.in >/dev/null; then \
584 : do nothing -- we still have an old unmodified configure.in \
586 test -r ${dr}/aclocal.m4 || touch ${dr}/aclocal.m4; \
587 echo "no" | gettextize --force --copy; \
588 test -r ${dr}/aclocal.m4 && %{__chmod} u+w ${dr}/aclocal.m4; \
591 if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then \
592 %{__libtoolize} --force --copy; \
594 aclocal ${aclocalinclude}; \
595 if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then \
598 echo "Running automake --gnu ${am_opt} ..."; \
599 %{__automake} --add-missing --gnu ${am_opt}; \
604 %{-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} %* ; \
605 %{-C:cd ${_mydir}; unset _mydir}
607 #------------------------------------------------------------------------------
608 # Useful perl macros (from Artur Frysiak <wiget@t17.ds.pwr.wroc.pl>)
610 # For example, these can be used as (from ImageMagick.spec from PLD site)
615 # Summary: libraries and modules for access to ImageMagick from perl
616 # Group: Development/Languages/Perl
617 # Requires: %{name} = %{version}
621 # rm -fr $RPM_BUILD_ROOT
622 # install -d $RPM_BUILD_ROOT/%{perl_sitearch}
625 # %defattr(644,root,root,755)
626 # %{perl_sitearch}/Image
627 # %dir %{perl_sitearch}/auto/Image
629 %requires_eq() %(LC_ALL="C" rpm -q --queryformat 'Requires:%%{NAME} = %%{VERSION}' %1| grep -v "is not")
630 %perl_sitearch %(eval "`perl -V:installsitearch`"; echo $installsitearch)
631 %perl_archlib %(eval "`perl -V:installarchlib`"; echo $installarchlib)
633 #------------------------------------------------------------------------------
634 # arch macro for all Intel i?86 compatibile processors
635 # (Note: This macro (and it's analogues) will probably be obsoleted when
636 # rpm can use regular expressions against target platforms in macro
637 # conditionals. This change will be introduced after rpm-3.0.4).
639 %ix86 i386 i486 i586 i686 i786 i886 i986
641 #------------------------------------------------------------------------
642 # Use in %install to generate locale specific file lists. For example,
648 # %files -f %{name}.lang
650 %find_lang @RPMCONFIGDIR@/find-lang.sh %{buildroot}