aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJani Välimaa <wally@mageia.org>2023-01-07 13:22:39 +0200
committerJani Välimaa <wally@mageia.org>2023-01-07 13:22:39 +0200
commitbbe8c36a26e5cfa5474f9bbff328a11666e58fa3 (patch)
tree5381fb3512e9a35449b12f197c1c73337de821cc
parent1214f621679255500069ee97fa17e77fa916fd22 (diff)
downloadrpm-setup-bbe8c36a26e5cfa5474f9bbff328a11666e58fa3.tar
rpm-setup-bbe8c36a26e5cfa5474f9bbff328a11666e58fa3.tar.gz
rpm-setup-bbe8c36a26e5cfa5474f9bbff328a11666e58fa3.tar.bz2
rpm-setup-bbe8c36a26e5cfa5474f9bbff328a11666e58fa3.tar.xz
rpm-setup-bbe8c36a26e5cfa5474f9bbff328a11666e58fa3.zip
Macros: drop separate macros.build
-rw-r--r--Makefile.am3
-rw-r--r--NEWS2
-rw-r--r--macros.build.in475
-rw-r--r--macros.in474
4 files changed, 477 insertions, 477 deletions
diff --git a/Makefile.am b/Makefile.am
index 67289fb..fef2f4a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -9,8 +9,7 @@ pkg_gdata = \
pkg_data_in = $(pkg_gdata:=.in)
-pkg_macrosd = macros.build \
- macros.gnome
+pkg_macrosd = macros.gnome
pkg_macrosd_in = $(pkg_macrosd:=.in)
diff --git a/NEWS b/NEWS
index a36667a..ec9ed9c 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+- macros: drop separate macros.build and combine it with macros
+
Version 2.69 - 7 January 2023, by Jani Välimaa
- macros.build: rename from build.macros
- macros.gnome: really add to dist
diff --git a/macros.build.in b/macros.build.in
deleted file mode 100644
index 486bc69..0000000
--- a/macros.build.in
+++ /dev/null
@@ -1,475 +0,0 @@
-
-%_sys_macros_dir @RPMSYSCONFDIR@/macros.d
-%build_sysmacrospath() %{_sys_macros_dir}/%{?1:%{1}}%{?!1:%{name}}.macros
-
-# Various programs used in rpm scripts
-%_update_icon_cache_bin %{_bindir}/gtk-update-icon-cache
-%_gconftool_bin %{_bindir}/gconftool-2
-
-#==============================================================================
-# ---- Required rpmrc macros.
-# Macros that used to be initialized as a side effect of rpmrc parsing.
-# These are the default values that can be overridden by other
-# (e.g. per-platform, per-system, per-packager, per-package) macros.
-#
-
-%ix86 i386 i486 i586 i686 pentium3 pentium4 athlon k6
-
-# Multilibs
-%_multilibpatt (/%{_lib}|/usr/%{_lib}(|/gconv)|/usr/local/%{_lib}|/usr/X11R6/%{_lib}|/opt/%{_lib})/[^/]*\\.([oa]|la|so[0-9.]*)$
-
-%_arch_tag_suffix %([ "%{?_lib}" = "lib64" ] && echo "()(64bit)")
-%arch_tagged() %{1}%{_arch_tag_suffix} %{?2:%{2} %{3}%{?!3:%{error:undefined 3rd argument in arch_tagged}}}
-
-# Games macros
-%_gamesdir games
-%_gamesbindir %{_prefix}/%{_gamesdir}
-%_gamesdatadir %{_datadir}/%{_gamesdir}
-
-# Menu directories
-%_menudir %{_prefix}/lib/menu
-%_iconsdir %{_datadir}/icons
-%_miconsdir %{_datadir}/icons/mini
-%_liconsdir %{_datadir}/icons/large
-
-%_xfontdir %_datadir/fonts
-
-%_webconfdir %{_sysconfdir}/httpd/conf
-%_webappconfdir %_webconfdir/sites.d
-
-# compatibility
-%webappconfdir %_webappconfdir
-
-# For Appdata metainfo
-%_metainfodir %{_datadir}/metainfo
-
-#==============================================================================
-# ---- Build configuration macros.
-#
-# Package version macro.
-# The type of package to produce, for compatibility with legacy
-# versions of rpm.
-#
-# Script gets packaged file list on input.
-# Returns list of multiarch files that are not marked as such,
-# i.e. files in $RPM_BUILD_ROOT that have arch-dependent values
-#
-# Note: Disable (by commenting out) for legacy compatibility.
-#%__check_multiarch_files @RPMLIBDIR@/check-multiarch-files %{buildroot}
-
-# For rebuilding gcj-db
-%_rebuildgcjdb_bin %{_bindir}/rebuild-gcj-db
-%update_gcjdb if [ -x %{_rebuildgcjdb_bin} ]; then %{_rebuildgcjdb_bin} || true ; fi \
-%{nil}
-
-%clean_gcjdb if [ -x %{_rebuildgcjdb_bin} ]; then %{_rebuildgcjdb_bin} || true ; fi \
-%{nil}
-
-# Rebuild icon cache
-#
-# following themes are handled through filetriggers:
-%icon_cache_through_filetrigger_hicolor 1
-%icon_cache_through_filetrigger_gnome 1
-%icon_cache_through_filetrigger_oxygen 1
-
-%update_icon_cache() %{expand: %%{!?icon_cache_through_filetrigger_%1:if [ -x %%{_update_icon_cache_bin} ]; then \
-%%{_update_icon_cache_bin} --force --quiet %%{_iconsdir}/%%{1} || true; fi \
-%%{nil}}}
-
-%clean_icon_cache() %{expand: %%{!?icon_cache_through_filetrigger_%1:if [ -x %%{_update_icon_cache_bin} -a -r %%{_iconsdir}/%%{1}/index.theme ]; then \
-%%{_update_icon_cache_bin} --force --quiet %%{_iconsdir}/%%{1} || true ; fi \
-%%{nil}}}
-
-# GConf schemas:
-# uninstall still need to be done in %preun:
-%preun_uninstall_gconf_schemas() if [ "$1" = "0" -a -x %{_gconftool_bin} ]; then \
-SCHEMAS="" \
-for SCHEMA in %{*} ; do \
- SCHEMAS="$SCHEMAS %{_sysconfdir}/gconf/schemas/$SCHEMA.schemas" \
-done \
-GCONF_CONFIG_SOURCE=`%{_gconftool_bin} --get-default-source` %{_gconftool_bin} --makefile-uninstall-rule $SCHEMAS > /dev/null || true ; fi \
-%{nil}
-
-# Mageia Linux version
-# (user may copy the following line in specfile)
-%mgaversion %distro_release
-
-%distsuffix @DISTSUFFIX@
-
-%__dist_ident %{?distsuffix:%distsuffix}%{?!distsuffix:.mga}%{?distro_release:%distro_release}
-
-%__distro_section %{?distro_section:%distro_section}%{?!distro_section:core}
-
-%mkrel(c:) %{-c: 0.%{-c*}.}%{1}%{?subrel:.%subrel}%{?dist:%dist}%{?!dist:%__dist_ident}%([ "%{__distro_section}" != "core" ] && echo .%__distro_section)
-
-%_logdir %{_var}/log
-%_localstatedir /var
-
-%_pkgdocdir %{_docdir}/%{name}
-%_docdir_fmt %%{NAME}
-
-# Include minimal debug information in build binaries.
-# Requires _enable_debug_packages.
-#
-%_enable_debug_packages 1
-%_include_minidebuginfo 1
-%_include_gdb_index 1
-%_debugsource_packages 1
-%_debuginfo_subpackages 1
-
-#------------------------------------------------------------------------------
-# definions merged from manbo-setup-build
-#
-
-# Default extension to use (for info files)
-%_extension .xz
-
-%__install_info /sbin/install-info
-
-%_install_info() if [[ -f %{_infodir}/%{1}%{_extension} ]]; then %{__install_info} %{_infodir}/%{1}%{_extension} --dir=%{_infodir}/dir; fi \
-%{nil}
-
-# (nb: keep the "alone on its line ';'")
-%_remove_install_info() if [ "$1" = "0" ]; then if [[ -f %{_infodir}/%{1}%{_extension} ]]; then %{__install_info} %{_infodir}/%{1}%{_extension} --dir=%{_infodir}/dir --remove ; fi; fi \
-%{nil}
-
-# Macro: %{mklibname <name> [<major> [<minor>]] [-s] [-d]}
-# - %{mklibname test} => lib64test, on a lib64 platform
-# - %{mklibname test 1 -d} => libtest1-devel
-# - %{mklibname test 1 -d 0 -s} => libtest1_0-static-devel
-%mklibname(ds) %{_lib}%{1}%{?2:%{2}}%{?3:_%{3}}%{-s:-static}%{-d:-devel}
-
-# Dynamic EVRD tags macro for use with versioned provides/requires in place of
-# '%{version}-%{release}', ie. to automatically add distepoch or epoch if present
-%EVRD %{?epoch:%{epoch}:}%{?version:%{version}}%{?release:-%{release}}%{?distepoch::%{distepoch}}
-
-#==============================================================================
-# ---- compiler flags.
-
-# C compiler flags. This is traditionally called CFLAGS in makefiles.
-# Historically also available as %%{optflags}, and %%build sets the
-# environment variable RPM_OPT_FLAGS to this value.
-%build_cflags %{optflags}
-
-# C++ compiler flags. This is traditionally called CXXFLAGS in makefiles.
-%build_cxxflags %{optflags}
-
-# Fortran compiler flags. Makefiles use both FFLAGS and FCFLAGS as
-# the corresponding variable names.
-%build_fflags %{optflags} %{?_fmoddir:-I%_fmoddir}
-
-# Some linkers default to a build-id algoritim that is not supported by rpmbuild,
-# so we need to specify the right algorithm to use.
-%_build_id_flags -Wl,--build-id=sha1
-
-# Link editor flags. This is usually called LDFLAGS in makefiles.
-# (Some makefiles use LFLAGS instead.) The default value assumes that
-# the flags, while intended for ld, are still passed through the gcc
-# compiler driver. At the beginning of %%build, the environment
-# variable RPM_LD_FLAGS to this value.
-%build_ldflags %{?!_disable_ld_as_needed: -Wl,--as-needed}%{?!_disable_ld_no_undefined: -Wl,--no-undefined}%{?!_disable_ld_relro: -Wl,-z,relro}%{?!_disable_ld_O1: -Wl,-O1}%{?!_disable_ld_build_id: %_build_id_flags}%{?!_disable_ld_enable_new_dtags: -Wl,--enable-new-dtags}
-
-# For compatibility
-%ldflags %build_ldflags
-
-# Expands to shell code to seot the compiler/linker environment
-# variables CFLAGS, CXXFLAGS, FFLAGS, FCFLAGS, LDFLAGS if they have
-# not been set already. RPM_OPT_FLAGS and RPM_LD_FLAGS have already
-# been set implicitly at the start of the %%build section.
-# LT_SYS_LIBRARY_PATH is used by libtool script.
-%set_build_flags \
- CFLAGS="${CFLAGS:-%{build_cflags}}" ; export CFLAGS ; \
- CXXFLAGS="${CXXFLAGS:-%{build_cxxflags}}" ; export CXXFLAGS ; \
- FFLAGS="${FFLAGS:-%{build_fflags}}" ; export FFLAGS ; \
- FCFLAGS="${FCFLAGS:-%{build_fflags}}" ; export FCFLAGS ; \
- LDFLAGS="${LDFLAGS:-%{build_ldflags}}" ; export LDFLAGS ; \
- LT_SYS_LIBRARY_PATH="${LT_SYS_LIBRARY_PATH:-%_libdir:}" ; export LT_SYS_LIBRARY_PATH
-
-# For compatibility
-%setup_compile_flags \
- %{warn:%%setup_compile_flags is deprecated, use %%set_build_flags instead} \
- %set_build_flags
-
-%debugcflags %{?_enable_debug_packages:-g}
-
-%_fortify_cflags -Wp,-D_FORTIFY_SOURCE=2
-
-# cf http://wiki.mandriva.com/en/Development/Packaging/Problems#format_not_a_string_literal_and_no_format_arguments
-%Werror_cflags -Wformat -Werror=format-security
-
-%_ssp_cflags -fstack-protector --param=ssp-buffer-size=4%{?_serverbuild_flags: %_serverbuild_flags}
-%__common_cflags -O2 %{debugcflags} -pipe %{Werror_cflags} %{?_fortify_cflags}%{?_legacy_common_support: -fcommon}
-%__common_cflags_with_ssp %{__common_cflags} %{?_ssp_cflags}
-
-# Servers opt flags.
-# Also set the env variables for backward compatibility (mdv #32050).
-%serverbuild %define _serverbuild_flags -fstack-protector-all \
-export CFLAGS="%optflags"; export CXXFLAGS="%optflags"; export RPM_OPT_FLAGS="%optflags" \
-%{nil}
-
-%make \
- %{warn:%%make is deprecated, use %%make_build instead} \
- %{__make} -O %_smp_mflags
-
-%makeinstall_std \
- %{warn:%%makeinstall_std is deprecated, use %%make_install instead} \
- make DESTDIR=%{?buildroot:%{buildroot}} install
-
-%__fix_libtool_ltmain_from_overlinking @RPMVENDORDIR@/fix-libtool-ltmain-from-overlinking
-%__fix_libtool_from_moving_options_after_libs @RPMVENDORDIR@/fix-libtool-from-moving-options-after-libs
-%__fix_dlsearch_path_in_libtool_for_multilib @RPMVENDORDIR@/fix-dlsearch-path-in-libtool-for-multilib
-
-# Update config.{guess,sub}
-%_configure_gnuconfig_hack 1
-
-%before_configure \
- %set_build_flags \
- CONFIGURE_TOP="${CONFIGURE_TOP:-.}"; \
- if [ "%_configure_gnuconfig_hack" = "1" ]; then \
- for i in $(find ${CONFIGURE_TOP} -name config.guess -o -name config.sub); do \
- [ -f %{_rpmconfigdir}/%{_real_vendor}/$(basename $i) ] && cp -af %{_rpmconfigdir}/%{_real_vendor}/$(basename $i) $i; \
- done; \
- fi; \
- %{?!_disable_ld_as_needed:@RPMVENDORDIR@/force-as-needed-for-shared-lib-in-libtool ;} \
- %{?!_disable_ld_no_undefined:@RPMVENDORDIR@/drop-ld-no-undefined-for-shared-lib-modules-in-libtool ;} \
- %{__fix_libtool_ltmain_from_overlinking} ; \
- %{__fix_libtool_from_moving_options_after_libs} $CONFIGURE_TOP ; \
- %{__fix_dlsearch_path_in_libtool_for_multilib} $CONFIGURE_TOP %{_lib}
-
-# This is an improved version of %configure (originally from PLD team).
-%_configure $CONFIGURE_TOP/configure
-%configure \
- %{before_configure}; \
- %{_configure} --host=%{_host} --build=%{_build} \\\
- --program-prefix=%{?_program_prefix} \\\
- --disable-dependency-tracking \\\
- --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}
-
-%configure2_5x \
- %{warn:%%configure2_5x is deprecated, use %%configure instead} \
- %configure
-
-# Maximum number of CPU's to use when building, 0 for unlimited.
-%_smp_ncpus_max 0
-
-# Deprecated names. For backwards compatibility only.
-%__global_cflags %{build_cflags}
-%__global_cxxflags %{build_cxxflags}
-%__global_fflags %{build_fflags}
-%__global_fcflags %{build_fflags}
-%__global_ldflags %{build_ldflags}
-
-#==============================================================================
-# ---- Build policy macros.
-#
-#
-#---------------------------------------------------------------------
-# Expanded at beginning of %install scriptlet.
-#
-
-
-#==============================================================================
-# ---- specfile macros.
-# Macro(s) here can be used reliably for reproducible builds.
-# (Note: Above is the goal, below are the macros under development)
-#
-
-#------------------------------------------------------------------------------
-# Useful perl macros
-# (initially from Artur Frysiak <wiget@t17.ds.pwr.wroc.pl>)
-# (modified by Pixel <pixel@mandriva.com>)
-#
-# [...]
-# Group: Development/Perl
-# [...]
-# %build
-# perl Makefile.PL INSTALLDIRS=vendor
-# %make
-# [...]
-# %install
-# rm -rf $RPM_BUILD_ROOT
-# make install PREFIX="$RPM_BUILD_ROOT/%{prefix}"
-# [...]
-# %files
-# %defattr(644,root,root,755)
-# %{perl_vendorlib}/CGI
-# or
-# %{perl_vendorarch}/DBI
-# %{perl_vendorarch}/auto/DBI
-# %{_mandir}/*/*
-#
-
-%perl_convert_version() %(perl -Mversion -le '
- $x = "%{1}";
- $y = $x;
- $x =~ s/[[:alpha:]]*$//;
- $y =~ s/^$x//;
- $x =~ s/\D*$//;
- $v = version->new($x)->normal;
- $v =~ s/^v//;
- print "$v$y";
-')
-
-#--------------------------------------------------------------------------------
-# Macro from conectiva
-
-%rename() \
-Obsoletes: %{1} < %{?2:%2}%{?!2:%{?epoch:%epoch}%{?!epoch:0}:%{version}-%{release}} \
-Provides: %{1} = %{?2:%2}%{?!2:%{?epoch:%epoch}%{?!epoch:0}:%{version}-%{release}}
-
-# Shorthand for %{defined with_...}
-# macros provided by rpm 4.4, but buggy :(
-%_with() %{expand: %%{?_with_%1:1} %%{!?_with_%1: %%{?_without_%1:0} %%{!?_without_%1: %%{?with_%1:%%{with_%1}} %%{!?with_%1: %%{?without_%1:!%%{without_%1}} %%{!?without_%1: %%{?2:%%2} %%{!?2:1} } } } } }
-%_without() !%{expand: %%{with %1 %{?2:%2}}}
-
-#------------------------------------------------------------------------------
-# Java Macros
-#
-
-%gcj_support 0
-%gcj_native \
-%if %{gcj_support} \
-BuildRequires: java-gcj-compat-devel \
-%else \
-BuildArch: noarch \
-%endif
-
-%aot_compile_rpm_bin %{_bindir}/aot-compile-rpm
-
-%gcj_compile \
-%if %{gcj_support} \
-%aot_compile_rpm_bin \
-%endif
-
-%gcj_files \
-%if %{gcj_support} \
-%dir %{_libdir}/gcj/%{name} \
-%attr(-,root,root) %{_libdir}/gcj/%{name}/* \
-%endif
-
-%remove_java_binaries \
-find . -name "*.jar" -delete
-
-%create_jar_links() \
-pushd %{buildroot}%{_javadir}; \
-for jar in *-%{version}.jar; do ln -sf ${jar} ${jar/-%{version}/}; done \
-popd
-
-#------------------------------------------------------------------------------
-# Ocaml macro
-#
-
-%ocaml_sitelib %(if [ -x /usr/bin/ocamlc ]; then ocamlc -where;fi)/site-lib
-
-#------------------------------------------------------------------------------
-# Systemd and general service related macros
-#
-
-%_tmpfilescreate() /usr/bin/systemd-tmpfiles --create %{1}.conf \
-%{nil}
-
-# Minimum versions for various packaging helpers.
-# These is defined here to easy upgrading from previous distros when the various
-# service helpers change and thus those pacakges need to be installed first to
-# ensure a smooth upgrade
-%rpmhelper_required_version 0.24.11
-%systemd_required_version 195
-
-#------------------------------------------------------------------------------
-# Redefine RPM sections to allow jumping over them using "--without <section>".
-# This an interesting alternative to --short-circuit.
-# The following are mostly equivalent:
-# % rpmbuild -bi --short-circuit foo.spec && rpmbuild -bb --short-circuit foo.spec
-# % rpmbuild -bb --without build foo.spec
-
-%prep %%prep \
-[ %{_with prep} -eq 1 ] || exit 0 \
-[ %{_with build} -eq 1 ] || exit 0 \
-[ %{_with install} -eq 1 ] || exit 0 \
-%{nil}
-
-%build %%build \
-[ %{_with install} -eq 1 ] || exit 0 \
-[ %{_with build} -eq 1 ] || exit 0 \
-%{nil}
-
-#---------------------------------------------------------------------
-# Expanded at beginning of %install scriptlet.
-#
-
-%__spec_install_pre %{___build_pre}\
-if [ %{_with install} -eq 1 ]; then\
- [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "${RPM_BUILD_ROOT}"\
- mkdir -p `dirname "$RPM_BUILD_ROOT"`\
- mkdir "$RPM_BUILD_ROOT"\
-fi
-
-#---------------------------------------------------------------------
-# Expanded at end of %install scriptlet.
-
-%__brp_strip /usr/lib/rpm/brp-strip %{__strip}
-%__brp_strip_comment_note /usr/lib/rpm/brp-strip-comment-note %{__strip} %{__objdump}
-%__brp_strip_static_archive /usr/lib/rpm/brp-strip-static-archive %{__strip}
-%__brp_check_rpaths /usr/lib/rpm/check-rpaths
-%__brp_remove_la_files /usr/lib/rpm/brp-remove-la-files
-# __brp_mangle_shebangs_exclude - shebangs to exclude
-# __brp_mangle_shebangs_exclude_file - file from which to get shebangs to exclude
-# __brp_mangle_shebangs_exclude_from - files to ignore
-# __brp_mangle_shebangs_exclude_from_file - file from which to get files to ignore
-%__brp_mangle_shebangs /usr/lib/rpm/redhat/brp-mangle-shebangs %{?__brp_mangle_shebangs_exclude:--shebangs "%{?__brp_mangle_shebangs_exclude}"} %{?__brp_mangle_shebangs_exclude_file:--shebangs-from "%{__brp_mangle_shebangs_exclude_file}"} %{?__brp_mangle_shebangs_exclude_from:--files "%{?__brp_mangle_shebangs_exclude_from}"} %{?__brp_mangle_shebangs_exclude_from_file:--files-from "%{__brp_mangle_shebangs_exclude_from_file}"}
-
-%__arch_install_post /usr/lib/rpm/check-buildroot
-
-%__os_install_post \
- %{?__spec_helper_post}%{?!__spec_helper_post:/usr/share/spec-helper/spec-helper} \
- %{!?__debug_package:\
- %{?__brp_strip} \
- %{?__brp_strip_comment_note} \
- %{?__brp_strip_static_archive} \
- } \
- %{?__brp_check_rpaths} \
- %{?__brp_remove_la_files} \
- %{?__brp_mangle_shebangs} \
- %{__os_install_post_python} \
-%{nil}
-
-%__spec_install_post\
- %{?__debug_package:%{__debug_install_post}}\
- %{__arch_install_post}\
- %{__os_install_post}\
-%{nil}
-
-%install %{?_enable_debug_packages:%{?buildsubdir:%{debug_package}}}\
-%%install\
-[ %{_with install} -eq 1 ] || exit 0 \
-%{nil}
-
-%check %%check \
-[ %{_with check} -eq 1 ] || exit 0 \
-%{nil}
-
-#
-# Should missing buildids terminate a build?
-%_missing_build_ids_terminate_build 1
-
-# Use SHA-256 for FILEDIGESTS instead of default MD5
-%_source_filedigest_algorithm 8
-%_binary_filedigest_algorithm 8
-
-# Use Zstandard compression for binary payloads
-%_binary_payload w19.zstdio
-
-# Automatically trim changelog entries after 2 years
-%_changelog_trimtime %{lua:print(os.time() - 2 * 365 * 86400)}
diff --git a/macros.in b/macros.in
index 59aedb5..9a4d84e 100644
--- a/macros.in
+++ b/macros.in
@@ -50,3 +50,477 @@
# activate filetriggers (cf http://wiki.mandriva.com/en/Rpm_filetriggers)
%_filetriggers_dir /var/lib/rpm/filetriggers
+%_sys_macros_dir @RPMSYSCONFDIR@/macros.d
+%build_sysmacrospath() %{_sys_macros_dir}/%{?1:%{1}}%{?!1:%{name}}.macros
+
+# Various programs used in rpm scripts
+%_update_icon_cache_bin %{_bindir}/gtk-update-icon-cache
+%_gconftool_bin %{_bindir}/gconftool-2
+
+#==============================================================================
+# ---- Required rpmrc macros.
+# Macros that used to be initialized as a side effect of rpmrc parsing.
+# These are the default values that can be overridden by other
+# (e.g. per-platform, per-system, per-packager, per-package) macros.
+#
+
+%ix86 i386 i486 i586 i686 pentium3 pentium4 athlon k6
+
+# Multilibs
+%_multilibpatt (/%{_lib}|/usr/%{_lib}(|/gconv)|/usr/local/%{_lib}|/usr/X11R6/%{_lib}|/opt/%{_lib})/[^/]*\\.([oa]|la|so[0-9.]*)$
+
+%_arch_tag_suffix %([ "%{?_lib}" = "lib64" ] && echo "()(64bit)")
+%arch_tagged() %{1}%{_arch_tag_suffix} %{?2:%{2} %{3}%{?!3:%{error:undefined 3rd argument in arch_tagged}}}
+
+# Games macros
+%_gamesdir games
+%_gamesbindir %{_prefix}/%{_gamesdir}
+%_gamesdatadir %{_datadir}/%{_gamesdir}
+
+# Menu directories
+%_menudir %{_prefix}/lib/menu
+%_iconsdir %{_datadir}/icons
+%_miconsdir %{_datadir}/icons/mini
+%_liconsdir %{_datadir}/icons/large
+
+%_xfontdir %_datadir/fonts
+
+%_webconfdir %{_sysconfdir}/httpd/conf
+%_webappconfdir %_webconfdir/sites.d
+
+# compatibility
+%webappconfdir %_webappconfdir
+
+# For Appdata metainfo
+%_metainfodir %{_datadir}/metainfo
+
+#==============================================================================
+# ---- Build configuration macros.
+#
+# Package version macro.
+# The type of package to produce, for compatibility with legacy
+# versions of rpm.
+#
+# Script gets packaged file list on input.
+# Returns list of multiarch files that are not marked as such,
+# i.e. files in $RPM_BUILD_ROOT that have arch-dependent values
+#
+# Note: Disable (by commenting out) for legacy compatibility.
+#%__check_multiarch_files @RPMLIBDIR@/check-multiarch-files %{buildroot}
+
+# For rebuilding gcj-db
+%_rebuildgcjdb_bin %{_bindir}/rebuild-gcj-db
+%update_gcjdb if [ -x %{_rebuildgcjdb_bin} ]; then %{_rebuildgcjdb_bin} || true ; fi \
+%{nil}
+
+%clean_gcjdb if [ -x %{_rebuildgcjdb_bin} ]; then %{_rebuildgcjdb_bin} || true ; fi \
+%{nil}
+
+# Rebuild icon cache
+#
+# following themes are handled through filetriggers:
+%icon_cache_through_filetrigger_hicolor 1
+%icon_cache_through_filetrigger_gnome 1
+%icon_cache_through_filetrigger_oxygen 1
+
+%update_icon_cache() %{expand: %%{!?icon_cache_through_filetrigger_%1:if [ -x %%{_update_icon_cache_bin} ]; then \
+%%{_update_icon_cache_bin} --force --quiet %%{_iconsdir}/%%{1} || true; fi \
+%%{nil}}}
+
+%clean_icon_cache() %{expand: %%{!?icon_cache_through_filetrigger_%1:if [ -x %%{_update_icon_cache_bin} -a -r %%{_iconsdir}/%%{1}/index.theme ]; then \
+%%{_update_icon_cache_bin} --force --quiet %%{_iconsdir}/%%{1} || true ; fi \
+%%{nil}}}
+
+# GConf schemas:
+# uninstall still need to be done in %preun:
+%preun_uninstall_gconf_schemas() if [ "$1" = "0" -a -x %{_gconftool_bin} ]; then \
+SCHEMAS="" \
+for SCHEMA in %{*} ; do \
+ SCHEMAS="$SCHEMAS %{_sysconfdir}/gconf/schemas/$SCHEMA.schemas" \
+done \
+GCONF_CONFIG_SOURCE=`%{_gconftool_bin} --get-default-source` %{_gconftool_bin} --makefile-uninstall-rule $SCHEMAS > /dev/null || true ; fi \
+%{nil}
+
+# Mageia Linux version
+# (user may copy the following line in specfile)
+%mgaversion %distro_release
+
+%distsuffix @DISTSUFFIX@
+
+%__dist_ident %{?distsuffix:%distsuffix}%{?!distsuffix:.mga}%{?distro_release:%distro_release}
+
+%__distro_section %{?distro_section:%distro_section}%{?!distro_section:core}
+
+%mkrel(c:) %{-c: 0.%{-c*}.}%{1}%{?subrel:.%subrel}%{?dist:%dist}%{?!dist:%__dist_ident}%([ "%{__distro_section}" != "core" ] && echo .%__distro_section)
+
+%_logdir %{_var}/log
+%_localstatedir /var
+
+%_pkgdocdir %{_docdir}/%{name}
+%_docdir_fmt %%{NAME}
+
+# Include minimal debug information in build binaries.
+# Requires _enable_debug_packages.
+#
+%_enable_debug_packages 1
+%_include_minidebuginfo 1
+%_include_gdb_index 1
+%_debugsource_packages 1
+%_debuginfo_subpackages 1
+
+#------------------------------------------------------------------------------
+# definions merged from manbo-setup-build
+#
+
+# Default extension to use (for info files)
+%_extension .xz
+
+%__install_info /sbin/install-info
+
+%_install_info() if [[ -f %{_infodir}/%{1}%{_extension} ]]; then %{__install_info} %{_infodir}/%{1}%{_extension} --dir=%{_infodir}/dir; fi \
+%{nil}
+
+# (nb: keep the "alone on its line ';'")
+%_remove_install_info() if [ "$1" = "0" ]; then if [[ -f %{_infodir}/%{1}%{_extension} ]]; then %{__install_info} %{_infodir}/%{1}%{_extension} --dir=%{_infodir}/dir --remove ; fi; fi \
+%{nil}
+
+# Macro: %{mklibname <name> [<major> [<minor>]] [-s] [-d]}
+# - %{mklibname test} => lib64test, on a lib64 platform
+# - %{mklibname test 1 -d} => libtest1-devel
+# - %{mklibname test 1 -d 0 -s} => libtest1_0-static-devel
+%mklibname(ds) %{_lib}%{1}%{?2:%{2}}%{?3:_%{3}}%{-s:-static}%{-d:-devel}
+
+# Dynamic EVRD tags macro for use with versioned provides/requires in place of
+# '%{version}-%{release}', ie. to automatically add distepoch or epoch if present
+%EVRD %{?epoch:%{epoch}:}%{?version:%{version}}%{?release:-%{release}}%{?distepoch::%{distepoch}}
+
+#==============================================================================
+# ---- compiler flags.
+
+# C compiler flags. This is traditionally called CFLAGS in makefiles.
+# Historically also available as %%{optflags}, and %%build sets the
+# environment variable RPM_OPT_FLAGS to this value.
+%build_cflags %{optflags}
+
+# C++ compiler flags. This is traditionally called CXXFLAGS in makefiles.
+%build_cxxflags %{optflags}
+
+# Fortran compiler flags. Makefiles use both FFLAGS and FCFLAGS as
+# the corresponding variable names.
+%build_fflags %{optflags} %{?_fmoddir:-I%_fmoddir}
+
+# Some linkers default to a build-id algoritim that is not supported by rpmbuild,
+# so we need to specify the right algorithm to use.
+%_build_id_flags -Wl,--build-id=sha1
+
+# Link editor flags. This is usually called LDFLAGS in makefiles.
+# (Some makefiles use LFLAGS instead.) The default value assumes that
+# the flags, while intended for ld, are still passed through the gcc
+# compiler driver. At the beginning of %%build, the environment
+# variable RPM_LD_FLAGS to this value.
+%build_ldflags %{?!_disable_ld_as_needed: -Wl,--as-needed}%{?!_disable_ld_no_undefined: -Wl,--no-undefined}%{?!_disable_ld_relro: -Wl,-z,relro}%{?!_disable_ld_O1: -Wl,-O1}%{?!_disable_ld_build_id: %_build_id_flags}%{?!_disable_ld_enable_new_dtags: -Wl,--enable-new-dtags}
+
+# For compatibility
+%ldflags %build_ldflags
+
+# Expands to shell code to seot the compiler/linker environment
+# variables CFLAGS, CXXFLAGS, FFLAGS, FCFLAGS, LDFLAGS if they have
+# not been set already. RPM_OPT_FLAGS and RPM_LD_FLAGS have already
+# been set implicitly at the start of the %%build section.
+# LT_SYS_LIBRARY_PATH is used by libtool script.
+%set_build_flags \
+ CFLAGS="${CFLAGS:-%{build_cflags}}" ; export CFLAGS ; \
+ CXXFLAGS="${CXXFLAGS:-%{build_cxxflags}}" ; export CXXFLAGS ; \
+ FFLAGS="${FFLAGS:-%{build_fflags}}" ; export FFLAGS ; \
+ FCFLAGS="${FCFLAGS:-%{build_fflags}}" ; export FCFLAGS ; \
+ LDFLAGS="${LDFLAGS:-%{build_ldflags}}" ; export LDFLAGS ; \
+ LT_SYS_LIBRARY_PATH="${LT_SYS_LIBRARY_PATH:-%_libdir:}" ; export LT_SYS_LIBRARY_PATH
+
+# For compatibility
+%setup_compile_flags \
+ %{warn:%%setup_compile_flags is deprecated, use %%set_build_flags instead} \
+ %set_build_flags
+
+%debugcflags %{?_enable_debug_packages:-g}
+
+%_fortify_cflags -Wp,-D_FORTIFY_SOURCE=2
+
+# cf http://wiki.mandriva.com/en/Development/Packaging/Problems#format_not_a_string_literal_and_no_format_arguments
+%Werror_cflags -Wformat -Werror=format-security
+
+%_ssp_cflags -fstack-protector --param=ssp-buffer-size=4%{?_serverbuild_flags: %_serverbuild_flags}
+%__common_cflags -O2 %{debugcflags} -pipe %{Werror_cflags} %{?_fortify_cflags}%{?_legacy_common_support: -fcommon}
+%__common_cflags_with_ssp %{__common_cflags} %{?_ssp_cflags}
+
+# Servers opt flags.
+# Also set the env variables for backward compatibility (mdv #32050).
+%serverbuild %define _serverbuild_flags -fstack-protector-all \
+export CFLAGS="%optflags"; export CXXFLAGS="%optflags"; export RPM_OPT_FLAGS="%optflags" \
+%{nil}
+
+%make \
+ %{warn:%%make is deprecated, use %%make_build instead} \
+ %{__make} -O %_smp_mflags
+
+%makeinstall_std \
+ %{warn:%%makeinstall_std is deprecated, use %%make_install instead} \
+ make DESTDIR=%{?buildroot:%{buildroot}} install
+
+%__fix_libtool_ltmain_from_overlinking @RPMVENDORDIR@/fix-libtool-ltmain-from-overlinking
+%__fix_libtool_from_moving_options_after_libs @RPMVENDORDIR@/fix-libtool-from-moving-options-after-libs
+%__fix_dlsearch_path_in_libtool_for_multilib @RPMVENDORDIR@/fix-dlsearch-path-in-libtool-for-multilib
+
+# Update config.{guess,sub}
+%_configure_gnuconfig_hack 1
+
+%before_configure \
+ %set_build_flags \
+ CONFIGURE_TOP="${CONFIGURE_TOP:-.}"; \
+ if [ "%_configure_gnuconfig_hack" = "1" ]; then \
+ for i in $(find ${CONFIGURE_TOP} -name config.guess -o -name config.sub); do \
+ [ -f %{_rpmconfigdir}/%{_real_vendor}/$(basename $i) ] && cp -af %{_rpmconfigdir}/%{_real_vendor}/$(basename $i) $i; \
+ done; \
+ fi; \
+ %{?!_disable_ld_as_needed:@RPMVENDORDIR@/force-as-needed-for-shared-lib-in-libtool ;} \
+ %{?!_disable_ld_no_undefined:@RPMVENDORDIR@/drop-ld-no-undefined-for-shared-lib-modules-in-libtool ;} \
+ %{__fix_libtool_ltmain_from_overlinking} ; \
+ %{__fix_libtool_from_moving_options_after_libs} $CONFIGURE_TOP ; \
+ %{__fix_dlsearch_path_in_libtool_for_multilib} $CONFIGURE_TOP %{_lib}
+
+# This is an improved version of %configure (originally from PLD team).
+%_configure $CONFIGURE_TOP/configure
+%configure \
+ %{before_configure}; \
+ %{_configure} --host=%{_host} --build=%{_build} \\\
+ --program-prefix=%{?_program_prefix} \\\
+ --disable-dependency-tracking \\\
+ --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}
+
+%configure2_5x \
+ %{warn:%%configure2_5x is deprecated, use %%configure instead} \
+ %configure
+
+# Maximum number of CPU's to use when building, 0 for unlimited.
+%_smp_ncpus_max 0
+
+# Deprecated names. For backwards compatibility only.
+%__global_cflags %{build_cflags}
+%__global_cxxflags %{build_cxxflags}
+%__global_fflags %{build_fflags}
+%__global_fcflags %{build_fflags}
+%__global_ldflags %{build_ldflags}
+
+#==============================================================================
+# ---- Build policy macros.
+#
+#
+#---------------------------------------------------------------------
+# Expanded at beginning of %install scriptlet.
+#
+
+
+#==============================================================================
+# ---- specfile macros.
+# Macro(s) here can be used reliably for reproducible builds.
+# (Note: Above is the goal, below are the macros under development)
+#
+
+#------------------------------------------------------------------------------
+# Useful perl macros
+# (initially from Artur Frysiak <wiget@t17.ds.pwr.wroc.pl>)
+# (modified by Pixel <pixel@mandriva.com>)
+#
+# [...]
+# Group: Development/Perl
+# [...]
+# %build
+# perl Makefile.PL INSTALLDIRS=vendor
+# %make
+# [...]
+# %install
+# rm -rf $RPM_BUILD_ROOT
+# make install PREFIX="$RPM_BUILD_ROOT/%{prefix}"
+# [...]
+# %files
+# %defattr(644,root,root,755)
+# %{perl_vendorlib}/CGI
+# or
+# %{perl_vendorarch}/DBI
+# %{perl_vendorarch}/auto/DBI
+# %{_mandir}/*/*
+#
+
+%perl_convert_version() %(perl -Mversion -le '
+ $x = "%{1}";
+ $y = $x;
+ $x =~ s/[[:alpha:]]*$//;
+ $y =~ s/^$x//;
+ $x =~ s/\D*$//;
+ $v = version->new($x)->normal;
+ $v =~ s/^v//;
+ print "$v$y";
+')
+
+#--------------------------------------------------------------------------------
+# Macro from conectiva
+
+%rename() \
+Obsoletes: %{1} < %{?2:%2}%{?!2:%{?epoch:%epoch}%{?!epoch:0}:%{version}-%{release}} \
+Provides: %{1} = %{?2:%2}%{?!2:%{?epoch:%epoch}%{?!epoch:0}:%{version}-%{release}}
+
+# Shorthand for %{defined with_...}
+# macros provided by rpm 4.4, but buggy :(
+%_with() %{expand: %%{?_with_%1:1} %%{!?_with_%1: %%{?_without_%1:0} %%{!?_without_%1: %%{?with_%1:%%{with_%1}} %%{!?with_%1: %%{?without_%1:!%%{without_%1}} %%{!?without_%1: %%{?2:%%2} %%{!?2:1} } } } } }
+%_without() !%{expand: %%{with %1 %{?2:%2}}}
+
+#------------------------------------------------------------------------------
+# Java Macros
+#
+
+%gcj_support 0
+%gcj_native \
+%if %{gcj_support} \
+BuildRequires: java-gcj-compat-devel \
+%else \
+BuildArch: noarch \
+%endif
+
+%aot_compile_rpm_bin %{_bindir}/aot-compile-rpm
+
+%gcj_compile \
+%if %{gcj_support} \
+%aot_compile_rpm_bin \
+%endif
+
+%gcj_files \
+%if %{gcj_support} \
+%dir %{_libdir}/gcj/%{name} \
+%attr(-,root,root) %{_libdir}/gcj/%{name}/* \
+%endif
+
+%remove_java_binaries \
+find . -name "*.jar" -delete
+
+%create_jar_links() \
+pushd %{buildroot}%{_javadir}; \
+for jar in *-%{version}.jar; do ln -sf ${jar} ${jar/-%{version}/}; done \
+popd
+
+#------------------------------------------------------------------------------
+# Ocaml macro
+#
+
+%ocaml_sitelib %(if [ -x /usr/bin/ocamlc ]; then ocamlc -where;fi)/site-lib
+
+#------------------------------------------------------------------------------
+# Systemd and general service related macros
+#
+
+%_tmpfilescreate() /usr/bin/systemd-tmpfiles --create %{1}.conf \
+%{nil}
+
+# Minimum versions for various packaging helpers.
+# These is defined here to easy upgrading from previous distros when the various
+# service helpers change and thus those pacakges need to be installed first to
+# ensure a smooth upgrade
+%rpmhelper_required_version 0.24.11
+%systemd_required_version 195
+
+#------------------------------------------------------------------------------
+# Redefine RPM sections to allow jumping over them using "--without <section>".
+# This an interesting alternative to --short-circuit.
+# The following are mostly equivalent:
+# % rpmbuild -bi --short-circuit foo.spec && rpmbuild -bb --short-circuit foo.spec
+# % rpmbuild -bb --without build foo.spec
+
+%prep %%prep \
+[ %{_with prep} -eq 1 ] || exit 0 \
+[ %{_with build} -eq 1 ] || exit 0 \
+[ %{_with install} -eq 1 ] || exit 0 \
+%{nil}
+
+%build %%build \
+[ %{_with install} -eq 1 ] || exit 0 \
+[ %{_with build} -eq 1 ] || exit 0 \
+%{nil}
+
+#---------------------------------------------------------------------
+# Expanded at beginning of %install scriptlet.
+#
+
+%__spec_install_pre %{___build_pre}\
+if [ %{_with install} -eq 1 ]; then\
+ [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "${RPM_BUILD_ROOT}"\
+ mkdir -p `dirname "$RPM_BUILD_ROOT"`\
+ mkdir "$RPM_BUILD_ROOT"\
+fi
+
+#---------------------------------------------------------------------
+# Expanded at end of %install scriptlet.
+
+%__brp_strip /usr/lib/rpm/brp-strip %{__strip}
+%__brp_strip_comment_note /usr/lib/rpm/brp-strip-comment-note %{__strip} %{__objdump}
+%__brp_strip_static_archive /usr/lib/rpm/brp-strip-static-archive %{__strip}
+%__brp_check_rpaths /usr/lib/rpm/check-rpaths
+%__brp_remove_la_files /usr/lib/rpm/brp-remove-la-files
+# __brp_mangle_shebangs_exclude - shebangs to exclude
+# __brp_mangle_shebangs_exclude_file - file from which to get shebangs to exclude
+# __brp_mangle_shebangs_exclude_from - files to ignore
+# __brp_mangle_shebangs_exclude_from_file - file from which to get files to ignore
+%__brp_mangle_shebangs /usr/lib/rpm/redhat/brp-mangle-shebangs %{?__brp_mangle_shebangs_exclude:--shebangs "%{?__brp_mangle_shebangs_exclude}"} %{?__brp_mangle_shebangs_exclude_file:--shebangs-from "%{__brp_mangle_shebangs_exclude_file}"} %{?__brp_mangle_shebangs_exclude_from:--files "%{?__brp_mangle_shebangs_exclude_from}"} %{?__brp_mangle_shebangs_exclude_from_file:--files-from "%{__brp_mangle_shebangs_exclude_from_file}"}
+
+%__arch_install_post /usr/lib/rpm/check-buildroot
+
+%__os_install_post \
+ %{?__spec_helper_post}%{?!__spec_helper_post:/usr/share/spec-helper/spec-helper} \
+ %{!?__debug_package:\
+ %{?__brp_strip} \
+ %{?__brp_strip_comment_note} \
+ %{?__brp_strip_static_archive} \
+ } \
+ %{?__brp_check_rpaths} \
+ %{?__brp_remove_la_files} \
+ %{?__brp_mangle_shebangs} \
+ %{__os_install_post_python} \
+%{nil}
+
+%__spec_install_post\
+ %{?__debug_package:%{__debug_install_post}}\
+ %{__arch_install_post}\
+ %{__os_install_post}\
+%{nil}
+
+%install %{?_enable_debug_packages:%{?buildsubdir:%{debug_package}}}\
+%%install\
+[ %{_with install} -eq 1 ] || exit 0 \
+%{nil}
+
+%check %%check \
+[ %{_with check} -eq 1 ] || exit 0 \
+%{nil}
+
+#
+# Should missing buildids terminate a build?
+%_missing_build_ids_terminate_build 1
+
+# Use SHA-256 for FILEDIGESTS instead of default MD5
+%_source_filedigest_algorithm 8
+%_binary_filedigest_algorithm 8
+
+# Use Zstandard compression for binary payloads
+%_binary_payload w19.zstdio
+
+# Automatically trim changelog entries after 2 years
+%_changelog_trimtime %{lua:print(os.time() - 2 * 365 * 86400)}