From f6099402e702636affd93a026ccf075df9f31911 Mon Sep 17 00:00:00 2001 From: Bart van Strien Date: Fri, 29 Jun 2012 13:04:32 +0200 Subject: [PATCH] Make it build on linux - Removed weird #ifdefs - Enabled optional executable building - Fixed exclude files, they're regexes after all --- platform/unix/configure.in | 5 ++++ platform/unix/exclude | 54 +++++++++++++++++++------------------- platform/unix/gen-makefile | 2 ++ src/modules/love/love.cpp | 20 +++----------- src/modules/love/love.h | 11 +++++--- 5 files changed, 45 insertions(+), 47 deletions(-) diff --git a/platform/unix/configure.in b/platform/unix/configure.in index 3a9452c5d..1d1e48739 100644 --- a/platform/unix/configure.in +++ b/platform/unix/configure.in @@ -65,6 +65,11 @@ AS_IF([test "x$enable_mpg123" != xno], AS_IF([test "x$enable_mpg123" != xno], AC_SEARCH_LIBS([mpg123_seek_64], [mpg123], AC_SUBST([FILE_OFFSET],[-D_FILE_OFFSET_BITS=64]), AC_SUBST([FILE_OFFSET],[]))) +AC_ARG_ENABLE([exe], AC_HELP_STRING([--disable-exe], [Disable building of executable launcher]), [], [enable_exe=yes]) +AS_IF([test "x$enable_exe" != xno], + AC_DEFINE([LOVE_BUILD_EXE], [], [Don't build launcher])) +AM_CONDITIONAL([LOVE_BUILD_EXE], [test "x$enable_exe" != xno]) + AC_CONFIG_FILES([ Makefile src/Makefile diff --git a/platform/unix/exclude b/platform/unix/exclude index 4c61a74c2..a81932b20 100644 --- a/platform/unix/exclude +++ b/platform/unix/exclude @@ -1,27 +1,27 @@ -./modules/native/tcc/libtcc/tccelf.c -./modules/native/tcc/libtcc/x86_64-gen.c -./modules/native/tcc/libtcc/tccasm.c -./modules/native/tcc/libtcc/tccpp.c -./modules/native/tcc/libtcc/il-gen.c -./modules/native/tcc/libtcc/c67-gen.c -./modules/native/tcc/libtcc/tcc.c -./modules/native/tcc/libtcc/elf.h -./modules/native/tcc/libtcc/tcccoff.c -./modules/native/tcc/libtcc/config.h -./modules/native/tcc/libtcc/i386-asm.h -./modules/native/tcc/libtcc/tccpe.c -./modules/native/tcc/libtcc/tcctok.h -./modules/native/tcc/libtcc/arm-gen.c -./modules/native/tcc/libtcc/i386-asm.c -./modules/native/tcc/libtcc/i386-gen.c -./modules/native/tcc/libtcc/tccgen.c -./modules/native/tcc/libtcc/tcc.h -./modules/native/tcc/libtcc/il-opcodes.h -./modules/native/tcc/libtcc/coff.h -./modules/native/tcc/libtcc/stab.h -./libraries/luasocket/libluasocket/wsocket.* -./modules/sound/lullaby/FLACDecoder.* -./modules/thread/sdl/* -./modules/thread/win32/* -./modules/thread/posix/* -./love.cpp +\./modules/native/tcc/libtcc/tccelf\.c +\./modules/native/tcc/libtcc/x86_64-gen\.c +\./modules/native/tcc/libtcc/tccasm\.c +\./modules/native/tcc/libtcc/tccpp\.c +\./modules/native/tcc/libtcc/il-gen\.c +\./modules/native/tcc/libtcc/c67-gen\.c +\./modules/native/tcc/libtcc/tcc\.c +\./modules/native/tcc/libtcc/elf\.h +\./modules/native/tcc/libtcc/tcccoff\.c +\./modules/native/tcc/libtcc/config\.h +\./modules/native/tcc/libtcc/i386-asm\.h +\./modules/native/tcc/libtcc/tccpe\.c +\./modules/native/tcc/libtcc/tcctok\.h +\./modules/native/tcc/libtcc/arm-gen\.c +\./modules/native/tcc/libtcc/i386-asm\.c +\./modules/native/tcc/libtcc/i386-gen\.c +\./modules/native/tcc/libtcc/tccgen\.c +\./modules/native/tcc/libtcc/tcc\.h +\./modules/native/tcc/libtcc/il-opcodes\.h +\./modules/native/tcc/libtcc/coff\.h +\./modules/native/tcc/libtcc/stab\.h +\./libraries/luasocket/libluasocket/wsocket\.* +\./modules/sound/lullaby/FLACDecoder\.* +\./modules/thread/sdl/* +\./modules/thread/win32/* +\./modules/thread/posix/* +\./love\.cpp diff --git a/platform/unix/gen-makefile b/platform/unix/gen-makefile index 805686dcb..4b2ea672b 100644 --- a/platform/unix/gen-makefile +++ b/platform/unix/gen-makefile @@ -8,11 +8,13 @@ echo "AM_CPPFLAGS = -I$inc_current -I$inc_modules -I$inc_libraries -I/usr/includ AUTOMAKE_OPTIONS = subdir-objects SUBDIRS = +if LOVE_BUILD_EXE # LÖVE executable bin_PROGRAMS = love #love_LDFLAGS = love_LDADD = liblove.la love_SOURCES = love.cpp +endif # libLÖVE lib_LTLIBRARIES = liblove.la diff --git a/src/modules/love/love.cpp b/src/modules/love/love.cpp index 94448d448..1fb616720 100644 --- a/src/modules/love/love.cpp +++ b/src/modules/love/love.cpp @@ -36,18 +36,12 @@ #include #endif // LOVE_LEGENDARY_CONSOLE_IO_HACK -#ifdef LOVE_BUILD_EXE - // Libraries. #include "libraries/luasocket/luasocket.h" // Scripts #include "scripts/boot.lua.h" -#endif // LOVE_BUILD_EXE - -#ifdef LOVE_BUILD_STANDALONE - // All modules define a c-accessible luaopen // so let's make use of those, instead // of addressing implementations directly. @@ -87,23 +81,21 @@ static const luaL_Reg modules[] = { { 0, 0 } }; -#endif // LOVE_BUILD_STANDALONE - #ifdef LOVE_LEGENDARY_CONSOLE_IO_HACK int w__openConsole(lua_State * L); #endif // LOVE_LEGENDARY_CONSOLE_IO_HACK -extern "C" LOVE_EXPORT const char *love_version() +const char *love_version() { return love::VERSION; } -extern "C" LOVE_EXPORT const char *love_codename() +const char *love_codename() { return love::VERSION_CODENAME; } -extern "C" LOVE_EXPORT int luaopen_love(lua_State * L) +int luaopen_love(lua_State * L) { love::luax_insistglobal(L, "love"); @@ -147,8 +139,6 @@ extern "C" LOVE_EXPORT int luaopen_love(lua_State * L) #endif lua_setfield(L, -2, "_os"); -#ifdef LOVE_BUILD_STANDALONE - // Preload module loaders. for (int i = 0; modules[i].name != 0; i++) { @@ -157,8 +147,6 @@ extern "C" LOVE_EXPORT int luaopen_love(lua_State * L) love::luasocket::__open(L); -#endif // LOVE_BUILD_STANDALONE - return 1; } @@ -206,7 +194,7 @@ int w__openConsole(lua_State * L) #endif // LOVE_LEGENDARY_CONSOLE_IO_HACK -extern "C" LOVE_EXPORT int luaopen_love_boot(lua_State *L) +int luaopen_love_boot(lua_State *L) { if (luaL_loadbuffer(L, (const char *)love::boot_lua, sizeof(love::boot_lua), "boot.lua") == 0) lua_call(L, 0, 1); diff --git a/src/modules/love/love.h b/src/modules/love/love.h index 106d4f497..6ba7a2e60 100644 --- a/src/modules/love/love.h +++ b/src/modules/love/love.h @@ -24,7 +24,10 @@ // Forward declare lua_State. struct lua_State; -extern "C" LOVE_EXPORT const char *love_version(); -extern "C" LOVE_EXPORT const char *love_codename(); -extern "C" LOVE_EXPORT int luaopen_love(lua_State *L); -extern "C" LOVE_EXPORT int luaopen_love_boot(lua_State *L); \ No newline at end of file +extern "C" +{ + LOVE_EXPORT const char *love_version(); + LOVE_EXPORT const char *love_codename(); + LOVE_EXPORT int luaopen_love(lua_State *L); + LOVE_EXPORT int luaopen_love_boot(lua_State *L); +}