Dumb MacOS X bundle question

Hopefully someone here has run into this before.

So I’ve got an Application Bundle on MacOS X, which basically looks like:

My Program.app
Various Data Files
Contents
MacOS
My Program <-- main binary.

I’d like to put an SDL .dylib in this bundle, so that “My Program”, which
uses SDL, will resolve against it at runtime regardless of where the
application bundle is sitting in the file system and what other SDL
libraries/frameworks are installed on the system. I assume most people
that have this application bundle won’t have SDL installed elsewhere,
though.

Is there an easy way to do this?

Thanks,
–ryan.

Sayeth Ryan C. Gordon on Fri, Feb 14, 2003 at 04:03:15PM -0500:

I’d like to put an SDL .dylib in this bundle, so that “My Program”, which
uses SDL, will resolve against it at runtime regardless of where the
application bundle is sitting in the file system and what other SDL
libraries/frameworks are installed on the system…

Is there an easy way to do this?

Fundamentally, you want to include a framework within your App
bundle. This tutorial explains how to do that:

http://cocoadevcentral.com/articles/000042.php

I am also working on this, but with an extra twist (including
SGE as a framework at the same time):

http://lists.apple.com/mhonarc/mac-games-dev/msg08901.html
(login with “archives”/“archives”, no quotes)

I’m not sure if the SDL runtime library for OS X is built
by default to allow this. I have instead downloaded the CVS
snapshot of SDL and have built the SDL.framework project that
is in there (see the README.MacOSX file for instructions).

This weekend I will work dilligently to get SDL & SGE
working together on OS X AND working as part of an
included framework inside an App bundle. I will probably
follow-up here (to this thread) with my success (or
failure). I’ll also follow-up to that original post
I made to mac-games-dev…

Good luck!

Thx,
-daniel
@Daniel_Hedrick
There are 10 types of people in this world…
those who understand binary, and those who don’t.

The SDL frameworks are already setup to do this. All you have to do is
copy the frameworks into MyApp.app/Contents/Frameworks (the easiest way
is to add a CopyFiles build phase to a PB project).

If you want to use a regular .dylib (not a framework), you have to use
the -install_name option to libtool (or -dylib_install_name to ld),
with something like:

libtool […] -dynamic -o mylib.dylib -install_name
"@executable_path/…/SharedLibraries/mylib.dylib"

This implies the following layout:

MyApp.app
Contents
MacOS
MyApp
SharedLibraries
mylib.dylibOn Saturday, February 15, 2003, at 03:01 PM, wrote:

Is there an easy way to do this?

libtool […] -dynamic -o mylib.dylib -install_name
"@executable_path/…/SharedLibraries/mylib.dylib"

Worked like a CHAMP! Thanks, Darrell!

–ryan.