Blame SOURCES/macros

a008c1
# Per-platform rpm configuration file.
a008c1
a008c1
#==============================================================================
a008c1
# ---- per-platform macros.
a008c1
#
a008c1
%_vendor		redhat
a008c1
%_os			linux
a008c1
%_target_platform	%{_target_cpu}-%{_vendor}-%{_target_os}%{?_gnu}
a008c1
a008c1
#==============================================================================
a008c1
# ---- configure macros.  note that most of these are inherited
a008c1
#      from the defaults.
a008c1
#
a008c1
%_localstatedir		/var
a008c1
a008c1
%_pkgdocdir             %{_docdir}/%{name}
a008c1
%_docdir_fmt            %%{NAME}
a008c1
a008c1
%_fmoddir		%{_libdir}/gfortran/modules
a008c1
a008c1
%_enable_debug_packages 1
a008c1
%_include_minidebuginfo 1
a008c1
%_include_gdb_index     1
a008c1
%_debugsource_packages  1
a008c1
%_debuginfo_subpackages 1
a008c1
a008c1
#==============================================================================
a008c1
# ---- compiler flags.
a008c1
a008c1
# C compiler flags.  This is traditionally called CFLAGS in makefiles.
a008c1
# Historically also available as %%{optflags}, and %%build sets the
a008c1
# environment variable RPM_OPT_FLAGS to this value.
a008c1
%build_cflags %{optflags}
a008c1
a008c1
# C++ compiler flags.  This is traditionally called CXXFLAGS in makefiles.
a008c1
%build_cxxflags %{optflags}
a008c1
a008c1
# Fortran compiler flags.  Makefiles use both FFLAGS and FCFLAGS as
a008c1
# the corresponding variable names.
a008c1
%build_fflags %{optflags} -I%{_fmoddir}
a008c1
a008c1
# Link editor flags.  This is usually called LDFLAGS in makefiles.
a008c1
# (Some makefiles use LFLAGS instead.)  The default value assumes that
a008c1
# the flags, while intended for ld, are still passed through the gcc
a008c1
# compiler driver.  At the beginning of %%build, the environment
a008c1
# variable RPM_LD_FLAGS to this value.
a008c1
%build_ldflags -Wl,-z,relro %{_ld_symbols_flags} %{_hardened_ldflags}
a008c1
a008c1
# Expands to shell code to seot the compiler/linker environment
a008c1
# variables CFLAGS, CXXFLAGS, FFLAGS, FCFLAGS, LDFLAGS if they have
a008c1
# not been set already.  RPM_OPT_FLAGS and RPM_LD_FLAGS have already
a008c1
# been set implicitly at the start of the %%build section.
a008c1
%set_build_flags \
a008c1
  CFLAGS="${CFLAGS:-%{build_cflags}}" ; export CFLAGS ; \
a008c1
  CXXFLAGS="${CXXFLAGS:-%{build_cxxflags}}" ; export CXXFLAGS ; \
a008c1
  FFLAGS="${FFLAGS:-%{build_fflags}}" ; export FFLAGS ; \
a008c1
  FCFLAGS="${FCFLAGS:-%{build_fflags}}" ; export FCFLAGS ; \
a008c1
  LDFLAGS="${LDFLAGS:-%{build_ldflags}}" ; export LDFLAGS
