rpms/koules/F-8 koules-1.4-asmfix.patch, NONE, 1.1 koules-1.4-clean.patch, NONE, 1.1 koules-1.4-imake.patch, NONE, 1.1 koules-1.4-make.patch, NONE, 1.1 koules-1.4-mode.patch, NONE, 1.1 koules-1.4-noman.patch, NONE, 1.1 koules-1.4-overflows.patch, NONE, 1.1 koules-1.4-retrace.patch, NONE, 1.1 koules-1.4-shm.patch, NONE, 1.1 koules-1.4-spelling.patch, NONE, 1.1 koules.desktop, NONE, 1.1 koules.spec, NONE, 1.1 .cvsignore, 1.1, 1.2 sources, 1.1, 1.2

Lubomir Kundrak (lkundrak) fedora-extras-commits at redhat.com
Sun Nov 4 20:12:24 UTC 2007


Author: lkundrak

Update of /cvs/pkgs/rpms/koules/F-8
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv14689/F-8

Modified Files:
	.cvsignore sources 
Added Files:
	koules-1.4-asmfix.patch koules-1.4-clean.patch 
	koules-1.4-imake.patch koules-1.4-make.patch 
	koules-1.4-mode.patch koules-1.4-noman.patch 
	koules-1.4-overflows.patch koules-1.4-retrace.patch 
	koules-1.4-shm.patch koules-1.4-spelling.patch koules.desktop 
	koules.spec 
Log Message:
Initial import


koules-1.4-asmfix.patch:

--- NEW FILE koules-1.4-asmfix.patch ---
This fixes compilation issues with newer GCC. Taken from PLD.

--- koules1.4/xlib/shmbitmap.c.orig	Wed Mar  4 19:59:19 1998
+++ koules1.4/xlib/shmbitmap.c	Thu Jan 24 20:00:39 2002
@@ -242,13 +242,12 @@
 muldiv64 (int CONST m1, int CONST m2, int CONST d)
 {
 /* int32 * int32 -> int64 / int32 -> int32 */
-  int             result;
+  int             result,dummy;
   __asm__ (
 	    "imull %%edx\n\t"
-	    "idivl %3\n\t"
-:	    "=a" (result)	/* out */
+	    "idivl %4\n\t"
+:	    "=a" (result), "=d" (dummy)	/* out */
 :	    "a" (m1), "d" (m2), "g" (d)		/* in */
-:	    "ax", "dx"		/* mod */
     );
   return result;
 }
--- koules1.4/font.c.orig	Wed Mar  4 19:59:19 1998
+++ koules1.4/font.c	Thu Jan 24 21:00:36 2002
@@ -52,13 +52,12 @@
 muldiv64 (int CONST m1, int CONST m2, int CONST d)
 {
 /* int32 * int32 -> int64 / int32 -> int32 */
-  int             result;
+  int             result,dummy;
   __asm__ (
 	    "imull %%edx\n\t"
-	    "idivl %3\n\t"
-:	    "=a" (result)	/* out */
+	    "idivl %4\n\t"
+:	    "=a" (result), "=d" (dummy)	/* out */
 :	    "a" (m1), "d" (m2), "g" (d)		/* in */
-:	    "ax", "dx"		/* mod */
     );
   return result;
 }

koules-1.4-clean.patch:

--- NEW FILE koules-1.4-clean.patch ---
This is from Debian and makes koules compile a bit more cleanly.

