# $Id$
# Maintainer: Alex Forencich <alex at alexforencich dot com>
# Contributor: Corrado Primier <bardo@aur.archlinux.org>
# Contributor: danst0 <danst0@west.de>

pkgname=avr-libc-atmel
pkgver=1.7.1
pkgrel=1
pkgdesc="The C runtime library for the AVR family of microcontrollers"
arch=('any')
url="http://savannah.nongnu.org/projects/avr-libc/"
license=('custom')
depends=('gcc-avr')
conflicts=("avr-libc")
provides=("avr-libc=$pkgver")
source=(http://savannah.nongnu.org/download/avr-libc/avr-libc-${pkgver}.tar.bz2
        'http://distribute.atmel.no/tools/opensource/avr-gcc/avr-libc-1.7.1/42-avr-libc-1.7.1-bug_11793_fix.patch'
        'http://distribute.atmel.no/tools/opensource/avr-gcc/avr-libc-1.7.1/43-avr-libc-1.7.1-bug13804.patch')
md5sums=('8608061dcff075d44d5c59cb7b6a6f39'
         '6da2573a881e4bc2b6465dad2fc6e1b9'
         '0a16996b55fc728036be7f32e1309c63')
options=(!strip)

build() {
  cd ${srcdir}/avr-libc-${pkgver}
  
  for file in ${srcdir}/*.patch; do
    echo "Patching with $file"
    patch -p0 < $file
  done
  
  ./configure --build=$(./config.guess) --host=avr --prefix=/usr
  
  make
}

package() {
  cd ${srcdir}/avr-libc-${pkgver}
  make DESTDIR=${pkgdir} install

  install -Dm644 LICENSE ${pkgdir}/usr/share/licenses/${pkgname}/COPYING
}

# vim:set ts=2 sw=2 et: