Skip to content

Commit

Permalink
games/gracer: fix build with -fno-common
Browse files Browse the repository at this point in the history
Move a variable definition from header to source file.
This fixes the build on FreeBSD 13+.
While we are at it, rename patches in accordance with makepatch
conventions and add missing dependencies.
  • Loading branch information
clausecker committed Apr 14, 2023
1 parent 81e3cda commit acbf6fa
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 47 deletions.
10 changes: 4 additions & 6 deletions games/gracer/Makefile
@@ -1,6 +1,6 @@
PORTNAME= gracer
PORTVERSION= 0.1.5
PORTREVISION= 23
PORTREVISION= 24
CATEGORIES= games
MASTER_SITES= SF

Expand All @@ -11,16 +11,14 @@ WWW= http://gracer.sourceforge.net/
LICENSE= GPLv2+
LICENSE_FILE= ${WRKSRC}/COPYING

BROKEN_FreeBSD_13= ld: error: duplicate symbol: GrBreak
BROKEN_FreeBSD_14= ld: error: duplicate symbol: GrBreak

BUILD_DEPENDS= ${LOCALBASE}/lib/libplibsl.a:x11-toolkits/plib
LIB_DEPENDS= libgif.so:graphics/giflib \
libpng.so:graphics/png

USES= gl gmake jpeg localbase perl5 tcl
USE_GL= glut
USES= gl gmake jpeg localbase perl5 tcl xorg
USE_GL= gl glu glut
USE_PERL5= build
USE_XORG= ice sm x11 xext xi xmu xt
GNU_CONFIGURE= yes
CONFIGURE_ARGS= --with-plib=${LOCALBASE}
CPPFLAGS+= -I${TCL_INCLUDEDIR}
Expand Down
@@ -1,6 +1,6 @@
--- ac2scene/ac2scene.c.orig Fri Apr 1 18:36:19 2005
+++ ac2scene/ac2scene.c Fri Apr 1 18:36:48 2005
@@ -160,8 +160,6 @@
--- ac2scene/ac2scene.c.orig 2000-03-01 04:26:42 UTC
+++ ac2scene/ac2scene.c
@@ -160,8 +160,6 @@ check_triangle_strip (GrSceneOptHint *hint, GrSurface
return 1;
}
break;
Expand All @@ -9,7 +9,7 @@
}

return 0;
@@ -232,8 +230,6 @@
@@ -232,8 +230,6 @@ check_triangle_fan (GrSceneOptHint *hint, GrSurface *s
return 1;
}
break;
Expand All @@ -18,15 +18,15 @@
}

return 0;
@@ -315,7 +311,6 @@
@@ -315,7 +311,6 @@ check_quad_strip (GrSceneOptHint *hint, GrSurface *sur
return 1;
}
break;
- default:
}

