Eliminate all the now unnecessary fsm->ix save-and-restores
[platform/upstream/rpm.git] / macros.in
1 #/*! \page config_macros Default configuration: @RPMCONFIGDIR@/macros
2 # \verbatim
3 #
4 # This is a global RPM configuration file. All changes made here will
5 # be lost when the rpm package is upgraded. Any per-system configuration
6 # should be added to /etc/rpm/macros, while per-user configuration should
7 # be added to ~/.rpmmacros.
8 #
9 #==============================================================================
10 # Macro naming conventions (preliminary):
11 #
12 #       Macros that begin with an underscore are "local" in the sense that
13 #       they (if used) will not be exported in rpm headers. Some macros
14 #       that don't start with an underscore (but look like they should)
15 #       are compatible with macros generated by rpm-2.5.x and will be made
16 #       more consistent in a future release.
17 #
18
19 #==============================================================================
20 # ---- A macro that expands to nothing.
21 #
22 %nil                    %{!?nil}
23
24 #==============================================================================
25 # ---- filesystem macros.
26 #
27 %_usr                   @prefix@
28 %_usrsrc                %{_usr}/src
29 %_var                   @localstatedir@
30
31 #==============================================================================
32 # ---- Generally useful path macros.
33 #
34 %__7zip                 @__7ZIP@
35 %__awk                  @AWK@
36 %__bzip2                @__BZIP2@
37 %__cat                  @__CAT@
38 %__chgrp                @__CHGRP@
39 %__chmod                @__CHMOD@
40 %__chown                @__CHOWN@
41 %__cp                   @__CP@
42 %__cpio                 @__CPIO@
43 %__file                 @__FILE@
44 %__gpg                  @__GPG@
45 %__grep                 @__GREP@
46 %__gzip                 @__GZIP@
47 %__id                   @__ID@
48 %__id_u                 %{__id} -u
49 %__install              @__INSTALL@
50 %__ln_s                 @LN_S@
51 %__lrzip                @__LRZIP@
52 %__lzip                 @__LZIP@
53 # Deprecated, use %__xz instead.
54 %__lzma                 %__xz --format=lzma
55 %__xz                   @__XZ@
56 %__make                 @__MAKE@
57 %__mkdir                @__MKDIR@
58 %__mkdir_p              @__MKDIR_P@
59 %__mv                   @__MV@
60 %__patch                @__PATCH@
61 %__perl                 @__PERL@
62 %__python               @__PYTHON@
63 %__restorecon           @__RESTORECON@
64 %__rm                   @__RM@
65 %__rsh                  @__RSH@
66 %__sed                  @__SED@
67 %__semodule             @__SEMODULE@
68 %__ssh                  @__SSH@
69 %__tar                  @__TAR@
70 %__unzip                @__UNZIP@
71 %__git                  @__GIT@
72 %__hg                   @__HG@
73 %__bzr                  @__BZR@
74 %__quilt                @__QUILT@
75
76 #==============================================================================
77 # ---- Build system path macros.
78 #
79 %__ar                   @AR@
80 %__as                   @AS@
81 %__cc                   @__CC@
82 %__cpp                  @CPP@
83 %__cxx                  @CXX@
84 %__ld                   @__LD@
85 %__nm                   @__NM@
86 %__objcopy              @__OBJCOPY@
87 %__objdump              @__OBJDUMP@
88 %__ranlib               @RANLIB@
89 %__remsh                %{__rsh}
90 %__strip                @__STRIP@
91
92 # XXX avoid failures if tools are not installed when rpm is built.
93 %__libtoolize           libtoolize
94 %__aclocal              aclocal
95 %__autoheader           autoheader
96 %__automake             automake
97 %__autoconf             autoconf
98
99 #==============================================================================
100 # Conditional build stuff.
101
102 # Check if symbol is defined.
103 # Example usage: %if %{defined with_foo} && %{undefined with_bar} ...
104 %defined()      %{expand:%%{?%{1}:1}%%{!?%{1}:0}}
105 %undefined()    %{expand:%%{?%{1}:0}%%{!?%{1}:1}}
106
107 # Shorthand for %{defined with_...}
108 %with()         %{expand:%%{?with_%{1}:1}%%{!?with_%{1}:0}}
109 %without()      %{expand:%%{?with_%{1}:0}%%{!?with_%{1}:1}}
110
111 # Handle conditional builds. %bcond_with is for case when feature is
112 # default off and needs to be activated with --with ... command line
113 # switch. %bcond_without is for the dual case.
114 #
115 # %bcond_with foo defines symbol with_foo if --with foo was specified on
116 # command line.
117 # %bcond_without foo defines symbol with_foo if --without foo was *not*
118 # specified on command line.
119 #
120 # For example (spec file):
121 #
122 # (at the beginning)
123 # %bcond_with extra_fonts
124 # %bcond_without static
125 # (and later)
126 # %if %{with extra_fonts}
127 # ...
128 # %else
129 # ...
130 # %endif
131 # %if ! %{with static}
132 # ...
133 # %endif
134 # %ifdef %{with static}
135 # ...
136 # %endif
137 # %{?with_static: ... }
138 # %{!?with_static: ... }
139 # %{?with_extra_fonts: ... }
140 # %{!?with_extra_fonts: ... }
141
142 #
143 # The bottom line: never use without_foo, _with_foo nor _without_foo, only
144 # with_foo. This way changing default set of bconds for given spec is just
145 # a matter of changing single line in it and syntax is more readable.
146 %bcond_with()           %{expand:%%{?_with_%{1}:%%global with_%{1} 1}}
147 %bcond_without()        %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}}
148 #
149 #==============================================================================
150 # ---- Required rpmrc macros.
151 #       Macros that used to be initialized as a side effect of rpmrc parsing.
152 #       These are the default values that can be overridden by other
153 #       (e.g. per-platform, per-system, per-packager, per-package) macros.
154 #
155 #       The directory where rpm's configuration and scripts live
156 %_rpmconfigdir          %{getconfdir}
157
158 #       The directory where sources/patches will be unpacked and built.
159 %_builddir              %{_topdir}/BUILD
160
161 #       The interpreter used for build scriptlets.
162 %_buildshell            /bin/sh
163
164 #       The path to the bzip2 executable (legacy, use %{__bzip2} instead).
165 %_bzip2bin              %{__bzip2}
166
167 #       The location of the rpm database file(s).
168 %_dbpath                %{_var}/lib/rpm
169
170 #       The location of the rpm database file(s) after "rpm --rebuilddb".
171 %_dbpath_rebuild        %{_dbpath}
172
173 %_keyringpath           %{_dbpath}/pubkeys/
174
175 #
176 #       Path to script that creates debug symbols in a /usr/lib/debug
177 #       shadow tree.
178 #
179 #       A spec file can %%define _find_debuginfo_opts to pass options to
180 #       the script.  See the script for details.
181 #
182 %__debug_install_post   \
183    %{_rpmconfigdir}/find-debuginfo.sh %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_find_debuginfo_opts} "%{_builddir}/%{?buildsubdir}"\
184 %{nil}
185
186 #       Template for debug information sub-package.
187 %debug_package \
188 %ifnarch noarch\
189 %global __debug_package 1\
190 %package debug\
191 Summary: Debug information for package %{name}\
192 Group: Development/Debug\
193 AutoReqProv: 0\
194 %description debug\
195 This package provides debug information for package %{name}.\
196 Debug information is useful when developing applications that use this\
197 package or when debugging this package.\
198 %files debug -f debugfiles.list\
199 %defattr(-,root,root)\
200 %endif\
201 %{nil}
202
203 %_defaultdocdir         %{_datadir}/doc
204 %_defaultlicensedir     %{_datadir}/licenses
205
206 #       The path to the gzip executable (legacy, use %{__gzip} instead).
207 %_gzipbin               %{__gzip}
208
209 #       The Unix time of the latest kept changelog entry in binary packages.
210 #       Any older entry is not packaged in binary packages.
211 %_changelog_trimtime    0
212
213 #       The directory where newly built binary packages will be written.
214 %_rpmdir                %{_topdir}/RPMS
215
216 #       A template used to generate the output binary package file name
217 #       (legacy).
218 %_rpmfilename           %{_build_name_fmt}
219
220 #       The directory where sources/patches from a source package will be
221 #       installed. This is also where sources/patches are found when building.
222 %_sourcedir             %{_topdir}/SOURCES
223
224 #       The directory where the spec file from a source package will be
225 #       installed.
226 %_specdir               %{_topdir}/SPECS
227
228 #       The directory where newly built source packages will be written.
229 %_srcrpmdir             %{_topdir}/SRPMS
230
231 #       The directory where buildroots will be created.
232 %_buildrootdir          %{_topdir}/BUILDROOT
233
234 #       Build root path, where %install installs the package during build.
235 %buildroot              %{_buildrootdir}/%{name}-%{version}-%{release}.%{_arch}
236
237 #       Directory where temporaray files can be created.
238 %_tmppath               %{_var}/tmp
239
240 #       Path to top of build area.
241 %_topdir                %{getenv:HOME}/rpmbuild
242
243 #       The path to the unzip executable (legacy, use %{__unzip} instead).
244 %_unzipbin              %{__unzip}
245
246 #==============================================================================
247 # ---- Optional rpmrc macros.
248 #       Macros that are initialized as a side effect of rpmrc and/or spec
249 #       file parsing.
250 #
251 #       The sub-directory (relative to %{_builddir}) where sources are compiled.
252 #       This macro is set after processing %setup, either explicitly from the
253 #       value given to -n or the default name-version.
254 #
255 #%buildsubdir
256
257 #       Configurable distribution information, same as Distribution: tag in a
258 #       specfile.
259 #
260 #%distribution
261
262 #       Configurable distribution URL, same as DistURL: tag in a specfile.
263 #       The URL will be used to supply reliable information to tools like
264 #       rpmfind.
265 #
266 # Note: You should not configure with disturl (or build packages with
267 # the DistURL: tag) unless you are willing to supply content in a
268 # yet-to-be-determined format at the URL specified.
269 #
270 #%disturl
271
272 #       Configurable bug URL, same as BugURL: tag in a specfile.
273 #       The URL will be used to supply reliable information to where
274 #       to file bugs.
275 #
276 #%bugurl
277
278 #       Boolean (i.e. 1 == "yes", 0 == "no") that controls whether files
279 #       marked as %doc should be installed.
280 #%_excludedocs
281
282 #       The port and machine name of a FTP proxy host running TIS firewall.
283 #
284 #%_ftpport
285 #%_ftpproxy
286
287 #       The signature to use and the location of configuration files for
288 #       signing packages with GNU gpg.
289 #
290 #%_gpg_name
291 #%_gpg_path
292
293 #       The port and machine name of an HTTP proxy host.
294 #
295 #%_httpport
296 #%_httpproxy
297
298 #       The PATH put into the environment before running %pre/%post et al.
299 #
300 %_install_script_path   /sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin
301
302 #       A colon separated list of desired locales to be installed;
303 #       "all" means install all locale specific files.
304 #       
305 %_install_langs all
306
307 #       The value of CLASSPATH in build scriptlets (iff configured).
308 #       
309 #%_javaclasspath        all
310
311 #       Import packaging conventions from jpackage.org (prefixed with _
312 #       to avoid name collisions).
313 #       
314 %_javadir      %{_datadir}/java
315 %_javadocdir   %{_datadir}/javadoc
316
317 #       A colon separated list of paths where files should *not* be installed.
318 #       Usually, these are network file system mount points.
319 #
320 #%_netsharedpath
321
322 #       (experimental)
323 #       The type of pattern match used on rpmdb iterator selectors:
324 #       "default"       simple glob-like regex, periods will be escaped,
325 #                       splats will have period prepended, full "^...$" match
326 #                       required. Also, file path tags will use glob(7).
327 #       "strcmp"        compare strings
328 #       "regex"         regex(7) patterns using regcomp(3)/regexec(3)
329 #       "glob"          glob(7) patterns using fnmatch(3)
330 #
331 %_query_selector_match  default
332
333 #       Configurable packager information, same as Packager: in a specfile.
334 #
335 #%packager
336
337 #       Compression type and level for source/binary package payloads.
338 #               "w9.gzdio"      gzip level 9 (default).
339 #               "w9.bzdio"      bzip2 level 9.
340 #               "w7.xzdio"      xz level 7, xz's default.
341 #               "w7.lzdio"      lzma-alone level 7, lzma's default
342 #
343 #%_source_payload       w9.gzdio
344 #%_binary_payload       w9.gzdio
345
346 #       Algorithm to use for generating file checksum digests on build.
347 #       If not specified or 0, MD5 is used.
348 #       WARNING: non-MD5 is backwards incompatible, don't enable lightly!
349 #       The supported algorithms may depend on NSS version, as of NSS
350 #       3.11.99.5 the following are supported:
351 #       1       MD5 (default)
352 #       2       SHA1
353 #       8       SHA256
354 #       9       SHA384
355 #       10      SHA512
356 #
357 #%_source_filedigest_algorithm  1
358 #%_binary_filedigest_algorithm  1
359
360 #       Configurable vendor information, same as Vendor: in a specfile.
361 #
362 #%vendor
363
364 #       Default fuzz level for %patch in spec file.
365 %_default_patch_fuzz    0
366
367 #       Default patch flags
368 #%_default_patch_flags  -s
369
370 #==============================================================================
371 # ---- Build configuration macros.
372 #
373 # Script gets packaged file list on input and buildroot as first parameter.
374 # Returns list of unpackaged files, i.e. files in $RPM_BUILD_ROOT not packaged.
375 #
376 # Note: Disable (by commenting out) for legacy compatibility.
377 %__check_files         %{_rpmconfigdir}/check-files %{buildroot}
378
379 #
380 # Should unpackaged files in a build root terminate a build?
381 #
382 # Note: The default value should be 0 for legacy compatibility.
383 %_unpackaged_files_terminate_build      1
384
385 #
386 # Should missing %doc files in the build directory terminate a build?
387 #
388 # Note: The default value should be 0 for legacy compatibility.
389 %_missing_doc_files_terminate_build     1
390
391 #
392 # Should binaries in noarch packages terminate a build?
393 %_binaries_in_noarch_packages_terminate_build   1
394
395 #
396 # Should rpm try to download missing sources at build-time?
397 # Enabling this is dangerous as long as rpm has no means to validate
398 # the integrity of the download with a digest or signature.
399 %_disable_source_fetch 1
400
401 #
402 # Program to call for each successfully built and written binary package.
403 # The package name is passed to the program as a command-line argument.
404 #
405 #%_build_pkgcheck       %{_bindir}/rpmlint
406
407 #
408 # Program to call for the whole binary package set after build.
409 # The package set is passed to the program via command-line arguments.
410 #
411 #%_build_pkgcheck_set   %{_bindir}/rpmlint
412
413 #
414 # Program to call for successfully built and written SRPM.
415 # The package name is passed to the program as a command-line argument.
416 #
417 #%_build_pkgcheck_srpm  %{_bindir}/rpmlint
418
419 #
420 # Should the build of packages fail if package checker (if defined) returns
421 # non-zero exit status?
422 #
423 #%_nonzero_exit_pkgcheck_terminate_build        1
424
425 #
426 # Should an ELF file processed by find-debuginfo.sh having no build ID
427 # terminate a build?  This is left undefined to disable it and defined to
428 # enable.
429 #
430 #%_missing_build_ids_terminate_build    1
431
432 #
433 # Use internal dependency generator rather than external helpers?
434 %_use_internal_dependency_generator     1
435
436 #
437 # Filter GLIBC_PRIVATE Provides: and Requires:
438 %_filter_GLIBC_PRIVATE                  0
439
440 # Directories whose contents should be considered as documentation.
441 %__docdir_path %{_datadir}/doc:%{_datadir}/man:%{_datadir}/info:%{_datadir}/gtk-doc/html:%{?_docdir}:%{?_mandir}:%{?_infodir}:%{?_javadocdir}:/usr/doc:/usr/man:/usr/info:/usr/X11R6/man
442
443 #
444 # Path to scripts to autogenerate package dependencies,
445 #
446 # Note: Used iff _use_internal_dependency_generator is zero.
447 #%__find_provides       %{_rpmconfigdir}/rpmdeps --provides
448 #%__find_requires       %{_rpmconfigdir}/rpmdeps --requires
449 %__find_provides        %{_rpmconfigdir}/find-provides
450 %__find_requires        %{_rpmconfigdir}/find-requires
451 #%__find_conflicts      ???
452 #%__find_obsoletes      ???
453
454
455 # Path to file attribute classifications for automatic dependency 
456 # extraction, used when _use_internal_dependency_generator
457 # is used (on by default). Files can have any number of attributes
458 # attached to them, and dependencies are separately extracted for
459 # each attribute.
460
461 # To define a new file attribute called "myattr", add a file named
462 # "myattr" to this directory, defining the requires and/or provides
463 # finder script(s) + magic and/or path pattern regex(es).
464 # provides finder and 
465 # %__myattr_requires    path + args to requires finder script for <myattr>
466 # %__myattr_provides    path + args to provides finder script for <myattr>
467 # %__myattr_magic       libmagic classification match regex
468 # %__myattr_path        path based classification match regex
469 # %__myattr_flags       flags to control behavior (just "exeonly" for now)
470 # %__myattr_exclude_magic       exclude by magic regex
471 # %__myattr_exclude_path        exclude by path regex
472 #
473 %_fileattrsdir          %{_rpmconfigdir}/fileattrs
474
475 #==============================================================================
476 # ---- Database configuration macros.
477 #       Macros used to configure Berkley db parameters.
478 #
479 # rpmdb macro configuration values are a colon (or white space) separated
480 # list of tokens, with an optional '!' negation to explicitly disable bit
481 # values, or a "=value" if a parameter. A per-tag value is used (e.g.
482 # %_dbi_config_Packages) if defined, otherwise a per-rpmdb default
483 # (e.g. %_dbi_config).
484 #
485 # Here's a short list of the tokens, with a guess of whether the option is
486 # useful:
487 #       (nothing)       currently used in rpm, known to work.
488 #       "+++"           under development, will be supported in rpm eventually.
489 #       "???"           I have no clue, you're mostly on your own.
490 #
491 # If you do find yourself inclined to fiddle, here's what I see (shrug):
492 # 1) Only the value of mp_size has any serious impact on overall performance,
493 #    and you will need ~256Kb to handle a typical machine install.
494 # 2) Only the Packages hash, because of the size of the values (i.e. headers),
495 #    will ever need tuning. Diddle the pagesize if you're interested, although
496 #    I believe that you will find pagesize=512 "best".
497 # 3) Adding nofsync increases speed, but risks total data loss. Fiddle shared
498 #    and/or mp_size instead.
499 #
500 #   token       works?  Berkeley db flag or value
501 #==================================================
502 #---------------------- DBENV tunable values:
503 #   mmapsize=16Mb       DBENV->set_mp_mmapsize
504 #   cachesize=1Mb       DBENV->set_cachesize, DB->set_cachesize
505 #---------------------- DB->open bits:
506 #   nommap      ???     DB_NOMMAP
507 #----------------------- rpmdb specific configuration:
508 #   lockdbfd            (always on for Packages) Use fcntl(2) locking ?
509 #   nofsync             Disable fsync(2) call performed after db3 writes?
510 #
511
512 # Misc BDB tuning options
513 %__dbi_other                    mp_mmapsize=128Mb mp_size=1Mb
514
515 %_dbi_config                    %{?__dbi_other}
516
517 # "Packages" should have shared/exclusive fcntl(2) lock using "lockdbfd".
518 %_dbi_config_Packages           %{?_dbi_config} lockdbfd
519
520 #==============================================================================
521 # ---- GPG/PGP/PGP5 signature macros.
522 #       Macro(s) to hold the arguments passed to GPG/PGP for package
523 #       signing and verification.
524 #
525 %__gpg_check_password_cmd       %{__gpg} \
526         gpg --batch --no-verbose --passphrase-fd 3 -u "%{_gpg_name}" -so -
527
528 %__gpg_sign_cmd                 %{__gpg} \
529         gpg --batch --no-verbose --no-armor --passphrase-fd 3 \
530         %{?_gpg_digest_algo:--digest-algo %{_gpg_digest_algo}} \
531         --no-secmem-warning \
532         -u "%{_gpg_name}" -sbo %{__signature_filename} %{__plaintext_filename}
533
534 # XXX rpm >= 4.1 verifies signatures internally
535 #%__gpg_verify_cmd              %{__gpg} \
536 #       gpg --batch --no-verbose --verify --no-secmem-warning \
537 #       %{__signature_filename} %{__plaintext_filename}
538 #
539 # XXX rpm-4.1 verifies prelinked libraries using a prelink undo helper.
540 #       Normally this macro is defined in /etc/rpm/macros.prelink, installed
541 #       with the prelink package. If the macro is undefined, then prelinked
542 #       shared libraries contents are MD5 digest verified (as usual), rather
543 #       than MD5 verifying the output of the prelink undo helper.
544 #
545 #       Note: The 2nd token is used as argv[0] and "library" is a
546 #       placeholder that will be deleted and replaced with the appropriate
547 #       library file path.
548 #%__prelink_undo_cmd     /usr/sbin/prelink prelink -y library
549
550 # Horowitz Key Protocol server configuration
551 #
552 %_hkp_keyserver         http://pgp.mit.edu
553 %_hkp_keyserver_query   %{_hkp_keyserver}:11371/pks/lookup?op=get&search=0x
554
555 #==============================================================================
556 # ---- Transaction macros.
557 #       Macro(s) used to parameterize transactions.
558 #
559 #       The output binary package file name template used when building
560 #       binary packages.
561 #
562 # XXX   Note: escaped %% for use in headerSprintf()
563 %_build_name_fmt        %%{ARCH}/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
564
565 #       Verify digest/signature flags for various rpm modes:
566 #       0x30300 (_RPMVSF_NODIGESTS)    --nohdrchk      if set, don't check digest(s)
567 #       0xc0c00 (_RPMVSF_NOSIGNATURES) --nosignature   if set, don't check signature(s)
568 #       0xf0000 (_RPMVSF_NOPAYLOAD)    --nolegacy      if set, check header+payload (if possible)
569 #       0x00f00 (_RPMVSF_NOHEADER)     --nohdrchk      if set, don't check rpmdb headers
570 #
571 #       For example, the value 0xf0c00 (=0xf0000+0xc0c00) disables legacy
572 #       digest/signature checking, disables signature checking, but attempts
573 #       digest checking, also when retrieving headers from the database.
574 #
575 #       You also can do:
576 #        >>> hex(rpm._RPMVSF_NOSIGNATURES)
577 #        '0xc0c00'
578 #       or:
579 #        >>> hex(rpm._RPMVSF_NOSIGNATURES|rpm._RPMVSF_NOPAYLOAD)
580 #        '0xf0c00'
581 #       at the python prompt for example, after "import rpm".
582 #
583 #       The checking overhead is ~11ms per header for digests/signatures;
584 #       each header from the database is checked only when first encountered
585 #       for each database open.
586 #
587 #       Note: the %_vsflags_erase applies to --upgrade/--freshen modes as
588 #       well as --erase.
589 #
590 %__vsflags              0xf0000
591 %_vsflags_build         %{__vsflags}
592 %_vsflags_erase         %{__vsflags}
593 %_vsflags_install       %{__vsflags}
594 %_vsflags_query         %{__vsflags}
595 %_vsflags_rebuilddb     0xc0c00
596 %_vsflags_verify        %{__vsflags}
597
598 #
599 # Default output format string for rpm -qa
600 #
601 # XXX   Note: escaped %% for use in headerFormat()
602 %_query_all_fmt         %%{nvra}
603
604 #
605 # Default path to the file used for transaction fcntl lock.
606 %_rpmlock_path  %{_dbpath}/.rpm.lock
607
608 #
609 # ISA dependency marker, none for noarch and name-bitness for others
610 %_isa                   %{?__isa:(%{__isa})}%{!?__isa:%{nil}}
611
612 #
613 # Define per-arch and per-os defaults. Normally overridden by per-target macros.
614 %__arch_install_post    %{nil}
615 %__os_install_post      %{___build_post}
616
617 # Macro to fix broken permissions in sources
618 %_fixperms      %{__chmod} -Rf @FIXPERMS@
619
620 #==============================================================================
621 # ---- Scriptlet template templates.
622 #       Global defaults used for building scriptlet templates.
623 #
624
625 %___build_shell         %{?_buildshell:%{_buildshell}}%{!?_buildshell:/bin/sh}
626 %___build_args          -e
627 %___build_cmd           %{?_sudo:%{_sudo} }%{?_remsh:%{_remsh} %{_remhost} }%{?_remsudo:%{_remsudo} }%{?_remchroot:%{_remchroot} %{_remroot} }%{___build_shell} %{___build_args}
628 %___build_pre   \
629   RPM_SOURCE_DIR=\"%{u2p:%{_sourcedir}}\"\
630   RPM_BUILD_DIR=\"%{u2p:%{_builddir}}\"\
631   RPM_OPT_FLAGS=\"%{optflags}\"\
632   RPM_ARCH=\"%{_arch}\"\
633   RPM_OS=\"%{_os}\"\
634   export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
635   RPM_DOC_DIR=\"%{_docdir}\"\
636   export RPM_DOC_DIR\
637   RPM_PACKAGE_NAME=\"%{name}\"\
638   RPM_PACKAGE_VERSION=\"%{version}\"\
639   RPM_PACKAGE_RELEASE=\"%{release}\"\
640   export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
641   LANG=C\
642   export LANG\
643   unset CDPATH DISPLAY ||:\
644   %{?buildroot:RPM_BUILD_ROOT=\"%{u2p:%{buildroot}}\"\
645   export RPM_BUILD_ROOT}\
646   %{?_javaclasspath:CLASSPATH=\"%{_javaclasspath}\"\
647   export CLASSPATH}\
648   \
649   %{verbose:set -x}%{!verbose:exec > /dev/null}\
650   umask 022\
651   cd \"%{u2p:%{_builddir}}\"\
652
653
654 #%___build_body         %{nil}
655 %___build_post          exit 0
656
657 %___build_template      #!%{___build_shell}\
658 %{___build_pre}\
659 %{nil}
660
661 #%{___build_body}\
662 #%{___build_post}\
663 #%{nil}
664
665 #==============================================================================
666 # ---- Scriptlet templates.
667 #       Macro(s) that expand to a command and script that is executed.
668 #       CAVEAT: All macro expansions must fit in a BUFSIZ (8192 byte) buffer.
669 #
670 %__spec_prep_shell      %{___build_shell}
671 %__spec_prep_args       %{___build_args}
672 %__spec_prep_cmd        %{___build_cmd}
673 %__spec_prep_pre        %{___build_pre}
674 %__spec_prep_body       %{___build_body}
675 %__spec_prep_post       %{___build_post}
676 %__spec_prep_template   #!%{__spec_prep_shell}\
677 %{__spec_prep_pre}\
678 %{nil}
679
680 #%{__spec_prep_body}\
681 #%{__spec_prep_post}\
682 #%{nil}
683
684 %__spec_build_shell     %{___build_shell}
685 %__spec_build_args      %{___build_args}
686 %__spec_build_cmd       %{___build_cmd}
687 %__spec_build_pre       %{___build_pre}
688 %__spec_build_body      %{___build_body}
689 %__spec_build_post      %{___build_post}
690 %__spec_build_template  #!%{__spec_build_shell}\
691 %{__spec_build_pre}\
692 %{nil}
693
694 #%{__spec_build_body}\
695 #%{__spec_build_post}\
696 #%{nil}
697
698 %__spec_install_shell   %{___build_shell}
699 %__spec_install_args    %{___build_args}
700 %__spec_install_cmd     %{___build_cmd}
701 %__spec_install_pre     %{___build_pre}
702 %__spec_install_body    %{___build_body}
703 %__spec_install_post\
704 %{?__debug_package:%{__debug_install_post}}\
705 %{__arch_install_post}\
706 %{__os_install_post}\
707 %{nil}
708 %__spec_install_template        #!%{__spec_install_shell}\
709 %{__spec_install_pre}\
710 %{nil}
711
712 #%{__spec_install_body}\
713 #%{__spec_install_post}\
714 #%{nil}
715
716 %__spec_check_shell     %{___build_shell}
717 %__spec_check_args      %{___build_args}
718 %__spec_check_cmd       %{___build_cmd}
719 %__spec_check_pre       %{___build_pre}
720 %__spec_check_body      %{___build_body}
721 %__spec_check_post      %{___build_post}
722 %__spec_check_template  #!%{__spec_check_shell}\
723 %{__spec_check_pre}\
724 %{nil}
725
726 #%{__spec_check_body}\
727 #%{__spec_check_post}\
728 #%{nil}
729
730 #%__spec_autodep_shell  %{___build_shell}
731 #%__spec_autodep_args   %{___build_args}
732 #%__spec_autodep_cmd    %{___build_cmd}
733 #%__spec_autodep_pre    %{___build_pre}
734 #%__spec_autodep_body   %{___build_body}
735 #%__spec_autodep_post   %{___build_post}
736 #%__spec_autodep_template       #!%{__spec_autodep_shell}\
737 #%{__spec_autodep_pre}\
738 #%{nil}
739
740 #%{__spec_autodep_body}\
741 #%{__spec_autodep_post}\
742 #%{nil}
743
744 %__spec_clean_shell     %{___build_shell}
745 %__spec_clean_args      %{___build_args}
746 %__spec_clean_cmd       %{___build_cmd}
747 %__spec_clean_pre       %{___build_pre}
748 %__spec_clean_body      %{___build_body}
749 %__spec_clean_post      %{___build_post}
750 %__spec_clean_template  #!%{__spec_clean_shell}\
751 %{__spec_clean_pre}\
752 %{nil}
753
754 #%{__spec_clean_body}\
755 #%{__spec_clean_post}\
756 #%{nil}
757
758 %__spec_rmbuild_shell   %{___build_shell}
759 %__spec_rmbuild_args    %{___build_args}
760 %__spec_rmbuild_cmd     %{___build_cmd}
761 %__spec_rmbuild_pre     %{___build_pre}
762 %__spec_rmbuild_body    %{___build_body}
763 %__spec_rmbuild_post    %{___build_post}
764 %__spec_rmbuild_template        #!%{__spec_rmbuild_shell}\
765 %{__spec_rmbuild_pre}\
766 %{nil}
767
768 #%{__spec_rmbuild_body}\
769 #%{__spec_rmbuild_post}\
770 #%{nil}
771
772 # XXX We don't expand pre/post install scriptlets (yet).
773 #%__spec_pre_pre                %{nil}
774 #%__spec_pre_post               %{nil}
775 #%__spec_post_pre               %{nil}
776 #%__spec_post_post              %{nil}
777 #%__spec_preun_pre              %{nil}
778 #%__spec_preun_post             %{nil}
779 #%__spec_postun_pre             %{nil}
780 #%__spec_postun_post            %{nil}
781 #%__spec_triggerpostun_pre      %{nil}
782 #%__spec_triggerpostun_post     %{nil}
783 #%__spec_triggerun_pre          %{nil}
784 #%__spec_triggerun_post         %{nil}
785 #%__spec_triggerin_pre          %{nil}
786 #%__spec_triggerin_post         %{nil}
787
788 #==============================================================================
789 # ---- configure macros.
790 #       Macro(s) slavishly copied from autoconf's config.status.
791 #
792 %_prefix                @prefix@
793 %_exec_prefix           %{_prefix}
794 %_bindir                %{_exec_prefix}/bin
795 %_sbindir               %{_exec_prefix}/sbin
796 %_libexecdir            %{_exec_prefix}/libexec
797 %_datadir               %{_prefix}/share
798 %_sysconfdir            /etc
799 %_sharedstatedir        %{_prefix}/com
800 %_localstatedir         %{_prefix}/var
801 %_lib                   lib
802 %_libdir                %{_exec_prefix}/%{_lib}
803 %_includedir            %{_prefix}/include
804 %_infodir               %{_datadir}/info
805 %_mandir                %{_datadir}/man
806
807 #==============================================================================
808 # ---- config.guess platform macros.
809 #       Macro(s) similar to the tokens used by configure.
810 #
811 %_build                 %{_host}
812 %_build_alias           %{_host_alias}
813 %_build_cpu             %{_host_cpu}
814 %_build_vendor          %{_host_vendor}
815 %_build_os              %{_host_os}
816 %_host                  @host@
817 %_host_alias            @host_alias@%{nil}
818 %_host_cpu              @host_cpu@
819 %_host_vendor           @host_vendor@
820 %_host_os               @host_os@
821 %_target                %{_host}
822 %_target_alias          %{_host_alias}
823 %_target_cpu            %{_host_cpu}
824 %_target_vendor         %{_host_vendor}
825 %_target_os             %{_host_os}
826
827 #==============================================================================
828 # ---- specfile macros.
829 #       Macro(s) here can be used reliably for reproducible builds.
830 #       (Note: Above is the goal, below are the macros under development)
831 #
832 # The configure macro runs autoconf configure script with platform specific
833 # directory structure (--prefix, --libdir etc) and compiler flags
834 # such as CFLAGS.
835 #
836 # The configure macro should be invoked as %configure (rather than %{configure})
837 # because the rest of the arguments will be expanded using %*.
838 #
839 %_configure ./configure
840 %configure \
841   CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
842   CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
843   FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS ; \
844   %{_configure} --host=%{_host} --build=%{_build} \\\
845         --program-prefix=%{?_program_prefix} \\\
846         --disable-dependency-tracking \\\
847         --prefix=%{_prefix} \\\
848         --exec-prefix=%{_exec_prefix} \\\
849         --bindir=%{_bindir} \\\
850         --sbindir=%{_sbindir} \\\
851         --sysconfdir=%{_sysconfdir} \\\
852         --datadir=%{_datadir} \\\
853         --includedir=%{_includedir} \\\
854         --libdir=%{_libdir} \\\
855         --libexecdir=%{_libexecdir} \\\
856         --localstatedir=%{_localstatedir} \\\
857         --sharedstatedir=%{_sharedstatedir} \\\
858         --mandir=%{_mandir} \\\
859         --infodir=%{_infodir}
860
861 #------------------------------------------------------------------------------
862 # The make install analogue of %configure for modern autotools:
863 %make_install %{__make} install DESTDIR=%{?buildroot}
864
865 #------------------------------------------------------------------------------
866 # Former make install analogue, kept for compatibility and for old/broken
867 #  packages that don't support DESTDIR properly.
868 %makeinstall \
869   %{__make} \\\
870         prefix=%{?buildroot:%{buildroot}}%{_prefix} \\\
871         exec_prefix=%{?buildroot:%{buildroot}}%{_exec_prefix} \\\
872         bindir=%{?buildroot:%{buildroot}}%{_bindir} \\\
873         sbindir=%{?buildroot:%{buildroot}}%{_sbindir} \\\
874         sysconfdir=%{?buildroot:%{buildroot}}%{_sysconfdir} \\\
875         datadir=%{?buildroot:%{buildroot}}%{_datadir} \\\
876         includedir=%{?buildroot:%{buildroot}}%{_includedir} \\\
877         libdir=%{?buildroot:%{buildroot}}%{_libdir} \\\
878         libexecdir=%{?buildroot:%{buildroot}}%{_libexecdir} \\\
879         localstatedir=%{?buildroot:%{buildroot}}%{_localstatedir} \\\
880         sharedstatedir=%{?buildroot:%{buildroot}}%{_sharedstatedir} \\\
881         mandir=%{?buildroot:%{buildroot}}%{_mandir} \\\
882         infodir=%{?buildroot:%{buildroot}}%{_infodir} \\\
883   install
884
885 #------------------------------------------------------------------------------
886 # The GNUconfigure macro does the following:
887 #       update config.guess and config.sub.
888 #       regenerate all autoconf/automake files
889 #       optionally change to a directory (make the directory if requested).
890 #       run configure with correct prefix, platform, and CFLAGS.
891 #       optionally restore current directory.
892 #
893 # Based on autogen.sh from GNOME and orginal GNUconfigure
894 #
895 %GNUconfigure(MCs:)      \
896   CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS; \
897   LDFLAGS="${LDFLAGS:-%{-s:-s}}"  ; export LDFLAGS; \
898   %{-C:_mydir="`pwd`"; %{-M: %{__mkdir} -p %{-C*};} cd %{-C*}} \
899   dirs="`find ${_mydir} -name configure.in -print`"; export dirs; \
900     for coin in `echo ${dirs}` \
901 do \
902   dr=`dirname ${coin}`; \
903 if test -f ${dr}/NO-AUTO-GEN; then \
904  : \
905 else \
906      macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < ${coin}`; \
907     ( cd ${dr}; \
908       aclocalinclude="${ACLOCAL_FLAGS}"; \
909       for k in ${macrodirs}; do \
910         if test -d ${k}; then \
911           aclocalinclude="${aclocalinclude} -I ${k}"; \
912         ##else \
913         ##  echo "**Warning**: No such directory \`${k}'.  Ignored." \
914         fi \
915       done \
916       if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then \
917         if grep "sed.*POTFILES" configure.in >/dev/null; then \
918           : do nothing -- we still have an old unmodified configure.in \
919         else \
920           test -r ${dr}/aclocal.m4 || touch ${dr}/aclocal.m4; \
921           echo "no" | gettextize --force --copy; \
922           test -r ${dr}/aclocal.m4 && %{__chmod} u+w ${dr}/aclocal.m4; \
923         fi \
924       fi \
925       if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then \
926         %{__libtoolize} --force --copy; \
927       fi \
928       aclocal ${aclocalinclude}; \
929       if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then \
930         %{__autoheader}; \
931       fi \
932       echo "Running automake --gnu ${am_opt} ..."; \
933       %{__automake} --add-missing --gnu ${am_opt}; \
934       %{__autoconf}; \
935     ); \
936   fi \
937 done \
938   %{-C:${_mydir}}%{!-C:.}/configure --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} %* ; \
939   %{-C:cd ${_mydir}; unset _mydir}
940
941 %patches %{lua: for i, p in ipairs(patches) do print(p.." ") end}
942 %sources %{lua: for i, s in ipairs(sources) do print(s.." ") end}
943
944 #------------------------------------------------------------------------------
945 # Useful perl macros (from Artur Frysiak <wiget@t17.ds.pwr.wroc.pl>)
946 #
947 # For example, these can be used as (from ImageMagick.spec from PLD site)
948 #       [...]
949 #       BuildPrereq: perl
950 #       [...]
951 #       %package perl
952 #       Summary: libraries and modules for access to ImageMagick from perl
953 #       Group: Development/Languages/Perl
954 #       Requires: %{name} = %{version}
955 #       %requires_eq    perl
956 #       [...]
957 #       %install
958 #       rm -fr $RPM_BUILD_ROOT
959 #       install -d $RPM_BUILD_ROOT/%{perl_sitearch}
960 #       [...]
961 #       %files perl
962 #       %defattr(644,root,root,755)
963 #       %{perl_sitearch}/Image
964 #       %dir %{perl_sitearch}/auto/Image
965 #
966 %requires_eq()  %(LC_ALL="C" echo '%*' | xargs -r rpm -q --qf 'Requires: %%{name} = %%{epoch}:%%{version}\\n' | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -v "is not")
967 %perl_sitearch  %(eval "`%{__perl} -V:installsitearch`"; echo $installsitearch)
968 %perl_sitelib   %(eval "`%{__perl} -V:installsitelib`"; echo $installsitelib)
969 %perl_vendorarch %(eval "`%{__perl} -V:installvendorarch`"; echo $installvendorarch)
970 %perl_vendorlib  %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib)
971 %perl_archlib   %(eval "`%{__perl} -V:installarchlib`"; echo $installarchlib)
972 %perl_privlib   %(eval "`%{__perl} -V:installprivlib`"; echo $installprivlib)
973
974 #------------------------------------------------------------------------------
975 # Useful python macros for determining python version and paths
976 #
977 %python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; import sys; sys.stdout.write(get_python_lib())")
978 %python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; import sys; sys.stdout.write(get_python_lib(1))")
979 %python_version %(%{__python} -c "import sys; sys.stdout.write(sys.version[:3])")
980
981 #------------------------------------------------------------------------------
982 # arch macro for all Intel i?86 compatibile processors
983 #  (Note: This macro (and it's analogues) will probably be obsoleted when
984 #   rpm can use regular expressions against target platforms in macro
985 #   conditionals.
986 #
987 %ix86   i386 i486 i586 i686 pentium3 pentium4 athlon geode
988
989 #------------------------------------------------------------------------------
990 # arch macro for all supported ARM processors
991 %arm    armv3l armv4b armv4l armv4tl armv5tel armv5tejl armv6l armv7l
992
993 #------------------------------------------------------------------------------
994 # arch macro for all supported Sparc processors
995 %sparc sparc sparcv8 sparcv9 sparcv9v sparc64 sparc64v
996
997 #------------------------------------------------------------------------------
998 # arch macro for all supported Alpha processors
999 %alpha  alpha alphaev56 alphaev6 alphaev67
1000
1001 #------------------------------------------------------------------------------
1002 # arch macro for all supported PowerPC 64 processors
1003 %power64        ppc64 ppc64p7
1004
1005 #------------------------------------------------------------------------
1006 # Use in %install to generate locale specific file lists. For example,
1007 #
1008 # %install
1009 # ...
1010 # %find_lang %{name}
1011 # ...
1012 # %files -f %{name}.lang
1013 #
1014 %find_lang      %{_rpmconfigdir}/find-lang.sh %{buildroot}
1015
1016 # Commands + opts to use for retrieving remote files
1017 # Proxy opts can be set through --httpproxy/--httpport popt aliases,
1018 # for any special local needs use %__urlhelper_localopts in system-wide
1019 # or per-user macro configuration.
1020 %__urlhelpercmd         @__CURL@
1021 %__urlhelperopts        --silent --show-error --fail --location -o
1022 %__urlhelper_proxyopts   %{?_httpproxy:--proxy %{_httpproxy}%{?_httpport::%{_httpport}}}%{!?_httpproxy:%{nil}}
1023 %_urlhelper             %{__urlhelpercmd} %{?__urlhelper_localopts} %{?__urlhelper_proxyopts} %{__urlhelperopts}
1024
1025 #------------------------------------------------------------------------------
1026 # Collection specific macros
1027 %__plugindir            %{_libdir}/rpm-plugins
1028 %__collection_font      %{__plugindir}/exec.so /usr/bin/fc-cache
1029 %__collection_java      %{__plugindir}/exec.so /usr/bin/rebuild-gcj-db
1030 %__collection_sepolicy          %{__plugindir}/sepolicy.so
1031 %__collection_sepolicy_flags    1
1032
1033 #------------------------------------------------------------------------------
1034 # Macros for further automated spec %setup and patch application
1035
1036 # default to plain patch
1037 %__scm patch
1038 # meh, figure something saner
1039 %__scm_author rpm-build <rpm-build>
1040
1041 # Plain patch (-m is unused)
1042 %__scm_setup_patch(q) %{nil}
1043 %__scm_apply_patch(qp:m:)\
1044 %{__patch} %{-p:-p%{-p*}} %{-q:-s}
1045
1046 # Mercurial (aka hg)
1047 %__scm_setup_hg(q)\
1048 %{__hg} init %{-q} .\
1049 %{__hg} add %{-q} .\
1050 %{__hg} commit %{-q} --user "%{__scm_author}" -m "%{name}-%{version} base"
1051
1052 %__scm_apply_hg(qp:m:)\
1053 %{__hg} import - %{-p:-p%{-p*}} %{-q} -m %{-m*} --user "%{__scm_author}"
1054
1055 # Git
1056 %__scm_setup_git(q)\
1057 %{__git} init %{-q}\
1058 %{__git} add .\
1059 %{__git} commit %{-q} -a\\\
1060         --author "%{__scm_author}" -m "%{name}-%{version} base"
1061
1062 %__scm_apply_git(qp:m:)\
1063 %{__git} apply %{-p:-p%{-p*}} -\
1064 %{__git} commit %{-q} -a -m %{-m*} --author "%{__scm_author}"
1065
1066 # Quilt
1067 %__scm_setup_quilt(q) %{nil}
1068 %__scm_apply_quilt(qp:m:)\
1069 %{__quilt} import %{-p:-p%{-p*}} %{1} && %{__quilt} push
1070
1071 # Bzr
1072 %__scm_setup_bzr(q)\
1073 %{__bzr} whoami "%{__scm_author}"\
1074 %{__bzr} init %{-q}\
1075 %{__bzr} add .\
1076 %{__bzr} commit %{-q} -m "%{name}-%{version} base"
1077
1078 # bzr doesn't seem to have its own command to apply patches?
1079 %__scm_apply_bzr(qp:m:)\
1080 %{__patch} %{-p:-p%{-p*}} %{-q:-s}\
1081 %{__bzr} commit %{-q} -m %{-m*}
1082
1083 # Single patch application
1084 %apply_patch(qp:m:)\
1085 %{uncompress:%{1}} | %{expand:%__scm_apply_%{__scm} %{-q} %{-p:-p%{-p*}} %{-m:-m%{-m*}}}
1086
1087 # Automatically apply all patches
1088 %autopatch(vp:)\
1089 %{lua:\
1090 for i, p in ipairs(patches) do\
1091     print(rpm.expand("%apply_patch -m %{basename:"..p.."}  "..rpm.expand("%{!-v:-q} %{-p:-p%{-p*}} ")..p.."\\n"))\
1092 end}
1093
1094 # One macro to (optionally) do it all.
1095 # -S<scm name>  Sets the used patch application style, eg '-S git' enables
1096 #               usage of git repository and per-patch commits.
1097 # -N            Disable automatic patch application
1098 # -p<num>       Use -p<num> for patch application       
1099 %autosetup(a:b:cDn:TvNS:p:)\
1100 %setup %{-a} %{-b} %{-c} %{-D} %{-n} %{-T} %{!-v:-q}\
1101 %{-S:%global __scm %{-S*}}\
1102 %{-S:%{expand:%__scm_setup_%{-S*} %{!-v:-q}}}\
1103 %{!-N:%autopatch %{-v} %{-p:-p%{-p*}}}
1104
1105 # \endverbatim
1106 #*/