PortSystem 1.0

name			syslog-ng
version			3.0.8
revision		2
categories		sysutils
license			{GPL-2 OpenSSLException}
platforms		darwin
maintainers		nomaintainer
description		Highly configurable syslog replacement.
long_description	syslog-ng is the world's most flexible and scalable audit \
					trail processing tool for organizations of any size. It \
					provides a centralised, securely stored log of all devices \
					on your network, whatever platform they run on. And \
					syslog-ng also incorporates a host of powerful features, \
					including filtering based on message content, as well as \
					customisable data mining and analysis capabilities.

homepage			http://www.balabit.com/products/syslog_ng/
master_sites			http://www.balabit.com/downloads/files/syslog-ng/open-source-edition/${version}/source/
checksums			md5 7107f5758dec4b774136f0f827b35258
distfiles			${name}_${version}${extract.suffix}
patchfiles			patch-src-Makefile.in.diff

depends_build			port:pkgconfig
depends_lib			port:eventlog \
				port:libnet11 \
				path:lib/pkgconfig/glib-2.0.pc:glib2

startupitem.create      yes
startupitem.executable  ${prefix}/sbin/syslog-ng
startupitem.pidfile clean ${prefix}/var/syslog-ng.pid

configure.args		--mandir=${prefix}/share/man \
			--enable-dynamic-linking \
			--sysconfdir=${prefix}/etc

platform powerpc	{
	configure.args-append		--host=powerpc
}

pre-destroot {
# Append the major.minor version number to the top of the sample config
	set major_minor [join [lrange [split ${version} .] 0 1] .]
	system "echo version $major_minor >> ${worksrcpath}/doc/examples/header"
	system "cat ${worksrcpath}/doc/examples/header ${worksrcpath}/doc/examples/syslog-ng.conf.sample \
		> ${worksrcpath}/doc/examples/syslog-ng.conf-dist"
}

post-destroot	{
	xinstall -m 644 ${worksrcpath}/doc/examples/syslog-ng.conf-dist \
		${destroot}${prefix}/etc
	xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
	xinstall -m 644 -W ${worksrcpath} ChangeLog README AUTHORS COPYING NEWS \
		${destroot}${prefix}/share/doc/${name}
	reinplace "s|/dev/log|/var/run/syslog|g" \
		${destroot}${prefix}/etc/syslog-ng.conf-dist
}

notes \
"To use syslog-ng, first unload OS X's built-in syslog daemon:

	sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.syslogd.plist

Then copy ${prefix}/etc/syslog-ng.conf-dist to ${prefix}/etc/syslog-ng.conf,
customize, and load syslog-ng:

	sudo launchctl load -w /Library/LaunchDaemons/org.macports.syslog-ng.plist"