# $Id: PKGBUILD 23617 2009-01-11 14:11:13Z thomas $
# Maintainer: Thomas Baechler <thomas@archlinux.org>

pkgname=klibc-module-init-tools
pkgver=3.5
pkgrel=30
pkgdesc="Utilities for inserting and removing modules from the Linux kernel"
arch=(i686 x86_64)
url="http://www.kernel.org"
license=('GPL')
groups=('base')
depends=('klibc' $(basename /lib/klibc-*.so .so))
source=(http://www.kernel.org/pub/linux/utils/kernel/module-init-tools/module-init-tools-$pkgver.tar.bz2)
md5sums=('2b47686247fc9a99bfdb9dd1d1d80e6f')

build() {
  cd $startdir/src/module-init-tools-$pkgver
  CFLAGS="${CFLAGS} -DCONFIG_NO_BACKWARDS_COMPAT" CC=klcc LD=klcc ./configure --prefix=/usr/lib/klibc
  # klibc lacks getc_unlocked, so use getc instead
  sed 's|getc_unlocked|getc|g' -i *.c
  make || return 1
  INSTALL=/bin/install make DESTDIR=$startdir/pkg install || return 1
  rm -f $startdir/pkg/usr/lib/klibc/sbin/{generate-modprobe.conf,insmod.static}
  rm -rf $startdir/pkg/usr/lib/klibc/{share,man}
}