# $Id: Portfile,v 1.4 2006/06/30 04:05:35 ben Exp $
PortSystem		1.0

name			libsdl_net-framework
version			1.2.5
platforms		macosx
categories		devel net
maintainers		darwinports@opendarwin.org
description		cross-platform networking library
long_description	This is a small sample cross-platform networking \
			library, with a sample chat client and server \
			application. The chat client uses the GUIlib GUI \
			framework library.
homepage		http://www.libsdl.org/projects/SDL_net/
master_sites		${homepage}/release/
distname		SDL_net-${version}
dist_subdir             libsdl_net
checksums		md5 e45b1048d2747480dcc65ece4130a920
depends_lib		port:libsdl-framework \
			port:libsdl_net

configure.args		--disable-sdltest

set buildindir build

platform darwin 8 {
if {$xcodeversion == "2.1"} {
set buildindir build/Deployment
}
}

post-extract {
	system "cd ${worksrcpath} && tar -xvzf PBProjects.tar.gz"
}

post-patch {
	reinplace "s|~/Library/Frameworks|./build/Frameworks|g" \
		${worksrcpath}/PBProjects/SDL_net.pbproj/project.pbxproj
	reinplace "s|\$(HOME)/Library/Frameworks|/Library/Frameworks|g" \
		${worksrcpath}/PBProjects/SDL_net.pbproj/project.pbxproj
	reinplace "s|\$HOME/Library/Frameworks|/Library/Frameworks|g" \
		${worksrcpath}/PBProjects/SDL_net.pbproj/project.pbxproj
	reinplace "s|build/SDL_net.framework|${buildindir}/SDL_net.framework|g" \
		${worksrcpath}/PBProjects/SDL_net.pbproj/project.pbxproj
}


build.dir	"${worksrcpath}/PBProjects"
build.type	pbx
build.target	-buildstyle Deployment -target Framework

post-build {
		cd ${worksrcpath}/PBProjects
		system "install_name_tool -id /Library/Frameworks/SDL_net.framework/SDL_net \
			build/Frameworks/SDL_net.framework/SDL_net"
}

destroot {
		cd "${worksrcpath}/PBProjects/build/Frameworks"
		xinstall -d -m 0755 ${destroot}/Library/Frameworks
		system "cp -R SDL_net.framework ${destroot}/Library/Frameworks"
}

platform darwin 6 {
	depends_lib-append	lib:libdl:dlcompat
}
