Better support for uninstalled frameworks
Submitted by Michael C. Grant
Assigned to pkg..@..op.org
As you probably know, Mac OSX has the concept of "Frameworks" that encapsulates shared libraries, header files, and the like into a convenient package. Users specify a framework to be used using the "-framework
<fname>" argument. If the framework is not in a standard system location, it is necessary to precede this with an additional "-F
<path>" argument as well. These two argument types are analogous to "-l" and "-L" library arguments, respectively.
So you probably know where this is going, because I've seen discussion of it in earlier pkg-config mailing lists... can we better support these flags in pkg-config?
--- Include "-framework
<fname>" arguments when calling "pkg-config --libs-only-l", and "-F
<path>" when using "pkg-config --libs-only-L".
--- Create new options that are suited specifically for frameworks; e.g., --frameworks-only-f and --frameworks-only-F.
--- Create--libs-only-lf and --libs-only-LF that retrieve both library and framework data simultaneously.
The advantage of the first approach is that many packages that rely on pkg-config for library discovery will suddenly "just work" on a Mac if their dependencies are provided in framework form. For instance, Qt is provided as a framework on the Mac; and if installed via Homebrew, it does not appear in the system path. So we would like to see things like this:
LDFLAGS+=-F/usr/local/Cellar/qt/4.8.5/lib LIBS+=-framework QtCore -framework QtGui -framework QtNetwork
The disadvantage of the first approach is that the mnemonic value of the command-line options --libs-only-l and --libs-only-L are damaged. My personal opinion is that this is outweighed by the benefits. The second and third approaches will require many existing configure scripts to be changed to add these new framework-specific calls.
I will say that a fix here goes hand in hand with a patch I have proposed for libtool (http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16384). In that case, I modified libtool to treat -F in the same manner as it currently treats -L; and in doing so, I ensure that the framework paths are properly passed to the linker. Note that libtool already treats -framework arguments properly; it was just -F that needed fixing.
I'm willing to work on a patch here if a consensus can be reached.