[mupen64plus-video-glide64] 120/172: Imported Upstream version 1.99.5+17+bfe79cebbe67

Sven Eckelmann ecsv-guest at moszumanska.debian.org
Thu Nov 26 06:11:58 UTC 2015


This is an automated email from the git hooks/post-receive script.

ecsv-guest pushed a commit to branch master
in repository mupen64plus-video-glide64.

commit d4da58421b653b09618dc0095bf3c981fe44a169
Author: Sven Eckelmann <sven at narfation.org>
Date:   Fri Feb 8 09:41:48 2013 +0100

    Imported Upstream version 1.99.5+17+bfe79cebbe67
---
 projects/unix/Makefile | 115 ++++++++++++++++++++++++++++++++++++-------------
 src/3dmath.cpp         |   2 +
 src/Gfx1.3.h           |   2 +-
 src/Main.cpp           |  19 ++------
 src/rdp.cpp            |  37 ++++++++--------
 src/wrapper/3dfx.h     |   3 ++
 6 files changed, 115 insertions(+), 63 deletions(-)

diff --git a/projects/unix/Makefile b/projects/unix/Makefile
index 931b171..a7c07f0 100644
--- a/projects/unix/Makefile
+++ b/projects/unix/Makefile
@@ -23,7 +23,7 @@
 # Makefile for Glide64 plugin in Mupen64Plus
 
 # detect operating system
-UNAME = $(shell uname -s)
+UNAME ?= $(shell uname -s)
 OS := NONE
 ifeq ("$(UNAME)","Linux")
   OS = LINUX
@@ -61,6 +61,12 @@ ifneq ("$(filter GNU/kFreeBSD kfreebsd,$(UNAME))","")
   SO_EXTENSION = so
   SHARED = -shared
 endif
+ifeq ("$(patsubst MINGW%,MINGW,$(UNAME))","MINGW")
+  OS = MINGW
+  SO_EXTENSION = dll
+  SHARED = -shared
+  PIC = 0
+endif
 ifeq ("$(OS)","NONE")
   $(error OS type "$(UNAME)" not supported.  Please file bug report at 'http://code.google.com/p/mupen64plus/issues')
 endif
@@ -99,16 +105,34 @@ ifneq ("$(filter ppc64 powerpc64,$(HOST_CPU))","")
   NO_ASM := 1
   $(warning Architecture "$(HOST_CPU)" not officially supported.')
 endif
+ifneq ("$(filter arm%,$(HOST_CPU))","")
+  ifeq ("$(filter arm%b,$(HOST_CPU))","")
+    CPU := ARM
+    ARCH_DETECTED := 32BITS
+    PIC ?= 1
+    NO_ASM := 1
+    $(warning Architecture "$(HOST_CPU)" not officially supported.')
+  endif
+endif
 ifeq ("$(CPU)","NONE")
   $(error CPU type "$(HOST_CPU)" not supported.  Please file bug report at 'http://code.google.com/p/mupen64plus/issues')
 endif
 
 # base CFLAGS, LDLIBS, and LDFLAGS
 OPTFLAGS ?= -O3
-CFLAGS += $(OPTFLAGS) -Wall -ffast-math -msse -fno-strict-aliasing -fvisibility=hidden -I../../src -I../../src/wrapper -DGCC
+WARNFLAGS ?= -Wall
+CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -ffast-math -fno-strict-aliasing -fvisibility=hidden -I../../src -I../../src/wrapper -DGCC
 CXXFLAGS += -fvisibility-inlines-hidden
 LDFLAGS += $(SHARED)
 
+# default configuration programs
+SDL_CONFIG = $(CROSS_COMPILE)sdl-config
+PKG_CONFIG = $(CROSS_COMPILE)pkg-config
+
+ifeq ($(CPU), X86)
+  CFLAGS += -msse
+endif
+
 # Since we are building a shared library, we must compile with -fPIC on some architectures
 # On 32-bit x86 systems we do not want to use -fPIC because we don't have to and it has a big performance penalty on this arch
 ifeq ($(PIC), 1)
@@ -139,14 +163,26 @@ ifeq ($(OS), LINUX)
   LDLIBS += -ldl
 endif
 ifeq ($(OS), OSX)
+  # Select the proper SDK
+  # Also, SDKs are stored in a different location since XCode 4.3
+  OSX_SDK ?= $(shell sw_vers -productVersion | cut -f1 -f2 -d .)
+  OSX_XCODEMAJ = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f1 -d .)
+  OSX_XCODEMIN = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f2 -d .)
+  OSX_XCODEGE43 = $(shell echo "`expr $(OSX_XCODEMAJ) \>= 4``expr $(OSX_XCODEMIN) \>= 3`")
+  ifeq ($(OSX_XCODEGE43), 11)
+    OSX_SYSROOT := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
+  else
+    OSX_SYSROOT := /Developer/SDKs
+  endif
+
   ifeq ($(CPU), X86)
     ifeq ($(ARCH_DETECTED), 64BITS)
