Elliot Lee 03bb291
# Per-platform rpm configuration file.
Elliot Lee 03bb291
Elliot Lee 03bb291
#==============================================================================
Elliot Lee 03bb291
# ---- per-platform macros.
Elliot Lee 03bb291
#
Elliot Lee 03bb291
%_vendor		redhat
Elliot Lee 03bb291
%_os			linux
cb63b82
%_target_platform	%{_target_cpu}-%{_vendor}-%{_target_os}%{?_gnu}
Elliot Lee 03bb291
Elliot Lee 03bb291
#==============================================================================
Jeremy Katz 8a919b8
# ---- configure macros.  note that most of these are inherited
Jeremy Katz 8a919b8
#      from the defaults.
Elliot Lee 03bb291
#
Elliot Lee 03bb291
%_localstatedir		/var
Elliot Lee 03bb291
e606f56
%_pkgdocdir             %{_docdir}/%{name}
e606f56
%_docdir_fmt            %%{NAME}
Elliot Lee 03bb291
Jonathan Masters 9ed9b4e
%_fmoddir		%{_libdir}/gfortran/modules
Jonathan Masters 9ed9b4e
Elliot Lee cec7d07
%_enable_debug_packages 1
98d1974
%_include_minidebuginfo 1
f6596a4
%_include_gdb_index     1
00e8557
%_debugsource_packages  1
00e8557
%_debuginfo_subpackages 1
27ac144
Elliot Lee 03bb291
#==============================================================================
fa08f0e
# ---- compiler flags.
fa08f0e
fa08f0e
# C compiler flags.  This is traditionally called CFLAGS in makefiles.
fa08f0e
# Historically also available as %%{optflags}, and %%build sets the
fa08f0e
# environment variable RPM_OPT_FLAGS to this value.
fa08f0e
%build_cflags %{optflags}
fa08f0e
fa08f0e
# C++ compiler flags.  This is traditionally called CXXFLAGS in makefiles.
fa08f0e
%build_cxxflags %{optflags}
fa08f0e
fa08f0e
# Fortran compiler flags.  Makefiles use both FFLAGS and FCFLAGS as
fa08f0e
# the corresponding variable names.
fa08f0e
%build_fflags %{optflags} -I%{_fmoddir}
fa08f0e
fa08f0e
# Link editor flags.  This is usually called LDFLAGS in makefiles.
fa08f0e
# (Some makefiles use LFLAGS instead.)  The default value assumes that
fa08f0e
# the flags, while intended for ld, are still passed through the gcc
fa08f0e
# compiler driver.  At the beginning of %%build, the environment
fa08f0e
# variable RPM_LD_FLAGS to this value.
85e473f
%build_ldflags -Wl,-z,relro %{_ld_as_needed_flags} %{_ld_symbols_flags} %{_hardened_ldflags}
fa08f0e
fa08f0e
# Expands to shell code to seot the compiler/linker environment
fa08f0e
# variables CFLAGS, CXXFLAGS, FFLAGS, FCFLAGS, LDFLAGS if they have
fa08f0e
# not been set already.  RPM_OPT_FLAGS and RPM_LD_FLAGS have already
fa08f0e
# been set implicitly at the start of the %%build section.
fa08f0e
%set_build_flags \
fa08f0e
  CFLAGS="${CFLAGS:-%{build_cflags}}" ; export CFLAGS ; \
fa08f0e
  CXXFLAGS="${CXXFLAGS:-%{build_cxxflags}}" ; export CXXFLAGS ; \
fa08f0e
  FFLAGS="${FFLAGS:-%{build_fflags}}" ; export FFLAGS ; \
fa08f0e
  FCFLAGS="${FCFLAGS:-%{build_fflags}}" ; export FCFLAGS ; \
fa08f0e
  LDFLAGS="${LDFLAGS:-%{build_ldflags}}" ; export LDFLAGS
