Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Jun 2005 01:50:49 GMT
From:      Matthew Luckie <mjl@luckie.org.nz>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/82710: [patch] xscreensaver does not compile on 4.X
Message-ID:  <200506280150.j5S1onA7058281@www.freebsd.org>
Resent-Message-ID: <200506280200.j5S20JRu062001@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         82710
>Category:       ports
>Synopsis:       [patch] xscreensaver does not compile on 4.X
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jun 28 02:00:19 GMT 2005
>Closed-Date:
>Last-Modified:
>Originator:     Matthew Luckie
>Release:        4.11-RELEASE-p8
>Organization:
>Environment:
FreeBSD lycra.luckie.org.nz 4.11-RELEASE-p8 FreeBSD 4.11-RELEASE-p8 #1: Wed May 11 14:02:09 NZST 2005     root@lycra.luckie.org.nz:/files/freebsd_src/sys/compile/lycra  i386
>Description:
antmaze.c has two major problems:
 - it declares an array with 1 less element than it needs
 - it uses C99isms.

the patch below fixes these problems and allows antmaze to compile (and xscreensaver).
>How-To-Repeat:
cc -Wall -Wstrict-prototypes -Wnested-externs -std=c89 -U__STRICT_ANSI__ -c -I. -I. -I./../../utils -I./.. -I../..  -I/usr/local/include/atk-1.0 -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/local/include/libxml2 -I/usr/local/include -I/usr/X11R6/include/gtk-2.0 -I/usr/X11R6/lib/gtk-2.0/include -I/usr/X11R6/include -I/usr/X11R6/include/pango-1.0 -I/usr/local/include/freetype2 -I/usr/X11R6/include/libglade-2.0   -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -I/usr/X11R6/include/gtk-2.0 -I/usr/X11R6/include   -DSTANDALONE -DUSE_GL -DHAVE_CONFIG_H -O -pipe  -I/usr/local/include -I/usr/local/include/gnome-xml -I/usr/X11R6/include antmaze.c
antmaze.c:203: warning: excess elements in array initializer
antmaze.c:203: warning: (near initialization for `antmaterial')
antmaze.c:208: warning: excess elements in array initializer
antmaze.c:208: warning: (near initialization for `antdirection')
antmaze.c:214: warning: excess elements in array initializer
antmaze.c:214: warning: (near initialization for `antposition')
antmaze.c:235: warning: excess elements in array initializer
antmaze.c:235: warning: (near initialization for `bposition')
antmaze.c:252: warning: excess elements in array initializer
antmaze.c:252: warning: (near initialization for `part')
antmaze.c: In function `makeCheckImage':
antmaze.c:276: warning: suggest parentheses around comparison in operand of ^
antmaze.c:272: warning: unused variable `k'
antmaze.c:272: warning: unused variable `c'
antmaze.c:272: warning: unused variable `r'
antmaze.c: In function `makeBrushedImage':
antmaze.c:305: warning: unused variable `k'
antmaze.c:305: warning: unused variable `r'
antmaze.c: In function `update_ants':
antmaze.c:988: syntax error before `df'
antmaze.c:989: `df' undeclared (first use in this function)
antmaze.c:989: (Each undeclared identifier is reported only once
antmaze.c:989: for each function it appears in.)
antmaze.c:1001: syntax error before `df'
antmaze.c:1174: syntax error before `double'
antmaze.c:1175: `dt' undeclared (first use in this function)
antmaze.c: In function `pinit':
antmaze.c:1186: warning: unused variable `status'
antmaze.c: At top level:
antmaze.c:116: warning: `MaterialMagenta' defined but not used
antmaze.c:154: warning: `mySphere2' defined but not used
gmake[1]: *** [antmaze.o] Error 1
gmake[1]: Leaving directory `/usr/tmp/files/freebsd_ports/x11/xscreensaver/work/xscreensaver-4.22/hacks/glx'
gmake: *** [all] Error 5
*** Error code 2

Stop in /files/freebsd_ports/x11/xscreensaver.
>Fix:
put this as a patch in x11/xscreensaver/files/

--- hacks/glx/antmaze.c.orig	Tue Jun 28 13:40:57 2005
+++ hacks/glx/antmaze.c	Tue Jun 28 13:36:46 2005
@@ -193,7 +193,7 @@
 /* no cone */
 static Bool myCone2(float radius) { return True; }
 
-#define ANTCOUNT 4
+#define ANTCOUNT 5 
 #define PI 3.14157
 
 static int focus = 0;
@@ -971,6 +971,7 @@
 double fadeoutspeed = 0.0;
 
 void update_ants(void) {
+  GLfloat df[4];
   int i;
 
   /* fade out */
@@ -985,7 +986,8 @@
     
     fadeout += fadeoutspeed;
 
-    GLfloat df[4] = {0.8*fadeout, 0.8*fadeout, 0.8*fadeout, 1.0};
+    df[0] = df[1] = df[2] = 0.8*fadeout;
+    df[3] = 1.0;
     glLightfv(GL_LIGHT0, GL_DIFFUSE, df);
     glLightfv(GL_LIGHT1, GL_DIFFUSE, df);
   }
@@ -998,7 +1000,8 @@
       fadeoutspeed = 0.0;
       entroducing = 12;
     }
-    GLfloat df[4] = {0.8*fadeout, 0.8*fadeout, 0.8*fadeout, 1.0};
+    df[0] = df[1] = df[2] = 0.8*fadeout;
+    df[3] = 1.0;
     glLightfv(GL_LIGHT0, GL_DIFFUSE, df);
     glLightfv(GL_LIGHT1, GL_DIFFUSE, df);    
   }
@@ -1159,7 +1162,7 @@
       /* difference */
       double dx = antpath[i][part[i]][0] - antposition[i][0];
       double dz = - antpath[i][part[i]][1] + antposition[i][1];
-      double theta, ideal;
+      double theta, ideal, dt;
 
       if(dz > EPSILON)
 	theta = atan(dz/dx);
@@ -1171,7 +1174,7 @@
 	ideal += Pi;
 
       /* compute correction */
-      double dt = sign(ideal) * min(fabs(ideal), PI/90.0);
+      dt = sign(ideal) * min(fabs(ideal), PI/90.0);
       antdirection[i] += dt;
       if(antdirection[i] > 2.0*PI)
 	antdirection[i] = 0.0;

>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200506280150.j5S1onA7058281>