--- koules-1.4.orig/xlib/interface.c
+++ koules-1.4/xlib/interface.c
@@ -154,7 +155,7 @@
 	  {
 	    register unsigned char *data = (unsigned char *) source.vbuff,
 	                   *end = (unsigned char *) source.vbuff + MAPWIDTH * (MAPHEIGHT + 20);
-	    register unsigned long *out = (unsigned long *) source.ximage->data;
+	    register uint32_t *out = (uint32_t *) source.ximage->data;
 	    while (data < end)
 	      {
 		*out = rpixels[*data];
--- koules-1.4.orig/koules.sndsrv.linux.c
+++ koules-1.4/koules.sndsrv.linux.c
@@ -181,7 +180,7 @@
 void
 do_everything (int dsp, int is_pcsp)
 {
-  char            k;
+  signed char     k;
   int             i, j;
   int             terminate = -1;	/* Which Sound to Terminate                              */
   int             playing[16];	/* Sound numbers that we are playing                     */
Index: koules-1.4/rcfiles.c
===================================================================
--- koules-1.4.orig/rcfiles.c	2006-11-03 11:12:56.000000000 +0100
+++ koules-1.4/rcfiles.c	2006-11-03 11:12:58.000000000 +0100
@@ -20,6 +20,7 @@
 /* Changes for joystick "accelerate by deflection"         *
  *  (c) 1997 by Ludvik Tesar (Ludv\'{\i}k Tesa\v{r})       *
  ************************LT*********************************/
+#include <errno.h>
 #include "koules.h"
 #ifdef XSUPPORT
 static CONST char *name = ".xkoules-controls";
Index: koules-1.4/xlib/interface.c
===================================================================
--- koules-1.4.orig/xlib/interface.c	1998-03-05 18:19:44.000000000 +0100
+++ koules-1.4/xlib/interface.c	2006-11-03 11:12:58.000000000 +0100
@@ -14,6 +14,7 @@
 *----------------------------------------------------------*
 *  interface.c interface xlib graphics functions           *
 ***********************************************************/
+#include <stdint.h>
 #include <X11/Xlib.h>
 #include <X11/keysym.h>
 #include <X11/keysymdef.h>
Index: koules-1.4/xlib/init.c
===================================================================
--- koules-1.4.orig/xlib/init.c	2006-11-03 11:12:54.000000000 +0100
+++ koules-1.4/xlib/init.c	2006-11-03 11:12:58.000000000 +0100
@@ -30,6 +30,7 @@
 #include "../framebuffer.h"
 
 #include <sys/time.h>
+#include <time.h>
 #include <unistd.h>
 #include "../mygetopt.h"
 #include <sys/signal.h>
Index: koules-1.4/xlib/text.c
===================================================================
--- koules-1.4.orig/xlib/text.c	2006-11-03 11:13:03.000000000 +0100
+++ koules-1.4/xlib/text.c	2006-11-03 11:13:17.000000000 +0100
@@ -4,6 +4,7 @@
 
 #ifdef MITSHM
 #include <stdlib.h>
+#include <string.h>
 #include "inlstring.h"		/* include inline string operations */
 #include "interface.h"
 

koules-1.4-imake.patch:

--- NEW FILE koules-1.4-imake.patch ---
Install to relative location and look for the sound server in the right place.

--- koules1.4/Imakefile.imake	2007-10-28 02:59:43.000000000 +0100
+++ koules1.4/Imakefile	2007-10-28 03:01:57.000000000 +0100
@@ -56,7 +56,7 @@
 
 DEFINES = -DONLYANSI -DSOUND $(JOYSTICK1) $(NET) $(MITSHM1) $(HAVEUSLEEP1) $(SYSDEFS) $(JOYSTICK) -Ixlib\
 	$(NAMEDEF) $(ASMDEF)\
-	-DSOUNDSERVER=\"$(SOUNDDIR)/$(SOUNDSERVER)\" \
+	-DSOUNDSERVER=\"$(LIBEXECDIR)/$(SOUNDSERVER)\" \
 	-DSOUNDDIR=\"$(SOUNDDIR)\" \
 	-DSOUNDDEV=\"$(SOUNDDEV)\"
 #endif
@@ -84,7 +84,6 @@
 all::xkoules
 #endif
 
-BINDIR = $(KOULESDIR)
 DESTDIR = /
 
 ComplexProgramTargetNoMan(xkoules)
@@ -95,26 +94,26 @@
 #endif
 #ifdef NAS_SOUND
 install:: $(PROGRAMS) $(SOUNDSERVER)
-	@echo "Koules directory is " $(KOULESDIR)
+	@echo "Koules directory is " $(BINDIR)
 	@:
 	@echo "Instalin man page to " $(MANDIR)
-	@mkdirhier $(MANDIR)
-	$(INSTALL) -c $(INSTBINFLAGS) xkoules.6 $(MANDIR);
+	@mkdirhier $(DESTDIR)$(MANDIR)
+	$(INSTALL) -c $(INSTBINFLAGS) xkoules.6 $(DESTDIR)$(MANDIR);
 	@:
-	@echo "Creating directory " $(KOULESDIR)
-	@if [ ! -d $(KOULESDIR) ]; then mkdirhier $(KOULESDIR); fi
+	@echo "Creating directory " $(BINDIR)
+	@if [ ! -d $(DESTDIR)$(BINDIR) ]; then mkdirhier $(DESTDIR)$(BINDIR); fi
 	@:
 	@if [ "$(INSTALLSOUND)" = "True" ]; 				\
 	 then								\
 		echo "Creating directory " $(SOUNDDIR); 		\
-		if [ ! -d $(SOUNDDIR) ]; then mkdirhier $(SOUNDDIR); fi;    \
+		if [ ! -d $(DESTDIR)$(SOUNDDIR) ]; then mkdirhier $(DESTDIR)$(SOUNDDIR); fi;    \
 		echo "Copying sound server to directory " $(SOUNDDIR); \
-		$(INSTALL) -c -s $(INSTBINFLAGS) $(SOUNDSERVER) $(SOUNDDIR); \
+		$(INSTALL) -c -s $(INSTBINFLAGS) $(SOUNDSERVER) $(DESTDIR)$(LIBEXECDIR); \
 		echo "Copying sound files into directory " $(SOUNDDIR); \
 		cd ./sounds; set -x;					\
 		for file in *.raw; do                                   \
 		    auconvert -raw linu8 1 -rate 8000 -volume 40 $$file -file snd `basename $$file .raw`.au ; \
-		    $(INSTALL) -c $(INSTDATFLAGS) `basename $$file .raw`.au $(SOUNDDIR); \
+		    $(INSTALL) -c $(INSTDATFLAGS) `basename $$file .raw`.au $(DESTDIR)$(SOUNDDIR); \
 		done;                                                   \
 	 fi
 	@echo
@@ -123,26 +122,26 @@
 #else
 #ifdef RSOUND
 install:: $(PROGRAMS) $(SOUNDSERVER)
-	@echo "Koules directory is " $(KOULESDIR)
+	@echo "Koules directory is " $(BINDIR)
 	@:
 	@echo "Instalin man page to " $(MANDIR)
-	@mkdirhier $(MANDIR)
-	$(INSTALL) -c $(INSTBINFLAGS) xkoules.6 $(MANDIR);
+	@mkdirhier $(DESTDIR)$(MANDIR)
+	$(INSTALL) -c $(INSTBINFLAGS) xkoules.6 $(DESTDIR)$(MANDIR);
 	@:
-	@echo "Creating directory " $(KOULESDIR)
-	@if [ ! -d $(KOULESDIR) ]; then mkdirhier $(KOULESDIR); fi
+	@echo "Creating directory " $(BINDIR)
+	@if [ ! -d $(DESTDIR)$(BINDIR) ]; then mkdirhier $(DESTDIR)$(BINDIR); fi
 	@:
 	@if [ "$(INSTALLSOUND)" = "True" ]; 				\
 	 then								\
 		echo "Creating directory " $(SOUNDDIR); 		\
-		if [ ! -d $(SOUNDDIR) ]; then mkdirhier $(SOUNDDIR); fi;    \
+		if [ ! -d $(DESTDIR)$(SOUNDDIR) ]; then mkdirhier $(DESTDIR)$(SOUNDDIR); fi;    \
 		echo "Copying sound server to directory " $(SOUNDDIR); \
-		$(INSTALL) -c -s $(INSTBINFLAGS) $(SOUNDSERVER) $(SOUNDDIR); \
+		$(INSTALL) -c -s $(INSTBINFLAGS) $(SOUNDSERVER) $(DESTDIR)$(LIBEXECDIR); \
 		echo "Copying sound files into directory " $(SOUNDDIR); \
 		cd ./sounds; set -x;					\
 		for file in *.raw; do                                   \
 		    sh ../myauconvert $$file `basename $$file .raw`.au ; \
-		    $(INSTALL) -c $(INSTDATFLAGS) `basename $$file .raw`.au $(SOUNDDIR); \
+		    $(INSTALL) -c $(INSTDATFLAGS) `basename $$file .raw`.au $(DESTDIR)$(SOUNDDIR); \
 		done;                                                   \
 	 fi
 	@echo
@@ -153,25 +152,25 @@
 	@echo
 #else
 install:: $(PROGRAMS) $(SOUNDSERVER)
-	@echo "Koules directory is " $(KOULESDIR)
+	@echo "Koules directory is " $(BINDIR)
 	@:
 	@echo "Instalin man page to " $(MANDIR)
-	@mkdirhier $(MANDIR)
-	$(INSTALL) -c $(INSTBINFLAGS) xkoules.6 $(MANDIR);
+	@mkdirhier $(DESTDIR)$(MANDIR)
+	$(INSTALL) -c $(INSTBINFLAGS) xkoules.6 $(DESTDIR)$(MANDIR);
 	@:
-	@echo "Creating directory " $(KOULESDIR)
-	@if [ ! -d $(KOULESDIR) ]; then mkdirhier $(KOULESDIR); fi
+	@echo "Creating directory " $(BINDIR)
+	@if [ ! -d $(DESTDIR)$(BINDIR) ]; then mkdirhier $(DESTDIR)$(BINDIR); fi
 	@:
 	@if [ "$(INSTALLSOUND)" = "True" ]; 				\
 	 then								\
 		echo "Creating directory " $(SOUNDDIR); 		\
-		if [ ! -d $(SOUNDDIR) ]; then mkdirhier $(SOUNDDIR); fi;    \
+		if [ ! -d $(DESTDIR)$(SOUNDDIR) ]; then mkdirhier $(DESTDIR)$(SOUNDDIR); fi;    \
 		echo "Copying sound server to directory " $(SOUNDDIR); \
-		$(INSTALL) -c -s $(INSTBINFLAGS) $(SOUNDSERVER) $(SOUNDDIR); \
+		$(INSTALL) -c -s $(INSTBINFLAGS) $(SOUNDSERVER) $(DESTDIR)$(LIBEXECDIR); \
 		echo "Copying sound files into directory " $(SOUNDDIR); \
 		cd ./sounds; set -x;					\
 		for file in *.raw; do					\
-		    $(INSTALL) -c $(INSTDATFLAGS) $$file $(SOUNDDIR);	\
+		    $(INSTALL) -c $(INSTDATFLAGS) $$file $(DESTDIR)$(SOUNDDIR);	\
 		done;   						\
 	 fi
 	@echo

koules-1.4-make.patch:

--- NEW FILE koules-1.4-make.patch ---
Do not add arbitrary compiler flags and install into relative location.

--- koules1.4/Makefile.svgalib.make	1998-03-09 16:48:49.000000000 +0100
+++ koules1.4/Makefile.svgalib	2007-10-29 17:46:02.000000000 +0100
@@ -24,11 +24,10 @@
 INSTBINFLAGS=-m a=rxs,u=rwxs
 INSTALL = install
 
-CC	 = gcc
-OPTIMIZE = -Isvgalib -fomit-frame-pointer -O3 -ffast-math -s -Dlinux -Wall -DHAVEUSLEEP
-OPTIMIZE1 = -I svgalib -fomit-frame-pointer -O6  -ffast-math -funroll-loops -finline-functions   -s -Dlinux -Wall -DHAVEUSLEEP
-CFLAGS	 = $(DEFINES) $(ARCH) $(JOYSTICK) -DSOUNDDIR="\"$(SOUNDDIR)\"" $(SOUND) $(MOUSE) $(NET)\
-	-DSOUNDSERVER=\"$(SOUNDDIR)/$(SOUNDSERVER)\" \
+OPTIMIZE = -Isvgalib -DHAVEUSLEEP -O -finline-functions -ffast-math
+OPTIMIZE1 = -Isvgalib -DHAVEUSLEEP -O -finline-functions -funroll-loops -ffast-math
+CFLAGS	 += $(DEFINES) $(ARCH) $(JOYSTICK) -DSOUNDDIR="\"$(SOUNDDIR)\"" $(SOUND) $(MOUSE) $(NET)\
+	-DSOUNDSERVER=\"$(LIBEXECDIR)$(SOUNDSERVER)\" \
 	-DSOUNDDIR=\"$(SOUNDDIR)\" \
 	-DSOUNDDEV=\"$(SOUNDDEV)\"
 
@@ -74,22 +73,22 @@
 	@echo "Koules directory is " $(BINDIR)
 	@:
 	@echo "Instalin man page to " $(MANDIR)
-	$(INSTALL) -c $(INSTMANFLAGS) koules.svga.6 $(MANDIR);
+	$(INSTALL) -c $(INSTMANFLAGS) koules.svga.6 $(DESTDIR)$(MANDIR);
 	@:
 	@echo "Creating directory " $(BINDIR)
-	@if [ ! -d $(BINDIR) ]; then mkdir $(BINDIR); fi
-	$(INSTALL) -c -s $(INSTBINFLAGS) koules.svga $(BINDIR)
+	@if [ ! -d $(DESTDIR)$(BINDIR) ]; then mkdir $(DESTDIR)$(BINDIR); fi
+	$(INSTALL) -c -s $(INSTBINFLAGS) koules.svga $(DESTDIR)$(BINDIR)
 	@:
 	@if [ "$(INSTALLSOUND)" = "True" ]; 				\
 	 then								\
 		echo "Creating directory " $(SOUNDDIR); 		\
-		if [ ! -d $(SOUNDDIR) ]; then mkdir $(SOUNDDIR); fi;    \
+		if [ ! -d $(DESTDIR)$(SOUNDDIR) ]; then mkdir $(DESTDIR)$(SOUNDDIR); fi;    \
 		echo "Copying sound server to directory " $(SOUNDDIR); \
-		$(INSTALL) -c -s $(INSTBIN1FLAGS) $(SOUNDSERVER) $(SOUNDDIR); \
+		$(INSTALL) -c -s $(INSTBIN1FLAGS) $(SOUNDSERVER) $(DESTDIR)$(LIBEXECDIR); \
 		echo "Copying sound files into directory " $(SOUNDDIR); \
 		cd ./sounds; set -x;					\
 		for file in *.raw; do					\
-		    $(INSTALL) -c $(INSTDATFLAGS) $$file $(SOUNDDIR);	\
+		    $(INSTALL) -c $(INSTDATFLAGS) $$file $(DESTDIR)$(SOUNDDIR);	\
 		done;   						\
 	 fi
 	@echo "Don't forget to remove your old koules from /usr/games/koules "

koules-1.4-mode.patch:

--- NEW FILE koules-1.4-mode.patch ---
Dynamically decide about window size based on information from the windowing
system.

--- koules1.4/xlib/init.c.mode	2007-10-28 02:31:47.000000000 +0100
+++ koules1.4/xlib/init.c	2007-10-28 02:31:55.000000000 +0100
@@ -362,6 +362,12 @@
       printf ("could not open display\n");
       exit (0);
     }
+
+    if (MAPWIDTH == 0) {
+      GAMEWIDTH = MAPWIDTH = DisplayWidth (dp, DefaultScreen (dp)) * 0.8;
+      GAMEHEIGHT = MAPHEIGHT = DisplayHeight (dp, DefaultScreen (dp)) * 0.8;
+    }
+
   XSetCloseDownMode (dp, DestroyAll);
   screen = DefaultScreen (dp);
   fadeenable = 1;
@@ -634,10 +640,8 @@
   int             c;
   XEvent          event;
   nrockets = 1;
-  GAMEWIDTH = 640;
-  GAMEHEIGHT = 460;
-  MAPWIDTH = 640;
-  MAPHEIGHT = 460;
+  GAMEWIDTH = MAPWIDTH = 0;
+  GAMEHEIGHT = MAPHEIGHT = 0;
   DIV = 1;
 #ifdef MITSHM
   shm = 1;
@@ -819,6 +823,11 @@
 #ifdef NETSUPPORT
   if (server)
     {
+      if (MAPWIDTH == 0) {
+        GAMEWIDTH = MAPWIDTH = 640;
+        GAMEHEIGHT = MAPHEIGHT = 460;
+        DIV = 1;
+      }
       init_server ();
       server_loop ();
     }

koules-1.4-noman.patch:

--- NEW FILE koules-1.4-noman.patch ---
Make imake not complain about knowing about manual pages.
This one comes from PLD Linux's koules-noman.patch

--- koules1.4/Imakefile.orig	Thu Jan 24 20:35:15 2002
+++ koules1.4/Imakefile	Thu Jan 24 20:38:00 2002
@@ -87,7 +87,7 @@
 BINDIR = $(KOULESDIR)
 DESTDIR = /
 
-ComplexProgramTarget(xkoules)
+ComplexProgramTargetNoMan(xkoules)
 
 
 #ifdef SOUND

koules-1.4-overflows.patch:

--- NEW FILE koules-1.4-overflows.patch ---
This fixes some buffer overflow, that are not severe, unless koules.svga
is installed setuid root. Not by default. The first hunk is from Debian.

--- koules-1.4.orig/koules.sndsrv.linux.c
+++ koules-1.4/koules.sndsrv.linux.c
@@ -65,10 +65,9 @@
   for (i = 0; i < NUM_SOUNDS; i++)
     {
       s[0] = 0;
-      strcat (s, argv[1]);
-      if (s[(int) strlen (s) - 1] == '/')
+      if (argv[1][(int) strlen (argv[1]) - 1] == '/')
 	FILENAME[i]++;
-      strcat (s, FILENAME[i]);
+      snprintf(s, sizeof(s), "%s%s", argv[1], FILENAME[i]);
       FILENAME[i] = malloc ((int) strlen (s) + 1);
       strcpy (FILENAME[i], s);
       sound_buffer[i] = NULL;
diff -u koules1.4.orig/nas_sound.c koules1.4/nas_sound.c
--- koules1.4.orig/nas_sound.c	2007-10-28 03:29:35.000000000 +0100
+++ koules1.4/nas_sound.c	2007-10-28 03:31:16.000000000 +0100
@@ -175,9 +175,10 @@
 
       /* Use the environment variable if it exists */
       if ((str = getenv ("XGAL_SOUND_DIR")) != NULL)
-	sprintf (fbuf, "%s/%s", str, filename);
+	snprintf (fbuf, sizeof (fbuf), "%s/%s", str, filename);
       else
-	sprintf (fbuf, "%s/%s", unixSoundPath, filename);
+	snprintf (fbuf, sizeof (fbuf), "%s/%s", unixSoundPath, filename);
+	fbuf[sizeof (fbuf) -1] = '\0';
 
       sound_table[num_sounds].filename = strdup (fbuf);
       num_sounds++;
diff -u koules1.4.orig/soundos2.c koules1.4/soundos2.c
--- koules1.4.orig/soundos2.c	2007-10-28 03:29:35.000000000 +0100
+++ koules1.4/soundos2.c	2007-10-28 03:32:32.000000000 +0100
@@ -627,7 +627,8 @@
     printf ("Opening no.%d %s\n", k, FILENAME[k]);
   
 #endif /* 
 */
-    sprintf (filename, "sounds/%s", FILENAME[k]);
+    snprintf (filename, sizeof (filename), "sounds/%s", FILENAME[k]);
+    filename [sizeof (filename)-1] = '\0';
   
     fd = open (filename, O_RDONLY);
   
--- koules1.4/rcfiles.c.overflows	2007-10-28 04:58:04.000000000 +0100
+++ koules1.4/rcfiles.c	2007-10-28 05:01:26.000000000 +0100
@@ -59,11 +59,17 @@ save_rc ()
   if (client || server)
     return;
 #endif
+  fullname[sizeof (fullname)-1] = '\0';
 #ifdef OS2DIVE
-  sprintf (fullname, "%s", name);
+  snprintf (fullname, sizeof (fullname),  "%s", name);
 #else
-  sprintf (fullname, "%s/%s", mygetenv ("HOME"), name);
+  snprintf (fullname, sizeof (fullname), "%s/%s", mygetenv ("HOME"), name);
 #endif
+  if (fullname[sizeof (fullname)-1] != '\0')
+    {
+      printf ("Home directory file name too long, saving of controls skipped.");
+      return;
+    }
   if ((controls = fopen (fullname, "w")) == NULL)
     {
       printf ("could not open save file:%s\n"
@@ -89,11 +95,17 @@ save_rc ()
   fwrite (zeros, 2, sizeof (float), controls);
 #endif
   fclose (controls);
+  fullname[sizeof (fullname)-1] = '\0';
 #ifdef OS2DIVE
-  sprintf (fullname, "%s", levelsname);
+  snprintf (fullname, sizeof (fullname), "%s", levelsname);
 #else
-  sprintf (fullname, "%s/%s", mygetenv ("HOME"), levelsname);
+  snprintf (fullname, sizeof (fullname), "%s/%s", mygetenv ("HOME"), levelsname);
 #endif
+  if (fullname[sizeof (fullname)-1] != '\0')
+    {
+      printf ("Home directory file name too long, saving of controls skipped.");
+      return;
+    }
   if ((levels = fopen (fullname, "w")) == NULL)
     {
       printf ("could not open save file:%s\n"
@@ -120,11 +132,17 @@ load_rc ()
   if (client || server)
     return;
 #endif
+  fullname[sizeof (fullname)-1] = '\0';
 #ifdef OS2DIVE
-  sprintf (fullname, "%s", name);
+  snprintf (fullname, sizeof (fullname), "%s", name);
 #else
-  sprintf (fullname, "%s/%s", mygetenv ("HOME"), name);
+  snprintf (fullname, sizeof (fullname), "%s/%s", mygetenv ("HOME"), name);
 #endif
+  if (fullname[sizeof (fullname)-1] != '\0')
+    {
+      printf ("Home directory file name too long, using default controls.");
+      return;
+    }
   if ((controls = fopen (fullname, "r")) == NULL)
     {
       printf ("could not open save file:%s\n"
@@ -151,11 +169,17 @@ load_rc ()
 #endif
   fclose (controls);
 skip:;
+  fullname[sizeof (fullname)-1] = '\0';
 #ifdef OS2DIVE
-  sprintf (fullname, "%s", levelsname);
+  snprintf (fullname, sizeof (fullname), "%s", levelsname);
 #else
-  sprintf (fullname, "%s/%s", mygetenv ("HOME"), levelsname);
+  snprintf (fullname, sizeof (fullname), "%s/%s", mygetenv ("HOME"), levelsname);
 #endif
+  if (fullname[sizeof (fullname)-1] != '\0')
+    {
+      printf ("Home directory file name too long, using default controls.");
+      return;
+    }
   if ((levels = fopen (fullname, "r")) == NULL)
     {
       printf ("could not open save file:%s\n"

koules-1.4-retrace.patch:

--- NEW FILE koules-1.4-retrace.patch ---
This include no longer exists and seems unneeded.

--- koules1.4/svgalib/init.c.orig	2007-10-28 00:21:19.000000000 +0200
+++ koules1.4/svgalib/init.c	2007-10-28 00:21:35.000000000 +0200
@@ -44,7 +44,6 @@
 #include <sys/stat.h>
 #include <sys/vt.h>
 #include <unistd.h>
-#include <asm/io.h>		/*for waiting for retrace */
 #include <sys/ioctl.h>		/*for waiting for retrace */
 extern void     fadein1 ();
 extern GraphicsContext *starbackground;

koules-1.4-shm.patch:

--- NEW FILE koules-1.4-shm.patch ---
Fix disabling of XShm support, which is broken in xkoules.

--- koules1.4/xlib/init.c.shm	2007-10-28 02:37:54.000000000 +0200
+++ koules1.4/xlib/init.c	2007-10-28 02:38:49.000000000 +0200
@@ -374,32 +374,42 @@
 			    32, TrueColor, &vinfo_return) == True)
 	{
 	  useprivate = 0;
+#ifdef MITSHM
 	  bpp = 4;
+#endif
 	}
       else if (XMatchVisualInfo (dp, DefaultScreen (dp),
 				 24, TrueColor, &vinfo_return) == True)
 	{
 	  useprivate = 0;
+#ifdef MITSHM
 	  bpp = 4;
+#endif
 	}
       else if (XMatchVisualInfo (dp, DefaultScreen (dp),
 				 16, TrueColor, &vinfo_return) == True)
 	{
 	  useprivate = 0;
+#ifdef MITSHM
 	  bpp = 2;
+#endif
 	}
       else if (XMatchVisualInfo (dp, DefaultScreen (dp),
 				 15, TrueColor, &vinfo_return) == True)
 	{
 	  useprivate = 0;
+#ifdef MITSHM
 	  bpp = 2;
+#endif
 	}
       else if (XMatchVisualInfo (dp, DefaultScreen (dp),
 				 8, GrayScale, &vinfo_return) == True)
 	{
 	  useprivate = 0;
 	  monochrome = 1;
+#ifdef MITSHM
 	  bpp = 2;
+#endif
 	}
       else
 	{
@@ -410,7 +420,9 @@
 	}
     }
   else
+#ifdef MITSHM
     bpp = 1;
+#endif
   depth = vinfo_return.depth;
 #ifdef MITSHM
   /* Make sure all is destroyed if killed off */

koules-1.4-spelling.patch:

--- NEW FILE koules-1.4-spelling.patch ---
Spelling fixes from Debian.

--- koules-1.4.orig/rcfiles.c
+++ koules-1.4/rcfiles.c
@@ -66,7 +67,7 @@
   if ((controls = fopen (fullname, "w")) == NULL)
     {
       printf ("could not open save file:%s\n"
-	      "saving of controls skippen\n", fullname);
+	      "saving of controls skipped\n", fullname);
       perror ("error");
       return;
     }
@@ -96,7 +97,7 @@
   if ((levels = fopen (fullname, "w")) == NULL)
     {
       printf ("could not open save file:%s\n"
-	      "saving of controls skippen\n", fullname);
+	      "saving of controls skipped\n", fullname);
       perror ("error");
       return;
     }
--- koules-1.4.orig/text.h
+++ koules-1.4/text.h
@@ -270,7 +270,7 @@
 {
   "The DARK APPLEPOLISHER",
   "has heard about you",
-  "Your are famous",
+  "You are famous",
   "This has one disadvantage",
   "B_BALLS are going to",
   "kick you out",
@@ -290,7 +290,7 @@
   "...",
   "do not",
   "turn the power off",
-  "your are near",
+  "you are near",
   "your goal",
   "NOW you can finish the game"};
 static int      BBBALLSIZE = (sizeof (bbballtext) / sizeof (char *));


--- NEW FILE koules.desktop ---
[Desktop Entry]
Encoding=UTF-8
Name=Koules
Comment=Classic Linux action game with network multiplayer support
Exec=/usr/bin/xkoules
Icon=/usr/share/pixmaps/koules.xpm
Terminal=false
Type=Application
Categories=Application;Game;ArcadeGame;


--- NEW FILE koules.spec ---
Name:           koules
Version:        1.4
Release:        1%{?dist}
Summary:        Action game with multiplayer, network and sound support

Group:          Amusements/Games
License:        GPLv2
URL:            http://www.ucw.cz/~hubicka/koules/
Source0:        http://www.ucw.cz/~hubicka/koules/packages/%{name}%{version}-src.tar.gz
Source1:        koules.desktop
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires:  libX11-devel
BuildRequires:  libXext-devel
BuildRequires:  xmkmf
BuildRequires:  desktop-file-utils
%ifarch %{ix86} x86_64
BuildRequires:  svgalib-devel
%endif

Requires:       %{name}-sound = %{version}
Requires:       %{name}-x11 = %{version}
%ifarch %{ix86} x86_64
Requires:       %{name}-svgalib = %{version}
%endif

# Shared patches
Patch0:         koules-1.4-clean.patch
Patch1:         koules-1.4-overflows.patch
Patch2:         koules-1.4-spelling.patch

# SVGAlib specific patches
Patch10:        koules-1.4-retrace.patch
Patch11:        koules-1.4-make.patch

# X11 specific patches
Patch20:        koules-1.4-noman.patch
Patch21:        koules-1.4-asmfix.patch
Patch22:        koules-1.4-imake.patch
Patch23:        koules-1.4-shm.patch
Patch24:        koules-1.4-mode.patch

%ifarch %{ix86} x86_64
%package svgalib
Summary:        SVGAlib based variant of a multiplayer action game
Group:          Amusements/Games
%endif

%package x11
Summary:        X Window system variant of a multiplayer action game
Group:          Amusements/Games

%package sound
Summary:        Sound files for a classic Linux multiplayer action game
Group:          Amusements/Games


%description
Koules is a fast action arcade-style game.  It works in fine resolution
with cool 256 color graphics, multiplayer mode up to 5 players, full sound
and, of course, network support.  Koules is an original idea. First version
of Koules was developed from scratch by Jan Hubicka in July 1995.

%ifarch %{ix86} x86_64
%description svgalib
This package contains variant of a classic Linux arcade game with SVGAlib
support and can act as a network server for multiplayer game.  Use of this
package is discouraged as it needs to be run by privileged user unless used
as a network server.  Use koules-x11 package instead whenever possible.
%endif

%description x11
This package contains variant of a classic Linux arcade game with X Window
System support and can act as a network server for multiplayer game.

%description sound
This package contains sound files for a classic Linux arcade game. To make
sound functioning in Koules you either need to ensure exclusive access to
sound hardware for the game, or use a /dev/dsp wrapper such as padsp from
pulseaudio-utils package.


%define bindir          BINDIR=%{_bindir}
%define sounddir        SOUNDDIR=%{_datadir}/%{name}/sound
%define mandir          MANDIR=%{_mandir}/man6
%define libexecdir      LIBEXECDIR=%{_libexecdir}/%{name}
%define makedirs        %{bindir} %{sounddir} %{mandir} %{libexecdir}


%prep
%ifarch %{ix86} x86_64
# SVGAlib variant build tree
%setup -q -n %{name}-%{version}-svga -c
cd %{name}%{version}
%patch0 -p1 -b .clean
%patch1 -p1 -b .overflows
%patch2 -p1 -b .spelling
%patch10 -p1 -b .retrace
%patch11 -p1 -b .make
%endif

# X11 variant build tree
%setup -q -n %{name}-%{version}-x11 -c
cd %{name}%{version}
%patch0 -p1 -b .clean
%patch1 -p1 -b .overflows
%patch2 -p1 -b .spelling
%patch20 -p1 -b .noman
%patch21 -p1 -b .asmfix
%patch22 -p1 -b .imake
%patch23 -p1 -b .shm
%patch24 -p1 -b .mode


%build
%ifarch %{ix86} x86_64
# Build SVGAlib variant
cd $RPM_BUILD_DIR/%{name}-%{version}-svga/%{name}%{version}
# Builds with multiple concurrent jobs are problematic
make -f Makefile.svgalib %{makedirs} CFLAGS="%{optflags}"
%endif

# Build X11 variant
cd $RPM_BUILD_DIR/%{name}-%{version}-x11/%{name}%{version}
# Xshm is broken at the time
echo '#undef MITSHM' >> Iconfig
echo '#define HAVEUSLEEP' >> Iconfig
#sed 's,#define MITSHM,#undef MITSHM,' -i Iconfig
xmkmf -a
make %{makedirs} CCOPTIONS="%{optflags}"


%install
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT%{_mandir}/man6
install -d $RPM_BUILD_ROOT%{_datadir}/%{name}/sound
install -d $RPM_BUILD_ROOT%{_libexecdir}/%{name}

%ifarch %{ix86} x86_64
# Install SVGAlib variant
cd $RPM_BUILD_DIR/%{name}-%{version}-svga/%{name}%{version}
make -f Makefile.svgalib install %{makedirs} DESTDIR=$RPM_BUILD_ROOT \
	INSTALLSOUND=False
%endif

# Install X11 variant, and sound
cd $RPM_BUILD_DIR/%{name}-%{version}-x11/%{name}%{version}
make install %{makedirs} DESTDIR=$RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT%{_datadir}/pixmaps
install Icon.xpm $RPM_BUILD_ROOT%{_datadir}/pixmaps/%{name}.xpm
desktop-file-install --vendor fedora                    \
        --dir ${RPM_BUILD_ROOT}%{_datadir}/applications \
        %{SOURCE1}


%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%doc %{name}%{version}/ANNOUNCE
%doc %{name}%{version}/BUGS
%doc %{name}%{version}/COPYING
%doc %{name}%{version}/Card
%doc %{name}%{version}/ChangeLog
%doc %{name}%{version}/Koules.FAQ
%doc %{name}%{version}/README
%doc %{name}%{version}/TODO

%files sound
%{_datadir}/%{name}
%{_libexecdir}/%{name}/koules.sndsrv.linux

%ifarch %{ix86} x86_64
%files svgalib
%attr(755,root,root) %{_bindir}/koules.svga
%attr(644,root,root) %{_mandir}/man6/koules.svga.6*
%endif

%files x11
%{_bindir}/xkoules
%attr(644,root,root) %{_mandir}/man6/xkoules.6*
%attr(644,root,root) %{_datadir}/pixmaps/%{name}.xpm
%{_datadir}/applications/fedora-koules.desktop


%changelog
* Sun Oct 28 2007 Lubomir Kundrak <lkundrak at redhat.com> 1.4-1
- From Red Hat Linux 4.2 back into life


Index: .cvsignore
===================================================================
RCS file: /cvs/pkgs/rpms/koules/F-8/.cvsignore,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- .cvsignore	4 Nov 2007 19:22:31 -0000	1.1
+++ .cvsignore	4 Nov 2007 20:11:52 -0000	1.2
@@ -0,0 +1 @@
+koules1.4-src.tar.gz


Index: sources
===================================================================
RCS file: /cvs/pkgs/rpms/koules/F-8/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources	4 Nov 2007 19:22:31 -0000	1.1
+++ sources	4 Nov 2007 20:11:52 -0000	1.2
@@ -0,0 +1 @@
+0a5ac9e57c8b72e9fc200bc98273235c  koules1.4-src.tar.gz




More information about the fedora-extras-commits mailing list