summaryrefslogtreecommitdiff
path: root/community/pyzy/PKGBUILD
blob: 090fc75fbd866b78eb8d8a45c604ea2b10363e1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Maintainer: Felix Yan <felixonmars@gmail.com>
# Contributor: Kerrick Staley <mail@kerrickstaley.com>

pkgname=pyzy
pkgver=1.0
_commit="d7747466562cb8b4bc2934708e29b7643c7bedbc"
pkgrel=1
pkgdesc='The Chinese PinYin and Bopomofo conversion library'
arch=('i686' 'x86_64' 'mips64el')
url='https://github.com/pyzy/pyzy'
license=('LGPL')
depends=('glib2' 'sqlite' 'util-linux')
makedepends=('git' 'doxygen' 'gnome-common' 'python2')

__gitroot=git://github.com/pyzy/pyzy.git
__gitname=$pkgname

build() {
  cd "$srcdir"
  msg "Connecting to GIT server...."

  if [ -d $__gitname ] ; then
    cd $__gitname && git pull origin
    msg "The local files are updated."
  else
    git clone $__gitroot
  fi

  msg "GIT checkout done or server timeout"
  msg "Starting make..."

  rm -rf "$srcdir/$__gitname-build"
  git clone "$srcdir/$__gitname" "$srcdir/$__gitname-build"
  cd "$srcdir/$__gitname-build"
  git checkout "$_commit"	   

  # replace python with python2; see https://github.com/hsumita/libpyzy/issues/1
  find . -name '*.py' -exec sed -ri '1s#(bin/|env )python#\1python2#' '{}' \;
  
  ./autogen.sh --prefix=/usr
  make
}

package() {
  cd "$srcdir/$__gitname-build"

  make DESTDIR="$pkgdir" install
}