Ticket #34666: Portfile-cleanup.diff

File Portfile-cleanup.diff, 3.4 KB (added by lockhart (Thomas Lockhart), 12 years ago)

Patch to clean up the current Portfile. Includes substitution of configure.universal_cxxflags for +universal variant. This latest version uses configure.universal_ldflags for LDFLAGS. Duh.

  • Portfile

    old new  
    33
    44PortSystem          1.0
    55
    6 # Disable the full universal support since ACE already does most of this
    7 # and the extra stuff in muniversal (including making two build trees
    8 # and using libtool to merge libraries) does not work for this case.
    9 # PortGroup           muniversal 1.0
    10 
    116name                ace
    127set name_package    ACE
    138version             6.1.2
    14 revision            1
     9revision            2
    1510distname            ${name_package}-${version}
    1611categories          devel
    1712maintainers         fourpalms.org:lockhart openmaintainer
     
    3732
    3833universal_variant   yes
    3934
    40 variant ssl description {Enable SSL} {
    41         depends_lib port:openssl
    42 }
    43 
    4435use_bzip2           yes
    4536
    4637worksrcdir          ACE_wrappers
     
    6152    11  lion
    6253    12  mountainlion
    6354}
    64 if {"darwin" == ${os.platform}} {
    65     foreach {key value} [array get os.names]  {
    66         if {${key} == ${os.major}} {
    67             set os.name ${value}
    68         }
     55foreach {key value} [array get os.names]  {
     56    if {${key} == ${os.major}} {
     57        set os.name ${value}
    6958    }
    7059}
     60
    7161set libenv          DYLD_LIBRARY_PATH=${worksrcpath}/lib
    7262set aceenv          ACE_ROOT=${worksrcpath}
    7363set makearg         INSTALL_PREFIX=${prefix}
     
    7868        ${worksrcpath}/ace/config.h \
    7969        ${worksrcpath}/include/makeinclude/platform_macros.GNU
    8070    # disable the assignment for compilers in lion and use our environment instead
     71    ui_info "patching platform_macosx_lion.GNU"
    8172    reinplace "s|^\\(CXX:=.*\\)|# \\1|g" \
    8273        ${worksrcpath}/include/makeinclude/platform_macosx_lion.GNU
    8374    reinplace "s|^\\(CC:=.*\\)|# \\1|g" \
    8475        ${worksrcpath}/include/makeinclude/platform_macosx_lion.GNU
     76}
    8577
    86     if {[variant_exists universal] && [variant_isset universal]} {
    87         ui_debug "Enabling a universal build"
     78depends_lib-append  path:bin/perl:perl5
     79
     80proc setuniversalflags {fname cxxflags ldflags} {
     81    set apat "-arch \[ \]*\[a-z\]\[_a-z0-9\]*"
     82    if {[file exists ${fname}]} {
     83        reinplace "s|^\\(\[ \]*FLAGS_C_CC\[ \]*+=\[ \]*\\)${apat}\\(\[ \]*${apat}\\)*|\\1${cxxflags}|g" \
     84            ${fname}
     85        reinplace "s|^\\(\[ \]*LDFLAGS\[ \]*+=\[ \]*\\)${apat}\\(\[ \]*${apat}\\)*|\\1${ldflags}|g" \
     86            ${fname}
     87    } else {
     88        ui_warn "File ${fname} not found for patching"
     89    }
     90}
     91
     92variant universal {
     93    post-patch {
     94        ui_info "patching platform_macros.GNU"
    8895        reinplace "s|buildbits=64|buildbits=universal|g" \
    8996            ${worksrcpath}/include/makeinclude/platform_macros.GNU
    90         # do not set universal=1 which tries i386 and PPC but fails
    91         reinplace "s|universal=0|universal=0|g" \
    92             ${worksrcpath}/include/makeinclude/platform_macros.GNU
     97        setuniversalflags ${worksrcpath}/include/makeinclude/platform_macosx_${os.name}.GNU \
     98            ${configure.universal_cxxflags} ${configure.universal_ldflags}
    9399    }
     100}
    94101
    95     if {[variant_exists ssl] && [variant_isset ssl]} {
    96         ui_debug "Enabling SSL"
     102variant ssl description {Enable SSL} {
     103    depends_lib-append port:openssl
     104
     105    post-patch {
    97106        reinplace "s|ssl=0|ssl=1|g" \
    98107            ${worksrcpath}/include/makeinclude/platform_macros.GNU
    99108    }
    100109}
    101110
    102 depends_lib         path:bin/perl:perl5
    103 
    104111use_configure       no
    105112
    106113use_parallel_build  no