# $Id: Portfile,v 1.3 2006/03/13 09:41:59 takanori Exp $

#Synced with Fink, revision 1023

set kdeadmin kde-admindir-3.5.1

PortSystem 1.0
name		kdeedu3
version		3.5.1
revision	1
categories	kde
maintainers	ben@opendarwin.org takanori@opendarwin.org
description	KDE educational games and software. \
		NB No KDE sound support.
platforms	darwin
master_sites	kde:stable/${version}/src \
		http://ranger.befunk.com/fink/:admin
extract.suffix	.tar.bz2
use_bzip2	yes
distname	kdeedu-${version}
distfiles	${distname}.tar.bz2 ${kdeadmin}.tar.bz2:admin
depends_build	port:autoconf \
		port:automake
depends_lib	port:kdebase3

checksums	${distname}.tar.bz2 md5 fe31b9a2ec4e299531c6b7beeab09534 \
		${kdeadmin}.tar.bz2 md5 b6115a7310f8e8533af91be02e225d0e

extract.only ${distname}.tar.bz2
post-extract { system "cd ${worksrcpath} && bzcat -dc ${distpath}/${kdeadmin}.tar.bz2 | tar xf -" }

patchfiles	kdeedu3.patch
patch		{
		cd ${worksrcpath}
		foreach file $patchfiles {
		    system "sed -e 's,@FINKPREFIX@,${prefix},g' ${portpath}/${filesdir}/${file} | patch -p1"
		}
}
post-patch      {
		reinplace "s|lib/freetype219/||g" ${worksrcpath}/environment-helper.sh
		reinplace "s|include/qt|include/qt3|g" ${worksrcpath}/environment-helper.sh
		reinplace "s|--with-ssl-dir=/usr|--with-ssl-dir=\$PREFIX|g" ${worksrcpath}/environment-helper.sh
		foreach file [glob ${worksrcpath}/admin/*] {
		    reinplace "s|-O2|-Os|g" $file
		    reinplace "s|doc/HTML|doc/kde|g" $file
		    reinplace "s|/usr/share/doc/packages/qt3/html|${prefix}/share/doc/qt3/html|g" $file
		}
		foreach file {CompileScript.sh InstallScript.sh} {
		    file copy ${portpath}/${filesdir}/${file} ${worksrcpath}
		    reinplace "s|%p|${prefix}|g" ${worksrcpath}/${file}
		    reinplace "s|%N|${name}|g" ${worksrcpath}/${file}
		    reinplace "s|%v|${version}|g" ${worksrcpath}/${file}
		    reinplace "s|%r|${revision}|g" ${worksrcpath}/${file}
		    reinplace "s|%c|${configure.args}|g" ${worksrcpath}/${file}
		    reinplace "s|%d|${destroot}|g" ${worksrcpath}/${file}
		    reinplace "s|%i|${destroot}${prefix}|g" ${worksrcpath}/${file}
		    file attributes ${worksrcpath}/${file} -permissions 0755
		}
}

configure.args	--disable-kig-python-scripting --with-distribution='DarwinPorts/Mac OS X' --without-arts

configure	{}
build		{ system "cd ${worksrcpath} && ./CompileScript.sh" }
destroot	{ system "cd ${worksrcpath} && ./InstallScript.sh" }

post-destroot   {
		xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
		xinstall -m 644 -W ${worksrcpath} COPYING INSTALL README ${destroot}${prefix}/share/doc/${name}
}

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