From 29f3fe70aeb5f566864c7868f7c89483547e92b4 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Tue, 13 May 2014 14:42:20 +1000 Subject: Extantz calls love, and love calls LuaSL, and clean out the need for scripts to twiddle the Lua paths. --- src/LuaSL/LuaSL_main.c | 19 +++++++++++++++++-- src/LuaSL/test.sh | 27 --------------------------- src/extantz/build.lua | 2 +- src/extantz/extantz.c | 19 ++++++++++++++++++- src/love/love.c | 7 +++++++ 5 files changed, 43 insertions(+), 31 deletions(-) delete mode 100755 src/LuaSL/test.sh (limited to 'src') diff --git a/src/LuaSL/LuaSL_main.c b/src/LuaSL/LuaSL_main.c index 0d8a6db..7d6fa99 100644 --- a/src/LuaSL/LuaSL_main.c +++ b/src/LuaSL/LuaSL_main.c @@ -221,8 +221,23 @@ static Eina_Bool _del(void *data, int type __UNUSED__, Ecore_Con_Event_Client_De int main(int argc, char **argv) { - gameGlobals ourGlobals; - int result = EXIT_FAILURE; + gameGlobals ourGlobals; + char *env, cwd[PATH_MAX], temp[PATH_MAX * 2]; + int result = EXIT_FAILURE; + + // Sigh, Elm has this great thing for dealing with bin, lib, and data directories, but this is not an Elm app, + // And Elm is too heavy for just that little bit. + // So just duplicate a bit of what we need here. Sorta. + getcwd(cwd, PATH_MAX); + env = getenv("LUA_CPATH"); + if (!env) env = ""; + sprintf(temp, "%s;%s/lib?.so;%s/?.so;%s/?.so", env, PACKAGE_LIB_DIR, PACKAGE_LIB_DIR, cwd); + setenv("LUA_CPATH", temp, 1); + + env = getenv("LUA_PATH"); + if (!env) env = ""; + sprintf(temp, "%s;%s/?.lua;%s/?.lua", env, PACKAGE_LIB_DIR, cwd); + setenv("LUA_PATH", temp, 1); memset(&ourGlobals, 0, sizeof(gameGlobals)); ourGlobals.address = "127.0.0.1"; diff --git a/src/LuaSL/test.sh b/src/LuaSL/test.sh deleted file mode 100755 index e8471c8..0000000 --- a/src/LuaSL/test.sh +++ /dev/null @@ -1,27 +0,0 @@ -#! /bin/bash - -wd=$(pwd) - -# Kill any left overs. -killall -KILL LuaSL -export LUA_PATH="$wd/../../lib/?.lua" - -case $@ in - - ddd) - ddd ../../LuaSL - ;; - - gdb) - gdb ../../LuaSL - ;; - - *) - echo "_______________ STARTING LuaSL _______________" - ../../LuaSL & - sleep 1 - echo "_______________ STARTING love _______________" - ../../love - ;; - -esac diff --git a/src/extantz/build.lua b/src/extantz/build.lua index caca02f..1591e8a 100755 --- a/src/extantz/build.lua +++ b/src/extantz/build.lua @@ -15,7 +15,7 @@ end CFLAGS = CFLAGS .. ' -I../../libraries/irrlicht-1.8.1/include -I/usr/X11R6/include -I../GuiLua' LDFLAGS = LDFLAGS .. ' -L../../libraries/irrlicht-1.8.1/lib/Linux' -libs = libs .. ' -lIrrlicht -lGL -lbz2 -lGuiLua -lwinFang' +libs = libs .. ' -lIrrlicht -lGL -lbz2 -lGuiLua -lwinFang -lRunnr' removeFiles(dir, {'crappisspuke.o', 'CDemo.o', 'extantzCamera.o', 'gears.o', 'ephysics_demo.o', 'Evas_3D_demo.o', '../../media/extantz.edj'}) removeFiles(dir, {'../../extantz', 'camera.o', 'files.o', 'scenri.o', 'woMan.o'}) diff --git a/src/extantz/extantz.c b/src/extantz/extantz.c index b422343..c077f44 100644 --- a/src/extantz/extantz.c +++ b/src/extantz/extantz.c @@ -1,3 +1,5 @@ +#include + #include "extantz.h" #include "SledjHamr.h" #include "LumbrJack.h" @@ -408,7 +410,7 @@ void overlay_add(globals *ourGlobals) EAPI_MAIN int elm_main(int argc, char **argv) { GLData *gld = NULL; - char buf[PATH_MAX]; + char buf[PATH_MAX * 2], *env; // Eina_Bool gotWebKit = elm_need_web(); // Initialise ewebkit if it exists, or return EINA_FALSE if it don't. /* Set the locale according to the system pref. @@ -428,6 +430,21 @@ EAPI_MAIN int elm_main(int argc, char **argv) logDom = loggingStartup("extantz", logDom); + // Add extras, so we can run test.lua later. + env = getenv("LUA_CPATH"); + if (!env) env = ""; + sprintf(buf, "%s;%s/src/GuiLua/?.so", env, elm_app_bin_dir_get()); + setenv("LUA_CPATH", buf, 1); + + env = getenv("LUA_PATH"); + if (!env) env = ""; + sprintf(buf, "%s;%s/src/GuiLua/?.lua", env, elm_app_bin_dir_get()); + setenv("LUA_PATH", buf, 1); + + sprintf(buf, "%s/love &", elm_app_bin_dir_get()); + system(buf); + sleep(1); + // Don't do this, we need to clean up other stuff to, so set a clean up function below. //elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED); elm_policy_set(ELM_POLICY_EXIT, ELM_POLICY_EXIT_NONE); diff --git a/src/love/love.c b/src/love/love.c index b0d1c05..6a3cdaa 100644 --- a/src/love/love.c +++ b/src/love/love.c @@ -11,6 +11,8 @@ Dedicated to my girl Boots, coz she means the world to me. #include #include +#include + #include "LumbrJack.h" #include "Runnr.h" @@ -377,6 +379,11 @@ int main(int argc, char **argv) char *programName = argv[0]; boolean badArgs = FALSE; int result = EXIT_FAILURE; + char buf[PATH_MAX]; + + sprintf(buf, "%s/LuaSL &", PACKAGE_BIN_DIR); + system(buf); + sleep(1); memset(&ourGlobals, 0, sizeof(gameGlobals)); ourGlobals.address = "127.0.0.1"; -- cgit v1.1