return 0;
@@ -397,8 +392,6 @@
@@ -397,8 +392,6 @@ optimize_object (GrObject *obj,
hints[i]->state = GR_SCENE_OPT_QUAD_STRIP_START;
hints[i]->surf->elements = gr_new (GrSElement, num_quads * 2 + 2);
break;
Expand Down
20 changes: 20 additions & 0 deletions games/gracer/files/patch-common_gr__memory.h
@@ -0,0 +1,20 @@
--- common/gr_memory.h.orig 2000-03-01 04:27:04 UTC
+++ common/gr_memory.h
@@ -29,7 +29,7 @@ extern "C" {
}
#endif

-#include <malloc.h>
+#include <stdlib.h>

#define gr_new(type,num) (type *) malloc (sizeof(type) * (num))
#define gr_new0(type,num) (type *) __malloc0 (sizeof(type) * (num))
@@ -64,7 +64,7 @@ void gr_slist_free (GrSList *list);
void gr_dlist_free (GrDList *list);

#define gr_FOREACH(l,p) \
- for (; (l) != NULL && ((void *)(p) = (l)->data, 1); (l) = (l)->next)
+ for (; (l) != NULL && ((p) = (l)->data, 1); (l) = (l)->next)

void gr_ref_incr (GrRef *ref);
void gr_ref_decr (GrRef *ref);
@@ -1,6 +1,6 @@
--- common/gr_texture.c.orig 2000-03-01 04:27:18 UTC
+++ common/gr_texture.c
@@ -274,7 +274,11 @@ read_gif_file (GrTexture *texture, char
@@ -274,7 +274,11 @@ read_gif_file (GrTexture *texture, char *filename)
int index;
int width, height;

Expand All @@ -12,7 +12,7 @@
if (!file)
return -1;

@@ -419,7 +423,7 @@ read_png_file (GrTexture *texture, char
@@ -419,7 +423,7 @@ read_png_file (GrTexture *texture, char *filename)
if (fread (header, 1, PNG_BYTES_TO_CHECK, file) != PNG_BYTES_TO_CHECK) {
goto ERROR;
}
Expand All @@ -21,7 +21,7 @@
goto ERROR;
}

@@ -431,7 +435,7 @@ read_png_file (GrTexture *texture, char
@@ -431,7 +435,7 @@ read_png_file (GrTexture *texture, char *filename)
if (!info_ptr) {
goto ERROR;
}
Expand Down
11 changes: 0 additions & 11 deletions games/gracer/files/patch-gr_memory.h

This file was deleted.

11 changes: 0 additions & 11 deletions games/gracer/files/patch-gr_world.c

This file was deleted.

@@ -1,5 +1,6 @@
Index: src/glhash.h
@@ -709,6 +709,8 @@
--- src/glhash.h.orig 2000-03-01 04:09:04 UTC
+++ src/glhash.h
@@ -709,6 +709,8 @@ glWordList glwordlist[] = {
{"all_attrib_bits", GL_ALL_ATTRIB_BITS},
{"client_pixel_store_bit", GL_CLIENT_PIXEL_STORE_BIT},
{"client_vertex_array_bit", GL_CLIENT_VERTEX_ARRAY_BIT},
Expand Down
@@ -1,22 +1,22 @@
--- src/glutwidgets.c.orig Wed May 4 18:47:07 2005
+++ src/glutwidgets.c Wed May 4 18:48:56 2005
@@ -254,7 +254,6 @@
--- src/glutwidgets.c.orig 2000-03-01 04:28:21 UTC
+++ src/glutwidgets.c
@@ -254,7 +254,6 @@ glut_reshape_func (int width, int height)
widget->x -= (width - screen_width) / 2;
widget->width += (width - screen_width);
break;
- default:
}
switch (widget->anchor & GR_VERTICAL_MASK) {
case GR_BOTTOM:
@@ -267,7 +266,6 @@
@@ -267,7 +266,6 @@ glut_reshape_func (int width, int height)
widget->y -= (height - screen_height) / 2;
widget->height += (width - screen_height);
break;
- default:
}
glut_widget_calc_bbox (widget);
}
@@ -325,8 +323,6 @@
@@ -325,8 +323,6 @@ glut_keyboard_func (unsigned char key, int x, int y)
glut_widget_set_focus (glut_next_focus_widget (NULL));
}
break;
Expand All @@ -25,7 +25,7 @@
}
}

@@ -502,8 +498,6 @@
@@ -502,8 +498,6 @@ glut_special_func (int key, int x, int y)
glut_widget_set_focus (widget);
}
break;
Expand All @@ -34,7 +34,7 @@
}
}

@@ -1297,8 +1291,6 @@
@@ -1297,8 +1291,6 @@ default_button_keyboard (GlutObject obj, unsigned char
}
glut_post_redisplay ();
break;
Expand All @@ -43,7 +43,7 @@
}
}

@@ -1569,8 +1561,6 @@
@@ -1569,8 +1561,6 @@ default_label_display (GlutObject obj)
case GR_RIGHT:
width = glut_label_width (obj) / 2;
break;
Expand Down
11 changes: 11 additions & 0 deletions games/gracer/files/patch-src_gr__world.c
@@ -0,0 +1,11 @@
--- src/gr_world.c.orig 2000-03-01 04:28:24 UTC
+++ src/gr_world.c
@@ -167,8 +167,6 @@ gr_world_check_trigger (GrWorld *world, int side)
case GR_CLINE_B_TO_A:
vehicle->lap_count --;
break;
-
- default:
}

tlist = entry->triggers;
11 changes: 11 additions & 0 deletions games/gracer/files/patch-src_vehicle.c
@@ -0,0 +1,11 @@
--- src/vehicle.c.orig 2023-04-13 00:36:40 UTC
+++ src/vehicle.c
@@ -58,6 +58,8 @@

#define SIGN(d) ((d)>=0.0? 1.0:-1.0)

+extern struct _GrBreakData GrBreak;
+
static void
next_word (char *str, int *index)
{
11 changes: 11 additions & 0 deletions games/gracer/files/patch-src_vehicle.h
@@ -0,0 +1,11 @@
--- src/vehicle.h.orig 2023-04-13 00:36:07 UTC
+++ src/vehicle.h
@@ -65,7 +65,7 @@ typedef struct _GrEngineData GrEngineData;
typedef struct _GrLapHistory GrLapHistory;
typedef struct _GrVehicleData GrVehicleData;

-struct _GrBreakData {
+extern struct _GrBreakData {
GrRef ref;

/* constants */

0 comments on commit acbf6fa

Please sign in to comment.