merger_(configure|build)_args and related tricks for universal?

Bayard Bell buffer.g.overflow at googlemail.com
Fri Mar 11 10:53:44 PST 2011


I've noticed this trick used in various ports (spidermonkey, libiconv, openssl) to allow variation between the arches used in a universal build, seemingly by building a hash/dict/associative array/don't-know-the-problem-term-for-Tcl of arch-specific settings that are set/appended/whatever and then sourced as the arches are iterated through. To use lang/xercesc as an example:

proc bits_arg_for_arch {arch} {
        switch ${arch} {
                x86_64  -
                ppc64   { return {-b 64} }
                i386    -
                ppc     { return {-b 32} }
        }
}

if {[variant_isset universal]} {
        foreach arch {x86_64 ppc64 i386 ppc} {
                set merger_configure_args(${arch}) [bits_arg_for_arch ${arch}]
        }
} else {
        configure.args-append [bits_arg_for_arch ${configure.build_arch}]
}

Maybe a little easier to read, at least for an untutored eye such as mine, would be math/arpack:

if { ! [variant_isset universal]} {
        build.args-append home=${worksrcpath}
        if { ${build_arch}=="x86_64" || ${build_arch}=="ppc64" } {
                build.args-append FFLAGS='-O2 -m64'
        } else {
                build.args-append FFLAGS='-O2 -m32'
        }
} else {
        foreach arch {x86_64 i386 ppc ppc64} {
                set merger_build_args(${arch}) home=${worksrcpath}-${arch}
                if { ${arch}=="x86_64" || ${arch}=="ppc64" } {
                        lappend merger_build_args(${arch}) FFLAGS='-O2 -m64'
                } else {
                        lappend merger_build_args(${arch}) FFLAGS='-O2 -m32'
                }
        }

}

I was trying to use these to fix an upstream dependency for a Python module I was trying to port, but I haven't been able either to get it to work as I might intuit (no evidence of arguments being merged in adapting from the latter example with minor changes) or to find any documentation to explain how it's supposed to work. I don't know Tcl at all, which isn't nearly well enough to work out the mechanics quickly from the source, so I thought I'd ask here. Happy to write up a HOWTO for posterity if someone can smack me with a clue stick.

Cheers,
Bayard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 1515 bytes
Desc: not available
URL: <http://lists.macosforge.org/pipermail/macports-users/attachments/20110311/dc4e1184/attachment.bin>


More information about the macports-users mailing list