# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Antonio Rojas <arojas@archlinux.org>

pkgname=nauty
epoch=1
pkgver=2.8.8
pkgrel=2
pkgdesc='A program for computing automorphism groups of graphs and digraphs'
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
url='http://pallini.di.uniroma1.it/'
license=(Apache)
depends=(glibc)
source=(http://pallini.di.uniroma1.it/nauty${pkgver//./_}.tar.gz)
sha256sums=('159d2156810a6bb240410cd61eb641add85088d9f15c888cdaa37b8681f929ce')
 
build() {
  cd nauty${pkgver//./_}

  export CFLAGS+=' -fPIC -ffat-lto-objects'
  ./configure --enable-generic
  make
}

package() {
  cd nauty${pkgver//./_}

  mkdir -p "$pkgdir"/usr/bin
  for _program in addedgeg amtog biplabg catg complg converseg copyg countg cubhamg deledgeg delptg directg dreadnaut dretodot dretog \
    genbg genbgL geng genquarticg genrang genspecialg gentourng gentreeg hamheuristic labelg linegraphg listg multig newedgeg \
    pickg planarg ranlabg shortg showg subdivideg twohamg vcolg watercluster2 NRswitchg;
  do
   install -m755 $_program "$pkgdir"/usr/bin/$program
  done
  install -Dm644 nauty.a "$pkgdir"/usr/lib/libnauty.a
  install -Dm644 *.h -t "$pkgdir"/usr/include/nauty

  mkdir -p "$pkgdir"/usr/share/licenses/nauty
  install COPYRIGHT "$pkgdir"/usr/share/licenses/nauty/LICENSE
}
