diff options
author | respiranto | 2015-08-24 22:18:44 +0200 |
---|---|---|
committer | respiranto | 2015-08-24 22:18:44 +0200 |
commit | a69817c00f4b9dce3cdd3bc3b899eb3d63cc6e21 (patch) | |
tree | 7562d68572bcaae246167fd8613ad01c045cc273 | |
download | aur-a69817c00f4b9dce3cdd3bc3b899eb3d63cc6e21.tar.gz |
Initial upload
-rw-r--r-- | .SRCINFO | 21 | ||||
-rw-r--r-- | PKGBUILD | 41 | ||||
-rw-r--r-- | dict-wn.install | 78 |
3 files changed, 140 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..5aef6099e3fc --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,21 @@ +pkgbase = dict-wn + pkgdesc = WordNet in dict format + pkgver = 3.0 + pkgrel = 1 + url = http://wordnet.princeton.edu/ + install = dict-wn.install + arch = any + license = custom: WordNet License + license = GPL + makedepends = dictd + makedepends = tk + makedepends = python2 + makedepends = ghostscript + optdepends = dictd: dict client and server + provides = dictd-wn + conflicts = dictd-wn + source = http://ftp.de.debian.org/debian/pool/main/w/wordnet/wordnet_3.0.orig.tar.gz + md5sums = a91cee4bab52c750dc25e3b1d296a091 + +pkgname = dict-wn + diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..c60dca2a0a0b --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,41 @@ +# Maintainer: respiranto <respiranto@icloud.com> +# Contributor: Enrico Morelli <morelli@cerm.unifi.it> +# Contributor: Andrew Engelbrecht <sudoman@ninthfloor.org> +pkgname=dict-wn +pkgver=3.0 +pkgrel=1 +pkgdesc="WordNet in dict format" +arch=('any') +url="http://wordnet.princeton.edu/" +license=('custom: WordNet License' 'GPL') +optdepends=('dictd: dict client and server') +makedepends=('dictd' 'tk' 'python2' 'ghostscript') +provides=('dictd-wn') +conflicts=('dictd-wn') +install=$pkgname.install +# the tarball from debian is required, since it contains wordnet_structures.py +source=("http://ftp.de.debian.org/debian/pool/main/w/wordnet/wordnet_$pkgver.orig.tar.gz") +md5sums=('a91cee4bab52c750dc25e3b1d296a091'); + +build() { + cd WordNet-$pkgver + ./configure + + # we need to use python2, pass the name, and the url of the new WN version + sed -i 's/python wordnet_structures.py/python2 wordnet_structures.py --wn_url="http:\/\/wordnet\.princeton.edu" --db_desc_short=" WordNet \(r\) 3\.0 \(2006\)"/g' contrib/wordnet_structures/Makefile + + # Tcl_Interp structure does by default not contain result + sed -i 's/^#include <tcl.h>$/#define USE_INTERP_RESULT\n#include <tcl.h>/' src/stubs.c + + make +} + +package() { + cd WordNet-$pkgver + install -m 0755 -d $pkgdir/usr/share/doc/$pkgname/ + install -m 0644 -t $pkgdir/usr/share/doc/$pkgname/ AUTHORS COPYING NEWS README + + cd contrib/wordnet_structures/ + install -m 0755 -d $pkgdir/usr/share/dictd/ + install -m 0644 -t $pkgdir/usr/share/dictd/ wn.dict.dz wn.index +} diff --git a/dict-wn.install b/dict-wn.install new file mode 100644 index 000000000000..5728b8d0e13b --- /dev/null +++ b/dict-wn.install @@ -0,0 +1,78 @@ +pkgname=dict-wn +basename=wn +dictd_conf=/etc/dict/dictd.conf +datadir=/usr/share/dictd +conf="database $basename { + data $datadir/$basename.dict.dz + index $datadir/$basename.index +}" + +post_install() +{ + echo + if pacman -Qq dictd > /dev/null 2>&1 + then + if grep -q "^database *$basename" "$dictd_conf" + then + echo "$pkgname already configured in $dictd_conf" + else + echo "Adding configuration for $pkgname to $dictd_conf" + echo "$conf" >> "$dictd_conf" + fi + + if systemctl -q is-active dictd.service + then + echo "Restarting dictd service in order to" \ + "use the new dictionary database" + systemctl restart dictd.service + else + echo "Starting dictd service in order to" \ + "use the new dictionary database" + systemctl start dictd.service + fi + else + echo "dictd does not appear to be installed." + echo "In order to use this database you should either" \ + "install dictd or alternatively" \ + "another dict server and configure it on your own." + fi + echo +} + +post_upgrade() +{ + if pacman -Qq dictd > /dev/null 2>&1 && \ + systemctl -q is-active dictd.service + then + echo -e "\nRestarting dictd service in order to" \ + "use the updated dictionary database" + systemctl restart dictd.service + fi +} + +post_remove() +{ + if pacman -Qq dictd > /dev/null 2>&1 + then + current_conf="$(grep -A 3 "^database *$basename" "$dictd_conf")" + if test -n "$current_conf" + then + echo + if test "$current_conf" = "$conf" + then + echo "Removing configuration for $pkgname from $dictd_conf" + sed -i "/database $basename {/,/}/d" "$dictd_conf" + else + echo "User created / modified configuration" \ + "for $pkgname in $dictd_conf is left untouched." + fi + fi + + if systemctl -q is-active dictd.service + then + echo "Restarting dictd service in order to" \ + "stop using the removed dictionary database" + systemctl restart dictd.service + fi + fi +} |