# $Id: PKGBUILD 66004 2012-02-22 14:18:48Z spupykin $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>

pkgname=perl-device-gsm
pkgver=1.58
pkgrel=3
pkgdesc="Perl extension to interface GSM phones / modems"
arch=('any')
url="http://search.cpan.org/dist/Device-Gsm/"
license=('PerlArtistic')
depends=('perl-device-modem')
provides=('perl-device-gsm-charset' 'perl-device-gsm-networks'
	  'perl-device-gsm-pdu' 'perl-sms-token' 'perl-sms-token-da'
	  'perl-sms-token-dcs' 'perl-sms-token-mr' 'perl-sms-token-oa'
	  'perl-sms-token-pdutype' 'perl-sms-token-pid' 'perl-sms-token-sca'
	  'perl-sms-token-scts' 'perl-sms-token-ud' 'perl-sms-token-vp')
options=(!emptydirs)
source=("http://search.cpan.org/CPAN/authors/id/C/CO/COSIMO/Device-Gsm-$pkgver.tar.gz")
md5sums=('a0bfe2f7a7380c109c73ab8693b91797')

build() {
  _dir=$(find $srcdir -maxdepth 2 -type f -name 'Makefile.PL')
  if [ ! -z "$_dir" ]; then
    cd $(dirname "$_dir")
    PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor
    make
    make install DESTDIR="${pkgdir}"
  else
  _dir=$(find $srcdir -maxdepth 2 -type f -name 'Build.PL')
  if [ ! -z "$_dir" ]; then
    cd $(dirname "$_dir")
    PERL_MM_USE_DEFAULT=1 perl Build.PL INSTALLDIRS=vendor
    ./Build
    ./Build install destdir=${pkgdir}
  else
    echo "error: failed to detect build method for $pkgname"
    echo "you may be able to fix this by editing the PKGBUILD"
    return 1
  fi fi
  # remove perllocal.pod and .packlist
  find ${pkgdir} -name perllocal.pod -delete
  find ${pkgdir} -name .packlist -delete
}
