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

qboosh qboosh at pld-linux.org
Sun Sep 22 17:37:09 CEST 2013


commit d1fb270ecf99f1d4cd91cf55495cd25ccf1c8ee8
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Sun Sep 22 17:37:36 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)

 Glide_V3.spec         |  12 ++++-
 glide-format.patch    |  64 +++++++++++++++++++++++
 glide-include.patch   |  41 +++++++++++++++
 glide-morearchs.patch | 138 ++++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 254 insertions(+), 1 deletion(-)
---
diff --git a/Glide_V3.spec b/Glide_V3.spec
index e0b7cc1..a6930a3 100644
--- a/Glide_V3.spec
+++ b/Glide_V3.spec
@@ -15,6 +15,9 @@ Source0:	GlideV3.tar.gz
 Patch0:		glide-gcc4.patch
 Patch1:		glide-cpp.patch
 Patch2:		glide-link.patch
+Patch3:		glide-format.patch
+Patch4:		glide-morearchs.patch
+Patch5:		glide-include.patch
 URL:		http://glide.sourceforge.net/
 %ifarch %{ix86}
 BuildRequires:	/usr/bin/gasp
@@ -90,6 +93,9 @@ serii 3Dfx Interactive Voodoo przy użyciu interfejsu Glide 3.x.
 %patch0 -p1
 %patch1 -p1
 %patch2 -p1
+%patch3 -p1
+%patch4 -p1
+%patch5 -p1
 chmod +x swlibs/include/make/ostype
 
 ln glide2x/README README.glide2x
@@ -99,7 +105,11 @@ ln glide3x/README README.glide3x
 %{__make} V3_NODRI \
 	CC="%{__cc}" \
 	CNODEBUG="%{rpmcflags} %{!?debug:-fomit-frame-pointer}\
-		%{!?debug:-funroll-loops -fexpensive-optimizations -ffast-math -DBIG_OPT}"
+		%{!?debug:-funroll-loops -fexpensive-optimizations -ffast-math -DBIG_OPT}" \
+%ifnarch %{ix86}
+	FX_GLIDE_CTRISETUP=1 \
+	GL_AMD3D=
+%endif
 
 %install
 rm -rf $RPM_BUILD_ROOT
