# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4
# $Id: Portfile 62755 2010-01-16 09:38:34Z krischik@macports.org $

PortSystem 1.0

name				leafnode
version				1.11.7
revision			2
categories			news
platforms			darwin
maintainers			macports.org:krischik
description			Leafnode is a store & forward NNTP proxy
long_description	Leafnode is a software package that implements a store	\
					& forward NNTP proxy (client and server) that supportis	\
					TCP connections across IPv4 and IPv6. It can be used to	\
					give a regular newsreader off-line functionality, merge	\
					news articles from several upstream newsservers for		\
					newsreaders that only support one server well and avoid	\
					duplicate news download for a small LAN with multiple	\
					users reading news.

homepage			http://leafnode.sourceforge.net/
master_sites		sourceforge

checksums			md5 e5e8ac28386c59df0b14ddbfcbe78509

depends_lib			port:pcre

use_bzip2			yes

configure.args		--mandir='\${prefix}/share/man'			\
					--sysconfdir='\${prefix}/etc/${name}'	\
					--with-user=_news						\
					--with-group=_news

configure.cxxflags-append	"-I${prefix}/include"

destroot.destdir	prefix=${destroot}${prefix}

set launch_dir /etc/LaunchDaemons/org.macports.${name}

pre-destroot {
	addgroup	_news			realname="NEWS Server group"
	adduser		_news gid=_news realname="NEWS Server user"
}

post-destroot {
	xinstall -o _news -g _news	-m 750 -d ${destroot}${prefix}/etc/${name}
	xinstall -o root  -g wheel	-m 750 -d ${destroot}${prefix}${launch_dir}
	xinstall					-m 755 -d ${destroot}${prefix}/var
	xinstall					-m 755 -d ${destroot}${prefix}/var/spool
	xinstall -o _news -g _news	-m 755 -d ${destroot}${prefix}/var/spool/news
	xinstall					-m 755 -d ${destroot}/${applications_dir}/Utilities

	xinstall -o _news -g _news -m 640											\
		-W ${filespath}															\
		config																	\
		filters																	\
		${destroot}${prefix}/etc/${name}

	xinstall -o _news -g _news -m 644											\
		-W ${filespath}															\
		dummy																	\
		${destroot}${prefix}/var/spool/news

	xinstall -o root -g wheel -m 644											\
		-W ${filespath}															\
		org.macports.fetchnews.plist.in											\
		${destroot}${prefix}${launch_dir}/org.macports.fetchnews.plist
	xinstall -o root -g wheel -m 644											\
		-W ${filespath}															\
		org.macports.leafnode.plist.in											\
		${destroot}${prefix}${launch_dir}/org.macports.leafnode.plist
	xinstall -o root -g wheel -m 644											\
		-W ${filespath}															\
		org.macports.texpire.plist.in											\
		${destroot}${prefix}${launch_dir}/org.macports.texpire.plist

	xinstall -m 755																\
		-W ${filespath}															\
		Restart_Fetchnews.command.in											\
		${destroot}/${applications_dir}/Utilities/Restart_Fetchnews.command
	xinstall -m 755																\
		-W ${filespath}															\
		Restart_Leafnode.command.in												\
		${destroot}/${applications_dir}/Utilities/Restart_Leafnode.command
	xinstall -m 755																\
		-W ${filespath}															\
		Restart_Texpire.command.in												\
		${destroot}/${applications_dir}/Utilities/Restart_Texpire.command

	reinplace																	\
		s|@PREFIX@|${prefix}|g													\
		${destroot}${prefix}${launch_dir}/org.macports.fetchnews.plist			\
		${destroot}${prefix}${launch_dir}/org.macports.leafnode.plist			\
		${destroot}${prefix}${launch_dir}/org.macports.texpire.plist
	reinplace																	\
		s|@PREFIX@|${prefix}|g													\
		${destroot}/${applications_dir}/Utilities/Restart_Fetchnews.command		\
		${destroot}/${applications_dir}/Utilities/Restart_Leafnode.command		\
		${destroot}/${applications_dir}/Utilities/Restart_Texpire.command
}

############################################################ {{{1 ###########
# vim: set nowrap tabstop=4 shiftwidth=4 softtabstop=4 noexpandtab :
# vim: set textwidth=0 filetype=tcl foldmethod=marker nospell :
