Elliot Lee 03bb29
# Per-platform rpm configuration file.
Elliot Lee 03bb29
Elliot Lee 03bb29
#==============================================================================
Elliot Lee 03bb29
# ---- per-platform macros.
Elliot Lee 03bb29
#
Elliot Lee 03bb29
%_vendor		redhat
Elliot Lee 03bb29
%_os			linux
cb63b8
%_target_platform	%{_target_cpu}-%{_vendor}-%{_target_os}%{?_gnu}
Elliot Lee 03bb29
Elliot Lee 03bb29
#==============================================================================
Jeremy Katz 8a919b
# ---- configure macros.  note that most of these are inherited
Jeremy Katz 8a919b
#      from the defaults.
Elliot Lee 03bb29
#
Elliot Lee 03bb29
%_prefix		/usr
Elliot Lee 03bb29
%_sysconfdir		/etc
Elliot Lee 03bb29
%_localstatedir		/var
2f654d
%_infodir		%{_prefix}/share/info
2f654d
%_mandir		%{_prefix}/share/man
Elliot Lee 03bb29
2f654d
%_defaultdocdir		%{_prefix}/share/doc
e606f5
%_pkgdocdir             %{_docdir}/%{name}
e606f5
%_docdir_fmt            %%{NAME}
Elliot Lee 03bb29
Jonathan Masters 9ed9b4
%_fmoddir		%{_libdir}/gfortran/modules
Jonathan Masters 9ed9b4
Elliot Lee cec7d0
%_enable_debug_packages 1
98d197
%_include_minidebuginfo 1
27ac14
Elliot Lee 03bb29
#==============================================================================
Elliot Lee 03bb29
# ---- configure and makeinstall.
Elliot Lee 03bb29
#
6c38f1
%_configure_libtool_hardening_hack	1
f2e341
%_configure ./configure
6c38f1
%configure \
Elliot Lee 03bb29
  CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
Elliot Lee 03bb29
  CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
Jonathan Masters 9ed9b4
  FFLAGS="${FFLAGS:-%optflags -I%_fmoddir}" ; export FFLAGS ; \
0466a2
  FCFLAGS="${FCFLAGS:-%optflags -I%_fmoddir}" ; export FCFLAGS ; \
4b29a2
  LDFLAGS="${LDFLAGS:-%__global_ldflags}"; export LDFLAGS; \
2a5571
  for i in $(find . -name config.guess -o -name config.sub) ; do \
2a5571
      [ -f /usr/lib/rpm/redhat/$(basename $i) ] && %{__rm} -f $i && %{__cp} -fv /usr/lib/rpm/redhat/$(basename $i) $i ; \
2a5571
  done ; \
6c38f1
  [ "%_configure_libtool_hardening_hack" = 1 ] && [ x != "x%{_hardened_ldflags}" ] && \
6c38f1
      for i in $(find . -name ltmain.sh) ; do \
6c38f1
        %{__sed} -i.backup -e 's~compiler_flags=$~compiler_flags="%{_hardened_ldflags}"~' $i \
6c38f1
      done ; \
f2e341
  %{_configure} --build=%{_build} --host=%{_host} \\\
Elliot Lee 4ccbbe
	--program-prefix=%{?_program_prefix} \\\
850eda
	--disable-dependency-tracking \\\
Elliot Lee a2894a
	--prefix=%{_prefix} \\\
Elliot Lee 03bb29
	--exec-prefix=%{_exec_prefix} \\\
Elliot Lee 03bb29
	--bindir=%{_bindir} \\\
Elliot Lee 03bb29
	--sbindir=%{_sbindir} \\\
Elliot Lee 03bb29
	--sysconfdir=%{_sysconfdir} \\\
Elliot Lee 03bb29
	--datadir=%{_datadir} \\\
Elliot Lee 03bb29
	--includedir=%{_includedir} \\\
Elliot Lee 03bb29
	--libdir=%{_libdir} \\\
Elliot Lee 03bb29
	--libexecdir=%{_libexecdir} \\\
