Reply to topic  [ 3 posts ] 
Flags ordering in Makepkg 
Author Message
Yorick Master

Joined: Tue Mar 07, 2006 10:31 pm
Posts: 125
Location: Meudon, France
Post Flags ordering in Makepkg
Hi,

In Makepkg I see
Code:
LDFLAGS=$(COPT) $(Y_LDFLAGS) $(PKG_LDFLAGS)


I think PKG_LDFLAGS should come first:
Code:
LDFLAGS=$(COPT) $(PKG_LDFLAGS) $(Y_LDFLAGS)


else it is not possible (or at least very tricky) to choose with which version of a library my plug-in should be linked.

In my case, I have a package from which I build both a shared library and a Yorick plug-in. An "older" (a.k.a. stable) version of both is already installed and I want to compile a newer (a.k.a. "development") version, so I need to put "-L../lib" in front of "-L/opt/local/lib" which is present in Y_LDFLAGS.

This issue may affect other flags as well.

Cheers, Thibaut.


Fri Apr 20, 2012 5:12 am
Profile WWW
Yorick Master

Joined: Mon Nov 22, 2004 9:43 am
Posts: 354
Location: Livermore, CA, USA
Post Re: Flags ordering in Makepkg
I don't think it's very tricky. Why can't you just reverse the order after the include Makepkg? Or just insert the -L../lib in the necessary place directly in your post-include LDFLAGS macro?

This sort of thing happens routinely whenever you try to link against third party packages. I doubt whether changing the order will solve all such complicated linking instructions, and I'm loathe to change it for fear of breaking other currently functioning code. The problem actually lies with the way library dependencies are communicated (or not); it is very frustrating. I've built in as much flexibility as I can by having dozens of make macros you can substitute, override, or replace. It sounds like you have a very special case here ("development" and "stable" versions of things both present), and you are free to override whatever you like in Makepkg after it is included -- just do it. Only the target dependencies in Makepkg are really hard to override; all of the compile rules are yours to modify as needed after Makepkg is included. The mpy/Makefile has some examples; Y_MAIN_O has to be overridden in that case, you just want to fiddle with LDFLAGS. The bottom line is, linking against third party libraries is always a nasty and non-portable business...


Sat Apr 21, 2012 1:57 pm
Profile
Yorick Master

Joined: Tue Mar 07, 2006 10:31 pm
Posts: 125
Location: Meudon, France
Post Re: Flags ordering in Makepkg
I think you're right, nevermind. The right thing to do for my case is certainly to override LDFLAGS after the Make.cfg include. (In my case, I ship a share library in the same source and I want to link with that instance of the ibrary even if there is another instance already installed on the system).

Regards, Thibaut.


Mon Apr 30, 2012 2:58 am
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.