a008c1
a008c1
# Internal-only.  Do not use.  Expand a variable and strip the flags
a008c1
# not suitable to extension builders.
a008c1
%__extension_strip_flags() %{lua:
a008c1
local name = rpm.expand("%{1}")
a008c1
local value = " " .. rpm.expand("%{build_" .. name .. "}")
a008c1
local result = string.gsub(value, "%s+-specs=[^%s]+", " ")
a008c1
print(result)
a008c1
}
a008c1
a008c1
# Variants of CFLAGS, CXXFLAGS, FFLAGS, LDFLAGS for use within
a008c1
# extension builders.
a008c1
%extension_cflags %{__extension_strip_flags cflags}
a008c1
%extension_cxxflags %{__extension_strip_flags cxxflags}
a008c1
%extension_fflags %{__extension_strip_flags fflags}
a008c1
%extension_ldflags %{__extension_strip_flags ldflags}
a008c1
a008c1
# Deprecated names.  For backwards compatibility only.
a008c1
%__global_cflags %{build_cflags}
a008c1
%__global_cxxflags %{build_cxxflags}
a008c1
%__global_fflags %{build_fflags}
a008c1
%__global_fcflags %{build_fflags}
a008c1
%__global_ldflags %{build_ldflags}
a008c1
a008c1
#==============================================================================
a008c1
# ---- configure and makeinstall.
a008c1
#
a008c1
%_configure_gnuconfig_hack	1
a008c1
%_configure_libtool_hardening_hack	1
a008c1
# If defined, _configure_disable_silent_rules will cause --disable-silent-rules
a008c1
# to be added to the list of options passed to the configure script.
a008c1
# Eventually we'll want to turn this on by default, but this gives packagers a
a008c1
# way to turn it back off.
a008c1
# %_configure_disable_silent_rules 1
a008c1
%configure \
a008c1
  %{set_build_flags}; \
a008c1
  [ "%_configure_gnuconfig_hack" = 1 ] && for i in $(find $(dirname %{_configure}) -name config.guess -o -name config.sub) ; do \
a008c1
      [ -f /usr/lib/rpm/redhat/$(basename $i) ] && %{__rm} -f $i && %{__cp} -fv /usr/lib/rpm/redhat/$(basename $i) $i ; \
a008c1
  done ; \
a008c1
  [ "%_configure_libtool_hardening_hack" = 1 ] && [ x != "x%{_hardened_ldflags}" ] && \
a008c1
      for i in $(find . -name ltmain.sh) ; do \
a008c1
        %{__sed} -i.backup -e 's~compiler_flags=$~compiler_flags="%{_hardened_ldflags}"~' $i \
a008c1
      done ; \
a008c1
  %{_configure} --build=%{_build} --host=%{_host} \\\
a008c1
	--program-prefix=%{?_program_prefix} \\\
a008c1
	--disable-dependency-tracking \\\
a008c1
	%{?_configure_disable_silent_rules:--disable-silent-rules} \\\
a008c1
	--prefix=%{_prefix} \\\
a008c1
	--exec-prefix=%{_exec_prefix} \\\
a008c1
	--bindir=%{_bindir} \\\
a008c1
	--sbindir=%{_sbindir} \\\
a008c1
	--sysconfdir=%{_sysconfdir} \\\
a008c1
	--datadir=%{_datadir} \\\
a008c1
	--includedir=%{_includedir} \\\
a008c1
	--libdir=%{_libdir} \\\
a008c1
	--libexecdir=%{_libexecdir} \\\
a008c1
	--localstatedir=%{_localstatedir} \\\
a008c1
	--sharedstatedir=%{_sharedstatedir} \\\
a008c1
	--mandir=%{_mandir} \\\
a008c1
	--infodir=%{_infodir}
a008c1
a008c1
# Maximum number of CPU's to use when building, 0 for unlimited.
a008c1
#
a008c1
# This was for some time capped at 16.  Please see
a008c1
# https://bugzilla.redhat.com/show_bug.cgi?id=669638 and
a008c1
# https://bugzilla.redhat.com/show_bug.cgi?id=1384938 for the situation
a008c1
# surrounding this.
a008c1
#%_smp_ncpus_max 0
a008c1
%_smp_mflags %([ -z "$RPM_BUILD_NCPUS" ] \\\
a008c1
	&& RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\
a008c1
        ncpus_max=%{?_smp_ncpus_max}; \\\
a008c1
        if [ -n "$ncpus_max" ] && [ "$ncpus_max" -gt 0 ] && [ "$RPM_BUILD_NCPUS" -gt "$ncpus_max" ]; then RPM_BUILD_NCPUS="$ncpus_max"; fi; \\\
a008c1
        if [ "$RPM_BUILD_NCPUS" -gt 1 ]; then echo "-j$RPM_BUILD_NCPUS"; fi)
