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
#==============================================================================
6e04472
# ---- compiler flags.
6e04472
6e04472
# C compiler flags.  This is traditionally called CFLAGS in makefiles.
6e04472
# Historically also available as %%{optflags}, and %%build sets the
6e04472
# environment variable RPM_OPT_FLAGS to this value.
6e04472
%build_cflags %{optflags}
6e04472
6e04472
# C++ compiler flags.  This is traditionally called CXXFLAGS in makefiles.
6e04472
%build_cxxflags %{optflags}
6e04472
6e04472
# Fortran compiler flags.  Makefiles use both FFLAGS and FCFLAGS as
6e04472
# the corresponding variable names.
6e04472
%build_fflags %{optflags} -I%{_fmoddir}
6e04472
6e04472
# Link editor flags.  This is usually called LDFLAGS in makefiles.
6e04472
# (Some makefiles use LFLAGS instead.)  The default value assumes that
6e04472
# the flags, while intended for ld, are still passed through the gcc
6e04472
# compiler driver.  At the beginning of %%build, the environment
6e04472
# variable RPM_LD_FLAGS to this value.
6e04472
%build_ldflags -Wl,-z,relro %{_hardened_ldflags}
6e04472
6e04472
# Expands to shell code to seot the compiler/linker environment
6e04472
# variables CFLAGS, CXXFLAGS, FFLAGS, FCFLAGS, LDFLAGS if they have
6e04472
# not been set already.  RPM_OPT_FLAGS and RPM_LD_FLAGS have already
6e04472
# been set implicitly at the start of the %%build section.
6e04472
%set_build_flags \
6e04472
  CFLAGS="${CFLAGS:-%{build_cflags}}" ; export CFLAGS ; \
6e04472
  CXXFLAGS="${CXXFLAGS:-%{build_cxxflags}}" ; export CXXFLAGS ; \
6e04472
  FFLAGS="${FFLAGS:-%{build_fflags}}" ; export FFLAGS ; \
6e04472
  FCFLAGS="${FCFLAGS:-%{build_fflags}}" ; export FCFLAGS ; \
6e04472
  LDFLAGS="${LDFLAGS:-%{build_ldflags}}" ; export LDFLAGS
6e04472
6e04472
# Deprecated names.  For backwards compatibility only.
6e04472
%__global_cflags %{build_cflags}
6e04472
%__global_cxxflags %{build_cxxflags}
6e04472
%__global_fflags %{build_fflags}
6e04472
%__global_fcflags %{build_fflags}
6e04472
%__global_ldflags %{build_ldflags}
6e04472
6e04472
#==============================================================================
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 \
6e04472
  %{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
5f7da21
# Maximum number of CPU's to use when building, 0 for unlimited.
9a4753b
#
9a4753b
# This was for some time capped at 16.  Please see
9a4753b
# https://bugzilla.redhat.com/show_bug.cgi?id=669638 and
9a4753b
# https://bugzilla.redhat.com/show_bug.cgi?id=1384938 for the situation
9a4753b
# surrounding this.
9a4753b
#%_smp_ncpus_max 0
Elliot Lee 03bb291
%_smp_mflags %([ -z "$RPM_BUILD_NCPUS" ] \\\
Elliot Lee 03bb291
	&& RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\
5f7da21
        ncpus_max=%{?_smp_ncpus_max}; \\\
5f7da21
        if [ -n "$ncpus_max" ] && [ "$ncpus_max" -gt 0 ] && [ "$RPM_BUILD_NCPUS" -gt "$ncpus_max" ]; then RPM_BUILD_NCPUS="$ncpus_max"; fi; \\\
5f7da21
        if [ "$RPM_BUILD_NCPUS" -gt 1 ]; then echo "-j$RPM_BUILD_NCPUS"; fi)
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
5df8c7a
# Build root policy macros. Standard naming:
5df8c7a
# convert all '-' in basename to '_', add two leading underscores.
5df8c7a
%__brp_compress /usr/lib/rpm/brp-compress
5df8c7a
%__brp_strip /usr/lib/rpm/brp-strip %{__strip}
5df8c7a
%__brp_strip_comment_note /usr/lib/rpm/brp-strip-comment-note %{__strip} %{__objdump}
5df8c7a
%__brp_strip_static_archive /usr/lib/rpm/brp-strip-static-archive %{__strip}
5df8c7a
%__brp_python_bytecompile /usr/lib/rpm/brp-python-bytecompile %{__python} %{?_python_bytecompile_errors_terminate_build}
5df8c7a
%__brp_python_hardlink /usr/lib/rpm/brp-python-hardlink
5df8c7a
Elliot Lee 03bb291
%__os_install_post    \
5df8c7a
    %{?__brp_compress} \
055d0b7
    %{!?__debug_package:\
5df8c7a
    %{?__brp_strip} \
5df8c7a
    %{?__brp_strip_comment_note} \
055d0b7
    } \
5df8c7a
    %{?__brp_strip_static_archive} \
5df8c7a
    %{?py_auto_byte_compile:%{?__brp_python_bytecompile} \
5df8c7a
    %{?__brp_python_hardlink} \
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
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
5034f24
%_hardening_ldflags	-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)
d9235d2
%_hardened_build	1
5034f24
%_hardened_cflags	%{?_hardened_build:%{_hardening_cflags}}
5034f24
%_hardened_ldflags	%{?_hardened_build:%{_hardening_ldflags}}
5181193
8fe5b07
%__global_compiler_flags	-O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches %{_hardened_cflags}
3081c4e
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
}