fa08f0e
e80fa13
# Internal-only.  Do not use.  Expand a variable and strip the flags
e80fa13
# not suitable to extension builders.
e80fa13
%__extension_strip_flags() %{lua:
e80fa13
local name = rpm.expand("%{1}")
e80fa13
local value = " " .. rpm.expand("%{build_" .. name .. "}")
e80fa13
local result = string.gsub(value, "%s+-specs=[^%s]+", " ")
e80fa13
print(result)
e80fa13
}
e80fa13
e80fa13
# Variants of CFLAGS, CXXFLAGS, FFLAGS, LDFLAGS for use within
e80fa13
# extension builders.
e80fa13
%extension_cflags %{__extension_strip_flags cflags}
e80fa13
%extension_cxxflags %{__extension_strip_flags cxxflags}
e80fa13
%extension_fflags %{__extension_strip_flags fflags}
e80fa13
%extension_ldflags %{__extension_strip_flags ldflags}
e80fa13
fa08f0e
# Deprecated names.  For backwards compatibility only.
fa08f0e
%__global_cflags %{build_cflags}
fa08f0e
%__global_cxxflags %{build_cxxflags}
fa08f0e
%__global_fflags %{build_fflags}
fa08f0e
%__global_fcflags %{build_fflags}
fa08f0e
%__global_ldflags %{build_ldflags}
fa08f0e
fa08f0e
#==============================================================================
Elliot Lee 03bb291
# ---- configure and makeinstall.
Elliot Lee 03bb291
#
4362927
%_configure_gnuconfig_hack	1
6c38f18
%_configure_libtool_hardening_hack	1
7359cf0
# If defined, _configure_disable_silent_rules will cause --disable-silent-rules
7359cf0
# to be added to the list of options passed to the configure script.
7359cf0
# Eventually we'll want to turn this on by default, but this gives packagers a
7359cf0
# way to turn it back off.
7359cf0
# %_configure_disable_silent_rules 1
6c38f18
%configure \
fa08f0e
  %{set_build_flags}; \
a91c848
  [ "%_configure_gnuconfig_hack" = 1 ] && for i in $(find $(dirname %{_configure}) -name config.guess -o -name config.sub) ; do \
2a55717
      [ -f /usr/lib/rpm/redhat/$(basename $i) ] && %{__rm} -f $i && %{__cp} -fv /usr/lib/rpm/redhat/$(basename $i) $i ; \
2a55717
  done ; \
6c38f18
  [ "%_configure_libtool_hardening_hack" = 1 ] && [ x != "x%{_hardened_ldflags}" ] && \
6c38f18
      for i in $(find . -name ltmain.sh) ; do \
6c38f18
        %{__sed} -i.backup -e 's~compiler_flags=$~compiler_flags="%{_hardened_ldflags}"~' $i \
6c38f18
      done ; \
f2e3413
  %{_configure} --build=%{_build} --host=%{_host} \\\
Elliot Lee 4ccbbe7
	--program-prefix=%{?_program_prefix} \\\
850eda5
	--disable-dependency-tracking \\\
a0145ec
	%{?_configure_disable_silent_rules:--disable-silent-rules} \\\
Elliot Lee a2894a5
	--prefix=%{_prefix} \\\
Elliot Lee 03bb291
	--exec-prefix=%{_exec_prefix} \\\
Elliot Lee 03bb291
	--bindir=%{_bindir} \\\
Elliot Lee 03bb291
	--sbindir=%{_sbindir} \\\
Elliot Lee 03bb291
	--sysconfdir=%{_sysconfdir} \\\
Elliot Lee 03bb291
	--datadir=%{_datadir} \\\
Elliot Lee 03bb291
	--includedir=%{_includedir} \\\
Elliot Lee 03bb291
	--libdir=%{_libdir} \\\
Elliot Lee 03bb291
	--libexecdir=%{_libexecdir} \\\
Elliot Lee 03bb291
	--localstatedir=%{_localstatedir} \\\
Elliot Lee 03bb291
	--sharedstatedir=%{_sharedstatedir} \\\
Elliot Lee 03bb291
	--mandir=%{_mandir} \\\
6c38f18
	--infodir=%{_infodir}
