1 #/*! \page config_macros Default configuration: @RPMCONFIGDIR@/macros
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.
9 #==============================================================================
10 # Macro naming conventions (preliminary):
12 # Macros that begin with an underscore are "local" in the sense that
13 # they (if used) will not be exported in rpm headers. Some macros
14 # that don't start with an underscore (but look like they should)
15 # are compatible with macros generated by rpm-2.5.x and will be made
16 # more consistent in a future release.
19 #==============================================================================
20 # ---- A macro that expands to nothing.
24 #==============================================================================
25 # ---- filesystem macros.
31 #==============================================================================
32 # ---- Generally useful path macros.
49 %__install @__INSTALL@
53 # Deprecated, use %__xz instead.
54 %__lzma %__xz --format=lzma
58 %__mkdir_p @__MKDIR_P@
63 %__restorecon @__RESTORECON@
67 %__semodule @__SEMODULE@
76 #==============================================================================
77 # ---- Build system path macros.
86 %__objcopy @__OBJCOPY@
87 %__objdump @__OBJDUMP@
92 # XXX avoid failures if tools are not installed when rpm is built.
93 %__libtoolize libtoolize
95 %__autoheader autoheader
99 #==============================================================================
100 # Conditional build stuff.
102 # Check if symbol is defined.
103 # Example usage: %if %{defined with_foo} && %{undefined with_bar} ...
104 %defined() %{expand:%%{?%{1}:1}%%{!?%{1}:0}}
105 %undefined() %{expand:%%{?%{1}:0}%%{!?%{1}:1}}
107 # Shorthand for %{defined with_...}
108 %with() %{expand:%%{?with_%{1}:1}%%{!?with_%{1}:0}}
109 %without() %{expand:%%{?with_%{1}:0}%%{!?with_%{1}:1}}
111 # Handle conditional builds. %bcond_with is for case when feature is
112 # default off and needs to be activated with --with ... command line
113 # switch. %bcond_without is for the dual case.
115 # %bcond_with foo defines symbol with_foo if --with foo was specified on
117 # %bcond_without foo defines symbol with_foo if --without foo was *not*
118 # specified on command line.
120 # For example (spec file):
123 # %bcond_with extra_fonts
124 # %bcond_without static
126 # %if %{with extra_fonts}
131 # %if ! %{with static}
134 # %ifdef %{with static}
137 # %{?with_static: ... }
138 # %{!?with_static: ... }
139 # %{?with_extra_fonts: ... }
140 # %{!?with_extra_fonts: ... }
143 # The bottom line: never use without_foo, _with_foo nor _without_foo, only
144 # with_foo. This way changing default set of bconds for given spec is just
145 # a matter of changing single line in it and syntax is more readable.
146 %bcond_with() %{expand:%%{?_with_%{1}:%%global with_%{1} 1}}
147 %bcond_without() %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}}
149 #==============================================================================
150 # ---- Required rpmrc macros.
151 # Macros that used to be initialized as a side effect of rpmrc parsing.
152 # These are the default values that can be overridden by other
153 # (e.g. per-platform, per-system, per-packager, per-package) macros.
155 # The directory where rpm's configuration and scripts live
156 %_rpmconfigdir %{getconfdir}
158 # The directory where sources/patches will be unpacked and built.
159 %_builddir %{_topdir}/BUILD
161 # The interpreter used for build scriptlets.
164 # The path to the bzip2 executable (legacy, use %{__bzip2} instead).
165 %_bzip2bin %{__bzip2}
167 # The location of the rpm database file(s).
168 %_dbpath %{_var}/lib/rpm
170 # The location of the rpm database file(s) after "rpm --rebuilddb".
171 %_dbpath_rebuild %{_dbpath}
173 %_keyringpath %{_dbpath}/pubkeys/
176 # Path to script that creates debug symbols in a /usr/lib/debug
179 # A spec file can %%define _find_debuginfo_opts to pass options to
180 # the script. See the script for details.
182 %__debug_install_post \
183 %{_rpmconfigdir}/find-debuginfo.sh %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_find_debuginfo_opts} "%{_builddir}/%{?buildsubdir}"\
186 # Template for debug information sub-package.
188 %global __debug_package 1\
190 Summary: Debug information for package %{name}\
191 Group: Development/Debug\
193 %description debuginfo\
194 This package provides debug information for package %{name}.\
195 Debug information is useful when developing applications that use this\
196 package or when debugging this package.\
197 %files debuginfo -f debugfiles.list\
198 %defattr(-,root,root)\
201 %_defaultdocdir %{_datadir}/doc/packages
202 %_defaultlicensedir %{_datadir}/licenses
203 %_docdir_fmt %%{NAME}
205 # The path to the gzip executable (legacy, use %{__gzip} instead).
208 # The Unix time of the latest kept changelog entry in binary packages.
209 # Any older entry is not packaged in binary packages.
210 %_changelog_trimtime 0
212 # The directory where newly built binary packages will be written.
213 %_rpmdir %{_topdir}/RPMS
215 # A template used to generate the output binary package file name
217 %_rpmfilename %{_build_name_fmt}
219 # The directory where sources/patches from a source package will be
220 # installed. This is also where sources/patches are found when building.
221 %_sourcedir %{_topdir}/SOURCES
223 # The directory where the spec file from a source package will be
225 %_specdir %{_topdir}/SPECS
227 # The directory where newly built source packages will be written.
228 %_srcrpmdir %{_topdir}/SRPMS
230 # The directory where buildroots will be created.
231 %_buildrootdir %{_topdir}/BUILDROOT
233 # Build root path, where %install installs the package during build.
234 %buildroot %{_buildrootdir}/%{name}-%{version}-%{release}.%{_arch}
236 # Directory where temporaray files can be created.
237 %_tmppath %{_var}/tmp
239 # Path to top of build area.
240 %_topdir %{expand:%%global _topdir %{lua:if posix.access(rpm.expand("%{_usrsrc}/packages"), "w") then print "%{_usrsrc}/packages" else print "%{getenv:HOME}/rpmbuild" end} \
243 # The path to the unzip executable (legacy, use %{__unzip} instead).
244 %_unzipbin %{__unzip}
246 #==============================================================================
247 # ---- Optional rpmrc macros.
248 # Macros that are initialized as a side effect of rpmrc and/or spec
251 # The sub-directory (relative to %{_builddir}) where sources are compiled.
252 # This macro is set after processing %setup, either explicitly from the
253 # value given to -n or the default name-version.
257 # Configurable distribution information, same as Distribution: tag in a
262 # Configurable distribution URL, same as DistURL: tag in a specfile.
263 # The URL will be used to supply reliable information to tools like
266 # Note: You should not configure with disturl (or build packages with
267 # the DistURL: tag) unless you are willing to supply content in a
268 # yet-to-be-determined format at the URL specified.
272 # Configurable bug URL, same as BugURL: tag in a specfile.
273 # The URL will be used to supply reliable information to where
278 # Boolean (i.e. 1 == "yes", 0 == "no") that controls whether files
279 # marked as %doc should be installed.
282 # The port and machine name of a FTP proxy host running TIS firewall.
287 # The signature to use and the location of configuration files for
288 # signing packages with GNU gpg.
293 # The port and machine name of an HTTP proxy host.
298 # The PATH put into the environment before running %pre/%post et al.
300 %_install_script_path /sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin
302 # A colon separated list of desired locales to be installed;
303 # "all" means install all locale specific files.
307 # The value of CLASSPATH in build scriptlets (iff configured).
311 # Import packaging conventions from jpackage.org (prefixed with _
312 # to avoid name collisions).
314 %_javadir %{_datadir}/java
315 %_javadocdir %{_datadir}/javadoc
317 # A colon separated list of paths where files should *not* be installed.
318 # Usually, these are network file system mount points.
323 # The type of pattern match used on rpmdb iterator selectors:
324 # "default" simple glob-like regex, periods will be escaped,
325 # splats will have period prepended, full "^...$" match
326 # required. Also, file path tags will use glob(7).
327 # "strcmp" compare strings
328 # "regex" regex(7) patterns using regcomp(3)/regexec(3)
329 # "glob" glob(7) patterns using fnmatch(3)
331 %_query_selector_match default
333 # Configurable packager information, same as Packager: in a specfile.
337 # Compression type and level for source/binary package payloads.
338 # "w9.gzdio" gzip level 9 (default).
339 # "w9.bzdio" bzip2 level 9.
340 # "w7.xzdio" xz level 7, xz's default.
341 # "w7.lzdio" lzma-alone level 7, lzma's default
343 #%_source_payload w9.gzdio
344 %_binary_payload w5.lzdio
346 # Algorithm to use for generating file checksum digests on build.
347 # If not specified or 0, MD5 is used.
348 # WARNING: non-MD5 is backwards incompatible, don't enable lightly!
349 # The supported algorithms may depend on NSS version, as of NSS
350 # 3.11.99.5 the following are supported:
357 #%_source_filedigest_algorithm 1
358 #%_binary_filedigest_algorithm 1
360 # Configurable vendor information, same as Vendor: in a specfile.
364 # Default fuzz level for %patch in spec file.
365 %_default_patch_fuzz 0
367 # Default patch flags
368 #%_default_patch_flags -s
370 #==============================================================================
371 # ---- Build configuration macros.
373 # Script gets packaged file list on input and buildroot as first parameter.
374 # Returns list of unpackaged files, i.e. files in $RPM_BUILD_ROOT not packaged.
376 # Note: Disable (by commenting out) for legacy compatibility.
377 %__check_files %{_rpmconfigdir}/check-files %{buildroot}
380 # Should unpackaged files in a build root terminate a build?
382 # Note: The default value should be 0 for legacy compatibility.
383 %_unpackaged_files_terminate_build 1
386 # Should missing %doc files in the build directory terminate a build?
388 # Note: The default value should be 0 for legacy compatibility.
389 %_missing_doc_files_terminate_build 1
392 # Should binaries in noarch packages terminate a build?
393 %_binaries_in_noarch_packages_terminate_build 1
396 # Should rpm try to download missing sources at build-time?
397 # Enabling this is dangerous as long as rpm has no means to validate
398 # the integrity of the download with a digest or signature.
399 %_disable_source_fetch 1
402 # Program to call for each successfully built and written binary package.
403 # The package name is passed to the program as a command-line argument.
405 #%_build_pkgcheck %{_bindir}/rpmlint
408 # Program to call for the whole binary package set after build.
409 # The package set is passed to the program via command-line arguments.
411 #%_build_pkgcheck_set %{_bindir}/rpmlint
414 # Program to call for successfully built and written SRPM.
415 # The package name is passed to the program as a command-line argument.
417 #%_build_pkgcheck_srpm %{_bindir}/rpmlint
420 # Should the build of packages fail if package checker (if defined) returns
421 # non-zero exit status?
423 #%_nonzero_exit_pkgcheck_terminate_build 1
426 # Should an ELF file processed by find-debuginfo.sh having no build ID
427 # terminate a build? This is left undefined to disable it and defined to
430 #%_missing_build_ids_terminate_build 1
433 # Use internal dependency generator rather than external helpers?
434 %_use_internal_dependency_generator 1
437 # Filter GLIBC_PRIVATE Provides: and Requires:
438 %_filter_GLIBC_PRIVATE 0
440 # Directories whose contents should be considered as documentation.
441 %__docdir_path %{_datadir}/doc:%{_datadir}/man:%{_datadir}/info:%{_datadir}/gtk-doc/html:%{?_docdir}:%{?_mandir}:%{?_infodir}:%{?_javadocdir}:/usr/doc:/usr/man:/usr/info:/usr/X11R6/man
443 # maxnum,cuttime,minnum
444 # 2009/03/01 (SLES11 GA)
445 %_binarychangelogtrim 0,1235862000,10
448 # Path to scripts to autogenerate package dependencies,
450 # Note: Used iff _use_internal_dependency_generator is zero.
451 #%__find_provides %{_rpmconfigdir}/rpmdeps --provides
452 #%__find_requires %{_rpmconfigdir}/rpmdeps --requires
453 %__find_provides %{_rpmconfigdir}/find-provides %name
454 %__find_requires %{_rpmconfigdir}/find-requires %name
455 #%__find_conflicts ???
456 #%__find_obsoletes ???
457 #%__find_supplements ???
458 #%__find_enhances ???
461 # Path to file attribute classifications for automatic dependency
462 # extraction, used when _use_internal_dependency_generator
463 # is used (on by default). Files can have any number of attributes
464 # attached to them, and dependencies are separately extracted for
467 # To define a new file attribute called "myattr", add a file named
468 # "myattr" to this directory, defining the requires and/or provides
469 # finder script(s) + magic and/or path pattern regex(es).
470 # provides finder and
471 # %__myattr_requires path + args to requires finder script for <myattr>
472 # %__myattr_provides path + args to provides finder script for <myattr>
473 # %__myattr_magic libmagic classification match regex
474 # %__myattr_path path based classification match regex
475 # %__myattr_flags flags to control behavior (just "exeonly" for now)
476 # %__myattr_exclude_magic exclude by magic regex
477 # %__myattr_exclude_path exclude by path regex
479 %_fileattrsdir %{_rpmconfigdir}/fileattrs
481 #==============================================================================
482 # ---- Database configuration macros.
483 # Macros used to configure Berkley db parameters.
485 # rpmdb macro configuration values are a colon (or white space) separated
486 # list of tokens, with an optional '!' negation to explicitly disable bit
487 # values, or a "=value" if a parameter. A per-tag value is used (e.g.
488 # %_dbi_config_Packages) if defined, otherwise a per-rpmdb default
489 # (e.g. %_dbi_config).
491 # Here's a short list of the tokens, with a guess of whether the option is
493 # (nothing) currently used in rpm, known to work.
494 # "+++" under development, will be supported in rpm eventually.
495 # "???" I have no clue, you're mostly on your own.
497 # If you do find yourself inclined to fiddle, here's what I see (shrug):
498 # 1) Only the value of mp_size has any serious impact on overall performance,
499 # and you will need ~256Kb to handle a typical machine install.
500 # 2) Only the Packages hash, because of the size of the values (i.e. headers),
501 # will ever need tuning. Diddle the pagesize if you're interested, although
502 # I believe that you will find pagesize=512 "best".
503 # 3) Adding nofsync increases speed, but risks total data loss. Fiddle shared
504 # and/or mp_size instead.
506 # token works? Berkeley db flag or value
507 #==================================================
508 #---------------------- DBENV tunable values:
509 # mmapsize=16Mb DBENV->set_mp_mmapsize
510 # cachesize=1Mb DBENV->set_cachesize, DB->set_cachesize
511 #---------------------- DB->open bits:
512 # nommap ??? DB_NOMMAP
513 #----------------------- rpmdb specific configuration:
514 # lockdbfd (always on for Packages) Use fcntl(2) locking ?
515 # nofsync Disable fsync(2) call performed after db3 writes?
518 # Misc BDB tuning options
519 %__dbi_other mp_mmapsize=128Mb mp_size=1Mb
521 %_dbi_config %{?__dbi_other} nofsync
523 # "Packages" should have shared/exclusive fcntl(2) lock using "lockdbfd".
524 %_dbi_config_Packages %{?__dbi_other} lockdbfd
526 #==============================================================================
527 # ---- GPG/PGP/PGP5 signature macros.
528 # Macro(s) to hold the arguments passed to GPG/PGP for package
529 # signing and verification.
531 %__gpg_check_password_cmd %{__gpg} \
532 gpg --batch --no-verbose --passphrase-fd 3 -u "%{_gpg_name}" -so -
534 %__gpg_sign_cmd %{__gpg} \
535 gpg --batch --no-verbose --no-armor --passphrase-fd 3 \
536 %{?_gpg_digest_algo:--digest-algo %{_gpg_digest_algo}} \
537 --no-secmem-warning \
538 -u "%{_gpg_name}" -sbo %{__signature_filename} %{__plaintext_filename}
540 # XXX rpm >= 4.1 verifies signatures internally
541 #%__gpg_verify_cmd %{__gpg} \
542 # gpg --batch --no-verbose --verify --no-secmem-warning \
543 # %{__signature_filename} %{__plaintext_filename}
545 # XXX rpm-4.1 verifies prelinked libraries using a prelink undo helper.
546 # Normally this macro is defined in /etc/rpm/macros.prelink, installed
547 # with the prelink package. If the macro is undefined, then prelinked
548 # shared libraries contents are MD5 digest verified (as usual), rather
549 # than MD5 verifying the output of the prelink undo helper.
551 # Note: The 2nd token is used as argv[0] and "library" is a
552 # placeholder that will be deleted and replaced with the appropriate
554 #%__prelink_undo_cmd /usr/sbin/prelink prelink -y library
556 # Horowitz Key Protocol server configuration
558 %_hkp_keyserver http://pgp.mit.edu
559 %_hkp_keyserver_query %{_hkp_keyserver}:11371/pks/lookup?op=get&search=0x
561 #==============================================================================
562 # ---- Transaction macros.
563 # Macro(s) used to parameterize transactions.
565 # The output binary package file name template used when building
568 # XXX Note: escaped %% for use in headerSprintf()
569 %_build_name_fmt %%{ARCH}/%%{NAME}-%%{VERSION}-%%{RELEASE}.%%{ARCH}.rpm
571 # Verify digest/signature flags for various rpm modes:
572 # 0x30300 (_RPMVSF_NODIGESTS) --nohdrchk if set, don't check digest(s)
573 # 0xc0c00 (_RPMVSF_NOSIGNATURES) --nosignature if set, don't check signature(s)
574 # 0xf0000 (_RPMVSF_NOPAYLOAD) --nolegacy if set, check header+payload (if possible)
575 # 0x00f00 (_RPMVSF_NOHEADER) --nohdrchk if set, don't check rpmdb headers
577 # For example, the value 0xf0c00 (=0xf0000+0xc0c00) disables legacy
578 # digest/signature checking, disables signature checking, but attempts
579 # digest checking, also when retrieving headers from the database.
582 # >>> hex(rpm._RPMVSF_NOSIGNATURES)
585 # >>> hex(rpm._RPMVSF_NOSIGNATURES|rpm._RPMVSF_NOPAYLOAD)
587 # at the python prompt for example, after "import rpm".
589 # The checking overhead is ~11ms per header for digests/signatures;
590 # each header from the database is checked only when first encountered
591 # for each database open.
593 # Note: the %_vsflags_erase applies to --upgrade/--freshen modes as
597 %_vsflags_build %{__vsflags}
598 %_vsflags_erase %{__vsflags}
599 %_vsflags_install %{__vsflags}
600 %_vsflags_query %{__vsflags}
601 %_vsflags_rebuilddb 0xc0c00
602 %_vsflags_verify %{__vsflags}
605 # Default output format string for rpm -qa
607 # XXX Note: escaped %% for use in headerFormat()
608 %_query_all_fmt %%{nvra}
611 # Default path to the file used for transaction fcntl lock.
612 %_rpmlock_path %{_dbpath}/.rpm.lock
615 # ISA dependency marker, none for noarch and name-bitness for others
616 %_isa %{?__isa:(%{__isa})}%{!?__isa:%{nil}}
619 # Define per-arch and per-os defaults. Normally overridden by per-target macros.
620 %__arch_install_post %{nil}
621 %__os_install_post %{___build_post}
623 # Macro to fix broken permissions in sources
624 %_fixperms %{__chmod} -Rf @FIXPERMS@
626 #==============================================================================
627 # ---- Scriptlet template templates.
628 # Global defaults used for building scriptlet templates.
631 %___build_shell %{?_buildshell:%{_buildshell}}%{!?_buildshell:/bin/sh}
633 %___build_cmd %{?_sudo:%{_sudo} }%{?_remsh:%{_remsh} %{_remhost} }%{?_remsudo:%{_remsudo} }%{?_remchroot:%{_remchroot} %{_remroot} }%{___build_shell} %{___build_args}
635 RPM_SOURCE_DIR=\"%{u2p:%{_sourcedir}}\"\
636 RPM_BUILD_DIR=\"%{u2p:%{_builddir}}\"\
637 RPM_OPT_FLAGS=\"%{optflags}\"\
638 RPM_ARCH=\"%{_arch}\"\
640 export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
641 RPM_DOC_DIR=\"%{_docdir}\"\
643 RPM_PACKAGE_NAME=\"%{name}\"\
644 RPM_PACKAGE_VERSION=\"%{version}\"\
645 RPM_PACKAGE_RELEASE=\"%{release}\"\
646 export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
649 unset CDPATH DISPLAY ||:\
650 %{?buildroot:RPM_BUILD_ROOT=\"%{u2p:%{buildroot}}\"\
651 export RPM_BUILD_ROOT}\
652 %{?_javaclasspath:CLASSPATH=\"%{_javaclasspath}\"\
655 %{verbose:set -x}%{!verbose:exec > /dev/null}\
657 cd \"%{u2p:%{_builddir}}\"\
660 #%___build_body %{nil}
661 %___build_post exit 0
663 %___build_template #!%{___build_shell}\
671 #==============================================================================
672 # ---- Scriptlet templates.
673 # Macro(s) that expand to a command and script that is executed.
674 # CAVEAT: All macro expansions must fit in a BUFSIZ (8192 byte) buffer.
676 %__spec_prep_shell %{___build_shell}
677 %__spec_prep_args %{___build_args}
678 %__spec_prep_cmd %{___build_cmd}
679 %__spec_prep_pre %{___build_pre}
680 %__spec_prep_body %{___build_body}
681 %__spec_prep_post %{___build_post}
682 %__spec_prep_template #!%{__spec_prep_shell}\
686 #%{__spec_prep_body}\
687 #%{__spec_prep_post}\
690 %__spec_build_shell %{___build_shell}
691 %__spec_build_args %{___build_args}
692 %__spec_build_cmd %{___build_cmd}
693 %__spec_build_pre %{___build_pre}
694 %__spec_build_body %{___build_body}
695 %__spec_build_post %{___build_post}
696 %__spec_build_template #!%{__spec_build_shell}\
700 #%{__spec_build_body}\
701 #%{__spec_build_post}\
704 %__spec_install_shell %{___build_shell}
705 %__spec_install_args %{___build_args}
706 %__spec_install_cmd %{___build_cmd}
707 %__spec_install_pre %{___build_pre}
708 %__spec_install_body %{___build_body}
709 %__spec_install_post\
710 %{?__debug_package:%{__debug_install_post}}\
711 %{__arch_install_post}\
712 %{__os_install_post}\
714 %__spec_install_template #!%{__spec_install_shell}\
715 %{__spec_install_pre}\
718 #%{__spec_install_body}\
719 #%{__spec_install_post}\
722 %__spec_check_shell %{___build_shell}
723 %__spec_check_args %{___build_args}
724 %__spec_check_cmd %{___build_cmd}
725 %__spec_check_pre %{___build_pre}
726 %__spec_check_body %{___build_body}
727 %__spec_check_post %{___build_post}
728 %__spec_check_template #!%{__spec_check_shell}\
732 #%{__spec_check_body}\
733 #%{__spec_check_post}\
736 #%__spec_autodep_shell %{___build_shell}
737 #%__spec_autodep_args %{___build_args}
738 #%__spec_autodep_cmd %{___build_cmd}
739 #%__spec_autodep_pre %{___build_pre}
740 #%__spec_autodep_body %{___build_body}
741 #%__spec_autodep_post %{___build_post}
742 #%__spec_autodep_template #!%{__spec_autodep_shell}\
743 #%{__spec_autodep_pre}\
746 #%{__spec_autodep_body}\
747 #%{__spec_autodep_post}\
750 %__spec_clean_shell %{___build_shell}
751 %__spec_clean_args %{___build_args}
752 %__spec_clean_cmd %{___build_cmd}
753 %__spec_clean_pre %{___build_pre}
754 %__spec_clean_body %{___build_body}
755 %__spec_clean_post %{___build_post}
756 %__spec_clean_template #!%{__spec_clean_shell}\
760 #%{__spec_clean_body}\
761 #%{__spec_clean_post}\
764 %__spec_rmbuild_shell %{___build_shell}
765 %__spec_rmbuild_args %{___build_args}
766 %__spec_rmbuild_cmd %{___build_cmd}
767 %__spec_rmbuild_pre %{___build_pre}
768 %__spec_rmbuild_body %{___build_body}
769 %__spec_rmbuild_post %{___build_post}
770 %__spec_rmbuild_template #!%{__spec_rmbuild_shell}\
771 %{__spec_rmbuild_pre}\
774 #%{__spec_rmbuild_body}\
775 #%{__spec_rmbuild_post}\
778 # XXX We don't expand pre/post install scriptlets (yet).
779 #%__spec_pre_pre %{nil}
780 #%__spec_pre_post %{nil}
781 #%__spec_post_pre %{nil}
782 #%__spec_post_post %{nil}
783 #%__spec_preun_pre %{nil}
784 #%__spec_preun_post %{nil}
785 #%__spec_postun_pre %{nil}
786 #%__spec_postun_post %{nil}
787 #%__spec_triggerpostun_pre %{nil}
788 #%__spec_triggerpostun_post %{nil}
789 #%__spec_triggerun_pre %{nil}
790 #%__spec_triggerun_post %{nil}
791 #%__spec_triggerin_pre %{nil}
792 #%__spec_triggerin_post %{nil}
794 #==============================================================================
795 # ---- configure macros.
796 # Macro(s) slavishly copied from autoconf's config.status.
799 %_exec_prefix %{_prefix}
800 %_bindir %{_exec_prefix}/bin
801 %_sbindir %{_exec_prefix}/sbin
802 %_libexecdir %{_exec_prefix}/libexec
803 %_datadir %{_prefix}/share
805 %_sharedstatedir %{_prefix}/com
806 %_localstatedir %{_prefix}/var
808 %_libdir %{_exec_prefix}/%{_lib}
809 %_includedir %{_prefix}/include
810 %_infodir %{_datadir}/info
811 %_mandir %{_datadir}/man
813 #==============================================================================
814 # ---- config.guess platform macros.
815 # Macro(s) similar to the tokens used by configure.
818 %_build_alias %{_host_alias}
819 %_build_cpu %{_host_cpu}
820 %_build_vendor %{_host_vendor}
821 %_build_os %{_host_os}
823 %_host_alias @host@%{nil}
824 %_host_cpu @host_cpu@
825 %_host_vendor @host_vendor@
828 %_target_alias %{_host_alias}
829 %_target_cpu %{_host_cpu}
830 %_target_vendor %{_host_vendor}
831 %_target_os %{_host_os}
833 #==============================================================================
834 # ---- specfile macros.
835 # Macro(s) here can be used reliably for reproducible builds.
836 # (Note: Above is the goal, below are the macros under development)
838 # The configure macro runs autoconf configure script with platform specific
839 # directory structure (--prefix, --libdir etc) and compiler flags
842 # The configure macro should be invoked as %configure (rather than %{configure})
843 # because the rest of the arguments will be expanded using %*.
845 %_configure ./configure
847 CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
848 CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
849 FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS ; \
850 %{_configure} --host=%{_host} --build=%{_build} \\\
851 --program-prefix=%{?_program_prefix} \\\
852 --disable-dependency-tracking \\\
853 --prefix=%{_prefix} \\\
854 --exec-prefix=%{_exec_prefix} \\\
855 --bindir=%{_bindir} \\\
856 --sbindir=%{_sbindir} \\\
857 --sysconfdir=%{_sysconfdir} \\\
858 --datadir=%{_datadir} \\\
859 --includedir=%{_includedir} \\\
860 --libdir=%{_libdir} \\\
861 --libexecdir=%{_libexecdir} \\\
862 --localstatedir=%{_localstatedir} \\\
863 --sharedstatedir=%{_sharedstatedir} \\\
864 --mandir=%{_mandir} \\\
865 --infodir=%{_infodir}
867 #------------------------------------------------------------------------------
868 # The make install analogue of %configure for modern autotools:
869 %make_install %{__make} install DESTDIR=%{?buildroot}
871 #------------------------------------------------------------------------------
872 # Former make install analogue, kept for compatibility and for old/broken
873 # packages that don't support DESTDIR properly.
876 prefix=%{?buildroot:%{buildroot}}%{_prefix} \\\
877 exec_prefix=%{?buildroot:%{buildroot}}%{_exec_prefix} \\\
878 bindir=%{?buildroot:%{buildroot}}%{_bindir} \\\
879 sbindir=%{?buildroot:%{buildroot}}%{_sbindir} \\\
880 sysconfdir=%{?buildroot:%{buildroot}}%{_sysconfdir} \\\
881 datadir=%{?buildroot:%{buildroot}}%{_datadir} \\\
882 includedir=%{?buildroot:%{buildroot}}%{_includedir} \\\
883 libdir=%{?buildroot:%{buildroot}}%{_libdir} \\\
884 libexecdir=%{?buildroot:%{buildroot}}%{_libexecdir} \\\
885 localstatedir=%{?buildroot:%{buildroot}}%{_localstatedir} \\\
886 sharedstatedir=%{?buildroot:%{buildroot}}%{_sharedstatedir} \\\
887 mandir=%{?buildroot:%{buildroot}}%{_mandir} \\\
888 infodir=%{?buildroot:%{buildroot}}%{_infodir} \\\
891 #------------------------------------------------------------------------------
892 # The GNUconfigure macro does the following:
893 # update config.guess and config.sub.
894 # regenerate all autoconf/automake files
895 # optionally change to a directory (make the directory if requested).
896 # run configure with correct prefix, platform, and CFLAGS.
897 # optionally restore current directory.
899 # Based on autogen.sh from GNOME and orginal GNUconfigure
901 %GNUconfigure(MCs:) \
902 CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS; \
903 LDFLAGS="${LDFLAGS:-%{-s:-s}}" ; export LDFLAGS; \
904 %{-C:_mydir="`pwd`"; %{-M: %{__mkdir} -p %{-C*};} cd %{-C*}} \
905 dirs="`find ${_mydir} -name configure.in -print`"; export dirs; \
906 for coin in `echo ${dirs}` \
908 dr=`dirname ${coin}`; \
909 if test -f ${dr}/NO-AUTO-GEN; then \
912 macrodirs=`sed -n -e 's,AM_ACLOCAL_INCLUDE(\(.*\)),\1,gp' < ${coin}`; \
914 aclocalinclude="${ACLOCAL_FLAGS}"; \
915 for k in ${macrodirs}; do \
916 if test -d ${k}; then \
917 aclocalinclude="${aclocalinclude} -I ${k}"; \
919 ## echo "**Warning**: No such directory \`${k}'. Ignored." \
922 if grep "^AM_GNU_GETTEXT" configure.in >/dev/null; then \
923 if grep "sed.*POTFILES" configure.in >/dev/null; then \
924 : do nothing -- we still have an old unmodified configure.in \
926 test -r ${dr}/aclocal.m4 || touch ${dr}/aclocal.m4; \
927 echo "no" | gettextize --force --copy; \
928 test -r ${dr}/aclocal.m4 && %{__chmod} u+w ${dr}/aclocal.m4; \
931 if grep "^AM_PROG_LIBTOOL" configure.in >/dev/null; then \
932 %{__libtoolize} --force --copy; \
934 aclocal ${aclocalinclude}; \
935 if grep "^AM_CONFIG_HEADER" configure.in >/dev/null; then \
938 echo "Running automake --gnu ${am_opt} ..."; \
939 %{__automake} --add-missing --gnu ${am_opt}; \
944 %{-C:${_mydir}}%{!-C:.}/configure --prefix=%{_prefix} --exec-prefix=%{_exec_prefix} --bindir=%{_bindir} --sbindir=%{_sbindir} --sysconfdir=%{_sysconfdir} --datadir=%{_datadir} --includedir=%{_includedir} --libdir=%{_libdir} --libexecdir=%{_libexecdir} --localstatedir=%{_localstatedir} --sharedstatedir=%{_sharedstatedir} --mandir=%{_mandir} --infodir=%{_infodir} %* ; \
945 %{-C:cd ${_mydir}; unset _mydir}
947 %patches %{lua: for i, p in ipairs(patches) do print(p.." ") end}
948 %sources %{lua: for i, s in ipairs(sources) do print(s.." ") end}
950 #------------------------------------------------------------------------------
951 # Useful perl macros (from Artur Frysiak <wiget@t17.ds.pwr.wroc.pl>)
953 # For example, these can be used as (from ImageMagick.spec from PLD site)
958 # Summary: libraries and modules for access to ImageMagick from perl
959 # Group: Development/Languages/Perl
960 # Requires: %{name} = %{version}
964 # rm -fr $RPM_BUILD_ROOT
965 # install -d $RPM_BUILD_ROOT/%{perl_sitearch}
968 # %defattr(644,root,root,755)
969 # %{perl_sitearch}/Image
970 # %dir %{perl_sitearch}/auto/Image
972 %requires_eq() %(LC_ALL="C" echo '%*' | xargs -r rpm -q --qf 'Requires: %%{name} = %%{epoch}:%%{version}\\n' | sed -e 's/ (none):/ /' -e 's/ 0:/ /' | grep -v "is not")
973 %perl_sitearch %(eval "`%{__perl} -V:installsitearch`"; echo $installsitearch)
974 %perl_sitelib %(eval "`%{__perl} -V:installsitelib`"; echo $installsitelib)
975 %perl_vendorarch %(eval "`%{__perl} -V:installvendorarch`"; echo $installvendorarch)
976 %perl_vendorlib %(eval "`%{__perl} -V:installvendorlib`"; echo $installvendorlib)
977 %perl_archlib %(eval "`%{__perl} -V:installarchlib`"; echo $installarchlib)
978 %perl_privlib %(eval "`%{__perl} -V:installprivlib`"; echo $installprivlib)
980 #------------------------------------------------------------------------------
981 # Useful python macros for determining python version and paths
983 %python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; import sys; sys.stdout.write(get_python_lib())")
984 %python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; import sys; sys.stdout.write(get_python_lib(1))")
985 %python_version %(%{__python} -c "import sys; sys.stdout.write(sys.version[:3])")
987 # More useful perl macros (from Raul Dias <rsd@swi.com.br>)
989 %perl_version %(perl -V:version | sed "s!.*='!!;s!'.*!!")
990 %perl_man1ext %(perl -V:man1ext | sed "s!.*='!!;s!'.*!!")
991 %perl_man3ext %(perl -V:man3ext | sed "s!.*='!!;s!'.*!!")
992 %perl_man1dir %(perl -V:man1dir | sed "s!.*='!!;s!'.*!!")
993 %perl_man3dir %(perl -V:man3dir | sed "s!.*='!!;s!'.*!!")
994 %perl_installman1dir %(perl -V:installman1dir | sed "s!.*='!!;s!'.*!!")
995 %perl_installman3dir %(perl -V:installman3dir | sed "s!.*='!!;s!'.*!!")
996 %perl_installarchlib %(perl -V:installarchlib | sed "s!.*='!!;s!'.*!!")
997 %perl_prefix %{buildroot}
999 #------------------------------------------------------------------------------
1000 # Python specific macro definitions (originally from PLD).
1002 %py_ver %(python -c "import sys; v=sys.version_info[:2]; print '%%d.%%d'%%v" 2>/dev/null || echo PYTHON-NOT-FOUND)
1003 %py_prefix %(python -c "import sys; print sys.prefix" 2>/dev/null || echo PYTHON-NOT-FOUND)
1004 %py_libdir %{py_prefix}/%{_lib}/python%{py_ver}
1005 %py_incdir %{py_prefix}/include/python%{py_ver}
1006 %py_sitedir %{py_libdir}/site-packages
1008 find %1 -name '*.pyc' -exec rm -f {} \\; \
1009 python -c "import sys, os, compileall; br='%{buildroot}'; compileall.compile_dir(sys.argv[1], ddir=br and (sys.argv[1][len(os.path.abspath(br)):]+'/') or None)" %1 \
1011 find %1 -name '*.pyo' -exec rm -f {} \\; \
1012 python -O -c "import sys, os, compileall; br='%{buildroot}'; compileall.compile_dir(sys.argv[1], ddir=br and (sys.argv[1][len(os.path.abspath(br)):]+'/') or None)" %1 \
1015 %define minver %py_ver \
1016 %define maxver %(python -c "import sys; a,b=sys.version_info[:2]; print '%%d.%%d'%%(a,b+1)" 2>/dev/null || echo PYTHON-NOT-FOUND) \
1017 BuildRequires: python %{-d:python-devel} \
1018 PreReq: python >= %minver, python < %maxver
1021 #------------------------------------------------------------------------------
1022 # arch macro for all Intel i?86 compatibile processors
1023 # (Note: This macro (and it's analogues) will probably be obsoleted when
1024 # rpm can use regular expressions against target platforms in macro
1027 %ix86 i386 i486 i586 i686 pentium3 pentium4 athlon geode
1029 #------------------------------------------------------------------------------
1030 # arch macro for all supported ARM processors
1031 %arm armv3l armv4b armv4l armv4tl armv5b armv5l armv5teb armv5tel armv5tejl armv6l armv7l armv7hl
1032 %arml armv3l armv4l armv5l armv5tel armv6l armv7l armv7hl
1033 %armb armv4b armv5b armv5teb
1035 #------------------------------------------------------------------------------
1036 # arch macro for all supported Sparc processors
1037 %sparc sparc sparcv8 sparcv9 sparcv9v sparc64 sparc64v
1039 #------------------------------------------------------------------------------
1040 # arch macro for all supported Alpha processors
1041 %alpha alpha alphaev56 alphaev6 alphaev67
1043 #------------------------------------------------------------------------------
1044 # arch macro for all supported PowerPC 64 processors
1045 %power64 ppc64 ppc64p7
1047 #------------------------------------------------------------------------
1048 # Use in %install to generate locale specific file lists. For example,
1052 # %find_lang %{name}
1054 # %files -f %{name}.lang
1056 %find_lang %{_rpmconfigdir}/find-lang.sh %{buildroot}
1058 # Commands + opts to use for retrieving remote files
1059 # Proxy opts can be set through --httpproxy/--httpport popt aliases,
1060 # for any special local needs use %__urlhelper_localopts in system-wide
1061 # or per-user macro configuration.
1062 %__urlhelpercmd @__CURL@
1063 %__urlhelperopts --silent --show-error --fail --location -o
1064 %__urlhelper_proxyopts %{?_httpproxy:--proxy %{_httpproxy}%{?_httpport::%{_httpport}}}%{!?_httpproxy:%{nil}}
1065 %_urlhelper %{__urlhelpercmd} %{?__urlhelper_localopts} %{?__urlhelper_proxyopts} %{__urlhelperopts}
1067 #------------------------------------------------------------------------------
1068 # Collection specific macros
1069 %__plugindir %{_libdir}/rpm-plugins
1070 %__collection_font %{__plugindir}/exec.so /usr/bin/fc-cache
1071 %__collection_java %{__plugindir}/exec.so /usr/bin/rebuild-gcj-db
1072 %__collection_sepolicy %{__plugindir}/sepolicy.so
1073 %__collection_sepolicy_flags 1
1075 #------------------------------------------------------------------------------
1076 # Macros for further automated spec %setup and patch application
1078 # default to plain patch
1080 # meh, figure something saner
1081 %__scm_username rpm-build
1082 %__scm_usermail <rpm-build>
1083 %__scm_author %{__scm_username} %{__scm_usermail}
1085 # Plain patch (-m is unused)
1086 %__scm_setup_patch(q) %{nil}
1087 %__scm_apply_patch(qp:m:)\
1088 %{__patch} %{-p:-p%{-p*}} %{-q:-s}
1090 # Mercurial (aka hg)
1092 %{__hg} init %{-q} .\
1093 %{__hg} add %{-q} .\
1094 %{__hg} commit %{-q} --user "%{__scm_author}" -m "%{name}-%{version} base"
1096 %__scm_apply_hg(qp:m:)\
1097 %{__hg} import - %{-p:-p%{-p*}} %{-q} -m %{-m*} --user "%{__scm_author}"
1100 %__scm_setup_git(q)\
1101 %{__git} init %{-q}\
1102 %{__git} config user.name "%{__scm_username}"\
1103 %{__git} config user.email "%{__scm_usermail}"\
1105 %{__git} commit %{-q} -a\\\
1106 --author "%{__scm_author}" -m "%{name}-%{version} base"
1108 %__scm_apply_git(qp:m:)\
1109 %{__git} apply %{-p:-p%{-p*}} -\
1110 %{__git} commit %{-q} -a -m %{-m*} --author "%{__scm_author}"
1113 %__scm_setup_quilt(q) %{nil}
1114 %__scm_apply_quilt(qp:m:)\
1115 %{__quilt} import %{-p:-p%{-p*}} %{1} && %{__quilt} push
1118 %__scm_setup_bzr(q)\
1119 %{__bzr} init %{-q}\
1120 %{__bzr} whoami --branch "%{__scm_author}"\
1122 %{__bzr} commit %{-q} -m "%{name}-%{version} base"
1124 # bzr doesn't seem to have its own command to apply patches?
1125 %__scm_apply_bzr(qp:m:)\
1126 %{__patch} %{-p:-p%{-p*}} %{-q:-s}\
1127 %{__bzr} commit %{-q} -m %{-m*}
1129 # Single patch application
1130 %apply_patch(qp:m:)\
1131 %{uncompress:%{1}} | %{expand:%__scm_apply_%{__scm} %{-q} %{-p:-p%{-p*}} %{-m:-m%{-m*}}}
1133 # Automatically apply all patches
1136 for i, p in ipairs(patches) do\
1137 print(rpm.expand("%apply_patch -m %{basename:"..p.."} "..rpm.expand("%{!-v:-q} %{-p:-p%{-p*}} ")..p.."\\n"))\
1140 # One macro to (optionally) do it all.
1141 # -S<scm name> Sets the used patch application style, eg '-S git' enables
1142 # usage of git repository and per-patch commits.
1143 # -N Disable automatic patch application
1144 # -p<num> Use -p<num> for patch application
1145 %autosetup(a:b:cDn:TvNS:p:)\
1146 %setup %{-a} %{-b} %{-c} %{-D} %{-n} %{-T} %{!-v:-q}\
1147 %{-S:%global __scm %{-S*}}\
1148 %{-S:%{expand:%__scm_setup_%{-S*} %{!-v:-q}}}\
1149 %{!-N:%autopatch %{-v} %{-p:-p%{-p*}}}
1155 #------------------------------------------------------------------------
1156 # standard build service macros
1161 %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 \
1164 %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 \
1168 /usr/sbin/groupadd -o -r %{1} 2>/dev/null || :\
1169 /usr/sbin/useradd -o -r -g %{1} -d %{2} -s %{3} -c %{4} %{1} 2>/dev/null || :\