From ce8fbe076d085b6dda068bd60f22a3c02701311e Mon Sep 17 00:00:00 2001 From: mazzearos Date: Fri, 3 Aug 2012 19:10:44 +0000 Subject: [PATCH] Started to add Lua support to AROS. src/Makefile: link with lua. Note that I'm currently using an absolute path to include/lua which only exits on my machine until AROS has support for pkg-config. src/setup.h: added valid path to lua scripts. src/io.c: take colon into account when checking for last separator. src/factory.c: use luaL_newstate() instead of lua_open() because latter doesn't exist anymore in Lua-5.2. Note: that fix should be valid for all platforms. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1977 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- src/Makefile | 8 +++++--- src/factory.c | 6 +++++- src/io.c | 2 ++ src/setup.h | 2 ++ 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/Makefile b/src/Makefile index c93abcfa..eb0c0ce4 100644 --- a/src/Makefile +++ b/src/Makefile @@ -316,10 +316,12 @@ endif else ifdef AROS32CROSS - #cross compile an Aros 32 bit executable + #cross compile an AROS 32 bit executable BIN = ../GrafX2 - COPT = -Wall -Wno-pointer-sign -Wno-unused-but-set-variable -g `i386-linux-aros-sdl-config --cflags` $(TTFCOPT) - LOPT = -lSDL_image `i386-linux-aros-sdl-config --libs` -lpng -ljpeg -lz $(TTFLOPT) -lfreetype2shared + COPT = -Wall -Wno-pointer-sign -Wno-unused-but-set-variable -g `i386-linux-aros-sdl-config --cflags` $(TTFCOPT) $(LUACOPT) + LOPT = -lSDL_image `i386-linux-aros-sdl-config --libs` -lpng -ljpeg -lz $(TTFLOPT) -lfreetype2shared $(LUALOPT) + LUACOPT = -I/home/mazze/projects/fullaros/aros-linux-i386-dbg/bin/linux-i386/AROS/Development/include/lua + LUALOPT = -llua CC = i386-linux-aros-gcc OBJDIR = ../obj/aros STRIP = strip --strip-unneeded --remove-section .comment diff --git a/src/factory.c b/src/factory.c index 64972bc2..a100167c 100644 --- a/src/factory.c +++ b/src/factory.c @@ -1593,8 +1593,12 @@ void Run_script(const char *script_subdirectory, const char *script_filename) Extract_path(buf,Last_run_script); chdir(buf); +#if defined(__AROS__) + L = luaL_newstate(); // lua_open() doesn't exist anymore in Lua-5.2 +#else L = lua_open(); - +#endif + strcpy(buf, "LUA_PATH="); strcat(buf, Data_directory); Append_path(buf+9, SCRIPTS_SUBDIRECTORY, NULL); diff --git a/src/io.c b/src/io.c index 3697e926..c189f01a 100644 --- a/src/io.c +++ b/src/io.c @@ -172,6 +172,8 @@ char * Find_last_slash(const char * str) if (*str == PATH_SEPARATOR[0] #ifdef __WIN32__ || *str == '/' +#elif __AROS__ + || *str == ':' #endif ) position = str; diff --git a/src/setup.h b/src/setup.h index 369ac7ce..762a617b 100644 --- a/src/setup.h +++ b/src/setup.h @@ -73,6 +73,8 @@ void Set_config_directory(const char * program_dir, char * config_dir); /// Name of the subdirectory containing scripts #if defined (__MINT__) #define SCRIPTS_SUBDIRECTORY "SCRIPTS" +#elif defined(__AROS__) + #define SCRIPTS_SUBDIRECTORY "share/grafx2/scripts" #else #define SCRIPTS_SUBDIRECTORY "scripts" #endif