# $Id: Portfile,v 1.2 2006/01/07 16:20:06 mww Exp $

PortSystem 1.0

name			gpc34
version			20050331
set gcc_version	3.4.3
categories		lang
platforms		darwin
maintainers		mww@opendarwin.org
description		The GNU Pascal compiler
long_description	${description}

homepage		http://gnu-pascal.de/
master_sites	http://www.gnu-pascal.de/alpha/:gpc \
				gnu:/gcc/gcc-${gcc_version}:gcc
distfiles		gpc-${version}.tar.bz2:gpc \
				gcc-core-${gcc_version}.tar.bz2:gcc
checksums		gpc-20050331.tar.bz2 md5 cdc1460ba7b3cc099d404c5fa1202f8a \
				gcc-core-${gcc_version}.tar.bz2 md5 d2cbfe8fc3205c1d7969b26377405778
use_bzip2		yes

depends_lib		port:libiconv

set bindir		${prefix}/lib/${name}/bin
set major		3.4
worksrcdir		build

post-extract {
	file mkdir ${worksrcpath}
	system "ln -s ${workpath}/p ${workpath}/gcc-${gcc_version}/gcc/p"
}

configure.cmd	${workpath}/gcc-${gcc_version}/configure
configure.args	--enable-languages=pascal \
				--bindir=${bindir} \
				--libdir=${prefix}/lib/${name} \
				--infodir=${prefix}/share/info \
				--mandir=${prefix}/share/man \
				--libexecdir=${prefix}/libexec/${name} \
				--with-system-zlib \
				--disable-nls \
				--with-local-prefix=${prefix} \
				--program-suffix=-dp-${major}

build.target	bootstrap-lean
build.args		STAGE1_CFLAGS="-g -DHAVE_DESIGNATED_INITIALIZERS=0"

post-destroot {
	system "cd ${destroot}${prefix}/bin && ln -sf ${bindir}/gpc-dp-${major} && \
		ln -sf ${bindir}/gpidump-dp-${major}"
	foreach infopage {cpp cppinternals gcc gccinstall gccint} {
		file delete ${destroot}${prefix}/share/info/${infopage}.info
	}
	foreach man1page {cpp gcc gcov} {
		file delete ${destroot}${prefix}/share/man/man1/${man1page}-dp-${major}.1
	}
	file delete -force ${destroot}${prefix}/share/man/man7
}

platform darwin 8 {
	configure.env CC=/usr/bin/gcc-3.3 CPP=/usr/bin/cpp-3.3 CXX=/usr/bin/g++-3.3
}

