1# Contributor: <xmingske@gmail.com>
2# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
3pkgname=seafile
4pkgver=7.0.9
5pkgrel=1
6pkgdesc="Cloud storage system with advanced support for file syncing, privacy protection and teamwork"
7url="https://github.com/haiwen/seafile/"
8arch="all"
9license="AGPL3"
10makedepends="autoconf automake bash curl-dev fuse-dev glib-dev
11 intltool jansson-dev libarchive-dev libevent-dev libevhtp-dev
12 libsearpc-dev libtool libzdb-dev openssl-dev sqlite-dev util-linux-dev
13 vala bsd-compat-headers libevhtp-dev"
14depends="bash ${pkgname}-common"
15pkgusers="seafile"
16pkggroups="seafile"
17source="
18 $pkgname-$pkgver.tar.gz::https://github.com/haiwen/seafile/archive/v${pkgver}.tar.gz
19 seafile.initd
20 seafile.confd"
21subpackages="$pkgname-dev $pkgname-doc py-$pkgname:py $pkgname-server
22 $pkgname-common"
23install="seafile-server.pre-install seafile-server.post-install"
24
25_builddir="${srcdir}/${pkgname}-${pkgver}"
26
27prepare() {
28 local pf
29 cd "${_builddir}" || return 1
30 for pf in $source; do
31 case $pf in
32 *.patch) msg $pf; patch -p1 -i "$srcdir"/${pf} || return 1;;
33 esac
34 done
35}
36
37build() {
38 cd "${_builddir}"
39 ./autogen.sh
40 ./configure \
41 --prefix=/usr \
42 --sysconfdir=/etc \
43 --mandir=/usr/share/man \
44 --infodir=/usr/share/info \
45 --enable-server \
46 --enable-python \
47 --enable-fuse \
48 --enable-client \
49 --enable-console
50 make CFLAGS="$CFLAGS $(pkgconf --cflags evhtp)" || return 1
51}
52
53package() {
54 cd "${_builddir}"
55 make DESTDIR="${pkgdir}" install || return 1
56 rm "${pkgdir}"/usr/lib/libseafile.la || return 1
57}
58
59py() {
60 arch="noarch"
61 cd "$_builddir"
62 pkgdesc="$pkgname python bindings"
63 install -d "$subpkgdir"/usr/lib || return 1
64 mv "$pkgdir"/usr/lib/python* "$subpkgdir"/usr/lib/ || return 1
65}
66
67common() {
68 mkdir -p "${subpkgdir}"/usr/bin || return 1
69 mkdir -p "${subpkgdir}"/usr/lib || return 1
70 mv "${pkgdir}"/usr/bin/seafile "${subpkgdir}"/usr/bin
71 mv "${pkgdir}"/usr/lib/libseafile.so.0* "${subpkgdir}"/usr/lib
72}
73
74server() {
75 mkdir -p "${subpkgdir}"/usr/bin
76 for b in "${pkgdir}"/usr/bin/*; do
77 if [[ "$b" != "${pkgdir}/usr/bin/seaf-cli" ]] && \
78 [[ "$b" != "${pkgdir}/usr/bin/seaf-daemon" ]] && \
79 [[ "$b" != "${pkgdir}/usr/bin/seafile" ]]; then
80 mv "$b" "${subpkgdir}/usr/bin" || return 1
81 fi
82 done
83 mkdir -m 755 -p "${subpkgdir}"/usr/share/seafile || return 1
84 cp -ar "${_builddir}"/scripts "${subpkgdir}"/usr/share/seafile || return 1
85 install -D -m0644 "${srcdir}"/seafile.confd "${subpkgdir}"/etc/conf.d/seafile \
86 || return 1
87 install -D -m0755 "${srcdir}"/seafile.initd "${subpkgdir}"/etc/init.d/seafile \
88 || return 1
89
90 #make dirs for default instance
91 SEAFILE_HOME="${subpkgdir}"/var/lib/seafile
92 SEAFILE_DEFAULT=$SEAFILE_HOME/default
93 mkdir -m 755 -p $SEAFILE_DEFAULT 2>/dev/null
94 chown seafile:seafile $SEAFILE_DEFAULT
95
96}
97sha512sums="
984c87e7a4a6a4cef631cbfbeb1bde3c8c9e0915d5fe4597d5b3a4b8aa15e9650e97b51ee6a3b0bae4d235ec53149dca01aed7acd704da593c97da0a17e352a75d seafile-7.0.9.tar.gz
9966b84519ab66e7435da13a2ed1869bac3ead1f7b46ed4b0a5ecda6dfcea056c5e0af8abcf1eba00fc2e68b8df7e07e3951968c385850f01ecf46f08dfdbe7083 seafile.initd
100051ccc065a3b7abc7c802e00e364da1c3f689e133c4ba37385dbff97cfe8ad4b490cf53778344d129213fb0238258690a47f5e737387bce1368db59d22ee8504 seafile.confd
101"