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