summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c5845a39976788792797b0ccb18263fcd739bb49 (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
110
# Maintainer: Joffrey <j-off@live.fr>
# Contributor: eolianoe <eolianoe [at] gmail [DoT] com>
# Contributor: Edvinas Valatka <edacval@gmail.com>
# Contributor: Aaron Lindsay <aaron@aclindsay.com>

pkgname=seafile-server
pkgver=13.0.29
pkgrel=1
pkgdesc='Seafile server core'
arch=('i686' 'x86_64' 'armv7h' 'aarch64')
url='https://github.com/haiwen/seafile-server'
license=('AGPL-3.0-only' 'Apache-2.0')
depends=(
    'argon2'
    'fuse2'
    'hiredis'
    'mariadb-libs'
    'python'
    'libsearpc'
    'libevent'
    'libevhtp-seafile'
    'libarchive'
    'libjwt2'
)
makedepends=('intltool' 'vala' 'go' 'git')
conflicts=('seafile')
source=(
    "$pkgname-$pkgver.tar.gz::$url/archive/v$pkgver-server.tar.gz"
    'fix_seafile-controller_paths.diff'
    'fix_incompatible_pointer.diff'
    'seafile-notification@.service'
    'seafile-notification.service'
    'seafile-sysusers.conf'
    'seafile-tmpfiles.conf'
)
sha256sums=(
    '434779910a02b805d3ae2b7329eaf325433b51330b54454d2d54e20ce47b4004'
    'c4bd2b24fa2e5919b1ada61fff0dda7486460a8814764dc37db79178378d4930'
    '4d84d7b73aad520ef37d42f20a4a3b67f373a703a655e01d4e0a8158a5d985c0'
    'ae92d89964bed69582818cd1a5a220758ca7dd7382260c8eee9ab20fd29caf96'
    '5296a5b0a13a9d427989a04101db10152725f2b61ff7e017e3864fac2ad99afa'
    '2faf52556d901ae18cfaa33b1cc55ee14abab4f78869eb6a2889ceeac4e3076a'
    '24962ce5cba697d18980b9d418c7654fbfc5118c69236f9fc94aa3cd526ac176'
)

prepare() {
    cd "$srcdir/$pkgname-$pkgver-server"
    sed -i 's|(DESTDIR)@prefix@|@prefix@|' './lib/libseafile.pc.in'
    patch -p1 -i "$srcdir/fix_seafile-controller_paths.diff"
    patch -p1 -i "$srcdir/fix_incompatible_pointer.diff"
}

build() {
    cd "$srcdir/$pkgname-$pkgver-server"
    ./autogen.sh
    ./configure \
        --prefix='/usr' \
        --with-mysql='/usr/bin/mysql_config' \
        --enable-fuse \
        --enable-python \
        --enable-console
    make

    # Build Go packages
    export GOPATH="$srcdir"
    export CGO_CPPFLAGS="$CPPFLAGS"
    export CGO_CFLAGS="$CFLAGS"
    export CGO_CXXFLAGS="$CXXFLAGS"
    export CGO_LDFLAGS="$LDFLAGS"
    export CGO_ENABLED=1

    GOFLAGS='-buildmode=pie'
    GOFLAGS+=' -trimpath'
    GOFLAGS+=' -ldflags=-linkmode=external'
    GOFLAGS+=' -mod=readonly'
    GOFLAGS+=' -modcacherw'
    export GOFLAGS

    for pkg in fileserver notification-server; do
        pushd "$pkg"
        go build .
        popd
    done
}

package() {
    cd "$srcdir/$pkgname-$pkgver-server"
    make DESTDIR="$pkgdir" install

    # Prepare directories layout for deploying
    install -dm755 "$pkgdir/usr/share/$pkgname/"{runtime,seafile}
    cp -rp ./scripts/* "$pkgdir/usr/share/$pkgname"

    # The scripts needs this bin directory.
    ln -s /usr/bin/ "$pkgdir/usr/share/$pkgname/seafile/bin"

    # Install Go binaries
    for bin in fileserver notification-server; do
        install -Dm755 "$bin/$bin" "$pkgdir/usr/bin/$bin"
    done

    # Systemd
    install -Dm644 \
        "$srcdir/seafile-sysusers.conf" \
        "$pkgdir/usr/lib/sysusers.d/seafile.conf"
    install -Dm644 \
        "$srcdir/seafile-tmpfiles.conf" \
        "$pkgdir/usr/lib/tmpfiles.d/seafile.conf"
    install -Dm644 "$srcdir/"*.service -t "$pkgdir/usr/lib/systemd/system"
}