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