LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File linux-kernel-headers.spec.difftoin of Package orig-linux-kernel-headers (Project Ports:ARM:Base:build:cross)

--- linux-kernel-headers.spec	2009-10-11 01:51:17.000000000 +0200
+++ linux-kernel-headers.spec.in	2009-11-04 09:20:21.368255861 +0100
@@ -16,11 +16,12 @@
 #
 
 # norootforbuild
-
+%define origname linux-kernel-headers
 
 Name:           linux-kernel-headers
 License:        GPL v2 only
 Summary:        Linux Kernel Headers
 Group:          Development/Libraries/C and C++
+ExcludeArch:    %arm
 BuildArch:      noarch
 # this confusing version number has no meaning
@@ -30,7 +31,7 @@ Url:            http://www.kernel.org/
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 Provides:       kernel-headers
 PreReq:         coreutils
-Source:         %{name}-%{version}.tar.bz2
+Source:         %{origname}-%{version}.tar.bz2
 Source1:        linux-kernel-headers_install_all.sh
 Patch0:         linux-kernel-headers.SuSE.TIOCGDEV.patch
 Patch1:         linux-kernel-headers.SuSE.SO_BSDCOMPAT.patch
@@ -42,9 +43,55 @@ interface; compiling external kernel mod
 instead.
 
 
+# start if != "linux-kernel-headers"
+%if "%{name}" != "linux-kernel-headers"
+
+%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
+
+%define TARGET %(echo %{name}|sed -e "s/cross-\\(.*\\)-linux-kernel-headers/\\1/;s/-/_/g;s/parisc/hppa/;s/i.86/i586/;s/ppc/powerpc/")
+%define _cross_target_cpu %{TARGET}
+
+%if "%{TARGET}" == "sh4"
+%define _cross_target_cpu sh
+%endif
+
+%if "%{TARGET}" == "i586"
+%define _cross_target_cpu x86
+%endif
+
+%if "%{TARGET}" == "x86_64"
+%define _cross_target_cpu x86
+%endif
+
+#
+# TARGET-TUPLE
+#
+%if "%{TARGET}" == "avr" || "%{TARGET}" == "spu"
+%define TARGET_OS %{TARGET}
+%else
+%define TARGET_OS %{TARGET}-suse-linux-gnu
+%endif
+%if "%{TARGET}" == "armv5tel"
+%define TARGET_OS %{TARGET}-suse-linux-gnueabi
+%define _cross_target_cpu arm
+%endif
+
+%if "%{TARGET}" == "armv7l"
+%define TARGET_OS %{TARGET}-suse-linux-gnueabi
+%define _cross_target_cpu arm
+%endif
+
+
+%define _prefix /opt/cross/%{TARGET_OS}/sys-root/usr
+
+# end if != "linux-kernel-headers"
+%endif
+
 
 %prep
-%setup -q
+%setup -q -n %{origname}-%{version}
 %patch0
 %patch1
 
@@ -91,6 +138,16 @@ BOGUS
 cat version.h
 
 %install
+%if "%{_cross_target_cpu}" != "%{_target_cpu}"
+mkdir -p $RPM_BUILD_ROOT%{_prefix}/include
+cp -a $RPM_BUILD_DIR/%{origname}-%{version}/usr/include/asm-%{_cross_target_cpu} $RPM_BUILD_ROOT%{_prefix}/include/asm
+
+rm -f $RPM_BUILD_ROOT%{_prefix}/include/asm-generic
+cp -a $RPM_BUILD_DIR/%{origname}-%{version}/usr/include/asm-generic $RPM_BUILD_ROOT%{_prefix}/include/
+rm -f $RPM_BUILD_ROOT%{_prefix}/usr/include/linux
+cp -a $RPM_BUILD_DIR/%{origname}-%{version}/usr/include/linux $RPM_BUILD_ROOT%{_prefix}/include/linux
+%else
+
 rm -rf    $RPM_BUILD_ROOT
 mkdir     $RPM_BUILD_ROOT
 cp -a usr $RPM_BUILD_ROOT
@@ -107,7 +164,10 @@ rm -fv   $RPM_BUILD_ROOT//usr/include/sc
 # The directory turned into a symlink in 10.3 (2.6.22)
 # rpm will remove obsolete files after the post install scripts
 # A trigger will run after the /usr/include/asm was removed
+%endif
 
+%if "%{_cross_target_cpu}" != "%{_target_cpu}"
+%else
 %postun
 echo "postun %{name}-%{version}-%{release} $0 $*"
 if test "$1" = 0
@@ -115,7 +175,10 @@ then
 	rm -f usr/include/asm
 fi
 exit 0
+%endif
 
+%if "%{_cross_target_cpu}" != "%{_target_cpu}"
+%else
 %post
 echo "post %{name}-%{version}-%{release} $0 $*"
 asm_link=
@@ -147,7 +210,10 @@ then
 fi
 ln -sfn asm-$asm_link usr/include/asm
 exit 0
+%endif
 
+%if "%{_cross_target_cpu}" != "%{_target_cpu}"
+%else
 %triggerpostun -- linux-kernel-headers < 2.6.22 , glibc-devel < 2.5, libc < 2.2
 echo "triggerpostun %{name}-%{version}-%{release} $# $0 $*"
 asm_link=
@@ -164,6 +230,7 @@ case "$(uname -m)" in
 esac
 ln -sfvn asm-$asm_link usr/include/asm
 exit 0
+%endif
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -171,5 +238,13 @@ rm -rf $RPM_BUILD_ROOT
 %files
 %defattr(-,root,root)
 %{_prefix}/include/*
+%if "%{_cross_target_cpu}" != "%{_target_cpu}"
+%dir /opt/cross
+%dir /opt/cross/%{TARGET_OS}
+%dir /opt/cross/%{TARGET_OS}/sys-root
+%dir /opt/cross/%{TARGET_OS}/sys-root/usr
+%dir /opt/cross/%{TARGET_OS}/sys-root/usr/include
+%endif
+
 
 %changelog