-      CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
-      LDFLAGS += -bundle -framework OpenGL -arch x86_64
+      CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk
+      LDFLAGS += -bundle -arch x86_64
       LDLIBS += -ldl
     else
-      CFLAGS += -pipe -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk
-      LDFLAGS += -bundle -framework OpenGL -arch i686
+      CFLAGS += -pipe -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk
+      LDFLAGS += -bundle -arch i686
       LDLIBS += -ldl
     endif
   endif
@@ -155,33 +191,47 @@ ifeq ($(OS), FREEBSD)
   LDLIBS += -lc
 endif
 
-# test for essential build dependencies
-ifeq ($(shell which pkg-config 2>/dev/null),)
-  $(error pkg-config not found)
+# search for OpenGL libraries
+GL_LIBS=
+ifeq ($(OS), OSX)
+  GL_LIBS = -framework OpenGL
+endif
+ifeq ($(OS), MINGW)
+  GL_LIBS = -lopengl32
 endif
-ifeq ($(shell pkg-config --modversion gl 2>/dev/null),)
-  $(error No OpenGL development libraries found!)
+ifeq ("$(GL_LIBS)", "")
+  ifeq ($(shell which $(PKG_CONFIG) 2>/dev/null),)
+    $(error $(PKG_CONFIG) not found)
+  endif
+  ifeq ($(shell $(PKG_CONFIG) --modversion gl 2>/dev/null),)
+    $(error No OpenGL development libraries found!)
+  endif
+  CFLAGS += $(shell $(PKG_CONFIG) --cflags gl)
+  GL_LIBS = $(shell $(PKG_CONFIG) --libs gl)
 endif
-CFLAGS += $(shell pkg-config --cflags gl)
-LDLIBS += $(shell pkg-config --libs gl)
+LDLIBS += $(GL_LIBS)
 
 # test for presence of SDL
-ifeq ($(shell which sdl-config 2>/dev/null),)
+ifeq ($(shell which $(SDL_CONFIG) 2>/dev/null),)
   $(error No SDL development libraries found!)
 endif
 ifeq ($(OS),FREEBSD)
-    CFLAGS  += $(shell sdl-config --cflags)
-    LDLIBS += $(shell sdl-config --libs)
+    CFLAGS  += $(shell $(SDL_CONFIG) --cflags)
+    LDLIBS += $(shell $(SDL_CONFIG) --libs)
 endif
 ifeq ($(OS),OSX)
-    CFLAGS  += $(shell sdl-config --cflags)
+    CFLAGS  += $(shell $(SDL_CONFIG) --cflags)
     # sdl-config on mac screws up when we're trying to build a library and not an executable
     # SDL 1.3 is supposed to fix that, if it's ever released
     LDLIBS += -L/usr/local/lib -lSDL -Wl,-framework,Cocoa
 endif
 ifeq ($(OS),LINUX)
-    CFLAGS  += $(shell sdl-config --cflags)
-    LDLIBS += $(shell sdl-config --libs)
+    CFLAGS  += $(shell $(SDL_CONFIG) --cflags)
+    LDLIBS += $(shell $(SDL_CONFIG) --libs)
+endif
+ifeq ($(OS), MINGW)
+  CFLAGS += $(shell $(SDL_CONFIG) --cflags)
+  LDLIBS += $(shell $(SDL_CONFIG) --libs)
 endif
 
 # set mupen64plus core API header path
@@ -216,8 +266,8 @@ endif
 endif
 
 # set base program pointers and flags
-CC       ?= gcc
-CXX      ?= g++
+CC        = $(CROSS_COMPILE)gcc
+CXX       = $(CROSS_COMPILE)g++
 RM       ?= rm -f
 INSTALL  ?= install
 MKDIR ?= mkdir -p
@@ -251,7 +301,7 @@ ifeq ($(PLUGINDIR),)
 endif
 
 SRCDIR = ../../src
-OBJDIR = _obj
+OBJDIR = _obj$(POSTFIX)
 
 # list of source files to compile
 SOURCE = \
@@ -266,7 +316,6 @@ SOURCE = \
 	$(SRCDIR)/TexBuffer.cpp \
 	$(SRCDIR)/TexCache.cpp \
 	$(SRCDIR)/Util.cpp \
-	$(SRCDIR)/osal_dynamiclib_unix.c \
 	$(SRCDIR)/rdp.cpp \
 	$(SRCDIR)/wrapper/2xsai.cpp \
 	$(SRCDIR)/wrapper/combiner.cpp \
