From c301cc94e6fd03d865da97e1a4cf73db338bd7f2 Mon Sep 17 00:00:00 2001 From: Sam James Date: Mon, 24 Oct 2022 19:01:44 +0100 Subject: sci-misc/gt-itm: fix build w/ Clang 16, musl Closes: https://bugs.gentoo.org/832835 Closes: https://bugs.gentoo.org/741582 Signed-off-by: Sam James --- .../gt-itm-19961004-Fix-build-with-Clang-16.patch | 326 +++++++++++++++++++++ .../files/gt-itm-19961004-Fix-musl-build.patch | 69 +++++ sci-misc/gt-itm/files/gt-itm-19961004-gentoo.patch | 201 +++++++++++++ sci-misc/gt-itm/files/gt-itm-implicits.patch | 28 +- sci-misc/gt-itm/gt-itm-19961004-r2.ebuild | 80 ----- sci-misc/gt-itm/gt-itm-19961004-r3.ebuild | 71 +++++ 6 files changed, 681 insertions(+), 94 deletions(-) create mode 100644 sci-misc/gt-itm/files/gt-itm-19961004-Fix-build-with-Clang-16.patch create mode 100644 sci-misc/gt-itm/files/gt-itm-19961004-Fix-musl-build.patch create mode 100644 sci-misc/gt-itm/files/gt-itm-19961004-gentoo.patch delete mode 100644 sci-misc/gt-itm/gt-itm-19961004-r2.ebuild create mode 100644 sci-misc/gt-itm/gt-itm-19961004-r3.ebuild (limited to 'sci-misc') diff --git a/sci-misc/gt-itm/files/gt-itm-19961004-Fix-build-with-Clang-16.patch b/sci-misc/gt-itm/files/gt-itm-19961004-Fix-build-with-Clang-16.patch new file mode 100644 index 000000000000..e13a035e1950 --- /dev/null +++ b/sci-misc/gt-itm/files/gt-itm-19961004-Fix-build-with-Clang-16.patch @@ -0,0 +1,326 @@ +From 960d73fb2149340e39acc23741ede9dee52b8778 Mon Sep 17 00:00:00 2001 +From: Sam James +Date: Mon, 24 Oct 2022 18:47:48 +0100 +Subject: [PATCH 1/2] Fix build with Clang 16 + +Bug: https://bugs.gentoo.org/741582 +--- a/gt-itm/src/dfs.c ++++ b/gt-itm/src/dfs.c +@@ -23,7 +23,7 @@ int dfs(Graph *G,int n,u_char *vis); + + /* check connectivity of graph g */ + /* uses depth-first search. */ +-isconnected(Graph *G) ++int isconnected(Graph *G) + { + u_char *vis; + Vertex *vp; +--- a/gt-itm/src/edriver.c ++++ b/gt-itm/src/edriver.c +@@ -51,9 +51,7 @@ + } \ + }\ + +-main(argc,argv) +- int argc; +- char *argv[]; ++int main(int argc, char **argv) + { + int i; + int min, max, sum, bins, *ddist; +@@ -63,14 +61,14 @@ main(argc,argv) + char outfile[MAXF]; + char *dstr = "-nd"; + int plen, idx; +- FILE *ddf, *evf, *pdf, *fp, *fopen(); ++ FILE *ddf, *evf, *pdf, *fp; + int prdist = 1; + enum Field f0, f1; + int first = 1; + + if (argc == 1) { + printf("Usage: edriver [-nd] [-]*\n\n"); +- return; ++ return 1; + } + /* determine whether to print distributions */ + /* determine where in argv the field pairs begin */ +--- a/gt-itm/src/eval.c ++++ b/gt-itm/src/eval.c +@@ -201,10 +201,7 @@ int bicomp(Graph *g,int verbose) + } + + +-void twofield_sptree(g,u,f0,f1) +-Graph*g; +-Vertex*u; +-enum Field f0,f1; ++void twofield_sptree(Graph *g, Vertex *u, enum Field f0, enum Field f1) + { + Vertex *v, *t; + Arc *r; +--- a/gt-itm/src/geog.c ++++ b/gt-itm/src/geog.c +@@ -33,7 +33,7 @@ + static char geogId[]="$Id: geog.c,v 1.1 1996/10/04 13:36:46 calvert Exp $"; + + long fdiam(Graph *g); +-void die(s); ++void die(char* errstr); + + double + distance(Vertex *u, Vertex *v) +@@ -75,7 +75,7 @@ printparms(char *buf,geo_parms *pp) + void + randomize(long* a, long size, long mean, int iters) + { +-register i,indx; ++int i,indx; + + for (i=0; iutil_types,GEO_UTIL); /* same for all geo graphs, */ +--- a/gt-itm/src/itm.c ++++ b/gt-itm/src/itm.c +@@ -56,7 +56,7 @@ + char *delim = " \t\n", *nonestr = ""; + static char errstr[256]; + +-void die(s); ++void die(char* errstr); + + char * + get_geoparms(FILE * f, geo_parms * pp) +@@ -298,7 +298,7 @@ geo_parms parmsbuf[MAXLEVEL]; /* make sure MAXLEVEL >= 3 */ + return NULL; + } + +-main(int argc, char **argv) ++int main(int argc, char **argv) + { + FILE *infile; + char *rv; +@@ -306,7 +306,7 @@ main(int argc, char **argv) + + if (argc == 1) { + printf("itm ....\n\n"); +- return; ++ return 1; + } + while (--argc) { + +--- a/gt-itm/src/sgb2alt.c ++++ b/gt-itm/src/sgb2alt.c +@@ -24,7 +24,7 @@ + #include "gb_save.h" + #include "geog.h" + +-main(argc,argv) ++int main(argc,argv) + int argc; + char *argv[]; + { +@@ -36,14 +36,14 @@ main(argc,argv) + + if (argc != 3) { + printf("sgb2old \n\n"); +- return; ++ return 1; + } + fout = fopen(argv[2],"w"); + + g = restore_graph(argv[1]); + if (g == NULL) { + printf("%s does not contain a correct SGB graph\n",argv[1]); +- return; ++ return 1; + } + + fprintf(fout,"GRAPH (#nodes #edges id uu vv ww xx yy zz):\n"); +--- a/gt-itm/src/ts.c ++++ b/gt-itm/src/ts.c +@@ -76,7 +76,7 @@ int stubs_OK(Vertex *snp0,Vertex *snp1); + long + fdiam(Graph *g) + { +-register i,j,k; ++int i,j,k; + long **dist, **ldist; + int changed,mallocd; + long diam, ldiam, newdist = 0, otherend; +@@ -174,7 +174,7 @@ Arc *a; + } /* fdiam */ + + void +-die(s) ++die(char* s) + { + fprintf(stderr,"Fatal error %s\n",s); + exit(1); +@@ -187,7 +187,7 @@ exit(1); + void + copyedges(Graph *fromG, Graph *toG, long base) + { +-register i, indx; ++int i, indx; + Vertex *np, *vp, *basep; + Arc *ap; + +@@ -245,7 +245,7 @@ long i,j,k; + long indx, diam, totalnodes, base, dom; + char dnodename[ID_FIELD_SIZE], snodename[ID_FIELD_SIZE]; + int dnamelen, numtries=0; +-register Vertex *v,*dnp, *snp, /* domain node and stub node pointers */ ++Vertex *v,*dnp, *snp, /* domain node and stub node pointers */ + *ddnp, *fp, *tp, *tmp; + + Arc *a; +--- a/gt-itm/src/sgb2alt.c ++++ b/gt-itm/src/sgb2alt.c +@@ -32,7 +32,7 @@ int main(argc,argv) + Vertex *v; + Arc *a; + Graph *g; +- FILE *fopen(), *fout; ++ FILE *fout; + + if (argc != 3) { + printf("sgb2old \n\n"); +--- a/sgb2ns/sgb2comns.c ++++ b/sgb2ns/sgb2comns.c +@@ -80,9 +80,7 @@ void print_flat_nodes(FILE *fout, Graph *g); + void print_edges(FILE *fout, Graph *g); + void print_hdr(FILE *fout, Graph *g); + +-main(argc,argv) +- int argc; +- char *argv[]; ++int main(int argc, char *argv[]) + { + + int hier_flag=0; +@@ -102,7 +100,7 @@ main(argc,argv) + g = restore_graph(argv[1]); + if (g == NULL) { + printf("%s does not contain a correct SGB graph\n",argv[1]); +- return; ++ return 1; + } + + if (hier_flag) +--- a/sgb2ns/sgb2hierns.c ++++ b/sgb2ns/sgb2hierns.c +@@ -47,9 +47,7 @@ + #define HUGE 655536 + + +-main(argc,argv) +- int argc; +- char *argv[]; ++int main(int argc, char *argv[]) + { + + int i, +@@ -89,7 +87,7 @@ main(argc,argv) + /* for the purpose of scenario generator, need to return a list of transits + & stubs and num of nodes in each - hence the optional third arg topofile */ + printf("sgb2hierns ??\n\n"); +- return; ++ return 1; + } + + fout = fopen(argv[2],"w"); +@@ -101,7 +99,7 @@ main(argc,argv) + g = restore_graph(argv[1]); + if (g == NULL) { + printf("%s does not contain a correct SGB graph\n",argv[1]); +- return; ++ return 1; + } + + fprintf(fout,"# Generated by sgb2hier-ns,sgb2hier-ns generated from sgb2ns\n"); +--- a/sgb2ns/sgb2ns.c ++++ b/sgb2ns/sgb2ns.c +@@ -41,27 +41,25 @@ + #include "gb_save.h" + #include "geog.h" + +-main(argc,argv) +- int argc; +- char *argv[]; ++int main(int argc,char *argv[]) + { + int i, j, nlink; + Vertex *v; + Arc *a; + Graph *g; +- FILE *fopen(), *fout; ++ FILE *fout; + char m[420]; + + if (argc != 3) { + printf("sgb2ns \n\n"); +- return; ++ return 1; + } + fout = fopen(argv[2],"w"); + + g = restore_graph(argv[1]); + if (g == NULL) { + printf("%s does not contain a correct SGB graph\n",argv[1]); +- return; ++ return 1; + } + + fprintf(fout, "# Generated by sgb2ns, created by Polly Huang\n"); +--- a/sgb2ns/ts2ns.c ++++ b/sgb2ns/ts2ns.c +@@ -55,7 +55,7 @@ main(argc,argv) + Vertex *v; + Arc *a; + Graph *g; +- FILE *fopen(), *fout; ++ FILE *fout; + char m[420], name[40]; + int transits[HUGE]; + int p,q, total_transits; diff --git a/sci-misc/gt-itm/files/gt-itm-19961004-Fix-musl-build.patch b/sci-misc/gt-itm/files/gt-itm-19961004-Fix-musl-build.patch new file mode 100644 index 000000000000..3826661bd9f1 --- /dev/null +++ b/sci-misc/gt-itm/files/gt-itm-19961004-Fix-musl-build.patch @@ -0,0 +1,69 @@ +From 15670744cc6a182cf0d2a4ed16748255ac1ff5c8 Mon Sep 17 00:00:00 2001 +From: Sam James +Date: Mon, 24 Oct 2022 18:48:48 +0100 +Subject: [PATCH 2/2] Fix musl build + +Bug: https://bugs.gentoo.org/832835 +--- a/gt-itm/src/dfs.c ++++ b/gt-itm/src/dfs.c +@@ -19,22 +19,22 @@ static char dfsID[]="$Id: dfs.c,v 1.1 1996/10/04 13:36:32 calvert Exp $"; + + #define NBBY 8 + +-int dfs(Graph *G,int n,u_char *vis); ++int dfs(Graph *G,int n,unsigned char *vis); + + /* check connectivity of graph g */ + /* uses depth-first search. */ + int isconnected(Graph *G) + { +-u_char *vis; ++unsigned char *vis; + Vertex *vp; + int i,nbytes; + + nbytes = (G->n/NBBY)+ (G->n%NBBY?1:0); + + if (nbytes < STACKMAX) { /* for small amounts we use stack frame */ +- vis = (u_char *) alloca(nbytes); ++ vis = (unsigned char *) alloca(nbytes); + } else { +- vis = (u_char *) malloc(nbytes); ++ vis = (unsigned char *) malloc(nbytes); + } + + for (i=0; i +-#include /* for NBBY */ ++#include /* for NBBY */ + #include + #include + #include /* for strchr() */ +--- a/sgb2ns/Makefile ++++ b/sgb2ns/Makefile +@@ -8,11 +8,10 @@ + # uncomment the two Solaris lines below, and comment the SunOS line. + # + # For Solaris: uncomment the next two lines +-SYS = -DSYSV +-LIBS = -lm -lgb5 ++LIBS = -lm -lgb + + # For SunOS: uncomment the next line +-#LIBS = -lm -lgb4 ++#LIBS = -lm -lgb + + GT_ITM = ../gt-itm + IDIR = $(GT_ITM)/include +@@ -33,16 +32,16 @@ CH = $(IDIR)/geog.h $(IDIR)/gb_graph.h $(IDIR)/gb_save.h + all: sgb2comns sgb2hierns sgb2ns ts2ns + + sgb2ns: $(CN) +- $(CC) $(CFLAGS) -o $(BDIR)/sgb2ns $(CN) $(LIBS) ++ $(CC) $(LDFLAGS) $(CFLAGS) -o $(BDIR)/sgb2ns $(CN) $(LIBS) + + ts2ns: $(CN) +- $(CC) $(CFLAGS) -o $(BDIR)/ts2ns $(CN) $(LIBS) ++ $(CC) $(LDFLAGS) $(CFLAGS) -o $(BDIR)/ts2ns $(CN) $(LIBS) + + sgb2hierns: $(HN) +- $(CC) $(CFLAGS) -o $(BDIR)/sgb2hierns $(HN) $(LIBS) ++ $(CC) $(LDFLAGS) $(CFLAGS) -o $(BDIR)/sgb2hierns $(HN) $(LIBS) + + sgb2comns: $(COM) +- $(CC) $(CFLAGS) -o $(BDIR)/sgb2comns $(COM) $(LIBS) ++ $(CC) $(LDFLAGS) $(CFLAGS) -o $(BDIR)/sgb2comns $(COM) $(LIBS) + + sgb2ns.o: $(CH) + sgb2hierns.o: $(CH) +--- a/sgb2ns/sgb2comns.c ++++ b/sgb2ns/sgb2comns.c +@@ -49,6 +49,7 @@ + */ + + #include ++#include + #include + #include + #include "gb_graph.h" +--- a/sgb2ns/sgb2hierns.c ++++ b/sgb2ns/sgb2hierns.c +@@ -34,7 +34,8 @@ + */ + + #include +-#include ++#include ++#include + #include "gb_graph.h" + #include "gb_save.h" + #include "geog.h" diff --git a/sci-misc/gt-itm/files/gt-itm-implicits.patch b/sci-misc/gt-itm/files/gt-itm-implicits.patch index 7618354469ff..70da0f568c65 100644 --- a/sci-misc/gt-itm/files/gt-itm-implicits.patch +++ b/sci-misc/gt-itm/files/gt-itm-implicits.patch @@ -1,5 +1,5 @@ ---- gt-itm/src/geog.c -+++ gt-itm/src/geog.c +--- a/gt-itm/src/geog.c ++++ b/gt-itm/src/geog.c @@ -6,6 +6,7 @@ */ @@ -18,8 +18,8 @@ double distance(Vertex *u, Vertex *v) { ---- gt-itm/src/ts.c -+++ gt-itm/src/ts.c +--- a/gt-itm/src/ts.c ++++ b/gt-itm/src/ts.c @@ -8,6 +8,7 @@ */ @@ -39,8 +39,8 @@ /* fast diameter computation using Floyd-Warshall * Returns the HOP diameter of the graph, i.e. each edge given UNIT wt. * Leaves the LENGTH diameter of the graph in g->Gldiam. ---- gt-itm/include/geog.h -+++ gt-itm/include/geog.h +--- a/gt-itm/include/geog.h ++++ b/gt-itm/include/geog.h @@ -74,3 +74,8 @@ geo_parms* toppp, /* params for transit connectivity */ geo_parms* transpp, /* " " transit domains */ @@ -50,8 +50,8 @@ +long idist(Vertex *u, Vertex *v); +int printparms(char *buf,geo_parms *pp); +int isconnected(Graph *G); ---- gt-itm/src/edriver.c -+++ gt-itm/src/edriver.c +--- a/gt-itm/src/edriver.c ++++ b/gt-itm/src/edriver.c @@ -35,6 +35,8 @@ */ @@ -61,8 +61,8 @@ #include "gb_graph.h" #include "gb_save.h" #include "gb_dijk.h" ---- gt-itm/include/eval.h -+++ gt-itm/include/eval.h +--- a/gt-itm/include/eval.h ++++ b/gt-itm/include/eval.h @@ -8,4 +8,7 @@ enum Field {Len, A, B, Hops}; @@ -72,8 +72,8 @@ +void dopaths(Graph *g, enum Field f0, enum Field f1, int *rmin, int *rmax, float *ravg); +void dodepthdist(Graph *g, int** ddist); +int bicomp(Graph *g,int verbose); ---- gt-itm/src/dfs.c -+++ gt-itm/src/dfs.c +--- a/gt-itm/src/dfs.c ++++ b/gt-itm/src/dfs.c @@ -6,6 +6,7 @@ */ @@ -91,8 +91,8 @@ /* check connectivity of graph g */ /* uses depth-first search. */ isconnected(Graph *G) ---- gt-itm/src/itm.c.orig 2010-10-12 17:11:25.748461793 +0200 -+++ gt-itm/src/itm.c 2010-10-12 17:13:09.237165705 +0200 +--- a/gt-itm/src/itm.c.orig ++++ b/gt-itm/src/itm.c @@ -42,6 +42,7 @@ #include /* for calloc(),atoi(),etc. */ #include /* for strtok() */ diff --git a/sci-misc/gt-itm/gt-itm-19961004-r2.ebuild b/sci-misc/gt-itm/gt-itm-19961004-r2.ebuild deleted file mode 100644 index 295139f5bfc9..000000000000 --- a/sci-misc/gt-itm/gt-itm-19961004-r2.ebuild +++ /dev/null @@ -1,80 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=6 - -inherit toolchain-funcs - -DESCRIPTION="Routines to generate / analyze graphs using models for internetwork topology" -HOMEPAGE="http://www.cc.gatech.edu/fac/Ellen.Zegura/graphs.html - http://www.isi.edu/nsnam/ns/ns-topogen.html#gt-itm" -SRC_URI="http://www.cc.gatech.edu/fac/Ellen.Zegura/gt-itm/gt-itm.tar.gz -> ${P}.tar.gz - http://www.isi.edu/nsnam/dist/sgb2ns.tar.gz -> sgb2ns-${PV}.tar.gz" - -LICENSE="all-rights-reserved sgb2ns" -SLOT="0" -KEYWORDS="~amd64 ~x86" -RESTRICT="mirror bindist" -IUSE="doc" - -DEPEND="dev-util/sgb" -RDEPEND="${DEPEND}" - -S="${WORKDIR}/${PN}" -S2="${WORKDIR}/sgb2ns" - -PATCHES=( "${FILESDIR}"/${PN}-implicits.patch ) -DOCS=( README docs/. ) - -src_unpack() { - unpack "sgb2ns-${PV}.tar.gz" - - mkdir "${S}" || die - cd "${S}" || die - unpack "${P}.tar.gz" -} - -src_prepare() { - sed -ri -e '/^[[:alnum:]]+\.o:/d' \ - -e 's|LIBS = -lm -lgb.*|LIBS = -lm -lgb|' \ - -e 's/\$\(CC\)/& \$\(LDFLAGS\)/g' \ - src/Makefile || die - sed -ri -e '/^SYS = -DSYSV/d' \ - -e 's|LIBS = -lm -lgb.*|LIBS = -lm -lgb|' \ - -e 's/\$\(CC\)/& \$\(LDFLAGS\)/g' \ - "${S2}"/Makefile || die - - rm -f lib/* || die - - while IFS="" read -d $'\0' -r file; do - sed -i -re 's|(\.\./)+bin/||g' "$file" || die - done < <(find sample-graphs/ -perm /a+x -type f -name 'Run*' -print0) - - sed -i -e 's|sys/types.h|sys/param.h|' src/geog.c || die - sed -i -e '162 s/connected $/connected \\/' src/eval.c || die - - # fix implicit function declarations - sed -i -e '/stdio.h/ a\#include ' \ - "${S2}/sgb2comns.c" "${S2}/sgb2hierns.c" || die - sed -i -e "s///g" "${S2}/sgb2hierns.c" || die - default -} - -src_compile() { - emake -C src CFLAGS="${CFLAGS} -I../include" LDFLAGS="${LDFLAGS}" \ - CC="$(tc-getCC)" - - emake -C "${S2}" CFLAGS="${CFLAGS} -I\$(IDIR) -L\$(LDIR)" LDFLAGS="${LDFLAGS}" \ - CC="$(tc-getCC)" -} - -src_install() { - dobin bin/* - einstalldocs - newdoc "${S2}"/README README.sgb2ns - if use doc; then - dodoc -r sample-graphs - dodoc "${S2}"/*.{tcl,gb} - docompress -x "/usr/share/doc/${PF}/sample-graphs" - fi -} diff --git a/sci-misc/gt-itm/gt-itm-19961004-r3.ebuild b/sci-misc/gt-itm/gt-itm-19961004-r3.ebuild new file mode 100644 index 000000000000..fb3284587034 --- /dev/null +++ b/sci-misc/gt-itm/gt-itm-19961004-r3.ebuild @@ -0,0 +1,71 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit flag-o-matic toolchain-funcs + +DESCRIPTION="Routines to generate / analyze graphs using models for internetwork topology" +HOMEPAGE="http://www.cc.gatech.edu/fac/Ellen.Zegura/graphs.html + http://www.isi.edu/nsnam/ns/ns-topogen.html#gt-itm" +SRC_URI="http://www.cc.gatech.edu/fac/Ellen.Zegura/gt-itm/gt-itm.tar.gz -> ${P}.tar.gz + http://www.isi.edu/nsnam/dist/sgb2ns.tar.gz -> sgb2ns-${PV}.tar.gz" +S="${WORKDIR}/${PN}" +S2="${WORKDIR}/sgb2ns" + +LICENSE="all-rights-reserved sgb2ns" +SLOT="0" +KEYWORDS="~amd64 ~x86" +RESTRICT="mirror bindist" +IUSE="doc" + +DEPEND="dev-util/sgb" +RDEPEND="${DEPEND}" + +PATCHES=( + "${FILESDIR}"/${PN}-19961004-gentoo.patch + "${FILESDIR}"/${PN}-implicits.patch + "${FILESDIR}"/${PN}-19961004-Fix-build-with-Clang-16.patch + "${FILESDIR}"/${PN}-19961004-Fix-musl-build.patch +) + +DOCS=( README docs/. ) + +src_unpack() { + unpack "sgb2ns-${PV}.tar.gz" + + mkdir "${S}" || die + cd "${S}" || die + unpack "${P}.tar.gz" +} + +src_prepare() { + rm -f lib/* || die + + cd "${WORKDIR}" || die + default + cd "${S}" || die +} + +src_compile() { + append-cflags -std=gnu89 + + emake -C src CFLAGS="${CFLAGS} -I../include" LDFLAGS="${LDFLAGS}" \ + CC="$(tc-getCC)" + + emake -C "${S2}" CFLAGS="${CFLAGS} -I\$(IDIR) -L\$(LDIR)" LDFLAGS="${LDFLAGS}" \ + CC="$(tc-getCC)" +} + +src_install() { + dobin bin/* + + einstalldocs + newdoc "${S2}"/README README.sgb2ns + + if use doc; then + dodoc -r sample-graphs + dodoc "${S2}"/*.{tcl,gb} + docompress -x /usr/share/doc/${PF}/sample-graphs + fi +} -- cgit v1.2.3-65-gdbad