tcl or portfile keyword for alias

Ryan Schmidt ryandesign at macports.org
Tue Feb 10 15:07:39 PST 2009


On Feb 10, 2009, at 11:59, Bradley Giesbrecht wrote:

>
> On Feb 9, 2009, at 9:57 PM, Ryan Schmidt wrote:
>
>>
>> On Feb 9, 2009, at 22:52, Bradley Giesbrecht wrote:
>>
>>> On Feb 9, 2009, at 8:41 PM, Ryan Schmidt wrote:
>>>
>>>> On Feb 9, 2009, at 22:34, Bradley Giesbrecht wrote:
>>>>
>>>>> On Feb 9, 2009, at 4:18 PM, Ryan Schmidt wrote:
>>>>>
>>>>>> On Feb 9, 2009, at 17:53, Ryan Schmidt wrote:
>>>>>>
>>>>>>> You could prepend ${prefix}/lib/mysql5/bin to the PATH.  
>>>>>>> That's where the program "mysql_config" lives.
>>>>>>>
>>>>>>> configure.env-append    PATH=${prefix}/lib/mysql5/bin:$env(PATH)
>>>>>>
>>>>>> The reason it then still doesn't work is because libzdb is  
>>>>>> calling mysql_config incorrectly. As you note, it uses  
>>>>>> "mysql_config --libs $LDFLAGS". It is not correct to put  
>>>>>> "$LDFLAGS" at the end of that command invocation. The correct  
>>>>>> way to call it is just "mysql_config --libs". It works for you  
>>>>>> on the command line because LDFLAGS is empty by default, but  
>>>>>> MacPorts fills it with a value, so when run within MacPorts,  
>>>>>> it fails. If you look in the config.log, you see that  
>>>>>> mysql_config is printing its usage message, showing that the  
>>>>>> way it is being used is not correct. Attached is a Portfile  
>>>>>> and patch that work for me. You should send the patchfile to  
>>>>>> the author of libzdb.
>>>>>>
>>>>>> In the Portfile, I also added a dependency on mysql5, and  
>>>>>> added configure arguments to disable postgresql and sqlite. If  
>>>>>> you want to enable postgresql or sqlite, remove the  
>>>>>> corresponding configure argument and add the required dependency.
>>>>>
>>>>> I had a more complex Portfile which I trimmed down before  
>>>>> posting to make it simple to try.
>>>>>
>>>>> I guess I'm old school that way.
>>>>>
>>>>> The patch Portfile attached to your email removed the patch  
>>>>> file. I like it but it didn't work.
>>>>> If I add the patch and remove the $LDFLAGS in the patch  
>>>>> "mysql_config --libs $LDFLAGS" to "mysql_config --libs" it works.
>>>>
>>>> But... the Portfile I attached said
>>>>
>>>> patchfiles                  patch-configure
>>>>
>>>> And I attached my revised patch-configure which said
>>>>
>>>> -	LDFLAGS=`mysql_config --libs $LDFLAGS`
>>>> -	CPPFLAGS=`mysql_config --include $CPPFLAGS`
>>>> +	LDFLAGS="`mysql_config --libs` $LDFLAGS"
>>>> +	CPPFLAGS="`mysql_config --include` $CPPFLAGS"
>>>>
>>>> to fix the problem with calling mysql_config. My Portfile also  
>>>> fixed the PATH in the configure phase with
>>>>
>>>> configure.env-append        PATH=${prefix}/lib/mysql5/bin:$env 
>>>> (PATH)
>>>>
>>>> so that mysql_config could be found. I tested this before  
>>>> attaching it to the email and it worked for me as sent.
>>>
>>> Reading your comment " It is not correct to put "$LDFLAGS" at the  
>>> end of that command invocation." and without looking in  
>>> "config.log" personally I assumed you meant to remove the  
>>> "$LDFLAGS" from "mysql_config --libs $LDFLAGS" in the patch.
>>>
>>> I just copied your revised Portfile and patch-configure file and  
>>> ran "port clean --all" and "port configure" and it failed.
>>>
>>> Altering the patch to remove ""$LDFLAGS"" fixed the configure  
>>> problems.
>>>
>>> Anyways, without looking at the configure.log I believe you are  
>>> right and that is very cool. I will pass your/our patch upstream.
>>
>> LDFLAGS should not be inside the backticks, but should presumably  
>> be outside the backticks. The way the developer had it, he was  
>> saying "set LDFLAGS to the value of the program invocation  
>> `mysql_config --libs $LDFLAGS`" and that's not a valid invocation  
>> of mysql_config if $LDFLAGS is nonempty. I changed it to say "set  
>> LDFLAGS to the value of the program invocation `mysql_config -- 
>> libs` and then a space and then whatever was already in $LDFLAGS"  
>> which I think is what the developer was trying to say, but maybe  
>> he never tested with LDFLAGS nonempty.
>>
>> I just tried again with the files I sent earlier and it works  
>> fine. Make a directory libzdb, put Portfile in it, make a files  
>> directory in it, put patch-configure in the files directory, cd to  
>> the libzdb directory, and run port -d configure. For me it says:
>
> I appologize. I may have not noticed the change you made to the  
> patch to move the $LDFLAGS outside the backticks.
>
> Your right, your files work. Thank you for your help.
>
> Now I need to finish the Portfile so I can continue with the dbmail- 
> devel port.
>
> Since libzdb may be used by someone else some day I'm trying to  
> think what to do with it.
>
> Should I make variants for sqlite, mysql and postgresql or just let  
> the configure script look for all three and fail with a message if  
> it finds nothing?
>
> I remember you (Ryan) saying it's nice to keep the variant count to  
> a minimum.

True, fewer variants are better. However, it is not ok for a port to  
use whatever it finds and fail if it finds nothing. A port must  
declare dependencies on all ports it uses. So you must either force  
the port to use specific versions of mysql, postgresql and/or sqlite,  
or force the port not to use mysql, postgresql and/or sqlite.

For now it's probably fine to just make the port do whatever you need  
it to do for your purposes. If someone else needs it to support other  
database systems in the future, they can file a ticket in Trac.





More information about the macports-dev mailing list