@@ -276,7 +325,13 @@ SOURCE = \
 	$(SRCDIR)/wrapper/hq2x.cpp \
 	$(SRCDIR)/wrapper/hq4x.cpp \
 	$(SRCDIR)/wrapper/main.cpp \
-	$(SRCDIR)/wrapper/textures.cpp 
+	$(SRCDIR)/wrapper/textures.cpp
+
+ifeq ($(OS),MINGW)
+SOURCE += $(SRCDIR)/osal_dynamiclib_win32.c
+else
+SOURCE += $(SRCDIR)/osal_dynamiclib_unix.c
+endif
 
 
 
@@ -287,7 +342,7 @@ OBJDIRS = $(dir $(OBJECTS))
 $(shell $(MKDIR) $(OBJDIRS))
 
 # build targets
-TARGET = mupen64plus-video-glide64.$(SO_EXTENSION)
+TARGET = mupen64plus-video-glide64$(POSTFIX).$(SO_EXTENSION)
 
 targets:
 	@echo "Mupen64plus-video-glide64 N64 Graphics plugin makefile. "
@@ -302,7 +357,9 @@ targets:
 	@echo "    NO_ASM=1      == build without inline assembly code (x86 MMX/SSE)"
 	@echo "    APIDIR=path   == path to find Mupen64Plus Core headers"
 	@echo "    OPTFLAGS=flag == compiler optimization (default: -O3)"
+	@echo "    WARNFLAGS=flag == compiler warning levels (default: -Wall)"
 	@echo "    PIC=(1|0)     == Force enable/disable of position independent code"
+	@echo "    POSTFIX=name  == String added to the name of the the build (default: '')"
 	@echo "  Install Options:"
 	@echo "    PREFIX=path   == install/uninstall prefix (default: /usr/local)"
 	@echo "    SHAREDIR=path == path to install shared data files (default: PREFIX/share/mupen64plus)"
@@ -327,7 +384,7 @@ uninstall:
 	$(RM) "$(DESTDIR)$(SHAREDIR)/Glide64.ini"
 
 clean:
-	$(RM) -r ./_obj $(TARGET)
+	$(RM) -r $(OBJDIR) $(TARGET)
 
 rebuild: clean all
 
@@ -337,9 +394,9 @@ CFLAGS += -MD
 
 CXXFLAGS += $(CFLAGS)
 ifeq ($(LTO), 1)
-  CFLAGS += -flto
-  CXXFLAGS += -flto
-  LDFLAGS += -fuse-linker-plugin $(CXXFLAGS)
+  CFLAGS += -flto -ffunction-sections -fdata-sections
+  CXXFLAGS += -flto -ffunction-sections -fdata-sections
+  LDFLAGS += -fuse-linker-plugin -Wl,--gc-sections $(CXXFLAGS)
 endif
 
 # standard build rules
diff --git a/src/3dmath.cpp b/src/3dmath.cpp
index 9e433e4..79ff203 100755
--- a/src/3dmath.cpp
+++ b/src/3dmath.cpp
@@ -41,7 +41,9 @@
 #include "m64p_config.h"
 #include "m64p_vidext.h"
 #include "3dmath.h"
+#if !defined(NO_ASM)
 #include <xmmintrin.h>
