New Ticket     Tickets     Wiki     Browse Source     Timeline     Roadmap     Ticket Reports     Search

Changeset 80247


Ignore:
Timestamp:
07/07/11 12:54:18 (4 years ago)
Author:
jeremyhu@…
Message:

apple-gcc42: Updated to build the Apple gcc driver-driver (support for -arch XXXX), C++, and gcc_select

Location:
trunk/dports/lang/apple-gcc42
Files:
9 added
1 edited

Legend:

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

    r80126 r80247  
    22 
    33PortSystem 1.0 
     4PortGroup select 1.0 
    45 
    56name                    apple-gcc42 
    67version                 5666.3 
     8revision                1 
    79categories              lang 
    810platforms               darwin 
    9 maintainers             nomaintainer 
     11maintainers             jeremyhu openmaintainer 
    1012description             Apple's version of gcc 4.2 
    1113long_description        Apple's version of the GNU compiler collection, \ 
    12                         version 4.2. Supports C and Objective-C. 
     14                        version 4.2. Supports C, Objective-C, anc C++ 
    1315 
    1416homepage                http://opensource.apple.com/ 
     
    1921                        rmd160  a01d000f89c0e89dd0079dcd202bba7629ba78dc 
    2022 
    21 post-extract { file mkdir ${workpath}/build } 
     23depends_run             port:gcc_select 
    2224 
    23 set nprefix ${prefix}/lib/${name} 
     25use_configure no 
    2426 
    25 # try to avoid non-Apple programs at all costs (rather volatile build) 
    26 configure.dir           ${workpath}/build 
    27 configure.cmd           ${worksrcpath}/configure 
    28 configure.pre_args      --prefix=${nprefix} 
    29 configure.ccache        no 
    30 configure.distcc        no 
    31 # C++ support breaks the build 
    32 configure.args          --enable-languages=c,objc \ 
    33                         --program-suffix=-apple-4.2 
    34 configure.cflags 
    35 configure.ldflags 
    36 configure.cppflags 
    37 configure.cc_archflags 
    38 configure.cxx_archflags 
    39 configure.objc_archflags 
    40 configure.ld_archflags 
    41 configure.env           PATH="/bin:/usr/bin:/sbin:/usr/sbin" 
     27select.group    gcc 
     28select.file     ${filespath}/${name} 
    4229 
    43 build.dir               ${configure.dir} 
     30set srcroot ${worksrcpath} 
     31set objroot ${workpath}/objroot 
     32set symroot ${workpath}/symroot 
    4433 
    45 destroot.dir            ${build.dir} 
     34# system-libstdc++.patch   : Adjust build system to use libstdc++ from / since we don't have it in MacPorts 
     35# no-rm-system.patch       : Comment out a rogue rm /usr/... in the build script 
     36# prefix.patch             : Fix hardcoded instances of /usr 
     37# suffix.patch             : Make binaries end in -apple-4.2 
     38# makeinfo.patch           : Fix version detection for makeinfo in configure scripts 
     39# werror-*.patch           : Fix compilation errors when building for x86_64 
     40patchfiles \ 
     41        system-libstdc++.patch \ 
     42        no-rm-system.patch \ 
     43        prefix.patch \ 
     44        suffix.patch \ 
     45        makeinfo.patch \ 
     46        werror-c-incpath.patch \ 
     47        werror-local-alloc.patch 
    4648 
    47 # STAGE1_CFLAGS="-O2 -fkeep-inline-functions" : from configure.ac 
    48 # BOOT_CFLAGS="-O2 -g" : from Makefile.tpl 
    49 # -std=gnu89 : for building with compilers that default to c99 (clang) 
    50 # -D_FORTIFY_SOURCE=0 : The built compiler might not understand newer builtins 
    51 #                       exposed in libc headers for fortified string functions. 
    52 #                       Yes, we need to set both BOOT_CFLAGS and STAGE1_CFLAGS 
    53 #                       because STAGE1_CFLAGS is used with xgcc for libgcc 
    54 build.args-append BOOT_CFLAGS="-O2 -g -D_FORTIFY_SOURCE=0" STAGE1_CFLAGS="-O2 -fkeep-inline-functions -D_FORTIFY_SOURCE=0 -std=gnu89" 
     49post-patch { 
     50        # Install documentation in a MacPorts location 
     51        reinplace "/^HTMLDIR=/ s:=.*$:=\"${prefix}/share/doc/${name}/html\":" ${worksrcpath}/build_gcc 
    5552 
    56 post-destroot { 
    57         file delete -force \ 
    58                 ${destroot}${nprefix}/man ${destroot}${nprefix}/info 
    59         system "cd ${destroot}${prefix}/bin && ln -sf ${nprefix}/bin/gcc-apple-4.2 && ln -sf ${nprefix}/bin/cpp-apple-4.2" 
     53        # arch returns i386 even when we want x86_64 
     54        reinplace "/^BUILD=/ s:arch:echo ${build_arch}:" ${worksrcpath}/build_gcc 
     55 
     56        # Use our CC 
     57        # TODO: This seems insufficient as "gcc" is still being used 
     58        reinplace "/^unset CC/ s:^:#:" ${worksrcpath}/build_gcc 
     59 
     60        # ppc not tested, but it should hopefully work... 
     61        if {${build_arch} == "ppc"} { 
     62                reinplace "/^PPC_SYSROOT=/ s:=.*$:=/:" ${worksrcpath}/build_gcc 
     63        } elseif {[file exists ${developer_dir}/SDKs/MacOSX10.5.sdk]} { 
     64                reinplace "/^PPC_SYSROOT=/ s:=.*$:=${developer_dir}/SDKs/MacOSX10.5.sdk:" ${worksrcpath}/build_gcc 
     65        } elseif {[file exists ${developer_dir}/SDKs/MacOSX10.4u.sdk]} { 
     66                reinplace "/^PPC_SYSROOT=/ s:=.*$:=${developer_dir}/SDKs/MacOSX10.4u.sdk:" ${worksrcpath}/build_gcc 
     67        } elseif {[file exists ${developer_dir}/SDKs/MacOSX10.3.9.sdk]} { 
     68                reinplace "/^PPC_SYSROOT=/ s:=.*$:=${developer_dir}/SDKs/MacOSX10.3.9.sdk:" ${worksrcpath}/build_gcc 
     69        } 
    6070} 
     71 
     72# TODO: Use MacPorts dependencies 
     73build.env \ 
     74        CC="${configure.cc}" \ 
     75        LIBRARY_PATH="/usr/lib" \ 
     76        CPATH="/usr/include" \ 
     77        PATH="/bin:/usr/bin:/sbin:/usr/sbin" 
     78 
     79#       MAKEINFO=${prefix}/bin/makeinfo 
     80 
     81build.args-append \ 
     82        PREFIX="${prefix}" \ 
     83        SRCROOT="${srcroot}" \ 
     84        OBJROOT="${objroot}" \ 
     85        SYMROOT="${symroot}" \ 
     86        DSTROOT="${destroot}" \ 
     87        RC_NONARCH_CFLAGS="-pipe -std=gnu89" \ 
     88        RC_OS="macos" 
     89 
     90if {[variant_isset universal]} { 
     91        build.args-append \ 
     92                RC_ARCHS="${universal_archs}" 
     93} else { 
     94        build.args-append \ 
     95                RC_ARCHS="${build_arch}" 
     96} 
     97 
     98set build_targets {i386} 
     99 
     100if {[file exists ${developer_dir}/SDKs/MacOSX10.3.9.sdk] || 
     101    [file exists ${developer_dir}/SDKs/MacOSX10.4u.sdk] || 
     102    [file exists ${developer_dir}/SDKs/MacOSX10.5.sdk] || 
     103    ${build_arch} == "ppc"} { 
     104        lappend build_targets ppc 
     105} 
     106 
     107# TODO: arm? 
     108 
     109build.args-append \ 
     110        TARGETS="${build_targets}" 
     111 
     112# Yes, use "install" ... the build system does make/install in one go 
     113# TODO: split the build_gcc script into two to better match MacPorts 
     114build.target install 
     115destroot {} 
    61116 
    62117livecheck.type          regex 
Note: See TracChangeset for help on using the changeset viewer.