Elliot Lee 03bb29
	--localstatedir=%{_localstatedir} \\\
Elliot Lee 03bb29
	--sharedstatedir=%{_sharedstatedir} \\\
Elliot Lee 03bb29
	--mandir=%{_mandir} \\\
6c38f1
	--infodir=%{_infodir}
Elliot Lee 03bb29
Elliot Lee 03bb29
%makeinstall \
Elliot Lee ecdfe2
  %{__make} \\\
Elliot Lee 03bb29
	prefix=%{?buildroot:%{buildroot}}%{_prefix} \\\
Elliot Lee 03bb29
	exec_prefix=%{?buildroot:%{buildroot}}%{_exec_prefix} \\\
Elliot Lee 03bb29
	bindir=%{?buildroot:%{buildroot}}%{_bindir} \\\
Elliot Lee 03bb29
	sbindir=%{?buildroot:%{buildroot}}%{_sbindir} \\\
Elliot Lee 03bb29
	sysconfdir=%{?buildroot:%{buildroot}}%{_sysconfdir} \\\
Elliot Lee 03bb29
	datadir=%{?buildroot:%{buildroot}}%{_datadir} \\\
Elliot Lee 03bb29
	includedir=%{?buildroot:%{buildroot}}%{_includedir} \\\
Elliot Lee 03bb29
	libdir=%{?buildroot:%{buildroot}}%{_libdir} \\\
Elliot Lee 03bb29
	libexecdir=%{?buildroot:%{buildroot}}%{_libexecdir} \\\
Elliot Lee 03bb29
	localstatedir=%{?buildroot:%{buildroot}}%{_localstatedir} \\\
Elliot Lee 03bb29
	sharedstatedir=%{?buildroot:%{buildroot}}%{_sharedstatedir} \\\
Elliot Lee 03bb29
	mandir=%{?buildroot:%{buildroot}}%{_mandir} \\\
Elliot Lee 03bb29
	infodir=%{?buildroot:%{buildroot}}%{_infodir} \\\
Elliot Lee 03bb29
  install
Elliot Lee 03bb29
5f7da2
# Maximum number of CPU's to use when building, 0 for unlimited.
5f7da2
%_smp_ncpus_max 16
Elliot Lee 03bb29
%_smp_mflags %([ -z "$RPM_BUILD_NCPUS" ] \\\
Elliot Lee 03bb29
	&& RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\
5f7da2
        ncpus_max=%{?_smp_ncpus_max}; \\\
5f7da2
        if [ -n "$ncpus_max" ] && [ "$ncpus_max" -gt 0 ] && [ "$RPM_BUILD_NCPUS" -gt "$ncpus_max" ]; then RPM_BUILD_NCPUS="$ncpus_max"; fi; \\\
5f7da2
        if [ "$RPM_BUILD_NCPUS" -gt 1 ]; then echo "-j$RPM_BUILD_NCPUS"; fi)
