msm related macros are defined in post scrpit of rpm-security-plugin
[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
183 %_find_debuginfo_opts %{?_rpm_strip_disable:--strip-disable}
184 %_find_debuginfo_strip_opts %{?_rpm_strip_option:\'--strip-option=%{_rpm_strip_option}\'}
185 %_find_debuginfo_ko_strip_opts %{?_rpm_ko_strip_option:\'--strip-ko-option=%{_rpm_ko_strip_option}\'}
186
187 %__debug_install_post   \
188    %{_rpmconfigdir}/find-debuginfo.sh %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_find_debuginfo_opts} %{?_find_debuginfo_strip_opts} %{?_find_debuginfo_ko_strip_opts} "%{_builddir}/%{?buildsubdir}"\
189 %{nil}
190
191 #       Template for debug information sub-package.
192 %debug_package \
193 %global __debug_package 1\
194 %package debugsource\
195 Summary: Debug sources for package %{name}\
196 Group: Development/Debug\
197 AutoReqProv: 0\
198 %description debugsource\
199 This package provides debug sources for package %{name}.\
200 Debug sources are useful when developing applications that use this\
201 package or when debugging this package.\
202 %files debugsource -f debugsources.list\
203 %defattr(-,root,root)\
204 %{nil}
205
206 %_defaultdocdir         %{_datadir}/doc/packages
207 %_defaultlicensedir     %{_datadir}/licenses
208 %_docdir_fmt          %%{NAME}
209
210 #       The path to the gzip executable (legacy, use %{__gzip} instead).
211 %_gzipbin               %{__gzip}
212
213 #       The Unix time of the latest kept changelog entry in binary packages.
214 #       Any older entry is not packaged in binary packages.
215 %_changelog_trimtime    0
216
217 #       The directory where newly built binary packages will be written.
218 %_rpmdir                %{_topdir}/RPMS
219
220 #       A template used to generate the output binary package file name
221 #       (legacy).
222 %_rpmfilename           %{_build_name_fmt}
223
224 #       The directory where sources/patches from a source package will be
225 #       installed. This is also where sources/patches are found when building.
226 %_sourcedir             %{_topdir}/SOURCES
227
228 #       The directory where the spec file from a source package will be
229 #       installed.
230 %_specdir               %{_topdir}/SPECS
231
232 #       The directory where newly built source packages will be written.
233 %_srcrpmdir             %{_topdir}/SRPMS
234
235 #       The directory where buildroots will be created.
236 %_buildrootdir          %{_topdir}/BUILDROOT
237
238 #       Build root path, where %install installs the package during build.
239 %buildroot              %{_buildrootdir}/%{name}-%{version}-%{release}.%{_arch}
240
241 #       Directory where temporaray files can be created.
242 %_tmppath               %{_var}/tmp
243
244 #       Path to top of build area.
245 %_topdir                %{expand:%%global _topdir %{lua:if posix.access(rpm.expand("%{_usrsrc}/packages"), "w") then print "%{_usrsrc}/packages" else print "%{getenv:HOME}/rpmbuild" end} \
246 }%_topdir
247
248 #       The path to the unzip executable (legacy, use %{__unzip} instead).
249 %_unzipbin              %{__unzip}
250
251 #==============================================================================
252 # ---- Optional rpmrc macros.
253 #       Macros that are initialized as a side effect of rpmrc and/or spec
254 #       file parsing.
255 #
256 #       The sub-directory (relative to %{_builddir}) where sources are compiled.
257 #       This macro is set after processing %setup, either explicitly from the
258 #       value given to -n or the default name-version.
259 #
260 #%buildsubdir
261
262 #       Configurable distribution information, same as Distribution: tag in a
263 #       specfile.
264 #
265 #%distribution
266
267 #       Configurable distribution URL, same as DistURL: tag in a specfile.
268 #       The URL will be used to supply reliable information to tools like
269 #       rpmfind.
270 #
271 # Note: You should not configure with disturl (or build packages with
272 # the DistURL: tag) unless you are willing to supply content in a
273 # yet-to-be-determined format at the URL specified.
274 #
275 #%disturl
276
277 #       Configurable bug URL, same as BugURL: tag in a specfile.
278 #       The URL will be used to supply reliable information to where
279 #       to file bugs.
280 #
281 #%bugurl
282
283 #       Boolean (i.e. 1 == "yes", 0 == "no") that controls whether files
284 #       marked as %doc should be installed.
285 #%_excludedocs
286
287 #       The port and machine name of a FTP proxy host running TIS firewall.
288 #
289 #%_ftpport
290 #%_ftpproxy
291
292 #       The signature to use and the location of configuration files for
293 #       signing packages with GNU gpg.
294 #
295 #%_gpg_name
296 #%_gpg_path
297
298 #       The port and machine name of an HTTP proxy host.
299 #
300 #%_httpport
301 #%_httpproxy
302
303 #       The PATH put into the environment before running %pre/%post et al.
304 #
305 %_install_script_path   /sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin
306
307 #       A colon separated list of desired locales to be installed;
308 #       "all" means install all locale specific files.
309 #       
310 %_install_langs all
311
312 #       The value of CLASSPATH in build scriptlets (iff configured).
313 #       
314 #%_javaclasspath        all
315
316 #       Import packaging conventions from jpackage.org (prefixed with _
317 #       to avoid name collisions).
318 #       
319 %_javadir      %{_datadir}/java
320 %_javadocdir   %{_datadir}/javadoc
321
322 #       A colon separated list of paths where files should *not* be installed.
323 #       Usually, these are network file system mount points.
324 #
325 #%_netsharedpath
326
327 #       (experimental)
328 #       The type of pattern match used on rpmdb iterator selectors:
329 #       "default"       simple glob-like regex, periods will be escaped,
330 #                       splats will have period prepended, full "^...$" match
331 #                       required. Also, file path tags will use glob(7).
332 #       "strcmp"        compare strings
333 #       "regex"         regex(7) patterns using regcomp(3)/regexec(3)
334 #       "glob"          glob(7) patterns using fnmatch(3)
335 #
336 %_query_selector_match  default
337
338 #       Configurable packager information, same as Packager: in a specfile.
339 #
340 #%packager
341
342 #       Compression type and level for source/binary package payloads.
343 #               "w9.gzdio"      gzip level 9 (default).
344 #               "w9.bzdio"      bzip2 level 9.
345 #               "w7.xzdio"      xz level 7, xz's default.
346 #               "w7.lzdio"      lzma-alone level 7, lzma's default
347 #
348 #%_source_payload       w9.gzdio
349 %_binary_payload        w5.lzdio
350
351 #       Algorithm to use for generating file checksum digests on build.
352 #       If not specified or 0, MD5 is used.
353 #       WARNING: non-MD5 is backwards incompatible, don't enable lightly!
354 #       The supported algorithms may depend on NSS version, as of NSS
355 #       3.11.99.5 the following are supported:
356 #       1       MD5 (default)
357 #       2       SHA1
358 #       8       SHA256
359 #       9       SHA384
360 #       10      SHA512
361 #
362 #%_source_filedigest_algorithm  1
363 #%_binary_filedigest_algorithm  1
364
365 #       Configurable vendor information, same as Vendor: in a specfile.
366 #
367 #%vendor
368
369 #       Default fuzz level for %patch in spec file.
370 %_default_patch_fuzz    0
371
372 #       Default patch flags
373 #%_default_patch_flags  -s
374
375 #==============================================================================
376 # ---- Build configuration macros.
377 #
378 # Script gets packaged file list on input and buildroot as first parameter.
379 # Returns list of unpackaged files, i.e. files in $RPM_BUILD_ROOT not packaged.
380 #
381 # Note: Disable (by commenting out) for legacy compatibility.
382 %__check_files         %{_rpmconfigdir}/check-files %{buildroot}
383
384 #
385 # Should unpackaged files in a build root terminate a build?
386 #
387 # Note: The default value should be 0 for legacy compatibility.
388 %_unpackaged_files_terminate_build      1
389
390 #
391 # Should missing %doc files in the build directory terminate a build?
392 #
393 # Note: The default value should be 0 for legacy compatibility.
394 %_missing_doc_files_terminate_build     1
395
396 #
397 # Should binaries in noarch packages terminate a build?
398 %_binaries_in_noarch_packages_terminate_build   1
399
400 #
401 # Should rpm try to download missing sources at build-time?
402 # Enabling this is dangerous as long as rpm has no means to validate
403 # the integrity of the download with a digest or signature.
404 %_disable_source_fetch 1
405
406 #
407 # Program to call for each successfully built and written binary package.
408 # The package name is passed to the program as a command-line argument.
409 #
410 #%_build_pkgcheck       %{_bindir}/rpmlint
411
412 #
413 # Program to call for the whole binary package set after build.
414 # The package set is passed to the program via command-line arguments.
415 #
416 #%_build_pkgcheck_set   %{_bindir}/rpmlint
417
418 #
419 # Program to call for successfully built and written SRPM.
420 # The package name is passed to the program as a command-line argument.
421 #
422 #%_build_pkgcheck_srpm  %{_bindir}/rpmlint
423
424 #
425 # Should the build of packages fail if package checker (if defined) returns
426 # non-zero exit status?
427 #
428 #%_nonzero_exit_pkgcheck_terminate_build        1
429
430 #
431 # Should an ELF file processed by find-debuginfo.sh having no build ID
432 # terminate a build?  This is left undefined to disable it and defined to
433 # enable.
434 #
435 #%_missing_build_ids_terminate_build    1
436
437 #
438 # Use internal dependency generator rather than external helpers?
439 %_use_internal_dependency_generator     1
440
441 #
442 # Filter GLIBC_PRIVATE Provides: and Requires:
443 %_filter_GLIBC_PRIVATE                  0
444
445 # Directories whose contents should be considered as documentation.
446 %__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
447
448 # maxnum,cuttime,minnum
449 # 2009/03/01 (SLES11 GA)
450 %_binarychangelogtrim 0,1235862000,10
451
452 #
453 # Path to scripts to autogenerate package dependencies,
454 #
455 %__set_helper_env %{lua:
456 posix.setenv("RPMBUILD_SPECFILE",rpm.expand("%?_specfile"));
457 posix.setenv("RPMBUILD_SOURCEDIR",rpm.expand("%?_sourcedir"));
458 }
459 # Note: Used iff _use_internal_dependency_generator is zero.
460 #%__find_provides       %{_rpmconfigdir}/rpmdeps --provides
461 #%__find_requires       %{_rpmconfigdir}/rpmdeps --requires
462 %__find_provides        %{__set_helper_env}%{_rpmconfigdir}/find-provides %name
463 %__find_requires        %{__set_helper_env}%{_rpmconfigdir}/find-requires %name
464 #%__find_conflicts      ???
465 #%__find_obsoletes      ???
466 %__find_supplements     %{__set_helper_env}%{_rpmconfigdir}/find-supplements %name
467 #%__find_enhances       ???
468
469
470 # Path to file attribute classifications for automatic dependency 
471 # extraction, used when _use_internal_dependency_generator
472 # is used (on by default). Files can have any number of attributes
473 # attached to them, and dependencies are separately extracted for
474 # each attribute.
475
476 # To define a new file attribute called "myattr", add a file named
477 # "myattr" to this directory, defining the requires and/or provides
478 # finder script(s) + magic and/or path pattern regex(es).
479 # provides finder and 
480 # %__myattr_requires    path + args to requires finder script for <myattr>
481 # %__myattr_provides    path + args to provides finder script for <myattr>
482 # %__myattr_magic       libmagic classification match regex
483 # %__myattr_path        path based classification match regex
484 # %__myattr_flags       flags to control behavior (just "exeonly" for now)
485 # %__myattr_exclude_magic       exclude by magic regex
486 # %__myattr_exclude_path        exclude by path regex
487 #
488 %_fileattrsdir          %{_rpmconfigdir}/fileattrs
489
490 #==============================================================================
491 # ---- Database configuration macros.
492 #       Macros used to configure Berkley db parameters.
493 #
494 # rpmdb macro configuration values are a colon (or white space) separated
495 # list of tokens, with an optional '!' negation to explicitly disable bit
496 # values, or a "=value" if a parameter. A per-tag value is used (e.g.
497 # %_dbi_config_Packages) if defined, otherwise a per-rpmdb default
498 # (e.g. %_dbi_config).
499 #
500 # Here's a short list of the tokens, with a guess of whether the option is
501 # useful:
502 #       (nothing)       currently used in rpm, known to work.
503 #       "+++"           under development, will be supported in rpm eventually.
504 #       "???"           I have no clue, you're mostly on your own.
505 #
506 # If you do find yourself inclined to fiddle, here's what I see (shrug):
507 # 1) Only the value of mp_size has any serious impact on overall performance,
508 #    and you will need ~256Kb to handle a typical machine install.
509 # 2) Only the Packages hash, because of the size of the values (i.e. headers),
510 #    will ever need tuning. Diddle the pagesize if you're interested, although
511 #    I believe that you will find pagesize=512 "best".
512 # 3) Adding nofsync increases speed, but risks total data loss. Fiddle shared
513 #    and/or mp_size instead.
514 #
515 #   token       works?  Berkeley db flag or value
516 #==================================================
517 #---------------------- DBENV tunable values:
518 #   mmapsize=16Mb       DBENV->set_mp_mmapsize
519 #   cachesize=1Mb       DBENV->set_cachesize, DB->set_cachesize
520 #---------------------- DB->open bits:
521 #   nommap      ???     DB_NOMMAP
522 #----------------------- rpmdb specific configuration:
523 #   lockdbfd            (always on for Packages) Use fcntl(2) locking ?
524 #   nofsync             Disable fsync(2) call performed after db3 writes?
525 #
526
527 # Misc BDB tuning options
528 %__dbi_other                    mp_mmapsize=128Mb mp_size=1Mb
529
530 %_dbi_config                    %{?__dbi_other} nofsync
531
532 # "Packages" should have shared/exclusive fcntl(2) lock using "lockdbfd".
533 %_dbi_config_Packages           %{?__dbi_other} lockdbfd
534
535 #==============================================================================
536 # ---- GPG/PGP/PGP5 signature macros.
537 #       Macro(s) to hold the arguments passed to GPG/PGP for package
538 #       signing and verification.
539 #
540 %__gpg_check_password_cmd       %{__gpg} \
541         gpg --batch --no-verbose --passphrase-fd 3 -u "%{_gpg_name}" -so -
542
543 %__gpg_sign_cmd                 %{__gpg} \
544         gpg --batch --no-verbose --no-armor --passphrase-fd 3 \
545         %{?_gpg_digest_algo:--digest-algo %{_gpg_digest_algo}} \
546         --no-secmem-warning \
547         -u "%{_gpg_name}" -sbo %{__signature_filename} %{__plaintext_filename}
548
549 # XXX rpm >= 4.1 verifies signatures internally
550 #%__gpg_verify_cmd              %{__gpg} \
551 #       gpg --batch --no-verbose --verify --no-secmem-warning \
552 #       %{__signature_filename} %{__plaintext_filename}
553 #
554 # XXX rpm-4.1 verifies prelinked libraries using a prelink undo helper.
555 #       Normally this macro is defined in /etc/rpm/macros.prelink, installed
556 #       with the prelink package. If the macro is undefined, then prelinked
557 #       shared libraries contents are MD5 digest verified (as usual), rather
558 #       than MD5 verifying the output of the prelink undo helper.
559 #
560 #       Note: The 2nd token is used as argv[0] and "library" is a
561 #       placeholder that will be deleted and replaced with the appropriate
562 #       library file path.
563 #%__prelink_undo_cmd     /usr/sbin/prelink prelink -y library
564
565 # Horowitz Key Protocol server configuration
566 #
567 %_hkp_keyserver         http://pgp.mit.edu
568 %_hkp_keyserver_query   %{_hkp_keyserver}:11371/pks/lookup?op=get&search=0x
569
570 #==============================================================================
571 # ---- Transaction macros.
572 #       Macro(s) used to parameterize transactions.
573 #
574 #       The output binary package file name template used when building
575 #       binary packages.
576 #
577 # XXX   Note: escaped %% for use in headerSprintf()
578 %_build_name_fmt        %%{ARCH}/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
579
580 #       Verify digest/signature flags for various rpm modes:
581 #       0x30300 (_RPMVSF_NODIGESTS)    --nohdrchk      if set, don't check digest(s)
582 #       0xc0c00 (_RPMVSF_NOSIGNATURES) --nosignature   if set, don't check signature(s)
583 #       0xf0000 (_RPMVSF_NOPAYLOAD)    --nolegacy      if set, check header+payload (if possible)
584 #       0x00f00 (_RPMVSF_NOHEADER)     --nohdrchk      if set, don't check rpmdb headers
585 #
586 #       For example, the value 0xf0c00 (=0xf0000+0xc0c00) disables legacy
587 #       digest/signature checking, disables signature checking, but attempts
588 #       digest checking, also when retrieving headers from the database.
589 #
590 #       You also can do:
591 #        >>> hex(rpm._RPMVSF_NOSIGNATURES)
592 #        '0xc0c00'
593 #       or:
594 #        >>> hex(rpm._RPMVSF_NOSIGNATURES|rpm._RPMVSF_NOPAYLOAD)
595 #        '0xf0c00'
596 #       at the python prompt for example, after "import rpm".
597 #
598 #       The checking overhead is ~11ms per header for digests/signatures;
599 #       each header from the database is checked only when first encountered
600 #       for each database open.
601 #
602 #       Note: the %_vsflags_erase applies to --upgrade/--freshen modes as
603 #       well as --erase.
604 #
605 %__vsflags              0xf0000
606 %_vsflags_build         %{__vsflags}
607 %_vsflags_erase         %{__vsflags}
608 %_vsflags_install       %{__vsflags}
609 %_vsflags_query         %{__vsflags}
610 %_vsflags_rebuilddb     0xc0c00
611 %_vsflags_verify        %{__vsflags}
612
613 #
614 # Default output format string for rpm -qa
615 #
616 # XXX   Note: escaped %% for use in headerFormat()
617 %_query_all_fmt         %%{nvra}
618
619 #
620 # Default path to the file used for transaction fcntl lock.
621 %_rpmlock_path  %{_dbpath}/.rpm.lock
622
623 #
624 # ISA dependency marker, none for noarch and name-bitness for others
625 %_isa                   %{?__isa:(%{__isa})}%{!?__isa:%{nil}}
626
627 #
628 # Define per-arch and per-os defaults. Normally overridden by per-target macros.
629 %__arch_install_post    %{nil}
630 %__os_install_post      %{___build_post}
631
632 # Macro to fix broken permissions in sources
633 %_fixperms      %{__chmod} -Rf @FIXPERMS@
634
635 #==============================================================================
636 # ---- Scriptlet template templates.
637 #       Global defaults used for building scriptlet templates.
638 #
639
640 %___build_shell         %{?_buildshell:%{_buildshell}}%{!?_buildshell:/bin/sh}
641 %___build_args          -e
642 %___build_cmd           %{?_sudo:%{_sudo} }%{?_remsh:%{_remsh} %{_remhost} }%{?_remsudo:%{_remsudo} }%{?_remchroot:%{_remchroot} %{_remroot} }%{___build_shell} %{___build_args}
643 %___build_pre   \
644   RPM_SOURCE_DIR=\"%{u2p:%{_sourcedir}}\"\
645   RPM_BUILD_DIR=\"%{u2p:%{_builddir}}\"\
646   RPM_OPT_FLAGS=\"%{optflags}\"\
647   RPM_ARCH=\"%{_arch}\"\
648   RPM_OS=\"%{_os}\"\
649   export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
650   RPM_DOC_DIR=\"%{_docdir}\"\
651   export RPM_DOC_DIR\
652   RPM_PACKAGE_NAME=\"%{name}\"\
653   RPM_PACKAGE_VERSION=\"%{version}\"\
654   RPM_PACKAGE_RELEASE=\"%{release}\"\
655   export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
656   LANG=C\
657   export LANG\
658   unset CDPATH DISPLAY ||:\
659   %{?buildroot:RPM_BUILD_ROOT=\"%{u2p:%{buildroot}}\"\
660   export RPM_BUILD_ROOT}\
661   %{?_javaclasspath:CLASSPATH=\"%{_javaclasspath}\"\
662   export CLASSPATH}\
663   \
664   %{verbose:set -x}%{!verbose:exec > /dev/null}\
665   umask 022\
666   cd \"%{u2p:%{_builddir}}\"\
667
668
669 #%___build_body         %{nil}
670 %___build_post          exit 0
671
672 %___build_template      #!%{___build_shell}\
673 %{___build_pre}\
674 %{nil}
675
676 #%{___build_body}\
677 #%{___build_post}\
678 #%{nil}
679
680 #==============================================================================
681 # ---- Scriptlet templates.
682 #       Macro(s) that expand to a command and script that is executed.
683 #       CAVEAT: All macro expansions must fit in a BUFSIZ (8192 byte) buffer.
684 #
685 %__spec_prep_shell      %{___build_shell}
686 %__spec_prep_args       %{___build_args}
687 %__spec_prep_cmd        %{___build_cmd}
688 %__spec_prep_pre        %{___build_pre}
689 %__spec_prep_body       %{___build_body}
690 %__spec_prep_post       %{___build_post}
691 %__spec_prep_template   #!%{__spec_prep_shell}\
692 %{__spec_prep_pre}\
693 %{nil}
694
695 #%{__spec_prep_body}\
696 #%{__spec_prep_post}\
697 #%{nil}
698
699 %__spec_build_shell     %{___build_shell}
700 %__spec_build_args      %{___build_args}
701 %__spec_build_cmd       %{___build_cmd}
702 %__spec_build_pre       %{___build_pre}
703 %__spec_build_body      %{___build_body}
704 %__spec_build_post      %{___build_post}
705 %__spec_build_template  #!%{__spec_build_shell}\
706 %{__spec_build_pre}\
707 %{nil}
708
709 #%{__spec_build_body}\
710 #%{__spec_build_post}\
711 #%{nil}
712
713 %__spec_install_shell   %{___build_shell}
714 %__spec_install_args    %{___build_args}
715 %__spec_install_cmd     %{___build_cmd}
716 %__spec_install_pre     %{___build_pre}
717 %__spec_install_body    %{___build_body}
718 %__spec_install_post\
719 %{?__debug_package:%{__debug_install_post}}\
720 %{__arch_install_post}\
721 %{__os_install_post}\
722 %{nil}
723 %__spec_install_template        #!%{__spec_install_shell}\
724 %{__spec_install_pre}\
725 %{nil}
726
727 #%{__spec_install_body}\
728 #%{__spec_install_post}\
729 #%{nil}
730
731 %__spec_check_shell     %{___build_shell}
732 %__spec_check_args      %{___build_args}
733 %__spec_check_cmd       %{___build_cmd}
734 %__spec_check_pre       %{___build_pre}
735 %__spec_check_body      %{___build_body}
736 %__spec_check_post      %{___build_post}
737 %__spec_check_template  #!%{__spec_check_shell}\
738 %{__spec_check_pre}\
739 %{nil}
740
741 #%{__spec_check_body}\
742 #%{__spec_check_post}\
743 #%{nil}
744
745 #%__spec_autodep_shell  %{___build_shell}
746 #%__spec_autodep_args   %{___build_args}
747 #%__spec_autodep_cmd    %{___build_cmd}
748 #%__spec_autodep_pre    %{___build_pre}
749 #%__spec_autodep_body   %{___build_body}
750 #%__spec_autodep_post   %{___build_post}
751 #%__spec_autodep_template       #!%{__spec_autodep_shell}\
752 #%{__spec_autodep_pre}\
753 #%{nil}
754
755 #%{__spec_autodep_body}\
756 #%{__spec_autodep_post}\
757 #%{nil}
758
759 %__spec_clean_shell     %{___build_shell}
760 %__spec_clean_args      %{___build_args}
761 %__spec_clean_cmd       %{___build_cmd}
762 %__spec_clean_pre       %{___build_pre}
763 %__spec_clean_body      %{___build_body}
764 %__spec_clean_post      %{___build_post}
765 %__spec_clean_template  #!%{__spec_clean_shell}\
766 %{__spec_clean_pre}\
767 %{nil}
768
769 #%{__spec_clean_body}\
770 #%{__spec_clean_post}\
771 #%{nil}
772
773 %__spec_rmbuild_shell   %{___build_shell}
774 %__spec_rmbuild_args    %{___build_args}
775 %__spec_rmbuild_cmd     %{___build_cmd}
776 %__spec_rmbuild_pre     %{___build_pre}
777 %__spec_rmbuild_body    %{___build_body}
778 %__spec_rmbuild_post    %{___build_post}
779 %__spec_rmbuild_template        #!%{__spec_rmbuild_shell}\
780 %{__spec_rmbuild_pre}\
781 %{nil}
782
783 #%{__spec_rmbuild_body}\
784 #%{__spec_rmbuild_post}\
785 #%{nil}
786
787 # XXX We don't expand pre/post install scriptlets (yet).
788 #%__spec_pre_pre                %{nil}
789 #%__spec_pre_post               %{nil}
790 #%__spec_post_pre               %{nil}
791 #%__spec_post_post              %{nil}
792 #%__spec_preun_pre              %{nil}
793 #%__spec_preun_post             %{nil}
794 #%__spec_postun_pre             %{nil}
795 #%__spec_postun_post            %{nil}
796 #%__spec_triggerpostun_pre      %{nil}
797 #%__spec_triggerpostun_post     %{nil}
798 #%__spec_triggerun_pre          %{nil}
799 #%__spec_triggerun_post         %{nil}
800 #%__spec_triggerin_pre          %{nil}
801 #%__spec_triggerin_post         %{nil}
802
803 #==============================================================================
804 # ---- configure macros.
805 #       Macro(s) slavishly copied from autoconf's config.status.
806 #
807 %_prefix                @prefix@
808 %_exec_prefix           %{_prefix}
809 %_bindir                %{_exec_prefix}/bin
810 %_sbindir               %{_exec_prefix}/sbin
811 %_libexecdir            %{_exec_prefix}/libexec
812 %_datadir               %{_prefix}/share
813 %_sysconfdir            /etc
814 %_sharedstatedir        %{_prefix}/com
815 %_localstatedir         %{_prefix}/var
816 %_lib                   lib
817 %_libdir                %{_exec_prefix}/%{_lib}
818 %_includedir            %{_prefix}/include
819 %_infodir               %{_datadir}/info
820 %_mandir                %{_datadir}/man
821
822 #==============================================================================
823 # ---- config.guess platform macros.
824 #       Macro(s) similar to the tokens used by configure.
825 #
826 %_build                 %{_host}
827 %_build_alias           %{_host_alias}
828 %_build_cpu             %{_host_cpu}
829 %_build_vendor          %{_host_vendor}
830 %_build_os              %{_host_os}
831 %_host                  @host@
832 %_host_alias            @host@%{nil}
833 %_host_cpu              @host_cpu@
834 %_host_vendor           @host_vendor@
835 %_host_os               @host_os@
836 %_target                %{_host}
837 %_target_alias          %{_host_alias}
838 %_target_cpu            %{_host_cpu}
839 %_target_vendor         %{_host_vendor}
840 %_target_os             %{_host_os}
841
842 #==============================================================================
843 # ---- specfile macros.
844 #       Macro(s) here can be used reliably for reproducible builds.
845 #       (Note: Above is the goal, below are the macros under development)
846 #
847 # The configure macro runs autoconf configure script with platform specific
848 # directory structure (--prefix, --libdir etc) and compiler flags
849 # such as CFLAGS.
850 #
851 # The configure macro should be invoked as %configure (rather than %{configure})
852 # because the rest of the arguments will be expanded using %*.
853 #
854 %_configure ./configure
855 %configure \
856   CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
857   CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
858   FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS ; \
859   %{_configure} --host=%{_host} --build=%{_build} \\\
860         --program-prefix=%{?_program_prefix} \\\
861         --disable-dependency-tracking \\\
862         --prefix=%{_prefix} \\\
863         --exec-prefix=%{_exec_prefix} \\\
864         --bindir=%{_bindir} \\\
865         --sbindir=%{_sbindir} \\\
866         --sysconfdir=%{_sysconfdir} \\\
867         --datadir=%{_datadir} \\\
868         --includedir=%{_includedir} \\\
869         --libdir=%{_libdir} \\\
870         --libexecdir=%{_libexecdir} \\\
871         --localstatedir=%{_localstatedir} \\\
872         --sharedstatedir=%{_sharedstatedir} \\\
873         --mandir=%{_mandir} \\\
874         --infodir=%{_infodir} \\\
875         --disable-dependency-tracking
876
877 #------------------------------------------------------------------------------
878 # The make install analogue of %configure for modern autotools:
879 %make_install %{__make} install DESTDIR=%{?buildroot}
880
881 #------------------------------------------------------------------------------
882 # Former make install analogue, kept for compatibility and for old/broken
883 #  packages that don't support DESTDIR properly.
884 %makeinstall \
885   %{__make} \\\
886         prefix=%{?buildroot:%{buildroot}}%{_prefix} \\\
887         exec_prefix=%{?buildroot:%{buildroot}}%{_exec_prefix} \\\
888         bindir=%{?buildroot:%{buildroot}}%{_bindir} \\\
889         sbindir=%{?buildroot:%{buildroot}}%{_sbindir} \\\
890         sysconfdir=%{?buildroot:%{buildroot}}%{_sysconfdir} \\\
891         datadir=%{?buildroot:%{buildroot}}%{_datadir} \\\
892         includedir=%{?buildroot:%{buildroot}}%{_includedir} \\\
893         libdir=%{?buildroot:%{buildroot}}%{_libdir} \\\
894         libexecdir=%{?buildroot:%{buildroot}}%{_libexecdir} \\\
895         localstatedir=%{?buildroot:%{buildroot}}%{_localstatedir} \\\
896         sharedstatedir=%{?buildroot:%{buildroot}}%{_sharedstatedir} \\\
897         mandir=%{?buildroot:%{buildroot}}%{_mandir} \\\
898         infodir=%{?buildroot:%{buildroot}}%{_infodir} \\\
899   install
900
901 #------------------------------------------------------------------------------
902 # The GNUconfigure macro does the following:
903 #       update config.guess and config.sub.
904 #       regenerate all autoconf/automake files
905 #       optionally change to a directory (make the directory if requested).
906 #       run configure with correct prefix, platform, and CFLAGS.
907 #       optionally restore current directory.
908 #
909 # Based on autogen.sh from GNOME and orginal GNUconfigure
910 #
911 %GNUconfigure(MCs:)      \
912   CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS; \
913   LDFLAGS="${LDFLAGS:-%{-s:-s}}"  ; export LDFLAGS; \
914   %{-C:_mydir="`pwd`"; %{-M: %{__mkdir} -p %{-C*};} cd %{-C*}} \
915   dirs="`find ${_mydir} -name configure.in -print`"; export dirs; \
916     for coin in `echo ${dirs}` \
917 do \
918   dr=`dirname ${coin}`; \
919 if test -f ${dr}/NO-AUTO-GEN; then \
920  : \
921 else \
922      macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < ${coin}`; \
923     ( cd ${dr}; \
924       aclocalinclude="${ACLOCAL_FLAGS}"; \
925       for k in ${macrodirs}; do \
926         if test -d ${k}; then \
927           aclocalinclude="${aclocalinclude} -I ${k}"; \
928         ##else \
929         ##  echo "**Warning**: No such directory \`${k}'.  Ignored." \
930         fi \
931       done \
932       if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then \
933         if grep "sed.*POTFILES" configure.in >/dev/null; then \
934           : do nothing -- we still have an old unmodified configure.in \
935         else \
936           test -r ${dr}/aclocal.m4 || touch ${dr}/aclocal.m4; \
937           echo "no" | gettextize --force --copy; \
938           test -r ${dr}/aclocal.m4 && %{__chmod} u+w ${dr}/aclocal.m4; \
939         fi \
940       fi \
941       if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then \
942         %{__libtoolize} --force --copy; \
943       fi \
944       aclocal ${aclocalinclude}; \
945       if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then \
946         %{__autoheader}; \
947       fi \
948       echo "Running automake --gnu ${am_opt} ..."; \
949       %{__automake} --add-missing --gnu ${am_opt}; \
950       %{__autoconf}; \
951     ); \
952   fi \
953 done \
954   %{-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} %* ; \
955   %{-C:cd ${_mydir}; unset _mydir}
956
957 %patches %{lua: for i, p in ipairs(patches) do print(p.." ") end}
958 %sources %{lua: for i, s in ipairs(sources) do print(s.." ") end}
959
960 #------------------------------------------------------------------------------
961 # Useful perl macros (from Artur Frysiak <wiget@t17.ds.pwr.wroc.pl>)
962 #
963 # For example, these can be used as (from ImageMagick.spec from PLD site)
964 #       [...]
965 #       BuildPrereq: perl
966 #       [...]
967 #       %package perl
968 #       Summary: libraries and modules for access to ImageMagick from perl
969 #       Group: Development/Languages/Perl
970 #       Requires: %{name} = %{version}
971 #       %requires_eq    perl
972 #       [...]
973 #       %install
974 #       rm -fr $RPM_BUILD_ROOT
975 #       install -d $RPM_BUILD_ROOT/%{perl_sitearch}
976 #       [...]
977 #       %files perl
978 #       %defattr(644,root,root,755)
979 #       %{perl_sitearch}/Image
980 #       %dir %{perl_sitearch}/auto/Image
981 #
982 %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")
983 %perl_sitearch  %(eval "`%{__perl} -V:installsitearch`"; echo $installsitearch)
984 %perl_sitelib   %(eval "`%{__perl} -V:installsitelib`"; echo $installsitelib)
985 %perl_vendorarch %(eval "`%{__perl} -V:installvendorarch`"; echo $installvendorarch)
986 %perl_vendorlib  %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib)
987 %perl_archlib   %(eval "`%{__perl} -V:installarchlib`"; echo $installarchlib)
988 %perl_privlib   %(eval "`%{__perl} -V:installprivlib`"; echo $installprivlib)
989
990 #------------------------------------------------------------------------------
991 # Useful python macros for determining python version and paths
992 #
993 %python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; import sys; sys.stdout.write(get_python_lib())")
994 %python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; import sys; sys.stdout.write(get_python_lib(1))")
995 %python_version %(%{__python} -c "import sys; sys.stdout.write(sys.version[:3])")
996
997 # More useful perl macros (from Raul Dias <rsd@swi.com.br>)
998 #
999 %perl_version           %(perl -V:version | sed "s!.*='!!;s!'.*!!")
1000 %perl_man1ext           %(perl -V:man1ext | sed "s!.*='!!;s!'.*!!")
1001 %perl_man3ext           %(perl -V:man3ext | sed "s!.*='!!;s!'.*!!")
1002 %perl_man1dir           %(perl -V:man1dir | sed "s!.*='!!;s!'.*!!")
1003 %perl_man3dir           %(perl -V:man3dir | sed "s!.*='!!;s!'.*!!")
1004 %perl_installman1dir    %(perl -V:installman1dir | sed "s!.*='!!;s!'.*!!")
1005 %perl_installman3dir    %(perl -V:installman3dir | sed "s!.*='!!;s!'.*!!")
1006 %perl_installarchlib    %(perl -V:installarchlib | sed "s!.*='!!;s!'.*!!")
1007 %perl_prefix            %{buildroot}
1008
1009 #------------------------------------------------------------------------------
1010 # Python specific macro definitions (originally from PLD).
1011 #
1012 %py_ver                 %(python -c "import sys; v=sys.version_info[:2]; print '%%d.%%d'%%v" 2>/dev/null || echo PYTHON-NOT-FOUND)
1013 %py_prefix              %(python -c "import sys; print sys.prefix" 2>/dev/null || echo PYTHON-NOT-FOUND)
1014 %py_libdir              %{py_prefix}/%{_lib}/python%{py_ver}
1015 %py_incdir              %{py_prefix}/include/python%{py_ver}
1016 %py_sitedir             %{py_libdir}/site-packages
1017 %py_compile(O)  \
1018 find %1 -name '*.pyc' -exec rm -f {} \\; \
1019 python -c "import sys, os, compileall; br='%{buildroot}'; compileall.compile_dir(sys.argv[1], ddir=br and (sys.argv[1][len(os.path.abspath(br)):]+'/') or None)" %1 \
1020 %{-O: \
1021 find %1 -name '*.pyo' -exec rm -f {} \\; \
1022 python -O -c "import sys, os, compileall; br='%{buildroot}'; compileall.compile_dir(sys.argv[1], ddir=br and (sys.argv[1][len(os.path.abspath(br)):]+'/') or None)" %1 \
1023 }
1024 %py_requires(d) \
1025 %define minver %py_ver \
1026 %define maxver %(python -c "import sys; a,b=sys.version_info[:2]; print '%%d.%%d'%%(a,b+1)" 2>/dev/null || echo PYTHON-NOT-FOUND) \
1027 BuildRequires: python %{-d:python-devel} \
1028 PreReq: python >= %minver, python < %maxver
1029
1030
1031 #------------------------------------------------------------------------------
1032 # arch macro for all Intel i?86 compatibile processors
1033 #  (Note: This macro (and it's analogues) will probably be obsoleted when
1034 #   rpm can use regular expressions against target platforms in macro
1035 #   conditionals.
1036 #
1037 %ix86   i386 i486 i586 i686 pentium3 pentium4 athlon geode
1038
1039 #------------------------------------------------------------------------------
1040 # arch macro for all supported ARM processors
1041 %arm    armv3l armv4b armv4l armv4tl armv5b armv5l armv5teb armv5tel armv5tejl armv6l armv7l armv7hl
1042 %arml   armv3l armv4l armv5l armv5tel armv6l armv7l armv7hl
1043 %armb   armv4b armv5b armv5teb
1044
1045 #------------------------------------------------------------------------------
1046 # arch macro for all supported Sparc processors
1047 %sparc sparc sparcv8 sparcv9 sparcv9v sparc64 sparc64v
1048
1049 #------------------------------------------------------------------------------
1050 # arch macro for all supported Alpha processors
1051 %alpha  alpha alphaev56 alphaev6 alphaev67
1052
1053 #------------------------------------------------------------------------------
1054 # arch macro for all supported PowerPC 64 processors
1055 %power64        ppc64 ppc64p7
1056
1057 #------------------------------------------------------------------------
1058 # Use in %install to generate locale specific file lists. For example,
1059 #
1060 # %install
1061 # ...
1062 # %find_lang %{name}
1063 # ...
1064 # %files -f %{name}.lang
1065 #
1066 %find_lang      %{_rpmconfigdir}/find-lang.sh %{buildroot}
1067 %no_lang_C  --without-C
1068
1069
1070 # Commands + opts to use for retrieving remote files
1071 # Proxy opts can be set through --httpproxy/--httpport popt aliases,
1072 # for any special local needs use %__urlhelper_localopts in system-wide
1073 # or per-user macro configuration.
1074 %__urlhelpercmd         @__CURL@
1075 %__urlhelperopts        --silent --show-error --fail --location -o
1076 %__urlhelper_proxyopts   %{?_httpproxy:--proxy %{_httpproxy}%{?_httpport::%{_httpport}}}%{!?_httpproxy:%{nil}}
1077 %_urlhelper             %{__urlhelpercmd} %{?__urlhelper_localopts} %{?__urlhelper_proxyopts} %{__urlhelperopts}
1078
1079 #------------------------------------------------------------------------------
1080 # Collection specific macros
1081 %__plugindir            %{_libdir}/rpm-plugins
1082 %__collection_font      %{__plugindir}/exec.so /usr/bin/fc-cache
1083 %__collection_java      %{__plugindir}/exec.so /usr/bin/rebuild-gcj-db
1084 %__collection_sepolicy          %{__plugindir}/sepolicy.so
1085 %__collection_sepolicy_flags    1
1086
1087 #------------------------------------------------------------------------------
1088 # transaction specific macros
1089 #%__transaction_plugins     msm
1090 #%__plugindir                           %{_libdir}/rpm-plugins
1091 #%__transaction_msm                     %{__plugindir}/msm.so
1092 #%__transaction_msm_default_policy      %{_libdir}/rpm-plugins/msm-device-sec-policy
1093 #------------------------------------------------------------------------------
1094 # Macros for further automated spec %setup and patch application
1095
1096 # default to plain patch
1097 %__scm patch
1098 # meh, figure something saner
1099 %__scm_username rpm-build
1100 %__scm_usermail <rpm-build>
1101 %__scm_author %{__scm_username} %{__scm_usermail}
1102
1103 # Plain patch (-m is unused)
1104 %__scm_setup_patch(q) %{nil}
1105 %__scm_apply_patch(qp:m:)\
1106 %{__patch} %{-p:-p%{-p*}} %{-q:-s}
1107
1108 # Mercurial (aka hg)
1109 %__scm_setup_hg(q)\
1110 %{__hg} init %{-q} .\
1111 %{__hg} add %{-q} .\
1112 %{__hg} commit %{-q} --user "%{__scm_author}" -m "%{name}-%{version} base"
1113
1114 %__scm_apply_hg(qp:m:)\
1115 %{__hg} import - %{-p:-p%{-p*}} %{-q} -m %{-m*} --user "%{__scm_author}"
1116
1117 # Git
1118 %__scm_setup_git(q)\
1119 %{__git} init %{-q}\
1120 %{__git} config user.name "%{__scm_username}"\
1121 %{__git} config user.email "%{__scm_usermail}"\
1122 %{__git} add .\
1123 %{__git} commit %{-q} -a\\\
1124         --author "%{__scm_author}" -m "%{name}-%{version} base"
1125
1126 %__scm_apply_git(qp:m:)\
1127 %{__git} apply %{-p:-p%{-p*}} -\
1128 %{__git} commit %{-q} -a -m %{-m*} --author "%{__scm_author}"
1129
1130 # Quilt
1131 %__scm_setup_quilt(q) %{nil}
1132 %__scm_apply_quilt(qp:m:)\
1133 %{__quilt} import %{-p:-p%{-p*}} %{1} && %{__quilt} push
1134
1135 # Bzr
1136 %__scm_setup_bzr(q)\
1137 %{__bzr} init %{-q}\
1138 %{__bzr} whoami --branch "%{__scm_author}"\
1139 %{__bzr} add .\
1140 %{__bzr} commit %{-q} -m "%{name}-%{version} base"
1141
1142 # bzr doesn't seem to have its own command to apply patches?
1143 %__scm_apply_bzr(qp:m:)\
1144 %{__patch} %{-p:-p%{-p*}} %{-q:-s}\
1145 %{__bzr} commit %{-q} -m %{-m*}
1146
1147 # Single patch application
1148 %apply_patch(qp:m:)\
1149 %{uncompress:%{1}} | %{expand:%__scm_apply_%{__scm} %{-q} %{-p:-p%{-p*}} %{-m:-m%{-m*}}}
1150
1151 # Automatically apply all patches
1152 %autopatch(vp:)\
1153 %{lua:\
1154 for i, p in ipairs(patches) do\
1155     print(rpm.expand("%apply_patch -m %{basename:"..p.."}  "..rpm.expand("%{!-v:-q} %{-p:-p%{-p*}} ")..p.."\\n"))\
1156 end}
1157
1158 # One macro to (optionally) do it all.
1159 # -S<scm name>  Sets the used patch application style, eg '-S git' enables
1160 #               usage of git repository and per-patch commits.
1161 # -N            Disable automatic patch application
1162 # -p<num>       Use -p<num> for patch application       
1163 %autosetup(a:b:cDn:TvNS:p:)\
1164 %setup %{-a} %{-b} %{-c} %{-D} %{-n} %{-T} %{!-v:-q}\
1165 %{-S:%global __scm %{-S*}}\
1166 %{-S:%{expand:%__scm_setup_%{-S*} %{!-v:-q}}}\
1167 %{!-N:%autopatch %{-v} %{-p:-p%{-p*}}}
1168
1169 # \endverbatim
1170 #*/
1171
1172
1173 #------------------------------------------------------------------------
1174 # standard build service macros
1175 #
1176 %ext_info .gz
1177 %ext_man .gz
1178
1179 %info_add() test -x /sbin/install-info -a -f %{?2}%{?!2:%{_infodir}}/%{1}%ext_info && /sbin/install-info --info-dir=%{?2}%{?!2:%{_infodir}} %{?2}%{?!2:%{_infodir}}/%{1}%ext_info \
1180 %{nil}
1181
1182 %info_del() test -x /sbin/install-info -a ! -f %{?2}%{?!2:%{_infodir}}/%{1}%ext_info && /sbin/install-info --quiet --delete --info-dir=%{?2}%{?!2:%{_infodir}} %{?2}%{?!2:%{_infodir}}/%{1}%ext_info \
1183 %{nil}
1184
1185 %user_group_add() \
1186 /usr/sbin/groupadd -o -r %{1} 2>/dev/null || :\
1187 /usr/sbin/useradd -o -r -g %{1} -d %{2} -s %{3} -c %{4} %{1} 2>/dev/null || :\
1188 %{nil}
1189