Calling adding a pre-configure or pre-build block via a "pre_XXX function pointer"

René J.V. Bertin rjvbertin at gmail.com
Sun Jul 28 16:28:46 UTC 2024


Hi,

I hope the title is clear enough to attract some answers.

I currently have a some PG code

```
    if {[tbool use_configure]} {
        ui_debug "Doing setup_build in pre-configure"
        set setup_build pre-configure
    } else {
        ui_debug "Doing setup_build in pre-build"
        set setup_build pre-build
    }   
    ${setup_build} {
        # bla
    }
```

that is executed when the PG is read. I would like to move that to a function that also sets the global `use_configure` so I can execute it at an appropriate moment in the Portfile, instead of having to set use_configure before including the PG. Ideally the `setup_build` variable would be namespaced.

I wrote the code that sets the variable, but it is apparently not recognised as a callable procedure.

Stupidly I already reverted the file so I've lost the implementation that I whipped up, but the actual setting of the variable was done exactly as above. I don't understand why it works in an inline implementation as above, but not when done through a function. One doesn't have to declare `pre-configure` or `pre-build` as globals in order to call them from functions, but maybe I should have declared them as such in order to be able to copy them as callable entities?

Thanks,
R.


More information about the macports-dev mailing list