1 # $Id: macros.in,v 1.34 1999/08/18 16:29:53 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 #==============================================================================
26 # XXX The use of which here is overly simple (read: dumb).
37 %__install %(which install)
42 %__ranlib %(which ranlib)
44 %__strip %(which strip)
47 # XXX avoid weird failures from which if tools are not installed
48 %__libtoolize libtoolize
50 %__autoheader autoheader
54 #==============================================================================
55 # ---- Required rpmrc macros.
56 # Macros that used to be initialized as a side effect of rpmrc parsing.
57 # These are the default values that can be overridden by other
58 # (e.g. per-platform, per-system, per-packager) macro files.
60 %_builddir %{_topdir}/BUILD
63 %_dbpath %{_var}/lib/rpm
64 %_defaultdocdir %{_usr}/doc
66 %__find_provides @FINDPROVIDES@
67 %__find_requires @FINDREQUIRES@
69 #%__find_conflicts ???
70 #%__find_obsoletes ???
72 # XXX fixowner, fixgroup, and fixperms are run at the end of hardcoded setup
73 %_fixowner [ `%{__id} -u` = '0' ] && %{__chown} -Rhf root
74 %_fixgroup [ `%{__id} -u` = '0' ] && %{__chgrp} -Rhf @ROOT_GROUP@
75 %_fixperms %{__chmod} -Rf @FIXPERMS@
80 %_rpmdir %{_topdir}/RPMS
82 # XXX Note escaped %% for use in headerSprintf
83 %_rpmfilename %%{ARCH}/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
85 %_sourcedir %{_topdir}/SOURCES
86 %_specdir %{_topdir}/SPECS
87 %_srcrpmdir %{_topdir}/SRPMS
89 %_topdir %{_usrsrc}/redhat
91 #==============================================================================
92 # ---- Optional rpmrc macros.
93 # Macros that used to be initialized as a side effect of rpmrc and/or
94 # spec file parsing but were not set in the distributed configuration
95 # /usr/lib/rpm/rpmrc file.
115 #==============================================================================
116 # ---- per-platform macros.
117 # Macros that are specific to an individual platform. The values here
118 # will be used if the per-platform macro file does not exist..
120 %_arch @RPMCANONARCH@
121 %_vendor @RPMCANONVENDOR@
123 %_target_platform %{_target_cpu}-%{_vendor}-%{_target_os}
125 # XXX use the rpmrc instantiated macro for now
128 #==============================================================================
129 # ---- script environment macros.
130 # Macro(s) that establish the environment for running a script.
132 %_preScriptEnvironment \
133 RPM_SOURCE_DIR=\"%{_sourcedir}\"\
134 RPM_BUILD_DIR=\"%{_builddir}\"\
135 RPM_OPT_FLAGS=\"%{optflags}\"\
136 RPM_ARCH=\"%{_arch}\"\
138 export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
139 RPM_DOC_DIR=\"%{_docdir}\"\
141 RPM_PACKAGE_NAME=\"%{name}\"\
142 RPM_PACKAGE_VERSION=\"%{version}\"\
143 RPM_PACKAGE_RELEASE=\"%{release}\"\
144 export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
145 %{?buildroot:RPM_BUILD_ROOT=\"%{buildroot}\"\
146 export RPM_BUILD_ROOT\
149 #==============================================================================
150 # ---- configure macros.
151 # Macro(s) slavishly copied from config.status.
152 # CAVEAT: Only _prefix is currently used (read: supported). Please
153 # don't expect or rely on these macros keeping their current values
154 # (or even being defined) in future versions of rpm.
157 %_exec_prefix %{_prefix}
158 %_bindir %{_exec_prefix}/bin
159 %_sbindir %{_exec_prefix}/sbin
160 %_libexecdir %{_exec_prefix}/libexec
161 %_datadir %{_prefix}/share
162 %_sysconfdir %{_prefix}/etc
163 %_sharedstatedir %{_prefix}/com
164 %_localstatedir %{_prefix}/var
165 %_libdir %{_exec_prefix}/lib
166 %_includedir %{_prefix}/include
167 %_oldincludedir /usr/include
168 %_infodir %{_prefix}/info
169 %_mandir %{_prefix}/man
171 #==============================================================================
172 # ---- config.guess platform macros.
173 # Macro(s) similar to the tokens used by configure.
176 %_build_alias %{_host_alias}
177 %_build_cpu %{_host_cpu}
178 %_build_vendor %{_host_vendor}
179 %_build_os %{_host_os}
181 %_host_alias @host_alias@
182 %_host_cpu @host_cpu@
183 %_host_vendor @host_vendor@
186 %_target_alias %{_host_alias}
187 %_target_cpu %{_host_cpu}
188 %_target_vendor %{_host_vendor}
189 %_target_os %{_host_os}
191 #==============================================================================
192 # ---- specfile macros.
193 # Macro(s) here can be used reliably for reproducible builds.
194 # (Note: Above is the goal, below are the macros under development)
196 # The configure macro does the following:
197 # optionally change to a subdirectory (not implemented).
198 # attempt to update config.guess and config.sub.
199 # run configure with correct prefix, platform, and CFLAGS.
200 # optionally restore current directory (not implemented).
201 # The configure macro should be invoked as %configure (rather than %{configure})
202 # because the rest of the arguments will be expanded using %*. Another
203 # gotcha is that arguments, if present, should be on the same line as the
207 %{?__libtoolize:[ -f configure.in ] && %{__libtoolize} --copy --force} \
208 CFLAGS="%{optflags}" ./configure %{_target_platform} --prefix=%{_prefix}
210 #------------------------------------------------------------------------------
211 # The GNUconfigure macro does the following:
212 # update config.guess and config.sub.
213 # regenerate all autoconf/automake files
214 # optionally change to a directory (make the directory if requested).
215 # run configure with correct prefix, platform, and CFLAGS.
216 # optionally restore current directory.
219 %{__libtoolize} --copy --force \
224 %{-C:_mydir="`pwd`"; %{-M:%{__mkdir} -p %{-C*};} cd %{-C*};} \
225 CFLAGS="%{optflags}" %{-C:${_mydir}}%{!-C:.}/configure %{_target_platform} --prefix=%{_prefix} %* \
226 %{-C:cd ${_mydir}; unset _mydir}
228 #------------------------------------------------------------------------------
229 # Useful perl macros (from Artur Frysiak <wiget@t17.ds.pwr.wroc.pl>)
231 # For example, these can be used as (from ImageMagick.spec from PLD site)
236 # Summary: libraries and modules for access to ImageMagick from perl
237 # Group: Development/Languages/Perl
238 # Requires: %{name} = %{version}
242 # rm -fr $RPM_BUILD_ROOT
243 # install -d $RPM_BUILD_ROOT/%{perl_sitearch}
246 # %defattr(644,root,root,755)
247 # %{perl_sitearch}/Image
248 # %dir %{perl_sitearch}/auto/Image
250 %requires_eq() %(LC_ALL="C" rpm -q --queryformat 'Requires:%%{NAME} = %%{VERSION}' %1| grep -v "is not")
251 %perl_sitearch %(eval "`perl -V:installsitearch`"; echo $installsitearch)
252 %perl_archlib %(eval "`perl -V:installarchlib`"; echo $installarchlib)