add several BuildRoot FTW policies.
[tools/librpm-tizen.git] / macros.in
1 # $Id: macros.in,v 1.40 2000/01/07 17:32:28 jbj Exp $
2 #==============================================================================
3 # Macro naming conventions (preliminary):
4 #
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.
10 #
11
12 #==============================================================================
13 # ---- A macro that expands to nothing.
14 #
15 %nil    %{!?nil}
16
17 #==============================================================================
18 # ---- filesystem macros.
19 #
20 %_usr                   @prefix@
21 %_usrsrc                %{_usr}/src
22 %_var                   @varprefix@
23
24 #==============================================================================
25 # ---- Generally useful path macros.
26 #
27 %__awk                  @AWK@
28 %__bzip2                %{_bzip2bin}
29 %__cat                  @__CAT@
30 %__chgrp                @__CHGRP@
31 %__chmod                @__CHMOD@
32 %__chown                @__CHOWN@
33 %__cp                   @__CP@
34 %__cpio                 @__CPIO@
35 %__gzip                 %{_gzipbin}
36 %__id                   @__ID@
37 %__install              @__INSTALL@
38 %__ln_s                 @LN_S@
39 %__make                 @__MAKE@
40 %__mkdir                @__MKDIR@
41 %__mkdir_p              @MKDIR_P@
42 %__mv                   @__MV@
43 %__patch                @__PATCH@
44 %__pgp                  %{_pgpbin}
45 %__rm                   @__RM@
46 %__rsh                  @__RSH@
47 %__ssh                  @__SSH@
48 %__tar                  @__TAR@
49
50 #==============================================================================
51 # ---- Build system path macros.
52 #
53 %__ar                   @AR@
54 %__cc                   @CC@
55 %__cpp                  @CPP@
56 %__ld                   @__LD@
57 %__nm                   @__NM@
58 %__objcopy              @__OBJCOPY@
59 %__objdump              @__OBJDUMP@
60 %__ranlib               @RANLIB@
61 %__remsh                %{__rsh}
62 %__strip                @__STRIP@
63
64 # XXX avoid failures if tools are not installed when rpm is built.
65 %__libtoolize           libtoolize
66 %__aclocal              aclocal
67 %__autoheader           autoheader
68 %__automake             automake
69 %__autoconf             autoconf
70
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.
76 #
77 %_builddir              %{_topdir}/BUILD
78 %_buildshell            /bin/sh
79 %_bzip2bin              @BZIP2BIN@
80 %_dbpath                %{_var}/lib/rpm
81 %_defaultdocdir         %{_usr}/doc
82 #
83 %__find_provides        @FINDPROVIDES@
84 %__find_requires        @FINDREQUIRES@
85 #%__find_prereq         ???
86 #%__find_conflicts      ???
87 #%__find_obsoletes      ???
88 #
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@
93 #
94 %_gzipbin               @GZIPBIN@
95 %_instchangelog         5
96 %_pgpbin                @PGPBIN@
97 %_rpmdir                %{_topdir}/RPMS
98 #
99 # XXX Note escaped %% for use in headerSprintf
100 %_rpmfilename           %%{ARCH}/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
101 %_signature             none
102 %_sourcedir             %{_topdir}/SOURCES
103 %_specdir               %{_topdir}/SPECS
104 %_srcrpmdir             %{_topdir}/SRPMS
105 %_tmppath               %{_var}/tmp
106 %_topdir                %{_usrsrc}/redhat
107 #
108 #==============================================================================
109 # ---- Optional rpmrc macros.
110 #       Macros that are initialized as a side effect of rpmrc and/or spec
111 #       file parsing.
112 #
113 #%buildroot
114 #%buildsubdir
115 #%distribution
116 #%_excludedocs
117 #%_ftpport
118 #%_ftpproxy
119 #%_gpg_name
120 #%_gpg_path
121 #%_httpport
122 #%_httpproxy
123 #%_install_langs
124 #%_langpatt
125 #%_netsharedpath
126 #%packager
127 #%_pgp_name
128 #%_pgp_path
129 #%_provides
130 #%_timecheck
131 #%vendor
132
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..
137 #
138 %_arch                  @RPMCANONARCH@
139 %_vendor                @RPMCANONVENDOR@
140 %_os                    @RPMCANONOS@
141 %_target_platform       %{_target_cpu}-%{_vendor}-%{_target_os}
142 #
143 # XXX use the rpmrc instantiated macro for now
144 #%optflags              -O2
145
146 #==============================================================================
147 # ---- Scriptlet template templates.
148 #       Global defaults for building scriptlet templates.
149 #
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}\"\
156 RPM_OS=\"%{_os}\"\
157 export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
158 RPM_DOC_DIR=\"%{_docdir}\"\
159 export RPM_DOC_DIR\
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}
166
167 %___build_shell         %{?_buildshell:%{_buildshell}}%{!?_buildshell:/bin/sh}
168 %___build_args          -e
169 %___build_cmd           %{?_sudo:%{_sudo} }%{?_remsh:%{_remsh} %{_remhost} }%{?_remsudo:%{_remsudo} }%{?_remchroot:%{_remchroot} %{_remroot} }%{___build_shell} %{___build_args}
170 %___build_pre   \
171 RPM_SOURCE_DIR=\"%{u2p:%{_sourcedir}}\"\
172 RPM_BUILD_DIR=\"%{u2p:%{_builddir}}\"\
173 RPM_OPT_FLAGS=\"%{optflags}\"\
174 RPM_ARCH=\"%{_arch}\"\
175 RPM_OS=\"%{_os}\"\
176 export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
177 RPM_DOC_DIR=\"%{_docdir}\"\
178 export RPM_DOC_DIR\
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}\
185 \
186 %{verbose:set -x}%{!verbose:exec > /dev/null}\
187 umask 022\
188 cd %{u2p:%{_builddir}}\
189
190
191 #%___build_body         %{nil}
192 %___build_post          exit 0
193
194 %___build_template      #!%{___build_shell}\
195 %{___build_pre}\
196 %{nil}
197
198 #%{___build_body}\
199 #%{___build_post}\
200 #%{nil}
201
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.
206 #
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}\
214 %{__spec_prep_pre}\
215 %{nil}
216
217 #%{__spec_prep_body}\
218 #%{__spec_prep_post}\
219 #%{nil}
220
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}\
228 %{__spec_build_pre}\
229 %{nil}
230
231 #%{__spec_build_body}\
232 #%{__spec_build_post}\
233 #%{nil}
234
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}\
243 %{nil}
244
245 #%{__spec_install_body}\
246 #%{__spec_install_post}\
247 #%{nil}
248
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}\
257 #%{nil}
258
259 #%{__spec_autodep_body}\
260 #%{__spec_autodep_post}\
261 #%{nil}
262
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}\
270 %{__spec_clean_pre}\
271 %{nil}
272
273 #%{__spec_clean_body}\
274 #%{__spec_clean_post}\
275 #%{nil}
276
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}\
285 %{nil}
286
287 #%{__spec_rmbuild_body}\
288 #%{__spec_rmbuild_post}\
289 #%{nil}
290
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}
306
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.
313 #
314 %_prefix                @prefix@
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
328
329 #==============================================================================
330 # ---- config.guess platform macros.
331 #       Macro(s) similar to the tokens used by configure.
332 #
333 %_build                 %{_host}
334 %_build_alias           %{_host_alias}
335 %_build_cpu             %{_host_cpu}
336 %_build_vendor          %{_host_vendor}
337 %_build_os              %{_host_os}
338 %_host                  @host@
339 %_host_alias            @host_alias@
340 %_host_cpu              @host_cpu@
341 %_host_vendor           @host_vendor@
342 %_host_os               @host_os@
343 %_target                %{_host}
344 %_target_alias          %{_host_alias}
345 %_target_cpu            %{_host_cpu}
346 %_target_vendor         %{_host_vendor}
347 %_target_os             %{_host_os}
348
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)
353 #
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
362 # %configure.
363 #
364 %configure      \
365   %{?__libtoolize:[ -f configure.in ] && %{__libtoolize} --copy --force} \
366   CFLAGS="%{optflags}" ./configure %{_target_platform} --prefix=%{_prefix}
367
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.
375 #
376 %GNUconfigure(MC:)      \
377   %{__libtoolize} --copy --force \
378   %{__aclocal} \
379   %{__autoheader} \
380   %{__automake} \
381   %{__autoconf} \
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}
385
386 #------------------------------------------------------------------------------
387 # Useful perl macros (from Artur Frysiak <wiget@t17.ds.pwr.wroc.pl>)
388 #
389 # For example, these can be used as (from ImageMagick.spec from PLD site)
390 #       [...]
391 #       BuildPrereq: perl
392 #       [...]
393 #       %package perl
394 #       Summary: libraries and modules for access to ImageMagick from perl
395 #       Group: Development/Languages/Perl
396 #       Requires: %{name} = %{version}
397 #       %requires_eq    perl
398 #       [...]
399 #       %install
400 #       rm -fr $RPM_BUILD_ROOT
401 #       install -d $RPM_BUILD_ROOT/%{perl_sitearch}
402 #       [...]
403 #       %files perl
404 #       %defattr(644,root,root,755)
405 #       %{perl_sitearch}/Image
406 #       %dir %{perl_sitearch}/auto/Image
407 #
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)