This avoids the %n usage, switches HOMEPAGE and MASTER_SITES to https
and adds a proper fix for -fno-common, as all common variables come
from iface.[ch], so we can simply extern them in the header.

Index: Makefile
===================================================================
RCS file: /cvs/ports/math/mcl/Makefile,v
retrieving revision 1.14
diff -u -p -r1.14 Makefile
--- Makefile    14 Feb 2021 03:19:26 -0000      1.14
+++ Makefile    14 Sep 2021 03:07:01 -0000
@@ -5,14 +5,16 @@ COMMENT=      clustering algorithm for graphs
 V=             14-137
 DISTNAME=      mcl-${V}
 PKGNAME=       mcl-${V:S,-,_,}
+REVISION=      0
+
 CATEGORIES=    math
 
-HOMEPAGE=      http://micans.org/mcl/
+HOMEPAGE=      https://micans.org/mcl/
 
 # GPLv2
 PERMIT_PACKAGE=        Yes
 
-MASTER_SITES=  http://micans.org/mcl/src/
+MASTER_SITES=  https://micans.org/mcl/src/
 
 WANTLIB=       c m pthread
 
@@ -20,8 +22,5 @@ CONFIGURE_STYLE=gnu
 USE_GROFF =    Yes
 
 FAKE_FLAGS=    exampledir=${PREFIX}/share/examples/mcl/
-
-# 20+ duplicate symbols
-CFLAGS+=       -fcommon
 
 .include <bsd.port.mk>
Index: patches/patch-src_impala_iface_h
===================================================================
RCS file: patches/patch-src_impala_iface_h
diff -N patches/patch-src_impala_iface_h
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_impala_iface_h    14 Sep 2021 03:13:55 -0000
@@ -0,0 +1,31 @@
+$OpenBSD$
+
+Fix for -fno-common
+
+Index: src/impala/iface.h
+--- src/impala/iface.h.orig
++++ src/impala/iface.h
+@@ -16,15 +16,15 @@
+ 
+ /* This file currently provides nothing */
+ 
+-dim nu_meet_can  ;
+-dim nu_meet_sl   ;
+-dim nu_meet_zip  ;
+-dim nu_diff_can  ;
+-dim nu_diff_sl   ;
+-dim nu_diff_zip  ;
+-double nu_magic  ;
++extern dim nu_meet_can  ;
++extern dim nu_meet_sl   ;
++extern dim nu_meet_zip  ;
++extern dim nu_diff_can  ;
++extern dim nu_diff_sl   ;
++extern dim nu_diff_zip  ;
++extern double nu_magic  ;
+ 
+-dim mclx_n_thread_g  ;
++extern dim mclx_n_thread_g  ;
+ 
+ #endif
+ 
Index: patches/patch-src_impala_io_c
===================================================================
RCS file: patches/patch-src_impala_io_c
diff -N patches/patch-src_impala_io_c
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ patches/patch-src_impala_io_c       14 Sep 2021 03:13:55 -0000
@@ -0,0 +1,42 @@
+$OpenBSD$
+
+Avoid printf %n
+
+Index: src/impala/io.c
+--- src/impala/io.c.orig
++++ src/impala/io.c
+@@ -1413,10 +1413,10 @@ static void mclva_dump
+    ;  }
+ 
+       if (vid>=0)
+-      {  fprintf(fp, "%ld%n", (long) vid, &n_converted)
++      {  n_converted = fprintf(fp, "%ld", (long) vid)
+       ;  nr_chars += n_converted
+       ;  if (vec->val != 0.0)
+-            fprintf(fp, ":%.*g%n", valdigits, (double) vec->val, &n_converted)
++            n_converted = fprintf(fp, ":%.*g", valdigits, (double) vec->val)
+          ,  nr_chars += n_converted
+       ;  while (nr_chars+1 < leadwidth)  /* we get one below */
+          {  fputs(" ", fp)
+@@ -1426,18 +1426,17 @@ static void mclva_dump
+ 
+       for (d=0; d<vec->n_ivps;d++)
+       {  if (valdigits > -1)
+-         {  fprintf
++         {  n_converted = fprintf
+             (  fp
+-            ,  " %ld:%.*g%n"
++            ,  " %ld:%.*g"
+             ,  (long) (vec->ivps+d)->idx
+             ,  (int) valdigits
+             ,  (double) (vec->ivps+d)->val
+-            ,  &n_converted
+             )
+          ;  nr_chars += n_converted
+       ;  }
+          else if (valdigits == MCLXIO_VALUE_NONE)
+-         {  fprintf(fp, " %ld%n",  (long) (vec->ivps+d)->idx, &n_converted)
++         {  n_converted = fprintf(fp, " %ld",  (long) (vec->ivps+d)->idx)
+          ;  nr_chars += n_converted
+       ;  }
+ 

Reply via email to