apkbuilds @ 121d6f029f4ebc205915bb5a0c74ecde7d874b32

feat: Add some dependencies of seafile

Add initial setup for dependencies of seafile server
diff --git a/libsearpc/APKBUILD b/libsearpc/APKBUILD
new file mode 100644
index 0000000000000000000000000000000000000000..9ab7120c8bdf5acc5b313e5724ce3b0927cc8320
--- /dev/null
+++ b/libsearpc/APKBUILD
@@ -0,0 +1,55 @@
+# Contributor: <xmingske@gmail.com>
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=libsearpc
+pkgver=3.1
+pkgrel=0
+pkgdesc="A simple and easy-to-use C language RPC framework"
+url="https://github.com/haiwen/libsearpc/"
+arch="all"
+license="LGPL2.1"
+makedepends="autoconf automake bash glib-dev jansson-dev libtool python3-dev"
+source="$pkgname-$pkgver.tar.gz::https://github.com/haiwen/libsearpc/archive/v3.1-latest.tar.gz"
+subpackages="$pkgname-dev py-$pkgname:py"
+
+_builddir="${srcdir}"/${pkgname}-3.1-latest
+
+prepare() {
+	local pf
+	cd "${_builddir}"
+	for pf in $source; do
+		case $pf in
+		*.patch) msg $pf; patch -p1 -i "$srcdir"/${pf} || return 1;;
+		esac
+	done
+}
+
+build() {
+	cd "${_builddir}"
+	./autogen.sh
+	./configure \
+                --prefix=/usr \
+                --sysconfdir=/etc \
+                --mandir=/usr/share/man \
+                --infodir=/usr/share/info
+	make || return 1
+}
+
+package() {
+	cd "${_builddir}"
+	make DESTDIR="${pkgdir}" install || return 1
+	rm "${pkgdir}"/usr/lib/libsearpc.la
+	echo ${pkgdir}/usr/lib/pkgconfig/libsearpc.pc
+	sed -i -e 's/(DESTDIR)//' "${pkgdir}"/usr/lib/pkgconfig/libsearpc.pc
+	sed -i -e 's/prefix=.*/prefix=\/usr/' "${pkgdir}"/usr/lib/pkgconfig/libsearpc.pc
+}
+
+py() {
+	arch="noarch"
+	cd "$_builddir"
+	pkgdesc="$pkgname python bindings"
+	install -d "$subpkgdir"/usr/lib
+	mv "$pkgdir"/usr/lib/python* "$subpkgdir"/usr/lib/
+}
+sha512sums="
+4dfb14601819c634078f7bd538da13e70d6c714297c777bd2af07521d8fefd6c71a0f00bf135349f2efb3e809a27500b459af727471915bd47d8b351e069e120  libsearpc-3.1.tar.gz
+"
diff --git a/libzdb/APKBUILD b/libzdb/APKBUILD
new file mode 100644
index 0000000000000000000000000000000000000000..42f1c76dac7545d2f464428712dd31ae9958b9cc
--- /dev/null
+++ b/libzdb/APKBUILD
@@ -0,0 +1,46 @@
+# Contributor: Ɓukasz Jendrysik <scadu@yandex.com>
+# Contributor: Carlo Landmeter <clandmeter@gmail.com>
+# Maintainer:
+pkgname=libzdb
+pkgver=3.2.2
+pkgrel=0
+pkgdesc="A thread-safe high level multi-database connection pool library"
+url="http://www.tildeslash.com/libzdb/"
+arch="all"
+license="GPL"
+depends=
+depends_dev="flex-dev sqlite-dev mariadb-dev postgresql-dev"
+makedepends="$depends_dev flex"
+install=""
+subpackages="$pkgname-dev"
+source="http://www.tildeslash.com/libzdb/dist/libzdb-$pkgver.tar.gz"
+
+_builddir="$srcdir/$pkgname-$pkgver"
+
+prepare() {
+	local i
+	cd "$_builddir"
+	for i in $source; do
+		case $i in
+		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+		esac
+	done
+}
+
+build() {
+	cd "$_builddir"
+	./configure --prefix=/usr \
+		--sysconfdir=/etc \
+		--mandir=/usr/share/man \
+		--enable-optimized \
+		--infodir=/usr/share/info
+	make || return 1
+}
+
+package() {
+	cd "$_builddir"
+	make DESTDIR="$pkgdir" install || return 1
+}
+sha512sums="
+1e732f8785322e0369de16a8100c9467e96ad1ca4eee31e8bfc349f4f17d4cc237a691addc060a66e1b46bcfeb99c3aed07b1d5dbe20e70fde4ffbf35dbea2eb  libzdb-3.2.2.tar.gz
+"
diff --git a/seafile/APKBUILD b/seafile/APKBUILD
new file mode 100644
index 0000000000000000000000000000000000000000..8a47f382c98425414deb5cf7465f7a5c56b0ea4f
--- /dev/null
+++ b/seafile/APKBUILD
@@ -0,0 +1,101 @@
+# Contributor: <xmingske@gmail.com>
+# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
+pkgname=seafile
+pkgver=7.0.9
+pkgrel=1
+pkgdesc="Cloud storage system with advanced support for file syncing, privacy protection and teamwork"
+url="https://github.com/haiwen/seafile/"
+arch="all"
+license="AGPL3"
+makedepends="autoconf automake bash curl-dev fuse-dev glib-dev
+	intltool jansson-dev libarchive-dev libevent-dev libevhtp-dev
+	libsearpc-dev libtool libzdb-dev openssl-dev sqlite-dev util-linux-dev
+	vala bsd-compat-headers libevhtp-dev"
+depends="bash ${pkgname}-common"
+pkgusers="seafile"
+pkggroups="seafile"
+source="
+    $pkgname-$pkgver.tar.gz::https://github.com/haiwen/seafile/archive/v${pkgver}.tar.gz
+    seafile.initd
+    seafile.confd"
+subpackages="$pkgname-dev $pkgname-doc py-$pkgname:py $pkgname-server
+	$pkgname-common"
+install="seafile-server.pre-install seafile-server.post-install"
+
+_builddir="${srcdir}/${pkgname}-${pkgver}"
+
+prepare() {
+	local pf
+	cd "${_builddir}" || return 1
+	for pf in $source; do
+		case $pf in
+		*.patch) msg $pf; patch -p1 -i "$srcdir"/${pf} || return 1;;
+		esac
+	done
+}
+
+build() {
+	cd "${_builddir}"
+	./autogen.sh
+	./configure \
+                --prefix=/usr \
+                --sysconfdir=/etc \
+                --mandir=/usr/share/man \
+                --infodir=/usr/share/info \
+		--enable-server \
+		--enable-python \
+		--enable-fuse \
+		--enable-client \
+		--enable-console
+	make CFLAGS="$CFLAGS $(pkgconf --cflags evhtp)" || return 1
+}
+
+package() {
+	cd "${_builddir}"
+	make DESTDIR="${pkgdir}" install || return 1
+	rm "${pkgdir}"/usr/lib/libseafile.la || return 1
+}
+
+py() {
+        arch="noarch"
+        cd "$_builddir"
+        pkgdesc="$pkgname python bindings"
+        install -d "$subpkgdir"/usr/lib || return 1
+        mv "$pkgdir"/usr/lib/python* "$subpkgdir"/usr/lib/ || return 1
+}
+
+common() {
+	mkdir -p "${subpkgdir}"/usr/bin || return 1
+	mkdir -p "${subpkgdir}"/usr/lib || return 1
+	mv "${pkgdir}"/usr/bin/seafile "${subpkgdir}"/usr/bin
+	mv "${pkgdir}"/usr/lib/libseafile.so.0* "${subpkgdir}"/usr/lib
+}
+
+server() {
+	mkdir -p "${subpkgdir}"/usr/bin
+	for b in "${pkgdir}"/usr/bin/*; do
+		if [[ "$b" != "${pkgdir}/usr/bin/seaf-cli" ]] && \
+		[[ "$b" != "${pkgdir}/usr/bin/seaf-daemon" ]] && \
+		[[ "$b" != "${pkgdir}/usr/bin/seafile" ]]; then
+			mv "$b" "${subpkgdir}/usr/bin" || return 1
+		fi
+	done
+	mkdir -m 755 -p "${subpkgdir}"/usr/share/seafile || return 1
+	cp -ar "${_builddir}"/scripts "${subpkgdir}"/usr/share/seafile || return 1
+	install -D -m0644 "${srcdir}"/seafile.confd "${subpkgdir}"/etc/conf.d/seafile \
+	    || return 1
+	install -D -m0755 "${srcdir}"/seafile.initd "${subpkgdir}"/etc/init.d/seafile \
+	    || return 1
+
+	#make dirs for default instance
+	SEAFILE_HOME="${subpkgdir}"/var/lib/seafile
+	SEAFILE_DEFAULT=$SEAFILE_HOME/default
+	mkdir -m 755 -p $SEAFILE_DEFAULT 2>/dev/null
+	chown seafile:seafile $SEAFILE_DEFAULT
+
+}
+sha512sums="
+4c87e7a4a6a4cef631cbfbeb1bde3c8c9e0915d5fe4597d5b3a4b8aa15e9650e97b51ee6a3b0bae4d235ec53149dca01aed7acd704da593c97da0a17e352a75d  seafile-7.0.9.tar.gz
+66b84519ab66e7435da13a2ed1869bac3ead1f7b46ed4b0a5ecda6dfcea056c5e0af8abcf1eba00fc2e68b8df7e07e3951968c385850f01ecf46f08dfdbe7083  seafile.initd
+051ccc065a3b7abc7c802e00e364da1c3f689e133c4ba37385dbff97cfe8ad4b490cf53778344d129213fb0238258690a47f5e737387bce1368db59d22ee8504  seafile.confd
+"
diff --git a/seafile/seafile-server.post-install b/seafile/seafile-server.post-install
new file mode 100644
index 0000000000000000000000000000000000000000..dee6e9797af648baf68dbc3d61a15a58f5477f32
--- /dev/null
+++ b/seafile/seafile-server.post-install
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+SEAFILE_HOME=/var/lib/seafile
+SEAFILE_DEFAULT=$SEAFILE_HOME/default
+
+if [[ ! -d $SEAFILE_DEFAULT/scripts ]]; then
+	cd $SEAFILE_DEFAULT
+	cp -ar /usr/share/seafile/scripts .
+fi
diff --git a/seafile/seafile-server.pre-install b/seafile/seafile-server.pre-install
new file mode 100644
index 0000000000000000000000000000000000000000..7e3df0b5ef9febbb04bf553f905cf02c73baa0d4
--- /dev/null
+++ b/seafile/seafile-server.pre-install
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+SEAFILE_HOME=/var/lib/seafile
+
+addgroup -S -g 800 seafile 2>/dev/null
+adduser -S -u 800 -D -h $SEAFILE_HOME -s /bin/sh -G seafile -g seafile seafile 2>/dev/null
+
+exit 0
diff --git a/seafile/seafile.confd b/seafile/seafile.confd
new file mode 100644
index 0000000000000000000000000000000000000000..b169b0e55fe520f5b7641cb2d434298ee653cedd
--- /dev/null
+++ b/seafile/seafile.confd
@@ -0,0 +1,4 @@
+instance="default"
+
+seafile_user="seafile"
+seafile_group="seafile"
diff --git a/seafile/seafile.initd b/seafile/seafile.initd
new file mode 100644
index 0000000000000000000000000000000000000000..b92a7653ad99c2dbd7bdc2fc4d06fb5573d0351f
--- /dev/null
+++ b/seafile/seafile.initd
@@ -0,0 +1,16 @@
+#!/sbin/openrc-run
+
+depend() {
+	need net
+}
+
+start() {
+	ebegin "Starting Seafile $instance instance"
+	start-stop-daemon --chdir /var/lib/seafile/$instance --user $seafile_user \
+	    --group $seafile_group /usr/bin/seafile-admin start $seafile_opts
+}
+
+stop() {
+	ebegin "Stopping Seafile $instance instance"
+	start-stop-daemon --chdir /var/lib/seafile/$instance /usr/bin/seafile-admin stop
+}