New Ticket     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Changeset 93184

Show
Ignore:
Timestamp:
05/17/2012 00:04:46 (less than one hour ago)
Author:
jeremyhu@…
Message:

apple-gcc42: Use MacPorts cctools and ld64 (with a bootstrap variant for Tiger)

Location:
trunk/dports/lang/apple-gcc42
Files:
1 removed
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/dports/lang/apple-gcc42/Portfile

    r93183 r93184  
    77version                 5666.3 
    88set gcc_version         4.2.1 
    9 revision                5 
     9revision                6 
    1010categories              lang 
    1111platforms               darwin 
     
    4949#+  --with-gmp=$DEST_ROOT \ 
    5050#+  --with-mpfr=$DEST_ROOT \ 
    51 #depends_lib             port:gmp port:mpfr port:libiconv 
    52  
    53 depends_run             port:gcc_select 
     51#depends_lib             port:gmp port:mpfr 
     52 
     53#depends_lib             port:libiconv 
     54depends_run             port:gcc_select port:ld64 port:cctools 
     55depends_skip_archcheck-append gcc_select ld64 cctools 
    5456 
    5557use_configure no 
     
    7072set symroot ${workpath}/symroot 
    7173 
    72 # makeinfo.patch                 : Fix version detection for makeinfo in configure scripts 
    7374# werror-*.patch                 : Fix compilation errors when building for x86_64 
    7475# incpath.patch                  : Don't prepend the -isysroot option argument to the compiler's own search paths 
     
    7778 
    7879patchfiles \ 
    79         makeinfo.patch \ 
    8080        werror-c-incpath.patch \ 
    8181        werror-local-alloc.patch \ 
     
    100100 
    101101post-extract { 
    102         file copy -force ${filespath}/build_gcc ${worksrcpath} 
     102    file copy -force ${filespath}/build_gcc ${worksrcpath} 
    103103} 
    104104 
    105105post-patch { 
    106         # Install documentation in a MacPorts location 
    107         reinplace "/^HTMLDIR=/ s:=.*$:=\"${prefix}/share/doc/${name}/html\":" ${worksrcpath}/build_gcc 
    108  
    109         # arch returns i386 even when we want x86_64 
    110         reinplace "/^BUILD=/ s:arch:echo ${build_arch}:" ${worksrcpath}/build_gcc 
    111  
    112         # This is set to isysroot/Developer/SDKs/MacOSX10.5.sdk mmacosx-version-min=10.5 
    113         # which is not always right.  Our CFLAGS should take care of this instead 
    114         reinplace "/^MULTILIB_EXTRA_OPTS/d" ${worksrcpath}/gcc/config/rs6000/t-darwin 
    115  
    116         if {${build_arch} == "ppc"} { 
    117                 reinplace "/^PPC_SYSROOT=/ s:=.*$:=/:" ${worksrcpath}/build_gcc 
    118         } elseif {[file exists ${developer_dir}/SDKs/MacOSX10.5.sdk]} { 
    119                 reinplace "/^PPC_SYSROOT=/ s:=.*$:=${developer_dir}/SDKs/MacOSX10.5.sdk:" ${worksrcpath}/build_gcc 
    120         } elseif {[file exists ${developer_dir}/SDKs/MacOSX10.4u.sdk]} { 
    121                 reinplace "/^PPC_SYSROOT=/ s:=.*$:=${developer_dir}/SDKs/MacOSX10.4u.sdk:" ${worksrcpath}/build_gcc 
    122         } elseif {[file exists ${developer_dir}/SDKs/MacOSX10.3.9.sdk]} { 
    123                 reinplace "/^PPC_SYSROOT=/ s:=.*$:=${developer_dir}/SDKs/MacOSX10.3.9.sdk:" ${worksrcpath}/build_gcc 
    124         } 
    125  
    126         if {${os.major} < 9} { 
    127             reinplace "/vproc.h/d" ${worksrcpath}/gcc/libgcov.c 
     106    # Install documentation in a MacPorts location 
     107    #reinplace "/^HTMLDIR=/ s:=.*$:=\"${prefix}/share/doc/${name}/html\":" ${worksrcpath}/build_gcc 
     108 
     109    # arch returns i386 even when we want x86_64 
     110    reinplace "/^BUILD=/ s:arch:echo ${build_arch}:" ${worksrcpath}/build_gcc 
     111 
     112    # This is set to isysroot/Developer/SDKs/MacOSX10.5.sdk mmacosx-version-min=10.5 
     113    # which is not always right.  Our CFLAGS should take care of this instead 
     114    reinplace "/^MULTILIB_EXTRA_OPTS/d" ${worksrcpath}/gcc/config/rs6000/t-darwin 
     115 
     116    # Brand our compiler 
     117    reinplace "/VERSUFFIX/s/)\"/) (MacPorts ${name} ${version}_${revision}${portvariants})\"/" \ 
     118        ${worksrcpath}/gcc/version.c 
     119    reinplace "/bug_report_url/s|http:.*>|https://trac.macports.org/newticket>|" \ 
     120        ${worksrcpath}/gcc/version.c 
     121 
     122    if {${build_arch} == "ppc"} { 
     123        reinplace "/^PPC_SYSROOT=/ s:=.*$:=/:" ${worksrcpath}/build_gcc 
     124    } elseif {[file exists ${developer_dir}/SDKs/MacOSX10.5.sdk]} { 
     125        reinplace "/^PPC_SYSROOT=/ s:=.*$:=${developer_dir}/SDKs/MacOSX10.5.sdk:" ${worksrcpath}/build_gcc 
     126    } elseif {[file exists ${developer_dir}/SDKs/MacOSX10.4u.sdk]} { 
     127        reinplace "/^PPC_SYSROOT=/ s:=.*$:=${developer_dir}/SDKs/MacOSX10.4u.sdk:" ${worksrcpath}/build_gcc 
     128    } elseif {[file exists ${developer_dir}/SDKs/MacOSX10.3.9.sdk]} { 
     129        reinplace "/^PPC_SYSROOT=/ s:=.*$:=${developer_dir}/SDKs/MacOSX10.3.9.sdk:" ${worksrcpath}/build_gcc 
     130    } 
     131 
     132    if {${os.major} < 9} { 
     133        reinplace "/vproc.h/d" ${worksrcpath}/gcc/libgcov.c 
     134    } 
     135 
     136    # Disable -Werror for our bootstrap gcc 
     137    if {[string match "*clang*" ${configure.compiler}]} { 
     138        reinplace "s:--enable-werror : :" ${worksrcpath}/build_gcc 
     139    } 
     140} 
     141 
     142compiler.cpath 
     143 
     144# TODO: Better use of MacPorts dependencies 
     145build.env \ 
     146    LANGUAGES="c,c++,objc,obj-c++" \ 
     147    LIBRARY_PATH="/usr/lib" \ 
     148    CPATH="/usr/include" \ 
     149    PATH="/bin:/usr/bin:/sbin:/usr/sbin" \ 
     150    LANGUAGES="c,c++,objc,obj-c++" \ 
     151    AR_FOR_TARGET=${prefix}/bin/ar \ 
     152    AS_FOR_TARGET=${prefix}/bin/as \ 
     153    LD_FOR_TARGET=${prefix}/bin/ld \ 
     154    NM_FOR_TARGET=${prefix}/bin/nm \ 
     155    OBJDUMP_FOR_TARGET=${prefix}/bin/objdump \ 
     156    RANLIB_FOR_TARGET=${prefix}/bin/ranlib \ 
     157    STRIP_FOR_TARGET=${prefix}/bin/strip \ 
     158    OTOOL=${prefix}/bin/otool \ 
     159    OTOOL64=${prefix}/bin/otool 
     160 
     161build.args-append \ 
     162    CC="${configure.cc} -std=gnu89" \ 
     163    PREFIX="${prefix}" \ 
     164    SRCROOT="${srcroot}" \ 
     165    OBJROOT="${objroot}" \ 
     166    SYMROOT="${symroot}" \ 
     167    DSTROOT="${destroot}" \ 
     168    RC_NONARCH_CFLAGS="-pipe -std=gnu89" \ 
     169    RC_OS="macos" \ 
     170    RC_ARCHS="[get_canonical_archs]" 
     171 
     172# On Tiger, we need apple-gcc42 to build llvm, which is needed for cctools 
     173variant bootstrap description {Variant to break a dependency cycle on Tiger by first building an apple-gcc42 using host ld and cctools} { 
     174#    depends_lib-delete      port:libiconv 
     175    depends_run-delete      port:ld64 port:cctools 
     176 
     177    build.env \ 
     178        LIBRARY_PATH="/usr/lib" \ 
     179        CPATH="/usr/include" \ 
     180        PATH="/bin:/usr/bin:/sbin:/usr/sbin" \ 
     181        LANGUAGES="c,c++,objc,obj-c++" 
     182 
     183    pre-fetch { 
     184        if {([file exists ${prefix}/bin/ld] && [file exists ${prefix}/bin/as]) || ${os.major} > 8} { 
     185            ui_error "Please install this port without the bootstrap variant." 
     186            error "Please install this port without the bootstrap variant." 
    128187        } 
    129  
    130         # Disable -Werror for our bootstrap gcc 
    131         if {${configure.compiler} == "clang" || 
    132             ${configure.compiler} == "macports-clang"} { 
    133                 reinplace "s:--enable-werror : :" ${worksrcpath}/build_gcc 
    134         } 
    135 } 
    136  
    137 compiler.cpath 
    138  
    139 # TODO: Use MacPorts dependencies 
    140 build.env \ 
    141         LIBRARY_PATH="/usr/lib" \ 
    142         CPATH="/usr/include" \ 
    143         PATH="/bin:/usr/bin:/sbin:/usr/sbin" \ 
    144         LANGUAGES="c,c++,objc,obj-c++" 
    145  
    146 #       MAKEINFO=${prefix}/bin/makeinfo 
    147  
    148 build.args-append \ 
    149         CC="${configure.cc} -std=gnu89" \ 
    150         PREFIX="${prefix}" \ 
    151         SRCROOT="${srcroot}" \ 
    152         OBJROOT="${objroot}" \ 
    153         SYMROOT="${symroot}" \ 
    154         DSTROOT="${destroot}" \ 
    155         RC_NONARCH_CFLAGS="-pipe -std=gnu89" \ 
    156         RC_OS="macos" \ 
    157         RC_ARCHS="[get_canonical_archs]" 
     188    } 
     189} 
     190 
     191platform darwin 8 { 
     192    if {![file exists ${prefix}/bin/gcc-apple-4.2] && 
     193        (![file exists ${prefix}/bin/ld] || ![file exists ${prefix}/bin/as])} { 
     194        default_variants +bootstrap 
     195    } 
     196} 
    158197 
    159198set build_targets {} 
     
    176215 
    177216build.args-append \ 
    178         TARGETS="${build_targets}" 
     217    TARGETS="${build_targets}" 
    179218 
    180219# Yes, use "install" ... the build system does make/install in one go 
  • trunk/dports/lang/apple-gcc42/files/build_gcc

    r92393 r93184  
    244244unset RC_DEBUG_OPTIONS 
    245245make $MAKEFLAGS CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1 
    246 make $MAKEFLAGS html CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1 
     246# The version check for makeinfo is broken in all the configure scripts, 
     247# and building documentation which is already available online isn't worth 
     248# the effort in fixing it 
     249#make $MAKEFLAGS html CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1 
    247250make $MAKEFLAGS DESTDIR=$DIR/dst-$BUILD-$BUILD install-gcc install-target \ 
    248251  CFLAGS="$CFLAGS" CXXFLAGS="$CFLAGS" || exit 1 
     
    424427 
    425428# HTML documentation 
    426 HTMLDIR="/Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.DeveloperTools.docset/Contents/Resources/Documents/documentation/DeveloperTools" 
    427 mkdir -p ".$HTMLDIR" || exit 1 
    428 cp -Rp $DIR/obj-$BUILD-$BUILD/gcc/HTML/* ".$HTMLDIR/" || exit 1 
     429#HTMLDIR="/Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.DeveloperTools.docset/Contents/Resources/Documents/documentation/DeveloperTools" 
     430#mkdir -p ".$HTMLDIR" || exit 1 
     431#cp -Rp $DIR/obj-$BUILD-$BUILD/gcc/HTML/* ".$HTMLDIR/" || exit 1 
    429432 
    430433# Manual pages