Mac OS X Framework



Hoi  Gregor

Thanx for the Tips. This would make the Framework more like one. The ability to include it into the application bundle would be very handy.

If I look at other Frameworks I always find a single library in the top directory, for example:

/System/Library/Frameworks/ApplicationServices.framework/Versions/A/ Frameworks/ImageIO.framework/ImageIO

If I do "otool -L /System/Library/Frameworks/ ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/ ImageIO", I get references to many other libraries that are located inside the framework bundle:

/System/Library/Frameworks/ApplicationServices.framework/ Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/ libJPEG.dylib (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/ApplicationServices.framework/ Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/ libJP2.dylib (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/ApplicationServices.framework/ Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/ libGIF.dylib (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/ApplicationServices.framework/ Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/ libRaw.dylib (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/ApplicationServices.framework/ Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/ libTIFF.dylib (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/ApplicationServices.framework/ Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/ libPng.dylib (compatibility version 1.0.0, current version 1.0.0) /System/Library/Frameworks/ApplicationServices.framework/ Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/ libRadiance.dylib (compatibility version 1.0.0, current version 1.0.0)

In my Gtk+.framework I have tons of libraries. Would it be possible to create something like the above for gtk? Would it make sense? Right now I just use pkg-config to find the libraries and the result looks like this:

/Applications/Shity Apps/Gtk-Demo.app/Contents/MacOS/gtk-demo:
/Library/Frameworks/Gtk+.framework/Versions/2.9.1//lib/ libgdk_pixbuf-2.0.0.dylib (compatibility version 902.0.0, current version 902.0.0) /Library/Frameworks/Gtk+.framework/Versions/2.9.1//lib/ libgdk-quartz-2.0.0.dylib (compatibility version 902.0.0, current version 902.0.0) /Library/Frameworks/Gtk+.framework/Versions/2.9.1//lib/ libgtk-quartz-2.0.0.dylib (compatibility version 902.0.0, current version 902.0.0) /Library/Frameworks/Gtk+.framework/Versions/2.9.1//lib/ libpangocairo-1.0.0.dylib (compatibility version 1301.0.0, current version 1301.1.0) /Library/Frameworks/Gtk+.framework/Versions/2.9.1//lib/ libpangoft2-1.0.0.dylib (compatibility version 1301.0.0, current version 1301.1.0) /Library/Frameworks/Gtk+.framework/Versions/2.9.1//lib/ libpango-1.0.0.dylib (compatibility version 1301.0.0, current version 1301.1.0) /Library/Frameworks/Gtk+.framework/Versions/2.9.1//lib/ libatk-1.0.0.dylib (compatibility version 1115.0.0, current version 1115.0.0) /Library/Frameworks/Gtk+.framework/Versions/2.9.1//lib/ libgobject-2.0.0.dylib (compatibility version 1102.0.0, current version 1102.0.0) /Library/Frameworks/Gtk+.framework/Versions/2.9.1//lib/ libgmodule-2.0.0.dylib (compatibility version 1102.0.0, current version 1102.0.0) /Library/Frameworks/Gtk+.framework/Versions/2.9.1//lib/ libglib-2.0.0.dylib (compatibility version 1102.0.0, current version 1102.0.0) /Library/Frameworks/Gtk+.framework/Versions/2.9.1//lib/ libcairo.2.dylib (compatibility version 9.0.0, current version 9.0.0) /Library/Frameworks/Gtk+.framework/Versions/2.9.1//lib/ libpng12.0.dylib (compatibility version 11.0.0, current version 11.0.0) /Library/Frameworks/Gtk+.framework/Versions/2.9.1//lib/ libfontconfig.1.dylib (compatibility version 2.0.0, current version 2.4.0) /Library/Frameworks/Gtk+.framework/Versions/2.9.1//lib/ libfreetype.6.dylib (compatibility version 10.0.0, current version 10.8.0) /Library/Frameworks/Gtk+.framework/Versions/2.9.1//lib/ libxml2.2.dylib (compatibility version 9.0.0, current version 9.24.0) /Library/Frameworks/Gtk+.framework/Versions/2.9.1//lib/ libintl.3.dylib (compatibility version 8.0.0, current version 8.3.0)

What do you think?

Cheers,
Ezra.


On 11.06.2006, at 10:22, Gregor Riepl wrote:

Hi Ezra

Well it's looking better now. I even ended up with ready to use Installers. I still got my pkg-config/headers problem though so the script still has some ugly hard links in it., besides all the other debugging ugliness. I'm also not sure if the framework is usable the way it's now. I will first have to try to compile some apps against it. I'll definitely come with more problems soon.

To make a framework fully usable, it's dynamic library paths need to be adapted with install_name_tool.
For example, its the self-reference should be
@executable_path/../Frameworks/<name of framework>.framework/ Versions/A/<name of library inside framework> This makes the library includable in application bundles, instead of having to install it. But you may of course also use /Library/Frameworks/<name of framework>.framework/Versions/A/<name of library inside framework> Have a look at the output of otool -L for some system and user- installed libraries, i.e.

$ otool -L /System/Library/Frameworks/Cocoa.framework/Cocoa
/System/Library/Frameworks/Cocoa.framework/Cocoa:
/System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 11.0.0) /System/Library/Frameworks/AppKit.framework/Versions/C/ AppKit (compatibility version 45.0.0, current version 822.0.0) /System/Library/Frameworks/CoreData.framework/Versions/A/ CoreData (compatibility version 1.0.0, current version 46.0.0) /System/Library/Frameworks/Foundation.framework/Versions/C/ Foundation (compatibility version 300.0.0, current version 566.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.0.0)

or

$ otool -L /Library/Frameworks/SDL_image.framework/SDL_image
/Library/Frameworks/SDL_image.framework/SDL_image:
@executable_path/../Frameworks/SDL_image.framework/Versions/ A/SDL_image (compatibility version 1.0.0, current version 1.0.0) @executable_path/../Frameworks/SDL.framework/Versions/A/SDL (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.0.0) /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 71.1.1)

If a library has a lot of dependencies, you may run into a problem here: The Mach-O header's area for library references isn't of variable size, and install_name_tool may refuse to change all paths. There's afaik no other way then to relink the binary with the option -headerpad_max_install_names (see man ld).





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]