# $Id: PKGBUILD 112467 2014-06-02 10:55:16Z spupykin $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Jens Pranaitis <jens@jenux.homelinux.org>

pkgname=busybox
pkgver=1.22.1
pkgrel=2
pkgdesc="Utilities for rescue and embedded systems"
arch=("i686" "x86_64")
url="http://www.busybox.net"
license=('GPL')
makedepends=("make" "gcc" "sed" "ncurses")
source=("$url/downloads/$pkgname-$pkgver.tar.bz2"
	http://busybox.net/downloads/fixes-$pkgver/busybox-$pkgver-{ash,date,iplink,nc}.patch
	"config")
install=busybox.install
md5sums=('337d1a15ab1cb1d4ed423168b1eb7d7e'
         '538d8cddbdfc449239b25a40bc8d1575'
         'bc381f9ceb3824141c968f5bc4353943'
         '24686ec2750a8703feb57fc9c6aaed1d'
         '69eecaae5f812d08655dfdf34b60503f'
         'e7c697e37b2120f0e0a354c48180cde4')

prepare() {
  cd "$srcdir/$pkgname-$pkgver"
  for i in $srcdir/*.patch; do
    patch -p1 <$i
  done
}

build() {
  cd "$srcdir/$pkgname-$pkgver"
  cp $srcdir/config .config
  sed '1,1i#include <sys/resource.h>' -i include/libbb.h
  # if you want to run menuconfig uncomment the following line:
#  make menuconfig ; return 1
  make
}

package() {
  cd "$srcdir/$pkgname-$pkgver"
  install -Dm755 busybox $pkgdir/usr/bin/busybox
}
