# $Id: Portfile,v 1.6 2005/09/13 06:57:50 olegb Exp $
PortSystem 1.0
name		freetype1
version		1.3.1
revision	3
categories	print
maintainers	darwinports@opendarwin.org
description	Free and portable render engine for TrueType fonts
long_description	The FreeType engine is a free and portable TrueType \
			font rendering engine. It has been developed to \
			provide TT support to a great variety of platforms \
			and environments. Notice that FreeType is a *library*. \
			It is *not* a font server for your preferred environment, \
			even though it was designed to allow the design of \
			many font servers.  
platforms	darwin
distname	freetype-${version}
master_sites	sourceforge:freetype
checksums	md5 9a9e7ad00c1ef6dfbf8f8e19ceefb300
platform darwin {
	pre-configure 	{ 
		file copy -force /usr/share/libtool/config.sub ${worksrcpath} 
		file copy -force /usr/share/libtool/config.guess ${worksrcpath} 
		reinplace "s|all: ttlib tttest ttpo|all: ttlib ttpo|g" \
			${worksrcpath}/Makefile.in
	}
}

depends_lib	bin:msgfmt:gettext
patchfiles	patch-contrib-ttfbanner-ttfbanner.c \
			patch-contrib-ttf2pfb-ttf2pfb.c

configure.args	--mandir=${prefix}/share/man --prefix=${destroot}${prefix}
post-build {
	# configure & build in contrib/*
	foreach package {ttf2bdf ttf2pfb ttf2pk ttfbanner} {
		system "cd ${worksrcpath}/contrib/$package && \
			${configure.cmd} --mandir=${destroot}${prefix}/share/man --prefix=${destroot}${prefix} --without-kpathsea-dir"
		system "cd ${worksrcpath}/contrib/$package && \
			${build.cmd} ${build.pre_args}"
	}
}

destroot 	{
			system "cd ${worksrcpath}/lib \
			&& make -f arch/unix/Makefile install"

			system "cd ${worksrcpath}/po \
                        && make install"

			foreach package {ttf2bdf ttf2pfb ttf2pk ttfbanner} {
				system "cd ${worksrcpath}/contrib/${package} \
                        && make install"
			}
		}
post-destroot	{
			system "cd ${destroot}/${prefix} \
			&& mv include/freetype include/freetype1"
			# remove ttf2pfb's getafm, as it conflicts with psutils'
			file delete "${destroot}/${prefix}/bin/getafm"
			# remove ttf2pfb's t1asm, as it conflicts with t1utils'
			file delete "${destroot}/${prefix}/bin/t1asm"
		}
variant x86		{
	patchfiles-append	patch-configure
		}
