configurable PATH for install %pre/%post et al scriptlets.
[tools/librpm-tizen.git] / macros.in
1 # $Id: macros.in,v 1.41 2000/01/11 15:22:35 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, per-package) macros.
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 #       Configurable build root path, same as BuildRoot: in a specfile.
114 #       (Note: the configured macro value will override the spec file value).
115 #
116 #%buildroot
117
118 #       The sub-directory (relative to %{_builddir}) where sources are compiled.
119 #
120 #%buildsubdir
121
122 #       Configurable distribution information, same as Distribution: in a
123 #       specfile.
124 #
125 #%distribution
126
127 #       Boolean (i.e. 1 == "yes", 0 == "no") that controls whether files
128 #       marked as %doc should be installed.
129 #%_excludedocs
130
131 #       The port and machine name of a FTP proxy host running TIS firewall.
132 #
133 #%_ftpport
134 #%_ftpproxy
135
136 #       The signature to use and the location of configuration files for
137 #       signing packages with GNU gpg.
138 #
139 #%_gpg_name
140 #%_gpg_path
141
142 #       The port and machine name of an HTTP proxy host.
143 #
144 #%_httpport
145 #%_httpproxy
146
147 #       The PATH put into the environment before running %pre/%post et al.
148 #
149 %_install_script_path   /sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin
150
151 #       A colon separated list of desired locales to be installed;
152 #       "all" means install all locale specific files.
153 #       
154 #%_install_langs
155
156 #
157 #       Deprecated.
158 #%_langpatt
159
160 #       A colon separated list of paths where files should *not* be installed.
161 #       Usually, these are network file system mount points.
162 #
163 #%_netsharedpath
164
165 #       Configurable packager information, same as Packager: in a specfile.
166 #
167 #%packager
168
169 #       The signature to use and the location of configuration files for
170 #       signing packages with PGP.
171 #
172 #%_pgp_name
173 #%_pgp_path
174
175 #       Configurable virtual provides (unimplemented, use Provides: ...
176 #       in an rpmrc file).
177 #
178 #%_provides
179
180 #       Deprecated.
181 #
182 #%_timecheck
183
184 #       Configurable vendor information, same as Vendor: in a specfile.
185 #
186 #%vendor
187
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..
192 #
193 %_arch                  @RPMCANONARCH@
194 %_vendor                @RPMCANONVENDOR@
195 %_os                    @RPMCANONOS@
196 %_target_platform       %{_target_cpu}-%{_vendor}-%{_target_os}
197 #
198 # XXX use the rpmrc instantiated macro for now
199 #%optflags              -O2
200
201 #==============================================================================
202 # ---- Scriptlet template templates.
203 #       Global defaults used for building scriptlet templates.
204 #
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}\"\
211 RPM_OS=\"%{_os}\"\
212 export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
213 RPM_DOC_DIR=\"%{_docdir}\"\
214 export RPM_DOC_DIR\
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}
221
222 %___build_shell         %{?_buildshell:%{_buildshell}}%{!?_buildshell:/bin/sh}
223 %___build_args          -e
224 %___build_cmd           %{?_sudo:%{_sudo} }%{?_remsh:%{_remsh} %{_remhost} }%{?_remsudo:%{_remsudo} }%{?_remchroot:%{_remchroot} %{_remroot} }%{___build_shell} %{___build_args}
225 %___build_pre   \
226 RPM_SOURCE_DIR=\"%{u2p:%{_sourcedir}}\"\
227 RPM_BUILD_DIR=\"%{u2p:%{_builddir}}\"\
228 RPM_OPT_FLAGS=\"%{optflags}\"\
229 RPM_ARCH=\"%{_arch}\"\
230 RPM_OS=\"%{_os}\"\
231 export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
232 RPM_DOC_DIR=\"%{_docdir}\"\
233 export RPM_DOC_DIR\
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}\
240 \
241 %{verbose:set -x}%{!verbose:exec > /dev/null}\
242 umask 022\
243 cd %{u2p:%{_builddir}}\
244
245
246 #%___build_body         %{nil}
247 %___build_post          exit 0
248
249 %___build_template      #!%{___build_shell}\
250 %{___build_pre}\
251 %{nil}
252
253 #%{___build_body}\
254 #%{___build_post}\
255 #%{nil}
256
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.
261 #
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}\
269 %{__spec_prep_pre}\
270 %{nil}
271
272 #%{__spec_prep_body}\
273 #%{__spec_prep_post}\
274 #%{nil}
275
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}\
283 %{__spec_build_pre}\
284 %{nil}
285
286 #%{__spec_build_body}\
287 #%{__spec_build_post}\
288 #%{nil}
289
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}\
298 %{nil}
299
300 #%{__spec_install_body}\
301 #%{__spec_install_post}\
302 #%{nil}
303
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}\
312 #%{nil}
313
314 #%{__spec_autodep_body}\
315 #%{__spec_autodep_post}\
316 #%{nil}
317
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}\
325 %{__spec_clean_pre}\
326 %{nil}
327
328 #%{__spec_clean_body}\
329 #%{__spec_clean_post}\
330 #%{nil}
331
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}\
340 %{nil}
341
342 #%{__spec_rmbuild_body}\
343 #%{__spec_rmbuild_post}\
344 #%{nil}
345
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}
361
362 #==============================================================================
363 # ---- configure macros.
364 #       Macro(s) slavishly copied from autoconf's config.status.
365 #
366 %_prefix                @prefix@
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
380
381 #==============================================================================
382 # ---- config.guess platform macros.
383 #       Macro(s) similar to the tokens used by configure.
384 #
385 %_build                 %{_host}
386 %_build_alias           %{_host_alias}
387 %_build_cpu             %{_host_cpu}
388 %_build_vendor          %{_host_vendor}
389 %_build_os              %{_host_os}
390 %_host                  @host@
391 %_host_alias            @host_alias@
392 %_host_cpu              @host_cpu@
393 %_host_vendor           @host_vendor@
394 %_host_os               @host_os@
395 %_target                %{_host}
396 %_target_alias          %{_host_alias}
397 %_target_cpu            %{_host_cpu}
398 %_target_vendor         %{_host_vendor}
399 %_target_os             %{_host_os}
400
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)
405 #
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
414 # %configure.
415 #
416 %configure      \
417   %{?__libtoolize:[ -f configure.in ] && %{__libtoolize} --copy --force} \
418   CFLAGS="%{optflags}" ./configure %{_target_platform} --prefix=%{_prefix}
419
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.
427 #
428 %GNUconfigure(MC:)      \
429   %{__libtoolize} --copy --force \
430   %{__aclocal} \
431   %{__autoheader} \
432   %{__automake} \
433   %{__autoconf} \
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}
437
438 #------------------------------------------------------------------------------
439 # Useful perl macros (from Artur Frysiak <wiget@t17.ds.pwr.wroc.pl>)
440 #
441 # For example, these can be used as (from ImageMagick.spec from PLD site)
442 #       [...]
443 #       BuildPrereq: perl
444 #       [...]
445 #       %package perl
446 #       Summary: libraries and modules for access to ImageMagick from perl
447 #       Group: Development/Languages/Perl
448 #       Requires: %{name} = %{version}
449 #       %requires_eq    perl
450 #       [...]
451 #       %install
452 #       rm -fr $RPM_BUILD_ROOT
453 #       install -d $RPM_BUILD_ROOT/%{perl_sitearch}
454 #       [...]
455 #       %files perl
456 #       %defattr(644,root,root,755)
457 #       %{perl_sitearch}/Image
458 #       %dir %{perl_sitearch}/auto/Image
459 #
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)