apkbuilds @ 121d6f029f4ebc205915bb5a0c74ecde7d874b32

feat: Add some dependencies of seafile

Add initial setup for dependencies of seafile server
  1diff --git a/libsearpc/APKBUILD b/libsearpc/APKBUILD
  2new file mode 100644
  3index 0000000000000000000000000000000000000000..9ab7120c8bdf5acc5b313e5724ce3b0927cc8320
  4--- /dev/null
  5+++ b/libsearpc/APKBUILD
  6@@ -0,0 +1,55 @@
  7+# Contributor: <xmingske@gmail.com>
  8+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
  9+pkgname=libsearpc
 10+pkgver=3.1
 11+pkgrel=0
 12+pkgdesc="A simple and easy-to-use C language RPC framework"
 13+url="https://github.com/haiwen/libsearpc/"
 14+arch="all"
 15+license="LGPL2.1"
 16+makedepends="autoconf automake bash glib-dev jansson-dev libtool python3-dev"
 17+source="$pkgname-$pkgver.tar.gz::https://github.com/haiwen/libsearpc/archive/v3.1-latest.tar.gz"
 18+subpackages="$pkgname-dev py-$pkgname:py"
 19+
 20+_builddir="${srcdir}"/${pkgname}-3.1-latest
 21+
 22+prepare() {
 23+	local pf
 24+	cd "${_builddir}"
 25+	for pf in $source; do
 26+		case $pf in
 27+		*.patch) msg $pf; patch -p1 -i "$srcdir"/${pf} || return 1;;
 28+		esac
 29+	done
 30+}
 31+
 32+build() {
 33+	cd "${_builddir}"
 34+	./autogen.sh
 35+	./configure \
 36+                --prefix=/usr \
 37+                --sysconfdir=/etc \
 38+                --mandir=/usr/share/man \
 39+                --infodir=/usr/share/info
 40+	make || return 1
 41+}
 42+
 43+package() {
 44+	cd "${_builddir}"
 45+	make DESTDIR="${pkgdir}" install || return 1
 46+	rm "${pkgdir}"/usr/lib/libsearpc.la
 47+	echo ${pkgdir}/usr/lib/pkgconfig/libsearpc.pc
 48+	sed -i -e 's/(DESTDIR)//' "${pkgdir}"/usr/lib/pkgconfig/libsearpc.pc
 49+	sed -i -e 's/prefix=.*/prefix=\/usr/' "${pkgdir}"/usr/lib/pkgconfig/libsearpc.pc
 50+}
 51+
 52+py() {
 53+	arch="noarch"
 54+	cd "$_builddir"
 55+	pkgdesc="$pkgname python bindings"
 56+	install -d "$subpkgdir"/usr/lib
 57+	mv "$pkgdir"/usr/lib/python* "$subpkgdir"/usr/lib/
 58+}
 59+sha512sums="
 60+4dfb14601819c634078f7bd538da13e70d6c714297c777bd2af07521d8fefd6c71a0f00bf135349f2efb3e809a27500b459af727471915bd47d8b351e069e120  libsearpc-3.1.tar.gz
 61+"
 62diff --git a/libzdb/APKBUILD b/libzdb/APKBUILD
 63new file mode 100644
 64index 0000000000000000000000000000000000000000..42f1c76dac7545d2f464428712dd31ae9958b9cc
 65--- /dev/null
 66+++ b/libzdb/APKBUILD
 67@@ -0,0 +1,46 @@
 68+# Contributor: Łukasz Jendrysik <scadu@yandex.com>
 69+# Contributor: Carlo Landmeter <clandmeter@gmail.com>
 70+# Maintainer:
 71+pkgname=libzdb
 72+pkgver=3.2.2
 73+pkgrel=0
 74+pkgdesc="A thread-safe high level multi-database connection pool library"
 75+url="http://www.tildeslash.com/libzdb/"
 76+arch="all"
 77+license="GPL"
 78+depends=
 79+depends_dev="flex-dev sqlite-dev mariadb-dev postgresql-dev"
 80+makedepends="$depends_dev flex"
 81+install=""
 82+subpackages="$pkgname-dev"
 83+source="http://www.tildeslash.com/libzdb/dist/libzdb-$pkgver.tar.gz"
 84+
 85+_builddir="$srcdir/$pkgname-$pkgver"
 86+
 87+prepare() {
 88+	local i
 89+	cd "$_builddir"
 90+	for i in $source; do
 91+		case $i in
 92+		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
 93+		esac
 94+	done
 95+}
 96+
 97+build() {
 98+	cd "$_builddir"
 99+	./configure --prefix=/usr \
100+		--sysconfdir=/etc \
101+		--mandir=/usr/share/man \
102+		--enable-optimized \
103+		--infodir=/usr/share/info
104+	make || return 1
105+}
106+
107+package() {
108+	cd "$_builddir"
109+	make DESTDIR="$pkgdir" install || return 1
110+}
111+sha512sums="
112+1e732f8785322e0369de16a8100c9467e96ad1ca4eee31e8bfc349f4f17d4cc237a691addc060a66e1b46bcfeb99c3aed07b1d5dbe20e70fde4ffbf35dbea2eb  libzdb-3.2.2.tar.gz
113+"
114diff --git a/seafile/APKBUILD b/seafile/APKBUILD
115new file mode 100644
116index 0000000000000000000000000000000000000000..8a47f382c98425414deb5cf7465f7a5c56b0ea4f
117--- /dev/null
118+++ b/seafile/APKBUILD
119@@ -0,0 +1,101 @@
120+# Contributor: <xmingske@gmail.com>
121+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
122+pkgname=seafile
123+pkgver=7.0.9
124+pkgrel=1
125+pkgdesc="Cloud storage system with advanced support for file syncing, privacy protection and teamwork"
126+url="https://github.com/haiwen/seafile/"
127+arch="all"
128+license="AGPL3"
129+makedepends="autoconf automake bash curl-dev fuse-dev glib-dev
130+	intltool jansson-dev libarchive-dev libevent-dev libevhtp-dev
131+	libsearpc-dev libtool libzdb-dev openssl-dev sqlite-dev util-linux-dev
132+	vala bsd-compat-headers libevhtp-dev"
133+depends="bash ${pkgname}-common"
134+pkgusers="seafile"
135+pkggroups="seafile"
136+source="
137+    $pkgname-$pkgver.tar.gz::https://github.com/haiwen/seafile/archive/v${pkgver}.tar.gz
138+    seafile.initd
139+    seafile.confd"
140+subpackages="$pkgname-dev $pkgname-doc py-$pkgname:py $pkgname-server
141+	$pkgname-common"
142+install="seafile-server.pre-install seafile-server.post-install"
143+
144+_builddir="${srcdir}/${pkgname}-${pkgver}"
145+
146+prepare() {
147+	local pf
148+	cd "${_builddir}" || return 1
149+	for pf in $source; do
150+		case $pf in
151+		*.patch) msg $pf; patch -p1 -i "$srcdir"/${pf} || return 1;;
152+		esac
153+	done
154+}
155+
156+build() {
157+	cd "${_builddir}"
158+	./autogen.sh
159+	./configure \
160+                --prefix=/usr \
161+                --sysconfdir=/etc \
162+                --mandir=/usr/share/man \
163+                --infodir=/usr/share/info \
164+		--enable-server \
165+		--enable-python \
166+		--enable-fuse \
167+		--enable-client \
168+		--enable-console
169+	make CFLAGS="$CFLAGS $(pkgconf --cflags evhtp)" || return 1
170+}
171+
172+package() {
173+	cd "${_builddir}"
174+	make DESTDIR="${pkgdir}" install || return 1
175+	rm "${pkgdir}"/usr/lib/libseafile.la || return 1
176+}
177+
178+py() {
179+        arch="noarch"
180+        cd "$_builddir"
181+        pkgdesc="$pkgname python bindings"
182+        install -d "$subpkgdir"/usr/lib || return 1
183+        mv "$pkgdir"/usr/lib/python* "$subpkgdir"/usr/lib/ || return 1
184+}
185+
186+common() {
187+	mkdir -p "${subpkgdir}"/usr/bin || return 1
188+	mkdir -p "${subpkgdir}"/usr/lib || return 1
189+	mv "${pkgdir}"/usr/bin/seafile "${subpkgdir}"/usr/bin
190+	mv "${pkgdir}"/usr/lib/libseafile.so.0* "${subpkgdir}"/usr/lib
191+}
192+
193+server() {
194+	mkdir -p "${subpkgdir}"/usr/bin
195+	for b in "${pkgdir}"/usr/bin/*; do
196+		if [[ "$b" != "${pkgdir}/usr/bin/seaf-cli" ]] && \
197+		[[ "$b" != "${pkgdir}/usr/bin/seaf-daemon" ]] && \
198+		[[ "$b" != "${pkgdir}/usr/bin/seafile" ]]; then
199+			mv "$b" "${subpkgdir}/usr/bin" || return 1
200+		fi
201+	done
202+	mkdir -m 755 -p "${subpkgdir}"/usr/share/seafile || return 1
203+	cp -ar "${_builddir}"/scripts "${subpkgdir}"/usr/share/seafile || return 1
204+	install -D -m0644 "${srcdir}"/seafile.confd "${subpkgdir}"/etc/conf.d/seafile \
205+	    || return 1
206+	install -D -m0755 "${srcdir}"/seafile.initd "${subpkgdir}"/etc/init.d/seafile \
207+	    || return 1
208+
209+	#make dirs for default instance
210+	SEAFILE_HOME="${subpkgdir}"/var/lib/seafile
211+	SEAFILE_DEFAULT=$SEAFILE_HOME/default
212+	mkdir -m 755 -p $SEAFILE_DEFAULT 2>/dev/null
213+	chown seafile:seafile $SEAFILE_DEFAULT
214+
215+}
216+sha512sums="
217+4c87e7a4a6a4cef631cbfbeb1bde3c8c9e0915d5fe4597d5b3a4b8aa15e9650e97b51ee6a3b0bae4d235ec53149dca01aed7acd704da593c97da0a17e352a75d  seafile-7.0.9.tar.gz
218+66b84519ab66e7435da13a2ed1869bac3ead1f7b46ed4b0a5ecda6dfcea056c5e0af8abcf1eba00fc2e68b8df7e07e3951968c385850f01ecf46f08dfdbe7083  seafile.initd
219+051ccc065a3b7abc7c802e00e364da1c3f689e133c4ba37385dbff97cfe8ad4b490cf53778344d129213fb0238258690a47f5e737387bce1368db59d22ee8504  seafile.confd
220+"
221diff --git a/seafile/seafile-server.post-install b/seafile/seafile-server.post-install
222new file mode 100644
223index 0000000000000000000000000000000000000000..dee6e9797af648baf68dbc3d61a15a58f5477f32
224--- /dev/null
225+++ b/seafile/seafile-server.post-install
226@@ -0,0 +1,9 @@
227+#!/bin/sh
228+
229+SEAFILE_HOME=/var/lib/seafile
230+SEAFILE_DEFAULT=$SEAFILE_HOME/default
231+
232+if [[ ! -d $SEAFILE_DEFAULT/scripts ]]; then
233+	cd $SEAFILE_DEFAULT
234+	cp -ar /usr/share/seafile/scripts .
235+fi
236diff --git a/seafile/seafile-server.pre-install b/seafile/seafile-server.pre-install
237new file mode 100644
238index 0000000000000000000000000000000000000000..7e3df0b5ef9febbb04bf553f905cf02c73baa0d4
239--- /dev/null
240+++ b/seafile/seafile-server.pre-install
241@@ -0,0 +1,8 @@
242+#!/bin/sh
243+
244+SEAFILE_HOME=/var/lib/seafile
245+
246+addgroup -S -g 800 seafile 2>/dev/null
247+adduser -S -u 800 -D -h $SEAFILE_HOME -s /bin/sh -G seafile -g seafile seafile 2>/dev/null
248+
249+exit 0
250diff --git a/seafile/seafile.confd b/seafile/seafile.confd
251new file mode 100644
252index 0000000000000000000000000000000000000000..b169b0e55fe520f5b7641cb2d434298ee653cedd
253--- /dev/null
254+++ b/seafile/seafile.confd
255@@ -0,0 +1,4 @@
256+instance="default"
257+
258+seafile_user="seafile"
259+seafile_group="seafile"
260diff --git a/seafile/seafile.initd b/seafile/seafile.initd
261new file mode 100644
262index 0000000000000000000000000000000000000000..b92a7653ad99c2dbd7bdc2fc4d06fb5573d0351f
263--- /dev/null
264+++ b/seafile/seafile.initd
265@@ -0,0 +1,16 @@
266+#!/sbin/openrc-run
267+
268+depend() {
269+	need net
270+}
271+
272+start() {
273+	ebegin "Starting Seafile $instance instance"
274+	start-stop-daemon --chdir /var/lib/seafile/$instance --user $seafile_user \
275+	    --group $seafile_group /usr/bin/seafile-admin start $seafile_opts
276+}
277+
278+stop() {
279+	ebegin "Stopping Seafile $instance instance"
280+	start-stop-daemon --chdir /var/lib/seafile/$instance /usr/bin/seafile-admin stop
281+}