1#!/bin/sh
2#
3#	Output a simple RPM spec file that uses no fancy features requring
4#	RPM v4. This is intended to work with any RPM distro.
5#
6#	The only gothic bit here is redefining install_post to avoid
7#	stripping the symbols from files in the kernel which we want
8#
9#	Patched for non-x86 by Opencon (L) 2002 <opencon@rio.skydome.net>
10#
11# That's the voodoo to see if it's a x86.
12ISX86=`arch | grep -ie i.86`
13if [ ! -z $ISX86 ]; then
14	PC=1
15else
16	PC=0
17fi
18# starting to output the spec
19if [ "`grep CONFIG_DRM=y .config | cut -f2 -d\=`" = "y" ]; then
20	PROVIDES=kernel-drm
21fi
22
23PROVIDES="$PROVIDES kernel-$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION"
24
25echo "Name: kernel"
26echo "Summary: The Linux Kernel"
27echo "Version: "$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION | sed -e "s/-//g"
28# we need to determine the NEXT version number so that uname and
29# rpm -q will agree
30echo "Release: `. scripts/mkversion`"
31echo "License: GPL"
32echo "Group: System Environment/Kernel"
33echo "Vendor: The Linux Community"
34echo "URL: http://www.kernel.org"
35echo -n "Source: kernel-$VERSION.$PATCHLEVEL.$SUBLEVEL"
36echo "$EXTRAVERSION.tar.gz" | sed -e "s/-//g"
37echo "BuildRoot: /var/tmp/%{name}-%{PACKAGE_VERSION}-root"
38echo "Provides: $PROVIDES"
39echo "%define __spec_install_post /usr/lib/rpm/brp-compress || :"
40echo "%define debug_package %{nil}"
41echo ""
42echo "%description"
43echo "The Linux Kernel, the operating system core itself"
44echo ""
45echo "%prep"
46echo "%setup -q"
47echo ""
48echo "%build"
49# This is the first 'disagreement' between x86 and other archs.
50if [ $PC = 1 ]; then
51	echo "make oldconfig dep clean bzImage modules"
52else
53	echo "make oldconfig dep clean vmlinux modules"
54fi
55# Back on track
56echo ""
57echo "%install"
58echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib $RPM_BUILD_ROOT/lib/modules'
59echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make modules_install'
60# And that's the second
61if [ $PC = 1 ]; then
62	echo 'cp arch/i386/boot/bzImage $RPM_BUILD_ROOT'"/boot/vmlinuz-$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION"
63else
64	echo 'cp vmlinux $RPM_BUILD_ROOT'"/boot/vmlinux-$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION"
65fi
66# Back on track, again
67echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION"
68echo 'cp .config $RPM_BUILD_ROOT'"/boot/config-$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION"
69echo ""
70echo "%clean"
71echo '#echo -rf $RPM_BUILD_ROOT'
72echo ""
73echo "%files"
74echo '%defattr (-, root, root)'
75echo "%dir /lib/modules"
76echo "/lib/modules/$VERSION.$PATCHLEVEL.$SUBLEVEL$EXTRAVERSION"
77echo "/boot/*"
78echo ""
79