diff --git a/glide-format.patch b/glide-format.patch
new file mode 100644
index 0000000..1e5b681
--- /dev/null
+++ b/glide-format.patch
@@ -0,0 +1,64 @@
+--- GlideV3/glide2x/h3/glide/tests/tlib.c.orig	2000-03-20 22:51:02.000000000 +0100
++++ GlideV3/glide2x/h3/glide/tests/tlib.c	2013-09-22 13:04:18.151544595 +0200
+@@ -1433,7 +1433,7 @@
+ 
+ FxBool
+ tlErrorMessage( char *err) {
+-  fprintf(stderr, err);
++  fputs(err, stderr);
+ } /* tlErrorMessage */
+ 
+ #else
+@@ -1472,7 +1472,7 @@
+ 
+ FxBool
+ tlErrorMessage( char *err) {
+-  fprintf(stderr, err);
++  fputs(err, stderr);
+ } /* tlErrorMessage */
+ 
+ #else   /* __WIN32__ */
+--- GlideV3/glide3x/h3/glide3/tests/tlib.c.orig	2000-03-20 22:51:02.000000000 +0100
++++ GlideV3/glide3x/h3/glide3/tests/tlib.c	2013-09-22 13:04:18.151544595 +0200
+@@ -1433,7 +1433,7 @@
+ 
+ FxBool
+ tlErrorMessage( char *err) {
+-  fprintf(stderr, err);
++  fputs(err, stderr);
+ } /* tlErrorMessage */
+ 
+ #else
+@@ -1472,7 +1472,7 @@
+ 
+ FxBool
+ tlErrorMessage( char *err) {
+-  fprintf(stderr, err);
++  fputs(err, stderr);
+ } /* tlErrorMessage */
+ 
+ #else   /* __WIN32__ */
+--- GlideV3/swlibs/fxmisc/fximg.c.orig	2000-02-15 23:27:31.000000000 +0100
++++ GlideV3/swlibs/fxmisc/fximg.c	2013-09-22 13:08:08.412245152 +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);
+--- GlideV3/swlibs/newpci/pcilib/fxlinux.c.orig	2000-02-15 23:27:31.000000000 +0100
++++ GlideV3/swlibs/newpci/pcilib/fxlinux.c	2013-09-22 13:08:52.804308215 +0200
+@@ -186,7 +186,7 @@
+ static FxBool 
+ pciOutputStringLinux(const char *msg) 
+ {
+-  printf(msg);
++  fputs(msg, stdout);
+   return FXTRUE;
+ }
+ 
diff --git a/glide-include.patch b/glide-include.patch
new file mode 100644
index 0000000..88320bf
--- /dev/null
+++ b/glide-include.patch
@@ -0,0 +1,41 @@
+--- GlideV3/swlibs/fxmisc/fxos.c.orig	2000-02-15 23:27:31.000000000 +0100
++++ GlideV3/swlibs/fxmisc/fxos.c	2013-09-22 13:54:27.608090410 +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..035075a
--- /dev/null
+++ b/glide-morearchs.patch
@@ -0,0 +1,138 @@
+--- GlideV3/glide2x/h3/glide/src/fxglide.h.orig	2013-09-22 13:04:59.430129466 +0200
++++ GlideV3/glide2x/h3/glide/src/fxglide.h	2013-09-22 13:10:55.626683027 +0200
+@@ -1329,6 +1329,18 @@
+ #define P6FENCE __eieio()
+ #elif defined(__GNUC__) && defined(__i386__)
+ #define P6FENCE asm("xchg %%eax, %0" : : "m" (_GlideRoot.p6Fencer) : "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
+ #error "P6 Fencing in-line assembler code needs to be added for this compiler"
+ #endif /* Compiler specific fence commands */
+--- GlideV3/glide2x/h3/glide/src/makefile.linux.orig	2013-09-22 14:06:56.279556474 +0200
++++ GlideV3/glide2x/h3/glide/src/makefile.linux	2013-09-22 14:09:47.450846589 +0200
+@@ -129,12 +129,12 @@
+ ifeq ($(FX_GLIDE_CTRISETUP),1)
+ ASMTRISETUP     =
+ ATSOPTS         =       -DGLIDE_USE_C_TRISETUP 
+-CFILES          =       gxdraw.c
++CFILES          =       gxdraw.c xtexdl_def.c
+ else
+ DSPOPTS         +=      -DGLIDE_DISPATCH_SETUP=1 -DGLIDE_PACKED_RGB=0
+ 
+ ifeq ($(GL_AMD3D),)
+-ASMTRISETUP     =       xdraw2.S
++ASMTRISETUP     =       xdraw2.S cpudtect.S
+ else
+ LIBOBJS		+=	xdraw2_def.o xdraw2_3dnow.o
+ endif #GL_AMD3D
+@@ -185,7 +185,7 @@
+ LAINCS          =       -I$(BUILD_ROOT)/$(FX_GLIDE_HW)/include
+ LAOPTS          =       $(DBGOPTS) $(DSPOPTS) $(OPTOPTS)
+ 
+-AFILES          =       $(ASMTRISETUP) cpudtect.S
++AFILES          =       $(ASMTRISETUP)
+ 
+ # sources
+ HEADERS         =       glide.h gump.h glidesys.h glideutl.h
+--- GlideV3/glide2x/h3/glide/src/gpci.c.orig	2000-03-20 22:51:02.000000000 +0100
++++ GlideV3/glide2x/h3/glide/src/gpci.c	2013-09-22 16:43:44.783550030 +0200
+@@ -966,7 +966,13 @@
+ 
+   /* Setup the basic proc tables based on the cpu type. */
+   {
+-    _GlideRoot.CPUType = GLIDE_GETENV("FX_CPU", _cpu_detect_asm() );
++    _GlideRoot.CPUType = GLIDE_GETENV("FX_CPU",
++#ifdef __i386__
++	_cpu_detect_asm()
++#else
++	0
++#endif
++	);
+     GDBG_INFO(80,"\tcpu: %d\n",_GlideRoot.CPUType);
+       
+     /* Default case */
+--- GlideV3/glide2x/h3/glide/src/diglide.c.orig	2000-03-20 22:51:02.000000000 +0100
++++ GlideV3/glide2x/h3/glide/src/diglide.c	2013-09-22 16:48:14.702762083 +0200
+@@ -291,7 +291,9 @@
+     break;
+ 
+   case GR_HINT_FPUPRECISION:
++#ifdef __i386__
+     hints ? double_precision_asm() : single_precision_asm();
++#endif
+     break;
+ 
+   case GR_HINT_ALLOW_MIPMAP_DITHER:
+--- GlideV3/glide3x/h3/glide3/src/fxglide.h.orig	2013-09-22 16:52:18.240748150 +0200
++++ GlideV3/glide3x/h3/glide3/src/fxglide.h	2013-09-22 16:53:06.216311355 +0200
+@@ -1475,6 +1475,18 @@
+ #  define P6FENCE __eieio()
+ #elif defined(__GNUC__) && defined(__i386__)
+ #define P6FENCE asm("xchg %%eax, %0" : : "m" (_GlideRoot.p6Fencer) : "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  /* !defined ( P6FENCE ) */
+ #  error "P6 Fencing code needs to be added for this compiler"
+ #endif /* !defined ( P6FENCE ) */
+--- GlideV3/glide3x/h3/glide3/src/makefile.linux.orig	2000-03-20 22:51:03.000000000 +0100
++++ GlideV3/glide3x/h3/glide3/src/makefile.linux	2013-09-22 16:59:00.126094039 +0200
+@@ -128,10 +128,11 @@
+ # this makefile from Chris's sst1 glide2x tree.
+ ifeq ($(FX_GLIDE_CTRISETUP),1)
+ ASMTRISETUP     =
++ASMCPUDTECT	=
+ ATSOPTS         =       -DGLIDE_USE_C_TRISETUP 
+ CFILES          +=      gxdraw.c
+ else
+-
++ASMCPUDTECT	=	cpudtect.S
+ # There are now special build rules to get specialized
+ # function versions of the functions taht these files
+ # originally contained. See the end of the file.
+@@ -179,7 +180,7 @@
+ LAINCS          =       -I$(BUILD_ROOT)/$(FX_GLIDE_HW)/include
+ LAOPTS          =       $(DBGOPTS) $(DSPOPTS) $(OPTOPTS)
+ 
+-AFILES          =       $(ASMTRISETUP) cpudtect.S
++AFILES          =       $(ASMTRISETUP) $(ASMCPUDTECT)
+ 
+ # sources
+ HEADERS         =       glide.h glidesys.h glideutl.h
+--- GlideV3/glide3x/h3/glide3/src/gpci.c.orig	2000-03-20 22:51:03.000000000 +0100
++++ GlideV3/glide3x/h3/glide3/src/gpci.c	2013-09-22 17:02:02.101218508 +0200
+@@ -898,7 +898,13 @@
+   _GlideRoot.environment.gammaG = GLIDE_FGETENV("SSTH3_GGAMMA", -1.f);
+   _GlideRoot.environment.gammaB = GLIDE_FGETENV("SSTH3_BGAMMA", -1.f);
+ 
+-  _GlideRoot.CPUType                       = GLIDE_GETENV("FX_CPU", _cpu_detect_asm() );    
++  _GlideRoot.CPUType                       = GLIDE_GETENV("FX_CPU",
++#ifdef __i386__
++      _cpu_detect_asm()
++#else
++      0
++#endif
++      );    
+   GDBG_INFO(0,"               cpu: 0x%x\n",_GlideRoot.CPUType);
+ 
+   /* Setup the basic proc tables based on the cpu type. */
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/Glide_V3.git/commitdiff/d1fb270ecf99f1d4cd91cf55495cd25ccf1c8ee8



More information about the pld-cvs-commit mailing list