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
%_prefix		/usr
Elliot Lee 03bb291
%_sysconfdir		/etc
Elliot Lee 03bb291
%_localstatedir		/var
Elliot Lee 03bb291
%_infodir		/usr/share/info
Elliot Lee 03bb291
%_mandir		/usr/share/man
Elliot Lee 03bb291
%_initrddir		%{_sysconfdir}/rc.d/init.d
Elliot Lee 03bb291
Elliot Lee 03bb291
%_defaultdocdir		%{_usr}/share/doc
Elliot Lee 03bb291
Jonathan Masters 9ed9b4e
%_fmoddir		%{_libdir}/gfortran/modules
Jonathan Masters 9ed9b4e
Elliot Lee cec7d07
%_enable_debug_packages 1
27ac144
Elliot Lee 03bb291
#==============================================================================
Elliot Lee 03bb291
# ---- configure and makeinstall.
Elliot Lee 03bb291
#
Elliot Lee 03bb291
%configure \
Elliot Lee 03bb291
  CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ; \
Elliot Lee 03bb291
  CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ; \
Jonathan Masters 9ed9b4e
  FFLAGS="${FFLAGS:-%optflags -I%_fmoddir}" ; export FFLAGS ; \
Elliot Lee 2eb59b7
  ./configure --build=%{_build} --host=%{_host} \\\
Elliot Lee a2894a5
	--target=%{_target_platform} \\\
Elliot Lee 4ccbbe7
	--program-prefix=%{?_program_prefix} \\\
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} \\\
Elliot Lee 03bb291
	--infodir=%{_infodir}
Elliot Lee 03bb291
Elliot Lee 03bb291
%makeinstall \
Elliot Lee ecdfe2c
  %{__make} \\\
Elliot Lee 03bb291
	prefix=%{?buildroot:%{buildroot}}%{_prefix} \\\
Elliot Lee 03bb291
	exec_prefix=%{?buildroot:%{buildroot}}%{_exec_prefix} \\\
Elliot Lee 03bb291
	bindir=%{?buildroot:%{buildroot}}%{_bindir} \\\
Elliot Lee 03bb291
	sbindir=%{?buildroot:%{buildroot}}%{_sbindir} \\\
Elliot Lee 03bb291
	sysconfdir=%{?buildroot:%{buildroot}}%{_sysconfdir} \\\
Elliot Lee 03bb291
	datadir=%{?buildroot:%{buildroot}}%{_datadir} \\\
Elliot Lee 03bb291
	includedir=%{?buildroot:%{buildroot}}%{_includedir} \\\
Elliot Lee 03bb291
	libdir=%{?buildroot:%{buildroot}}%{_libdir} \\\
Elliot Lee 03bb291
	libexecdir=%{?buildroot:%{buildroot}}%{_libexecdir} \\\
Elliot Lee 03bb291
	localstatedir=%{?buildroot:%{buildroot}}%{_localstatedir} \\\
Elliot Lee 03bb291
	sharedstatedir=%{?buildroot:%{buildroot}}%{_sharedstatedir} \\\
Elliot Lee 03bb291
	mandir=%{?buildroot:%{buildroot}}%{_mandir} \\\
Elliot Lee 03bb291
	infodir=%{?buildroot:%{buildroot}}%{_infodir} \\\
Elliot Lee 03bb291
  install
