1 # $Id: macros.in,v 1.53 2000/04/23 20:37:57 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:
209 # 0 linux glibc libdb1 routines.
210 # 1 db_185.h interface in db2/db3 libdb.a.
211 # 2 native db2 interface.
212 # 3 native db3 interface.
213 # -1 db3 -> db2 -> db1 -> db0 (as available).
214 # There are two macros so that --rebuilddb can convert old_db_api -> new_db_api.
218 # This is a colon separated list of tokens for Berkeley db configuration.
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 # The (intended) default value for Red Hat Linux is
239 # hash:mpool:shared:lock
241 # teardown Should the DB3 environment be removed after use (experimental)?
242 # usecursors Should DB3 cursors be used in get/put/del (experimental)?
244 %__dbi_flags create:mpool
246 %__dbi_perms perms=0644
247 %__dbi_major db%{_dbapi}
248 %__dbi_other teardown:usecursors
249 %__dbi_verbose verbose
250 %__dbi_mp_mmapsize mp_mmapsize=16Mb
251 %__dbi_mp_size mp_size=2Mb
260 %{__dbi_mp_mmapsize}\
264 %_dbi_indices Packages:Name:Basenames:Group:Requirename:Providename:Conflictname:Triggername
266 #==============================================================================
267 # ---- per-platform macros.
268 # Macros that are specific to an individual platform. The values here
269 # will be used if the per-platform macro file does not exist..
271 %_arch @RPMCANONARCH@
272 %_vendor @RPMCANONVENDOR@
274 %_target_platform %{_target_cpu}-%{_vendor}-%{_target_os}
276 # XXX use the rpmrc instantiated macro for now
279 %__arch_install_post %{nil}
280 %__os_install_post %{___build_post}
282 #==============================================================================
283 # ---- Scriptlet template templates.
284 # Global defaults used for building scriptlet templates.
286 # XXX legacy configuration, this will be eliminated after rpm-3.0.4.
287 %_preScriptEnvironment \
288 RPM_SOURCE_DIR=\"%{_sourcedir}\"\
289 RPM_BUILD_DIR=\"%{_builddir}\"\
290 RPM_OPT_FLAGS=\"%{optflags}\"\
291 RPM_ARCH=\"%{_arch}\"\
293 export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
294 RPM_DOC_DIR=\"%{_docdir}\"\
296 RPM_PACKAGE_NAME=\"%{name}\"\
297 RPM_PACKAGE_VERSION=\"%{version}\"\
298 RPM_PACKAGE_RELEASE=\"%{release}\"\
299 export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
300 %{?buildroot:RPM_BUILD_ROOT=\"%{buildroot}\"\
301 export RPM_BUILD_ROOT}
303 %___build_shell %{?_buildshell:%{_buildshell}}%{!?_buildshell:/bin/sh}
305 %___build_cmd %{?_sudo:%{_sudo} }%{?_remsh:%{_remsh} %{_remhost} }%{?_remsudo:%{_remsudo} }%{?_remchroot:%{_remchroot} %{_remroot} }%{___build_shell} %{___build_args}
307 RPM_SOURCE_DIR=\"%{u2p:%{_sourcedir}}\"\
308 RPM_BUILD_DIR=\"%{u2p:%{_builddir}}\"\
309 RPM_OPT_FLAGS=\"%{optflags}\"\
310 RPM_ARCH=\"%{_arch}\"\
312 export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
313 RPM_DOC_DIR=\"%{_docdir}\"\
315 RPM_PACKAGE_NAME=\"%{name}\"\
316 RPM_PACKAGE_VERSION=\"%{version}\"\
317 RPM_PACKAGE_RELEASE=\"%{release}\"\
318 export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
319 %{?buildroot:RPM_BUILD_ROOT=\"%{u2p:%{buildroot}}\"\
320 export RPM_BUILD_ROOT}\
322 %{verbose:set -x}%{!verbose:exec > /dev/null}\
324 cd %{u2p:%{_builddir}}\
327 #%___build_body %{nil}
328 %___build_post exit 0
330 %___build_template #!%{___build_shell}\
338 #==============================================================================
339 # ---- Scriptlet templates.
340 # Macro(s) that expand to a command and script that is executed.
341 # CAVEAT: All macro expansions must fit in a BUFSIZ (8192 byte) buffer.
343 %__spec_prep_shell %{___build_shell}
344 %__spec_prep_args %{___build_args}
345 %__spec_prep_cmd %{___build_cmd}
346 %__spec_prep_pre %{___build_pre}
347 %__spec_prep_body %{___build_body}
348 %__spec_prep_post %{___build_post}
349 %__spec_prep_template #!%{__spec_prep_shell}\
353 #%{__spec_prep_body}\
354 #%{__spec_prep_post}\
357 %__spec_build_shell %{___build_shell}
358 %__spec_build_args %{___build_args}
359 %__spec_build_cmd %{___build_cmd}
360 %__spec_build_pre %{___build_pre}
361 %__spec_build_body %{___build_body}
362 %__spec_build_post %{___build_post}
363 %__spec_build_template #!%{__spec_build_shell}\
367 #%{__spec_build_body}\
368 #%{__spec_build_post}\
371 %__spec_install_shell %{___build_shell}
372 %__spec_install_args %{___build_args}
373 %__spec_install_cmd %{___build_cmd}
374 %__spec_install_pre %{___build_pre}
375 %__spec_install_body %{___build_body}
376 %__spec_install_post\
377 %{__arch_install_post}\
378 %{__os_install_post}\
380 %__spec_install_template #!%{__spec_install_shell}\
381 %{__spec_install_pre}\
384 #%{__spec_install_body}\
385 #%{__spec_install_post}\
388 #%__spec_autodep_shell %{___build_shell}
389 #%__spec_autodep_args %{___build_args}
390 #%__spec_autodep_cmd %{___build_cmd}
391 #%__spec_autodep_pre %{___build_pre}
392 #%__spec_autodep_body %{___build_body}
393 #%__spec_autodep_post %{___build_post}
394 #%__spec_autodep_template #!%{__spec_autodep_shell}\
395 #%{__spec_autodep_pre}\
398 #%{__spec_autodep_body}\
399 #%{__spec_autodep_post}\
402 %__spec_clean_shell %{___build_shell}
403 %__spec_clean_args %{___build_args}
404 %__spec_clean_cmd %{___build_cmd}
405 %__spec_clean_pre %{___build_pre}
406 %__spec_clean_body %{___build_body}
407 %__spec_clean_post %{___build_post}
408 %__spec_clean_template #!%{__spec_clean_shell}\
412 #%{__spec_clean_body}\
413 #%{__spec_clean_post}\
416 %__spec_rmbuild_shell %{___build_shell}
417 %__spec_rmbuild_args %{___build_args}
418 %__spec_rmbuild_cmd %{___build_cmd}
419 %__spec_rmbuild_pre %{___build_pre}
420 %__spec_rmbuild_body %{___build_body}
421 %__spec_rmbuild_post %{___build_post}
422 %__spec_rmbuild_template #!%{__spec_rmbuild_shell}\
423 %{__spec_rmbuild_pre}\
426 #%{__spec_rmbuild_body}\
427 #%{__spec_rmbuild_post}\
430 # XXX We don't expand pre/post install scriptlets (yet).
431 #%__spec_pre_pre %{nil}
432 #%__spec_pre_post %{nil}
433 #%__spec_post_pre %{nil}
434 #%__spec_post_post %{nil}
435 #%__spec_preun_pre %{nil}
436 #%__spec_preun_post %{nil}
437 #%__spec_postun_pre %{nil}
438 #%__spec_postun_post %{nil}
439 #%__spec_triggerpostun_pre %{nil}
440 #%__spec_triggerpostun_post %{nil}
441 #%__spec_triggerun_pre %{nil}
442 #%__spec_triggerun_post %{nil}
443 #%__spec_triggerin_pre %{nil}
444 #%__spec_triggerin_post %{nil}
446 #==============================================================================
447 # ---- configure macros.
448 # Macro(s) slavishly copied from autoconf's config.status.
451 %_exec_prefix %{_prefix}
452 %_bindir %{_exec_prefix}/bin
453 %_sbindir %{_exec_prefix}/sbin
454 %_libexecdir %{_exec_prefix}/libexec
455 %_datadir %{_prefix}/share
456 %_sysconfdir %{_prefix}/etc
457 %_sharedstatedir %{_prefix}/com
458 %_localstatedir %{_prefix}/var
460 %_libdir %{_exec_prefix}/%{_lib}
461 %_includedir %{_prefix}/include
462 %_oldincludedir /usr/include
463 %_infodir %{_prefix}/info
464 %_mandir %{_prefix}/man
466 #==============================================================================
467 # ---- config.guess platform macros.
468 # Macro(s) similar to the tokens used by configure.
471 %_build_alias %{_host_alias}
472 %_build_cpu %{_host_cpu}
473 %_build_vendor %{_host_vendor}
474 %_build_os %{_host_os}
476 %_host_alias @host_alias@
477 %_host_cpu @host_cpu@
478 %_host_vendor @host_vendor@
481 %_target_alias %{_host_alias}
482 %_target_cpu %{_host_cpu}
483 %_target_vendor %{_host_vendor}
484 %_target_os %{_host_os}
486 #==============================================================================
487 # ---- specfile macros.
488 # Macro(s) here can be used reliably for reproducible builds.
489 # (Note: Above is the goal, below are the macros under development)
491 # The configure macro does the following:
492 # optionally change to a subdirectory (not implemented).
493 # attempt to update config.guess and config.sub.
494 # run configure with correct prefix, platform, and CFLAGS.
495 # optionally restore current directory (not implemented).
496 # The configure macro should be invoked as %configure (rather than %{configure})
497 # because the rest of the arguments will be expanded using %*. Another
498 # gotcha is that arguments, if present, should be on the same line as the
502 %{?__libtoolize:[ -f configure.in ] && %{__libtoolize} --copy --force} \
503 CFLAGS="%{optflags}" ./configure %{_target_platform} --prefix=%{_prefix}
505 #------------------------------------------------------------------------------
506 # This is an improved version of %configure that may replace the above
507 # macro at some point (from PLD team).
509 #%configure { CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
510 # CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
511 # FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS ; \
512 # ./configure %{_target_platform} \
513 # --prefix=%{_prefix} \
514 # --exec-prefix=%{_exec_prefix} \
515 # --bindir=%{_bindir} \
516 # --sbindir=%{_sbindir} \
517 # --sysconfdir=%{_sysconfdir} \
518 # --datadir=%{_datadir} \
519 # --includedir=%{_includedir} \
520 # --libdir=%{_libdir} \
521 # --libexecdir=%{_libexecdir} \
522 # --localstatedir=%{_localstatedir} \
523 # --sharedstatedir=%{_sharedstatedir} \
524 # --mandir=%{_mandir} \
525 # --infodir=%{_infodir} }
527 #------------------------------------------------------------------------------
528 # The GNUconfigure macro does the following:
529 # update config.guess and config.sub.
530 # regenerate all autoconf/automake files
531 # optionally change to a directory (make the directory if requested).
532 # run configure with correct prefix, platform, and CFLAGS.
533 # optionally restore current directory.
535 # Based on autogen.sh from GNOME and orginal GNUconfigure
537 %GNUconfigure(MCs:) \
538 CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS; \
539 LDFLAGS="${LDFLAGS:-'%{-s:-s}'}" ; export LDFLAGS; \
540 %{-C:_mydir="`pwd`"; %{-M: %{__mkdir} -p %{-C*};} cd %{-C*}} \
541 dirs="`find ${_mydir} -name configure.in -print`"; export dirs; \
542 for coin in `echo ${dirs}` \
544 dr=`dirname ${coin}`; \
545 if test -f ${dr}/NO-AUTO-GEN; then \
548 macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < ${coin}`; \
550 aclocalinclude="${ACLOCAL_FLAGS}"; \
551 for k in ${macrodirs}; do \
552 if test -d ${k}; then \
553 aclocalinclude="${aclocalinclude} -I ${k}"; \
555 ## echo "**Warning**: No such directory \`${k}'. Ignored." \
558 if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then \
559 if grep "sed.*POTFILES" configure.in >/dev/null; then \
560 : do nothing -- we still have an old unmodified configure.in \
562 test -r ${dr}/aclocal.m4 || touch ${dr}/aclocal.m4; \
563 echo "no" | gettextize --force --copy; \
564 test -r ${dr}/aclocal.m4 && %{__chmod} u+w ${dr}/aclocal.m4; \
567 if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then \
568 %{__libtoolize} --force --copy; \
570 aclocal ${aclocalinclude}; \
571 if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then \
574 echo "Running automake --gnu ${am_opt} ..."; \
575 %{__automake} --add-missing --gnu ${am_opt}; \
580 %{-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} %* ; \
581 %{-C:cd ${_mydir}; unset _mydir}
583 #------------------------------------------------------------------------------
584 # Useful perl macros (from Artur Frysiak <wiget@t17.ds.pwr.wroc.pl>)
586 # For example, these can be used as (from ImageMagick.spec from PLD site)
591 # Summary: libraries and modules for access to ImageMagick from perl
592 # Group: Development/Languages/Perl
593 # Requires: %{name} = %{version}
597 # rm -fr $RPM_BUILD_ROOT
598 # install -d $RPM_BUILD_ROOT/%{perl_sitearch}
601 # %defattr(644,root,root,755)
602 # %{perl_sitearch}/Image
603 # %dir %{perl_sitearch}/auto/Image
605 %requires_eq() %(LC_ALL="C" rpm -q --queryformat 'Requires:%%{NAME} = %%{VERSION}' %1| grep -v "is not")
606 %perl_sitearch %(eval "`perl -V:installsitearch`"; echo $installsitearch)
607 %perl_archlib %(eval "`perl -V:installarchlib`"; echo $installarchlib)
609 #------------------------------------------------------------------------------
610 # arch macro for all Intel i?86 compatibile processors
611 # (Note: This macro (and it's analogues) will probably be obsoleted when
612 # rpm can use regular expressions against target platforms in macro
613 # conditionals. This change will be introduced after rpm-3.0.4).
615 %ix86 i386 i486 i586 i686 i786 i886 i986
617 #------------------------------------------------------------------------
618 # Use in %install to generate locale specific file lists. For example,
624 # %files -f %{name}.lang
626 %find_lang @RPMCONFIGDIR@/find-lang.sh %{buildroot}