# $Id: Portfile,v 1.7 2005/10/20 19:52:53 mww Exp $

PortSystem 1.0
name		smpeg
version		0.4.4
revision	6
categories	multimedia
maintainers	mww@opendarwin.org
platforms	darwin
description	a general purpose MPEG video/audio player/library
long_description	smpeg is a general purpose MPEG video/audio player and \
			library programmed by Loki entertainment and others

homepage	http://www.lokigames.com/development/smpeg.php3
master_sites	ftp://ftp.lokigames.com/pub/open-source/smpeg/ freebsd \
			opendarwin::lt
distfiles-append	ltconfig13:lt \
				ltmain13:lt
extract.only	${distname}${extract.suffix}

checksums	${distname}${extract.suffix} md5 59c76ac704088ef5539210190c4e1fe3 \
			ltconfig13 md5 ea53f42a550c9f9e653758a8ed91574e \
			ltmain13 md5 e094ae92724c4015dbab97de151c2525

depends_lib	port:libsdl

patchfiles	patch-smpeg.h patch-glmovie-tile.c patch-glmovie.c patch-Makefile.in
post-patch {
	file copy -force ${distpath}/ltconfig13 ${worksrcpath}/ltconfig
	file copy -force ${distpath}/ltmain13 ${worksrcpath}/ltmain.sh
}

configure.args	--without-x \
		--disable-gtktest \
		--disable-gtk-player \
		--disable-static \
		--disable-sdltest \
		--mandir=${prefix}/share/man \
		--enable-shared=no

configure.env	CC=g++
platform darwin 8 {
	configure.env	CC=/usr/bin/g++-4.0 CXX=/usr/bin/g++-4.0
}

set libname	libsmpeg.${version}.dylib
set ln	"ln -s ${libname}"
post-destroot {
	xinstall -m 644 ${worksrcpath}/${libname} ${destroot}${prefix}/lib
	system "cd ${destroot}${prefix}/lib && ${ln} libsmpeg.dylib \
		&& ${ln} libsmpeg.0.dylib && ${ln} libsmpeg.0.4.dylib"
	reinplace "s|library_names=\'\'|library_names=\'${libname}\'|g" \
		${destroot}${prefix}/lib/libsmpeg.la
}
