File cross-sh4-linux-kernel-headers.spec of Package cross-sh4-linux-kernel-headers
#
# spec file for package linux-kernel-headers (Version 2.6.18.2)
#
# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
# norootforbuild
Name: cross-sh4-linux-kernel-headers
BuildRequires: bison dejagnu flex gcc-c++
License: GNU General Public License (GPL)
Summary: Linux Kernel Headers
Group: Development/Libraries/C and C++
Version: 2.6.20
Release: 3
autoprov: no
URL: http://www.kernel.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-build
Provides: cross-sh4-kernel-headers
Source: kernel-headers-2.6.20.tar.bz2
Source1: create_biarch_asm.sh
Source2: version.h
Patch0: kernel-headers.SuSE.diff
Patch1: kernel-headers.diff
Patch2: kernel-headers-cross-sh4.diff
%define HOST %(echo %{_target_cpu}|sed -e "s/parisc/hppa/" -e "s/i.86/i586/" -e "s/ppc/powerpc/")-suse-linux
%define _cross_target_cpu _target_cpu
%define _prefix /usr
%if "%{name}" != "linux-kernel-headers"
%define TARGET %(echo %{name}|sed -e "s/cross-\\(.*\\)-linux-kernel-headers/\\1/;s/-/_/g;s/parisc/hppa/;s/i.86/i586/;s/ppc/powerpc/")
%if "%{TARGET}" == "sh4"
%define _cross_target_cpu sh
%else
%define _cross_target_cpu %{TARGET}
%endif
%define _prefix /opt/cross/%{TARGET}-linux/sys-root/usr
%endif
%description
This package provides Linux kernel headers, the kernel API description
required for compilation of almost all programs. This is the userspace
interface; compiling external kernel modules requires kernel-source
instead.
%prep
# The source is just the kernel's include/ subdirectory grabbed verbatim from
# the appropriate vanilla linux source tarball, with the uninteresting
# first-level subdirectories removed (just {linux,asm*} kept).
%setup -n kernel-headers
%patch0
%patch1
%if "%{TARGET}" == "sh4"
%patch2
%endif
find . -name "*.orig" -exec rm {} \;
touch asm-ia64/asm-offsets.h
%build
# Install special version.h
install -m644 $RPM_SOURCE_DIR/version.h linux/version.h
%ifarch sparc sparcv9 sparc64 x86_64
# Make sure execute permissions don't go lost
chmod 755 $RPM_SOURCE_DIR/create_biarch_asm.sh
$RPM_SOURCE_DIR/create_biarch_asm.sh %{_cross_target_cpu} $RPM_BUILD_ROOT $RPM_BUILD_DIR 1
%else
%ifarch %ix86
ln -sf asm-i386 asm
%else
%ifarch armv4l
ln -sf asm-arm asm; ln -sf proc-armv asm/proc; ln -sf arch-ebsa285 asm/arch
%else
%ifarch hppa
ln -sf asm-parisc asm
%else
%ifarch s390 s390x
ln -sf asm-s390 asm
%else
%ifarch ppc ppc64
ln -sf asm-powerpc asm
%else
(if [ ! -d asm-%{_cross_target_cpu} ]; then
echo kernel headers for %{_cross_target_cpu} does not exist
exit 1
fi
ln -sf asm-%{_cross_target_cpu} asm)
%endif
%endif
%endif
%endif
%endif
%endif
%install
mkdir -p $RPM_BUILD_ROOT%{_prefix}/include
rm -f $RPM_BUILD_ROOT%{_prefix}/include/asm
#
# Create bi-arch asm headers
#
%if "%{_cross_target_cpu}" != "%{_target_cpu}"
cp -a $RPM_BUILD_DIR/kernel-headers/asm-%{_cross_target_cpu} $RPM_BUILD_ROOT%{_prefix}/include/asm
%else
%ifarch sparc sparcv9 sparc64 x86_64
chmod 755 $RPM_SOURCE_DIR/create_biarch_asm.sh
$RPM_SOURCE_DIR/create_biarch_asm.sh %{_cross_target_cpu} $RPM_BUILD_ROOT $RPM_BUILD_DIR 0
%else
#
%ifarch armv4l
cp -a $RPM_BUILD_DIR/kernel-headers/asm-arm $RPM_BUILD_ROOT%{_prefix}/include/asm
%else
%ifarch hppa
cp -a $RPM_BUILD_DIR/kernel-headers/asm-parisc $RPM_BUILD_ROOT%{_prefix}/include/asm
%else
%ifarch s390 s390x
cp -a $RPM_BUILD_DIR/kernel-headers/asm-s390 $RPM_BUILD_ROOT%{_prefix}/include/asm
%else
%ifarch ppc ppc64
cp -a $RPM_BUILD_DIR/kernel-headers/asm-powerpc $RPM_BUILD_ROOT%{_prefix}/include/asm
%else
cp -a $RPM_BUILD_DIR/kernel-headers/asm-%{_cross_target_cpu} $RPM_BUILD_ROOT%{_prefix}/include/asm
%endif
%endif
%endif
%endif
%endif
%endif
rm -f $RPM_BUILD_ROOT%{_prefix}/include/asm-generic
cp -a $RPM_BUILD_DIR/kernel-headers/asm-generic $RPM_BUILD_ROOT%{_prefix}/include/
rm -f $RPM_BUILD_ROOT%{_prefix}/usr/include/linux
cp -a $RPM_BUILD_DIR/kernel-headers/linux $RPM_BUILD_ROOT%{_prefix}/include/linux
%clean
rm -rf $RPM_BUILD_ROOT%{_prefix}
%files
%defattr(-,root,root)
%{_prefix}/include/*
%changelog -n cross-sh4-linux-kernel-headers
* Thu Apr 5 2007 - martin.mohring@5etech.eu
- Added fix for config.h on sh4: #define CONFIG_PAGE_SIZE_4KB
* Mon Mar 5 2007 - martin.mohring@5etech.eu
- Fix for Upstream fix (wrongly packaged tar file)
* Fri Mar 2 2007 - martin.mohring@5etech.eu
- Upstream merge Linux Kernel 2.6.20 update