Elliot Lee 03bb291
Elliot Lee 03bb291
#==============================================================================
Elliot Lee 03bb291
# ---- Build policy macros.
Elliot Lee 03bb291
#
159a65f
#
159a65f
#---------------------------------------------------------------------
159a65f
#	Expanded at beginning of %install scriptlet.
159a65f
#
159a65f
159a65f
%__spec_install_pre %{___build_pre}\
159a65f
    [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "${RPM_BUILD_ROOT}"\
159a65f
    mkdir -p `dirname "$RPM_BUILD_ROOT"`\
159a65f
    mkdir "$RPM_BUILD_ROOT"\
159a65f
%{nil}
159a65f
Elliot Lee 03bb291
#---------------------------------------------------------------------
Elliot Lee 03bb291
#	Expanded at end of %install scriptlet.
Elliot Lee 03bb291
#
Elliot Lee 03bb291
Jesse Keating 9b11fc2
%__arch_install_post   /usr/lib/rpm/check-buildroot
Elliot Lee 03bb291
c4646d7
# Build root policy macros. Standard naming:
c4646d7
# convert all '-' in basename to '_', add two leading underscores.
12ace9b
%__brp_ldconfig /usr/lib/rpm/redhat/brp-ldconfig
c4646d7
%__brp_compress /usr/lib/rpm/brp-compress
c4646d7
%__brp_strip /usr/lib/rpm/brp-strip %{__strip}
c4646d7
%__brp_strip_comment_note /usr/lib/rpm/brp-strip-comment-note %{__strip} %{__objdump}
c4646d7
%__brp_strip_static_archive /usr/lib/rpm/brp-strip-static-archive %{__strip}
c7d6417
%__brp_python_bytecompile /usr/lib/rpm/brp-python-bytecompile "%{__python}" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
c4646d7
%__brp_python_hardlink /usr/lib/rpm/brp-python-hardlink
f7e8f73
# __brp_mangle_shebangs_exclude - shebangs to exclude
f7e8f73
# __brp_mangle_shebangs_exclude_file - file from which to get shebangs to exclude
f7e8f73
# __brp_mangle_shebangs_exclude_from - files to ignore
f7e8f73
# __brp_mangle_shebangs_exclude_from_file - file from which to get files to ignore
f7e8f73
%__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}"}
c4646d7
Elliot Lee 03bb291
%__os_install_post    \
12ace9b
    %{?__brp_ldconfig} \
c4646d7
    %{?__brp_compress} \
055d0b7
    %{!?__debug_package:\
c4646d7
    %{?__brp_strip} \
c4646d7
    %{?__brp_strip_comment_note} \
055d0b7
    } \
c4646d7
    %{?__brp_strip_static_archive} \
a747e7f
    %{?py_auto_byte_compile:%{?__brp_python_bytecompile}} \
c4646d7
    %{?__brp_python_hardlink} \
257a3a9
    %{?__brp_mangle_shebangs} \
Elliot Lee 03bb291
%{nil}
Elliot Lee 03bb291
Elliot Lee 03bb291
%__spec_install_post\
61fb9e2
    %{?__debug_package:%{__debug_install_post}}\
Elliot Lee 03bb291
    %{__arch_install_post}\
Elliot Lee 03bb291
    %{__os_install_post}\
