Hi!
[tools/librpm-tizen.git] / macros.in
1 # $Id: macros.in,v 1.51 2000/04/19 16:03:49 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 %__arch_install_post    %{nil}
230 %__os_install_post      %{___build_post}
231
232 #==============================================================================
233 # ---- Scriptlet template templates.
234 #       Global defaults used for building scriptlet templates.
235 #
236 # XXX legacy configuration, this will be eliminated after rpm-3.0.4.
237 %_preScriptEnvironment  \
238 RPM_SOURCE_DIR=\"%{_sourcedir}\"\
239 RPM_BUILD_DIR=\"%{_builddir}\"\
240 RPM_OPT_FLAGS=\"%{optflags}\"\
241 RPM_ARCH=\"%{_arch}\"\
242 RPM_OS=\"%{_os}\"\
243 export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
244 RPM_DOC_DIR=\"%{_docdir}\"\
245 export RPM_DOC_DIR\
246 RPM_PACKAGE_NAME=\"%{name}\"\
247 RPM_PACKAGE_VERSION=\"%{version}\"\
248 RPM_PACKAGE_RELEASE=\"%{release}\"\
249 export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
250 %{?buildroot:RPM_BUILD_ROOT=\"%{buildroot}\"\
251 export RPM_BUILD_ROOT}
252
253 %___build_shell         %{?_buildshell:%{_buildshell}}%{!?_buildshell:/bin/sh}
254 %___build_args          -e
255 %___build_cmd           %{?_sudo:%{_sudo} }%{?_remsh:%{_remsh} %{_remhost} }%{?_remsudo:%{_remsudo} }%{?_remchroot:%{_remchroot} %{_remroot} }%{___build_shell} %{___build_args}
256 %___build_pre   \
257 RPM_SOURCE_DIR=\"%{u2p:%{_sourcedir}}\"\
258 RPM_BUILD_DIR=\"%{u2p:%{_builddir}}\"\
259 RPM_OPT_FLAGS=\"%{optflags}\"\
260 RPM_ARCH=\"%{_arch}\"\
261 RPM_OS=\"%{_os}\"\
262 export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
263 RPM_DOC_DIR=\"%{_docdir}\"\
264 export RPM_DOC_DIR\
265 RPM_PACKAGE_NAME=\"%{name}\"\
266 RPM_PACKAGE_VERSION=\"%{version}\"\
267 RPM_PACKAGE_RELEASE=\"%{release}\"\
268 export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
269 %{?buildroot:RPM_BUILD_ROOT=\"%{u2p:%{buildroot}}\"\
270 export RPM_BUILD_ROOT}\
271 \
272 %{verbose:set -x}%{!verbose:exec > /dev/null}\
273 umask 022\
274 cd %{u2p:%{_builddir}}\
275
276
277 #%___build_body         %{nil}
278 %___build_post          exit 0
279
280 %___build_template      #!%{___build_shell}\
281 %{___build_pre}\
282 %{nil}
283
284 #%{___build_body}\
285 #%{___build_post}\
286 #%{nil}
287
288 #==============================================================================
289 # ---- Scriptlet templates.
290 #       Macro(s) that expand to a command and script that is executed.
291 #       CAVEAT: All macro expansions must fit in a BUFSIZ (8192 byte) buffer.
292 #
293 %__spec_prep_shell      %{___build_shell}
294 %__spec_prep_args       %{___build_args}
295 %__spec_prep_cmd        %{___build_cmd}
296 %__spec_prep_pre        %{___build_pre}
297 %__spec_prep_body       %{___build_body}
298 %__spec_prep_post       %{___build_post}
299 %__spec_prep_template   #!%{__spec_prep_shell}\
300 %{__spec_prep_pre}\
301 %{nil}
302
303 #%{__spec_prep_body}\
304 #%{__spec_prep_post}\
305 #%{nil}
306
307 %__spec_build_shell     %{___build_shell}
308 %__spec_build_args      %{___build_args}
309 %__spec_build_cmd       %{___build_cmd}
310 %__spec_build_pre       %{___build_pre}
311 %__spec_build_body      %{___build_body}
312 %__spec_build_post      %{___build_post}
313 %__spec_build_template  #!%{__spec_build_shell}\
314 %{__spec_build_pre}\
315 %{nil}
316
317 #%{__spec_build_body}\
318 #%{__spec_build_post}\
319 #%{nil}
320
321 %__spec_install_shell   %{___build_shell}
322 %__spec_install_args    %{___build_args}
323 %__spec_install_cmd     %{___build_cmd}
324 %__spec_install_pre     %{___build_pre}
325 %__spec_install_body    %{___build_body}
326 %__spec_install_post\
327 %{__arch_install_post}\
328 %{__os_install_post}\
329 %{nil}
330 %__spec_install_template        #!%{__spec_install_shell}\
331 %{__spec_install_pre}\
332 %{nil}
333
334 #%{__spec_install_body}\
335 #%{__spec_install_post}\
336 #%{nil}
337
338 #%__spec_autodep_shell  %{___build_shell}
339 #%__spec_autodep_args   %{___build_args}
340 #%__spec_autodep_cmd    %{___build_cmd}
341 #%__spec_autodep_pre    %{___build_pre}
342 #%__spec_autodep_body   %{___build_body}
343 #%__spec_autodep_post   %{___build_post}
344 #%__spec_autodep_template       #!%{__spec_autodep_shell}\
345 #%{__spec_autodep_pre}\
346 #%{nil}
347
348 #%{__spec_autodep_body}\
349 #%{__spec_autodep_post}\
350 #%{nil}
351
352 %__spec_clean_shell     %{___build_shell}
353 %__spec_clean_args      %{___build_args}
354 %__spec_clean_cmd       %{___build_cmd}
355 %__spec_clean_pre       %{___build_pre}
356 %__spec_clean_body      %{___build_body}
357 %__spec_clean_post      %{___build_post}
358 %__spec_clean_template  #!%{__spec_clean_shell}\
359 %{__spec_clean_pre}\
360 %{nil}
361
362 #%{__spec_clean_body}\
363 #%{__spec_clean_post}\
364 #%{nil}
365
366 %__spec_rmbuild_shell   %{___build_shell}
367 %__spec_rmbuild_args    %{___build_args}
368 %__spec_rmbuild_cmd     %{___build_cmd}
369 %__spec_rmbuild_pre     %{___build_pre}
370 %__spec_rmbuild_body    %{___build_body}
371 %__spec_rmbuild_post    %{___build_post}
372 %__spec_rmbuild_template        #!%{__spec_rmbuild_shell}\
373 %{__spec_rmbuild_pre}\
374 %{nil}
375
376 #%{__spec_rmbuild_body}\
377 #%{__spec_rmbuild_post}\
378 #%{nil}
379
380 # XXX We don't expand pre/post install scriptlets (yet).
381 #%__spec_pre_pre                %{nil}
382 #%__spec_pre_post               %{nil}
383 #%__spec_post_pre               %{nil}
384 #%__spec_post_post              %{nil}
385 #%__spec_preun_pre              %{nil}
386 #%__spec_preun_post             %{nil}
387 #%__spec_postun_pre             %{nil}
388 #%__spec_postun_post            %{nil}
389 #%__spec_triggerpostun_pre      %{nil}
390 #%__spec_triggerpostun_post     %{nil}
391 #%__spec_triggerun_pre          %{nil}
392 #%__spec_triggerun_post         %{nil}
393 #%__spec_triggerin_pre          %{nil}
394 #%__spec_triggerin_post         %{nil}
395
396 #==============================================================================
397 # ---- configure macros.
398 #       Macro(s) slavishly copied from autoconf's config.status.
399 #
400 %_prefix                @prefix@
401 %_exec_prefix           %{_prefix}
402 %_bindir                %{_exec_prefix}/bin
403 %_sbindir               %{_exec_prefix}/sbin
404 %_libexecdir            %{_exec_prefix}/libexec
405 %_datadir               %{_prefix}/share
406 %_sysconfdir            %{_prefix}/etc
407 %_sharedstatedir        %{_prefix}/com
408 %_localstatedir         %{_prefix}/var
409 %_lib                   lib
410 %_libdir                %{_exec_prefix}/%{_lib}
411 %_includedir            %{_prefix}/include
412 %_oldincludedir         /usr/include
413 %_infodir               %{_prefix}/info
414 %_mandir                %{_prefix}/man
415
416 #==============================================================================
417 # ---- config.guess platform macros.
418 #       Macro(s) similar to the tokens used by configure.
419 #
420 %_build                 %{_host}
421 %_build_alias           %{_host_alias}
422 %_build_cpu             %{_host_cpu}
423 %_build_vendor          %{_host_vendor}
424 %_build_os              %{_host_os}
425 %_host                  @host@
426 %_host_alias            @host_alias@
427 %_host_cpu              @host_cpu@
428 %_host_vendor           @host_vendor@
429 %_host_os               @host_os@
430 %_target                %{_host}
431 %_target_alias          %{_host_alias}
432 %_target_cpu            %{_host_cpu}
433 %_target_vendor         %{_host_vendor}
434 %_target_os             %{_host_os}
435
436 #==============================================================================
437 # ---- specfile macros.
438 #       Macro(s) here can be used reliably for reproducible builds.
439 #       (Note: Above is the goal, below are the macros under development)
440 #
441 # The configure macro does the following:
442 #       optionally change to a subdirectory (not implemented).
443 #       attempt to update config.guess and config.sub.
444 #       run configure with correct prefix, platform, and CFLAGS.
445 #       optionally restore current directory (not implemented).
446 # The configure macro should be invoked as %configure (rather than %{configure})
447 # because the rest of the arguments will be expanded using %*. Another
448 # gotcha is that arguments, if present, should be on the same line as the
449 # %configure.
450 #
451 %configure      \
452   %{?__libtoolize:[ -f configure.in ] && %{__libtoolize} --copy --force} \
453   CFLAGS="%{optflags}" ./configure %{_target_platform} --prefix=%{_prefix}
454
455 #------------------------------------------------------------------------------
456 # This is an improved version of %configure that may replace the above
457 # macro at some point (from PLD team).
458 #
459 #%configure { CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
460 # CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
461 # FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS ; \
462 # ./configure %{_target_platform} \
463 #       --prefix=%{_prefix} \
464 #       --exec-prefix=%{_exec_prefix} \
465 #       --bindir=%{_bindir} \
466 #       --sbindir=%{_sbindir} \
467 #       --sysconfdir=%{_sysconfdir} \
468 #       --datadir=%{_datadir} \
469 #       --includedir=%{_includedir} \
470 #       --libdir=%{_libdir} \
471 #       --libexecdir=%{_libexecdir} \
472 #       --localstatedir=%{_localstatedir} \
473 #       --sharedstatedir=%{_sharedstatedir} \
474 #       --mandir=%{_mandir} \
475 #       --infodir=%{_infodir} }
476
477 #------------------------------------------------------------------------------
478 # The GNUconfigure macro does the following:
479 #       update config.guess and config.sub.
480 #       regenerate all autoconf/automake files
481 #       optionally change to a directory (make the directory if requested).
482 #       run configure with correct prefix, platform, and CFLAGS.
483 #       optionally restore current directory.
484 #
485 # Based on autogen.sh from GNOME and orginal GNUconfigure
486 #
487 %GNUconfigure(MCs:)      \
488   CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS; \
489   LDFLAGS="${LDFLAGS:-'%{-s:-s}'}"  ; export LDFLAGS; \
490   %{-C:_mydir="`pwd`"; %{-M: %{__mkdir} -p %{-C*};} cd %{-C*}} \
491   dirs="`find ${_mydir} -name configure.in -print`"; export dirs; \
492     for coin in `echo ${dirs}` \
493 do \
494   dr=`dirname ${coin}`; \
495 if test -f ${dr}/NO-AUTO-GEN; then \
496  : \
497 else \
498      macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < ${coin}`; \
499     ( cd ${dr}; \
500       aclocalinclude="${ACLOCAL_FLAGS}"; \
501       for k in ${macrodirs}; do \
502         if test -d ${k}; then \
503           aclocalinclude="${aclocalinclude} -I ${k}"; \
504         ##else \
505         ##  echo "**Warning**: No such directory \`${k}'.  Ignored." \
506         fi \
507       done \
508       if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then \
509         if grep "sed.*POTFILES" configure.in >/dev/null; then \
510           : do nothing -- we still have an old unmodified configure.in \
511         else \
512           test -r ${dr}/aclocal.m4 || touch ${dr}/aclocal.m4; \
513           echo "no" | gettextize --force --copy; \
514           test -r ${dr}/aclocal.m4 && %{__chmod} u+w ${dr}/aclocal.m4; \
515         fi \
516       fi \
517       if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then \
518         %{__libtoolize} --force --copy; \
519       fi \
520       aclocal ${aclocalinclude}; \
521       if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then \
522         %{__autoheader}; \
523       fi \
524       echo "Running automake --gnu ${am_opt} ..."; \
525       %{__automake} --add-missing --gnu ${am_opt}; \
526       %{__autoconf}; \
527     ); \
528   fi \
529 done \
530   %{-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} %* ; \
531   %{-C:cd ${_mydir}; unset _mydir}
532
533 #------------------------------------------------------------------------------
534 # Useful perl macros (from Artur Frysiak <wiget@t17.ds.pwr.wroc.pl>)
535 #
536 # For example, these can be used as (from ImageMagick.spec from PLD site)
537 #       [...]
538 #       BuildPrereq: perl
539 #       [...]
540 #       %package perl
541 #       Summary: libraries and modules for access to ImageMagick from perl
542 #       Group: Development/Languages/Perl
543 #       Requires: %{name} = %{version}
544 #       %requires_eq    perl
545 #       [...]
546 #       %install
547 #       rm -fr $RPM_BUILD_ROOT
548 #       install -d $RPM_BUILD_ROOT/%{perl_sitearch}
549 #       [...]
550 #       %files perl
551 #       %defattr(644,root,root,755)
552 #       %{perl_sitearch}/Image
553 #       %dir %{perl_sitearch}/auto/Image
554 #
555 %requires_eq()  %(LC_ALL="C" rpm -q --queryformat 'Requires:%%{NAME} = %%{VERSION}' %1| grep -v "is not")
556 %perl_sitearch  %(eval "`perl -V:installsitearch`"; echo $installsitearch)
557 %perl_archlib   %(eval "`perl -V:installarchlib`"; echo $installarchlib)
558
559 #------------------------------------------------------------------------------
560 # arch macro for all Intel i?86 compatibile processors
561 #  (Note: This macro (and it's analogues) will probably be obsoleted when
562 #   rpm can use regular expressions against target platforms in macro
563 #   conditionals. This change will be introduced after rpm-3.0.4).
564 #
565 %ix86   i386 i486 i586 i686 i786 i886 i986
566
567 #------------------------------------------------------------------------
568 # Use in %install to generate locale specific file lists. For example,
569 #
570 # %install
571 # ...
572 # %find_lang %{name}
573 # ...
574 # %files -f %{name}.lang
575 #
576 %find_lang      @RPMCONFIGDIR@/find-lang.sh %{buildroot}
577