Elliot Lee 03bb29
Elliot Lee 03bb29
#==============================================================================
Elliot Lee 03bb29
# ---- Build policy macros.
Elliot Lee 03bb29
#
159a65
#
159a65
#---------------------------------------------------------------------
159a65
#	Expanded at beginning of %install scriptlet.
159a65
#
159a65
159a65
%__spec_install_pre %{___build_pre}\
159a65
    [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf "${RPM_BUILD_ROOT}"\
159a65
    mkdir -p `dirname "$RPM_BUILD_ROOT"`\
159a65
    mkdir "$RPM_BUILD_ROOT"\
159a65
%{nil}
159a65
Elliot Lee 03bb29
#---------------------------------------------------------------------
Elliot Lee 03bb29
#	Expanded at end of %install scriptlet.
Elliot Lee 03bb29
#
Elliot Lee 03bb29
Jesse Keating 9b11fc
%__arch_install_post   /usr/lib/rpm/check-buildroot
Elliot Lee 03bb29
Elliot Lee 03bb29
%__os_install_post    \
Elliot Lee 03bb29
    /usr/lib/rpm/redhat/brp-compress \
055d0b
    %{!?__debug_package:\
055d0b
    /usr/lib/rpm/redhat/brp-strip %{__strip} \
Elliot Lee 1de7d8
    /usr/lib/rpm/redhat/brp-strip-comment-note %{__strip} %{__objdump} \
055d0b
    } \
055d0b
    /usr/lib/rpm/redhat/brp-strip-static-archive %{__strip} \
7cf1ad
    /usr/lib/rpm/brp-python-bytecompile %{__python} %{?_python_bytecompile_errors_terminate_build} \
Jeremy Katz a959c1
    /usr/lib/rpm/redhat/brp-python-hardlink \
Jeremy Katz 85ff37
    %{!?__jar_repack:/usr/lib/rpm/redhat/brp-java-repack-jars} \
Elliot Lee 03bb29
%{nil}
Elliot Lee 03bb29
Elliot Lee 47b9f8
#    /usr/lib/rpm/redhat/brp-implant-ident-static
Elliot Lee 47b9f8
Elliot Lee 03bb29
%__spec_install_post\
61fb9e
    %{?__debug_package:%{__debug_install_post}}\
Elliot Lee 03bb29
    %{__arch_install_post}\
Elliot Lee 03bb29
    %{__os_install_post}\
Elliot Lee 03bb29
%{nil}
Elliot Lee 03bb29
Tim Powers 1640cd
d18a94
#	Template for debug information sub-package.
d18a94
# NOTE: This is a copy from rpm to get the ifnarch noarch fix, it can be removed later
d18a94
%debug_package \
d18a94
%ifnarch noarch\
d18a94
%global __debug_package 1\
Elliot Lee 5fbe73
%package debuginfo \
d18a94
Summary: Debug information for package %{name}\
d18a94
Group: Development/Debug\
Jonathan Masters 9ed9b4
AutoReqProv: 0\
Elliot Lee 5fbe73
%description debuginfo\
d18a94
This package provides debug information for package %{name}.\
d18a94
Debug information is useful when developing applications that use this\
d18a94
package or when debugging this package.\
Elliot Lee 5fbe73
%files debuginfo -f debugfiles.list\
d18a94
%defattr(-,root,root)\
d18a94
%endif\
d18a94
%{nil}
Elliot Lee 03bb29
Tim Powers 1640cd
%install %{?_enable_debug_packages:%{?buildsubdir:%{debug_package}}}\
Tim Powers 1640cd
%%install\
Jonathan Masters 9ed9b4
%{nil}
Jonathan Masters 9ed9b4
Elliot Lee 00cbca
#
Tim Powers 4707ac
# use internal dep generator?
Tim Powers 4707ac
%_use_internal_dependency_generator 1
Tim Powers 4707ac
Tim Powers 4707ac
#
Elliot Lee 00cbca
# Should missing %doc files terminate a build?
Elliot Lee 7f05ca
%_missing_doc_files_terminate_build    1
Jonathan Masters 9ed9b4
#
Jonathan Masters 9ed9b4
# Should missing buildids terminate a build?
Jonathan Masters 9ed9b4
%_missing_build_ids_terminate_build    1
Elliot Lee f0352f
Elliot Lee f0352f
#
Elliot Lee f0352f
# Should unpackaged files in a build root terminate a build?
Elliot Lee 7f05ca
%_unpackaged_files_terminate_build    1
Elliot Lee 3b777d
7cf1ad
#
7cf1ad
## Should python bytecompilation errors terminate a build?
7cf1ad
%_python_bytecompile_errors_terminate_build 1
7cf1ad
e2a80f
# Use SHA-256 for FILEDIGESTS instead of default MD5
e2a80f
%_source_filedigest_algorithm 8
e2a80f
%_binary_filedigest_algorithm 8
e2a80f
e56e81
# Use XZ compression for binary payloads
e56e81
%_binary_payload w2.xzdio
e56e81
Elliot Lee 3b777d
%__find_provides        /usr/lib/rpm/redhat/find-provides
Elliot Lee 3b777d
%__find_requires        /usr/lib/rpm/redhat/find-requires
Elliot Lee e7eb34
5034f2
%_hardening_cflags	-specs=/usr/lib/rpm/redhat/redhat-hardened-cc1
6c38f1
# we don't escape symbols '~', '"', etc. so be careful when changing this
5034f2
%_hardening_ldflags	-specs=/usr/lib/rpm/redhat/redhat-hardened-ld
5034f2
5034f2
#_hardened_build	0
5034f2
%_hardened_cflags	%{?_hardened_build:%{_hardening_cflags}}
5034f2
%_hardened_ldflags	%{?_hardened_build:%{_hardening_ldflags}}
518119
33b9cb
%__global_cflags	-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}
0ae4b3
%__global_ldflags	-Wl,-z,relro %{_hardened_ldflags}
Elliot Lee f41aa8
Jeremy Katz feffba
# Use these macros to differentiate between RH and other KMP implementation(s).
Jeremy Katz feffba
redhat_kernel_module_package	1
Jeremy Katz feffba
kernel_module_package_release	1
Jeremy Katz feffba
Jeremy Katz feffba
#kernel_module_package [ -n name ] [ -v version ] [ -r release ] [ -s script ]
Jeremy Katz feffba
#                      [ -f filelist] [ -x ] [ -p preamble ] flavor flavor ...
Jeremy Katz feffba
Jeremy Katz feffba
%kernel_module_package_buildreqs	%global kmodtool_generate_buildreqs 1 \
Jeremy Katz feffba
					kernel-devel
