[packages/Glide_V2] - added format patch (fixes build with -Werror=format-security) - added morearchs patch (allow build

qboosh qboosh at pld-linux.org
Mon Sep 23 20:51:11 CEST 2013


commit 13e3f2a3547325eb0b8aa77c3c7b7a00199dc6cf
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Mon Sep 23 20:51:38 2013 +0200

    - added format patch (fixes build with -Werror=format-security)
    - added morearchs patch (allow build on non-x86)
    - added include patch (avoid includes nested in function)
    - one more lvalue fix for gcc4+

 Glide_V2.spec         |  14 ++++-
 glide-format.patch    |  46 ++++++++++++++
 glide-gcc4.patch      |  20 ++++++
 glide-include.patch   |  41 ++++++++++++
 glide-morearchs.patch | 170 ++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 289 insertions(+), 2 deletions(-)
---
diff --git a/Glide_V2.spec b/Glide_V2.spec
index c81c5fe..99979af 100644
--- a/Glide_V2.spec
+++ b/Glide_V2.spec
@@ -16,6 +16,9 @@ Patch0:		glide-gcc4.patch
 Patch1:		glide-gasp.patch
 Patch2:		glide-cpp.patch
 Patch3:		glide-link.patch
+Patch4:		glide-morearchs.patch
+Patch5:		glide-format.patch
+Patch6:		glide-include.patch
 URL:		http://glide.sourceforge.net/
 %ifarch %{ix86}
 BuildRequires:	/usr/bin/gasp
@@ -86,6 +89,9 @@ Interactive Voodoo przy użyciu interfejsu Glide 3.x.
 %patch1 -p1
 %patch2 -p1
 %patch3 -p1
+%patch4 -p1
+%patch5 -p1
+%patch6 -p1
 chmod +x swlibs/include/make/ostype
 %{__rm} glide3x/cvg/init/*.{o,a}
 
@@ -95,10 +101,14 @@ ln glide3x/README README.glide3x
 %build
 # Make sure we build for Voodoo2
 export FX_GLIDE_HW=cvg
-%{__make} V2 \
+%{__make} -j1 V2 \
 	CC="%{__cc}" \
 	CNODEBUG="%{rpmcflags} %{!?debug:-fomit-frame-pointer -funroll-loops} \
-		%{!?debug:-fexpensive-optimizations -ffast-math -DBIG_OPT}"
+		%{!?debug:-fexpensive-optimizations -ffast-math -DBIG_OPT}" \
+%ifnarch %{ix86}
+	FX_GLIDE_CTRISETUP=1
+%endif
+	
 
 %install
 rm -rf $RPM_BUILD_ROOT
diff --git a/glide-format.patch b/glide-format.patch
new file mode 100644
index 0000000..4b5e63a
--- /dev/null
+++ b/glide-format.patch
@@ -0,0 +1,46 @@
+--- GlideV2/glide2x/cvg/glide/tests/tlib.c.orig	2000-04-20 23:26:36.000000000 +0200
++++ GlideV2/glide2x/cvg/glide/tests/tlib.c	2013-09-21 07:44:29.182138177 +0200
+@@ -1433,7 +1433,7 @@
+ 
+ FxBool
+ tlErrorMessage( char *err) {
+-  fprintf(stderr, err);
++  fputs(err, stderr);
+ } /* tlErrorMessage */
+ 
+ #else
+--- GlideV2/glide3x/cvg/glide3/tests/tlib.c.orig	2000-04-20 23:26:36.000000000 +0200
++++ GlideV2/glide3x/cvg/glide3/tests/tlib.c	2013-09-21 07:44:29.182138177 +0200
+@@ -1433,7 +1433,7 @@
+ 
+ FxBool
+ tlErrorMessage( char *err) {
+-  fprintf(stderr, err);
++  fputs(err, stderr);
+ } /* tlErrorMessage */
+ 
+ #else
+--- GlideV2/swlibs/fxmisc/fximg.c.orig	2000-04-20 23:26:42.000000000 +0200
++++ GlideV2/swlibs/fxmisc/fximg.c	2013-09-21 08:00:09.335790777 +0200
+@@ -1879,8 +1879,8 @@
+ 	    char buf[1024], *p;
+ 	    strcpy(buf,prefix);			// copy and replace semicolon
+ 	    if (p = strchr(buf,';')) *p = '\0';
+-	    fprintf(stderr,buf);
+-	    fprintf(stderr,"/");
++	    fputs(buf,stderr);
++	    fputs("/",stderr);
+ 	}
+ 	fprintf (stderr,"%s (%dx%d) ...", filename, info->any.width,info->any.height);
+ 	fflush(stderr);
+--- GlideV2/swlibs/newpci/pcilib/fxlinux.c.orig	2000-04-20 23:26:42.000000000 +0200
++++ GlideV2/swlibs/newpci/pcilib/fxlinux.c	2013-09-21 08:01:44.556878851 +0200
+@@ -186,7 +186,7 @@
+ static FxBool 
+ pciOutputStringLinux(const char *msg) 
+ {
+-  printf(msg);
++  fputs(msg,stdout);
+   return FXTRUE;
+ }
+ 
diff --git a/glide-gcc4.patch b/glide-gcc4.patch
index ee9e8ee..c028e62 100644
--- a/glide-gcc4.patch
+++ b/glide-gcc4.patch
@@ -327,3 +327,23 @@
            }
          }
  #endif
