summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 52b70fb3fd99ef88126bf3f497abf70548e75151 (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
# Maintainer: gudzpoz <gudzpoz@live.com>

pkgname="emacs-chinese-word-segmentation-git"
pkgver=r57.5ef7898
pkgrel=1
pkgdesc="Chinese word segmentation tool for Emacs based on libjieba."
arch=('x86_64')
url="https://github.com/kanglmf/emacs-chinese-word-segmentation"
license=('GPL3')
depends=('emacs')
makedepends=('git' 'gcc' 'cmake')
provides=("${pkgname%-git}")
conflicts=("${pkgname%-git}")
install=cns.install
source=("${pkgname%-git}::git+https://github.com/kanglmf/emacs-chinese-word-segmentation.git")
sha256sums=('SKIP')

pkgver() {
    cd "$srcdir/${pkgname%-git}"
    printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
    cd "$srcdir/${pkgname%-git}"
    git submodule update --init --recursive
    make
    sed -e 's#(defcustom cns-dict-directory nil#(defcustom cns-dict-directory "/usr/share/emacs/site-lisp/cns"#' \
        -e 's#(defcustom cns-prog (executable-find "chinese-word-segmentation")#(defcustom cns-prog "/usr/share/emacs/site-lisp/cns/cnws"#' \
        cns.el > cns.configured.el
}

package() {
    cd "$srcdir/${pkgname%-git}"

    install -D -m644 cns.configured.el "${pkgdir}/usr/share/emacs/site-lisp/cns.el"

    install -D -m755 cnws "${pkgdir}/usr/share/emacs/site-lisp/cns/cnws"
    install -D -m644 cppjieba/dict/jieba.dict.utf8 "${pkgdir}/usr/share/emacs/site-lisp/cns/jieba.dict.utf8"
    install -D -m644 cppjieba/dict/hmm_model.utf8 "${pkgdir}/usr/share/emacs/site-lisp/cns/hmm_model.utf8"
    install -D -m644 cppjieba/dict/user.dict.utf8 "${pkgdir}/usr/share/emacs/site-lisp/cns/user.dict.utf8"
    install -D -m644 cppjieba/dict/stop_words.utf8 "${pkgdir}/usr/share/emacs/site-lisp/cns/stop_words.utf8"
    install -D -m644 cppjieba/dict/idf.utf8 "${pkgdir}/usr/share/emacs/site-lisp/cns/idf.utf8"
    install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
    install -D -m644 cppjieba/LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE.cppjieba"
}