Blame SOURCES/macros

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