summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 54f58d504c2a050d602dde49fcf690ea79fd4264 (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
49
50
51
52
53
54
55
56
57
58
# Maintainer: Dmitry Kharitonov <arch[at]nano-model[dot]com>
# Contributor: Francois Garillot <francois[@]garillot.net>
# Contributor: Malkov Fyodor aka krox: iksut@yandex.ru
# Contributor: Ianis Vasilev: ianis@ivasilev.net

pkgname=ocrodjvu-python3-git
_pkgbasename='ocrodjvu'
pkgver=0.14+25.r1436.1425cf9
pkgrel=1.314
pkgdesc="OCR for DjVu (Python 3 port)"
arch=('i686' 'x86_64')
url='https://github.com/FriedrichFroebel/ocrodjvu'
license=('GPL-2.0-only')
provides=(ocrodjvu)
conflicts=(ocrodjvu)
makedepends=(python python-build python-installer python-wheel git coreutils make libxslt docbook-xsl)
depends=(python python-lxml python-djvulibre-python)
optdepends=('python-html5lib: HTML parser; required for the ``--html5`` option'
            'python-pyicu: required for the ``--word-segmentation=uax29`` option'
            'cuneiform: OCR system' 
            'tesseract: OCR system'
            'ocrad: OCR system'
            'gocr: OCR system'
            'ocropy: OCR system')
source=(git+https://github.com/FriedrichFroebel/ocrodjvu)
sha512sums=('SKIP')

_fullsrcdir() {
  echo "$srcdir/$_pkgbasename"
}

# Based on https://aur.archlinux.org/packages/dpsprep-git#comment-1031722
pkgver() {
    cd "$(_fullsrcdir)"

    _ver="$(git describe --tags | sed -E -e 's|^[vV]||' -e 's|\-g[0-9a-f]*$||' | tr '-' '+')"
    _rev="$(git rev-list --count HEAD)"
    _hash="$(git rev-parse --short HEAD)"

    if [ -z "${_ver}" ]; then
        error "Version could not be determined."
        return 1
    else
        printf '%s' "${_ver}.r${_rev}.${_hash}"
    fi
}

build() {
    cd "$srcdir/ocrodjvu"
    make -C doc
    python -m build --wheel --no-isolation
}

package() {
    cd "$srcdir/ocrodjvu"
    python -m installer --destdir="$pkgdir" dist/*.whl
    make PREFIX="/usr" DESTDIR="$pkgdir" install_manpage
}