# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: csslayer <wengxt AT gmail com>

pkgname=fcitx5-chinese-addons
pkgver=0.0.0.20181104
_commit=cf54d3ab3d2369af7759b39baf202a7105fc67d5
_pytablever=20121124
pkgrel=2
pkgdesc="Addons related to Chinese, including IME previous bundled inside fcitx4"
arch=('x86_64')
url="https://gitlab.com/fcitx/fcitx5-chinese-addons"
license=('GPL')
depends=('curl' 'fcitx5-qt' 'libime' 'opencc' 'qt5-webengine')
makedepends=('boost' 'extra-cmake-modules')
source=("https://gitlab.com/fcitx/fcitx5-chinese-addons/-/archive/$_commit/fcitx5-chinese-addons-$_commit.tar.bz2"
        http://download.fcitx-im.org/data/py_table-$_pytablever.tar.gz
        http://download.fcitx-im.org/data/py_stroke-$_pytablever.tar.gz)
noextract=(py_table-$_pytablever.tar.gz)
sha512sums=('9d41ec9b3811a7970d35361df30975124facd165c7e6d551dc79651853cbd670bad5631f221381fa098b7730d185fe3b4fc50572f5fb8c3542c26dc85d9cccda'
            '0fa72ce6820a316e9729bc0d7a08af5ca3468134de9ff1bf0c559a398846a7bcf7313a3609d943e6bab637d930cf45ad9acfe25a8d3df078a774b071a7296486'
            'd80ff9a3549e07c7a6935e686785f9a076c58f1a782a832ae28ee65e2a213d67f089f450ce09bed87ec2a141c32b9c1fcb83c221ddcab436858fa9009f161fb3')

prepare() {
  cd $pkgname-$_commit/modules/pinyinhelper
  ln -s "$srcdir"/py_table-$_pytablever.tar.gz
  ln -s "$srcdir"/py_stroke-$_pytablever.tar.gz
}

build(){
  cd $pkgname-$_commit
 
  cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_LIBDIR=/usr/lib .
  make
}

package() {
  cd $pkgname-$_commit
  make DESTDIR="$pkgdir" install
}
