summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 007c6332874788a676a909a8c70dca9e50799055 (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
# shellcheck disable=SC2034,SC2154,SC2164
pkgname=('heka')
_srcname='heka'
pkgdesc='Data collection and processing made easy'
pkgver='0.10.0'
pkgrel='7'
arch=('i686' 'x86_64')
url="https://github.com/mozilla-services/${_srcname}"
license=('MPL2')

depends=('geoip')
makedepends=(
    'cmake'
    'gcc'
    'git'
    'go'
    'make'
    'mercurial'
    'patch'
)
optdepends=('geoip-database-extra: GeoIpDecoder')

source=(
    "${_srcname}::git+${url}.git#tag=v${pkgver}"
    'heka.service'
    'cmake.patch'
)
sha512sums=(
    'SKIP'
    'SKIP'
    'SKIP'
)

install='install.sh'

prepare() {
    cd "${srcdir}/${_srcname}"

    git apply "${srcdir}/cmake.patch"
}

build() {
    path_build="${srcdir}/build"
    mkdir --parents "${path_build}"
    cd "${path_build}"

    export GOPATH="${path_build}/heka"
    export LD_LIBRARY_PATH="${GOPATH}/lib"
    export DYLD_LIBRARY_PATH="${GOPATH}/lib"
    export GOBIN="${GOPATH}/bin"
    export PATH="${GOBIN}:${PATH}"
    export CTEST_OUTPUT_ON_FAILURE=1

    cmake \
        -DCMAKE_INSTALL_PREFIX='/usr' \
        -DCMAKE_BUILD_TYPE='release' \
        -DHEKA_PATH='/usr/share/heka' \
        "${srcdir}/${_srcname}"
    make
}

package() {
    path_build="${srcdir}/build"
    cd "${path_build}"

    export GOPATH="${path_build}/heka"
    export GOBIN="${GOPATH}/bin"
    export PATH="${GOBIN}:${PATH}"

    make DESTDIR="${pkgdir}" install

    install --owner='533' --group='533' --mode='750' --directory "${pkgdir}/var/cache/hekad"
    install --directory "${pkgdir}/etc/heka/conf.d"
    install -D --mode='644' "${srcdir}/heka.service" "${pkgdir}/usr/lib/systemd/system/heka.service"
}