# $Id: Portfile 52266 2009-06-13 12:10:01Z ryandesign@macports.org $

PortSystem 1.0

set major               4.2

name                    llvm-gcc42
version                 2.5
categories              lang
platforms               darwin
maintainers             erickt openmaintainer
description             llvm is a next generation compiler infrastructure
long_description        llvm brings tools to work on the llvm intermediate \
                        language incl. a C and C++ frontend.

homepage                http://llvm.org/
master_sites            http://llvm.org/releases/${version}/

distname                llvm-gcc-${major}-${version}.source

checksums		md5 c5800d85059fcf80429a86c536127595 \
			sha1 5c2f0f1341868d8cdeb2eb4efdf9bf35c63526cb \
			rmd160 6d93b4024e5caa42396f536935800ce1a02423e4

depends_lib             port:llvm

worksrcdir              build

pre-patch {
  file mkdir ${workpath}/build
}

configure.cmd           ../llvm-gcc${major}-${version}.source/configure

configure.args-append   --enable-llvm=${prefix}/lib/llvm/obj \
                        --enable-languages=c,c++,objc,obj-c++ \
												--mandir=${prefix}/share/man \
                        --infodir=${prefix}/share/info \
                        --program-prefix=llvm- \
                        --program-suffix=-${major}

post-destroot {
  file delete -force ${destroot}/${prefix}/share/man/man7
  file delete -force ${destroot}/${prefix}/share/info
  file delete -force ${destroot}/${prefix}/bin/gccld
  file delete -force ${destroot}/${prefix}/bin/gccas
}

platform darwin {
  post-extract {
    system "rm -rf ${workpath}/llvm-gcc${major}-${version}.source/libstdc++-v3"
  }

  configure.args-append  --with-gxx-include-dir=/usr/include/c++/4.0.0
}

platform darwin powerpc {
  set triple powerpc-apple-darwin${os.major}

  configure.env-append TRIPLE=${triple}
  configure.post_args  --build=${triple} --host=${triple} --target=${triple}
}

platform darwin i386 {
  set triple i686-apple-darwin${os.major}

  configure.env-append TRIPLE=${triple} \
                       TARGETOPTIONS="--with-arch=nocona --with-tune=generic"
  configure.post_args  --build=${triple} --host=${triple} --target=${triple}
}

