1 # $Id: macros.in,v 1.40 2000/01/07 17:32:28 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) macro files.
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
133 #==============================================================================
134 # ---- per-platform macros.
135 # Macros that are specific to an individual platform. The values here
136 # will be used if the per-platform macro file does not exist..
138 %_arch @RPMCANONARCH@
139 %_vendor @RPMCANONVENDOR@
141 %_target_platform %{_target_cpu}-%{_vendor}-%{_target_os}
143 # XXX use the rpmrc instantiated macro for now
146 #==============================================================================
147 # ---- Scriptlet template templates.
148 # Global defaults for building scriptlet templates.
150 # XXX legacy configuration.
151 %_preScriptEnvironment \
152 RPM_SOURCE_DIR=\"%{_sourcedir}\"\
153 RPM_BUILD_DIR=\"%{_builddir}\"\
154 RPM_OPT_FLAGS=\"%{optflags}\"\
155 RPM_ARCH=\"%{_arch}\"\
157 export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
158 RPM_DOC_DIR=\"%{_docdir}\"\
160 RPM_PACKAGE_NAME=\"%{name}\"\
161 RPM_PACKAGE_VERSION=\"%{version}\"\
162 RPM_PACKAGE_RELEASE=\"%{release}\"\
163 export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
164 %{?buildroot:RPM_BUILD_ROOT=\"%{buildroot}\"\
165 export RPM_BUILD_ROOT}
167 %___build_shell %{?_buildshell:%{_buildshell}}%{!?_buildshell:/bin/sh}
169 %___build_cmd %{?_sudo:%{_sudo} }%{?_remsh:%{_remsh} %{_remhost} }%{?_remsudo:%{_remsudo} }%{?_remchroot:%{_remchroot} %{_remroot} }%{___build_shell} %{___build_args}
171 RPM_SOURCE_DIR=\"%{u2p:%{_sourcedir}}\"\
172 RPM_BUILD_DIR=\"%{u2p:%{_builddir}}\"\
173 RPM_OPT_FLAGS=\"%{optflags}\"\
174 RPM_ARCH=\"%{_arch}\"\
176 export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
177 RPM_DOC_DIR=\"%{_docdir}\"\
179 RPM_PACKAGE_NAME=\"%{name}\"\
180 RPM_PACKAGE_VERSION=\"%{version}\"\
181 RPM_PACKAGE_RELEASE=\"%{release}\"\
182 export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
183 %{?buildroot:RPM_BUILD_ROOT=\"%{u2p:%{buildroot}}\"\
184 export RPM_BUILD_ROOT}\
186 %{verbose:set -x}%{!verbose:exec > /dev/null}\
188 cd %{u2p:%{_builddir}}\
191 #%___build_body %{nil}
192 %___build_post exit 0
194 %___build_template #!%{___build_shell}\
202 #==============================================================================
203 # ---- Scriptlet templates.
204 # Macro(s) that expand to a command and script that is executed.
205 # CAVEAT: All macro expansions must fit in a BUFSIZ (8192 byte) buffer.
207 %__spec_prep_shell %{___build_shell}
208 %__spec_prep_args %{___build_args}
209 %__spec_prep_cmd %{___build_cmd}
210 %__spec_prep_pre %{___build_pre}
211 %__spec_prep_body %{___build_body}
212 %__spec_prep_post %{___build_post}
213 %__spec_prep_template #!%{__spec_prep_shell}\
217 #%{__spec_prep_body}\
218 #%{__spec_prep_post}\
221 %__spec_build_shell %{___build_shell}
222 %__spec_build_args %{___build_args}
223 %__spec_build_cmd %{___build_cmd}
224 %__spec_build_pre %{___build_pre}
225 %__spec_build_body %{___build_body}
226 %__spec_build_post %{___build_post}
227 %__spec_build_template #!%{__spec_build_shell}\
231 #%{__spec_build_body}\
232 #%{__spec_build_post}\
235 %__spec_install_shell %{___build_shell}
236 %__spec_install_args %{___build_args}
237 %__spec_install_cmd %{___build_cmd}
238 %__spec_install_pre %{___build_pre}
239 %__spec_install_body %{___build_body}
240 %__spec_install_post %{___build_post}
241 %__spec_install_template #!%{__spec_install_shell}\
242 %{__spec_install_pre}\
245 #%{__spec_install_body}\
246 #%{__spec_install_post}\
249 #%__spec_autodep_shell %{___build_shell}
250 #%__spec_autodep_args %{___build_args}
251 #%__spec_autodep_cmd %{___build_cmd}
252 #%__spec_autodep_pre %{___build_pre}
253 #%__spec_autodep_body %{___build_body}
254 #%__spec_autodep_post %{___build_post}
255 #%__spec_autodep_template #!%{__spec_autodep_shell}\
256 #%{__spec_autodep_pre}\
259 #%{__spec_autodep_body}\
260 #%{__spec_autodep_post}\
263 %__spec_clean_shell %{___build_shell}
264 %__spec_clean_args %{___build_args}
265 %__spec_clean_cmd %{___build_cmd}
266 %__spec_clean_pre %{___build_pre}
267 %__spec_clean_body %{___build_body}
268 %__spec_clean_post %{___build_post}
269 %__spec_clean_template #!%{__spec_clean_shell}\
273 #%{__spec_clean_body}\
274 #%{__spec_clean_post}\
277 %__spec_rmbuild_shell %{___build_shell}
278 %__spec_rmbuild_args %{___build_args}
279 %__spec_rmbuild_cmd %{___build_cmd}
280 %__spec_rmbuild_pre %{___build_pre}
281 %__spec_rmbuild_body %{___build_body}
282 %__spec_rmbuild_post %{___build_post}
283 %__spec_rmbuild_template #!%{__spec_rmbuild_shell}\
284 %{__spec_rmbuild_pre}\
287 #%{__spec_rmbuild_body}\
288 #%{__spec_rmbuild_post}\
291 # XXX We don't expand pre/post install scriptlets (yet).
292 #%__spec_pre_pre %{nil}
293 #%__spec_pre_post %{nil}
294 #%__spec_post_pre %{nil}
295 #%__spec_post_post %{nil}
296 #%__spec_preun_pre %{nil}
297 #%__spec_preun_post %{nil}
298 #%__spec_postun_pre %{nil}
299 #%__spec_postun_post %{nil}
300 #%__spec_triggerpostun_pre %{nil}
301 #%__spec_triggerpostun_post %{nil}
302 #%__spec_triggerun_pre %{nil}
303 #%__spec_triggerun_post %{nil}
304 #%__spec_triggerin_pre %{nil}
305 #%__spec_triggerin_post %{nil}
307 #==============================================================================
308 # ---- configure macros.
309 # Macro(s) slavishly copied from config.status.
310 # CAVEAT: Only _prefix is currently used (read: supported). Please
311 # don't expect or rely on these macros keeping their current values
312 # (or even being defined) in future versions of rpm.
315 %_exec_prefix %{_prefix}
316 %_bindir %{_exec_prefix}/bin
317 %_sbindir %{_exec_prefix}/sbin
318 %_libexecdir %{_exec_prefix}/libexec
319 %_datadir %{_prefix}/share
320 %_sysconfdir %{_prefix}/etc
321 %_sharedstatedir %{_prefix}/com
322 %_localstatedir %{_prefix}/var
323 %_libdir %{_exec_prefix}/lib
324 %_includedir %{_prefix}/include
325 %_oldincludedir /usr/include
326 %_infodir %{_prefix}/info
327 %_mandir %{_prefix}/man
329 #==============================================================================
330 # ---- config.guess platform macros.
331 # Macro(s) similar to the tokens used by configure.
334 %_build_alias %{_host_alias}
335 %_build_cpu %{_host_cpu}
336 %_build_vendor %{_host_vendor}
337 %_build_os %{_host_os}
339 %_host_alias @host_alias@
340 %_host_cpu @host_cpu@
341 %_host_vendor @host_vendor@
344 %_target_alias %{_host_alias}
345 %_target_cpu %{_host_cpu}
346 %_target_vendor %{_host_vendor}
347 %_target_os %{_host_os}
349 #==============================================================================
350 # ---- specfile macros.
351 # Macro(s) here can be used reliably for reproducible builds.
352 # (Note: Above is the goal, below are the macros under development)
354 # The configure macro does the following:
355 # optionally change to a subdirectory (not implemented).
356 # attempt to update config.guess and config.sub.
357 # run configure with correct prefix, platform, and CFLAGS.
358 # optionally restore current directory (not implemented).
359 # The configure macro should be invoked as %configure (rather than %{configure})
360 # because the rest of the arguments will be expanded using %*. Another
361 # gotcha is that arguments, if present, should be on the same line as the
365 %{?__libtoolize:[ -f configure.in ] && %{__libtoolize} --copy --force} \
366 CFLAGS="%{optflags}" ./configure %{_target_platform} --prefix=%{_prefix}
368 #------------------------------------------------------------------------------
369 # The GNUconfigure macro does the following:
370 # update config.guess and config.sub.
371 # regenerate all autoconf/automake files
372 # optionally change to a directory (make the directory if requested).
373 # run configure with correct prefix, platform, and CFLAGS.
374 # optionally restore current directory.
377 %{__libtoolize} --copy --force \
382 %{-C:_mydir="`pwd`"; %{-M:%{__mkdir} -p %{-C*};} cd %{-C*};} \
383 CFLAGS="%{optflags}" %{-C:${_mydir}}%{!-C:.}/configure %{_target_platform} --prefix=%{_prefix} %* \
384 %{-C:cd ${_mydir}; unset _mydir}
386 #------------------------------------------------------------------------------
387 # Useful perl macros (from Artur Frysiak <wiget@t17.ds.pwr.wroc.pl>)
389 # For example, these can be used as (from ImageMagick.spec from PLD site)
394 # Summary: libraries and modules for access to ImageMagick from perl
395 # Group: Development/Languages/Perl
396 # Requires: %{name} = %{version}
400 # rm -fr $RPM_BUILD_ROOT
401 # install -d $RPM_BUILD_ROOT/%{perl_sitearch}
404 # %defattr(644,root,root,755)
405 # %{perl_sitearch}/Image
406 # %dir %{perl_sitearch}/auto/Image
408 %requires_eq() %(LC_ALL="C" rpm -q --queryformat 'Requires:%%{NAME} = %%{VERSION}' %1| grep -v "is not")
409 %perl_sitearch %(eval "`perl -V:installsitearch`"; echo $installsitearch)
410 %perl_archlib %(eval "`perl -V:installarchlib`"; echo $installarchlib)