a008c1
a008c1
#==============================================================================
a008c1
# ---- Build policy macros.
a008c1
#
a008c1
#
a008c1
#---------------------------------------------------------------------
a008c1
#	Expanded at beginning of %install scriptlet.
a008c1
#
a008c1
a008c1
%__spec_install_pre %{___build_pre}\
a008c1
    [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "${RPM_BUILD_ROOT}"\
a008c1
    mkdir -p `dirname "$RPM_BUILD_ROOT"`\
a008c1
    mkdir "$RPM_BUILD_ROOT"\
a008c1
%{nil}
a008c1
a008c1
#---------------------------------------------------------------------
a008c1
#	Expanded at end of %install scriptlet.
a008c1
#
a008c1
a008c1
%__arch_install_post   /usr/lib/rpm/check-buildroot
a008c1
a008c1
# Build root policy macros. Standard naming:
a008c1
# convert all '-' in basename to '_', add two leading underscores.
a008c1
%__brp_ldconfig /usr/lib/rpm/redhat/brp-ldconfig
a008c1
%__brp_compress /usr/lib/rpm/brp-compress
a008c1
%__brp_strip /usr/lib/rpm/brp-strip %{__strip}
a008c1
%__brp_strip_comment_note /usr/lib/rpm/brp-strip-comment-note %{__strip} %{__objdump}
a008c1
%__brp_strip_static_archive /usr/lib/rpm/brp-strip-static-archive %{__strip}
a008c1
%__brp_python_bytecompile /usr/lib/rpm/brp-python-bytecompile %{?_python_bytecompile_errors_terminate_build}
a008c1
%__brp_python_hardlink /usr/lib/rpm/brp-python-hardlink
a008c1
# __brp_mangle_shebangs_exclude - shebangs to exclude
a008c1
# __brp_mangle_shebangs_exclude_file - file from which to get shebangs to exclude
a008c1
# __brp_mangle_shebangs_exclude_from - files to ignore
a008c1
# __brp_mangle_shebangs_exclude_from_file - file from which to get files to ignore
a008c1
%__brp_mangle_shebangs PYTHON3="%{__python3}" /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}"}
a008c1
a008c1
%__os_install_post    \
a008c1
    %{?__brp_ldconfig} \
a008c1
    %{?__brp_compress} \
a008c1
    %{!?__debug_package:\
a008c1
    %{?__brp_strip} \
a008c1
    %{?__brp_strip_comment_note} \
a008c1
    } \
a008c1
    %{?__brp_strip_static_archive} \
a008c1
    %{?py_auto_byte_compile:%{?__brp_python_bytecompile}} \
a008c1
    %{?__brp_python_hardlink} \
a008c1
    %{?__brp_mangle_shebangs} \
a008c1
%{nil}
a008c1
a008c1
%__spec_install_post\
a008c1
    %{?__debug_package:%{__debug_install_post}}\
a008c1
    %{__arch_install_post}\
a008c1
    %{__os_install_post}\
