## This is old -- don't use this.
## source/k/ makes kernel headers archives from the fresh compile.
# so all this script needs to do is re-process that archive and churn out a package.
# Also, l/glibc has copies of kernel-headers -- it doesn't use the copies in here.

#!/bin/bash

# kernel-headers.SlackBuild
# Build the kernel-headers for ARMedslack
# by Stuart Winter <stuart@armedslack.org>
# 12-Jul-04
# This script should only be run natively.

# Package metadata:
VER=2.4.21 # I had 2.4.26 here previously
ARCH=arm
BUILD=1

CWD=$PWD
PKG=/tmp/package-kernel-headers
TMP=/tmp/build-kernel-headers
rm -rf $PKG $TMP

# Create package framework:
mkdir -p $PKG/{install,usr/include} $TMP

# Install the package description:
install -m644 $CWD/slack-desc $PKG/install

# Extract Kernel & prepare the headers
cd $TMP
tar jxf $CWD/../../k/sources/linux-$VER.tar.bz2
cd linux-$VER
make mrproper
make include/linux/version.h
make symlinks
install -m644 $CWD/../../k/riscpc/config-riscpc .config
make oldconfig
cd include
cp -a asm-$ARCH asm-generic linux \
      $PKG/usr/include

cd $PKG
( cd usr/include 
  rm -f asm
  ln -s asm-$ARCH asm )

find . -type f -print0 | xargs -0 chmod 644
find . -type d -print0 | xargs -0 chmod 755
chown -R root:root .

makepkg -l y -c n /tmp/kernel-headers-$VER-$ARCH-$BUILD.tgz 

echo "Now move the headers into ~/tgzstash/d"
