summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile.mingw3215
-rw-r--r--src/lua-interface.cpp32
2 files changed, 40 insertions, 7 deletions
diff --git a/Makefile.mingw32 b/Makefile.mingw32
index 834dc72..ce41902 100644
--- a/Makefile.mingw32
+++ b/Makefile.mingw32
@@ -6,18 +6,19 @@ STRIP = i586-mingw32msvc-strip
INCLUDES = \
-I../mogltk/include \
-I../Baltisot/include \
--I../Baltisot/lib/zlib/include \
-I../Baltisot/lib/lua/include -I../Baltisot/lib/lua/includes \
-I../lua-modules/src \
-I../Baltisot/MSVC/iconv -I../Baltisot/MSVC/regex -I../Baltisot/MSVC \
--I../Mesa-7.0.3-win32/include \
+-I../Mesa-7.0.3-mingw32/include \
-I../pthreads-w32-2-8-0-release/ \
+-I../gnuwin32/include
HAVES = -DHAVE_VSSCANF -DHAVE_LIBJPEG -DHAVE_MALLOC_H -DHAVE_BYTESWAP_H
CPPFLAGS += $(INCLUDES) -g -fexceptions -DLUATASK_OMIT_COMMAND -DSTDC_HEADERS -DLIBICONV_PLUG -DREADLINE_STATIC -fexceptions -DWORDS_LITTLEENDIAN -march=i686 $(HAVES) -DUSE_MPQLIB
-LDFLAGS += -g -fexceptions -Wl,--enable-auto-image-base -Wl,--export-dynamic --export-all-symbols -Wl,--enable-auto-import -fexceptions ../libreadline-static.a ../libz.a -lwsock32 -lws2_32 ../pthreads-w32-2-8-0-release/libpthreadGC2.a --enable-stdcall-fixup
+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 -lwsock32 -lws2_32 ../pthreads-w32-2-8-0-release/libpthreadGC2.a --enable-stdcall-fixup
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
@@ -25,12 +26,14 @@ vpath %.cpp ../Baltisot/lib:../Baltisot/src:../Baltisot/lib/zlib/src:../Baltisot
vpath %.lua ../Baltisot/lib:../Baltisot/src
LUAINTERFACE_SOURCES = \
-lua-interface.cc \
-lua-plugin.cc \
+lua-interface-win32-main.c \
-LUAINTERFACE_LDFLAGS = -Wl,--whole-archive ../Mesa-7.0.3-win32/lib/libGLU.a ../Mesa-7.0.3-win32/lib/libOSMesa.a -Wl,--no-whole-archive
+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 = \
+lua-interface.cc \
+lua-plugin.cc \
+\
Main.cc \
\
RandISAAC.cc \
diff --git a/src/lua-interface.cpp b/src/lua-interface.cpp
index 3958ddb..0649119 100644
--- a/src/lua-interface.cpp
+++ b/src/lua-interface.cpp
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: lua-interface.cpp,v 1.9 2008-08-05 15:03:54 pixel Exp $ */
+/* $Id: lua-interface.cpp,v 1.10 2008-08-06 11:55:03 pixel Exp $ */
#define WIP
@@ -66,6 +66,7 @@ extern void luaosmesa_init(Lua * L) __attribute__ ((weak));
}
#ifdef _WIN32
+#define main win32_dll_main
#include <windows.h>
#include <ctype.h>
@@ -856,3 +857,32 @@ virtual int startup() throw (GeneralException) {
return 0;
}
CODE_ENDS
+
+#ifdef _WIN32
+extern "C" {
+
+int ffs(int i) {
+ register int bit = 0;
+ if (i != 0) {
+ if ((i & 0xffff) == 0) {
+ bit += 16;
+ i >>= 16;
+ }
+ if ((i & 0xff) == 0) {
+ bit += 8;
+ i >>= 8;
+ }
+ if ((i & 0xf) == 0) {
+ bit += 4;
+ i >>= 4;
+ }
+ while ((i & 1) == 0) {
+ bit++;
+ i >>= 1;
+ }
+ }
+ return bit;
+}
+
+}
+#endif