Blame SOURCES/macros

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