1 # $Id: macros.in,v 1.51 2000/04/19 16:03:49 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 %_defaultdocdir %{_usr}/doc
87 %__find_provides @FINDPROVIDES@
88 %__find_requires @FINDREQUIRES@
90 #%__find_conflicts ???
91 #%__find_obsoletes ???
93 # XXX fixowner, fixgroup, and fixperms are run at the end of hardcoded setup
95 %__chown_Rhf @__CHOWN_RHF@
96 %__chgrp_Rhf @__CHGRP_RHF@
97 %_fixowner [ `%{__id_u}` = '0' ] && %{__chown_Rhf} root
98 %_fixgroup [ `%{__id_u}` = '0' ] && %{__chgrp_Rhf} @ROOT_GROUP@
99 %_fixperms %{__chmod} -Rf @FIXPERMS@
104 %_rpmdir %{_topdir}/RPMS
106 # XXX Note escaped %% for use in headerSprintf
107 %_rpmfilename %%{ARCH}/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
109 %_sourcedir %{_topdir}/SOURCES
110 %_specdir %{_topdir}/SPECS
111 %_srcrpmdir %{_topdir}/SRPMS
112 %_tmppath %{_var}/tmp
113 %_topdir %{_usrsrc}/redhat
115 #==============================================================================
116 # ---- Optional rpmrc macros.
117 # Macros that are initialized as a side effect of rpmrc and/or spec
120 # Configurable build root path, same as BuildRoot: in a specfile.
121 # (Note: the configured macro value will override the spec file value).
125 # The sub-directory (relative to %{_builddir}) where sources are compiled.
126 # This macro is set after processing %setup, either explicitly from the
127 # value given to -n or the default name-version.
131 # Configurable distribution information, same as Distribution: in a
136 # Boolean (i.e. 1 == "yes", 0 == "no") that controls whether files
137 # marked as %doc should be installed.
140 # The port and machine name of a FTP proxy host running TIS firewall.
145 # The signature to use and the location of configuration files for
146 # signing packages with GNU gpg.
151 # The port and machine name of an HTTP proxy host.
156 # The PATH put into the environment before running %pre/%post et al.
158 %_install_script_path /sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin
160 # A colon separated list of desired locales to be installed;
161 # "all" means install all locale specific files.
169 # A colon separated list of paths where files should *not* be installed.
170 # Usually, these are network file system mount points.
174 # Configurable packager information, same as Packager: in a specfile.
178 # Compression type and level for package payloads.
179 # "w9.gzdio" gzip level 9 (default).
180 # "w9.bzdio" bzip2 level 9 (experimental, at your own risk).
182 #%_payload_compression w9.gzdio
184 # The signature to use and the location of configuration files for
185 # signing packages with PGP.
190 # Configurable virtual provides (unimplemented, use Provides: ...
199 # Configurable vendor information, same as Vendor: in a specfile.
203 # Preferred db interface:
204 # 0 linux glibc libdb1 routines.
205 # 1 db_185.h interface in db2/db3 libdb.a.
206 # 2 native db2 interface.
207 # 3 native db3 interface.
209 %_db3_flags create:mpool
210 %_db3_dbenv_remove yes
213 # Filter duplicate entries in db (needed only to correct bug pre rpm-3.0.4)
216 #==============================================================================
217 # ---- per-platform macros.
218 # Macros that are specific to an individual platform. The values here
219 # will be used if the per-platform macro file does not exist..
221 %_arch @RPMCANONARCH@
222 %_vendor @RPMCANONVENDOR@
224 %_target_platform %{_target_cpu}-%{_vendor}-%{_target_os}
226 # XXX use the rpmrc instantiated macro for now
229 %__arch_install_post %{nil}
230 %__os_install_post %{___build_post}
232 #==============================================================================
233 # ---- Scriptlet template templates.
234 # Global defaults used for building scriptlet templates.
236 # XXX legacy configuration, this will be eliminated after rpm-3.0.4.
237 %_preScriptEnvironment \
238 RPM_SOURCE_DIR=\"%{_sourcedir}\"\
239 RPM_BUILD_DIR=\"%{_builddir}\"\
240 RPM_OPT_FLAGS=\"%{optflags}\"\
241 RPM_ARCH=\"%{_arch}\"\
243 export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
244 RPM_DOC_DIR=\"%{_docdir}\"\
246 RPM_PACKAGE_NAME=\"%{name}\"\
247 RPM_PACKAGE_VERSION=\"%{version}\"\
248 RPM_PACKAGE_RELEASE=\"%{release}\"\
249 export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
250 %{?buildroot:RPM_BUILD_ROOT=\"%{buildroot}\"\
251 export RPM_BUILD_ROOT}
253 %___build_shell %{?_buildshell:%{_buildshell}}%{!?_buildshell:/bin/sh}
255 %___build_cmd %{?_sudo:%{_sudo} }%{?_remsh:%{_remsh} %{_remhost} }%{?_remsudo:%{_remsudo} }%{?_remchroot:%{_remchroot} %{_remroot} }%{___build_shell} %{___build_args}
257 RPM_SOURCE_DIR=\"%{u2p:%{_sourcedir}}\"\
258 RPM_BUILD_DIR=\"%{u2p:%{_builddir}}\"\
259 RPM_OPT_FLAGS=\"%{optflags}\"\
260 RPM_ARCH=\"%{_arch}\"\
262 export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
263 RPM_DOC_DIR=\"%{_docdir}\"\
265 RPM_PACKAGE_NAME=\"%{name}\"\
266 RPM_PACKAGE_VERSION=\"%{version}\"\
267 RPM_PACKAGE_RELEASE=\"%{release}\"\
268 export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
269 %{?buildroot:RPM_BUILD_ROOT=\"%{u2p:%{buildroot}}\"\
270 export RPM_BUILD_ROOT}\
272 %{verbose:set -x}%{!verbose:exec > /dev/null}\
274 cd %{u2p:%{_builddir}}\
277 #%___build_body %{nil}
278 %___build_post exit 0
280 %___build_template #!%{___build_shell}\
288 #==============================================================================
289 # ---- Scriptlet templates.
290 # Macro(s) that expand to a command and script that is executed.
291 # CAVEAT: All macro expansions must fit in a BUFSIZ (8192 byte) buffer.
293 %__spec_prep_shell %{___build_shell}
294 %__spec_prep_args %{___build_args}
295 %__spec_prep_cmd %{___build_cmd}
296 %__spec_prep_pre %{___build_pre}
297 %__spec_prep_body %{___build_body}
298 %__spec_prep_post %{___build_post}
299 %__spec_prep_template #!%{__spec_prep_shell}\
303 #%{__spec_prep_body}\
304 #%{__spec_prep_post}\
307 %__spec_build_shell %{___build_shell}
308 %__spec_build_args %{___build_args}
309 %__spec_build_cmd %{___build_cmd}
310 %__spec_build_pre %{___build_pre}
311 %__spec_build_body %{___build_body}
312 %__spec_build_post %{___build_post}
313 %__spec_build_template #!%{__spec_build_shell}\
317 #%{__spec_build_body}\
318 #%{__spec_build_post}\
321 %__spec_install_shell %{___build_shell}
322 %__spec_install_args %{___build_args}
323 %__spec_install_cmd %{___build_cmd}
324 %__spec_install_pre %{___build_pre}
325 %__spec_install_body %{___build_body}
326 %__spec_install_post\
327 %{__arch_install_post}\
328 %{__os_install_post}\
330 %__spec_install_template #!%{__spec_install_shell}\
331 %{__spec_install_pre}\
334 #%{__spec_install_body}\
335 #%{__spec_install_post}\
338 #%__spec_autodep_shell %{___build_shell}
339 #%__spec_autodep_args %{___build_args}
340 #%__spec_autodep_cmd %{___build_cmd}
341 #%__spec_autodep_pre %{___build_pre}
342 #%__spec_autodep_body %{___build_body}
343 #%__spec_autodep_post %{___build_post}
344 #%__spec_autodep_template #!%{__spec_autodep_shell}\
345 #%{__spec_autodep_pre}\
348 #%{__spec_autodep_body}\
349 #%{__spec_autodep_post}\
352 %__spec_clean_shell %{___build_shell}
353 %__spec_clean_args %{___build_args}
354 %__spec_clean_cmd %{___build_cmd}
355 %__spec_clean_pre %{___build_pre}
356 %__spec_clean_body %{___build_body}
357 %__spec_clean_post %{___build_post}
358 %__spec_clean_template #!%{__spec_clean_shell}\
362 #%{__spec_clean_body}\
363 #%{__spec_clean_post}\
366 %__spec_rmbuild_shell %{___build_shell}
367 %__spec_rmbuild_args %{___build_args}
368 %__spec_rmbuild_cmd %{___build_cmd}
369 %__spec_rmbuild_pre %{___build_pre}
370 %__spec_rmbuild_body %{___build_body}
371 %__spec_rmbuild_post %{___build_post}
372 %__spec_rmbuild_template #!%{__spec_rmbuild_shell}\
373 %{__spec_rmbuild_pre}\
376 #%{__spec_rmbuild_body}\
377 #%{__spec_rmbuild_post}\
380 # XXX We don't expand pre/post install scriptlets (yet).
381 #%__spec_pre_pre %{nil}
382 #%__spec_pre_post %{nil}
383 #%__spec_post_pre %{nil}
384 #%__spec_post_post %{nil}
385 #%__spec_preun_pre %{nil}
386 #%__spec_preun_post %{nil}
387 #%__spec_postun_pre %{nil}
388 #%__spec_postun_post %{nil}
389 #%__spec_triggerpostun_pre %{nil}
390 #%__spec_triggerpostun_post %{nil}
391 #%__spec_triggerun_pre %{nil}
392 #%__spec_triggerun_post %{nil}
393 #%__spec_triggerin_pre %{nil}
394 #%__spec_triggerin_post %{nil}
396 #==============================================================================
397 # ---- configure macros.
398 # Macro(s) slavishly copied from autoconf's config.status.
401 %_exec_prefix %{_prefix}
402 %_bindir %{_exec_prefix}/bin
403 %_sbindir %{_exec_prefix}/sbin
404 %_libexecdir %{_exec_prefix}/libexec
405 %_datadir %{_prefix}/share
406 %_sysconfdir %{_prefix}/etc
407 %_sharedstatedir %{_prefix}/com
408 %_localstatedir %{_prefix}/var
410 %_libdir %{_exec_prefix}/%{_lib}
411 %_includedir %{_prefix}/include
412 %_oldincludedir /usr/include
413 %_infodir %{_prefix}/info
414 %_mandir %{_prefix}/man
416 #==============================================================================
417 # ---- config.guess platform macros.
418 # Macro(s) similar to the tokens used by configure.
421 %_build_alias %{_host_alias}
422 %_build_cpu %{_host_cpu}
423 %_build_vendor %{_host_vendor}
424 %_build_os %{_host_os}
426 %_host_alias @host_alias@
427 %_host_cpu @host_cpu@
428 %_host_vendor @host_vendor@
431 %_target_alias %{_host_alias}
432 %_target_cpu %{_host_cpu}
433 %_target_vendor %{_host_vendor}
434 %_target_os %{_host_os}
436 #==============================================================================
437 # ---- specfile macros.
438 # Macro(s) here can be used reliably for reproducible builds.
439 # (Note: Above is the goal, below are the macros under development)
441 # The configure macro does the following:
442 # optionally change to a subdirectory (not implemented).
443 # attempt to update config.guess and config.sub.
444 # run configure with correct prefix, platform, and CFLAGS.
445 # optionally restore current directory (not implemented).
446 # The configure macro should be invoked as %configure (rather than %{configure})
447 # because the rest of the arguments will be expanded using %*. Another
448 # gotcha is that arguments, if present, should be on the same line as the
452 %{?__libtoolize:[ -f configure.in ] && %{__libtoolize} --copy --force} \
453 CFLAGS="%{optflags}" ./configure %{_target_platform} --prefix=%{_prefix}
455 #------------------------------------------------------------------------------
456 # This is an improved version of %configure that may replace the above
457 # macro at some point (from PLD team).
459 #%configure { CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
460 # CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
461 # FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS ; \
462 # ./configure %{_target_platform} \
463 # --prefix=%{_prefix} \
464 # --exec-prefix=%{_exec_prefix} \
465 # --bindir=%{_bindir} \
466 # --sbindir=%{_sbindir} \
467 # --sysconfdir=%{_sysconfdir} \
468 # --datadir=%{_datadir} \
469 # --includedir=%{_includedir} \
470 # --libdir=%{_libdir} \
471 # --libexecdir=%{_libexecdir} \
472 # --localstatedir=%{_localstatedir} \
473 # --sharedstatedir=%{_sharedstatedir} \
474 # --mandir=%{_mandir} \
475 # --infodir=%{_infodir} }
477 #------------------------------------------------------------------------------
478 # The GNUconfigure macro does the following:
479 # update config.guess and config.sub.
480 # regenerate all autoconf/automake files
481 # optionally change to a directory (make the directory if requested).
482 # run configure with correct prefix, platform, and CFLAGS.
483 # optionally restore current directory.
485 # Based on autogen.sh from GNOME and orginal GNUconfigure
487 %GNUconfigure(MCs:) \
488 CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS; \
489 LDFLAGS="${LDFLAGS:-'%{-s:-s}'}" ; export LDFLAGS; \
490 %{-C:_mydir="`pwd`"; %{-M: %{__mkdir} -p %{-C*};} cd %{-C*}} \
491 dirs="`find ${_mydir} -name configure.in -print`"; export dirs; \
492 for coin in `echo ${dirs}` \
494 dr=`dirname ${coin}`; \
495 if test -f ${dr}/NO-AUTO-GEN; then \
498 macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < ${coin}`; \
500 aclocalinclude="${ACLOCAL_FLAGS}"; \
501 for k in ${macrodirs}; do \
502 if test -d ${k}; then \
503 aclocalinclude="${aclocalinclude} -I ${k}"; \
505 ## echo "**Warning**: No such directory \`${k}'. Ignored." \
508 if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then \
509 if grep "sed.*POTFILES" configure.in >/dev/null; then \
510 : do nothing -- we still have an old unmodified configure.in \
512 test -r ${dr}/aclocal.m4 || touch ${dr}/aclocal.m4; \
513 echo "no" | gettextize --force --copy; \
514 test -r ${dr}/aclocal.m4 && %{__chmod} u+w ${dr}/aclocal.m4; \
517 if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then \
518 %{__libtoolize} --force --copy; \
520 aclocal ${aclocalinclude}; \
521 if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then \
524 echo "Running automake --gnu ${am_opt} ..."; \
525 %{__automake} --add-missing --gnu ${am_opt}; \
530 %{-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} %* ; \
531 %{-C:cd ${_mydir}; unset _mydir}
533 #------------------------------------------------------------------------------
534 # Useful perl macros (from Artur Frysiak <wiget@t17.ds.pwr.wroc.pl>)
536 # For example, these can be used as (from ImageMagick.spec from PLD site)
541 # Summary: libraries and modules for access to ImageMagick from perl
542 # Group: Development/Languages/Perl
543 # Requires: %{name} = %{version}
547 # rm -fr $RPM_BUILD_ROOT
548 # install -d $RPM_BUILD_ROOT/%{perl_sitearch}
551 # %defattr(644,root,root,755)
552 # %{perl_sitearch}/Image
553 # %dir %{perl_sitearch}/auto/Image
555 %requires_eq() %(LC_ALL="C" rpm -q --queryformat 'Requires:%%{NAME} = %%{VERSION}' %1| grep -v "is not")
556 %perl_sitearch %(eval "`perl -V:installsitearch`"; echo $installsitearch)
557 %perl_archlib %(eval "`perl -V:installarchlib`"; echo $installarchlib)
559 #------------------------------------------------------------------------------
560 # arch macro for all Intel i?86 compatibile processors
561 # (Note: This macro (and it's analogues) will probably be obsoleted when
562 # rpm can use regular expressions against target platforms in macro
563 # conditionals. This change will be introduced after rpm-3.0.4).
565 %ix86 i386 i486 i586 i686 i786 i886 i986
567 #------------------------------------------------------------------------
568 # Use in %install to generate locale specific file lists. For example,
574 # %files -f %{name}.lang
576 %find_lang @RPMCONFIGDIR@/find-lang.sh %{buildroot}