# $Id: Portfile,v 1.3 2006/03/01 08:32:44 blb Exp $

PortSystem			1.0
name				openslp
version				1.0.11
categories			devel net
maintainers			darwinports@opendarwin.org
description			Open source implementation of SLP
long_description \
	The OpenSLP project is an effort to develop an open-source \
	implementation of Service Location Protocol suitable for commercial and \
	non-commercial application. \
	Service Location Protocol is an IETF standards track protocol that \
	provides a framework to allow networking applications to discover the \
	existence, location, and configuration of networked services in \
	enterprise networks.

platforms			darwin

homepage			http://www.openslp.org/
master_sites		sourceforge opendarwin::lt

distfiles-append	ltconfig13:lt ltmain13:lt
checksums			${name}-${version}${extract.suffix} md5 \
						0ec965956ad1f66850f050b19c828b55 \
					ltconfig13 md5 ea53f42a550c9f9e653758a8ed91574e \
					ltmain13 md5 e094ae92724c4015dbab97de151c2525

extract.only		${name}-${version}${extract.suffix}

post-extract {
	file copy -force ${distpath}/ltconfig13 ${worksrcpath}/ltconfig
	file copy -force ${distpath}/ltmain13 ${worksrcpath}/ltmain.sh
	cd ${worksrcpath}/doc
	file delete -force CVS html/CVS html/IntroductionToSLP/CVS \
		html/ProgrammersGuide/CVS html/UsersGuide/CVS rfc/CVS
	system "chmod +x html rfc html/IntroductionToSLP html/ProgrammersGuide \
		html/UsersGuide"
}

set oslpTestDirs	[list SLPD_predicate_test SLPDereg SLPEscape \
					SLPFindAttrs SLPFindSrvTypes SLPFindSrvs SLPOpen \
					SLPParseSrvURL SLPReg SLPUnescape SLP_attr_test]

patchfiles			patch-Makefile.in patch-test_SLPDereg.dir_test.script \
					patch-test_SLPFindAttrs.dir_test.script \
					patch-test_SLPFindSrvTypes.dir_test.script \
					patch-test_SLPFindSrvs.dir_test.script \
					patch-test_SLPOpen.dir_test.script \
					patch-test_SLPReg.dir_test.script

post-patch {
	cd ${worksrcpath}/test
	foreach oslpATestDir ${oslpTestDirs} {
		# Since this is prior to the darwin-specific post-patch, the dirs
		# haven't been renamed to *.dir yet
		set oslpTestScript	${oslpATestDir}/test.script
		if {[file exists ${oslpTestScript}]} {
			reinplace "s|@@PREFIX@@|${prefix}|g" ${oslpTestScript}
		}
	}
}

variant darwin {
	# Need to rename some directories when on case-insensitive FS, as
	# make will create, eg, slpdereg where the directory SLPDereg
	# exists, which dies horribly on HFS+ (actual rename done in the
	# post-patch section below)
	patchfiles-append	patch-test_Makefile.in_darwin \
						patch-test_SLPEscape.dir_test.script_darwin \
						patch-test_SLPParseSrvURL.dir_test.script_darwin \
						patch-test_SLPUnescape.dir_test.script_darwin \
						patch-test_SLPDereg.dir_test.script_darwin \
						patch-test_SLPFindAttrs.dir_test.script_darwin \
						patch-test_SLPFindSrvTypes.dir_test.script_darwin \
						patch-test_SLPFindSrvs.dir_test.script_darwin \
						patch-test_SLPOpen.dir_test.script_darwin \
						patch-test_SLPReg.dir_test.script_darwin

	post-patch {
		file copy -force /usr/share/libtool/config.guess \
			/usr/share/libtool/config.sub ${worksrcpath}
		cd ${worksrcpath}/test
		foreach oslpATestDir ${oslpTestDirs} {
			file rename ${oslpATestDir} ${oslpATestDir}.dir
		}
	}
}

