summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 8b13fe4434072579ef91a5f428875bd6913f31f3 (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
# Maintainer: Einar Arnason einsiarna@gmail.com

ORG_NAME=emqx
REPO_NAME=emqx
LATEST_INFO="$(curl -s https://api.github.com/repos/${ORG_NAME}/${REPO_NAME}/releases/latest)"
TAG=$(echo "$LATEST_INFO" | grep "tag_name" | cut -d'"' -f4)

pkgname=$REPO_NAME-git
pkgver=5.0.3.49
pkgrel=1
pkgdesc="EMQX, a distributed, massively scalable, highly extensible MQTT message broker."
arch=('x86_64')
url="https://github.com/$ORG_NAME/$REPO_NAME"
license=('APACHE')
backup=("etc/emqx/emqx.conf")
provides=("$REPO_NAME" "$REPO_NAME-git")
conflicts=("$REPO_NAME" "$REPO_NAME-bin")
source=(
    "git+https://github.com/$ORG_NAME/$REPO_NAME.git"
)
sha256sums=(
    'SKIP'
)
depends=(ncurses erlang-nox)
makedepends=(
    cmake
    erlang-nox
    git
    unzip
    systemd
)
optdepends=()
install=$REPO_NAME.install
options=()

pkgver() {
    cd "$srcdir"/$REPO_NAME || exit
    echo "$TAG.$(git rev-list "$TAG"..HEAD --count)" | sed 's/v//g'
}

build() {
    cd "$srcdir/$REPO_NAME" || exit
    export CFLAGS="-fno-pie -no-pie -fPIC"
    make
}

package() {
    install -d "$pkgdir"/usr/bin
    install -d "$pkgdir"/usr/lib/emqx/bin
    install -d "$pkgdir"/usr/lib/emqx/plugins
    install -d "$pkgdir"/usr/lib/emqx/releases
    install -d "$pkgdir"/usr/lib/emqx/lib
    install -d "$pkgdir"/etc/
    install -d "$pkgdir"/var/lib/emqx
    install -d "$pkgdir"/var/log/emqx

    touch "$pkgdir"/usr/lib/emqx/plugins/.keep
    cp -ar "$srcdir"/emqx/_build/emqx/rel/emqx/bin "$pkgdir"/usr/lib/emqx/
    chmod +x "$pkgdir"/usr/lib/emqx/*
    ln -s /usr/lib/emqx/bin/emqx "$pkgdir"/usr/bin/emqx
    ln -s /usr/lib/emqx/bin/emqx_ctl "$pkgdir"/usr/bin/emqx_ctl
    cp -ar "$srcdir"/emqx/_build/emqx/rel/emqx/etc "$pkgdir"/usr/lib/emqx/
    ln -s /usr/lib/emqx/etc "$pkgdir"/etc/emqx
    cp -ar "$srcdir"/emqx/_build/emqx/rel/emqx/data/* "$pkgdir"/var/lib/emqx/
    cp -ar "$srcdir"/emqx/_build/emqx/rel/emqx/lib "$pkgdir"/usr/lib/emqx/
    cp -ar "$srcdir"/emqx/_build/emqx/rel/emqx/releases "$pkgdir"/usr/lib/emqx/
    cp -ar "$srcdir"/emqx/_build/emqx/rel/emqx/erts* "$pkgdir"/usr/lib/emqx/
    install -D -m 644 "$srcdir"/emqx/deploy/packages/emqx.service "$pkgdir"/usr/lib/systemd/system/emqx.service
}