# $Id: Portfile 66285 2010-04-08 08:09:09Z jmr@macports.org $

PortSystem 1.0

name			apple-gcc33
version			1823
categories		lang
platforms		darwin
maintainers		nomaintainer
description		Apple's version of gcc 3.3
long_description	Apple's version of the GNU compiler collection, \
			version 3.3. This is a backport for Mac OS X 10.4 on \
			Intel that may produce binaries that cannot be linked \
			against! The installed programs are named \
			gcc-apple-3.3 etc. This include only the C front end.

homepage		http://developer.apple.com/documentation/DeveloperTools/gcc-3.3/gcc/
master_sites		http://www.opensource.apple.com/darwinsource/tarballs/other/
distname		gcc_os-${version}
checksums		sha1 124b58a3e0c62d8b4d23661bc6238089717b4243

patchfiles		patch-gcc-gcc.c patch-expect-Makefile.in

post-extract { file mkdir ${workpath}/build }

set nprefix ${prefix}/lib/${name}

# try to avoid non-Apple programs at all costs (very volatile build)
configure.dir		${workpath}/build
configure.cmd		${worksrcpath}/configure
configure.pre_args	--prefix=${nprefix}
configure.args		--enable-languages=c --program-suffix=-apple-3.3
configure.cflags
configure.ldflags
configure.cppflags
configure.env		PATH="/bin:/usr/bin:/sbin:/usr/sbin"

build.dir		${configure.dir}

pre-destroot {
	reinplace "s|^INSTALL_ROOT.*|INSTALL_ROOT=${destroot}|g" \
		${build.dir}/tcl/unix/Makefile
}

destroot.dir		${build.dir}

post-destroot {
	file delete -force \
		${destroot}${nprefix}/man ${destroot}${nprefix}/info
	system "cd ${destroot}${prefix}/bin && ln -sf ${nprefix}/bin/gcc-apple-3.3 && ln -sf ${nprefix}/bin/cpp-apple-3.3"
}

livecheck.type	moddate
livecheck.url	${master_sites}

pre-fetch {
	if {${os.arch} == "i386"} {
		return -code error "${name} is not supported on Intel Macs!"
	}
}

