summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile31
-rw-r--r--Makefile.mingw328
-rwxr-xr-xsrc/generate-gl-glue.sh24
-rw-r--r--src/lua-interface.cpp3
4 files changed, 56 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index a5652db..7ffcc73 100644
--- a/Makefile
+++ b/Makefile
@@ -8,6 +8,9 @@ SHARED_FLAGS=-dynamiclib
SHARED_EXT=dylib
LIBS=-liconv
LD = g++
+LDFLAGS_GL = -L/usr/X11/lib -lGLU -lGL -X11 -dylib_file \
+/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:\
+/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib
else
ARCH_FLAGS=-march=i686 -m32
LDFLAGS_MESA=-u gluNewTess -Wl,--whole-archive ../Mesa-7.3/lib/libGLU.a ../Mesa-7.3/lib/libOSMesa.a -Wl,--no-whole-archive
@@ -16,6 +19,7 @@ LDFLAGS_READLINE=/usr/lib/libreadline.a /usr/lib/libncurses.a
SHARED_FLAGS=-shared
SHARED_EXT=so
LD = g++ -m32
+LDFLAGS_GL = -lGLU -lGL
endif
CC = gcc
CXX = g++
@@ -42,7 +46,7 @@ CPPFLAGS += $(INCLUDES) -g -DSTDC_HEADERS $(CPPFLAGS_READLINE) -DHOOK_STDS -fexc
BASIC_LDFLAGS = $(ARCH_FLAGS) $(LIBS)
-LDFLAGS += $(BASIC_LDFLAGS) $(LDFLAGS_READLINE) -L/usr/lib/oracle/11.1.0.1/client/lib $(LDFLAGS_MESA)
+LDFLAGS += $(BASIC_LDFLAGS) $(LDFLAGS_READLINE) -L/usr/lib/oracle/11.1.0.1/client/lib
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
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
@@ -199,7 +203,7 @@ httplib.lua \
plugin-luaosmesa.cc \
dds.c
-WHOLE_SOURCES = $(BALTISOT_SOURCES) $(LUA_SOURCES) $(LUAINTERFACE_SOURCES)
+WHOLE_SOURCES = $(BALTISOT_SOURCES) $(LUA_SOURCES) $(LUAINTERFACE_SOURCES) gl-glue.s
DEBUG_SOURCES = $(DEBUG_MODULES)
LUAINTERFACE_OBJECTS = $(addsuffix .o, $(notdir $(basename $(LUAINTERFACE_SOURCES))))
@@ -216,17 +220,24 @@ dep: $(ALL_DEPS)
luac: $(LUAC_OBJECTS)
$(LD) -o luac $(LUAC_OBJECTS) $(BASIC_LDFLAGS)
-lua-interface.$(SHARED_EXT): $(ALL_OBJECTS)
- $(LD) $(SHARED_FLAGS) -o lua-interface.$(SHARED_EXT) $(ALL_OBJECTS) $(LDFLAGS)
+lua-interface-mesa.$(SHARED_EXT): $(ALL_OBJECTS)
+ $(LD) $(SHARED_FLAGS) -o lua-interface.$(SHARED_EXT) $(ALL_OBJECTS) $(LDFLAGS) $(LDFLAGS_MESA)
+ mv lua-interface.$(SHARED_EXT) $@
+ ln -sf $@ lua-interface.$(SHARED_EXT)
-lua-interface: lua-interface.$(SHARED_EXT) lua-interface-main.o
- $(LD) -o lua-interface ./lua-interface.$(SHARED_EXT) lua-interface-main.o
+lua-interface-gl.$(SHARED_EXT): $(ALL_OBJECTS)
+ $(LD) $(SHARED_FLAGS) -o lua-interface.$(SHARED_EXT) $(ALL_OBJECTS) $(LDFLAGS) $(LDFLAGS_GL)
+ mv lua-interface.$(SHARED_EXT) $@
+ ln -sf $@ lua-interface.$(SHARED_EXT)
+
+lua-interface: lua-interface-mesa.$(SHARED_EXT) lua-interface-main.o
+ $(LD) -o $@ ./lua-interface.$(SHARED_EXT) lua-interface-main.o
lua-interface-dbg: $(ALL_OBJECTS) $(DEBUG_OBJECTS)
$(LD) -o lua-interface-dbg $(ALL_OBJECTS) $(DEBUG_OBJECTS) $(LDFLAGS) -lfreetype -lftgl ../Mesa-7.0.3/lib/libGLU.a ../Mesa-7.0.3/lib/libOSMesa.a /usr/lib/libmysqlclient.a -locci -lclntsh `Magick++-config --libs`
clean:
- rm -f lua-interface luac *.o *.dep *.so *.dylib
+ rm -f lua-interface-mesa lua-interface-gl luac *.o *.dep *.so *.dylib
%.dep : %.c
$(CC) $(CPPFLAGS) -M -MF $@ $<
@@ -243,4 +254,10 @@ clean:
%.clua : %.lua
./luac -o $@ $<
+gl-glue.dep:
+ touch gl-glue.dep
+
+gl-glue.s:
+ src/generate-gl-glue.sh > gl-glue.s
+
-include $(ALL_DEPS)
diff --git a/Makefile.mingw32 b/Makefile.mingw32
index c734ca4..9071aa5 100644
--- a/Makefile.mingw32
+++ b/Makefile.mingw32
@@ -1,7 +1,15 @@
+SYSTEM=$(shell uname)
+ifeq ($(SYSTEM),Darwin)
+CC = i386-mingw32-gcc
+CXX = i386-mingw32-g++
+LD = i386-mingw32-g++
+STRIP = i386-mingw32-strip
+else
CC = i586-mingw32msvc-gcc
CXX = i586-mingw32msvc-g++
LD = i586-mingw32msvc-g++
STRIP = i586-mingw32msvc-strip
+endif
INCLUDES = \
-I../mogltk/include \
diff --git a/src/generate-gl-glue.sh b/src/generate-gl-glue.sh
index b5ba951..f6abf2a 100755
--- a/src/generate-gl-glue.sh
+++ b/src/generate-gl-glue.sh
@@ -4,7 +4,13 @@ base="/Users/pixel/sources/Mesa-7.2/include/GL"
files="gl.h glu.h"
-os=`uname`
+if [ "$1" != "" ] ; then
+ os=$1
+fi
+
+if [ "$os" == "" ] ; then
+ os=`uname`
+fi
for f in $files ; do cat $base/$f ; done |
grep ^GLAPI.*ENTRY |
@@ -33,15 +39,29 @@ done
echo ".subsections_via_symbols"
-else
+elif [ "$os" == "Linux" ] ; then
cat tmp-symbol-list.txt | while read symbol ; do
echo ".globl m$symbol"
echo ".type m$symbol, @function"
+ echo "m$symbol:"
echo "jmp $symbol"
echo ".size m$symbol, .-m$symbol"
done
+elif [ "$os" == "mingw32" ] ; then
+
+cat tmp-symbol-list.txt | while read symbol do
+ echo ".globl _m$symbol"
+ echo ".def _m$symbol; .scl 2; .type 32; .endef;"
+ echo "_m$symbol:"
+ echo "jmp _$symbol"
+done
+
+cat tmp-symbol-list.txt | while read symbol do
+ echo ".def _$symbol; .scl 2; .type 32; .endef;"
+done
+
fi
rm tmp-symbol-list.txt
diff --git a/src/lua-interface.cpp b/src/lua-interface.cpp
index 0765f4c..3387c00 100644
--- a/src/lua-interface.cpp
+++ b/src/lua-interface.cpp
@@ -889,7 +889,8 @@ virtual int startup() throw (GeneralException) {
if (mserver || hserver || tserver) {
TaskMan::Init();
- L->load(&Input(server_fname));
+ if (hserver)
+ L->load(&Input(server_fname));
}
if (hserver) {