1 # $Id: macros.in,v 1.50 2000/04/06 15:20:29 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 #==============================================================================
230 # ---- Scriptlet template templates.
231 # Global defaults used for building scriptlet templates.
233 # XXX legacy configuration, this will be eliminated after rpm-3.0.4.
234 %_preScriptEnvironment \
235 RPM_SOURCE_DIR=\"%{_sourcedir}\"\
236 RPM_BUILD_DIR=\"%{_builddir}\"\
237 RPM_OPT_FLAGS=\"%{optflags}\"\
238 RPM_ARCH=\"%{_arch}\"\
240 export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
241 RPM_DOC_DIR=\"%{_docdir}\"\
243 RPM_PACKAGE_NAME=\"%{name}\"\
244 RPM_PACKAGE_VERSION=\"%{version}\"\
245 RPM_PACKAGE_RELEASE=\"%{release}\"\
246 export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
247 %{?buildroot:RPM_BUILD_ROOT=\"%{buildroot}\"\
248 export RPM_BUILD_ROOT}
250 %___build_shell %{?_buildshell:%{_buildshell}}%{!?_buildshell:/bin/sh}
252 %___build_cmd %{?_sudo:%{_sudo} }%{?_remsh:%{_remsh} %{_remhost} }%{?_remsudo:%{_remsudo} }%{?_remchroot:%{_remchroot} %{_remroot} }%{___build_shell} %{___build_args}
254 RPM_SOURCE_DIR=\"%{u2p:%{_sourcedir}}\"\
255 RPM_BUILD_DIR=\"%{u2p:%{_builddir}}\"\
256 RPM_OPT_FLAGS=\"%{optflags}\"\
257 RPM_ARCH=\"%{_arch}\"\
259 export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
260 RPM_DOC_DIR=\"%{_docdir}\"\
262 RPM_PACKAGE_NAME=\"%{name}\"\
263 RPM_PACKAGE_VERSION=\"%{version}\"\
264 RPM_PACKAGE_RELEASE=\"%{release}\"\
265 export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
266 %{?buildroot:RPM_BUILD_ROOT=\"%{u2p:%{buildroot}}\"\
267 export RPM_BUILD_ROOT}\
269 %{verbose:set -x}%{!verbose:exec > /dev/null}\
271 cd %{u2p:%{_builddir}}\
274 #%___build_body %{nil}
275 %___build_post exit 0
277 %___build_template #!%{___build_shell}\
285 #==============================================================================
286 # ---- Scriptlet templates.
287 # Macro(s) that expand to a command and script that is executed.
288 # CAVEAT: All macro expansions must fit in a BUFSIZ (8192 byte) buffer.
290 %__spec_prep_shell %{___build_shell}
291 %__spec_prep_args %{___build_args}
292 %__spec_prep_cmd %{___build_cmd}
293 %__spec_prep_pre %{___build_pre}
294 %__spec_prep_body %{___build_body}
295 %__spec_prep_post %{___build_post}
296 %__spec_prep_template #!%{__spec_prep_shell}\
300 #%{__spec_prep_body}\
301 #%{__spec_prep_post}\
304 %__spec_build_shell %{___build_shell}
305 %__spec_build_args %{___build_args}
306 %__spec_build_cmd %{___build_cmd}
307 %__spec_build_pre %{___build_pre}
308 %__spec_build_body %{___build_body}
309 %__spec_build_post %{___build_post}
310 %__spec_build_template #!%{__spec_build_shell}\
314 #%{__spec_build_body}\
315 #%{__spec_build_post}\
318 %__spec_install_shell %{___build_shell}
319 %__spec_install_args %{___build_args}
320 %__spec_install_cmd %{___build_cmd}
321 %__spec_install_pre %{___build_pre}
322 %__spec_install_body %{___build_body}
323 %__spec_install_post %{___build_post}
324 %__spec_install_template #!%{__spec_install_shell}\
325 %{__spec_install_pre}\
328 #%{__spec_install_body}\
329 #%{__spec_install_post}\
332 #%__spec_autodep_shell %{___build_shell}
333 #%__spec_autodep_args %{___build_args}
334 #%__spec_autodep_cmd %{___build_cmd}
335 #%__spec_autodep_pre %{___build_pre}
336 #%__spec_autodep_body %{___build_body}
337 #%__spec_autodep_post %{___build_post}
338 #%__spec_autodep_template #!%{__spec_autodep_shell}\
339 #%{__spec_autodep_pre}\
342 #%{__spec_autodep_body}\
343 #%{__spec_autodep_post}\
346 %__spec_clean_shell %{___build_shell}
347 %__spec_clean_args %{___build_args}
348 %__spec_clean_cmd %{___build_cmd}
349 %__spec_clean_pre %{___build_pre}
350 %__spec_clean_body %{___build_body}
351 %__spec_clean_post %{___build_post}
352 %__spec_clean_template #!%{__spec_clean_shell}\
356 #%{__spec_clean_body}\
357 #%{__spec_clean_post}\
360 %__spec_rmbuild_shell %{___build_shell}
361 %__spec_rmbuild_args %{___build_args}
362 %__spec_rmbuild_cmd %{___build_cmd}
363 %__spec_rmbuild_pre %{___build_pre}
364 %__spec_rmbuild_body %{___build_body}
365 %__spec_rmbuild_post %{___build_post}
366 %__spec_rmbuild_template #!%{__spec_rmbuild_shell}\
367 %{__spec_rmbuild_pre}\
370 #%{__spec_rmbuild_body}\
371 #%{__spec_rmbuild_post}\
374 # XXX We don't expand pre/post install scriptlets (yet).
375 #%__spec_pre_pre %{nil}
376 #%__spec_pre_post %{nil}
377 #%__spec_post_pre %{nil}
378 #%__spec_post_post %{nil}
379 #%__spec_preun_pre %{nil}
380 #%__spec_preun_post %{nil}
381 #%__spec_postun_pre %{nil}
382 #%__spec_postun_post %{nil}
383 #%__spec_triggerpostun_pre %{nil}
384 #%__spec_triggerpostun_post %{nil}
385 #%__spec_triggerun_pre %{nil}
386 #%__spec_triggerun_post %{nil}
387 #%__spec_triggerin_pre %{nil}
388 #%__spec_triggerin_post %{nil}
390 #==============================================================================
391 # ---- configure macros.
392 # Macro(s) slavishly copied from autoconf's config.status.
395 %_exec_prefix %{_prefix}
396 %_bindir %{_exec_prefix}/bin
397 %_sbindir %{_exec_prefix}/sbin
398 %_libexecdir %{_exec_prefix}/libexec
399 %_datadir %{_prefix}/share
400 %_sysconfdir %{_prefix}/etc
401 %_sharedstatedir %{_prefix}/com
402 %_localstatedir %{_prefix}/var
403 %_libdir %{_exec_prefix}/lib
404 %_includedir %{_prefix}/include
405 %_oldincludedir /usr/include
406 %_infodir %{_prefix}/info
407 %_mandir %{_prefix}/man
409 #==============================================================================
410 # ---- config.guess platform macros.
411 # Macro(s) similar to the tokens used by configure.
414 %_build_alias %{_host_alias}
415 %_build_cpu %{_host_cpu}
416 %_build_vendor %{_host_vendor}
417 %_build_os %{_host_os}
419 %_host_alias @host_alias@
420 %_host_cpu @host_cpu@
421 %_host_vendor @host_vendor@
424 %_target_alias %{_host_alias}
425 %_target_cpu %{_host_cpu}
426 %_target_vendor %{_host_vendor}
427 %_target_os %{_host_os}
429 #==============================================================================
430 # ---- specfile macros.
431 # Macro(s) here can be used reliably for reproducible builds.
432 # (Note: Above is the goal, below are the macros under development)
434 # The configure macro does the following:
435 # optionally change to a subdirectory (not implemented).
436 # attempt to update config.guess and config.sub.
437 # run configure with correct prefix, platform, and CFLAGS.
438 # optionally restore current directory (not implemented).
439 # The configure macro should be invoked as %configure (rather than %{configure})
440 # because the rest of the arguments will be expanded using %*. Another
441 # gotcha is that arguments, if present, should be on the same line as the
445 %{?__libtoolize:[ -f configure.in ] && %{__libtoolize} --copy --force} \
446 CFLAGS="%{optflags}" ./configure %{_target_platform} --prefix=%{_prefix}
448 #------------------------------------------------------------------------------
449 # This is an improved version of %configure that may replace the above
450 # macro at some point (from PLD team).
452 #%configure { CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
453 # CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
454 # FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS ; \
455 # ./configure %{_target_platform} \
456 # --prefix=%{_prefix} \
457 # --exec-prefix=%{_exec_prefix} \
458 # --bindir=%{_bindir} \
459 # --sbindir=%{_sbindir} \
460 # --sysconfdir=%{_sysconfdir} \
461 # --datadir=%{_datadir} \
462 # --includedir=%{_includedir} \
463 # --libdir=%{_libdir} \
464 # --libexecdir=%{_libexecdir} \
465 # --localstatedir=%{_localstatedir} \
466 # --sharedstatedir=%{_sharedstatedir} \
467 # --mandir=%{_mandir} \
468 # --infodir=%{_infodir} }
470 #------------------------------------------------------------------------------
471 # The GNUconfigure macro does the following:
472 # update config.guess and config.sub.
473 # regenerate all autoconf/automake files
474 # optionally change to a directory (make the directory if requested).
475 # run configure with correct prefix, platform, and CFLAGS.
476 # optionally restore current directory.
478 # Based on autogen.sh from GNOME and orginal GNUconfigure
480 %GNUconfigure(MCs:) \
481 CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS; \
482 LDFLAGS="${LDFLAGS:-'%{-s:-s}'}" ; export LDFLAGS; \
483 %{-C:_mydir="`pwd`"; %{-M: %{__mkdir} -p %{-C*};} cd %{-C*}} \
484 dirs="`find ${_mydir} -name configure.in -print`"; export dirs; \
485 for coin in `echo ${dirs}` \
487 dr=`dirname ${coin}`; \
488 if test -f ${dr}/NO-AUTO-GEN; then \
491 macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < ${coin}`; \
493 aclocalinclude="${ACLOCAL_FLAGS}"; \
494 for k in ${macrodirs}; do \
495 if test -d ${k}; then \
496 aclocalinclude="${aclocalinclude} -I ${k}"; \
498 ## echo "**Warning**: No such directory \`${k}'. Ignored." \
501 if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then \
502 if grep "sed.*POTFILES" configure.in >/dev/null; then \
503 : do nothing -- we still have an old unmodified configure.in \
505 test -r ${dr}/aclocal.m4 || touch ${dr}/aclocal.m4; \
506 echo "no" | gettextize --force --copy; \
507 test -r ${dr}/aclocal.m4 && %{__chmod} u+w ${dr}/aclocal.m4; \
510 if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then \
511 %{__libtoolize} --force --copy; \
513 aclocal ${aclocalinclude}; \
514 if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then \
517 echo "Running automake --gnu ${am_opt} ..."; \
518 %{__automake} --add-missing --gnu ${am_opt}; \
523 %{-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} %* ; \
524 %{-C:cd ${_mydir}; unset _mydir}
526 #------------------------------------------------------------------------------
527 # Useful perl macros (from Artur Frysiak <wiget@t17.ds.pwr.wroc.pl>)
529 # For example, these can be used as (from ImageMagick.spec from PLD site)
534 # Summary: libraries and modules for access to ImageMagick from perl
535 # Group: Development/Languages/Perl
536 # Requires: %{name} = %{version}
540 # rm -fr $RPM_BUILD_ROOT
541 # install -d $RPM_BUILD_ROOT/%{perl_sitearch}
544 # %defattr(644,root,root,755)
545 # %{perl_sitearch}/Image
546 # %dir %{perl_sitearch}/auto/Image
548 %requires_eq() %(LC_ALL="C" rpm -q --queryformat 'Requires:%%{NAME} = %%{VERSION}' %1| grep -v "is not")
549 %perl_sitearch %(eval "`perl -V:installsitearch`"; echo $installsitearch)
550 %perl_archlib %(eval "`perl -V:installarchlib`"; echo $installarchlib)
552 #------------------------------------------------------------------------------
553 # arch macro for all Intel i?86 compatibile processors
554 # (Note: This macro (and it's analogues) will probably be obsoleted when
555 # rpm can use regular expressions against target platforms in macro
556 # conditionals. This change will be introduced after rpm-3.0.4).
558 %ix86 i386 i486 i586 i686 i786 i886 i986
560 #------------------------------------------------------------------------
561 # Use in %install to generate locale specific file lists. For example,
567 # %files -f %{name}.lang
569 %find_lang @RPMCONFIGDIR@/find-lang.sh %{buildroot}