description="Encrypt arbitrary TCP connections inside SSL so you can communicate over secure channels"
url="http://www.stunnel.org"

contributors="Berlius,Fanch,Greg,Tnut"
packager="spiky <spiky@nutyx.org>"


name=stunnel
version=5.67
runyx_version=20201011


source=(http://downloads.tuxfamily.org/nutyx/files/runyx-${runyx_version}.tar.xz
	https://www.stunnel.org/downloads/$name-$version.tar.gz
	stunnel.conf)
prepare () {
SN="stunnel"
IDN="51"

if ! (getent group $SN > /dev/null); then
   groupadd -g $IDN $SN
fi
if ! (getent passwd $SN > /dev/null); then
   useradd -c "stunnel Daemon" -d /var/lib/$SN \
   -u $IDN -g $SN -s /bin/false $SN
fi

}
build () {
 
cd $name-$version
./configure --prefix=/usr \
	--sysconfdir=/etc \
	--localstatedir=/var
make
make DESTDIR=$PKG install


cd ../runyx-${runyx_version}
make DESTDIR=$PKG install-sysv-stunnel
make DESTDIR=$PKG install-runyx-stunnel

install -v -m750 -d $PKG/etc/stunnel
cp -v $SRC/stunnel.conf $PKG/etc/stunnel/stunnel.conf

}
service() {
bsdtar -cf \
$PKGMK_PACKAGE_DIR/$name.service${PKGMK_BUILDVER}${PKGMK_ARCH}.cards.tar \
lib/init etc/{init,rc.d}
 
rm -r etc/{rc.d,init}
rm -r lib/init
}