a008c1
%{nil}
a008c1
a008c1
%install %{?_enable_debug_packages:%{?buildsubdir:%{debug_package}}}\
a008c1
%%install\
a008c1
%{nil}
a008c1
a008c1
#
a008c1
# Should missing buildids terminate a build?
a008c1
%_missing_build_ids_terminate_build    1
a008c1
a008c1
#
a008c1
## Automatically compile python files
a008c1
%py_auto_byte_compile 1
a008c1
a008c1
#
a008c1
## Should python bytecompilation errors terminate a build?
a008c1
%_python_bytecompile_errors_terminate_build 1
a008c1
a008c1
# Use SHA-256 for FILEDIGESTS instead of default MD5
a008c1
%_source_filedigest_algorithm 8
a008c1
%_binary_filedigest_algorithm 8
a008c1
a008c1
# Use XZ compression for binary payloads
a008c1
%_binary_payload w2.xzdio
a008c1
a008c1
%_hardening_cflags	-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
a008c1
# we don't escape symbols '~', '"', etc. so be careful when changing this
a008c1
%_hardening_ldflags	-Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld
a008c1
a008c1
# Harden packages by default for Fedora 23:
a008c1
# https://fedorahosted.org/fesco/ticket/1384 (accepted on 2014-02-11)
a008c1
# Use "%undefine _hardened_build" to disable.
a008c1
%_hardened_build	1
a008c1
%_hardened_cflags	%{?_hardened_build:%{_hardening_cflags}}
a008c1
%_hardened_ldflags	%{?_hardened_build:%{_hardening_ldflags}}
a008c1
a008c1
%_annobin_cflags	-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1
a008c1
a008c1
# Add extra information to binary objects created by gcc for Fedora 28:
a008c1
# https://pagure.io/fesco/issue/1780 (accepted on 2017-10-30)
a008c1
# Use "%undefine _annotated_build" to disable.
a008c1
%_annotated_build	1
a008c1
%_annotated_cflags	%{?_annotated_build:%{_annobin_cflags}}
a008c1
a008c1
# Fail linking if there are undefined symbols.  Required for proper
a008c1
# ELF symbol versioning support.  Disabled by default.
a008c1
# Use "%define _strict_symbol_defs_build 1" to enable.
a008c1
#%_strict_symbol_defs_build	1
a008c1
%_ld_symbols_flags		%{?_strict_symbol_defs_build:-Wl,-z,defs}
a008c1
a008c1
%__global_compiler_flags	-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches %{_hardened_cflags} %{_annotated_cflags}
a008c1
a008c1
#==============================================================================
a008c1
# ---- Generic auto req/prov filtering macros
a008c1
#
a008c1
# http://fedoraproject.org/wiki/PackagingDrafts/AutoProvidesAndRequiresFiltering
a008c1
a008c1
# prevent anything matching from being scanned for provides
a008c1
%filter_provides_in(P) %{expand: \
a008c1
%global __filter_prov_cmd %{?__filter_prov_cmd} %{__grep} -v %{-P} '%*' | \
a008c1
}
a008c1
a008c1
# prevent anything matching from being scanned for requires
a008c1
%filter_requires_in(P) %{expand: \
a008c1
%global __filter_req_cmd %{?__filter_req_cmd} %{__grep} -v %{-P} '%*' | \
a008c1
}
a008c1
a008c1
# filter anything matching out of the provides stream
a008c1
%filter_from_provides() %{expand: \
a008c1
%global __filter_from_prov %{?__filter_from_prov} | %{__sed} -e '%*' \
a008c1
}
a008c1
a008c1
# filter anything matching out of the requires stream
a008c1
%filter_from_requires() %{expand: \
a008c1
%global __filter_from_req %{?__filter_from_req} | %{__sed} -e '%*' \
a008c1
}
a008c1
a008c1
# actually set up the filtering bits
a008c1
%filter_setup %{expand: \
a008c1
%global _use_internal_dependency_generator 0 \
a008c1
%global __deploop() while read FILE; do echo "${FILE}" | /usr/lib/rpm/rpmdeps -%{1}; done | /bin/sort -u \
a008c1
%global __find_provides /bin/sh -c "%{?__filter_prov_cmd} %{__deploop P} %{?__filter_from_prov}" \
a008c1
%global __find_requires /bin/sh -c "%{?__filter_req_cmd}  %{__deploop R} %{?__filter_from_req}" \
a008c1
}