summaryrefslogtreecommitdiff
path: root/packages/sys-power/nut/nut.exlib
blob: c18de3b728b12e3cbabd21ecc7af300a396cfb41 (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
# Copyright 2018 Gluzskiy Alexandr <sss@sss.chaoslab.ru>
# Distributed under the terms of the GNU General Public License v2

require github [ user=networkupstools tag=v${PV} ]
require autotools [ supported_autoconf=[ 2.5 ] supported_automake=[ 1.15 ] ]
require systemd-service

SUMMARY="Network-UPS Tools"
HOMEPAGE="http://www.networkupstools.org/"

LICENCES="GPL-2"
SLOT="0"


MYOPTIONS="cgi [[ description = [ build NUT CGI program ] ]]
    snmp usb ssl tcpd xml zeroconf
    ssl? ( ( providers: libressl openssl ) [[ number-selected = exactly-one ]] )
"


export_exlib_phases src_prepare src_install

DEPENDENCIES="
    build+run:
        cgi? ( media-libs/gd[>=2] )
        snmp? ( net/net-snmp )
        usb? ( dev-libs/libusb:0.1 )
        ssl? (
            providers:libressl? ( dev-libs/libressl:= )
            providers:openssl? ( dev-libs/openssl )
        )
        tcpd? ( sys-apps/tcp-wrappers )
        xml? ( net-misc/neon )
        zeroconf? ( net-dns/avahi )
    run:
        user/nut
        group/nut
    build:
        dev-lang/python
"

DEFAULT_SRC_CONFIGURE_PARAMS=(
    --sysconfdir=/etc/nut
    --datarootdir=/usr/share/nut
    --datadir=/usr/share/nut
    --disable-static
    --with-statepath=/var/lib/nut
    --with-drvpath=/usr/$(exhost --target)/lib/nut
    --with-htmlpath=/usr/share/nut/html
    --with-user=nut
    --with-group=nut
    --with-logfacility=LOG_DAEMON
    --with-dev
    --with-serial
    --without-powerman
    --without-docs
    --with-systemdsystemunitdir=${SYSTEMDSYSTEMUNITDIR}
)
#--with-doc=man 

DEFAULT_SRC_CONFIGURE_OPTION_WITHS=(
    cgi
    snmp
    ssl
    "tcpd wrap"
    usb
    "xml neon"
    "zeroconf avahi"
)


nut_src_prepare() {
    expatch "${FILES}"/autogen.patch
    edo sed -e "s/pkg-config/$(exhost --target)-pkg-config/g" -i "${WORK}"/m4/*.m4
    edo sed -e "s/AR, ar/AR, $(exhost --target)-ar/g" -i "${WORK}"/configure.ac
    edo ./autogen.sh
    autotools_src_prepare
}

nut_src_install() {
    default
    if option usb; then
        edo mv "${IMAGE}"/lib/udev "${IMAGE}"/usr/$(exhost --target)/lib/
        edo rmdir "${IMAGE}"/lib
    else
        edo rm -rf "${IMAGE}"/lib
    fi
}