# $Id: Portfile,v 1.6 2005/07/20 23:01:48 mww Exp $

PortSystem 1.0

name			gcc33
version			3.3.6
platforms		darwin
categories		lang
maintainers		mww@opendarwin.org
description		The GNU compiler collection
long_description	The GNU compiler collection, including front ends for C, \
				C++, Objective-C and Fortran 77.

homepage		http://gcc.gnu.org/gcc-3.3/
master_sites    gnu:/gcc/gcc-${version}
set dcore		gcc-core-${version}.tar.bz2
set dg77		gcc-g77-${version}.tar.bz2
set dcxx		gcc-g++-${version}.tar.bz2
set dobjc		gcc-objc-${version}.tar.bz2
distfiles		${dcore} ${dg77} ${dcxx} ${dcxx} ${dobjc}

checksums       ${dcore} md5 18c52e6fb8966b7700665dca289d077f \
				${dg77} md5 3752faab670bcc43b1ad8d5ef9ed8ed2 \
				${dcxx} md5 6b3d00b8d079805be1b895f7f6ce47a0 \
				${dobjc} md5 9af803dc2f7845c5119fa0ec69228b1e

use_bzip2		yes

set major		3.3

worksrcdir		build

post-extract {
	file mkdir ${worksrcpath}
}

configure.cmd	${workpath}/gcc-${version}/configure
configure.args	--enable-languages=c,c++,f77,objc \
				--libdir=${prefix}/lib/gcc-${major} \
				--infodir=${prefix}/share/info \
				--mandir=${prefix}/share/man \
				--with-local-prefix=${prefix} \
				--with-system-zlib \
				--disable-nls \
				--program-suffix=-dp-${major} \
				--with-gxx-include-dir=${prefix}/include/gcc-${major}/c++/

build.target	bootstrap-lean

post-destroot {
	cd ${destroot}${prefix}/share
	file delete -force info man/man7
	foreach manpage {cpp gcov} {
		file rename man/man1/${manpage}.1 man/man1/${manpage}-dp-${major}.1
	}
}

platform darwin 8 {
	configure.env	CC=/usr/bin/gcc-3.3
}

platform darwin 7 {
	depends_build	port:odcctools
	patch {
		reinplace "s|/usr/bin/libtool|${prefix}/bin/odlibtool|g" \
			${workpath}/gcc-${version}/gcc/config/darwin.h
	}
	configure.args-append	--with-as=${prefix}/bin/odas \
							--with-ld=${prefix}/bin/odld \
							--with-ar=${prefix}/bin/odar
}
