Ticket #37320: tbb-universal.diff

File tbb-universal.diff, 3.0 KB (added by ryandesign (Ryan Carsten Schmidt), 9 years ago)
  • Portfile

     
    22# $Id$
    33
    44PortSystem          1.0
     5PortGroup           muniversal 1.0
    56
    67name                tbb
    78version             4.3-20150424
     
    3031
    3132use_configure       no
    3233
    33 switch ${build_arch} {
    34     i386 {
    35         set tbb_arch ia32
    36     }
    37     x86_64 {
    38         set tbb_arch intel64
    39     }
    40     ppc {
    41         set tbb_arch ppc32
    42     }
    43     default {
    44         set tbb_arch ${build_arch}
    45     }
     34set tbb_arch(i386)      ia32
     35set tbb_arch(ppc)       ppc32
     36set tbb_arch(x86_64)    intel64
     37if {![info exists tbb_arch(${configure.build_arch})]} {
     38    set tbb_arch(${configure.build_arch}) ${configure.build_arch}
    4639}
    4740
    4841if {[string match *clang* ${configure.compiler}]} {
     
    6558}
    6659
    6760build.target        tbb tbbmalloc tbbproxy
    68 build.args-append   arch=${tbb_arch} \
    69                     compiler=${tbb_compiler} \
     61build.args-append   compiler=${tbb_compiler} \
    7062                    tbb_build_prefix=${tbb_build_prefix} \
    7163                    use_proxy=1
    7264
     
    7668
    7769# The Makefile does not have an install target.
    7870# http://software.intel.com/en-us/forums/topic/347428
    79 destroot.dir        ${worksrcpath}/build/${tbb_build_prefix}_release
    80 destroot {
     71# but the muniversal portgroup requires a destroot.cmd
     72destroot.cmd        true
     73
     74if {[variant_isset universal]} {
     75    foreach arch ${configure.universal_archs} {
     76        set merger_build_args(${arch}) arch=$tbb_arch(${arch})
     77        set merger_test_args(${arch}) arch=$tbb_arch(${arch})
     78    }
     79    merger-post-destroot {
     80        foreach arch ${universal_archs_to_use} {
     81            tbb_destroot ${worksrcpath}-${arch} ${destroot}-${arch}
     82        }
     83    }
     84} else {
     85    build.args-append arch=$tbb_arch(${configure.build_arch})
     86    test.args-append arch=$tbb_arch(${configure.build_arch})
     87    post-destroot {
     88        tbb_destroot ${worksrcpath} ${destroot}
     89    }
     90}
     91
     92proc tbb_destroot {worksrcpath destroot} {
     93    global          destroot.dir prefix tbb_build_prefix
     94    destroot.dir    ${worksrcpath}/build/${tbb_build_prefix}_release
     95
    8196    # fix paths
    82     reinplace "s|\\(TBBROOT.\\)\".*\"|\\1\"${prefix}\"|g" \
    83         ${destroot.dir}/tbbvars.sh ${destroot.dir}/tbbvars.csh
    84     reinplace "s|\\(tbb_bin.\\)\".*\"|\\1\"${prefix}/lib\"|g" \
    85         ${destroot.dir}/tbbvars.sh ${destroot.dir}/tbbvars.csh
     97    reinplace -W ${destroot.dir} "s|\\(TBBROOT.\\)\".*\"|\\1\"${prefix}\"|g" tbbvars.sh tbbvars.csh
     98    reinplace -W ${destroot.dir} "s|\\(tbb_bin.\\)\".*\"|\\1\"${prefix}/lib\"|g" tbbvars.sh tbbvars.csh
    8699
    87100    # copy lib, include & bin
    88101    copy {*}[glob ${destroot.dir}/lib*.dylib] ${destroot}${prefix}/lib
    89102    copy {*}[glob ${destroot.dir}/tbbvars.*sh] ${destroot}${prefix}/bin
    90103    copy ${worksrcpath}/include/tbb ${destroot}${prefix}/include/tbb
     104}
    91105
     106post-destroot {
    92107    # copy examples & docs
    93108    xinstall -d ${destroot}${prefix}/share/${name}
    94109    copy ${worksrcpath}/doc ${destroot}${prefix}/share/${name}/doc