summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO16
-rw-r--r--PKGBUILD32
-rw-r--r--dict-gcide.install71
3 files changed, 119 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..5ac9918a6fb0
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,16 @@
+pkgbase = dict-gcide
+ pkgdesc = GNU version of the Collaborative International Dictionary of English in dict format
+ pkgver = 0.48.1
+ pkgrel = 1
+ url = http://www.dict.org/
+ install = dict-gcide.install
+ arch = any
+ license = GPL
+ makedepends = dictd
+ optdepends = dictd: dict client and server
+ replaces = dictd-gcide
+ source = ftp://ftp.debian.org/debian/pool/main/d/dict-gcide/dict-gcide_0.48.1.tar.gz
+ md5sums = 44fa2d940c58e65635357fee76772a35
+
+pkgname = dict-gcide
+
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..4746f71efffa
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,32 @@
+# Maintainer: respiranto <respiranto@icloud.com>
+# Contributor: Tai Chi Minh Ralph Eastwood <tcmreastwood@gmail.com>
+pkgname=dict-gcide
+pkgver=0.48.1
+pkgrel=1
+pkgdesc="GNU version of the Collaborative International Dictionary of English in dict format"
+arch=('any')
+url="http://www.dict.org/"
+license=('GPL')
+optdepends=('dictd: dict client and server')
+makedepends=('dictd')
+replaces=('dictd-gcide')
+install=$pkgname.install
+source=("ftp://ftp.debian.org/debian/pool/main/d/$pkgname/${pkgname}_$pkgver.tar.gz")
+md5sums=('44fa2d940c58e65635357fee76772a35')
+
+build() {
+ cd "$pkgname-$pkgver"
+ export CPPFLAGS="-D_FORTIFY_SOURCE=0"
+ ./configure --with-local-libmaa --prefix=/usr
+ make
+ mkdir -p "$srcdir/final_data"
+ make dictdir="$srcdir/final_data" install
+ # fix wrong order:
+ LANG=C sort --dictionary-order --ignore-case -o "$srcdir/final_data"/gcide.index{,}
+}
+
+package()
+{
+ mkdir -p "$pkgdir/usr/share/dictd"
+ mv "$srcdir/final_data"/* "$pkgdir/usr/share/dictd/"
+}
diff --git a/dict-gcide.install b/dict-gcide.install
new file mode 100644
index 000000000000..9c89d4b894f8
--- /dev/null
+++ b/dict-gcide.install
@@ -0,0 +1,71 @@
+pkgname=dict-gcide
+basename=gcide
+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 -e "$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
+ fi
+}