commit:     9414bbf178fd71da75208821d57c0393a176b1c4
Author:     NHOrus <jy6x2b32pie9 <AT> yahoo <DOT> com>
AuthorDate: Wed Feb 19 18:23:11 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Apr 24 19:11:13 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9414bbf1

dev-tex/rail: update EAPI 7 -> 8, port to C23, enable parallel build

Closes: https://bugs.gentoo.org/883267
Closes: https://bugs.gentoo.org/738854
Closes: https://bugs.gentoo.org/947155
Signed-off-by: NHOrus <jy6x2b32pie9 <AT> yahoo.com>
Part-of: https://github.com/gentoo/gentoo/pull/40654
Closes: https://github.com/gentoo/gentoo/pull/40654
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-tex/rail/files/rail-1.2_p1-C23.patch           | 359 +++++++++++++++++++++
 dev-tex/rail/files/rail-1.2_p1-makefile.patch      |  21 ++
 ...rail-1.2_p1-r1.ebuild => rail-1.2_p1-r2.ebuild} |  11 +-
 3 files changed, 388 insertions(+), 3 deletions(-)

diff --git a/dev-tex/rail/files/rail-1.2_p1-C23.patch 
b/dev-tex/rail/files/rail-1.2_p1-C23.patch
new file mode 100644
index 000000000000..cdfc10264aae
--- /dev/null
+++ b/dev-tex/rail/files/rail-1.2_p1-C23.patch
@@ -0,0 +1,359 @@
+Fix includes and function definitions and signatures
+until whole thing compiles with C23.
+https://bugs.gentoo.org/738854
+https://bugs.gentoo.org/883267
+https://bugs.gentoo.org/947155
+--- a/gram.y
++++ b/gram.y
+@@ -5,6 +5,7 @@
+ #include <stdio.h>
+ 
+ #include "rail.h"
++extern int yylex (void);
+ 
+ char optchar;
+ 
+--- a/rail.c
++++ b/rail.c
+@@ -21,6 +21,7 @@
+ #include <stdlib.h>
+ #include <stdio.h>
+ #include <string.h>
++#include <unistd.h>
+ 
+ #include "patchlevel.h"
+ #include "rail.h"
+@@ -54,9 +55,7 @@
+ 
+ int anonymous;                /* anonymous rules */
+ 
+-main(argc,argv)
+-unsigned argc;
+-char *argv[];
++int main(int argc, char *argv[])
+ {
+       char *arg, **argp;
+       unsigned len;
+@@ -122,8 +121,7 @@
+       /*NOTREACHED*/
+ }
+ 
+-int setopt(c,s)
+-char c, *s;
++int setopt(char c, char *s)
+ {
+       int set;
+ 
+@@ -167,7 +165,7 @@
+       return 1;
+ }
+ 
+-usage()
++void usage(void)
+ {
+       fprintf(stderr,USAGE,myname);
+       exit(1);
+@@ -175,23 +173,21 @@
+ 
+ /* error routine for yyparse() */
+ 
+-yyerror(s)
+-char *s;
++void yyerror(char *s)
+ {
+       fatal("%s",s);
+ }
+ 
+ /* wrap-up routine for yylex() */
+ 
+-yywrap()
++int yywrap(void)
+ {
+       return(1);
+ }
+ 
+ /* check for non-NULL pointer */
+ 
+-char *mcheck(s)
+-char *s;
++char *mcheck(char *s)
+ {
+       if(s==NULL)
+               fatal("out of memory",(char *)NULL);
+@@ -201,9 +197,7 @@
+ 
+ /* make a new body */
+ 
+-BODYTYPE *newbody(kind,body1,body2)
+-int kind;
+-BODYTYPE *body1, *body2;
++BODYTYPE *newbody(int kind, BODYTYPE *body1, BODYTYPE *body2)
+ {
+       BODYTYPE *body;
+ 
+@@ -226,8 +220,7 @@
+ 
+ /* free a body recursively */
+ 
+-freebody(body)
+-BODYTYPE *body;
++void freebody(BODYTYPE *body)
+ {
+       int i;
+ 
+@@ -246,16 +239,14 @@
+ 
+ /* test if a body is empty */
+ 
+-int isemptybody(body)
+-BODYTYPE *body;
++int isemptybody(BODYTYPE *body)
+ {
+       return(body==NULL || body->kind==EMPTY);
+ }
+ 
+ /* add to a body list */
+ 
+-static addlist(body1,body2)
+-BODYTYPE *body1, *body2;
++void static addlist(BODYTYPE *body1, BODYTYPE *body2)
+ {
+       if(body1->nlist>=MAXLIST) {
+               yyerror("list too long");
+@@ -265,9 +256,7 @@
+ 
+ /* add two body lists (for CAT, BAR, PLUS) */
+ 
+-BODYTYPE *addbody(kind,body1,body2)
+-int kind;
+-BODYTYPE *body1, *body2;
++BODYTYPE *addbody(int kind, BODYTYPE *body1, BODYTYPE *body2)
+ {
+       BODYTYPE *body;
+       int i;
+@@ -292,8 +281,7 @@
+ 
+ /* reverse all concatenations (for PLUS) */
+ 
+-BODYTYPE *revbody(body)
+-BODYTYPE *body;
++BODYTYPE *revbody(BODYTYPE *body)
+ {
+       int i,j;
+       BODYTYPE *tmp;
+@@ -314,9 +302,7 @@
+ 
+ /* print a body for debugging */
+ 
+-prtbody(indent,body)
+-int indent;
+-BODYTYPE *body;
++void prtbody(int indent, BODYTYPE *body)
+ {
+       int i;
+ 
+@@ -376,9 +362,7 @@
+ 
+ /* output a body */
+ 
+-outbody(id,body)
+-IDTYPE *id;
+-BODYTYPE *body;
++void outbody(IDTYPE *id, BODYTYPE *body)
+ {
+       posbody(body,0);
+ 
+@@ -403,10 +387,7 @@
+ 
+ /* format a body */
+ 
+-fmtbody(body,cent,arrow)
+-BODYTYPE *body;
+-char *cent;
+-char arrow;
++void fmtbody(BODYTYPE *body, char *cent, char arrow)
+ {
+       BODYTYPE *body1;
+       int i;
+@@ -494,8 +475,7 @@
+ 
+ /* position body (fill in height and ystart) */
+ 
+-posbody(body,ystart)
+-BODYTYPE *body;
++void posbody(BODYTYPE *body, int ystart)
+ {
+       BODYTYPE *body1;
+       int i;
+@@ -551,8 +531,7 @@
+ 
+ /* output an index entry */
+ 
+-outindex(id)
+-IDTYPE *id;
++int outindex(IDTYPE *id)
+ {
+       if(id!=NULL)
+               fprintf(outf,"\\rail@index{%s}\n",id->name);
+@@ -560,9 +539,7 @@
+ 
+ /* make a new rule list */
+ 
+-RULETYPE *newrule(id,body)
+-IDTYPE *id;
+-BODYTYPE *body;
++RULETYPE *newrule(IDTYPE *id, BODYTYPE *body)
+ {
+       RULETYPE *rule;
+ 
+@@ -576,8 +553,7 @@
+ 
+ /* free a rule list */
+ 
+-freerule(rule)
+-RULETYPE *rule;
++void freerule(RULETYPE *rule)
+ {
+       RULETYPE *rulep;
+ 
+@@ -591,8 +567,7 @@
+ 
+ /* add two rule lists */
+ 
+-RULETYPE *addrule(rule1,rule2)
+-RULETYPE *rule1, *rule2;
++RULETYPE *addrule(RULETYPE *rule1, RULETYPE *rule2)
+ {
+       RULETYPE *rulep;
+ 
+@@ -609,8 +584,7 @@
+ 
+ /* output a rule list */
+ 
+-outrule(rule)
+-RULETYPE *rule;
++void outrule(RULETYPE *rule)
+ {
+       while(rule!=NULL) {
+ 
+@@ -625,8 +599,7 @@
+ 
+ /* look up an identifier */
+ 
+-IDTYPE *lookup(name)
+-char *name;
++IDTYPE *lookup(char *name)
+ {
+       IDTYPE *idp, **idq;
+ 
+@@ -648,8 +621,7 @@
+ 
+ /* delete an identifier */
+ 
+-delete(id)
+-IDTYPE *id;
++void delete(IDTYPE *id)
+ {
+       IDTYPE *idp, **idq;
+ 
+@@ -665,7 +637,7 @@
+ 
+ /* check that there are no undefined identifiers */
+ 
+-checkdefs()
++void checkdefs(void)
+ {
+       IDTYPE *id;
+ 
+@@ -676,8 +648,7 @@
+ 
+ /* complain about an undefined identifier */
+ 
+-undef(id)
+-IDTYPE *id;
++void undef(IDTYPE *id)
+ {
+       if(chkgram)
+               error("undefined identifier '%s'",id->name);
+@@ -685,8 +656,7 @@
+ 
+ /* complain about a redefined identifier */
+ 
+-redef(id)
+-IDTYPE *id;
++void redef(IDTYPE *id)
+ {
+       if(chkgram)
+               error("redefined identifier '%s'",id->name);
+@@ -694,8 +664,7 @@
+ 
+ /* display an error */
+ 
+-error(f,s)
+-char *f, *s;
++void error(char *f, char *s)
+ {
+       if(newline) {
+               printf("\n");
+@@ -713,8 +682,7 @@
+       fprintf(stderr,"\n");
+ }
+ 
+-fatal(f,s)
+-char *f,*s;
++void fatal(char *f, char *s)
+ {
+       error(f,s);
+ 
+--- a/rail.h
++++ b/rail.h
+@@ -68,22 +68,31 @@
+ 
+ extern IDTYPE *errorid;
+ 
+-extern char *mcheck();
++extern char *mcheck(char *s);
+ 
+-extern BODYTYPE *newbody();
+-extern freebody();
+-extern int isemptybody();
+-extern BODYTYPE *addbody();
+-extern BODYTYPE *revbody();
+-
+-extern RULETYPE *newrule();
+-extern freerule();
+-extern RULETYPE *addrule();
+-extern outrule();
+-
+-extern IDTYPE *lookup();
+-extern delete();
+-
+-extern undef();
+-extern redef();
+-extern error();
++extern BODYTYPE *newbody(int kind, BODYTYPE *body1, BODYTYPE *body2);
++extern void freebody(BODYTYPE *body);
++extern int isemptybody(BODYTYPE *body);
++extern BODYTYPE *addbody(int kind, BODYTYPE *body1, BODYTYPE *body2);
++extern BODYTYPE *revbody(BODYTYPE *body);
++extern void posbody(BODYTYPE *body, int ystart);
++extern void fmtbody(BODYTYPE *body, char *cent, char arrow);
++
++extern RULETYPE *newrule(IDTYPE *id, BODYTYPE *body);
++extern void freerule(RULETYPE *rule);
++extern RULETYPE *addrule(RULETYPE *rule1, RULETYPE *rule2);
++extern void outrule(RULETYPE *rule);
++
++extern IDTYPE *lookup(char *name);
++extern void delete(IDTYPE *id);
++
++extern void undef(IDTYPE *id);
++extern void redef(IDTYPE *id);
++extern void error(char *f, char *s);
++extern void yyerror(char *s);
++extern int yywrap(void);
++
++int setopt(char c, char *s);
++void usage(void);
++void checkdefs(void);
++void fatal(char *f, char *s);

diff --git a/dev-tex/rail/files/rail-1.2_p1-makefile.patch 
b/dev-tex/rail/files/rail-1.2_p1-makefile.patch
new file mode 100644
index 000000000000..44870b9a8c73
--- /dev/null
+++ b/dev-tex/rail/files/rail-1.2_p1-makefile.patch
@@ -0,0 +1,21 @@
+Correct Makefile, enabling parallel build.
+--- a/Makefile
++++ b/Makefile
+@@ -51,11 +53,15 @@
+ 
+ rail.o: patchlevel.h
+ 
++.PHONY: gram.c gram.h clean
++
+-gram.c gram.h: y.tab.c y.tab.h
++gram.c: y.tab.c
+       cmp -s gram.c y.tab.c || cp y.tab.c gram.c
++
++gram.h: y.tab.h
+       cmp -s gram.h y.tab.h || cp y.tab.h gram.h
+ 
+-y.tab.c y.tab.h y.output: gram.y
++y.tab.c y.tab.h y.output &: gram.y
+       $(YACC) $(YFLAGS) -dv gram.y
+ 
+ rail: $(OBJS)

diff --git a/dev-tex/rail/rail-1.2_p1-r1.ebuild 
b/dev-tex/rail/rail-1.2_p1-r2.ebuild
similarity index 83%
rename from dev-tex/rail/rail-1.2_p1-r1.ebuild
rename to dev-tex/rail/rail-1.2_p1-r2.ebuild
index cdd49433d9ca..a11cd774b754 100644
--- a/dev-tex/rail/rail-1.2_p1-r1.ebuild
+++ b/dev-tex/rail/rail-1.2_p1-r2.ebuild
@@ -1,7 +1,7 @@
-# Copyright 1999-2024 Gentoo Authors
+# Copyright 1999-2025 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=7
+EAPI=8
 
 inherit latex-package toolchain-funcs
 
@@ -18,8 +18,13 @@ BDEPEND="app-arch/unzip
        app-alternatives/yacc
        app-alternatives/lex"
 
+PATCHES=(
+       "${FILESDIR}/${P}-C23.patch"
+       "${FILESDIR}/${P}-makefile.patch"
+)
+
 src_compile() {
-       emake -j1 \
+       emake \
                CC="$(tc-getCC)" \
                CFLAGS="-DYYDEBUG ${CFLAGS} ${LDFLAGS}" \
                rail rail.dvi

Reply via email to