Jeremy Katz feffba
Jeremy Katz feffba
%kernel_module_package(n:v:r:s:f:xp:) %{expand:%( \
Jeremy Katz feffba
	%define kmodtool %{-s*}%{!-s:/usr/lib/rpm/redhat/kmodtool} \
Jeremy Katz feffba
	%define kmp_version %{-v*}%{!-v:%{version}} \
Jeremy Katz feffba
	%define kmp_release %{-r*}%{!-r:%{release}} \
Jeremy Katz feffba
	%define latest_kernel %(rpm -q --qf '%{VERSION}-%{RELEASE}\\\\n' `rpm -q kernel-devel | /usr/lib/rpm/redhat/rpmsort -r | head -n 1` | head -n 1) \
Jeremy Katz feffba
	%{!?kernel_version:%{expand:%%global kernel_version %{latest_kernel}}} \
Jeremy Katz feffba
	%global kverrel %(%{kmodtool} verrel %{?kernel_version} 2>/dev/null) \
Jeremy Katz feffba
	flavors="default" \
Jeremy Katz feffba
	if [ "i686" == "%{_target_cpu}" ] || [ "x86_64" == "%{_target_cpu}" ] \
Jeremy Katz feffba
	then \
Jeremy Katz feffba
		xenver=$(rpm -q kernel-xen-devel-%{kverrel}|head -n 1)\
Jeremy Katz feffba
		kdver=$(rpm -q kernel-kdump-devel-%{kverrel}|head -n 1)\
Jeremy Katz feffba
		if [ "kernel-xen-devel-%{kverrel}" == "$xenver" ] \
Jeremy Katz feffba
		then \
Jeremy Katz feffba
			flavors="$flavors xen" \
Jeremy Katz feffba
		fi \
Jeremy Katz feffba
		if [ "kernel-kdump-devel-%{kverrel}" == "$kdver" ] \
Jeremy Katz feffba
		then \
Jeremy Katz feffba
			flavors="$flavors kdump" \
Jeremy Katz feffba
		fi \
Jeremy Katz feffba
	fi \
Jeremy Katz feffba
	if [ -z "%*" ]; then \
Jeremy Katz feffba
		flavors_to_build=$flavors \
Jeremy Katz feffba
	elif [ -z "%{-x}" ]; then \
Jeremy Katz feffba
		flavors_to_build="%*" \
Jeremy Katz feffba
	else \
Jeremy Katz feffba
		flavors_to_build=" $flavors "\
Jeremy Katz feffba
		echo "[$flavors_to_build]" >/tmp/tmp.txt
Jeremy Katz feffba
		for i in %* \
Jeremy Katz feffba
		do \
Jeremy Katz feffba
			flavors_to_build=${flavors_to_build//$i /}
Jeremy Katz feffba
		done \
Jeremy Katz feffba
	fi \
Jeremy Katz feffba
	echo "%%global flavors_to_build ${flavors_to_build:-%%nil}" \
f41a8a
	echo "%%global kernel_source() /usr/src/kernels/%kverrel-\\\$([ %%%%{1} = default ] || echo "%%%%{1}.")%_target_cpu" \
Jeremy Katz feffba
	if [ ! -z "%{-f*}" ] \
Jeremy Katz feffba
	then \
Jeremy Katz feffba
		filelist="%{-f*}" \
Jeremy Katz feffba
	fi \
Jeremy Katz feffba
	if [ ! -z "%{-p*}" ] \
Jeremy Katz feffba
	then \
Jeremy Katz feffba
		preamble="%{-p*}" \
Jeremy Katz feffba
	fi \
Jeremy Katz feffba
	if [ -z "%{kmodtool_generate_buildreqs}" ] \
Jeremy Katz feffba
	then \
Jeremy Katz feffba
		nobuildreqs="yes" \
Jeremy Katz feffba
	fi \
Jeremy Katz feffba
	kmp_override_filelist="$filelist" kmp_override_preamble="$preamble" kmp_nobuildreqs="$buildreqs" %{kmodtool} rpmtemplate_kmp %{-n*}%{!-n:%name} %{kverrel} $flavors_to_build 2>/dev/null \
Jeremy Katz feffba
)}
b5b2ae
b5b2ae
#==============================================================================
b5b2ae
# ---- Generic auto req/prov filtering macros 
b5b2ae
#
b5b2ae
# http://fedoraproject.org/wiki/PackagingDrafts/AutoProvidesAndRequiresFiltering
b5b2ae
b5b2ae
# prevent anything matching from being scanned for provides
b5b2ae
%filter_provides_in(P) %{expand: \
b5b2ae
%global __filter_prov_cmd %{?__filter_prov_cmd} %{__grep} -v %{-P} '%*' | \
b5b2ae
}
b5b2ae
b5b2ae
# prevent anything matching from being scanned for requires
b5b2ae
%filter_requires_in(P) %{expand: \
b5b2ae
%global __filter_req_cmd %{?__filter_req_cmd} %{__grep} -v %{-P} '%*' | \
b5b2ae
}
b5b2ae
b5b2ae
# filter anything matching out of the provides stream
b5b2ae
%filter_from_provides() %{expand: \
b5b2ae
%global __filter_from_prov %{?__filter_from_prov} | %{__sed} -e '%*' \
b5b2ae
}
b5b2ae
b5b2ae
# filter anything matching out of the requires stream
b5b2ae
%filter_from_requires() %{expand: \
b5b2ae
%global __filter_from_req %{?__filter_from_req} | %{__sed} -e '%*' \
b5b2ae
}
b5b2ae
b5b2ae
# actually set up the filtering bits 
b5b2ae
%filter_setup %{expand: \
b5b2ae
%global _use_internal_dependency_generator 0 \
1891cc
%global __deploop() while read FILE; do echo "${FILE}" | /usr/lib/rpm/rpmdeps -%{1}; done | /bin/sort -u \
b5b2ae
%global __find_provides /bin/sh -c "%{?__filter_prov_cmd} %{__deploop P} %{?__filter_from_prov}" \
b5b2ae
%global __find_requires /bin/sh -c "%{?__filter_req_cmd}  %{__deploop R} %{?__filter_from_req}" \
b5b2ae
}
b5b2ae