Saturday, February 27, 2021

Re: FIX games/corewars -fno-common build error

On Sat 27/02/2021 18:59, Bjorn Ketelaars wrote:
> On Sat 27/02/2021 18:18, Christian Weisgerber wrote:
> > Bjorn Ketelaars:
> >
> > > +--- src/parser-cw.c.orig
> > > ++++ src/parser-cw.c
> > > +@@ -32,8 +32,8 @@
> > > + #include "program-cw.h"
> > > + #include "options.h"
> > > +
> > > +- int current_line;
> > > +- struct cw_line *root_line;
> > > ++ extern int current_line;
> > > ++ extern struct cw_line *root_line;
> >
> > Hmm. There are two parsers, parser-cw.y and parser-rc.y, and each
> > has variables current_line and root_line. Should those be static
> > instead?
>
> I overlooked the second parser, good catch. I think you are right that
> we need to make current_line and root_line static, thus limiting the
> visibility of things within the same file.
>
> dickman@ contacted me off list and told me that he had a similar diff

^ this should be daniel@


> except with WANTLIB updates and removal of trailing white spaces from
> pkg/DESCR. I'm not sure if he used static or extern.
>
> New diff, OK?
>
>
> diff --git Makefile Makefile
> index f4bb9e4e1e7..564c9521cc1 100644
> --- Makefile
> +++ Makefile
> @@ -3,20 +3,20 @@
> COMMENT= computer simulation game
>
> DISTNAME= corewars-0.9.13
> -REVISION= 9
> +REVISION= 10
>
> CATEGORIES= games x11
>
> -HOMEPAGE= http://corewars.org/
> +HOMEPAGE= https://corewars.org/
>
> # GPLv2
> PERMIT_PACKAGE= Yes
>
> -WANTLIB = GL X11 Xcomposite Xcursor Xdamage Xext Xfixes Xi Xinerama
> -WANTLIB += Xrandr Xrender atk-1.0 c cairo expat fontconfig freetype
> +WANTLIB += X11 Xcomposite Xcursor Xdamage Xext Xfixes Xi Xinerama
> +WANTLIB += Xrandr Xrender atk-1.0 c cairo fontconfig freetype
> WANTLIB += gdk-x11-2.0 gdk_pixbuf-2.0 gio-2.0 glib-2.0 gobject-2.0
> -WANTLIB += gtk-x11-2.0 iconv intl m pango-1.0 pangocairo-1.0
> -WANTLIB += pangoft2-1.0 pixman-1 png pthread xcb xcb-render xcb-shm z
> +WANTLIB += gtk-x11-2.0 harfbuzz intl m pango-1.0 pangocairo-1.0
> +WANTLIB += pangoft2-1.0 z
>
> LIB_DEPENDS= x11/gtk+2
>
> diff --git patches/patch-src_parser-cw_c patches/patch-src_parser-cw_c
> new file mode 100644
> index 00000000000..04ad6db7ba2
> --- /dev/null
> +++ patches/patch-src_parser-cw_c
> @@ -0,0 +1,18 @@
> +$OpenBSD$
> +
> +Fix -fno-common build error.
> +
> +Index: src/parser-cw.c
> +--- src/parser-cw.c.orig
> ++++ src/parser-cw.c
> +@@ -32,8 +32,8 @@
> + #include "program-cw.h"
> + #include "options.h"
> +
> +- int current_line;
> +- struct cw_line *root_line;
> ++ static int current_line;
> ++ static struct cw_line *root_line;
> + char cw_error_message[1024];
> +
> + void cw_error (char *s);
> diff --git patches/patch-src_parser-rc_c patches/patch-src_parser-rc_c
> new file mode 100644
> index 00000000000..79f01f72bc3
> --- /dev/null
> +++ patches/patch-src_parser-rc_c
> @@ -0,0 +1,18 @@
> +$OpenBSD$
> +
> +Fix -fno-common build error.
> +
> +Index: src/parser-rc.c
> +--- src/parser-rc.c.orig
> ++++ src/parser-rc.c
> +@@ -73,8 +73,8 @@
> + void free_expr(struct expr *expr);
> + struct expr *copy_expr(struct expr *expr);
> +
> +- int current_line, *current_cell;
> +- struct line *root_line;
> ++ static int current_line, *current_cell;
> ++ static struct line *root_line;
> + struct expr *org;
> + struct label *label_list;
> + struct label *for_index;
> diff --git pkg/DESCR pkg/DESCR
> index 554fc8aabe0..dff5a9c912f 100644
> --- pkg/DESCR
> +++ pkg/DESCR
> @@ -1,6 +1,6 @@
> -Corewars is a simulation game where a number of warriors try to crash
> -each other while they are running in a virtual computer. The warriors
> -can be written in one of two assembler-like languages called Corewars
> -and Redcode. Corewars is the default language and is easier to learn
> -and understand. Redcode provides more advanced and powerful
> -instructions but also requires more time to learn.
> +Corewars is a simulation game where a number of warriors try to crash
> +each other while they are running in a virtual computer. The warriors
> +can be written in one of two assembler-like languages called Corewars
> +and Redcode. Corewars is the default language and is easier to learn
> +and understand. Redcode provides more advanced and powerful
> +instructions but also requires more time to learn.

No comments:

Post a Comment