Page 1 of 1

Including additional lualibs in OS X .app

Posted: Wed Jun 05, 2013 4:40 pm
by Haimi
Hi @ll,

I am trying to build my .app For OS X according to the Wiki entry, which works like a charm.

My Problem is, I need additional lualibs (e.g. luadbi, md5,...) and I want to pack them into the app.

Can any OS X developer please give me a hint or tell me how to use them?
I am able to build .a, .so, .dylib and .framework, but I don't know which one to use best and how to include them correctly.

Any help or hint would be appreciated very much!

Greetings, Haimi

Re: Including additional lualibs in OS X .app

Posted: Thu Jun 06, 2013 4:13 pm
by Haimi
Okay, I figured it out myself:
A big problem was, that our game must be started from the game directory for some very deep coding reasons :monocle:
I fetched the needed packages via luarocks (I am using md5 by example)

Code: Select all

sudo luarocks install md5
  1. placed the game directory in Game.app/Contents/Resources
  2. copied the initializer file (/opt/local/var/luarocks/share/lua/5.1/md5.lua) to a new Directory: Game.app/Contents/Resources/Libraries
  3. copied the md5 core library (/opt/local/var/luarocks/lib/lua/5.1/md5) to: Game.app/Contents/Frameworks
  4. wrote a small bash script for game starting in Game.app/Contents/MacOS:

Code: Select all

#!/bin/bash
export LUA_CPATH="../../Frameworks/?/core.so;$1/Contents/Frameworks/?.so;$LUA_CPATH"
export LUA_PATH="../Libraries/?.lua;$LUA_PATH"
BIN_DIR=$(dirname $0)
cd ${BIN_DIR}/../Resources/<gamefolder>
../../MacOS/love .
Now all I need to do is to change the starting executable from love to my starting script.
I hope I can help anybody who might have this problem too.

Greetings!