+--- GlideV2/glide3x/cvg/glide3/src/gstrip.c.orig	2000-04-20 23:26:39.000000000 +0200
++++ GlideV2/glide3x/cvg/glide3/src/gstrip.c	2013-09-21 14:11:46.981730876 +0200
+@@ -248,7 +248,7 @@
+         vPtr = pointers;
+         if (mode)
+           vPtr = *(float **)vPtr;
+-        (float *)pointers += stride;
++        pointers = (float *)pointers + stride;
+         
+         TRI_SETF(FARRAY(vPtr, 0));
+         dataElem = 0;
+@@ -350,7 +350,7 @@
+                  *oow*gc->state.Viewport.hwidth + gc->state.Viewport.ox);
+         TRI_SETF(FARRAY(vPtr, 4)
+                  *oow*gc->state.Viewport.hheight + gc->state.Viewport.oy);
+-        (float *)pointers += stride;
++        pointers = (float *)pointers + stride;
+ 
+         TRI_VP_SETFS(vPtr, oow);
+ #endif
diff --git a/glide-include.patch b/glide-include.patch
new file mode 100644
index 0000000..1d1223f
--- /dev/null
+++ b/glide-include.patch
@@ -0,0 +1,41 @@
+--- GlideV2/swlibs/fxmisc/fxos.c.orig	2000-04-20 23:26:42.000000000 +0200
++++ GlideV2/swlibs/fxmisc/fxos.c	2013-09-21 08:13:51.993975299 +0200
+@@ -43,13 +43,22 @@
+ #include <fxos.h>
+ #endif
+ 
++#if defined ( __sparc__ ) || defined ( __DJGPP__ )
++#   include <sys/types.h>
++#   include <sys/timeb.h>
++#elif defined ( WIN32 ) || ( __DOS__ ) || defined(__FreeBSD__)
++#   include <time.h>
++#else
++#   include <sys/types.h>
++#   include <sys/times.h>
++#   include <sys/param.h>
++#endif
++
+ /* return current time in seconds (floating point)      */
+ float fxTime(void)
+ {
+ #if defined ( __sparc__ ) || defined ( __DJGPP__ )
+ /* times returns 0 in BSD Unix, so we use ftime instead */
+-#   include <sys/types.h>
+-#   include <sys/timeb.h>
+     struct timeb tb;
+     static time_t once;                 // saves first time value
+ 
+@@ -60,13 +69,9 @@
+     
+ #else
+ #if defined ( WIN32 ) || ( __DOS__ ) || defined(__FreeBSD__)
+-#   include <time.h>
+ #   define times(a) clock()
+ #   define HZ   CLOCKS_PER_SEC
+ #else
+-#   include <sys/types.h>
+-#   include <sys/times.h>
+-#   include <sys/param.h>
+     struct tms foo;
+ #endif
+     return times(&foo)/(float)HZ;
diff --git a/glide-morearchs.patch b/glide-morearchs.patch
new file mode 100644
index 0000000..30ac936
--- /dev/null
+++ b/glide-morearchs.patch
@@ -0,0 +1,170 @@
+--- GlideV2/glide2x/cvg/init/sst1init.h.orig	2013-09-21 07:41:42.484397830 +0200
++++ GlideV2/glide2x/cvg/init/sst1init.h	2013-09-21 07:46:29.837739823 +0200
+@@ -163,4 +163,16 @@
+ #elif defined (__GNUC__) && defined(__i386__)
+ #  define P6FENCE asm("xchg %%eax,%0" : /*outputs*/ : "m" (p6FenceVar) : \
+ 					"eax");
++#elif defined(__ia64__)
++#define P6FENCE asm volatile ("mf.a" ::: "memory");
++#elif defined(__alpha__)
++# define P6FENCE asm volatile("mb" ::: "memory");
++#elif defined(__powerpc__)
++# define P6FENCE asm volatile ("sync" ::: "memory");
++#elif defined (__x86_64__)
++# define P6FENCE asm volatile("mfence" ::: "memory");
++#elif defined(__sparc64__)
++# define P6FENCE asm volatile("membar #LoadLoad | #LoadStore | #StoreStore | #StoreLoad" ::: "memory");
++#elif defined(__sparc__)
++# define P6FENCE asm volatile("" ::: "memory");
+ #else
+--- GlideV2/glide2x/cvg/glide/src/cpudetect.c.orig	2000-04-20 23:26:36.000000000 +0200
++++ GlideV2/glide2x/cvg/glide/src/cpudetect.c	2013-09-21 08:28:32.804847399 +0200
+@@ -34,14 +34,25 @@
+ }
+ 
+ void single_precision_asm() {
++#if defined(__x86_64__)
++  asm("push %rax \n fnclex \n fstcw (%rsp) \n movl (%rsp), %eax \n "
++      "and $0x0000fcff, %eax \n movl %eax, (%rsp) \n fldcw (%rsp) \n pop %rax");
++#elif defined(__i386__)
+   asm("push %eax \n fnclex \n fstcw (%esp) \n movl (%esp), %eax \n "
+       "and $0x0000fcff, %eax \n movl %eax, (%esp) \n fldcw (%esp) \n pop %eax");
++#endif
+ }
+ 
+ 
+ void double_precision_asm() {
+-  asm("push %eax \n fnclex \n fstcw (%esp) \n movw (%esp), %eax \n "
++#if defined(__x86_64__)
++  asm("push %rax \n fnclex \n fstcw (%rsp) \n movl (%rsp), %eax \n "
++      "and $0x0000fcff, %eax \n or $0x000002ff, %eax \n mov %eax, (%rsp) \n "
++      "fldcw (%rsp) \n pop %rax");
++#elif defined(__i386__)
++  asm("push %eax \n fnclex \n fstcw (%esp) \n movl (%esp), %eax \n "
+       "and $0x0000fcff, %eax \n or $0x000002ff, %eax \n mov %eax, (%esp) \n "
+       "fldcw (%esp) \n pop %eax");
++#endif
+ }
+ 
+--- GlideV2/glide2x/cvg/init/makefile.linux.orig	2000-04-20 23:26:36.000000000 +0200
++++ GlideV2/glide2x/cvg/init/makefile.linux	2013-09-21 10:33:25.196185785 +0200
+@@ -52,5 +52,5 @@
+ # for some strange reason
+ #
+ ifndef DEBUG
+-CFLAGS = -g $(GCFLAGS) $(LCFLAGS) $(VCFLAGS)
++CFLAGS = -g $(GCFLAGS) $(LCFLAGS) $(VCFLAGS) -fPIC
+ endif
+--- GlideV2/glide3x/cvg/init/sst1init.h.orig	2013-09-21 07:41:42.484397830 +0200
++++ GlideV2/glide3x/cvg/init/sst1init.h	2013-09-21 07:46:29.837739823 +0200
+@@ -163,4 +163,16 @@
+ #elif defined (__GNUC__) && defined(__i386__)
+ #  define P6FENCE asm("xchg %%eax,%0" : /*outputs*/ : "m" (p6FenceVar) : \
+ 					"eax");
++#elif defined(__ia64__)
++#define P6FENCE asm volatile ("mf.a" ::: "memory");
++#elif defined(__alpha__)
++# define P6FENCE asm volatile("mb" ::: "memory");
++#elif defined(__powerpc__)
++# define P6FENCE asm volatile ("sync" ::: "memory");
++#elif defined (__x86_64__)
++# define P6FENCE asm volatile("mfence" ::: "memory");
++#elif defined(__sparc64__)
++# define P6FENCE asm volatile("membar #LoadLoad | #LoadStore | #StoreStore | #StoreLoad" ::: "memory");
++#elif defined(__sparc__)
++# define P6FENCE asm volatile("" ::: "memory");
+ #else
+--- GlideV2/glide3x/cvg/glide3/src/makefile.linux.orig	2000-04-20 23:26:39.000000000 +0200
++++ GlideV2/glide3x/cvg/glide3/src/makefile.linux	2013-09-21 14:30:15.403246286 +0200
+@@ -144,7 +144,7 @@
+ CFILES          =       gxdraw.c
+ else
+ CFILES          =       gxdraw.c
+-ASMTRISETUP     =       xdraw2.S xdraw3.S
++ASMTRISETUP     =       xdraw2.S xdraw3.S cpudtect.S
+ DSPOPTS         +=       -DGLIDE_PACKED_RGB=0 -DGLIDE_TRI_CULLING=1
+ endif
+ 
+@@ -193,7 +193,7 @@
+ LAINCS          =       -I$(BUILD_ROOT)/$(FX_GLIDE_HW)/include
+ LAOPTS          =       $(DBGOPTS) $(DSPOPTS) $(OPTOPTS)
+ 
+-AFILES          =       $(ASMTRISETUP) cpudtect.S
++AFILES          =       $(ASMTRISETUP)
+ 
+ # sources
+ HEADERS         =       glide.h glidesys.h glideutl.h
+--- GlideV2/glide3x/cvg/init/makefile.linux.orig	2000-04-20 23:26:36.000000000 +0200
++++ GlideV2/glide3x/cvg/init/makefile.linux	2013-09-21 10:33:25.196185785 +0200
+@@ -52,5 +52,5 @@
+ # for some strange reason
+ #
+ ifndef DEBUG
+-CFLAGS = -g $(GCFLAGS) $(LCFLAGS) $(VCFLAGS)
++CFLAGS = -g $(GCFLAGS) $(LCFLAGS) $(VCFLAGS) -fPIC
+ endif
+--- GlideV2/glide3x/cvg/glide3/src/gdraw.c.orig	2013-09-22 19:48:44.822836076 +0200
++++ GlideV2/glide3x/cvg/glide3/src/gdraw.c	2013-09-23 19:53:38.014765302 +0200
+@@ -243,7 +243,7 @@
+     vlist[0] = (float *)a;
+     vlist[1] = (float *)b;
+     vlist[2] = (float *)c;
+-    _grDrawTriangles(GR_VTX_PTR_ARRAY, 3, vlist);
++    _grDrawTriangles_Default(GR_VTX_PTR_ARRAY, 3, vlist);
+   } else {
+     /* 
+     ** draw a simple triangle 
+--- GlideV2/glide3x/cvg/glide3/src/gpci.c.orig	2000-04-20 23:26:39.000000000 +0200
++++ GlideV2/glide3x/cvg/glide3/src/gpci.c	2013-09-23 20:33:53.300359679 +0200
+@@ -221,6 +221,16 @@
+ /* Collection of all of the known procs for a given system */
+ static GrTriSetupProc _triSetupProcs[][2][2] = 
+ {
++#ifdef GLIDE_USE_C_TRISETUP
++  {
++    { NULL, NULL },
++    { NULL, _vptrisetup_cull }
++  },
++  {
++    { NULL, NULL },
++    { NULL, _vptrisetup_cull }
++  }
++#else
+   /* Default Procs */
+   {
+     { _trisetup_Default_Default, _trisetup_Default_cull }, /* GR_WINDOW_COORDS */
+@@ -233,10 +243,20 @@
+     { _trisetup_clip_coor_thunk, _trisetup_clip_coor_thunk }, /* GR_CLIP_COORDS */
+   },
+ #endif /* GL_AMD3D */
++#endif
+ };
+ 
++#ifdef GLIDE_USE_C_TRISETUP
++void FX_CSTYLE
++_grDrawVertexList(FxU32 pktype, FxU32 type, FxI32 mode, FxI32 count, void *pointers);
++#endif
++
+ static GrVertexListProc _vertexListProcs[][2] = {
++#ifdef GLIDE_USE_C_TRISETUP
++  { _grDrawVertexList, _grDrawVertexList },
++#else
+   { _drawvertexlist, _vpdrawvertexlist },
++#endif
+ #if GL_AMD3D
+   { _grDrawVertexList_3DNow_Window, _grDrawVertexList_3DNow_Clip }
+ #endif /* GL_AMD3D */
+@@ -577,7 +597,12 @@
+ 
+   /* Setup the basic proc tables based on the cpu type. */
+   {
+-    _GlideRoot.CPUType = _cpu_detect_asm();
++    _GlideRoot.CPUType =
++#ifdef __i386__
++      _cpu_detect_asm();
++#else
++      0;
++#endif
+     if (GETENV("FX_CPU")) _GlideRoot.CPUType = atoi(GETENV("FX_CPU"));
+ 
+     /* Default case */
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/Glide_V2.git/commitdiff/13e3f2a3547325eb0b8aa77c3c7b7a00199dc6cf



More information about the pld-cvs-commit mailing list