Browse Source

Make it build on linux

- Removed weird #ifdefs
- Enabled optional executable building
- Fixed exclude files, they're regexes after all
Bart van Strien 13 years ago
parent
commit
f6099402e7

+ 5 - 0
platform/unix/configure.in

@@ -65,6 +65,11 @@ AS_IF([test "x$enable_mpg123" != xno],
 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_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([
 AC_CONFIG_FILES([
 	Makefile
 	Makefile
 	src/Makefile
 	src/Makefile

+ 27 - 27
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

+ 2 - 0
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
 AUTOMAKE_OPTIONS = subdir-objects
 SUBDIRS =
 SUBDIRS =
 
 
+if LOVE_BUILD_EXE
 # LÖVE executable
 # LÖVE executable
 bin_PROGRAMS = love
 bin_PROGRAMS = love
 #love_LDFLAGS =
 #love_LDFLAGS =
 love_LDADD = liblove.la
 love_LDADD = liblove.la
 love_SOURCES = love.cpp
 love_SOURCES = love.cpp
+endif
 
 
 # libLÖVE
 # libLÖVE
 lib_LTLIBRARIES = liblove.la
 lib_LTLIBRARIES = liblove.la

+ 4 - 16
src/modules/love/love.cpp

@@ -36,18 +36,12 @@
 #include <fstream>
 #include <fstream>
 #endif // LOVE_LEGENDARY_CONSOLE_IO_HACK
 #endif // LOVE_LEGENDARY_CONSOLE_IO_HACK
 
 
-#ifdef LOVE_BUILD_EXE
-
 // Libraries.
 // Libraries.
 #include "libraries/luasocket/luasocket.h"
 #include "libraries/luasocket/luasocket.h"
 
 
 // Scripts
 // Scripts
 #include "scripts/boot.lua.h"
 #include "scripts/boot.lua.h"
 
 
-#endif // LOVE_BUILD_EXE
-
-#ifdef LOVE_BUILD_STANDALONE
-
 // All modules define a c-accessible luaopen
 // All modules define a c-accessible luaopen
 // so let's make use of those, instead
 // so let's make use of those, instead
 // of addressing implementations directly.
 // of addressing implementations directly.
@@ -87,23 +81,21 @@ static const luaL_Reg modules[] = {
 	{ 0, 0 }
 	{ 0, 0 }
 };
 };
 
 
-#endif // LOVE_BUILD_STANDALONE
-
 #ifdef LOVE_LEGENDARY_CONSOLE_IO_HACK
 #ifdef LOVE_LEGENDARY_CONSOLE_IO_HACK
 int w__openConsole(lua_State * L);
 int w__openConsole(lua_State * L);
 #endif // LOVE_LEGENDARY_CONSOLE_IO_HACK
 #endif // LOVE_LEGENDARY_CONSOLE_IO_HACK
 
 
-extern "C" LOVE_EXPORT const char *love_version()
+const char *love_version()
 {
 {
 	return love::VERSION;
 	return love::VERSION;
 }
 }
 
 
-extern "C" LOVE_EXPORT const char *love_codename()
+const char *love_codename()
 {
 {
 	return love::VERSION_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");
 	love::luax_insistglobal(L, "love");
 
 
@@ -147,8 +139,6 @@ extern "C" LOVE_EXPORT int luaopen_love(lua_State * L)
 #endif
 #endif
 	lua_setfield(L, -2, "_os");
 	lua_setfield(L, -2, "_os");
 
 
-#ifdef LOVE_BUILD_STANDALONE
-
 	// Preload module loaders.
 	// Preload module loaders.
 	for (int i = 0; modules[i].name != 0; i++)
 	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);
 	love::luasocket::__open(L);
 
 
-#endif // LOVE_BUILD_STANDALONE
-
 	return 1;
 	return 1;
 }
 }
 
 
@@ -206,7 +194,7 @@ int w__openConsole(lua_State * L)
 
 
 #endif // LOVE_LEGENDARY_CONSOLE_IO_HACK
 #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)
 	if (luaL_loadbuffer(L, (const char *)love::boot_lua, sizeof(love::boot_lua), "boot.lua") == 0)
 	lua_call(L, 0, 1);
 	lua_call(L, 0, 1);

+ 7 - 4
src/modules/love/love.h

@@ -24,7 +24,10 @@
 // Forward declare lua_State.
 // Forward declare lua_State.
 struct 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);
+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);
+}