aboutsummaryrefslogblamecommitdiffstats
path: root/community/nut/APKBUILD
blob: 61d17e1b8540032572658596be793cc6a41a8935 (plain) (tree)
1
2
3
4
5
6
7
8
9
                                                      


                                              
            
        
                           
                                  
          
                          
                                               
                                                                                  
                                                    

                  
                              
                                                                                
                                                                          


                    
 




                       

                                   


                               

                      

 
         
                                     


                                 
                               
                                           
                                

                                       




                                  
                               





                                    
                                             

                                          

                                                
                                           
                            

                              

 
         
                  
 
 
           
                                      

                                                                             
                                                                                               
                                                                     
 


                                                                             

                                                  


                                         
            

 
            
                                                                                                                                                  


                                                                                                                                              
# 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
"