# $Id: Portfile,v 1.5 2006/08/06 04:23:33 takanori Exp $

#Synced with Fink, Version 3.5.1-1023

PortSystem 1.0
name		kdeutils3
version		3.5.1
revision	1
set kdeadmin	kde-admindir-3.5.1
categories	kde
maintainers	ben@opendarwin.org takanori@opendarwin.org
description	KDE utilities. \
                NB No KDE sound support.
platforms	darwin
master_sites	opendarwin::kde351 \
		opendarwin::admin
#		kde:stable/${version}/src
#		http://ranger.befunk.com/fink/:admin
extract.suffix	.tar.bz2
use_bzip2	yes
distname	kdeutils-${version}
distfiles	${distname}.tar.bz2:kde351 \
		${kdeadmin}.tar.bz2:admin
depends_build	port:autoconf \
		port:automake
depends_lib	port:kdebase3 \
		port:gmp
#		port:python24

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

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

patchfiles	kdeutils3.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
		}
		# disable ksim which depends on net-snmp which doesn't build
		# on Mac OS 10.4
		file delete -force ${worksrcpath}/ksim
}

configure.args	--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} AUTHORS COPYING INSTALL README ${destroot}${prefix}/share/doc/${name}
}

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