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

PortSystem 1.0

name			libsdl_gfx-framework
version			2.0.13
categories		devel graphics
platforms		macosx
maintainers		darwinports@opendarwin.org
description		graphics primitives SDL extension
long_description	The SDL_gfx library evolved out of the \
			SDL_gfxPrimitives code which provided basic drawing \
			routines such as lines, circles or polygons and \
			SDL_rotozoom which implemented a interpolating \
			rotozoomer for SDL surfaces. The current components of \
			the SDL_gfx library are: Graphic Primitives, \
			Rotozoomer, Framerate control, MMX image filters. \
			It is backwards compatible to the above mentioned \
			code. It is written in plain C and can be used in C++ \
			code.

homepage		http://www.ferzkopp.net/~aschiffler/Software/SDL_gfx-2.0/
master_sites		${homepage}
distname		SDL_gfx-${version}
dist_subdir             libsdl_gfx
checksums		${distname}${extract.suffix} md5 b1ce778232db0b1979695f0a5a945a13

depends_lib		port:libsdl-framework \
			port:libsdl_gfx

configure.args		--disable-mmx \
			--disable-sdltest

set buildindir build

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

master_sites-append	opendarwin:lt
distfiles-append	ltconfig13:lt ltmain13:lt
checksums-append	ltconfig13 md5 ea53f42a550c9f9e653758a8ed91574e \
				ltmain13 md5 e094ae92724c4015dbab97de151c2525
extract.only		${distname}${extract.suffix}

post-extract {
	system "cd ${worksrcpath} && tar -xvzf OSX-PB.tgz"
}

post-patch {
	xinstall -m 0644 ${distpath}/ltconfig13 ${worksrcpath}/ltconfig
	xinstall -m 0644 ${distpath}/ltmain13 ${worksrcpath}/ltmain.sh
	reinplace "s|-version-info|-no-undefined -release \$(LT_RELEASE) &|" \
		${worksrcpath}/Makefile.in
	reinplace "s|\$(SYSTEM_LIBRARY_DIR)/Frameworks|/Library/Frameworks|g" \
		${worksrcpath}/PB/SDL_gfx.pbproj/project.pbxproj
	reinplace "s|\$(HOME)/Library/Frameworks|/Library/Frameworks|g" \
		${worksrcpath}/PB/SDL_gfx.pbproj/project.pbxproj
	reinplace "s|/Users/ttongue/Library/Frameworks|/Library/Frameworks|g" \
		${worksrcpath}/PB/SDL_gfx.pbproj/project.pbxproj
	reinplace "s|/Users/ttongue/Desktop/Code/PB/test/SDL_gfx-2.0.3|..|g" \
		${worksrcpath}/PB/SDL_gfx.pbproj/project.pbxproj
	reinplace "s|build/SDL_gfx.framework|${buildindir}/SDL_gfx.framework|g" \
		${worksrcpath}/PB/SDL_gfx.pbproj/project.pbxproj
}

build.dir	"${worksrcpath}/PB"
build.type	pbx
build.target	-buildstyle Deployment -target SDL_gfx

post-build {
	cd ${worksrcpath}/PB
	system "install_name_tool -id /Library/Frameworks/SDL_gfx.framework/SDL_gfx \
		${buildindir}/SDL_gfx.framework/SDL_gfx"
}

destroot {
	cd "${worksrcpath}/PB/${buildindir}"
	xinstall -d -m 0755 ${destroot}/Library/Frameworks
	system "cp -R SDL_gfx.framework ${destroot}/Library/Frameworks"
}

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

