From 76fb8089103e9dba9aaa7232c86d864d5874a08f Mon Sep 17 00:00:00 2001 From: Zhang Date: Sat, 21 Jul 2007 11:28:06 -0600 Subject: Fix a number of MINGW32 issues --- src/glu/sgi/Makefile.mgw | 229 +++++++++++++++++++++++++++ src/glu/sgi/libnurbs/interface/glcurveval.h | 2 +- src/glu/sgi/libnurbs/interface/glsurfeval.cc | 7 +- src/glu/sgi/libnurbs/interface/glsurfeval.h | 2 +- src/glut/glx/Makefile.mgw | 198 +++++++++++++++++++++++ src/glut/glx/glut_fbc.c | 4 +- src/glut/glx/glutint.h | 3 + src/glut/glx/win32_winproc.c | 3 + src/mesa/Makefile.mgw | 51 ++++-- src/mesa/drivers/windows/gdi/wgl.c | 57 ++++--- src/mesa/drivers/windows/gdi/wmesa.c | 7 +- src/mesa/drivers/windows/gdi/wmesadef.h | 4 +- src/mesa/main/glheader.h | 2 +- src/mesa/main/imports.c | 4 + src/mesa/main/imports.h | 4 + src/mesa/main/shaders.c | 8 +- src/mesa/main/texcompress_fxt1.c | 5 + 17 files changed, 544 insertions(+), 46 deletions(-) create mode 100644 src/glu/sgi/Makefile.mgw create mode 100644 src/glut/glx/Makefile.mgw (limited to 'src') diff --git a/src/glu/sgi/Makefile.mgw b/src/glu/sgi/Makefile.mgw new file mode 100644 index 0000000000..43b421e737 --- /dev/null +++ b/src/glu/sgi/Makefile.mgw @@ -0,0 +1,229 @@ +# Mesa 3-D graphics library +# Version: 5.1 +# +# Copyright (C) 1999-2003 Brian Paul All Rights Reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +# MinGW core makefile v1.4 for Mesa +# +# Copyright (C) 2002 - Daniel Borca +# Email : dborca@users.sourceforge.net +# Web : http://www.geocities.com/dborca + +# MinGW core-glu makefile updated for Mesa 7.0 +# +# Updated : by Heromyth, on 2007-7-21 +# Email : zxpmyth@yahoo.com.cn +# Bugs : 1) All the default settings work fine. But the setting X86=1 can't work. +# The others havn't been tested yet. +# 2) The generated DLLs are *not* compatible with the ones built +# with the other compilers like VC8, especially for GLUT. +# 3) Although more tests are needed, it can be used individually! + +# +# Available options: +# +# Environment variables: +# CFLAGS +# +# GLIDE path to Glide3 SDK; used with FX. +# default = $(TOP)/glide3 +# FX=1 build for 3dfx Glide3. Note that this disables +# compilation of most WMesa code and requires fxMesa. +# As a consequence, you'll need the Win32 Glide3 +# library to build any application. +# default = no +# ICD=1 build the installable client driver interface +# (windows opengl driver interface) +# default = no +# X86=1 optimize for x86 (if possible, use MMX, SSE, 3DNow). +# default = no +# +# Targets: +# all: build GL +# clean: remove object files +# + + + +.PHONY: all clean +.INTERMEDIATE: x86/gen_matypes.exe +.SUFFIXES: .rc .res + +# Set this to the prefix of your build tools, i.e. mingw32- +TOOLS_PREFIX = mingw32- + +TOP = ../../.. + +LIBDIR = $(TOP)/lib + +GLU_DLL = glu32.dll +GLU_IMP = libglu32.a +GLU_DEF = glu.def + +include $(TOP)/configs/config.mgw +GL_USING_STDCALL ?= 1 + +LDLIBS = -L$(LIBDIR) -lopengl32 +LDFLAGS = -Wl,--out-implib=$(LIBDIR)/$(GLU_IMP) -Wl,--output-def=$(LIBDIR)/$(GLU_DEF) + +CFLAGS += -DBUILD_GLU32 -D_DLL + +ifeq ($(GL_USING_STDCALL),1) + LDFLAGS += -Wl,--add-stdcall-alias +else + CFLAGS += -DGL_NO_STDCALL +endif + +CC = gcc +CFLAGS += -DNDEBUG -DLIBRARYBUILD -I$(TOP)/include -Iinclude +CXX = g++ +CXXFLAGS = $(CFLAGS) -Ilibnurbs/internals -Ilibnurbs/interface -Ilibnurbs/nurbtess + +AR = ar +ARFLAGS = crus + +UNLINK = del $(subst /,\,$(1)) +ifneq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),) +UNLINK = $(RM) $(1) +endif +ifneq ($(wildcard $(addsuffix /rm,$(subst :, ,$(PATH)))),) +UNLINK = $(RM) $(1) +endif + +C_SOURCES = \ + libutil/error.c \ + libutil/glue.c \ + libutil/mipmap.c \ + libutil/project.c \ + libutil/quad.c \ + libutil/registry.c \ + libtess/dict.c \ + libtess/geom.c \ + libtess/memalloc.c \ + libtess/mesh.c \ + libtess/normal.c \ + libtess/priorityq.c \ + libtess/render.c \ + libtess/sweep.c \ + libtess/tess.c \ + libtess/tessmono.c + +CC_SOURCES = \ + libnurbs/interface/bezierEval.cc \ + libnurbs/interface/bezierPatch.cc \ + libnurbs/interface/bezierPatchMesh.cc \ + libnurbs/interface/glcurveval.cc \ + libnurbs/interface/glinterface.cc \ + libnurbs/interface/glrenderer.cc \ + libnurbs/interface/glsurfeval.cc \ + libnurbs/interface/incurveeval.cc \ + libnurbs/interface/insurfeval.cc \ + libnurbs/internals/arc.cc \ + libnurbs/internals/arcsorter.cc \ + libnurbs/internals/arctess.cc \ + libnurbs/internals/backend.cc \ + libnurbs/internals/basiccrveval.cc \ + libnurbs/internals/basicsurfeval.cc \ + libnurbs/internals/bin.cc \ + libnurbs/internals/bufpool.cc \ + libnurbs/internals/cachingeval.cc \ + libnurbs/internals/ccw.cc \ + libnurbs/internals/coveandtiler.cc \ + libnurbs/internals/curve.cc \ + libnurbs/internals/curvelist.cc \ + libnurbs/internals/curvesub.cc \ + libnurbs/internals/dataTransform.cc \ + libnurbs/internals/displaylist.cc \ + libnurbs/internals/flist.cc \ + libnurbs/internals/flistsorter.cc \ + libnurbs/internals/hull.cc \ + libnurbs/internals/intersect.cc \ + libnurbs/internals/knotvector.cc \ + libnurbs/internals/mapdesc.cc \ + libnurbs/internals/mapdescv.cc \ + libnurbs/internals/maplist.cc \ + libnurbs/internals/mesher.cc \ + libnurbs/internals/monoTriangulationBackend.cc \ + libnurbs/internals/monotonizer.cc \ + libnurbs/internals/mycode.cc \ + libnurbs/internals/nurbsinterfac.cc \ + libnurbs/internals/nurbstess.cc \ + libnurbs/internals/patch.cc \ + libnurbs/internals/patchlist.cc \ + libnurbs/internals/quilt.cc \ + libnurbs/internals/reader.cc \ + libnurbs/internals/renderhints.cc \ + libnurbs/internals/slicer.cc \ + libnurbs/internals/sorter.cc \ + libnurbs/internals/splitarcs.cc \ + libnurbs/internals/subdivider.cc \ + libnurbs/internals/tobezier.cc \ + libnurbs/internals/trimline.cc \ + libnurbs/internals/trimregion.cc \ + libnurbs/internals/trimvertpool.cc \ + libnurbs/internals/uarray.cc \ + libnurbs/internals/varray.cc \ + libnurbs/nurbtess/directedLine.cc \ + libnurbs/nurbtess/gridWrap.cc \ + libnurbs/nurbtess/monoChain.cc \ + libnurbs/nurbtess/monoPolyPart.cc \ + libnurbs/nurbtess/monoTriangulation.cc \ + libnurbs/nurbtess/partitionX.cc \ + libnurbs/nurbtess/partitionY.cc \ + libnurbs/nurbtess/polyDBG.cc \ + libnurbs/nurbtess/polyUtil.cc \ + libnurbs/nurbtess/primitiveStream.cc \ + libnurbs/nurbtess/quicksort.cc \ + libnurbs/nurbtess/rectBlock.cc \ + libnurbs/nurbtess/sampleComp.cc \ + libnurbs/nurbtess/sampleCompBot.cc \ + libnurbs/nurbtess/sampleCompRight.cc \ + libnurbs/nurbtess/sampleCompTop.cc \ + libnurbs/nurbtess/sampleMonoPoly.cc \ + libnurbs/nurbtess/sampledLine.cc \ + libnurbs/nurbtess/searchTree.cc + +SOURCES = $(C_SOURCES) $(CC_SOURCES) + +OBJECTS = $(addsuffix .o,$(basename $(SOURCES))) + +.c.o: + $(CC) -o $@ $(CFLAGS) -c $< +.cc.o: + $(CXX) -o $@ $(CXXFLAGS) -c $< + + +all: $(LIBDIR) $(LIBDIR)/$(GLU_DLL) $(LIBDIR)/$(GLU_IMP) + +$(LIBDIR): + mkdir -p $(LIBDIR) + +$(LIBDIR)/$(GLU_DLL) $(LIBDIR)/$(GLU_IMP): $(OBJECTS) + g++ -shared -fPIC -o $(LIBDIR)/$(GLU_DLL) $(LDFLAGS) \ + $^ $(LDLIBS) + + + +clean: + -$(call UNLINK,libutil/*.o) + -$(call UNLINK,libtess/*.o) + -$(call UNLINK,libnurbs/interface/*.o) + -$(call UNLINK,libnurbs/internals/*.o) + -$(call UNLINK,libnurbs/nurbtess/*.o) diff --git a/src/glu/sgi/libnurbs/interface/glcurveval.h b/src/glu/sgi/libnurbs/interface/glcurveval.h index 4b44f6e847..a09a74d04c 100644 --- a/src/glu/sgi/libnurbs/interface/glcurveval.h +++ b/src/glu/sgi/libnurbs/interface/glcurveval.h @@ -93,7 +93,7 @@ public: output_triangles = flag; } #ifdef _WIN32 - void putCallBack(GLenum which, void (APIENTRY *fn)() ); + void putCallBack(GLenum which, void (GLAPIENTRY *fn)() ); #else void putCallBack(GLenum which, _GLUfuncptr fn ); #endif diff --git a/src/glu/sgi/libnurbs/interface/glsurfeval.cc b/src/glu/sgi/libnurbs/interface/glsurfeval.cc index a36b304508..b5bfab1e28 100644 --- a/src/glu/sgi/libnurbs/interface/glsurfeval.cc +++ b/src/glu/sgi/libnurbs/interface/glsurfeval.cc @@ -1184,8 +1184,11 @@ return; } -void -OpenGLSurfaceEvaluator::putCallBack(GLenum which, _GLUfuncptr fn ) +#ifdef _WIN32 +void OpenGLSurfaceEvaluator::putCallBack(GLenum which, void (GLAPIENTRY *fn)() ) +#else +void OpenGLSurfaceEvaluator::putCallBack(GLenum which, _GLUfuncptr fn ) +#endif { switch(which) { diff --git a/src/glu/sgi/libnurbs/interface/glsurfeval.h b/src/glu/sgi/libnurbs/interface/glsurfeval.h index c34a58cb9b..b7a88069f5 100644 --- a/src/glu/sgi/libnurbs/interface/glsurfeval.h +++ b/src/glu/sgi/libnurbs/interface/glsurfeval.h @@ -145,7 +145,7 @@ public: void newtmeshvert( long, long ); #ifdef _WIN32 - void putCallBack(GLenum which, void (APIENTRY *fn)() ); + void putCallBack(GLenum which, void (GLAPIENTRY *fn)() ); #else void putCallBack(GLenum which, _GLUfuncptr fn ); #endif diff --git a/src/glut/glx/Makefile.mgw b/src/glut/glx/Makefile.mgw new file mode 100644 index 0000000000..ae4eb6addc --- /dev/null +++ b/src/glut/glx/Makefile.mgw @@ -0,0 +1,198 @@ +# Mesa 3-D graphics library +# Version: 5.1 +# +# Copyright (C) 1999-2003 Brian Paul All Rights Reserved. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +# MinGW core makefile v1.4 for Mesa +# +# Copyright (C) 2002 - Daniel Borca +# Email : dborca@users.sourceforge.net +# Web : http://www.geocities.com/dborca + +# MinGW core-glut makefile updated for Mesa 7.0 +# +# Updated : by Heromyth, on 2007-7-21 +# Email : zxpmyth@yahoo.com.cn +# Bugs : 1) All the default settings work fine. But the setting X86=1 can't work. +# The others havn't been tested yet. +# 2) The generated DLLs are *not* compatible with the ones built +# with the other compilers like VC8, especially for GLUT. +# 3) Although more tests are needed, it can be used individually! + + +# +# Available options: +# +# Environment variables: +# CFLAGS +# +# GLIDE path to Glide3 SDK; used with FX. +# default = $(TOP)/glide3 +# FX=1 build for 3dfx Glide3. Note that this disables +# compilation of most WMesa code and requires fxMesa. +# As a consequence, you'll need the Win32 Glide3 +# library to build any application. +# default = no +# ICD=1 build the installable client driver interface +# (windows opengl driver interface) +# default = no +# X86=1 optimize for x86 (if possible, use MMX, SSE, 3DNow). +# default = no +# +# Targets: +# all: build GL +# clean: remove object files +# + + + +.PHONY: all clean +.INTERMEDIATE: x86/gen_matypes.exe +.SUFFIXES: .rc .res + +# Set this to the prefix of your build tools, i.e. mingw32- +TOOLS_PREFIX = mingw32- + +TOP = ../../.. + +LIBDIR = $(TOP)/lib + +GLUT_DLL = glut32.dll +GLUT_IMP = libglut32.a +GLUT_DEF = glut.def + +include $(TOP)/configs/config.mgw +GLUT_USING_STDCALL ?= 1 + + + +LDLIBS = -L$(LIBDIR) -lwinmm -lgdi32 -luser32 -lopengl32 -lglu32 +LDFLAGS = -Wl,--out-implib=$(LIBDIR)/$(GLUT_IMP) -Wl,--output-def=$(LIBDIR)/$(GLUT_DEF) + +CFLAGS += -DBUILD_GLUT32 -DGLUT_BUILDING_LIB -DMESA -D_DLL + +ifeq ($(GL_USING_STDCALL),0) + CFLAGS += -DGL_NO_STDCALL +endif + +ifeq ($(GLUT_USING_STDCALL),1) + CFLAGS += -D_STDCALL_SUPPORTED + LDFLAGS += -Wl,--add-stdcall-alias +else + CFLAGS += -DGLUT_NO_STDCALL +endif + +CFLAGS += -DNDEBUG -DLIBRARYBUILD -I$(TOP)/include + +CC = gcc +CXX = g++ +CXXFLAGS = $(CFLAGS) + +AR = ar +ARFLAGS = crus + +UNLINK = del $(subst /,\,$(1)) +ifneq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),) +UNLINK = $(RM) $(1) +endif +ifneq ($(wildcard $(addsuffix /rm,$(subst :, ,$(PATH)))),) +UNLINK = $(RM) $(1) +endif + +HDRS = glutint.h glutstroke.h glutbitmap.h glutwin32.h stroke.h win32_glx.h win32_x11.h + +SRCS = \ + glut_bitmap.c \ + glut_bwidth.c \ + glut_cindex.c \ + glut_cmap.c \ + glut_cursor.c \ + glut_dials.c \ + glut_dstr.c \ + glut_event.c \ + glut_ext.c \ + glut_fbc.c \ + glut_fullscrn.c \ + glut_gamemode.c \ + glut_get.c \ + glut_init.c \ + glut_input.c \ + glut_joy.c \ + glut_key.c \ + glut_keyctrl.c \ + glut_keyup.c \ + glut_mesa.c \ + glut_modifier.c \ + glut_overlay.c \ + glut_shapes.c \ + glut_space.c \ + glut_stroke.c \ + glut_swap.c \ + glut_swidth.c \ + glut_tablet.c \ + glut_teapot.c \ + glut_util.c \ + glut_vidresize.c \ + glut_warp.c \ + glut_win.c \ + glut_winmisc.c \ + win32_glx.c \ + win32_menu.c \ + win32_util.c \ + win32_winproc.c \ + win32_x11.c + + +SRCSSEMIGENS = \ + glut_8x13.c \ + glut_9x15.c \ + glut_hel10.c \ + glut_hel12.c \ + glut_hel18.c \ + glut_mroman.c \ + glut_roman.c \ + glut_tr10.c \ + glut_tr24.c + + + +SOURCES = $(SRCS) $(SRCSSEMIGENS) + +OBJECTS = $(addsuffix .o,$(basename $(SOURCES))) + +.c.o: + $(CC) -o $@ $(CFLAGS) -c $< +.cc.o: + $(CXX) -o $@ $(CXXFLAGS) -c $< + + +all: $(LIBDIR) $(LIBDIR)/$(GLUT_DLL) $(LIBDIR)/$(GLUT_IMP) + +$(LIBDIR): + mkdir -p $(LIBDIR) + +$(LIBDIR)/$(GLUT_DLL) $(LIBDIR)/$(GLUT_IMP): $(OBJECTS) + $(CXX) -shared -fPIC -o $(LIBDIR)/$(GLUT_DLL) $(LDFLAGS) \ + $^ $(LDLIBS) + + + +clean: + -$(call UNLINK,*.o) \ No newline at end of file diff --git a/src/glut/glx/glut_fbc.c b/src/glut/glx/glut_fbc.c index deb46c3d8d..e93188b862 100644 --- a/src/glut/glx/glut_fbc.c +++ b/src/glut/glx/glut_fbc.c @@ -18,7 +18,7 @@ /* Set a Fortran callback function. */ -void GLUTAPIENTRY +void APIENTRY __glutSetFCB(int which, void *func) { #ifdef SUPPORT_FORTRAN @@ -100,7 +100,7 @@ __glutSetFCB(int which, void *func) /* Get a Fortran callback function. */ -void* GLUTAPIENTRY +void* APIENTRY __glutGetFCB(int which) { #ifdef SUPPORT_FORTRAN diff --git a/src/glut/glx/glutint.h b/src/glut/glx/glutint.h index 6fe09ffe7e..a962c78023 100644 --- a/src/glut/glx/glutint.h +++ b/src/glut/glx/glutint.h @@ -26,7 +26,10 @@ #include #endif +#ifndef GLUT_BUILDING_LIB #define GLUT_BUILDING_LIB /* Building the GLUT library itself. */ +#endif + #include #if defined(MESA) && defined(_WIN32) && !defined(__CYGWIN32__) diff --git a/src/glut/glx/win32_winproc.c b/src/glut/glx/win32_winproc.c index a54bac75fa..e1fc785ebb 100644 --- a/src/glut/glx/win32_winproc.c +++ b/src/glut/glx/win32_winproc.c @@ -9,6 +9,9 @@ #include "glutint.h" #include +#ifdef __MINGW32__ +#include +#endif #if defined(_WIN32) && !defined(__CYGWIN32__) #include /* Win32 Multimedia API header. */ diff --git a/src/mesa/Makefile.mgw b/src/mesa/Makefile.mgw index ebec5c055a..3b52834bd1 100644 --- a/src/mesa/Makefile.mgw +++ b/src/mesa/Makefile.mgw @@ -1,5 +1,5 @@ # Mesa 3-D graphics library -# Version: 5.1 +# Version: 7.0 # # Copyright (C) 1999-2003 Brian Paul All Rights Reserved. # @@ -26,6 +26,16 @@ # Email : dborca@users.sourceforge.net # Web : http://www.geocities.com/dborca +# MinGW core-gl makefile updated for Mesa 7.0 +# +# updated : by Heromyth, on 2007-7-21 +# Email : zxpmyth@yahoo.com.cn +# Bugs : 1) All the default settings work fine. But the setting X86=1 can't work. +# The others havn't been tested yet. +# 2) The generated DLLs are *not* compatible with the ones built +# with the other compilers like VC8, especially for GLUT. +# 3) Although more tests are needed, it can be used individually! + # # Available options: @@ -52,7 +62,6 @@ # - .PHONY: all clean .INTERMEDIATE: x86/gen_matypes.exe .SUFFIXES: .rc .res @@ -60,6 +69,8 @@ # Set this to the prefix of your build tools, i.e. mingw32- TOOLS_PREFIX = mingw32- + + TOP = ../.. GLIDE ?= $(TOP)/glide3 LIBDIR = $(TOP)/lib @@ -71,11 +82,25 @@ else GL_IMP = libopengl32.a endif -LDLIBS = -lgdi32 +GL_DEF = gl.def + +include $(TOP)/configs/config.mgw +GL_USING_STDCALL ?= 1 + +MESA_LIB = libmesa.a + +LDLIBS = -lgdi32 -luser32 -liberty +LDFLAGS = -Wl,--out-implib=$(LIBDIR)/$(GL_IMP) -Wl,--output-def=$(LIBDIR)/gl.def CC = $(TOOLS_PREFIX)gcc -CFLAGS += -DBUILD_GL32 -D_OPENGL32_ -CFLAGS += $(INCLUDE_DIRS) +CFLAGS += -DBUILD_GL32 -D_OPENGL32_ -D_DLL -DMESA_MINWARN -DNDEBUG -D_USRDLL -DGDI_EXPORTS + +ifeq ($(GL_USING_STDCALL),1) + LDFLAGS += -Wl,--add-stdcall-alias +else + CFLAGS += -DGL_NO_STDCALL +endif + CFLAGS += -DUSE_EXTERNAL_DXTN_LIB=1 ifeq ($(FX),1) CFLAGS += -I$(GLIDE)/include -DFX @@ -104,6 +129,8 @@ endif include sources +CFLAGS += $(INCLUDE_DIRS) + ifeq ($(X86),1) CFLAGS += -DUSE_X86_ASM CFLAGS += -DUSE_MMX_ASM @@ -140,10 +167,9 @@ RESOURCE = $(GL_RES:.rc=.res) .c.o: $(CC) -o $@ $(CFLAGS) -c $< -.S.o: - $(CC) -o $@ $(CFLAGS) -c $< .s.o: $(CC) -o $@ $(CFLAGS) -x assembler-with-cpp -c $< + .rc.res: windres -o $@ -Irc -Ocoff $< @@ -153,9 +179,8 @@ $(LIBDIR): mkdir -p $(LIBDIR) $(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP): $(OBJECTS) $(RESOURCE) - $(TOOLS_PREFIX)dllwrap -o $(LIBDIR)/$(GL_DLL) --output-lib $(LIBDIR)/$(GL_IMP) \ - --target i386-mingw32 --def $(GL_DEF) -Wl,-enable-stdcall-fixup \ - $^ $(LDLIBS) + $(CC) -shared -fPIC -o $(LIBDIR)/$(GL_DLL) $(LDFLAGS) \ + $^ $(LDLIBS) $(X86_OBJECTS): x86/matypes.h @@ -187,17 +212,21 @@ tnl/t_vtx_x86_gcc.o: tnl/t_vtx_x86_gcc.S $(CC) -o $@ $(CFLAGS) -DSTDCALL_API -c $< clean: - -$(call UNLINK,array_cache/*.o) -$(call UNLINK,glapi/*.o) -$(call UNLINK,main/*.o) -$(call UNLINK,math/*.o) + -$(call UNLINK,vbo/*.o) -$(call UNLINK,shader/*.o) + -$(call UNLINK,shader/slang/*.o) + -$(call UNLINK,shader/grammar/*.o) -$(call UNLINK,sparc/*.o) -$(call UNLINK,ppc/*.o) -$(call UNLINK,swrast/*.o) -$(call UNLINK,swrast_setup/*.o) -$(call UNLINK,tnl/*.o) -$(call UNLINK,x86/*.o) + -$(call UNLINK,x86/rtasm/*.o) + -$(call UNLINK,x86-64/*.o) -$(call UNLINK,drivers/common/*.o) -$(call UNLINK,drivers/glide/*.o) -$(call UNLINK,drivers/windows/fx/*.o) diff --git a/src/mesa/drivers/windows/gdi/wgl.c b/src/mesa/drivers/windows/gdi/wgl.c index fb23d210db..dad3dc1160 100644 --- a/src/mesa/drivers/windows/gdi/wgl.c +++ b/src/mesa/drivers/windows/gdi/wgl.c @@ -33,15 +33,30 @@ /* We're essentially building part of GDI here, so define this so that * we get the right export linkage. */ #ifdef __MINGW32__ -#include + +#include +#include +#include +#include + +# if defined(BUILD_GL32) +# define WINGDIAPI __declspec(dllexport) +# else +# define __W32API_USE_DLLIMPORT__ +# endif + +#include +#include "GL/mesa_wgl.h" #include + #else + #define _GDI32_ -#endif #include -#include "glapi.h" +#endif +#include "glapi.h" #include "GL/wmesa.h" /* protos for wmesa* functions */ /* @@ -339,7 +354,7 @@ WINGDIAPI int GLAPIENTRY wglGetPixelFormat(HDC hdc) } WINGDIAPI BOOL GLAPIENTRY wglSetPixelFormat(HDC hdc,int iPixelFormat, - const PIXELFORMATDESCRIPTOR *ppfd) + const PIXELFORMATDESCRIPTOR *ppfd) { (void) hdc; @@ -392,12 +407,12 @@ static BOOL wglUseFontBitmaps_FX(HDC fontDevice, DWORD firstChar, bitDevice = CreateCompatibleDC(fontDevice); - // Swap fore and back colors so the bitmap has the right polarity + /* Swap fore and back colors so the bitmap has the right polarity */ tempColor = GetBkColor(bitDevice); SetBkColor(bitDevice, GetTextColor(bitDevice)); SetTextColor(bitDevice, tempColor); - // Place chars based on base line + /* Place chars based on base line */ VERIFY(SetTextAlign(bitDevice, TA_BASELINE) != GDI_ERROR ? 1 : 0); for(i = 0; i < (int)numChars; i++) { @@ -410,36 +425,36 @@ static BOOL wglUseFontBitmaps_FX(HDC fontDevice, DWORD firstChar, curChar = (char)(i + firstChar); - // Find how high/wide this character is + /* Find how high/wide this character is */ VERIFY(GetTextExtentPoint32(bitDevice, &curChar, 1, &size)); - // Create the output bitmap + /* Create the output bitmap */ charWidth = size.cx; charHeight = size.cy; - // Round up to the next multiple of 32 bits + /* Round up to the next multiple of 32 bits */ bmapWidth = ((charWidth + 31) / 32) * 32; bmapHeight = charHeight; bitObject = CreateCompatibleBitmap(bitDevice, bmapWidth, bmapHeight); - //VERIFY(bitObject); + /* VERIFY(bitObject); */ - // Assign the output bitmap to the device + /* Assign the output bitmap to the device */ origBmap = SelectObject(bitDevice, bitObject); (void) VERIFY(origBmap); VERIFY( PatBlt( bitDevice, 0, 0, bmapWidth, bmapHeight,BLACKNESS ) ); - // Use our source font on the device + /* Use our source font on the device */ VERIFY(SelectObject(bitDevice, GetCurrentObject(fontDevice,OBJ_FONT))); - // Draw the character + /* Draw the character */ VERIFY(TextOut(bitDevice, 0, metric.tmAscent, &curChar, 1)); - // Unselect our bmap object + /* Unselect our bmap object */ VERIFY(SelectObject(bitDevice, origBmap)); - // Convert the display dependant representation to a 1 bit deep DIB + /* Convert the display dependant representation to a 1 bit deep DIB */ numBytes = (bmapWidth * bmapHeight) / 8; bmap = malloc(numBytes); dibInfo->bmiHeader.biWidth = bmapWidth; @@ -447,24 +462,24 @@ static BOOL wglUseFontBitmaps_FX(HDC fontDevice, DWORD firstChar, res = GetDIBits(bitDevice, bitObject, 0, bmapHeight, bmap, dibInfo, DIB_RGB_COLORS); - //VERIFY(res); + /* VERIFY(res); */ - // Create the GL object + /* Create the GL object */ glNewList(i + listBase, GL_COMPILE); glBitmap(bmapWidth, bmapHeight, 0.0, (GLfloat)metric.tmDescent, (GLfloat)charWidth, 0.0, bmap); glEndList(); - // CheckGL(); + /* CheckGL(); */ - // Destroy the bmap object + /* Destroy the bmap object */ DeleteObject(bitObject); - // Deallocate the bitmap data + /* Deallocate the bitmap data */ free(bmap); } - // Destroy the DC + /* Destroy the DC */ VERIFY(DeleteDC(bitDevice)); free(dibInfo); diff --git a/src/mesa/drivers/windows/gdi/wmesa.c b/src/mesa/drivers/windows/gdi/wmesa.c index 2eec188912..5b67439f0f 100644 --- a/src/mesa/drivers/windows/gdi/wmesa.c +++ b/src/mesa/drivers/windows/gdi/wmesa.c @@ -6,6 +6,7 @@ #include "wmesadef.h" #include "colors.h" #include +#include #include "context.h" #include "extensions.h" #include "framebuffer.h" @@ -114,7 +115,7 @@ static void wmSetPixelFormat(WMesaFramebuffer pwfb, HDC hDC) { pwfb->cColorBits = GetDeviceCaps(hDC, BITSPIXEL); - // Only 16 and 32 bit targets are supported now + /* Only 16 and 32 bit targets are supported now */ assert(pwfb->cColorBits == 0 || pwfb->cColorBits == 16 || pwfb->cColorBits == 32); @@ -1171,7 +1172,7 @@ WMesaContext WMesaCreateContext(HDC hDC, /* I do not understand this contributed code */ /* Support memory and device contexts */ if(WindowFromDC(hDC) != NULL) { - c->hDC = GetDC(WindowFromDC(hDC)); // huh ???? + c->hDC = GetDC(WindowFromDC(hDC)); /* huh ???? */ } else { c->hDC = hDC; @@ -1404,6 +1405,7 @@ void WMesaSwapBuffers( HDC hdc ) * table entries. Hopefully, I'll find a better solution. The * dispatch table generation scripts ought to be making these dummy * stubs as well. */ +#if !defined(__MINGW32__) || !defined(GL_NO_STDCALL) void gl_dispatch_stub_543(void){} void gl_dispatch_stub_544(void){} void gl_dispatch_stub_545(void){} @@ -1471,3 +1473,4 @@ void gl_dispatch_stub_769(void){} void gl_dispatch_stub_770(void){} void gl_dispatch_stub_771(void){} +#endif diff --git a/src/mesa/drivers/windows/gdi/wmesadef.h b/src/mesa/drivers/windows/gdi/wmesadef.h index 97b063a8ba..83a42e6082 100644 --- a/src/mesa/drivers/windows/gdi/wmesadef.h +++ b/src/mesa/drivers/windows/gdi/wmesadef.h @@ -1,6 +1,8 @@ #ifndef WMESADEF_H #define WMESADEF_H - +#ifdef __MINGW32__ +#include +#endif #include "context.h" diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h index 63dd002a41..fd4127558a 100644 --- a/src/mesa/main/glheader.h +++ b/src/mesa/main/glheader.h @@ -92,7 +92,7 @@ #endif #ifdef WGLAPI -#undef WGLAPI +# undef WGLAPI #endif #if !defined(OPENSTEP) && (defined(__WIN32__) && !defined(__CYGWIN__)) && !defined(BUILD_FOR_SNAP) diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index 8a5dfdb4b8..3ae56c8b0b 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -575,7 +575,11 @@ _mesa_ffs(int i) * if no bits set. */ int +#ifdef __MINGW32__ +_mesa_ffsll(long val) +#else _mesa_ffsll(long long val) +#endif { #ifdef ffsll return ffsll(val); diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index 9be8014a13..ebdfc452a7 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -700,7 +700,11 @@ extern int _mesa_ffs(int i); extern int +#ifdef __MINGW32__ +_mesa_ffsll(long i); +#else _mesa_ffsll(long long i); +#endif extern unsigned int _mesa_bitcount(unsigned int n); diff --git a/src/mesa/main/shaders.c b/src/mesa/main/shaders.c index 58be1f46e5..7bf8808767 100644 --- a/src/mesa/main/shaders.c +++ b/src/mesa/main/shaders.c @@ -83,7 +83,7 @@ _mesa_CreateShader(GLenum type) } -GLhandleARB APIENTRY +GLhandleARB GLAPIENTRY _mesa_CreateShaderObjectARB(GLenum type) { GET_CURRENT_CONTEXT(ctx); @@ -99,7 +99,7 @@ _mesa_CreateProgram(void) } -GLhandleARB APIENTRY +GLhandleARB GLAPIENTRY _mesa_CreateProgramObjectARB(void) { GET_CURRENT_CONTEXT(ctx); @@ -319,7 +319,7 @@ _mesa_GetUniformivARB(GLhandleARB program, GLint location, GLint * params) #if 0 -GLint APIENTRY +GLint GLAPIENTRY _mesa_GetUniformLocation(GLuint program, const GLcharARB *name) { GET_CURRENT_CONTEXT(ctx); @@ -336,7 +336,7 @@ _mesa_GetHandleARB(GLenum pname) } -GLint APIENTRY +GLint GLAPIENTRY _mesa_GetUniformLocationARB(GLhandleARB programObj, const GLcharARB *name) { GET_CURRENT_CONTEXT(ctx); diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c index 411d51cfcc..b6991f45ed 100644 --- a/src/mesa/main/texcompress_fxt1.c +++ b/src/mesa/main/texcompress_fxt1.c @@ -302,7 +302,12 @@ const struct gl_texture_format _mesa_texformat_rgba_fxt1 = { #define FX64_NATIVE 1 +#ifdef __MINGW32__ +typedef unsigned long Fx64; +#else typedef unsigned long long Fx64; +#endif + #define FX64_MOV32(a, b) a = b #define FX64_OR32(a, b) a |= b -- cgit v1.2.3