summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: ee511ed68db395ba5c832244bd2b7b23d7915329 (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
# Maintainer: Philipp Schmitt (philipp<at>schmitt<dot>co)

pkgname=pilight
pkgver=7.0
pkgrel=1
pkgdesc='Modular domotica with the Raspberry Pi'
arch=('x86_64' 'armv6h' 'armv7h')
url="http://pilight.org/"
license=('GPL3')
makedepends=('cmake' 'gcc' 'glibc')
# TODO Are libpcap and libunwind not just build dependencies?
depends=('libpcap' 'libunwind')
source=("https://github.com/pilight/pilight/archive/v${pkgver}.tar.gz"
        'https://raw.github.com/pschmitt/aur-pilight/master/pilight.service')
sha256sums=('8fbf500165cdebf3700a1daa9e6c2507d1414684f65edd5252d9c9776763bbe7'
            '0d49982c52805a8004db3c32003b961731eb94af81d003b49c24cdb84607e588')
conflicts=('pilight-git')

prepare() {
    cd "${srcdir}/${pkgname}-${pkgver}"
    # Don't execute ldconfig when running make (requires root)
    sed -i 's/\(^.*COMMAND ldconfig.*\)/# \1/g' CMakeLists.txt
    # Change default webserver location
    sed -i 's|\("webserver-root"\): .*|\1: "/usr/share/webapps/pilight",|' res/config/config.json-default
}

build() {
    cd "${srcdir}/${pkgname}-${pkgver}"
    cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr
    make
}

package() {
    cd "${srcdir}/${pkgname}-${pkgver}"

    make DESTDIR="$pkgdir/" install
    install -Dm644 "${srcdir}/pilight.service" "${pkgdir}/usr/lib/systemd/system/pilight.service"

    # Fix paths
    cd "${pkgdir}"
    mv usr/sbin/* usr/bin
    rmdir usr/sbin
    mv usr/lib/pilight/libpilight.so.${pkgver} usr/lib/libpilight.so.${pkgver}
    ln -s usr/lib/libpilight.so.${pkgver} usr/lib/libpilight.so

    # Web GUI
    mkdir -p usr/share/webapps
    mv usr/local/share/pilight usr/share/webapps/pilight

    # Cleanup
    rm -rf usr/local usr/lib/pilight etc/init.d
}