summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2009-07-07 19:57:53 -0700
committerPixel <pixel@nobis-crew.org>2009-07-07 19:57:53 -0700
commit4a19ee400c7fe4fddaf1b99e63494f18a49fee2d (patch)
tree04a8d75e5a810f7b070a8f3d092b8fcfa6c459ec
parentc86ef9448280ef5f502efb3c475faa176c35aaef (diff)
Switching to Mesa-7.4.4 and adding support for Darwin fat binaries.
-rw-r--r--Makefile63
-rwxr-xr-xsrc/generate-gl-glue.sh39
2 files changed, 91 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 7d6e902..5f2258d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,9 +1,10 @@
SYSTEM=$(shell uname)
MACHINE=$(shell uname -m)
DISTRIB=$(shell cat /etc/issue | cut -f 1 -d\ | head -1)
+GL_GLUE=gl-glue.s
ifeq ($(SYSTEM),Darwin)
-ARCH_FLAGS=
-LDFLAGS_MESA=-all_load ../Mesa-7.4.2/lib/libGLU.a ../Mesa-7.4.2/lib/libOSMesa.a
+ARCH_FLAGS=-arch i386 -arch x86_64 -arch ppc -arch ppc64
+LDFLAGS_MESA=-all_load ../Mesa-7.4.4/lib/libGLU.a ../Mesa-7.4.4/lib/libmesa.a ../Mesa-7.4.4/lib/libglapi.a ../Mesa-7.4.4/lib/osmesa.o
CPPFLAGS_READLINE=
LDFLAGS_READLINE=-lreadline -lncurses
SHARED_FLAGS=-dynamiclib
@@ -13,10 +14,11 @@ 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
+GL_GLUE=gl-glue-fat.o
else
ARCH_FLAGS=-march=i686 -m32
ASFLAGS=-march=i686 --32
-LDFLAGS_MESA=-u gluNewTess -Wl,--whole-archive ../Mesa-7.4.2/lib/libGLU.a ../Mesa-7.4.2/lib/libOSMesa.a -Wl,--no-whole-archive
+LDFLAGS_MESA=-u gluNewTess -Wl,--whole-archive ../Mesa-7.4.4/lib/libGLU.a ../Mesa-7.4.4/lib/libOSMesa.a -Wl,--no-whole-archive
CPPFLAGS_READLINE=-DREADLINE_STATIC
LDFLAGS_READLINE=/usr/lib/libreadline.a /usr/lib/libncurses.a
ifeq ($(MACHINE),x86_64)
@@ -44,7 +46,7 @@ INCLUDES = \
-I../Baltisot/lib/lua/include -I../Baltisot/lib/lua/includes \
-I../lua-modules/src \
\
--I ../Mesa-7.4.2/include \
+-I ../Mesa-7.4.4/include \
-I ../tinyxml \
-I /usr/include/mysql \
-I /usr/include/FTGL -I /usr/include/freetype2 \
@@ -55,7 +57,8 @@ HAVES += -DHAVE_VSSCANF -DHAVE_LIBJPEG -DHAVE_FCNTL -DHAVE_MYSQL -DHAVE_UNISTD_H
LIBS += -lz -ldl -lpthread
-CPPFLAGS += $(INCLUDES) -g -DSTDC_HEADERS $(CPPFLAGS_READLINE) -DHOOK_STDS -fexceptions -DWORDS_LITTLEENDIAN -fexceptions $(ARCH_FLAGS) $(HAVES) -DUSE_MPQLIB
+CPPFLAGS_NO_ARCH += $(INCLUDES) -g -DSTDC_HEADERS $(CPPFLAGS_READLINE) -DHOOK_STDS -fexceptions -DWORDS_LITTLEENDIAN -fexceptions $(HAVES) -DUSE_MPQLIB
+CPPFLAGS += $(CPPFLAGS_NO_ARCH) $(ARCH_FLAGS)
BASIC_LDFLAGS += $(ARCH_FLAGS) $(LIBS)
@@ -216,7 +219,7 @@ dvdabstract.cpp \
isobuilder.cpp \
yazedc.cpp \
-WHOLE_SOURCES = $(BALTISOT_SOURCES) $(LUA_SOURCES) $(LUAINTERFACE_SOURCES) gl-glue.s
+WHOLE_SOURCES = $(BALTISOT_SOURCES) $(LUA_SOURCES) $(LUAINTERFACE_SOURCES) $(GL_GLUE)
DEBUG_SOURCES = $(DEBUG_MODULES)
LUAINTERFACE_OBJECTS = $(addsuffix .o, $(notdir $(basename $(LUAINTERFACE_SOURCES))))
@@ -258,13 +261,13 @@ clean:
rm -f lua-interface-mesa lua-interface-gl luac *.o *.dep *.so *.dylib
%.dep : %.c
- $(CC) $(CPPFLAGS) -M -MF $@ $<
+ $(CC) $(CPPFLAGS_NO_ARCH) -M -MF $@ $<
%.dep : %.cpp
- $(CXX) $(CPPFLAGS) -M -MF $@ $<
+ $(CXX) $(CPPFLAGS_NO_ARCH) -M -MF $@ $<
%.dep : %.cc
- $(CXX) $(CPPFLAGS) -M -MF $@ $<
+ $(CXX) $(CPPFLAGS_NO_ARCH) -M -MF $@ $<
%.c : %.clua
bin2c $< $@ $(basename $@)
@@ -272,12 +275,54 @@ clean:
%.clua : %.lua
./luac -o $@ $<
+gl-glue-i386.dep:
+ touch gl-glue-i386.dep
+
+gl-glue-x86_64.dep:
+ touch gl-glue-x86_64.dep
+
+gl-glue-ppc.dep:
+ touch gl-glue-ppc.dep
+
+gl-glue-ppc64.dep:
+ touch gl-glue-ppc64.dep
+
gl-glue.dep:
touch gl-glue.dep
+gl-glue-fat.dep:
+ touch gl-glue-fat.dep
+
+gl-glue-i386.s:
+ src/generate-gl-glue.sh $(SYSTEM) i386 > gl-glue-i386.s
+
+gl-glue-x86_64.s:
+ src/generate-gl-glue.sh $(SYSTEM) x86_64 > gl-glue-x86_64.s
+
+gl-glue-ppc.s:
+ src/generate-gl-glue.sh $(SYSTEM) ppc > gl-glue-ppc.s
+
+gl-glue-ppc64.s:
+ src/generate-gl-glue.sh $(SYSTEM) ppc64 > gl-glue-ppc64.s
+
gl-glue.s:
src/generate-gl-glue.sh > gl-glue.s
+gl-glue-i386.o: gl-glue-i386.s
+ as -arch i386 $< -o $@
+
+gl-glue-x86_64.o: gl-glue-x86_64.s
+ as -arch x86_64 $< -o $@
+
+gl-glue-ppc.o: gl-glue-ppc.s
+ as -arch ppc $< -o $@
+
+gl-glue-ppc64.o: gl-glue-ppc64.s
+ as -arch ppc64 $< -o $@
+
+gl-glue-fat.o: gl-glue-i386.o gl-glue-x86_64.o gl-glue-ppc.o gl-glue-ppc64.o
+ lipo -create $^ -output $@
+
-include $(ALL_DEPS)
.PHONY: dist
diff --git a/src/generate-gl-glue.sh b/src/generate-gl-glue.sh
index b0c5fbb..9a58334 100755
--- a/src/generate-gl-glue.sh
+++ b/src/generate-gl-glue.sh
@@ -1,8 +1,9 @@
#!/bin/sh
-base=`pwd`/../Mesa-7.4.2/include/GL
+base=`pwd`/../Mesa-7.4.4/include/GL
files="gl.h glu.h"
+arch=i386
if [ "$1" != "" ] ; then
os=$1
@@ -12,6 +13,10 @@ if [ "$os" == "" ] ; then
os=`uname`
fi
+if [ "$2" != "" ] ; then
+ arch=$2
+fi
+
for f in $files ; do cat $base/$f ; done |
grep ^GLAPI.*ENTRY |
sed 's/GLAPI\ .*\ .*ENTRY\ \([^\ ]*\)\ *(.*/\1/' |
@@ -20,15 +25,43 @@ for f in $files ; do cat $base/$f ; done |
grep -v EXT\$ |
sort -u > tmp-symbol-list.txt
+if [ "$arch" == "ppc" ] || [ "$arch" == "ppc64" ] ; then
+ echo ".section __TEXT,__text,regular,pure_instructions"
+ echo ".section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32"
+ if [ "$arch" == "ppc" ] ; then
+ echo ".machine ppc7400"
+ else
+ echo ".machine ppc64"
+ fi
+fi
+
echo ".text"
if [ "$os" == "Darwin" ] ; then
+if [ "$arch" == "ppc" ] || [ "$arch" == "ppc64" ] ; then
+ echo ".p2align 4,,15"
+fi
+
cat tmp-symbol-list.txt | while read symbol ; do
+ if [ "$arch" != "i386" ] ; then
+ echo ".globl _$symbol"
+ fi
echo ".globl _m$symbol"
echo "_m$symbol:"
- echo "jmp L_$symbol\$stub"
+ case "$arch" in
+ x86_64)
+ echo "jmp _$symbol"
+ ;;
+ i386)
+ echo "jmp L_$symbol\$stub"
+ ;;
+ *)
+ echo "b _$symbol"
+ esac
done
+if [ "$arch" == "i386" ] ; then
+
echo ".section __IMPORT,__jump_table,symbol_stubs,self_modifying_code+pure_instructions,5"
cat tmp-symbol-list.txt | while read symbol ; do
@@ -39,6 +72,8 @@ done
echo ".subsections_via_symbols"
+fi
+
elif [ "$os" == "Linux" ] ; then
cat tmp-symbol-list.txt | while read symbol ; do