diff options
-rw-r--r-- | Makefile.mingw32 | 76 | ||||
-rw-r--r-- | PSX-Bundle.vcproj | 204 | ||||
-rw-r--r-- | lua-interface.sln | 12 | ||||
-rw-r--r-- | src/lua-interface.cpp | 30 |
4 files changed, 307 insertions, 15 deletions
diff --git a/Makefile.mingw32 b/Makefile.mingw32 index 0c234fd..92f0f83 100644 --- a/Makefile.mingw32 +++ b/Makefile.mingw32 @@ -5,11 +5,18 @@ CXX = i386-mingw32-g++ LD = i386-mingw32-g++ STRIP = i386-mingw32-strip else +ifeq ($(SYSTEM),MINGW32_NT-5.1) +CC = gcc +CXX = g++ +LD = g++ +STRIP = strip +else CC = i586-mingw32msvc-gcc CXX = i586-mingw32msvc-g++ LD = i586-mingw32msvc-g++ STRIP = i586-mingw32msvc-strip endif +endif INCLUDES = \ -I../mogltk/include \ @@ -19,14 +26,18 @@ INCLUDES = \ -I../Baltisot/MSVC/iconv -I../Baltisot/MSVC/regex -I../Baltisot/MSVC \ -I../Mesa-7.0.3-mingw32/include \ -I../pthreads-w32-2-8-0-release/ \ --I../gnuwin32/include +-I../gnuwin32/include \ +-I../tinyxml \ HAVES = -DHAVE_VSSCANF -DHAVE_LIBJPEG -DHAVE_MALLOC_H -DHAVE_BYTESWAP_H -DHAVE_UCL -CPPFLAGS += $(INCLUDES) -g -fexceptions -DLUATASK_OMIT_COMMAND -DSTDC_HEADERS -DLIBICONV_PLUG -DREADLINE_STATIC -fexceptions -DWORDS_LITTLEENDIAN -march=i686 $(HAVES) -DUSE_MPQLIB +CPPFLAGS += $(INCLUDES) -g -fexceptions -DLUATASK_OMIT_COMMAND -DSTDC_HEADERS -DLIBICONV_PLUG -DREADLINE_STATIC -fexceptions -DWORDS_LITTLEENDIAN -march=i686 $(HAVES) -DUSE_MPQLIB -DFROM_LUAINTERFACE + +LDFLAGS_BASIC += -g -fexceptions -LDFLAGS += -L../gnuwin32/lib -g -fexceptions -Wl,--enable-auto-image-base -Wl,--export-dynamic --export-all-symbols -Wl,--enable-auto-import -fexceptions \ - ../libreadline-static.a -lz.dll -lucl.dll -lwsock32 -lws2_32 ../pthreads-w32-2-8-0-release/libpthreadGC2.a --enable-stdcall-fixup +LDFLAGS += $(LDFLAGS_BASIC) -Wl,--enable-auto-image-base -Wl,--export-dynamic --export-all-symbols -Wl,--enable-auto-import -fexceptions --enable-stdcall-fixup + +LIBS += -L../gnuwin32/lib ../libreadline-static.a -lz.dll -lucl.dll -lwsock32 -lws2_32 ../pthreads-w32-2-8-0-release/libpthreadGC2.a vpath %.c ../Baltisot/lib:../Baltisot/src:../Baltisot/lib/zlib/src:../Baltisot/lib/lua/src:../Baltisot/lib/lua/src/LuaLib:src:../paperIdol/src:../mogltk/lib:../tinyxml:../lua-modules/src:../Baltisot/MSVC/iconv:../Baltisot/MSVC/regex vpath %.cc ../Baltisot/lib:../Baltisot/src:../Baltisot/lib/zlib/src:../Baltisot/lib/lua/src:../Baltisot/lib/lua/src/LuaLib:src:../paperIdol/src:../mogltk/lib:../tinyxml:../lua-modules/src:../Baltisot/MSVC/iconv:../Baltisot/MSVC/regex @@ -38,10 +49,11 @@ lua-interface-main.c \ LUAINTERFACE_LDFLAGS = -Wl,--whole-archive ../Mesa-7.0.3-mingw32/lib/libGLU.a ../Mesa-7.0.3-mingw32/lib/libOSMesa.a -Wl,--no-whole-archive -BALTISOT_SOURCES = \ +LUAINTERFACE_MAIN_SOURCES = \ lua-interface.cc \ lua-plugin.cc \ -\ + +BALTISOT_SOURCES = \ Main.cc \ \ RandISAAC.cc \ @@ -162,11 +174,41 @@ generic.cc \ checkargs.c \ datecalc.c \ +LUAINTERFACE_LIGHT_SOURCES = \ +plugin-luaconfigfiles.cc \ +plugin-luahandle.cc \ +plugin-luahttp.cc \ +plugin-lualibs.cc \ +plugin-luarand.cc \ +plugin-luaregex.cc \ +plugin-luasmtp.cc \ +plugin-luatask.cc \ +plugin-luaxml.cc \ +LuaConfigFile.cc \ +tinystr.cpp \ +tinyxml.cpp \ +tinyxmlerror.cpp \ +tinyxmlparser.cpp \ +LuaXML.cc \ +LuaHttp.cc \ +LuaRegex.cc \ +loadlualibs.cc \ +supportlib.lua \ +tasklib.lua \ +ajaxlib.lua \ +htmllib.lua \ +xmllib.lua \ +httplib.lua \ +dblib.lua \ +LuaSmtp.cc \ +lua-plugin.cc \ WHOLE_SOURCES = $(BALTISOT_SOURCES) $(LUA_SOURCES) $(LUAINTERFACE_SOURCES) LUAINTERFACE_OBJECTS = $(addsuffix .o, $(notdir $(basename $(LUAINTERFACE_SOURCES)))) -LUAINTERFACE_DLL_OBJECTS = $(addsuffix .o, $(notdir $(basename $(BALTISOT_SOURCES) $(LUA_SOURCES)))) +LUAINTERFACE_MAIN_OBJECTS = $(addsuffix .o, $(notdir $(basename $(LUAINTERFACE_MAIN_SOURCES) $(LUA_SOURCES)))) +LUAINTERFACE_DLL_OBJECTS = $(addsuffix .o, $(notdir $(basename $(BALTISOT_SOURCES)))) +LUAINTERFACE_LIGHT_OBJECTS = lua-interface-light.o $(addsuffix .o, $(notdir $(basename $(LUAINTERFACE_LIGHT_SOURCES)))) LUAC_OBJECTS = $(addsuffix .o, $(notdir $(basename $(LUAC_SOURCES) $(LUA_SOURCES)))) ALL_OBJECTS = $(addsuffix .o, $(notdir $(basename $(WHOLE_SOURCES)))) @@ -177,16 +219,26 @@ all: dep luac.exe lua-interface.dll lua-interface.exe dep: $(ALL_DEPS) luac.exe: $(LUAC_OBJECTS) - $(LD) -o luac.exe $(LUAC_OBJECTS) $(LDFLAGS) + $(LD) -o luac.exe $(LUAC_OBJECTS) $(LDFLAGS) $(LIBS) -lua-interface.dll: $(LUAINTERFACE_DLL_OBJECTS) - $(LD) -shared -Wl,--output-def=lua-interface.def -Wl,--out-implib=lua-interface.a -o lua-interface.dll $(LUAINTERFACE_DLL_OBJECTS) $(LDFLAGS) $(LUAINTERFACE_LDFLAGS) +lua-interface.dll: $(LUAINTERFACE_DLL_OBJECTS) $(LUAINTERFACE_MAIN_OBJECTS) + $(LD) -shared -Wl,--output-def=lua-interface.def -Wl,--out-implib=lua-interface.a -o lua-interface.dll $(LUAINTERFACE_DLL_OBJECTS) $(LUAINTERFACE_MAIN_OBJECTS) $(LDFLAGS) $(LUAINTERFACE_LDFLAGS) $(LIBS) lua-interface.exe: $(LUAINTERFACE_OBJECTS) - $(LD) -o lua-interface.exe $(LUAINTERFACE_OBJECTS) ./lua-interface.a $(LDFLAGS) + $(LD) -o lua-interface.exe $(LUAINTERFACE_OBJECTS) ./lua-interface.a $(LDFLAGS) $(LIBS) + +lua-interface-light.exe: lua-interface-light.dll $(LUAINTERFACE_OBJECTS) + $(LD) -o lua-interface-light.exe $(LUAINTERFACE_OBJECTS) ./lua-interface.a $(LDFLAGS) $(LIBS) + +lua-interface-light.dll: $(LUAINTERFACE_DLL_OBJECTS) $(LUAINTERFACE_LIGHT_OBJECTS) + $(LD) -shared -Wl,--output-def=lua-interface.def -Wl,--out-implib=lua-interface.a -o lua-interface.dll $(LUAINTERFACE_DLL_OBJECTS) $(LUAINTERFACE_LIGHT_OBJECTS) $(LIBS) $(LDFLAGS) + touch lua-interface-light.dll + +lua-interface-light.o: lua-interface.cpp + $(CC) $(CPPFLAGS) -c -o lua-interface-light.o src/lua-interface.cpp -DLUA_INTERFACE_LIGHT clean: - rm -f lua-interface.dll lua-interface.exe luac.exe *.o *.dep *.a *.def + rm -f lua-interface.dll lua-interface.exe lua-interface-light.exe luac.exe *.o *.dep *.a *.def %.dep : %.c $(CC) $(CPPFLAGS) -M -MF $@ $< diff --git a/PSX-Bundle.vcproj b/PSX-Bundle.vcproj new file mode 100644 index 0000000..50b29e6 --- /dev/null +++ b/PSX-Bundle.vcproj @@ -0,0 +1,204 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9.00"
+ Name="PSX-Bundle"
+ ProjectGUID="{8D1FD5C4-7F15-4B9A-B63A-7D14D9234315}"
+ RootNamespace="PSX-Bundle"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)\$(ProjectName)"
+ IntermediateDirectory="$(SolutionDir)$(ConfigurationName)\$(ProjectName)\tmp"
+ ConfigurationType="4"
+ CharacterSet="2"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories=""..\PSX-Bundle\includes";..\Baltisot\include;..\Baltisot\lib\zlib\include;..\Baltisot\lib\lua\include;"..\PSX-Bundle\psxdev""
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;NO_DLL;_MSVC;LIBICONV_STATIC;LIBICONV_PLUG"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)$(ConfigurationName)\$(ProjectName)"
+ IntermediateDirectory="$(SolutionDir)$(ConfigurationName)\$(ProjectName)\tmp"
+ ConfigurationType="4"
+ CharacterSet="2"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories=""..\PSX-Bundle\includes";..\Baltisot\include;..\Baltisot\lib\zlib\include;..\Baltisot\lib\lua\include;"..\PSX-Bundle\psxdev""
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;NO_DLL;_MSVC;LIBICONV_STATIC;LIBICONV_PLUG"
+ RuntimeLibrary="2"
+ EnableFunctionLevelLinking="true"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLibrarianTool"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath="..\PSX-Bundle\lib\cdabstract.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\PSX-Bundle\lib\cdreader.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\PSX-Bundle\lib\cdutils.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\PSX-Bundle\lib\dvdabstract.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\PSX-Bundle\lib\isobuilder.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\PSX-Bundle\lib\luacd.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\PSX-Bundle\lib\luapsx.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\PSX-Bundle\lib\lzss.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\lua-modules-cd-tool\src\plugin-luacd.cc"
+ >
+ </File>
+ <File
+ RelativePath="..\lua-modules-cd-tool\src\plugin-luapsx.cc"
+ >
+ </File>
+ <File
+ RelativePath="..\PSX-Bundle\lib\yazedc.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/lua-interface.sln b/lua-interface.sln index 85aec8c..6538182 100644 --- a/lua-interface.sln +++ b/lua-interface.sln @@ -7,6 +7,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lua-interface", "lua-interf {A1355B37-BB42-4E76-BC1B-736CA3CF39C7} = {A1355B37-BB42-4E76-BC1B-736CA3CF39C7} {F0C7F93D-603B-4308-B875-BC6E8A4B2A94} = {F0C7F93D-603B-4308-B875-BC6E8A4B2A94} {F8D398BC-2B84-47C4-869C-EDE60D0234EA} = {F8D398BC-2B84-47C4-869C-EDE60D0234EA} + {8D1FD5C4-7F15-4B9A-B63A-7D14D9234315} = {8D1FD5C4-7F15-4B9A-B63A-7D14D9234315} {C406DAEC-0886-4771-8DEA-9D7329B46CC1} = {C406DAEC-0886-4771-8DEA-9D7329B46CC1} EndProjectSection EndProject @@ -20,6 +21,13 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lua", "lua.vcproj", "{A1355 EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "readline", "readline.vcproj", "{F8D398BC-2B84-47C4-869C-EDE60D0234EA}" EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "PSX-Bundle", "PSX-Bundle.vcproj", "{8D1FD5C4-7F15-4B9A-B63A-7D14D9234315}" + ProjectSection(ProjectDependencies) = postProject + {78F7C80D-678D-428C-AF5A-908F05BA0A14} = {78F7C80D-678D-428C-AF5A-908F05BA0A14} + {A1355B37-BB42-4E76-BC1B-736CA3CF39C7} = {A1355B37-BB42-4E76-BC1B-736CA3CF39C7} + {F0C7F93D-603B-4308-B875-BC6E8A4B2A94} = {F0C7F93D-603B-4308-B875-BC6E8A4B2A94} + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 @@ -50,6 +58,10 @@ Global {F8D398BC-2B84-47C4-869C-EDE60D0234EA}.Debug|Win32.Build.0 = Debug|Win32 {F8D398BC-2B84-47C4-869C-EDE60D0234EA}.Release|Win32.ActiveCfg = Release|Win32 {F8D398BC-2B84-47C4-869C-EDE60D0234EA}.Release|Win32.Build.0 = Release|Win32 + {8D1FD5C4-7F15-4B9A-B63A-7D14D9234315}.Debug|Win32.ActiveCfg = Debug|Win32 + {8D1FD5C4-7F15-4B9A-B63A-7D14D9234315}.Debug|Win32.Build.0 = Debug|Win32 + {8D1FD5C4-7F15-4B9A-B63A-7D14D9234315}.Release|Win32.ActiveCfg = Release|Win32 + {8D1FD5C4-7F15-4B9A-B63A-7D14D9234315}.Release|Win32.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/lua-interface.cpp b/src/lua-interface.cpp index 267a615..f560bd3 100644 --- a/src/lua-interface.cpp +++ b/src/lua-interface.cpp @@ -51,11 +51,16 @@ #ifndef _MSVC // this seems ignored under apple's gcc... dammit. +// Gah. msys doesn't support that properly either. #define WEAK __attribute__ ((weak)) #else #define WEAK #endif +#if defined(__APPLE__) || defined(__MINGW32__) +#define NO_SMART_MODULES +#endif + extern "C" { extern void luaconfigfiles_init(Lua * L) WEAK; @@ -79,6 +84,13 @@ extern void luacd_init(Lua * L) WEAK; #define main dll_main #endif +#ifdef LUA_INTERFACE_LIGHT +#define MODULES_BUILT_IN +#define LIGHT "-light" +#else +#define LIGHT +#endif + #ifdef _WIN32 #include <windows.h> @@ -312,15 +324,17 @@ int sLua_baselua_interface::baselua_interface_proceed_statics(Lua * L, int n, in case BASELUA_INTERFACE_LOADMODULE: filename = L->tostring(); if (0) { -#if !(defined(__APPLE__) || defined(MODULES_BUILT_IN)) +#if !defined(NO_SMART_MODULES) || defined(MODULES_BUILT_IN) } else if ((filename == "luaconfigfiles") && (luaconfigfiles_init != NULL)) { luaconfigfiles_init(L); +#ifndef LUA_INTERFACE_LIGHT #ifndef _MSVC } else if ((filename == "luaftgl") && (luaftgl_init != NULL)) { luaftgl_init(L); } else if ((filename == "luagl") && (luagl_init != NULL)) { luagl_init(L); #endif +#endif } else if ((filename == "luahandle") && (luahandle_init != NULL)) { luahandle_init(L); } else if ((filename == "luahttp") && (luahttp_init != NULL)) { @@ -329,18 +343,23 @@ int sLua_baselua_interface::baselua_interface_proceed_statics(Lua * L, int n, in luasmtp_init(L); } else if ((filename == "lualibs") && (lualibs_init != NULL)) { lualibs_init(L); +#ifndef LUA_INTERFACE_LIGHT #ifndef _MSVC } else if ((filename == "luaocci") && (luaocci_init != NULL)) { luaocci_init(L); #endif +#endif } else if ((filename == "luaregex") && (luaregex_init != NULL)) { luaregex_init(L); +#ifndef LUA_INTERFACE_LIGHT } else if ((filename == "luasql") && (luasql_init != NULL)) { luasql_init(L); +#endif } else if ((filename == "luatask") && (luatask_init != NULL)) { luatask_init(L); } else if ((filename == "luaxml") && (luaxml_init != NULL)) { luaxml_init(L); +#ifndef LUA_INTERFACE_LIGHT #ifndef _MSVC } else if ((filename == "luaosmesa") && (luaosmesa_init != NULL)) { luaosmesa_init(L); @@ -348,6 +367,7 @@ int sLua_baselua_interface::baselua_interface_proceed_statics(Lua * L, int n, in } else if ((filename == "luacd") && (luacd_init != NULL)) { luacd_init(L); #endif +#endif } else { LuaLoadPlugin(filename, L); } @@ -537,7 +557,7 @@ Lua * start_full_lua(void) { void showbanner() { printm(M_BARE, -"Lua-Interface version " VERSION " (c) 2003-2008 Nicolas \"Pixel\" Noble\n" +"Lua-Interface" LIGHT " version " VERSION " (c) 2003-2009 Nicolas \"Pixel\" Noble\n" LUA_RELEASE " " LUA_COPYRIGHT "\n" #ifdef WIP "Special version Work In Progress, compiled the " __DATE__ " at " __TIME__ "\n" @@ -689,7 +709,7 @@ static void * interactive_prompt(void * __L) { } void autoload_exports(Lua * L) { -#if not defined(__APPLE__) or defined(MODULES_BUILT_IN) +#if !defined(NO_SMART_MODULES) || defined(MODULES_BUILT_IN) if (lualibs_init) lualibs_init(L); if (luahandle_init) @@ -702,12 +722,15 @@ void autoload_exports(Lua * L) { luasmtp_init(L); if (luaregex_init) luaregex_init(L); +#ifndef LUA_INTERFACE_LIGHT if (luasql_init) luasql_init(L); +#endif if (luatask_init) luatask_init(L); if (luaxml_init) luaxml_init(L); +#ifndef LUA_INTERFACE_LIGHT #ifndef _MSVC if (luaftgl_init) luaftgl_init(L); @@ -721,6 +744,7 @@ void autoload_exports(Lua * L) { if (luacd_init) luacd_init(L); #endif +#endif } virtual int startup() throw (GeneralException) { |