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

PortSystem 1.0

name		libsdl_ttf-framework
version		2.0.7
categories	devel graphics
maintainers	darwinports@opendarwin.org
platforms	macosx
description	add on library for libSDL for rendering TrueType fonts
long_description	This library is a wrapper around the excellent \
			FreeType 2.0 library allowing to render TrueType fonts \
			in SDL applications.
	
homepage	http://www.libsdl.org/projects/SDL_ttf
master_sites	${homepage}/release/
distname	SDL_ttf-${version}
dist_subdir     libsdl_ttf
checksums	md5 0f6ee1a502e6913a412aac353dc75bbc

depends_lib	port:libsdl-framework \
		port:libsdl_ttf

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_ttf.pbproj/project.pbxproj
	reinplace "s|\$(HOME)/Library/Frameworks|/Library/Frameworks|g" \
		${worksrcpath}/PBProjects/SDL_ttf.pbproj/project.pbxproj
	reinplace "s|\$HOME/Library/Frameworks|/Library/Frameworks|g" \
		${worksrcpath}/PBProjects/SDL_ttf.pbproj/project.pbxproj
	reinplace "s|freetype/include|${prefix}/include/freetype2 ${prefix}/include|g" \
		${worksrcpath}/PBProjects/SDL_ttf.pbproj/project.pbxproj
	reinplace "s|freetype/lib|${prefix}/lib|g" \
		${worksrcpath}/PBProjects/SDL_ttf.pbproj/project.pbxproj
	reinplace "s|build/SDL_ttf.framework|${buildindir}/SDL_ttf.framework|g" \
		${worksrcpath}/PBProjects/SDL_ttf.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_ttf.framework/SDL_ttf \
			build/Frameworks/SDL_ttf.framework/SDL_ttf"
}

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

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