# $Id: Portfile,v 1.6 2006/03/12 02:21:07 markd Exp $
PortSystem 1.0

name			dnsupdate
version			2.7
categories		aqua net
maintainers		darwinports@opendarwin.org
platforms		darwin
description		DNSUpdate 2 is an Mac OS X client for dynamic DNS services
long_description	DNSUpdate 2 is a client for dynamic DNS services \
					like DynDNS.org and ZoneEdit.com, specific to MacOS \
					X. It uses the Cocoa framework and is launched at \
					boot time. It comes with a graphic application to \
					configure and monitor the client.
homepage		http://www.dnsupdate.org/
master_sites	http://ju.jalon.free.fr/DNSUpdateProject/
distname		DNSUpdate${version}s
checksums		md5 02edf8eca13cb0d40a9d5f38eb0a35cc
worksrcdir		DNSUpdate2

patchfiles		patch-DUInterface.h patch-DNSUpdate2.pbproj-project.pbxproj
post-patch {
	cd ${worksrcpath}
	reinplace "s|/usr/bin/tar.*\[*\]|& --owner root --group wheel|" \
		DNSUpdate2.pbproj/project.pbxproj
	reinplace "s|/usr/local|${prefix}|" \
		DNSUpdate2.pbproj/project.pbxproj \
		DUAppController.m \
		duInstallDaemon \
		duUninstallDaemon \
		English.lproj/DNSUpdateHelp.rtfd/TXT.rtf \
		French.lproj/DNSUpdateHelp.rtfd/TXT.rtf \
		German.lproj/DNSUpdateHelp.rtfd/TXT.rtf \
		Italian.lproj/DNSUpdateHelp.rtfd/TXT.rtf \
		Spanish.lproj/DNSUpdateHelp.rtfd/TXT.rtf \
		startDaemon.sh \
		StartupItem/DNSUpdate
	reinplace "s|/var/log|${prefix}/var/log|" \
		DUAppController.m \
		duInstallDaemon \
		English.lproj/DNSUpdateHelp.rtfd/TXT.rtf \
		French.lproj/DNSUpdateHelp.rtfd/TXT.rtf \
		German.lproj/DNSUpdateHelp.rtfd/TXT.rtf \
		Italian.lproj/DNSUpdateHelp.rtfd/TXT.rtf \
		Spanish.lproj/DNSUpdateHelp.rtfd/TXT.rtf \
		startDaemon.sh \
		StartupItem/DNSUpdate
	reinplace "s|/var/run|${prefix}/var/run|" \
		DUProtocols.h \
		English.lproj/DNSUpdateHelp.rtfd/TXT.rtf \
		French.lproj/DNSUpdateHelp.rtfd/TXT.rtf \
		German.lproj/DNSUpdateHelp.rtfd/TXT.rtf \
		Italian.lproj/DNSUpdateHelp.rtfd/TXT.rtf \
		Spanish.lproj/DNSUpdateHelp.rtfd/TXT.rtf
}

use_configure	no

build.type		pbx
build.target
build.args		-configuration Deployment -target All

destroot {
	cd ${worksrcpath}/build/Deployment
	# Install DNSUpdate application
	set appName DNSUpdate
	set appPath ${destroot}/Applications/DarwinPorts
	xinstall -d -m 0755 ${appPath}
	system "cp -R ${appName}.app ${appPath}/${appName}.app"

	# Install DNSUpdate daemon
	xinstall -m 0755 ${appName}.app/Contents/Resources/${name} \
		${destroot}${prefix}/sbin/${name}

	# Install StartupItem for DNSUpdate
	set itemPath ${destroot}/Library/StartupItems
	xinstall -d -m 0755 ${itemPath}/${appName}
	system "tar xvfz ${appName}.app/Contents/Resources/StartupItem.tgz \
		-C ${itemPath}/${appName}"

	# Create PREFIX/var/log placeholder
	set logPath ${destroot}${prefix}/var/log
	xinstall -d -m 0755 ${logPath}

	# Create PREFIX/var/run placeholder
	set runPath ${destroot}${prefix}/var/run
	destroot.keepdirs ${logPath} ${runPath}
}
