ff82e8436664e7a1e1bb1ae1c208b0f3a627e284
[tools/librpm-tizen.git] / macros.in
1 # $Id: macros.in,v 1.50 2000/04/06 15:20:29 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 %__grep                 @__GREP@
36 %__gzip                 %{_gzipbin}
37 %__id                   @__ID@
38 %__install              @__INSTALL@
39 %__ln_s                 @LN_S@
40 %__make                 @__MAKE@
41 %__mkdir                @__MKDIR@
42 %__mkdir_p              @MKDIR_P@
43 %__mv                   @__MV@
44 %__patch                @__PATCH@
45 %__perl                 @__PERL@
46 %__pgp                  %{_pgpbin}
47 %__rm                   @__RM@
48 %__rsh                  @__RSH@
49 %__sed                  @__SED@
50 %__ssh                  @__SSH@
51 %__tar                  @__TAR@
52
53 #==============================================================================
54 # ---- Build system path macros.
55 #
56 %__ar                   @AR@
57 %__cc                   @CC@
58 %__cpp                  @CPP@
59 %__ld                   @__LD@
60 %__nm                   @__NM@
61 %__objcopy              @__OBJCOPY@
62 %__objdump              @__OBJDUMP@
63 %__ranlib               @RANLIB@
64 %__remsh                %{__rsh}
65 %__strip                @__STRIP@
66
67 # XXX avoid failures if tools are not installed when rpm is built.
68 %__libtoolize           libtoolize
69 %__aclocal              aclocal
70 %__autoheader           autoheader
71 %__automake             automake
72 %__autoconf             autoconf
73
74 #==============================================================================
75 # ---- Required rpmrc macros.
76 #       Macros that used to be initialized as a side effect of rpmrc parsing.
77 #       These are the default values that can be overridden by other
78 #       (e.g. per-platform, per-system, per-packager, per-package) macros.
79 #
80 %_builddir              %{_topdir}/BUILD
81 %_buildshell            /bin/sh
82 %_bzip2bin              @BZIP2BIN@
83 %_dbpath                %{_var}/lib/rpm
84 %_rebuilddbpath         %{_dbpath}
85 %_defaultdocdir         %{_usr}/doc
86 #
87 %__find_provides        @FINDPROVIDES@
88 %__find_requires        @FINDREQUIRES@
89 #%__find_prereq         ???
90 #%__find_conflicts      ???
91 #%__find_obsoletes      ???
92 #
93 # XXX fixowner, fixgroup, and fixperms are run at the end of hardcoded setup
94 %__id_u                 @__ID_U@
95 %__chown_Rhf            @__CHOWN_RHF@
96 %__chgrp_Rhf            @__CHGRP_RHF@
97 %_fixowner              [ `%{__id_u}` = '0' ] && %{__chown_Rhf} root
98 %_fixgroup              [ `%{__id_u}` = '0' ] && %{__chgrp_Rhf} @ROOT_GROUP@
99 %_fixperms              %{__chmod} -Rf @FIXPERMS@
100 #
101 %_gzipbin               @GZIPBIN@
102 %_instchangelog         5
103 %_pgpbin                @PGPBIN@
104 %_rpmdir                %{_topdir}/RPMS
105 #
106 # XXX Note escaped %% for use in headerSprintf
107 %_rpmfilename           %%{ARCH}/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
108 %_signature             none
109 %_sourcedir             %{_topdir}/SOURCES
110 %_specdir               %{_topdir}/SPECS
111 %_srcrpmdir             %{_topdir}/SRPMS
112 %_tmppath               %{_var}/tmp
113 %_topdir                %{_usrsrc}/redhat
114
115 #==============================================================================
116 # ---- Optional rpmrc macros.
117 #       Macros that are initialized as a side effect of rpmrc and/or spec
118 #       file parsing.
119 #
120 #       Configurable build root path, same as BuildRoot: in a specfile.
121 #       (Note: the configured macro value will override the spec file value).
122 #
123 #%buildroot
124
125 #       The sub-directory (relative to %{_builddir}) where sources are compiled.
126 #       This macro is set after processing %setup, either explicitly from the
127 #       value given to -n or the default name-version.
128 #
129 #%buildsubdir
130
131 #       Configurable distribution information, same as Distribution: in a
132 #       specfile.
133 #
134 #%distribution
135
136 #       Boolean (i.e. 1 == "yes", 0 == "no") that controls whether files
137 #       marked as %doc should be installed.
138 #%_excludedocs
139
140 #       The port and machine name of a FTP proxy host running TIS firewall.
141 #
142 #%_ftpport
143 #%_ftpproxy
144
145 #       The signature to use and the location of configuration files for
146 #       signing packages with GNU gpg.
147 #
148 #%_gpg_name
149 #%_gpg_path
150
151 #       The port and machine name of an HTTP proxy host.
152 #
153 #%_httpport
154 #%_httpproxy
155
156 #       The PATH put into the environment before running %pre/%post et al.
157 #
158 %_install_script_path   /sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin
159
160 #       A colon separated list of desired locales to be installed;
161 #       "all" means install all locale specific files.
162 #       
163 %_install_langs all
164
165 #
166 #       Deprecated.
167 #%_langpatt
168
169 #       A colon separated list of paths where files should *not* be installed.
170 #       Usually, these are network file system mount points.
171 #
172 #%_netsharedpath
173
174 #       Configurable packager information, same as Packager: in a specfile.
175 #
176 #%packager
177
178 #       Compression type and level for package payloads.
179 #               "w9.gzdio"      gzip level 9 (default).
180 #               "w9.bzdio"      bzip2 level 9 (experimental, at your own risk).
181 #
182 #%_payload_compression  w9.gzdio
183
184 #       The signature to use and the location of configuration files for
185 #       signing packages with PGP.
186 #
187 #%_pgp_name
188 #%_pgp_path
189
190 #       Configurable virtual provides (unimplemented, use Provides: ...
191 #       in an rpmrc file).
192 #
193 #%_provides
194
195 #       Deprecated.
196 #
197 #%_timecheck
198
199 #       Configurable vendor information, same as Vendor: in a specfile.
200 #
201 #%vendor
202
203 # Preferred db interface:
204 #       0       linux glibc libdb1 routines.
205 #       1       db_185.h interface in db2/db3 libdb.a.
206 #       2       native db2 interface.
207 #       3       native db3 interface.
208 %_preferdb              3
209 %_db3_flags             create:mpool
210 %_db3_dbenv_remove      yes
211 %_db3_use_falloc        no
212
213 # Filter duplicate entries in db (needed only to correct bug pre rpm-3.0.4)
214 %_filterdbdups          no
215
216 #==============================================================================
217 # ---- per-platform macros.
218 #       Macros that are specific to an individual platform. The values here
219 #       will be used if the per-platform macro file does not exist..
220 #
221 %_arch                  @RPMCANONARCH@
222 %_vendor                @RPMCANONVENDOR@
223 %_os                    @RPMCANONOS@
224 %_target_platform       %{_target_cpu}-%{_vendor}-%{_target_os}
225 #
226 # XXX use the rpmrc instantiated macro for now
227 #%optflags              -O2
228
229 #==============================================================================
230 # ---- Scriptlet template templates.
231 #       Global defaults used for building scriptlet templates.
232 #
233 # XXX legacy configuration, this will be eliminated after rpm-3.0.4.
234 %_preScriptEnvironment  \
235 RPM_SOURCE_DIR=\"%{_sourcedir}\"\
236 RPM_BUILD_DIR=\"%{_builddir}\"\
237 RPM_OPT_FLAGS=\"%{optflags}\"\
238 RPM_ARCH=\"%{_arch}\"\
239 RPM_OS=\"%{_os}\"\
240 export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
241 RPM_DOC_DIR=\"%{_docdir}\"\
242 export RPM_DOC_DIR\
243 RPM_PACKAGE_NAME=\"%{name}\"\
244 RPM_PACKAGE_VERSION=\"%{version}\"\
245 RPM_PACKAGE_RELEASE=\"%{release}\"\
246 export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
247 %{?buildroot:RPM_BUILD_ROOT=\"%{buildroot}\"\
248 export RPM_BUILD_ROOT}
249
250 %___build_shell         %{?_buildshell:%{_buildshell}}%{!?_buildshell:/bin/sh}
251 %___build_args          -e
252 %___build_cmd           %{?_sudo:%{_sudo} }%{?_remsh:%{_remsh} %{_remhost} }%{?_remsudo:%{_remsudo} }%{?_remchroot:%{_remchroot} %{_remroot} }%{___build_shell} %{___build_args}
253 %___build_pre   \
254 RPM_SOURCE_DIR=\"%{u2p:%{_sourcedir}}\"\
255 RPM_BUILD_DIR=\"%{u2p:%{_builddir}}\"\
256 RPM_OPT_FLAGS=\"%{optflags}\"\
257 RPM_ARCH=\"%{_arch}\"\
258 RPM_OS=\"%{_os}\"\
259 export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
260 RPM_DOC_DIR=\"%{_docdir}\"\
261 export RPM_DOC_DIR\
262 RPM_PACKAGE_NAME=\"%{name}\"\
263 RPM_PACKAGE_VERSION=\"%{version}\"\
264 RPM_PACKAGE_RELEASE=\"%{release}\"\
265 export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
266 %{?buildroot:RPM_BUILD_ROOT=\"%{u2p:%{buildroot}}\"\
267 export RPM_BUILD_ROOT}\
268 \
269 %{verbose:set -x}%{!verbose:exec > /dev/null}\
270 umask 022\
271 cd %{u2p:%{_builddir}}\
272
273
274 #%___build_body         %{nil}
275 %___build_post          exit 0
276
277 %___build_template      #!%{___build_shell}\
278 %{___build_pre}\
279 %{nil}
280
281 #%{___build_body}\
282 #%{___build_post}\
283 #%{nil}
284
285 #==============================================================================
286 # ---- Scriptlet templates.
287 #       Macro(s) that expand to a command and script that is executed.
288 #       CAVEAT: All macro expansions must fit in a BUFSIZ (8192 byte) buffer.
289 #
290 %__spec_prep_shell      %{___build_shell}
291 %__spec_prep_args       %{___build_args}
292 %__spec_prep_cmd        %{___build_cmd}
293 %__spec_prep_pre        %{___build_pre}
294 %__spec_prep_body       %{___build_body}
295 %__spec_prep_post       %{___build_post}
296 %__spec_prep_template   #!%{__spec_prep_shell}\
297 %{__spec_prep_pre}\
298 %{nil}
299
300 #%{__spec_prep_body}\
301 #%{__spec_prep_post}\
302 #%{nil}
303
304 %__spec_build_shell     %{___build_shell}
305 %__spec_build_args      %{___build_args}
306 %__spec_build_cmd       %{___build_cmd}
307 %__spec_build_pre       %{___build_pre}
308 %__spec_build_body      %{___build_body}
309 %__spec_build_post      %{___build_post}
310 %__spec_build_template  #!%{__spec_build_shell}\
311 %{__spec_build_pre}\
312 %{nil}
313
314 #%{__spec_build_body}\
315 #%{__spec_build_post}\
316 #%{nil}
317
318 %__spec_install_shell   %{___build_shell}
319 %__spec_install_args    %{___build_args}
320 %__spec_install_cmd     %{___build_cmd}
321 %__spec_install_pre     %{___build_pre}
322 %__spec_install_body    %{___build_body}
323 %__spec_install_post    %{___build_post}
324 %__spec_install_template        #!%{__spec_install_shell}\
325 %{__spec_install_pre}\
326 %{nil}
327
328 #%{__spec_install_body}\
329 #%{__spec_install_post}\
330 #%{nil}
331
332 #%__spec_autodep_shell  %{___build_shell}
333 #%__spec_autodep_args   %{___build_args}
334 #%__spec_autodep_cmd    %{___build_cmd}
335 #%__spec_autodep_pre    %{___build_pre}
336 #%__spec_autodep_body   %{___build_body}
337 #%__spec_autodep_post   %{___build_post}
338 #%__spec_autodep_template       #!%{__spec_autodep_shell}\
339 #%{__spec_autodep_pre}\
340 #%{nil}
341
342 #%{__spec_autodep_body}\
343 #%{__spec_autodep_post}\
344 #%{nil}
345
346 %__spec_clean_shell     %{___build_shell}
347 %__spec_clean_args      %{___build_args}
348 %__spec_clean_cmd       %{___build_cmd}
349 %__spec_clean_pre       %{___build_pre}
350 %__spec_clean_body      %{___build_body}
351 %__spec_clean_post      %{___build_post}
352 %__spec_clean_template  #!%{__spec_clean_shell}\
353 %{__spec_clean_pre}\
354 %{nil}
355
356 #%{__spec_clean_body}\
357 #%{__spec_clean_post}\
358 #%{nil}
359
360 %__spec_rmbuild_shell   %{___build_shell}
361 %__spec_rmbuild_args    %{___build_args}
362 %__spec_rmbuild_cmd     %{___build_cmd}
363 %__spec_rmbuild_pre     %{___build_pre}
364 %__spec_rmbuild_body    %{___build_body}
365 %__spec_rmbuild_post    %{___build_post}
366 %__spec_rmbuild_template        #!%{__spec_rmbuild_shell}\
367 %{__spec_rmbuild_pre}\
368 %{nil}
369
370 #%{__spec_rmbuild_body}\
371 #%{__spec_rmbuild_post}\
372 #%{nil}
373
374 # XXX We don't expand pre/post install scriptlets (yet).
375 #%__spec_pre_pre                %{nil}
376 #%__spec_pre_post               %{nil}
377 #%__spec_post_pre               %{nil}
378 #%__spec_post_post              %{nil}
379 #%__spec_preun_pre              %{nil}
380 #%__spec_preun_post             %{nil}
381 #%__spec_postun_pre             %{nil}
382 #%__spec_postun_post            %{nil}
383 #%__spec_triggerpostun_pre      %{nil}
384 #%__spec_triggerpostun_post     %{nil}
385 #%__spec_triggerun_pre          %{nil}
386 #%__spec_triggerun_post         %{nil}
387 #%__spec_triggerin_pre          %{nil}
388 #%__spec_triggerin_post         %{nil}
389
390 #==============================================================================
391 # ---- configure macros.
392 #       Macro(s) slavishly copied from autoconf's config.status.
393 #
394 %_prefix                @prefix@
395 %_exec_prefix           %{_prefix}
396 %_bindir                %{_exec_prefix}/bin
397 %_sbindir               %{_exec_prefix}/sbin
398 %_libexecdir            %{_exec_prefix}/libexec
399 %_datadir               %{_prefix}/share
400 %_sysconfdir            %{_prefix}/etc
401 %_sharedstatedir        %{_prefix}/com
402 %_localstatedir         %{_prefix}/var
403 %_libdir                %{_exec_prefix}/lib
404 %_includedir            %{_prefix}/include
405 %_oldincludedir         /usr/include
406 %_infodir               %{_prefix}/info
407 %_mandir                %{_prefix}/man
408
409 #==============================================================================
410 # ---- config.guess platform macros.
411 #       Macro(s) similar to the tokens used by configure.
412 #
413 %_build                 %{_host}
414 %_build_alias           %{_host_alias}
415 %_build_cpu             %{_host_cpu}
416 %_build_vendor          %{_host_vendor}
417 %_build_os              %{_host_os}
418 %_host                  @host@
419 %_host_alias            @host_alias@
420 %_host_cpu              @host_cpu@
421 %_host_vendor           @host_vendor@
422 %_host_os               @host_os@
423 %_target                %{_host}
424 %_target_alias          %{_host_alias}
425 %_target_cpu            %{_host_cpu}
426 %_target_vendor         %{_host_vendor}
427 %_target_os             %{_host_os}
428
429 #==============================================================================
430 # ---- specfile macros.
431 #       Macro(s) here can be used reliably for reproducible builds.
432 #       (Note: Above is the goal, below are the macros under development)
433 #
434 # The configure macro does the following:
435 #       optionally change to a subdirectory (not implemented).
436 #       attempt to update config.guess and config.sub.
437 #       run configure with correct prefix, platform, and CFLAGS.
438 #       optionally restore current directory (not implemented).
439 # The configure macro should be invoked as %configure (rather than %{configure})
440 # because the rest of the arguments will be expanded using %*. Another
441 # gotcha is that arguments, if present, should be on the same line as the
442 # %configure.
443 #
444 %configure      \
445   %{?__libtoolize:[ -f configure.in ] && %{__libtoolize} --copy --force} \
446   CFLAGS="%{optflags}" ./configure %{_target_platform} --prefix=%{_prefix}
447
448 #------------------------------------------------------------------------------
449 # This is an improved version of %configure that may replace the above
450 # macro at some point (from PLD team).
451 #
452 #%configure { CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
453 # CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
454 # FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS ; \
455 # ./configure %{_target_platform} \
456 #       --prefix=%{_prefix} \
457 #       --exec-prefix=%{_exec_prefix} \
458 #       --bindir=%{_bindir} \
459 #       --sbindir=%{_sbindir} \
460 #       --sysconfdir=%{_sysconfdir} \
461 #       --datadir=%{_datadir} \
462 #       --includedir=%{_includedir} \
463 #       --libdir=%{_libdir} \
464 #       --libexecdir=%{_libexecdir} \
465 #       --localstatedir=%{_localstatedir} \
466 #       --sharedstatedir=%{_sharedstatedir} \
467 #       --mandir=%{_mandir} \
468 #       --infodir=%{_infodir} }
469
470 #------------------------------------------------------------------------------
471 # The GNUconfigure macro does the following:
472 #       update config.guess and config.sub.
473 #       regenerate all autoconf/automake files
474 #       optionally change to a directory (make the directory if requested).
475 #       run configure with correct prefix, platform, and CFLAGS.
476 #       optionally restore current directory.
477 #
478 # Based on autogen.sh from GNOME and orginal GNUconfigure
479 #
480 %GNUconfigure(MCs:)      \
481   CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS; \
482   LDFLAGS="${LDFLAGS:-'%{-s:-s}'}"  ; export LDFLAGS; \
483   %{-C:_mydir="`pwd`"; %{-M: %{__mkdir} -p %{-C*};} cd %{-C*}} \
484   dirs="`find ${_mydir} -name configure.in -print`"; export dirs; \
485     for coin in `echo ${dirs}` \
486 do \
487   dr=`dirname ${coin}`; \
488 if test -f ${dr}/NO-AUTO-GEN; then \
489  : \
490 else \
491      macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < ${coin}`; \
492     ( cd ${dr}; \
493       aclocalinclude="${ACLOCAL_FLAGS}"; \
494       for k in ${macrodirs}; do \
495         if test -d ${k}; then \
496           aclocalinclude="${aclocalinclude} -I ${k}"; \
497         ##else \
498         ##  echo "**Warning**: No such directory \`${k}'.  Ignored." \
499         fi \
500       done \
501       if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then \
502         if grep "sed.*POTFILES" configure.in >/dev/null; then \
503           : do nothing -- we still have an old unmodified configure.in \
504         else \
505           test -r ${dr}/aclocal.m4 || touch ${dr}/aclocal.m4; \
506           echo "no" | gettextize --force --copy; \
507           test -r ${dr}/aclocal.m4 && %{__chmod} u+w ${dr}/aclocal.m4; \
508         fi \
509       fi \
510       if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then \
511         %{__libtoolize} --force --copy; \
512       fi \
513       aclocal ${aclocalinclude}; \
514       if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then \
515         %{__autoheader}; \
516       fi \
517       echo "Running automake --gnu ${am_opt} ..."; \
518       %{__automake} --add-missing --gnu ${am_opt}; \
519       %{__autoconf}; \
520     ); \
521   fi \
522 done \
523   %{-C:${_mydir}}%{!-C:.}/configure %{_target_platform} --prefix=%{_prefix} --exec-prefix=%{_exec_prefix} --bindir=%{_bindir} --sbindir=%{_sbindir} --sysconfdir=%{_sysconfdir} --datadir=%{_datadir} --includedir=%{_includedir} --libdir=%{_libdir} --libexecdir=%{_libexecdir} --localstatedir=%{_localstatedir} --sharedstatedir=%{_sharedstatedir} --mandir=%{_mandir} --infodir=%{_infodir} %* ; \
524   %{-C:cd ${_mydir}; unset _mydir}
525
526 #------------------------------------------------------------------------------
527 # Useful perl macros (from Artur Frysiak <wiget@t17.ds.pwr.wroc.pl>)
528 #
529 # For example, these can be used as (from ImageMagick.spec from PLD site)
530 #       [...]
531 #       BuildPrereq: perl
532 #       [...]
533 #       %package perl
534 #       Summary: libraries and modules for access to ImageMagick from perl
535 #       Group: Development/Languages/Perl
536 #       Requires: %{name} = %{version}
537 #       %requires_eq    perl
538 #       [...]
539 #       %install
540 #       rm -fr $RPM_BUILD_ROOT
541 #       install -d $RPM_BUILD_ROOT/%{perl_sitearch}
542 #       [...]
543 #       %files perl
544 #       %defattr(644,root,root,755)
545 #       %{perl_sitearch}/Image
546 #       %dir %{perl_sitearch}/auto/Image
547 #
548 %requires_eq()  %(LC_ALL="C" rpm -q --queryformat 'Requires:%%{NAME} = %%{VERSION}' %1| grep -v "is not")
549 %perl_sitearch  %(eval "`perl -V:installsitearch`"; echo $installsitearch)
550 %perl_archlib   %(eval "`perl -V:installarchlib`"; echo $installarchlib)
551
552 #------------------------------------------------------------------------------
553 # arch macro for all Intel i?86 compatibile processors
554 #  (Note: This macro (and it's analogues) will probably be obsoleted when
555 #   rpm can use regular expressions against target platforms in macro
556 #   conditionals. This change will be introduced after rpm-3.0.4).
557 #
558 %ix86   i386 i486 i586 i686 i786 i886 i986
559
560 #------------------------------------------------------------------------
561 # Use in %install to generate locale specific file lists. For example,
562 #
563 # %install
564 # ...
565 # %find_lang %{name}
566 # ...
567 # %files -f %{name}.lang
568 #
569 %find_lang      @RPMCONFIGDIR@/find-lang.sh %{buildroot}
570