1 # $Id: macros.in,v 1.30 1999/05/10 22:58: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 # ---- filesystem macros.
19 #==============================================================================
21 # XXX The use of which here is overly simple (read: dumb).
32 %__install %(which install)
37 %__ranlib %(which ranlib)
39 %__strip %(which strip)
42 # XXX avoid weird failures from which if tools are not installed
43 %__libtoolize libtoolize
45 %__autoheader autoheader
49 #==============================================================================
50 # ---- Required rpmrc macros.
51 # Macros that used to be initialized as a side effect of rpmrc parsing.
52 # These are the default values that can be overridden by other
53 # (e.g. per-platform, per-system, per-packager) macro files.
55 %_builddir %{_topdir}/BUILD
58 %_dbpath %{_var}/lib/rpm
59 %_defaultdocdir %{_usr}/doc
61 # XXX fixowner, fixgroup, and fixperms are run at the end of hardcoded setup
62 %_fixowner [ `%{__id} -u` = '0' ] && %{__chown} -Rf root
63 %_fixgroup [ `%{__id} -u` = '0' ] && %{__chgrp} -Rf @ROOT_GROUP@
64 %_fixperms %{__chmod} -Rf @FIXPERMS@
69 %_rpmdir %{_topdir}/RPMS
71 # XXX Note escaped %% for use in headerSprintf
72 %_rpmfilename %%{ARCH}/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
74 %_sourcedir %{_topdir}/SOURCES
75 %_specdir %{_topdir}/SPECS
76 %_srcrpmdir %{_topdir}/SRPMS
78 %_topdir %{_usrsrc}/redhat
80 #==============================================================================
81 # ---- Optional rpmrc macros.
82 # Macros that used to be initialized as a side effect of rpmrc and/or
83 # spec file parsing but were not set in the distributed configuration
84 # /usr/lib/rpm/rpmrc file.
104 #==============================================================================
105 # ---- per-platform macros.
106 # Macros that are specific to an individual platform. The values here
107 # will be used if the per-platform macro file does not exist..
109 %_arch @RPMCANONARCH@
110 %_vendor @RPMCANONVENDOR@
112 %_target_platform %{_target_cpu}-%{_vendor}-%{_target_os}
114 # XXX use the rpmrc instantiated macro for now
117 #==============================================================================
118 # ---- script environment macros.
119 # Macro(s) that establish the environment for running a script.
121 %_preScriptEnvironment \
122 RPM_SOURCE_DIR=\"%{_sourcedir}\"\
123 RPM_BUILD_DIR=\"%{_builddir}\"\
124 RPM_OPT_FLAGS=\"%{optflags}\"\
125 RPM_ARCH=\"%{_arch}\"\
127 export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
128 RPM_DOC_DIR=\"%{_docdir}\"\
130 RPM_PACKAGE_NAME=\"%{name}\"\
131 RPM_PACKAGE_VERSION=\"%{version}\"\
132 RPM_PACKAGE_RELEASE=\"%{release}\"\
133 export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
134 %{?buildroot:RPM_BUILD_ROOT=\"%{buildroot}\"\
135 export RPM_BUILD_ROOT\
138 #==============================================================================
139 # ---- configure macros.
140 # Macro(s) slavishly copied from config.status.
141 # CAVEAT: Only _prefix is currently used (read: supported). Please
142 # don't expect or rely on these macros keeping their current values
143 # (or even being defined) in future versions of rpm.
146 %_exec_prefix %{_prefix}
147 %_bindir %{_exec_prefix}/bin
148 %_sbindir %{_exec_prefix}/sbin
149 %_libexecdir %{_exec_prefix}/libexec
150 %_datadir %{_prefix}/share
151 %_sysconfdir %{_prefix}/etc
152 %_sharedstatedir %{_prefix}/com
153 %_localstatedir %{_prefix}/var
154 %_libdir %{_exec_prefix}/lib
155 %_includedir %{_prefix}/include
156 %_oldincludedir /usr/include
157 %_infodir %{_prefix}/include
158 %_mandir %{_prefix}/man
160 #==============================================================================
161 # ---- config.guess platform macros.
162 # Macro(s) similar to the tokens used by configure.
165 %_build_alias %{_host_alias}
166 %_build_cpu %{_host_cpu}
167 %_build_vendor %{_host_vendor}
168 %_build_os %{_host_os}
170 %_host_alias @host_alias@
171 %_host_cpu @host_cpu@
172 %_host_vendor @host_vendor@
175 %_target_alias %{_host_alias}
176 %_target_cpu %{_host_cpu}
177 %_target_vendor %{_host_vendor}
178 %_target_os %{_host_os}
180 #==============================================================================
181 # ---- specfile macros.
182 # Macro(s) here can be used reliably for reproducible builds.
183 # (Note: Above is the goal, below are the macros under development)
185 # The configure macro does the following:
186 # optionally change to a subdirectory (not implemented).
187 # attempt to update config.guess and config.sub.
188 # run configure with correct prefix, platform, and CFLAGS.
189 # optionally restore current directory (not implemented).
190 # The configure macro should be invoked as %configure (rather than %{configure})
191 # because the rest of the arguments will be expanded using %*. Another
192 # gotcha is that arguments, if present, should be on the same line as the
196 %{?__libtoolize:[ -f configure.in ] && %{__libtoolize} --copy --force} \
197 CFLAGS="%{optflags}" ./configure %{_target_platform} --prefix=%{_prefix}
199 #------------------------------------------------------------------------------
200 # The GNUconfigure macro does the following:
201 # update config.guess and config.sub.
202 # regenerate all autoconf/automake files
203 # optionally change to a directory (make the directory if requested).
204 # run configure with correct prefix, platform, and CFLAGS.
205 # optionally restore current directory.
208 %{__libtoolize} --copy --force \
213 %{-C:_mydir="`pwd`"; %{-M:%{__mkdir} -p %{-C*};} cd %{-C*};} \
214 CFLAGS="%{optflags}" %{-C:${_mydir}}%{!-C:.}/configure %{_target_platform} --prefix=%{_prefix} %* \
215 %{-C:cd ${_mydir}; unset _mydir}
217 #------------------------------------------------------------------------------
218 # Useful perl macros (from Artur Frysiak <wiget@t17.ds.pwr.wroc.pl>)
220 # For example, these can be used as (from ImageMagick.spec from PLD site)
225 # Summary: libraries and modules for access to ImageMagick from perl
226 # Group: Development/Languages/Perl
227 # Requires: %{name} = %{version}
231 # rm -fr $RPM_BUILD_ROOT
232 # install -d $RPM_BUILD_ROOT/%{perl_sitearch}
235 # %defattr(644,root,root,755)
236 # %{perl_sitearch}/Image
237 # %dir %{perl_sitearch}/auto/Image
239 %requires_eq() %(LC_ALL="C" rpm -q --queryformat 'Requires:%%{NAME} = %%{VERSION}' %1| grep -v "is not")
240 %perl_sitearch %(eval "`perl -V:installsitearch`"; echo $installsitearch)
241 %perl_archlib %(eval "`perl -V:installarchlib`"; echo $installarchlib)