#!/bin/bash

####################################################
# Script : kernel-2.6-sourcepackage.SlackBuild
# Purpose: Build a source package of the 2.6 Kernel
# Author : Stuart Winter <mozes@armedslack.org>
# Date...: 27-May-2006
####################################################

source /usr/share/slackdev/buildkit.sh

# Package information:
export PACKAGE=kernel-source
#export VERSION=2.6.14.6
export VERSION=2.6.19.1
export BUILD=1
export PKGSERIES=k
export ARCH=noarch
export SLACKPACKAGE=$PACKAGE-$VERSION-$ARCH-$BUILD.tgz

CWD=$PWD
TMP=/tmp/package-kernel-source
rm -rf $TMP
mkdir -pm755 $TMP/usr/src

# Extract the virgin 2.6 kernel source:
cd $TMP/usr/src
tar jxf $CWD/sources/linux-2.6/linux-$VERSION.tar.bz2
ln -vfs linux-$VERSION linux

cd linux
make clean
rm -f .version

# We put patches and config files into an 'armedslack' 
# directory.  This way users can have one source package and
# easily find the Kernel config and patches used.
mkdir -pm755 armedslack/configs
cp -favv $CWD/configs/config-riscpc-linux-2.6 armedslack/configs/
cp -favv $CWD/configs/config-versatile-linux-2.6 armedslack/configs/
cp -favv $CWD/sources/linux-2.6/patches armedslack/

# Install package description.  This modified from the Slackware version
# because we need to mention the additional 'armedslack' directory.
cd $TMP
mkdir -m755 install
install -m644 $CWD/slack-descs/kernel-source install/slack-desc

start_fakeroot
chown -R root:root
chmod -R og-w .
slackmp # run makepkg
