# $Id: Portfile 85874 2011-10-17 04:58:40Z jmr@macports.org $

#Synced with Fink, revision 1.37

PortSystem 1.0

name		kdepim3
version		3.5.10
revision	1
set kdeadmin	kde-admindir-1502
categories	kde kde3
license		GPL-2
maintainers	nomaintainer
description	KDE personal information management tools. \
		NB No KDE sound support.
long_description ${description}
platforms	darwin
homepage	http://www.kde.org/
master_sites	kde:stable/${version}/src/:kde \
		http://ranger.users.finkproject.org/distfiles/kde-admindir/:admin \
		http://ranger.befunk.com/fink/kde-admindir/:admin \
		http://astrange.ithinksw.net/~astrange/ranger-fink/kde-admindir/:admin \
		http://www.southofheaven.net/befunk/kde-admindir/:admin
use_bzip2	yes
distname	kdepim-${version}
distfiles	${distname}.tar.bz2:kde \
		${kdeadmin}.tar.bz2:admin
dist_subdir     kde3
depends_build	port:autoconf263 \
		port:unsermake
depends_lib	port:gpgme \
		port:kdeaccessibility3 \
		port:kdebase3 \
		port:libgpg-error \
		port:opensync
#		port:gnokii    isn't detected :-(
#		port:gtk1
#		port:pilot-link
#		port:gpgsm or port:gnupg2

checksums	${distname}.tar.bz2 md5 fc93e458a8eec8131ede56cff30c28b2 \
		${kdeadmin}.tar.bz2 md5 92a60282c1d81f38835ce7d495255cc3

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

patchfiles	kdepim3.patch
patch		{
		foreach f $patchfiles {
		    system "cd ${worksrcpath} && sed -e 's,@FINKPREFIX@,${prefix},g' ${filespath}/${f} | patch -p1"
		}
		system "perl -pi -e 's,-O2,-Os,g; s,doc/HTML,doc/kde,g; s,/usr/share/doc/packages/qt3/html,${prefix}/share/doc/qt3/html,g;' ${worksrcpath}/admin/*"
		system "perl -pi -e 's,#include <malloc.h>,,g' ${worksrcpath}/libkcal/versit/vcc*"
		system "perl -pi -e 's/-Xlinker -framework -Xlinker (\\S*)/-Wl,-framework,\$1/g; s/-framework (\\S*)/-Wl,-framework,\$1/g;' ${worksrcpath}/admin/*"
}
post-patch	{
		reinplace "s|/lib/freetype219||g" ${worksrcpath}/environment-helper.sh
		reinplace "s|--with-ssl-dir=/usr|--with-ssl-dir=\$PREFIX|g" ${worksrcpath}/environment-helper.sh
		reinplace "s|HOME=/tmp|HOME=${workpath}|g" ${worksrcpath}/environment-helper.sh
		reinplace "s|/tmp/buildlog|${workpath}/buildlog|g" ${worksrcpath}/build-helper.sh
		foreach f {CompileScript.sh InstallScript.sh} {
		    copy ${filespath}/${f} ${worksrcpath}
		    reinplace "s|%p|${prefix}|g" ${worksrcpath}/${f}
		    reinplace "s|%N|${name}|g" ${worksrcpath}/${f}
		    reinplace "s|%v|${version}|g" ${worksrcpath}/${f}
		    reinplace "s|%r|${revision}|g" ${worksrcpath}/${f}
		    reinplace "s|%c|${configure.args}|g" ${worksrcpath}/${f}
		    reinplace "s|%d|${destroot}|g" ${worksrcpath}/${f}
		    reinplace "s|%i|${destroot}${prefix}|g" ${worksrcpath}/${f}
		    file attributes ${worksrcpath}/${f} -permissions 0755
		}
}

configure.args	--disable-indexlib --with-distribution='MacPorts/Mac OS X' --without-gnokii --without-arts

use_configure       no

use_parallel_build  yes
build.env           MAKEFLAGS="-j${build.jobs}" AUTOCONF=autoconf263
build.cmd           ./CompileScript.sh

destroot.cmd        ./InstallScript.sh
post-destroot	{
		xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
		xinstall -m 644 -W ${worksrcpath} README README.Kolab README.libical ${destroot}${prefix}/share/doc/${name}
}

livecheck.type	none
