summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: fa243870b70e68fc850629a52f8318a49b57dc71 (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
59
60
61
62
63
# Contributor: Jonas Heinrich <onny at project-insanity.org>
# Contributor: Lilydjwg <lilydjwg at archlinuxcn.org>
# Maintainer: Horo <horo at yoitsu.moe>

pkgname=parsoid-git
_pkgname=parsoid
pkgver=0.11.0.20200515
pkgrel=1
pkgdesc="A bidirectional wikitext parser and runtime"
arch=('any')
url="https://www.mediawiki.org/wiki/Parsoid"
license=('GPL2')
depends=('nodejs')
makedepends=('git' 'npm' 'jq')
optdepends=(
    'mediawiki: MediaWiki engine'
)
conflicts=('parsoid')
replaces=('parsoid')
provides=('parsoid')
backup=(usr/share/webapps/parsoid/localsettings.js
	usr/share/webapps/parsoid/config.yaml
	etc/webapps/parsoid/config.yaml
        etc/webapps/parsoid/localsettings.js)
source=("git+https://phabricator.wikimedia.org/diffusion/GPAR/parsoid.git"
        "parsoid.service"
        "parsoid.install"
        "parsoid.sysusers"
        "parsoid.tmpfiles")

sha512sums=('SKIP'
            '3733d08751209fdef134940bbcce48efd0f380e13a8df466a7a1010450857a924aa364628242e4307cf40f4a34e60c1aeb1400d9a5b9fed88b448ed549e4d3f1'
            '176c83b9bce00f63c0783f795ab5cb22746ccaab2ac49b13d71d974255b4eddadbbd481979c10bd5318194498cd3f2ce07af85ebf92508baa91ea4d4c7ee00c5'
            '7f2346af222052e2e685d859e0bb7a7c7c9f03988f772856e0888cad299cb3870afdc280feb9e2798e7989d3382f68f689d43a685b466ce9f138edb77b20de3a'
            '6158afa3c276ddb5090166680621b7b9213f3d73b2d1a95181f5441631be039e7d454228d2f214f1411bb7f953475ddbd368e89eaa2288ac200ac666a57a6a99')
options=('!strip')
install="parsoid.install"
pkgver() {
    cd "$_pkgname"
    # git describe doesn't work because tagged commits are not in master anymore
    echo $(jq -r .version package.json | grep -o '[0-9.]\+').$(git log -1 --pretty='%cd' --date=short | tr -d '-')
}
build() { 
    cd $srcdir/parsoid
    npm install
}
package() {
    install -d  "$pkgdir"/etc/webapps/${_pkgname}
    cp "$srcdir/parsoid/localsettings.example.js" "$pkgdir"/etc/webapps/${_pkgname}/localsettings.js
    cp "$srcdir/parsoid/config.example.yaml" "$pkgdir"/etc/webapps/${_pkgname}/config.yaml
    
    mkdir -p "${pkgdir}/usr/share/webapps/${_pkgname}"
    ln -s /etc/webapps/${_pkgname}/config.yaml "$pkgdir"/usr/share/webapps/${_pkgname}/config.yaml
    ln -s /etc/webapps/${_pkgname}/localsettings.js "$pkgdir"/usr/share/webapps/${_pkgname}/localsettings.js
    
    cd $srcdir/parsoid
    tar c --exclude=.git --exclude='*~' . | tar x -C "${pkgdir}/usr/share/webapps/${_pkgname}/"
    install -Dm644 "${srcdir}/parsoid.service" "${pkgdir}/usr/lib/systemd/system/parsoid.service"
    install -D "COPYING.txt" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
    install -Dm644 "$srcdir"/parsoid.sysusers "$pkgdir"/usr/lib/sysusers.d/parsoid.conf
    install -Dm644 "$srcdir"/parsoid.tmpfiles "$pkgdir"/usr/lib/tmpfiles.d/parsoid.conf
}