Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Installing a library



On 06/10/2005, at 5:13 AM, James Gallagher wrote:
I have a library that I build and install on various Unix machines
(Sun, SGI, Linux/x86) and I've ported it to OS/X. A very simple task,
mostly. I have made a .pkg package and it looks really nice, but I'm
installing in /usr/local/{bin,lib,sbin,...} and then installing a
second package that depends on the library. If users have
/usr/local/bin on PATH, it all works great, but most users don't.

Where should a library be installed? Is it a 'Framework?' If so, where
can I get documentation about their organization? I looked at the
Frameworks installed on my machine and only one (stuffit) actually had
the libs in there.

Suppose I do put the lib in Library (seems reasonable), what about any
executable scripts that are really part of it (for example, I have a
-config script that reports the version, et c.). Will executables in
Library be found?

Firstly installing libraries in frameworks is definitely preferable. Frameworks can contain anything you like, but a library called 'foo' (or symlinked as 'foo') will be linked by the option '- framework foo' if it is in a directory called 'foo.framework' somewhere on the framework search path. Similarly a 'foo.framework/ Headers' can contain header files accessed with '-F foo'. However, you can always use standard '-Iheaderpath' and '-Lfoopath -lfoo' style options.


If a dynamic library is linked with '-framework foo' the run time search will look in the directory which contained the library at link time, ~/Library/Frameworks/foo.framework, /Library/Frameworks/ foo.framework and /System//Library/Frameworks/foo.framework. So ~/ Library or /Library are appropriate installation paths. Have a look also at install_name_tool and its man page, and the documentation on versioning.

Apple have a lot of documentation on frameworks, but also check out the way other UNIX packages have done it. R, for instance, puts libraries and binaries in a framework and a symlink for the binary in /usr/bin. Apple do the same with Tcl/Tk. The installer can add the symlinks or you can have an app that does it when first launched like BBEdit does.

What is best depends on the structure and use of your library.

Bill Northcott
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Unix-porting mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/unix-porting/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.