summaryrefslogtreecommitdiff
path: root/testing/kopano-webapp-spellchecker-languagepack-fr-fr/APKBUILD
blob: c506296ea5209e0123bc1f1242bc0bd87c721381 (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# Maintainer: Noel Kuntze <noel.kuntze@contauro.com>
pkgname=kopano-webapp-spellchecker-languagepack-fr-fr
pkgdesc="French (France) languagepack for kopano-webapp's spellchecker plugin"
pkgver=2.0.1
pkgrel=2
# ppc64le, mips64 and riscv64 blocked by libmdbx -> kopano-core -> kopano-webapp
arch="noarch !ppc64le !mips64 !riscv64"
url="https://stash.kopano.io/projects/KWA/repos/spellchecker-languagepack-fr-fr/browse"
license="AGPL-3.0-only"
options="!check" # No test suite
depends="kopano-webapp-spellchecker"
# kopano-core necessary for mapi php module
makedepends="apache-ant openjdk8 kopano-webapp-src"
source="
	kopano-webapp-spellchecker-languagepack-fr-fr-$pkgver.zip::https://stash.kopano.io/rest/api/latest/projects/KWA/repos/spellchecker-languagepack-fr-fr/archive?at=refs%2Ftags%2Fv$pkgver&format=zip
"

_pluginname="${pkgname//kopano-webapp-/}"

builddir="$srcdir/"

#helper function
unpack() {
	local u
	verify
	initdcheck
	mkdir -p "$srcdir"
	local gunzip="$(command -v pigz || echo gunzip)"
	[ $gunzip = "/usr/bin/pigz" ] && gunzip="$gunzip -d"
	for u in $source; do
		local s
		local filename="$(filename_from_uri $u)"
		local new_root_dir="$builddir/${filename%%-[0-9]*}"
		if is_remote "$u"; then
			s="$SRCDEST/$filename"
		else
			s="$startdir/$u"
		fi
		case "$s" in
			*.tar)
				msg "Unpacking $s..."
				mkdir -p "$new_root_dir"
				tar -C "$new_root_dir" -xf "$s" ;;
			*.tar.gz|*.tgz)
				msg "Unpacking $s..."
				mkdir -p "$new_root_dir"
				$gunzip -c "$s" | tar -C "$new_root_dir" -x ;;
			*.tar.bz2)
				msg "Unpacking $s..."
				tar -C "$new_root_dir" -jxf "$s" ;;
			*.tar.lz)
				msg "Unpacking $s..."
				tar -C "$new_root_dir" --lzip -xf "$s" ;;
			*.tar.lzma)
				msg "Unpacking $s..."
				unlzma -T 0 -c "$s" | tar -C "$new_root_dir" -x  ;;
			*.tar.xz)
				msg "Unpacking $s..."
				local threads_opt
				if [ "$(readlink -f "$(command -v unxz)")" != "/bin/busybox" ]; then
					threads_opt="--threads=0"
				fi
				unxz $threads_opt -c "$s" | tar -C "$new_root_dir" -x ;;
			*.zip)
				msg "Unpacking $s..."
				unzip -n -q "$s" -d "$new_root_dir" ;;
		esac
	done
}

prepare() {
	cp -R /usr/share/src/kopano-webapp/ kopano-webapp
	find "kopano-webapp/plugins/" -type d -mindepth 1 -maxdepth 2 -print0 | xargs -0 -- rm -rf
	mv $pkgname kopano-webapp/plugins/$_pluginname
	default_prepare
}

build() {
	cd kopano-webapp
	ant tools
	cd plugins/$_pluginname
	ant deploy -Droot-folder="$(pwd)/../../" -Dtarget-folder="$(pwd)/../../deploy/plugins"
}

package() {
	cd "$srcdir/kopano-webapp/deploy/plugins/$_pluginname/"
	# /usr/share
	mkdir -p "$pkgdir/usr/share/webapps/kopano-webapp/plugins/$_pluginname/"
	cp -R -- * "$pkgdir/usr/share/webapps/kopano-webapp/plugins/$_pluginname/"
	rm -f "$pkgdir/usr/share/webapps/kopano-webapp/plugins/$_pluginname/config.php"

	# /var/lib
	install -dm 0700 -o kopano-webapp -g root "$pkgdir/var/lib/kopano-webapp/plugins/$_pluginname"
	# /etc
	if [ -e "config.php" ]; then
		## perform settings
		# convert windows line break to unix: http://stackoverflow.com/questions/11680815/removing-windows-newlines-on-linux-sed-vs-awk
		sed -i -e $'s/\r//' config.php
		install -dm 0750 -g kopano-webapp "$pkgdir/etc/webapps/kopano-webapp/plugins/$_pluginname/"
		## config mains
		install -m 0750 -g kopano-webapp config.php "$pkgdir/etc/webapps/kopano-webapp/plugins/$_pluginname/config.php"
		ln -sf "/etc/webapps/kopano-webapp/plugins/$_pluginname/config.php" "$pkgdir/usr/share/webapps/kopano-webapp/plugins/$_pluginname/config.php"
		## config examples
		install -m 0750 "$pkgdir/etc/webapps/kopano-webapp/plugins/$_pluginname/config.php" "$pkgdir/etc/webapps/kopano-webapp/plugins/$_pluginname/config.example.php"
	fi
}
sha512sums="
0e54c2fcc749a946c8c82d2b445cb85692a79109ae7ff7ab94c5c2c186bf6902b085fb3061beb596045d988e6145c45e202323d1af9b05220d50224a3fc4f36c  kopano-webapp-spellchecker-languagepack-fr-fr-2.0.1.zip
"