aboutsummaryrefslogtreecommitdiffstats
path: root/community/nut/APKBUILD
blob: 61d17e1b8540032572658596be793cc6a41a8935 (plain) (blame)
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
# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Contributor: Kozak Ivan <kozak-iv@yandex.ru>
# Maintainer: Kozak Ivan <kozak-iv@yandex.ru>
pkgname=nut
pkgver=2.8.0
pkgrel=4
pkgdesc="Network UPS tools"
url="https://networkupstools.org/"
arch="all"
license="GPL-2.0-or-later"
depends="hidapi eudev udev-init-scripts-openrc"
depends_dev="openssl-dev>3 libmodbus-dev libusb-dev net-snmp-dev neon-dev nss-dev"
makedepends="$depends_dev libtool autoconf automake"
pkgusers=$pkgname
pkggroups=$pkgname
install="$pkgname.pre-install"
subpackages="$pkgname-doc $pkgname-dev $pkgname-bash-completion $pkgname-openrc"
source="https://networkupstools.org/source/${pkgver%.*}/nut-$pkgver.tar.gz
	upsd.initd
	upsmon.initd
	"

prepare() {
	default_prepare

	# fix version
	git init .
	git config user.name "abc"
	git config user.email "a@a"
	git add configure.ac
	git commit -m "$pkgver"
	git tag "$pkgver"

	autoreconf -fi
}

build() {
	CFLAGS="$CFLAGS -flto=auto" \
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--libexecdir=/usr/lib/nut \
		--without-wrap \
		--with-user=$pkgname \
		--with-group=$pkgname \
		--disable-static \
		--with-serial \
		--with-usb \
		--without-avahi \
		--with-snmp \
		--with-modbus \
		--with-neon \
		--without-powerman \
		--without-ipmi \
		--without-freeipmi \
		--with-libltdl \
		--without-cgi \
		--with-drvpath=/usr/lib/nut \
		--datadir=/usr/share/nut \
		--sysconfdir=/etc/nut \
		--with-statepath=/var/run/nut \
		--with-altpidpath=/var/run/nut \
		--with-udev-dir=/lib/udev \
		--with-nss \
		--with-openssl
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
	install -Dm755 "$srcdir"/upsd.initd "$pkgdir"/etc/init.d/nut-upsd
	install -Dm755 "$srcdir"/upsmon.initd "$pkgdir"/etc/init.d/nut-upsmon
	install -Dm644 "$builddir"/scripts/logrotate/nutlogd "$pkgdir"/etc/logrotate.d/$pkgname
	install -d -o $pkgname -g $pkgname "$pkgdir"/var/lib/$pkgname

	install -D -m644 "$builddir"/scripts/misc/nut.bash_completion \
		"$pkgdir"/usr/share/bash-completion/completions/$pkgname.bash

	local file;
	for file in "$pkgdir"/etc/nut/*.sample; do
		chmod 640 $file
		chown root:$pkgname $file
		mv $file ${file%.sample}
	done
}

sha512sums="
3c413ae54088045a713eb80cf1bdda474f41bb3b67c7c0248aa7a0c4d441dce1ff42627a2735273d7e36892d1f2eeb895220cf28af63fec2fa0c7a267f82d577  nut-2.8.0.tar.gz
5fce1247815e36a0e787f28dfec215077a42b046f6ce35a5ad3cf94479dfc26303d3cf4d5f760d5851ed5273ee398572c36cd354af0645cbebc1f1560414e222  upsd.initd
32470ae473fc363131787cd57f13d40763898947d56d032790ba7f3a5eaa8038b602f7e395ca44f6c5adce8ee5ec496e30ca0eaadb3c78a38015677aea751e12  upsmon.initd
"