Ticket #32542: auto-compiler-deps.4.diff

File auto-compiler-deps.4.diff, 3.2 KB (added by neverpanic (Clemens Lang), 12 years ago)

4th attempt preventing the change of semantics of depends_lib and depends_build

  • macports1.0/macports.tcl

     
    16171617        error "Error evaluating variants"
    16181618    }
    16191619
     1620    $workername eval port::run_callbacks
     1621
    16201622    ditem_key $mport provides [$workername eval return \$subport]
    16211623
    16221624    return $mport
  • port1.0/port.tcl

     
    3232# standard package load
    3333package provide port 1.0
    3434
     35# Provide a callback registration mechanism for port subpackages. This needs to
     36# be done _before_ loading the subpackages.
     37namespace eval port {}
     38set port::_callback_list [list]
     39
     40# Append a new procedure to a list of callbacks to be called when
     41# port::run_callbacks is called from macports1.0 after evaluating a Portfile
     42proc port::register_callback {callback} {
     43        global port::_callback_list
     44
     45        lappend _callback_list ${callback}
     46}
     47
     48# Run the callbacks registered in the callback list. Called from macports1.0 in
     49# the child interpreter after evaluating the Portfile and the variants. Clears
     50# the list of callbacks.
     51proc port::run_callbacks {} {
     52        global port::_callback_list
     53
     54        ui_debug "Running callbacks..."
     55
     56        foreach callback ${_callback_list} {
     57                ui_debug "Running callback ${callback}"
     58                ${callback}
     59                ui_debug "Finished running callback ${callback}"
     60        }
     61        set _callback_list [list]
     62}
     63
    3564package require mp_package 1.0
    3665package require portmain 1.0
    3766package require portdepends 1.0
  • port1.0/portconfigure.tcl

     
    757757    return $ret
    758758}
    759759
     760# Automatically called from macports1.0 after evaluating the Portfile
     761# Some of the compilers we use are provided by MacPorts itself; ensure we
     762# automatically add a dependency when needed
     763proc portconfigure::add_automatic_compiler_dependencies {} {
     764    global configure.compiler portconfigure::compiler_name_map
     765
     766    # The default value requires substitution before use.
     767    set compiler [subst ${configure.compiler}]
     768    if {![compiler_is_port $compiler]} {
     769        return
     770    }
     771
     772    ui_debug "Chosen compiler ${compiler} is provided by a port, adding dependency"
     773
     774    set compiler_port $compiler_name_map($compiler)
     775    if {[string first "macports-gcc-" $compiler] == 0} {
     776        ui_debug "  Adding depends_lib port:$compiler_port"
     777        depends_lib-append port:$compiler_port
     778    } else {
     779        ui_debug "  Adding depends_build port:$compiler_port"
     780        depends_build-append port:$compiler_port
     781    }
     782
     783    if {[arch_flag_supported $compiler]} {
     784        ui_debug "  Adding depends_skip_archcheck port:$compiler_port"
     785        depends_skip_archcheck-append $compiler_port
     786    }
     787}
     788# Register the above procedure as a callback after Portfile evaluation
     789port::register_callback portconfigure::add_automatic_compiler_dependencies
     790
    760791proc portconfigure::configure_main {args} {
    761792    global [info globals]
    762793    global worksrcpath use_configure use_autoreconf use_autoconf use_automake use_xmkmf