# $Id: Portfile 102576 2013-02-04 22:58:48Z jeremyhu@macports.org $ PortSystem 1.0 PortGroup select 1.0 name llvm-gcc42 version 2336.11 revision 1 set gcc_version 4.2.1 categories lang platforms darwin license GPL-2+ maintainers erickt jeremyhu description llvm-gcc42 is a gcc compiler frontend for llvm long_description llvm-gcc42 integrates the LLVM optimizers and code \ generator with the GCC 4.2 parser. This allows LLVM to \ compile languages supported by the GCC compiler \ frontends, and provides high-fidelity drop-in \ compatibility with version 4.2 of GCC. homepage http://opensource.apple.com/ master_sites http://opensource.apple.com/tarballs/llvmgcc42/ distname llvmgcc42-${version} checksums md5 046629f7b3ce59bcb32b5116d29c27cd \ sha1 97b82b328780d1b4f261301dc084bb256172ee2a \ rmd160 90e496dc075ebd3daa088f818e52e7ecbb4a182e depends_lib port:ld64 port:cctools depends_run port:gcc_select depends_skip_archcheck ld64 cctools use_configure no variant universal {} supported_archs i386 x86_64 select.group gcc select.file ${filespath}/mp-llvm-gcc42 set srcroot ${worksrcpath} set objroot ${workpath}/objroot set symroot ${workpath}/symroot # werror-*.patch : Fix compilation errors when building for x86_64 # incpath.patch : Don't prepend the -isysroot option argument to the compiler's own search paths # driverdriver-num_infiles.patch : Fix linking with no input files (ie all static archives passed with -l...) # driverdriver-armcheck.patch : Build fix for the driverdriver when arm support is not available (eg: Tiger) patchfiles-append \ werror-local-alloc.patch \ incpath.patch \ driverdriver-num_infiles.patch \ driverdriver-armcheck.patch post-extract { file copy -force ${filespath}/build_gcc ${worksrcpath} } post-patch { # Install documentation in a MacPorts location #reinplace "/^HTMLDIR=/ s:=.*$:=\"${prefix}/share/doc/${name}/html\":" ${worksrcpath}/build_gcc # arch returns i386 even when we want x86_64 reinplace "/^BUILD=/ s:arch:echo ${build_arch}:" ${worksrcpath}/build_gcc # This is set to isysroot/Developer/SDKs/MacOSX10.5.sdk mmacosx-version-min=10.5 # which is not always right. Our CFLAGS should take care of this instead reinplace "/^MULTILIB_EXTRA_OPTS/d" ${worksrcpath}/gcc/config/rs6000/t-darwin # Brand our compiler reinplace "/VERSUFFIX/s/)\"/) (MacPorts ${name} ${version}_${revision}${portvariants})\"/" \ ${worksrcpath}/gcc/version.c reinplace "/bug_report_url/s|http:.*>|https://trac.macports.org/newticket>|" \ ${worksrcpath}/gcc/version.c # Don't use the DEVELOPER_DIR variable reinplace "s/DEVELOPER_DIR/MP_DEVELOPER_DIR/g" \ ${worksrcpath}/GNUmakefile \ ${worksrcpath}/llvmCore/utils/buildit/build_llvm if {${build_arch} == "ppc"} { reinplace "/^PPC_SYSROOT=/ s:=.*$:=/:" ${worksrcpath}/build_gcc } elseif {[file exists ${developer_dir}/SDKs/MacOSX10.5.sdk]} { reinplace "/^PPC_SYSROOT=/ s:=.*$:=${developer_dir}/SDKs/MacOSX10.5.sdk:" ${worksrcpath}/build_gcc } elseif {[file exists ${developer_dir}/SDKs/MacOSX10.4u.sdk]} { reinplace "/^PPC_SYSROOT=/ s:=.*$:=${developer_dir}/SDKs/MacOSX10.4u.sdk:" ${worksrcpath}/build_gcc } elseif {[file exists ${developer_dir}/SDKs/MacOSX10.3.9.sdk]} { reinplace "/^PPC_SYSROOT=/ s:=.*$:=${developer_dir}/SDKs/MacOSX10.3.9.sdk:" ${worksrcpath}/build_gcc } if {${os.major} < 9} { reinplace "/vproc.h/d" ${worksrcpath}/gcc/libgcov.c } # Disable -Werror for our bootstrap gcc if {[string match "*clang*" ${configure.compiler}]} { reinplace "s:--enable-werror : :" ${worksrcpath}/build_gcc } } compiler.cpath /usr/include compiler.library_path /usr/lib # TODO: Better use of MacPorts dependencies build.env \ LIBRARY_PATH="/usr/lib" \ CPATH="/usr/include" \ PATH="/bin:/usr/bin:/sbin:/usr/sbin" \ LANGUAGES="c,c++,objc,obj-c++" \ AR_FOR_TARGET=${prefix}/bin/ar \ AS_FOR_TARGET=${prefix}/bin/as \ LD_FOR_TARGET=${prefix}/bin/ld \ NM_FOR_TARGET=${prefix}/bin/nm \ OBJDUMP_FOR_TARGET=${prefix}/bin/objdump \ RANLIB_FOR_TARGET=${prefix}/bin/ranlib \ STRIP_FOR_TARGET=${prefix}/bin/strip \ DSYMUTIL_FOR_HOST=${prefix}/bin/dsymutil \ RANLIB_FOR_HOST=${prefix}/bin/ranlib \ STRIP_FOR_HOST=${prefix}/bin/strip \ OTOOL=${prefix}/bin/otool \ OTOOL64=${prefix}/bin/otool build.args-append \ CC="${configure.cc} -pipe -std=gnu89" \ CXX="${configure.cxx} -pipe" \ PREFIX="${prefix}" \ SRCROOT="${srcroot}" \ OBJROOT="${objroot}" \ SYMROOT="${symroot}" \ DSTROOT="${destroot}" \ RC_NONARCH_CFLAGS="-pipe -std=gnu89" \ RC_OS="macos" \ RC_ARCHS="[get_canonical_archs]" \ RC_ProjectSourceVersion="[lindex [split ${version} .] 0]" \ RC_ProjectSourceSubversion="[lindex [split ${version} .] 1]" if {[string match "*clang*" ${configure.compiler}]} { # Build fails using libc++ build.args-delete \ CXX="${configure.cxx} -pipe" build.args-append \ CXX="${configure.cxx} -pipe -stdlib=libstdc++" } set build_targets {} if {${os.major} > 8 || ${os.arch} == "i386"} { lappend build_targets i386 } # Support for PPC was dropped in Darwin 11 (Mac OS X 10.7) #if {${os.major} < 11} { # if {[file exists ${developer_dir}/SDKs/MacOSX10.3.9.sdk] || # [file exists ${developer_dir}/SDKs/MacOSX10.4u.sdk] || # [file exists ${developer_dir}/SDKs/MacOSX10.5.sdk] || # ${build_arch} == "ppc"} { # lappend build_targets ppc # } #} if {${os.major} < 11 && ${build_arch} == "ppc"} { lappend build_targets ppc } build.args-append \ TARGETS="${build_targets}" # Yes, use "install" ... the build system does make/install in one go # TODO: split the build_gcc script into two to better match MacPorts build.target install destroot {} post-destroot { if {[string match "*i386*" ${build_targets}]} { delete ${destroot}${prefix}/libexec/${name}/gcc/i686-apple-darwin${os.major}/${gcc_version}/as ln -s ../../../../../bin/as ${destroot}${prefix}/libexec/${name}/gcc/i686-apple-darwin${os.major}/${gcc_version}/as delete ${destroot}${prefix}/libexec/${name}/gcc/i686-apple-darwin${os.major}/${gcc_version}/ld ln -s ../../../../../bin/ld ${destroot}${prefix}/libexec/${name}/gcc/i686-apple-darwin${os.major}/${gcc_version}/ld delete ${destroot}${prefix}/libexec/${name}/gcc/i686-apple-darwin${os.major}/${gcc_version}/dsymutil # http://trac.macports.org/ticket/35770 delete ${destroot}${prefix}/lib/${name}/gcc/i686-apple-darwin${os.major}/${gcc_version}/libstdc++.dylib ln -s /usr/lib/libstdc++.6.dylib ${destroot}${prefix}/lib/${name}/gcc/i686-apple-darwin${os.major}/${gcc_version}/libstdc++.dylib } if {[string match "*ppc*" ${build_targets}]} { delete ${destroot}${prefix}/libexec/${name}/gcc/powerpc-apple-darwin${os.major}/${gcc_version}/as ln -s ../../../../../bin/as ${destroot}${prefix}/libexec/${name}/gcc/powerpc-apple-darwin${os.major}/${gcc_version}/as delete ${destroot}${prefix}/libexec/${name}/gcc/powerpc-apple-darwin${os.major}/${gcc_version}/ld ln -s ../../../../../bin/ld ${destroot}${prefix}/libexec/${name}/gcc/powerpc-apple-darwin${os.major}/${gcc_version}/ld delete ${destroot}${prefix}/libexec/${name}/gcc/powerpc-apple-darwin${os.major}/${gcc_version}/dsymutil # http://trac.macports.org/ticket/35770 delete ${destroot}${prefix}/lib/${name}/gcc/powerpc-apple-darwin${os.major}/${gcc_version}/libstdc++.dylib ln -s /usr/lib/libstdc++.6.dylib ${destroot}${prefix}/lib/${name}/gcc/powerpc-apple-darwin${os.major}/${gcc_version}/libstdc++.dylib } } livecheck.type regex livecheck.url [lindex ${master_sites} 0] livecheck.regex llvmgcc42-(\\d+(?:\\.\\d+)*)\\.tar