call script from Portfile?

Titus von Boxberg titus at v9g.de
Tue Sep 7 14:27:03 PDT 2010


Am 07.09.2010 um 21:43 schrieb Bradley Giesbrecht:

> 
> On Sep 7, 2010, at 12:34 PM, Titus von Boxberg wrote:
> 
>> Am 07.09.2010 um 21:19 schrieb Bradley Giesbrecht:
>> 
>>> 
>>> On Sep 7, 2010, at 8:56 AM, Titus von Boxberg wrote:
>>> 
>>>> Am 01.09.2010 um 08:29 schrieb Ryan Schmidt:
>>>> 
>>>>> 
>>>>> On Sep 1, 2010, at 01:09, Titus von Boxberg wrote:
>>>>> 
>>>>>> Is there a phase when both the port is activated and the build directory
>>>>>> is still in place? Is there a thing like post-activation ?
>>>>> 
>>>>> Yes, you can write a post-activate phase. But that's not the correct place to do the type of fix you're proposing. The correct place is probably the post-build phase. You can look at the oracle-instantclient for a (convoluted) example of calling install_name_tool in a portfile (it does it in the build phase, but you probably have an existing build phase you don't want to overwrite, so you probably want post-build instead).
>>>>> 
>>>> Just to refresh the thread:
>>>> The original question was if and when to call an external script that calls install_name_tool
>>>> which is necessary for wxWidgets-devel.
>>>> 
>>>> I figured that it would be easiest to define a post-install phase.
>>>> Then the already existing script from wxWidgets can be called without modifications.
>>>> That cannot be done in the post-build phase. In this phase I would have to patch
>>>> the script or handcraft the call of install_name_tool like in oracle-instantclient
>>>> which imo would only clutter the Portfile if there is a oneliner at hand.
>>>> 
>>>> Is there a variable that defines the installation directory for the port?
>>>> I.e. the path ${prefix}/var/macports/software/.../${prefix}?
>>>> Or maybe only the ... component? Or at least a variable holding all variants?
>>>> 
>>>> And why would the post-activate phase not be the correct place to call change_install_name?
>>>> Is a port ever used before activation?
>>> 
>>> I'm not sure when but at some point port registers the files installed. If you change the names of files after this point the commands like "port uninstall", "port contents" and "port provides" be adversely effected.
>> I'm not changing the names of the files.
>> port uninstall works well with this type of post-install script.
>> I only do not know how to get the path to the installation directory
>> because one component in it depends on variants selected.
> 
> In which ever phase you want to work you can add some "if [variant_isset myvariant]" logic.
> 
> man portfile
> /variant
Found it. The variable holding all selected variants of the port is ${portvariants}.
It's neither in the guide nor in the manpage.

Still, would be nice to know why not to handle the issue in post-activate commands.

Regards
Titus



More information about the macports-dev mailing list