# Maintainer: Tobias Powalowski <tpowa@archlinux.org>
# Contributor: Surain Mallawa Arachchi <mas@crc32.net>

pkgname=linux-atm
pkgver=2.5.2
pkgrel=7
pkgdesc="Drivers and tools to support ATM networking under Linux."
arch=('x86_64')
depends=('glibc')
optdepends=('flex: for atmsigd')
url="http://linux-atm.sourceforge.net/"
license=(GPL)
source=(https://downloads.sourceforge.net/sourceforge/${pkgname}/${pkgname}-${pkgver}.tar.gz
        linux-atm-man-pages.patch
        linux-atm-remove-define-hacks.patch
        linux-atm-linux-5.2-SIOCGSTAMP.patch
        linux-atm-string-formatting.patch)
options=(!makeflags)
md5sums=('d49499368c3cf15f73a05d9bce8824a8'
         '181390736336cdb615ae32f1ae5acfa6'
         '74275ad95cef3898ef3ec52c21012e45'
         'a5a44b282461e6530ad8db0f032bf3d5'
         'b08a6e98ffac0f2870be7f3a60948c5f')

prepare() {
  cd "${pkgname}-${pkgver}"
  patch -Np1 -i ../linux-atm-man-pages.patch
  patch -Np1 -i ../linux-atm-remove-define-hacks.patch
  patch -Np1 -i ../linux-atm-linux-5.2-SIOCGSTAMP.patch
  patch -Np1 -i ../linux-atm-string-formatting.patch

  # install firmware in /usr/lib
  sed -i "s#/lib/firmware#/usr/lib/firmware#" src/extra/Makefile.in
}

build() {
  cd "${srcdir}/${pkgname}-${pkgver}"
  ./configure --prefix=/usr --sbindir=/usr/bin --sysconfdir=/etc
  make
}

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