1 # $Id: macros.in,v 1.41 2000/01/11 15:22: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.
37 %__install @__INSTALL@
50 #==============================================================================
51 # ---- Build system path macros.
58 %__objcopy @__OBJCOPY@
59 %__objdump @__OBJDUMP@
64 # XXX avoid failures if tools are not installed when rpm is built.
65 %__libtoolize libtoolize
67 %__autoheader autoheader
71 #==============================================================================
72 # ---- Required rpmrc macros.
73 # Macros that used to be initialized as a side effect of rpmrc parsing.
74 # These are the default values that can be overridden by other
75 # (e.g. per-platform, per-system, per-packager, per-package) macros.
77 %_builddir %{_topdir}/BUILD
80 %_dbpath %{_var}/lib/rpm
81 %_defaultdocdir %{_usr}/doc
83 %__find_provides @FINDPROVIDES@
84 %__find_requires @FINDREQUIRES@
86 #%__find_conflicts ???
87 #%__find_obsoletes ???
89 # XXX fixowner, fixgroup, and fixperms are run at the end of hardcoded setup
90 %_fixowner [ `%{__id} -u` = '0' ] && %{__chown} -Rhf root
91 %_fixgroup [ `%{__id} -u` = '0' ] && %{__chgrp} -Rhf @ROOT_GROUP@
92 %_fixperms %{__chmod} -Rf @FIXPERMS@
97 %_rpmdir %{_topdir}/RPMS
99 # XXX Note escaped %% for use in headerSprintf
100 %_rpmfilename %%{ARCH}/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
102 %_sourcedir %{_topdir}/SOURCES
103 %_specdir %{_topdir}/SPECS
104 %_srcrpmdir %{_topdir}/SRPMS
105 %_tmppath %{_var}/tmp
106 %_topdir %{_usrsrc}/redhat
108 #==============================================================================
109 # ---- Optional rpmrc macros.
110 # Macros that are initialized as a side effect of rpmrc and/or spec
113 # Configurable build root path, same as BuildRoot: in a specfile.
114 # (Note: the configured macro value will override the spec file value).
118 # The sub-directory (relative to %{_builddir}) where sources are compiled.
122 # Configurable distribution information, same as Distribution: in a
127 # Boolean (i.e. 1 == "yes", 0 == "no") that controls whether files
128 # marked as %doc should be installed.
131 # The port and machine name of a FTP proxy host running TIS firewall.
136 # The signature to use and the location of configuration files for
137 # signing packages with GNU gpg.
142 # The port and machine name of an HTTP proxy host.
147 # The PATH put into the environment before running %pre/%post et al.
149 %_install_script_path /sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin
151 # A colon separated list of desired locales to be installed;
152 # "all" means install all locale specific files.
160 # A colon separated list of paths where files should *not* be installed.
161 # Usually, these are network file system mount points.
165 # Configurable packager information, same as Packager: in a specfile.
169 # The signature to use and the location of configuration files for
170 # signing packages with PGP.
175 # Configurable virtual provides (unimplemented, use Provides: ...
184 # Configurable vendor information, same as Vendor: in a specfile.
188 #==============================================================================
189 # ---- per-platform macros.
190 # Macros that are specific to an individual platform. The values here
191 # will be used if the per-platform macro file does not exist..
193 %_arch @RPMCANONARCH@
194 %_vendor @RPMCANONVENDOR@
196 %_target_platform %{_target_cpu}-%{_vendor}-%{_target_os}
198 # XXX use the rpmrc instantiated macro for now
201 #==============================================================================
202 # ---- Scriptlet template templates.
203 # Global defaults used for building scriptlet templates.
205 # XXX legacy configuration, this will be eliminated after rpm-3.0.4.
206 %_preScriptEnvironment \
207 RPM_SOURCE_DIR=\"%{_sourcedir}\"\
208 RPM_BUILD_DIR=\"%{_builddir}\"\
209 RPM_OPT_FLAGS=\"%{optflags}\"\
210 RPM_ARCH=\"%{_arch}\"\
212 export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
213 RPM_DOC_DIR=\"%{_docdir}\"\
215 RPM_PACKAGE_NAME=\"%{name}\"\
216 RPM_PACKAGE_VERSION=\"%{version}\"\
217 RPM_PACKAGE_RELEASE=\"%{release}\"\
218 export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
219 %{?buildroot:RPM_BUILD_ROOT=\"%{buildroot}\"\
220 export RPM_BUILD_ROOT}
222 %___build_shell %{?_buildshell:%{_buildshell}}%{!?_buildshell:/bin/sh}
224 %___build_cmd %{?_sudo:%{_sudo} }%{?_remsh:%{_remsh} %{_remhost} }%{?_remsudo:%{_remsudo} }%{?_remchroot:%{_remchroot} %{_remroot} }%{___build_shell} %{___build_args}
226 RPM_SOURCE_DIR=\"%{u2p:%{_sourcedir}}\"\
227 RPM_BUILD_DIR=\"%{u2p:%{_builddir}}\"\
228 RPM_OPT_FLAGS=\"%{optflags}\"\
229 RPM_ARCH=\"%{_arch}\"\
231 export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
232 RPM_DOC_DIR=\"%{_docdir}\"\
234 RPM_PACKAGE_NAME=\"%{name}\"\
235 RPM_PACKAGE_VERSION=\"%{version}\"\
236 RPM_PACKAGE_RELEASE=\"%{release}\"\
237 export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
238 %{?buildroot:RPM_BUILD_ROOT=\"%{u2p:%{buildroot}}\"\
239 export RPM_BUILD_ROOT}\
241 %{verbose:set -x}%{!verbose:exec > /dev/null}\
243 cd %{u2p:%{_builddir}}\
246 #%___build_body %{nil}
247 %___build_post exit 0
249 %___build_template #!%{___build_shell}\
257 #==============================================================================
258 # ---- Scriptlet templates.
259 # Macro(s) that expand to a command and script that is executed.
260 # CAVEAT: All macro expansions must fit in a BUFSIZ (8192 byte) buffer.
262 %__spec_prep_shell %{___build_shell}
263 %__spec_prep_args %{___build_args}
264 %__spec_prep_cmd %{___build_cmd}
265 %__spec_prep_pre %{___build_pre}
266 %__spec_prep_body %{___build_body}
267 %__spec_prep_post %{___build_post}
268 %__spec_prep_template #!%{__spec_prep_shell}\
272 #%{__spec_prep_body}\
273 #%{__spec_prep_post}\
276 %__spec_build_shell %{___build_shell}
277 %__spec_build_args %{___build_args}
278 %__spec_build_cmd %{___build_cmd}
279 %__spec_build_pre %{___build_pre}
280 %__spec_build_body %{___build_body}
281 %__spec_build_post %{___build_post}
282 %__spec_build_template #!%{__spec_build_shell}\
286 #%{__spec_build_body}\
287 #%{__spec_build_post}\
290 %__spec_install_shell %{___build_shell}
291 %__spec_install_args %{___build_args}
292 %__spec_install_cmd %{___build_cmd}
293 %__spec_install_pre %{___build_pre}
294 %__spec_install_body %{___build_body}
295 %__spec_install_post %{___build_post}
296 %__spec_install_template #!%{__spec_install_shell}\
297 %{__spec_install_pre}\
300 #%{__spec_install_body}\
301 #%{__spec_install_post}\
304 #%__spec_autodep_shell %{___build_shell}
305 #%__spec_autodep_args %{___build_args}
306 #%__spec_autodep_cmd %{___build_cmd}
307 #%__spec_autodep_pre %{___build_pre}
308 #%__spec_autodep_body %{___build_body}
309 #%__spec_autodep_post %{___build_post}
310 #%__spec_autodep_template #!%{__spec_autodep_shell}\
311 #%{__spec_autodep_pre}\
314 #%{__spec_autodep_body}\
315 #%{__spec_autodep_post}\
318 %__spec_clean_shell %{___build_shell}
319 %__spec_clean_args %{___build_args}
320 %__spec_clean_cmd %{___build_cmd}
321 %__spec_clean_pre %{___build_pre}
322 %__spec_clean_body %{___build_body}
323 %__spec_clean_post %{___build_post}
324 %__spec_clean_template #!%{__spec_clean_shell}\
328 #%{__spec_clean_body}\
329 #%{__spec_clean_post}\
332 %__spec_rmbuild_shell %{___build_shell}
333 %__spec_rmbuild_args %{___build_args}
334 %__spec_rmbuild_cmd %{___build_cmd}
335 %__spec_rmbuild_pre %{___build_pre}
336 %__spec_rmbuild_body %{___build_body}
337 %__spec_rmbuild_post %{___build_post}
338 %__spec_rmbuild_template #!%{__spec_rmbuild_shell}\
339 %{__spec_rmbuild_pre}\
342 #%{__spec_rmbuild_body}\
343 #%{__spec_rmbuild_post}\
346 # XXX We don't expand pre/post install scriptlets (yet).
347 #%__spec_pre_pre %{nil}
348 #%__spec_pre_post %{nil}
349 #%__spec_post_pre %{nil}
350 #%__spec_post_post %{nil}
351 #%__spec_preun_pre %{nil}
352 #%__spec_preun_post %{nil}
353 #%__spec_postun_pre %{nil}
354 #%__spec_postun_post %{nil}
355 #%__spec_triggerpostun_pre %{nil}
356 #%__spec_triggerpostun_post %{nil}
357 #%__spec_triggerun_pre %{nil}
358 #%__spec_triggerun_post %{nil}
359 #%__spec_triggerin_pre %{nil}
360 #%__spec_triggerin_post %{nil}
362 #==============================================================================
363 # ---- configure macros.
364 # Macro(s) slavishly copied from autoconf's config.status.
367 %_exec_prefix %{_prefix}
368 %_bindir %{_exec_prefix}/bin
369 %_sbindir %{_exec_prefix}/sbin
370 %_libexecdir %{_exec_prefix}/libexec
371 %_datadir %{_prefix}/share
372 %_sysconfdir %{_prefix}/etc
373 %_sharedstatedir %{_prefix}/com
374 %_localstatedir %{_prefix}/var
375 %_libdir %{_exec_prefix}/lib
376 %_includedir %{_prefix}/include
377 %_oldincludedir /usr/include
378 %_infodir %{_prefix}/info
379 %_mandir %{_prefix}/man
381 #==============================================================================
382 # ---- config.guess platform macros.
383 # Macro(s) similar to the tokens used by configure.
386 %_build_alias %{_host_alias}
387 %_build_cpu %{_host_cpu}
388 %_build_vendor %{_host_vendor}
389 %_build_os %{_host_os}
391 %_host_alias @host_alias@
392 %_host_cpu @host_cpu@
393 %_host_vendor @host_vendor@
396 %_target_alias %{_host_alias}
397 %_target_cpu %{_host_cpu}
398 %_target_vendor %{_host_vendor}
399 %_target_os %{_host_os}
401 #==============================================================================
402 # ---- specfile macros.
403 # Macro(s) here can be used reliably for reproducible builds.
404 # (Note: Above is the goal, below are the macros under development)
406 # The configure macro does the following:
407 # optionally change to a subdirectory (not implemented).
408 # attempt to update config.guess and config.sub.
409 # run configure with correct prefix, platform, and CFLAGS.
410 # optionally restore current directory (not implemented).
411 # The configure macro should be invoked as %configure (rather than %{configure})
412 # because the rest of the arguments will be expanded using %*. Another
413 # gotcha is that arguments, if present, should be on the same line as the
417 %{?__libtoolize:[ -f configure.in ] && %{__libtoolize} --copy --force} \
418 CFLAGS="%{optflags}" ./configure %{_target_platform} --prefix=%{_prefix}
420 #------------------------------------------------------------------------------
421 # The GNUconfigure macro does the following:
422 # update config.guess and config.sub.
423 # regenerate all autoconf/automake files
424 # optionally change to a directory (make the directory if requested).
425 # run configure with correct prefix, platform, and CFLAGS.
426 # optionally restore current directory.
429 %{__libtoolize} --copy --force \
434 %{-C:_mydir="`pwd`"; %{-M:%{__mkdir} -p %{-C*};} cd %{-C*};} \
435 CFLAGS="%{optflags}" %{-C:${_mydir}}%{!-C:.}/configure %{_target_platform} --prefix=%{_prefix} %* \
436 %{-C:cd ${_mydir}; unset _mydir}
438 #------------------------------------------------------------------------------
439 # Useful perl macros (from Artur Frysiak <wiget@t17.ds.pwr.wroc.pl>)
441 # For example, these can be used as (from ImageMagick.spec from PLD site)
446 # Summary: libraries and modules for access to ImageMagick from perl
447 # Group: Development/Languages/Perl
448 # Requires: %{name} = %{version}
452 # rm -fr $RPM_BUILD_ROOT
453 # install -d $RPM_BUILD_ROOT/%{perl_sitearch}
456 # %defattr(644,root,root,755)
457 # %{perl_sitearch}/Image
458 # %dir %{perl_sitearch}/auto/Image
460 %requires_eq() %(LC_ALL="C" rpm -q --queryformat 'Requires:%%{NAME} = %%{VERSION}' %1| grep -v "is not")
461 %perl_sitearch %(eval "`perl -V:installsitearch`"; echo $installsitearch)
462 %perl_archlib %(eval "`perl -V:installarchlib`"; echo $installarchlib)