+#endif
 
 void calc_light (VERTEX *v)
 {
diff --git a/src/Gfx1.3.h b/src/Gfx1.3.h
index 8888834..f8d629f 100755
--- a/src/Gfx1.3.h
+++ b/src/Gfx1.3.h
@@ -146,7 +146,7 @@ extern "C" {
 #ifdef WIN32
 #define LOGKEY      VK_LCONTROL     // this key
 #else
-#include <SDL/SDL.h>
+#include <SDL.h>
 #define LOGKEY KMOD_LCTRL
 inline int GetAsyncKeyState(int key) {
   return (SDL_GetModState() & key) != 0;
diff --git a/src/Main.cpp b/src/Main.cpp
index 8f04ff4..4d50f83 100755
--- a/src/Main.cpp
+++ b/src/Main.cpp
@@ -633,21 +633,10 @@ void guLoadTextures ()
   for (i=0; i<0x200; i++)
   {
     // cur = ~*(data++), byteswapped
-#if !defined(__GNUC__) && !defined(NO_ASM)
-    __asm {
-      mov eax, dword ptr [data]
-        mov ecx, dword ptr [eax]
-        add eax, 4
-        mov dword ptr [data], eax
-        not ecx
-        bswap ecx
-        mov dword ptr [cur],ecx
-    }
-#elif !defined(NO_ASM)
-     asm volatile ("bswap %[cur]"
-           : [cur] "=g"(cur)
-           : "[cur]"(~*(data++))
-           );
+#if !defined(__GNUC__)
+     cur = _byteswap_ulong(~*(data++));
+#else
+     cur = __builtin_bswap32(~*(data++));
 #endif
 
     for (b=0x80000000; b!=0; b>>=1)
diff --git a/src/rdp.cpp b/src/rdp.cpp
index f42a867..335cd1a 100755
--- a/src/rdp.cpp
+++ b/src/rdp.cpp
@@ -67,13 +67,19 @@ int wrong_tile = -1;
 
 int drawFlag = 1;	// draw flag for rendering callback
 
-#if defined(WIN32) || defined(NO_ASM)
-  #define BYTESWAP1(s1) s1 = ((s1 & 0xff) << 24) | ((s1 & 0xff00) << 8) | ((s1 & 0xff0000) >> 8) | ((s1 & 0xff000000) >> 24);
-  #define BYTESWAP2(s1,s2) s1 = ((s1 & 0xff) << 24) | ((s1 & 0xff00) << 8) | ((s1 & 0xff0000) >> 8) | ((s1 & 0xff000000) >> 24); \
-  s2 = ((s2 & 0xff) << 24) | ((s2 & 0xff00) << 8) | ((s2 & 0xff0000) >> 8) | ((s2 & 0xff000000) >> 24);
+#if defined(__GNUC__)
+  #define bswap32(x) __builtin_bswap32(x)
+#elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
+  #include <stdlib.h>
+  #define bswap32(x) _byteswap_ulong(x)
 #else
-  #define BYTESWAP1(s1) asm volatile (" bswap %0; " : "+r" (s1) : :);
-  #define BYTESWAP2(s1,s2) asm volatile (" bswap %0; bswap %1; " : "+r" (s1), "+r" (s2) : :);
+static inline uint32_t bswap32(uint32_t val)
+{
+        return (((val & 0xff000000) >> 24) |
+                ((val & 0x00ff0000) >>  8) |
+                ((val & 0x0000ff00) <<  8) |
+                ((val & 0x000000ff) << 24));
+}
 #endif
 
 // global strings
@@ -1986,9 +1992,8 @@ static void CopyswapBlock(int *pDst, unsigned int cnt, unsigned int SrcOffs)
         int *pSrc = (int *) ((uintptr_t) gfx.RDRAM + SrcOffs);
         for (unsigned int x = 0; x < cnt; x++)
         {
-            int s1 = *pSrc++;
-            int s2 = *pSrc++;
-            BYTESWAP2(s1, s2)
+            int s1 = bswap32(*pSrc++);
+            int s2 = bswap32(*pSrc++);
             *pDst++ = s1;
             *pDst++ = s2;
         }
@@ -1998,8 +2003,7 @@ static void CopyswapBlock(int *pDst, unsigned int cnt, unsigned int SrcOffs)
         // set source pointer to 4-byte aligned RDRAM location before the start
         int *pSrc = (int *) ((uintptr_t) gfx.RDRAM + (SrcOffs & 0xfffffffc));
         // do the first partial 32-bit word
-        int s0 = *pSrc++;
-        BYTESWAP1(s0)
+        int s0 = bswap32(*pSrc++);
         for (int x = 0; x < rem; x++)
             s0 >>= 8;
         for (int x = 4; x > rem; x--)
@@ -2009,21 +2013,18 @@ static void CopyswapBlock(int *pDst, unsigned int cnt, unsigned int SrcOffs)
             s0 >>= 8;
         }
         // do one full 32-bit word
-        s0 = *pSrc++;
-        BYTESWAP1(s0)
+        s0 = bswap32(*pSrc++);
         *pDst++ = s0;
         // do 'cnt-1' 64-bit dwords
         for (unsigned int x = 0; x < cnt-1; x++)
         {
-            int s1 = *pSrc++;
-            int s2 = *pSrc++;
-            BYTESWAP2(s1, s2)
+            int s1 = bswap32(*pSrc++);
+            int s2 = bswap32(*pSrc++);
             *pDst++ = s1;
             *pDst++ = s2;
         }
         // do last partial 32-bit word
-        s0 = *pSrc++;
-        BYTESWAP1(s0)
+        s0 = bswap32(*pSrc++);
         for (; rem > 0; rem--)
         {
             *((char *) pDst) = s0 & 0xff;
diff --git a/src/wrapper/3dfx.h b/src/wrapper/3dfx.h
index 5bece1b..e2f50fd 100644
--- a/src/wrapper/3dfx.h
+++ b/src/wrapper/3dfx.h
@@ -97,6 +97,9 @@ typedef struct { float r, g, b, a; } FxColor4;
 #  else /* !macintosh */
 #    error "Unknown MetroWerks target platform"
 #  endif /* !macintosh */
+#elif defined(__APPLE__)
+#  define FX_ENTRY extern
+#  define FX_CALL
 #else
 #  warning define FX_ENTRY & FX_CALL for your compiler
 #  define FX_ENTRY extern

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/mupen64plus-video-glide64.git



More information about the Pkg-games-commits mailing list