# $Id$
# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: dickeny@gmail.com
# Contributor: cuihao <cuihao dot leo at gmail dot com>

pkgbase=man-pages-zh
pkgname=(man-pages-zh_cn man-pages-zh_tw)
pkgver=1.6.3.3
pkgrel=1
arch=('any')
url='https://github.com/man-pages-zh/manpages-zh'
license=('GPL2')
depends=('man-db')
makedepends=('opencc' 'python' 'git')
source=("$pkgbase-$pkgver.tar.gz::https://github.com/man-pages-zh/manpages-zh/archive/v$pkgver.tar.gz")
sha512sums=('1c5136ef238f65278196b9690c6c859a0001afb16ae28b51fffd4c8dcef62f650f05270557aa59c4d9087301bafca117374a68c0e1beb724439577a354dd13bf')

build() {
  cd manpages-zh-$pkgver
  autoreconf -i
  ./configure --prefix=/usr
  make
}

package_man-pages-zh_cn() {
  pkgdesc='Simplified Chinese Linux man pages'

  cd manpages-zh-$pkgver
  make install DESTDIR="$pkgdir"

  rm -r "$pkgdir"/usr/share/man/zh_TW

  # remove conflicted files with shadow
  cd "$pkgdir"/usr/share/man/zh_CN
  rm -f ./man1/groups*
}

package_man-pages-zh_tw() {
  pkgdesc='Traditional Chinese Linux man pages'

  cd manpages-zh-$pkgver
  make install DESTDIR="$pkgdir"

  rm -r "$pkgdir"/usr/share/man/zh_CN

  # remove conflicted files with shadow
  cd "$pkgdir"/usr/share/man/zh_TW
  rm -f ./man1/groups*
}