Elliot Lee 03bb291
%{nil}
Elliot Lee 03bb291
Tim Powers 1640cd5
%install %{?_enable_debug_packages:%{?buildsubdir:%{debug_package}}}\
Tim Powers 1640cd5
%%install\
Jonathan Masters 9ed9b4e
%{nil}
Jonathan Masters 9ed9b4e
Elliot Lee 00cbca9
#
Jonathan Masters 9ed9b4e
# Should missing buildids terminate a build?
Jonathan Masters 9ed9b4e
%_missing_build_ids_terminate_build    1
Elliot Lee f0352fc
Elliot Lee f0352fc
#
db967d3
## Automatically compile python files
db967d3
%py_auto_byte_compile 1
db967d3
db967d3
#
7cf1ad2
## Should python bytecompilation errors terminate a build?
7cf1ad2
%_python_bytecompile_errors_terminate_build 1
c7d6417
## Should python bytecompilation compile outisde python specific directories?
a212174
%_python_bytecompile_extra 0
7cf1ad2
e2a80f3
# Use SHA-256 for FILEDIGESTS instead of default MD5
e2a80f3
%_source_filedigest_algorithm 8
e2a80f3
%_binary_filedigest_algorithm 8
e2a80f3
e56e816
# Use XZ compression for binary payloads
e56e816
%_binary_payload w2.xzdio
e56e816
5034f24
%_hardening_cflags	-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
6c38f18
# we don't escape symbols '~', '"', etc. so be careful when changing this
cd7779a
%_hardening_ldflags	-Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld
5034f24
d9235d2
# Harden packages by default for Fedora 23:
d9235d2
# https://fedorahosted.org/fesco/ticket/1384 (accepted on 2014-02-11)
3bf139f
# Use "%undefine _hardened_build" to disable.
d9235d2
%_hardened_build	1
5034f24
%_hardened_cflags	%{?_hardened_build:%{_hardening_cflags}}
5034f24
%_hardened_ldflags	%{?_hardened_build:%{_hardening_ldflags}}
5181193
b5ea4b2
%_annobin_cflags	-specs=/usr/lib/rpm/redhat/redhat-annobin-cc1
b5ea4b2
b5ea4b2
# Add extra information to binary objects created by gcc for Fedora 28:
b5ea4b2
# https://pagure.io/fesco/issue/1780 (accepted on 2017-10-30)
3bf139f
# Use "%undefine _annotated_build" to disable.
b5ea4b2
%_annotated_build	1
b5ea4b2
%_annotated_cflags	%{?_annotated_build:%{_annobin_cflags}}
b5ea4b2
078af19
# Fail linking if there are undefined symbols.  Required for proper
8d6c6d0
# ELF symbol versioning support.  Disabled by default.
68e4ff2
# Use "%define _ld_strict_symbol_defs 1" to enable.
68e4ff2
#%_ld_strict_symbol_defs		1
68e4ff2
%_ld_symbols_flags		%{?_ld_strict_symbol_defs:-Wl,-z,defs}
078af19
85e473f
# https://fedoraproject.org/wiki/Changes/RemoveExcessiveLinking
357550f
# use "%undefine _ld_as_needed" to disable.
357550f
%_ld_as_needed		1
ce50624
%_ld_as_needed_flags	%{?_ld_as_needed:-Wl,--as-needed}
85e473f
faa1ad4
%__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}
3081c4e
8c5d5de
# Automatically trim changelog entries after 2 years
8c5d5de
%_changelog_trimtime	%{lua:print(os.time() - 2 * 365 * 86400)}
8c5d5de
b5b2aed
#==============================================================================
20a4569
# ---- Generic auto req/prov filtering macros
b5b2aed
#
b5b2aed
# http://fedoraproject.org/wiki/PackagingDrafts/AutoProvidesAndRequiresFiltering
b5b2aed
b5b2aed
# prevent anything matching from being scanned for provides
b5b2aed
%filter_provides_in(P) %{expand: \
b5b2aed
%global __filter_prov_cmd %{?__filter_prov_cmd} %{__grep} -v %{-P} '%*' | \
b5b2aed
}
b5b2aed
b5b2aed
# prevent anything matching from being scanned for requires
b5b2aed
%filter_requires_in(P) %{expand: \
b5b2aed
%global __filter_req_cmd %{?__filter_req_cmd} %{__grep} -v %{-P} '%*' | \
b5b2aed
}
b5b2aed
b5b2aed
# filter anything matching out of the provides stream
b5b2aed
%filter_from_provides() %{expand: \
b5b2aed
%global __filter_from_prov %{?__filter_from_prov} | %{__sed} -e '%*' \
b5b2aed
}
b5b2aed
b5b2aed
# filter anything matching out of the requires stream
b5b2aed
%filter_from_requires() %{expand: \
b5b2aed
%global __filter_from_req %{?__filter_from_req} | %{__sed} -e '%*' \
b5b2aed
}
b5b2aed
20a4569
# actually set up the filtering bits
b5b2aed
%filter_setup %{expand: \
b5b2aed
%global _use_internal_dependency_generator 0 \
1891cc0
%global __deploop() while read FILE; do echo "${FILE}" | /usr/lib/rpm/rpmdeps -%{1}; done | /bin/sort -u \
b5b2aed
%global __find_provides /bin/sh -c "%{?__filter_prov_cmd} %{__deploop P} %{?__filter_from_prov}" \
b5b2aed
%global __find_requires /bin/sh -c "%{?__filter_req_cmd}  %{__deploop R} %{?__filter_from_req}" \
b5b2aed
}