I've been working on this some more, trying to build an actual application
from the binary. It almost works, and does work on my machine--but for some
reason cocoahelper fails to load on other machines.

Following Shawn's suggestion below, I added a cocoahelper.framework target
to the cocoahelper Makefile. I also fixed a bug in cocoahelper.lisp
regarding foreign library paths. Cocoahelper can now be loaded either from
the .dylib or the .framework.

I still have yet to find out if this solves my problem, as I need some else
to test my app. I'll get back to you when I have news.

On Sat, May 30, 2009 at 12:07 PM, Elliott Slaughter <
[email protected]> wrote:

> Thanks!
>
> The critical piece was loading cocoahelper--when I loaded it explicitly
>
> (defun test ()
>   (sb-alien:load-shared-object "cocoahelper.dylib")
>   (sb-alien:load-shared-object "SDL.framework/SDL")
>   (lispbuilder-sdl-cocoahelper::cocoahelper-init)
>   (sdl-examples:mandelbrot)
>   0)
>
> the created binary worked fine.
>
> Maybe, as suggested by Shawn, we should try to compile cocoahelper to a
> .framework instead of a .dylib. That might make this build process easier.
>
>
> On Sat, May 30, 2009 at 1:27 AM, Luke Crook <[email protected]> wrote:
>
>> Elliott,
>> FYI. I really hope the information below helps. Let me know.
>> - Luke
>>
>> ---------- Forwarded message ----------
>> From: David O'Toole <[email protected]>
>> Date: Wed, May 27, 2009 at 5:16 PM
>> Subject: Fwd: osx build script
>> To: luke <[email protected]>
>>
>>
>> Hey Luke, my friend Shawn Betts was able to get my roguelike working
>> on Mac OSX, I asked him to send me his build instructions. I thought
>> it might help with the issues discussed on the list.
>>
>>
>> ---------- Forwarded message ----------
>> From: Shawn Betts <[email protected]>
>> Date: Wed, May 27, 2009 at 5:47 PM
>> Subject: osx build script
>> To: [email protected]
>>
>>
>> Ok, so this is pretty tricky. I don't really remember why this stuff
>> worked or if it ended up being absolutely required but I'll describe
>> what I did and hopefully others can reproduce and refine it. First the
>> build tree:
>>
>> build-rlx.lisp
>> Frameworks/
>>  SDL.framework
>>  SDL_image.framework
>>  SDL_mixer.framework
>>  SDL_ttf.framework
>> build/
>>  sbcl
>>  cocoahelper.dylib
>>  SDL.framework
>> mac-site/
>>  alexandria/
>>  babel_0.3.0/
>>  cffi_0.10.3/
>>  lispbuilder/
>>    lispbuilder-sdl/
>>    lispbuilder-sdl-image/
>>    lispbuilder-sdl-mixer/
>>    lispbuilder-sdl-ttf/
>>  rt-20040621/
>>  trivial-features_0.4/
>> clon/
>> rlx/
>>
>> I've attached the template blast.app which contains the directory
>> structure and files for an osx application. You need to copy the
>> executable and game files into the appropriate directories for it to
>> work.
>>
>> I've also attached the build script. It does nothing more than build the
>> executable. The executable needs to be placed in the .app for it to work
>> because it expects certain directories and files to be present.
>>
>> First thing you need to do is modify cffi:
>>
>> --- src/cffi-sbcl.lisp~ 2009-04-14 19:33:40.000000000 -0700
>> +++ src/cffi-sbcl.lisp  2009-04-03 15:28:37.000000000 -0700
>> @@ -324,7 +324,7 @@
>>  (defun %load-foreign-library (name path)
>>   "Load a foreign library."
>>   (declare (ignore name))
>> -  (load-shared-object path))
>> +  (load-shared-object path :dont-save t))
>>
>>  ;;; SBCL 1.0.21.15 renamed SB-ALIEN::SHARED-OBJECT-FILE but introduced
>>  ;;; SB-ALIEN:UNLOAD-SHARED-OBJECT which we can use instead.
>>
>> You need this change because it allows you to tell sbcl where to find
>> the SDL libraries which are in different places at run time than at
>> build time.
>>
>> Next, this step may not be needed but it's what I did. you need to copy
>>
>> 1. sbcl
>> 2. cocoahelper.dylib
>> 3. SDL.framework
>>
>> into the directory you build rlx. I don't really remember why these have
>> to be in the same directory but apparently they did. Otherwise it'd fail
>> to load cocoahelper.dylib. (on a side note, this would all be much
>> easier if it was a .framework instead of a dylib. I once tried to build
>> it as a framework but failed)
>>
>> now:
>>
>> $ cd build/
>> $ ./sbcl
>>
>> * (load "../build-rlx.lisp")
>>
>> If you have everything set up correctly it should build you an
>> executable.
>>
>> Next copy that executable into blast.app/Contents/MacOS/
>> then copy standard/ and blast/ directories from rlx/ into
>> blast.app/Contents/Resources/
>>
>> You should now have an osx application which you can bundle into a .dmg
>> and distribute.
>>
>> All the libraries you need to fill the build tree above can be found in
>> blast.app.tgz.
>>
>> Good luck!
>>
>> -Shawn
>>
>>
>
>
> --
> Elliott Slaughter
>
> "Don't worry about what anybody else is going to do. The best way to
> predict the future is to invent it." - Alan Kay
>



-- 
Elliott Slaughter

"Don't worry about what anybody else is going to do. The best way to predict
the future is to invent it." - Alan Kay
_______________________________________________
application-builder mailing list
[email protected]
http://www.lispniks.com/mailman/listinfo/application-builder

Reply via email to