Elliot Lee 03bb291
Elliot Lee 03bb291
%_smp_mflags %([ -z "$RPM_BUILD_NCPUS" ] \\\
Elliot Lee 03bb291
	&& RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\
3a2d93f
        if [ "$RPM_BUILD_NCPUS" -gt 16 ]; then echo "-j16"; \\\
3a2d93f
        elif [ "$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
#
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
Elliot Lee 03bb291
%__os_install_post    \
Elliot Lee 03bb291
    /usr/lib/rpm/redhat/brp-compress \
Elliot Lee 12233c1
    %{!?__debug_package:/usr/lib/rpm/redhat/brp-strip %{__strip}} \
Bill Nottingham 3397996
    /usr/lib/rpm/redhat/brp-strip-static-archive %{__strip} \
Elliot Lee 1de7d81
    /usr/lib/rpm/redhat/brp-strip-comment-note %{__strip} %{__objdump} \
Elliot Lee f20fd09
    /usr/lib/rpm/brp-python-bytecompile \
Jeremy Katz a959c1f
    /usr/lib/rpm/redhat/brp-python-hardlink \
Jeremy Katz 85ff376
    %{!?__jar_repack:/usr/lib/rpm/redhat/brp-java-repack-jars} \
Elliot Lee 03bb291
%{nil}
Elliot Lee 03bb291
Elliot Lee 47b9f84
#    /usr/lib/rpm/redhat/brp-implant-ident-static
Elliot Lee 47b9f84
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
d18a947
#	Template for debug information sub-package.
d18a947
# NOTE: This is a copy from rpm to get the ifnarch noarch fix, it can be removed later
d18a947
%debug_package \
d18a947
%ifnarch noarch\
d18a947
%global __debug_package 1\
Elliot Lee 5fbe73e
%package debuginfo \
d18a947
Summary: Debug information for package %{name}\
d18a947
Group: Development/Debug\
Jonathan Masters 9ed9b4e
AutoReqProv: 0\
Elliot Lee 5fbe73e
%description debuginfo\
d18a947
This package provides debug information for package %{name}.\
d18a947
Debug information is useful when developing applications that use this\
d18a947
package or when debugging this package.\
Elliot Lee 5fbe73e
%files debuginfo -f debugfiles.list\
d18a947
%defattr(-,root,root)\
d18a947
%endif\
d18a947
%{nil}
Elliot Lee 03bb291
Elliot Lee 668485e
# Bad hack to set $LANG to C during all RPM builds
27ac144
%prep \
27ac144
%%prep\
Elliot Lee 668485e
LANG=C\
Elliot Lee 668485e
export LANG\
Elliot Lee 4410abd
unset DISPLAY\
Elliot Lee 668485e
%{nil}
Elliot Lee 668485e
Elliot Lee 668485e
%build %%build\
Elliot Lee 668485e
LANG=C\
Elliot Lee 668485e
export LANG\
Elliot Lee 4410abd
unset DISPLAY\
Elliot Lee 668485e
%{nil}
Elliot Lee 03bb291
Tim Powers 1640cd5
%install %{?_enable_debug_packages:%{?buildsubdir:%{debug_package}}}\
Tim Powers 1640cd5
%%install\
Elliot Lee 668485e
LANG=C\
Elliot Lee 668485e
export LANG\
Elliot Lee 4410abd
unset DISPLAY\
Elliot Lee 668485e
%{nil}
Elliot Lee 3ee6bad
Jonathan Masters 9ed9b4e
%check %%check\
Jonathan Masters 9ed9b4e
unset DISPLAY\
Jonathan Masters 9ed9b4e
%{nil}
Jonathan Masters 9ed9b4e
Jeremy Katz 9ffd969
%find_lang      /usr/lib/rpm/find-lang.sh %{buildroot}
Elliot Lee 00cbca9
Elliot Lee 00cbca9
#
Tim Powers 4707ac9
# use internal dep generator?
Tim Powers 4707ac9
%_use_internal_dependency_generator 1
Tim Powers 4707ac9
Tim Powers 4707ac9
#
Elliot Lee 00cbca9
# Should missing %doc files terminate a build?
Elliot Lee 7f05ca8
%_missing_doc_files_terminate_build    1
Jonathan Masters 9ed9b4e
#
Jonathan Masters 9ed9b4e
# Should missing buildids terminate a build?
Jonathan Masters 9ed9b4e
%_missing_build_ids_terminate_build    1
Elliot Lee f0352fc
Elliot Lee f0352fc
#
Elliot Lee f0352fc
# Should unpackaged files in a build root terminate a build?
Elliot Lee 7f05ca8
%_unpackaged_files_terminate_build    1
Elliot Lee 3b777d0
Elliot Lee 3b777d0
%__find_provides        /usr/lib/rpm/redhat/find-provides
Elliot Lee 3b777d0
%__find_requires        /usr/lib/rpm/redhat/find-requires
Elliot Lee e7eb34f
Elliot Lee d5e4ed6
%__global_cflags	-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4
Elliot Lee f41aa8c
Elliot Lee f41aa8c
# Disable lookups
Elliot Lee f41aa8c
%_hkp_keyserver  %{nil}
Jeremy Katz feffba4
Jeremy Katz feffba4
# Use these macros to differentiate between RH and other KMP implementation(s).
Jeremy Katz feffba4
redhat_kernel_module_package	1
Jeremy Katz feffba4
kernel_module_package_release	1
Jeremy Katz feffba4
Jeremy Katz feffba4
#kernel_module_package [ -n name ] [ -v version ] [ -r release ] [ -s script ]
Jeremy Katz feffba4
#                      [ -f filelist] [ -x ] [ -p preamble ] flavor flavor ...
Jeremy Katz feffba4
Jeremy Katz feffba4
%kernel_module_package_buildreqs	%global kmodtool_generate_buildreqs 1 \
Jeremy Katz feffba4
					kernel-devel
Jeremy Katz feffba4
Jeremy Katz feffba4
%kernel_module_package(n:v:r:s:f:xp:) %{expand:%( \
Jeremy Katz feffba4
	%define kmodtool %{-s*}%{!-s:/usr/lib/rpm/redhat/kmodtool} \
Jeremy Katz feffba4
	%define kmp_version %{-v*}%{!-v:%{version}} \
Jeremy Katz feffba4
	%define kmp_release %{-r*}%{!-r:%{release}} \
Jeremy Katz feffba4
	%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 feffba4
	%{!?kernel_version:%{expand:%%global kernel_version %{latest_kernel}}} \
Jeremy Katz feffba4
	%global kverrel %(%{kmodtool} verrel %{?kernel_version} 2>/dev/null) \
Jeremy Katz feffba4
	flavors="default" \
Jeremy Katz feffba4
	if [ "i686" == "%{_target_cpu}" ] || [ "x86_64" == "%{_target_cpu}" ] \
Jeremy Katz feffba4
	then \
Jeremy Katz feffba4
		xenver=$(rpm -q kernel-xen-devel-%{kverrel}|head -n 1)\
Jeremy Katz feffba4
		kdver=$(rpm -q kernel-kdump-devel-%{kverrel}|head -n 1)\
Jeremy Katz feffba4
		if [ "kernel-xen-devel-%{kverrel}" == "$xenver" ] \
Jeremy Katz feffba4
		then \
Jeremy Katz feffba4
			flavors="$flavors xen" \
Jeremy Katz feffba4
		fi \
Jeremy Katz feffba4
		if [ "kernel-kdump-devel-%{kverrel}" == "$kdver" ] \
Jeremy Katz feffba4
		then \
Jeremy Katz feffba4
			flavors="$flavors kdump" \
Jeremy Katz feffba4
		fi \
Jeremy Katz feffba4
	fi \
Jeremy Katz feffba4
	if [ -z "%*" ]; then \
Jeremy Katz feffba4
		flavors_to_build=$flavors \
Jeremy Katz feffba4
	elif [ -z "%{-x}" ]; then \
Jeremy Katz feffba4
		flavors_to_build="%*" \
Jeremy Katz feffba4
	else \
Jeremy Katz feffba4
		flavors_to_build=" $flavors "\
Jeremy Katz feffba4
		echo "[$flavors_to_build]" >/tmp/tmp.txt
Jeremy Katz feffba4
		for i in %* \
Jeremy Katz feffba4
		do \
Jeremy Katz feffba4
			flavors_to_build=${flavors_to_build//$i /}
Jeremy Katz feffba4
		done \
Jeremy Katz feffba4
	fi \
Jeremy Katz feffba4
	echo "%%global flavors_to_build ${flavors_to_build:-%%nil}" \
Jeremy Katz feffba4
	echo "%%global kernel_source() /usr/src/kernels/%kverrel-\\\$([ %%%%{1} = default ] || echo "%%%%{1}-")%_target_cpu" \
Jeremy Katz feffba4
	if [ ! -z "%{-f*}" ] \
Jeremy Katz feffba4
	then \
Jeremy Katz feffba4
		filelist="%{-f*}" \
Jeremy Katz feffba4
	fi \
Jeremy Katz feffba4
	if [ ! -z "%{-p*}" ] \
Jeremy Katz feffba4
	then \
Jeremy Katz feffba4
		preamble="%{-p*}" \
Jeremy Katz feffba4
	fi \
Jeremy Katz feffba4
	if [ -z "%{kmodtool_generate_buildreqs}" ] \
Jeremy Katz feffba4
	then \
Jeremy Katz feffba4
		nobuildreqs="yes" \
Jeremy Katz feffba4
	fi \
Jeremy Katz feffba4
	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 feffba4
)}