# $Id: Portfile,v 1.2 2006/01/12 18:21:18 mww Exp $

PortSystem 1.0
name            odgcc40
version         4062
description     Development snapshot of Apple's version of GCC 4.0.
long_description Development snapshot of Apple's version of the GNU Compiler \
		Collection. The GNU C, C++, Objective-C and Objective-C++ \
		compilers are included but the Java and Fortran compilers are \
		not. Please note that this is pre-release software, and that \
		it has not been through any quality assurance whatsoever. \
		This compiler may produce binaries that cannot be linked \
		against on Mac OS X 10.3 and Darwin 7. The installed programs \
		are named odgcc-4.0, etc.

platforms       darwin
categories      lang
maintainers     darwinports@opendarwin.org
homepage	http://gcc.gnu.org/gcc-4.0

master_sites	http://www.opendarwin.org/~danchr/distfiles/
checksums	sha1 29029a607232d60359ebb230a5b00f03733edd33
use_bzip2	yes
patchfiles	patch-gcc-version.c patch-build_gcc

depends_build	bin:msgfmt:gettext bin:ginstall:coreutils
depends_lib	path:${prefix}/bin/odlibtool:odcctools

post-patch {
	reinplace "s|/usr/bin/libtool|${prefix}/bin/odlibtool|g" \
       		${worksrcpath}/gcc/config/darwin.h
}

set gcc_archs ppc

configure {
	  file mkdir ${workpath}/sym ${workpath}/obj ${workpath}/dst
}

variant puredarwin {
	 set gcc_archs "${gcc_archs} i386"
}

platform darwin 8 {
	 set gcc_archs "${gcc_archs} ppc64"
}

# Apple's build system installs and compiles in one single step
build.args	RC_OS=macos RC_ARCHS=${gcc_archs} TARGETS=${gcc_archs} \
		SRCROOT=${worksrcpath} DSTROOT=${workpath}/dst \
		SYMROOT=${workpath}/sym OBJROOT=${workpath}/obj \
		PREFIX=${prefix} -w
build.target	install

destroot {
	file delete -force ${destroot}${prefix}
	file copy -force ${workpath}/dst/${prefix} ${destroot}${prefix}
	file delete -force ${destroot}${prefix}/share/man/man7 \
		${destroot}${prefix}/share/info

	foreach bin { cpp gcc gcov g++ } {
		file rename \
			${destroot}${prefix}/bin/${bin}-4.0 \
			${destroot}${prefix}/bin/od${bin}40
		file rename \
			${destroot}${prefix}/share/man/man1/${bin}-4.0.1 \
			${destroot}${prefix}/share/man/man1/od${bin}40.1
	}
}
