Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Dec 2013 02:49:59 +0900
From:      KATO Tsuguru <tkato432@yahoo.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/184820: lang/p2c: Fix build with clang
Message-ID:  <20131217024959.3920727da268d3ada2e71311@yahoo.com>
Resent-Message-ID: <201312161810.rBGIA3vm015871@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         184820
>Category:       ports
>Synopsis:       lang/p2c: Fix build with clang
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Dec 16 18:10:03 UTC 2013
>Closed-Date:
>Last-Modified:
>Originator:     KATO Tsuguru
>Release:        FreeBSD 8.4-RELEASE-p4 i386
>Organization:
>Environment:
>Description:
- Fix build with clang
- Add LICENSE

New file:
files/patch-Makefile
files/patch-comment.c
files/patch-lex.c
files/patch-loc.p2clib.c
files/patch-makeproto.c
files/patch-out.c
files/patch-p2clib.c
files/patch-parse.c
files/patch-trans.c
files/patch-trans.h

Remove file:
files/patch-a
files/patch-cc
files/patch-tc
scripts/configure

>How-To-Repeat:
>Fix:

diff -urN /usr/ports/lang/p2c/Makefile lang/p2c/Makefile
--- /usr/ports/lang/p2c/Makefile	2013-11-06 21:56:34.000000000 +0900
+++ lang/p2c/Makefile	2013-12-17 00:00:00.000000000 +0900
@@ -12,15 +12,31 @@
 MAINTAINER=	ports@FreeBSD.org
 COMMENT=	Pascal to C translator
 
-WRKSRC=		${WRKDIR}/p2c-1.21alpha-07.Dec.93
-MAN1=		p2c.1 p2cc.1
+LICENSE=	GPLv2
 
-pre-install: build
-	@${MKDIR} ${PREFIX}/bin
-	@${MKDIR} ${PREFIX}/lib
-	@${MKDIR} ${PREFIX}/man/man1
-	@${MKDIR} ${PREFIX}/include/p2c
-	@${INSTALL_MAN} ${WRKSRC}/src/p2cc.man ${PREFIX}/man/man1/p2cc.1
+WRKSRC=		${WRKDIR}/p2c-1.21alpha-07.Dec.93/src
+
+USES=		perl5 shebangfix
+SHEBANG_FILES=	p2cc.perl
+perl_OLD_CMD=	/bin/perl
+ALL_TARGET=	all p2cc
+
+do-install:
+	(cd ${WRKSRC} && ${INSTALL_PROGRAM} p2c \
+		${STAGEDIR}${PREFIX}/bin)
+	(cd ${WRKSRC} && ${INSTALL_SCRIPT} p2cc \
+		${STAGEDIR}${PREFIX}/bin)
+	(cd ${WRKSRC} && ${INSTALL_LIB} libp2c.a \
+		${STAGEDIR}${PREFIX}/lib)
+	@${MKDIR} ${STAGEDIR}${PREFIX}/include/p2c
+	(cd ${WRKSRC} && ${INSTALL_DATA} p2c.h \
+		${STAGEDIR}${PREFIX}/include/p2c)
+	@${MKDIR} ${STAGEDIR}${PREFIX}/lib/p2c
+	(cd ${WRKSRC} && ${INSTALL_DATA} sys.p2crc \
+		${STAGEDIR}${PREFIX}/lib/p2c/p2crc)
+.for i in loc.p2crc system.imp system.m2 turbo.imp string.pas
+	(cd ${WRKSRC} && ${INSTALL_DATA} ${i} \
+		${STAGEDIR}${PREFIX}/lib/p2c)
+.endfor
 
-NO_STAGE=	yes
 .include <bsd.port.mk>
diff -urN /usr/ports/lang/p2c/files/patch-Makefile lang/p2c/files/patch-Makefile
--- /usr/ports/lang/p2c/files/patch-Makefile	1970-01-01 09:00:00.000000000 +0900
+++ lang/p2c/files/patch-Makefile	2013-12-17 00:00:00.000000000 +0900
@@ -0,0 +1,68 @@
+--- Makefile.orig
++++ Makefile
+@@ -19,29 +19,30 @@
+ SHELL = /bin/sh
+ 
+ # Directories (private version)
+-HOMEDIR = ../home
+-INCDIR = ../home/p2c
+-BINDIR = ..
+-LIBDIR = ../home
+-MANDIR = ../home
+-MANFILE = p2c.cat          # human-readable manual (for cat.1)
++#HOMEDIR = ../home
++#INCDIR = ../home/p2c
++#BINDIR = ..
++#LIBDIR = ../home
++#MANDIR = ../home
++#MANFILE = p2c.cat          # human-readable manual (for cat.1)
+ #MANFILE = p2c.man.inst    # uncompressed nroff source (for man.1)
+ #MANFILE = p2c.man.Z       # compressed nroff source (for man.1.Z)
+ 
+ # Directories (public version)
+-#HOMEDIR = /usr/lib/p2c
+-#INCDIR = /usr/include/p2c
+-#BINDIR = /usr/bin
+-#LIBDIR = /usr/lib
+-#MANDIR = /usr/man/man1
+-#MANFILE = p2c.man.inst
++PREFIX ?= /usr/local
++HOMEDIR = $(PREFIX)/lib/p2c
++INCDIR = $(PREFIX)/include/p2c
++BINDIR = $(PREFIX)/bin
++LIBDIR = $(PREFIX)/lib
++MANDIR = $(PREFIX)/man/man1
++MANFILE = p2c.man.inst
+ 
+ # Compiler options
+-CC = cc                    # you may wish to use gcc here instead
++CC ?= cc                    # you may wish to use gcc here instead
+ OPT = # -O		   # uncomment this for optimization
+ DEB = # -g		   # uncomment this for debugging
+ DEFS =			   # place other -D types of things here
+-CFLAGS = $(OPT) $(DEB) $(DEFS)
++CFLAGS += $(OPT) $(DEB) $(DEFS)
+ LFLAGS =
+ 
+ 
+@@ -64,9 +65,9 @@
+ LIBOBJS = p2clib.o loc.p2clib.o
+ OTHERLIBOBJS =
+ 
+-ABSHOMEDIR = `cd $(HOMEDIR); pwd`
+-ABSINCDIR = `cd $(INCDIR); pwd`
+-ABSLIBDIR = `cd $(LIBDIR); pwd`
++ABSHOMEDIR = $(HOMEDIR)
++ABSINCDIR = $(INCDIR)
++ABSLIBDIR = $(LIBDIR)
+ 
+ MISCSRCS = makeproto.c
+ PROTOS = p2c.proto p2c.hdrs
+@@ -128,7 +129,6 @@
+ 	sed -e "s;--HOMEDIR--;$(ABSHOMEDIR);"   \
+ 	    -e "s;--INCDIR--;$(ABSINCDIR);"     \
+ 	    -e "s;--LIBDIR--;$(ABSLIBDIR);"     \
+-	    -e "s;/bin/perl;`which perl`;"      \
+ 	    p2cc.perl >p2cc
+ 	chmod a+x p2cc
+ 
diff -urN /usr/ports/lang/p2c/files/patch-a lang/p2c/files/patch-a
--- /usr/ports/lang/p2c/files/patch-a	2013-11-06 21:56:34.000000000 +0900
+++ lang/p2c/files/patch-a	1970-01-01 09:00:00.000000000 +0900
@@ -1,45 +0,0 @@
---- src/loc.p2clib.c.orig	Fri Feb 22 13:13:49 2002
-+++ src/loc.p2clib.c	Fri Feb 22 13:12:44 2002
-@@ -4,3 +4,42 @@
-  * the symbol LOCAL_INIT when you compile p2clib.c.
-  */
- 
-+/* Some Turbo "unit crt" functions. */
-+
-+#include <curses.h>
-+#include <term.h>
-+
-+static int terminfo_initialized;
-+static char *cl, *ce;
-+
-+static void initcurs()
-+{
-+    if (terminfo_initialized)
-+	return;
-+    setupterm(0, fileno(stdout), 0);
-+    ce = tgetstr("ce", 0);
-+    cl = tgetstr("cl", 0);
-+    terminfo_initialized = 1;
-+}
-+
-+void clreol()
-+{
-+    initcurs();
-+    if (ce)
-+	tputs(ce, 1, putchar);
-+}
-+
-+void clrscr()
-+{
-+    initcurs();
-+    if (cl)
-+	tputs(cl, 1, putchar);
-+}
-+
-+void delay(ms)
-+int ms;
-+{
-+    usleep(1000 * ms);
-+}
-+
-+
diff -urN /usr/ports/lang/p2c/files/patch-cc lang/p2c/files/patch-cc
--- /usr/ports/lang/p2c/files/patch-cc	2013-11-06 21:56:34.000000000 +0900
+++ lang/p2c/files/patch-cc	1970-01-01 09:00:00.000000000 +0900
@@ -1,24 +0,0 @@
---- src/Makefile.orig	Wed Dec  8 06:36:48 1993
-+++ src/Makefile	Tue Apr 13 02:12:49 2004
-@@ -24,8 +24,8 @@
- BINDIR = ..
- LIBDIR = ../home
- MANDIR = ../home
--MANFILE = p2c.cat          # human-readable manual (for cat.1)
--#MANFILE = p2c.man.inst    # uncompressed nroff source (for man.1)
-+#MANFILE = p2c.cat          # human-readable manual (for cat.1)
-+MANFILE = p2c.man.inst    # uncompressed nroff source (for man.1)
- #MANFILE = p2c.man.Z       # compressed nroff source (for man.1.Z)
- 
- # Directories (public version)
-@@ -37,8 +37,8 @@
- #MANFILE = p2c.man.inst
- 
- # Compiler options
--CC = cc                    # you may wish to use gcc here instead
--OPT = # -O		   # uncomment this for optimization
-+CC ?= cc                    # you may wish to use gcc here instead
-+OPT = $(CFLAGS)		   # uncomment this for optimization
- DEB = # -g		   # uncomment this for debugging
- DEFS =			   # place other -D types of things here
- CFLAGS = $(OPT) $(DEB) $(DEFS)
diff -urN /usr/ports/lang/p2c/files/patch-comment.c lang/p2c/files/patch-comment.c
--- /usr/ports/lang/p2c/files/patch-comment.c	1970-01-01 09:00:00.000000000 +0900
+++ lang/p2c/files/patch-comment.c	2013-12-17 00:00:00.000000000 +0900
@@ -0,0 +1,11 @@
+--- comment.c.orig
++++ comment.c
+@@ -299,7 +299,7 @@
+ 	    printf("\"%s\", line %d,%d: %s\n", infname, inf_lnum, outf_lnum, msg);
+     }
+     if (verbose)
+-	fprintf(logf, "%s:%d:%d: %s\n", infname, inf_lnum, outf_lnum, msg);
++	fprintf(p2c_logf, "%s:%d:%d: %s\n", infname, inf_lnum, outf_lnum, msg);
+     if (notephase == 2 || regression)
+ 	prefix = format_s("\004 p2c: %s:", infname);
+     else
diff -urN /usr/ports/lang/p2c/files/patch-lex.c lang/p2c/files/patch-lex.c
--- /usr/ports/lang/p2c/files/patch-lex.c	1970-01-01 09:00:00.000000000 +0900
+++ lang/p2c/files/patch-lex.c	2013-12-17 00:00:00.000000000 +0900
@@ -0,0 +1,74 @@
+--- lex.c.orig
++++ lex.c
+@@ -520,7 +520,7 @@
+ 	    if (outf != stdout)
+ 		printf("Translation aborted: Too many errors.\n");
+ 	    if (verbose)
+-		fprintf(logf, "Translation aborted: Too many errors.\n");
++		fprintf(p2c_logf, "Translation aborted: Too many errors.\n");
+ 	    closelogfile();
+ 	    exit_failure();
+ 	}
+@@ -541,9 +541,9 @@
+         printf("Translation aborted.\n");
+     }
+     if (verbose) {
+-	fprintf(logf, "%s:%d:%d: %s\n",
++	fprintf(p2c_logf, "%s:%d:%d: %s\n",
+ 		infname, inf_lnum, outf_lnum, msg);
+-	fprintf(logf, "Translation aborted.\n");
++	fprintf(p2c_logf, "Translation aborted.\n");
+     }
+     closelogfile();
+     exit_failure();
+@@ -562,7 +562,7 @@
+ {
+     if (checkeatnote(msg)) {
+ 	if (verbose)
+-	    fprintf(logf, "%s:%d:%d: Omitted warning: %s\n",
++	    fprintf(p2c_logf, "%s:%d:%d: Omitted warning: %s\n",
+ 		    infname, inf_lnum, outf_lnum, msg);
+ 	return;
+     }
+@@ -577,7 +577,7 @@
+ {
+     if (checkeatnote(msg)) {
+ 	if (verbose)
+-	    fprintf(logf, "%s:%d:%d: Omitted internal error in %s: %s\n",
++	    fprintf(p2c_logf, "%s:%d:%d: Omitted internal error in %s: %s\n",
+ 		    infname, inf_lnum, outf_lnum, proc, msg);
+ 	return;
+     }
+@@ -596,7 +596,7 @@
+ {
+     if (blockkind == TOK_IMPORT || checkeatnote(msg)) {
+ 	if (verbose)
+-	    fprintf(logf, "%s:%d:%d: Omitted note: %s\n",
++	    fprintf(p2c_logf, "%s:%d:%d: Omitted note: %s\n",
+ 		    infname, inf_lnum, outf_lnum, msg);
+ 	return;
+     }
+@@ -612,12 +612,12 @@
+ {
+     if (blockkind == TOK_IMPORT || checkeatnote(msg)) {
+ 	if (verbose)
+-	    fprintf(logf, "%s:%d:%d: Omitted end-note: %s\n",
++	    fprintf(p2c_logf, "%s:%d:%d: Omitted end-note: %s\n",
+ 		    infname, inf_lnum, outf_lnum, msg);
+ 	return;
+     }
+     if (verbose)
+-	fprintf(logf, "%s:%d:%d: Recorded end-note: %s\n",
++	fprintf(p2c_logf, "%s:%d:%d: Recorded end-note: %s\n",
+ 		infname, inf_lnum, outf_lnum, msg);
+     (void) strlist_add(&endnotelist, msg);
+ }
+@@ -1327,7 +1327,7 @@
+ 	    else
+ 		printf("Reading include file \"%s\"\n", fn);
+ 	if (verbose)
+-	    fprintf(logf, "Reading include file \"%s\"\n", fn);
++	    fprintf(p2c_logf, "Reading include file \"%s\"\n", fn);
+         if (expandincludes == 0) {
+             push_input_file(fp, fn, 2);
+             curtok = TOK_INCLUDE;
diff -urN /usr/ports/lang/p2c/files/patch-loc.p2clib.c lang/p2c/files/patch-loc.p2clib.c
--- /usr/ports/lang/p2c/files/patch-loc.p2clib.c	1970-01-01 09:00:00.000000000 +0900
+++ lang/p2c/files/patch-loc.p2clib.c	2013-12-17 00:00:00.000000000 +0900
@@ -0,0 +1,45 @@
+--- loc.p2clib.c.orig
++++ loc.p2clib.c
+@@ -4,3 +4,42 @@
+  * the symbol LOCAL_INIT when you compile p2clib.c.
+  */
+ 
++/* Some Turbo "unit crt" functions. */
++
++#include <curses.h>
++#include <term.h>
++
++static int terminfo_initialized;
++static char *cl, *ce;
++
++static void initcurs()
++{
++    if (terminfo_initialized)
++	return;
++    setupterm(0, fileno(stdout), 0);
++    ce = tgetstr("ce", 0);
++    cl = tgetstr("cl", 0);
++    terminfo_initialized = 1;
++}
++
++void clreol()
++{
++    initcurs();
++    if (ce)
++	tputs(ce, 1, putchar);
++}
++
++void clrscr()
++{
++    initcurs();
++    if (cl)
++	tputs(cl, 1, putchar);
++}
++
++void delay(ms)
++int ms;
++{
++    usleep(1000 * ms);
++}
++
++
diff -urN /usr/ports/lang/p2c/files/patch-makeproto.c lang/p2c/files/patch-makeproto.c
--- /usr/ports/lang/p2c/files/patch-makeproto.c	1970-01-01 09:00:00.000000000 +0900
+++ lang/p2c/files/patch-makeproto.c	2013-12-17 00:00:00.000000000 +0900
@@ -0,0 +1,19 @@
+--- makeproto.c.orig
++++ makeproto.c
+@@ -7,6 +7,7 @@
+ 
+ 
+ #include <stdio.h>
++#include <stdlib.h>
+ #include <ctype.h>
+ #include <time.h>
+ 
+@@ -157,7 +158,7 @@
+     char argdecls[MAXARGS][256], argnames[MAXARGS][80];
+     char *cp, *cp2, *cp3;
+     int i, j, pos, len, thistab, numstars, whichf, nargs, incomment, errors = 0;
+-    long li;
++    time_t li;
+     int typetab = 15, argtab = 30, width = 80, usenames = 0, usemacros = 0;
+     int useextern = 0, staticness = -1, hasheader = 0, useifdefs = 0;
+     int stupid = 1, firstdecl;
diff -urN /usr/ports/lang/p2c/files/patch-out.c lang/p2c/files/patch-out.c
--- /usr/ports/lang/p2c/files/patch-out.c	1970-01-01 09:00:00.000000000 +0900
+++ lang/p2c/files/patch-out.c	2013-12-17 00:00:00.000000000 +0900
@@ -0,0 +1,11 @@
+--- out.c.orig
++++ out.c
+@@ -1194,7 +1194,7 @@
+ 			    " seconds, %ld tries on line %d [251]", alts, outf_lnum);
+ 		    note(outbuf);
+ 		} else if (verbose) {
+-		    fprintf(logf, "%s, %d/%d: Line breaker spent %ld tries\n",
++		    fprintf(p2c_logf, "%s, %d/%d: Line breaker spent %ld tries\n",
+ 			    infname, inf_lnum, outf_lnum, alts);
+ 		}
+ 		if (testinglinebreaker)
diff -urN /usr/ports/lang/p2c/files/patch-p2clib.c lang/p2c/files/patch-p2clib.c
--- /usr/ports/lang/p2c/files/patch-p2clib.c	1970-01-01 09:00:00.000000000 +0900
+++ lang/p2c/files/patch-p2clib.c	2013-12-17 00:00:00.000000000 +0900
@@ -0,0 +1,29 @@
+--- p2clib.c.orig
++++ p2clib.c
+@@ -890,7 +890,7 @@
+ {
+ #ifndef NO_TIME
+     struct tm *tm;
+-    long clock;
++    time_t clock;
+ 
+     time(&clock);
+     tm = localtime(&clock);
+@@ -908,7 +908,7 @@
+ Void VAXdate(s)
+ char *s;
+ {
+-    long clock;
++    time_t clock;
+     char *c;
+     int i;
+     static int where[] = {8, 9, 0, 4, 5, 6, 0, 20, 21, 22, 23};
+@@ -924,7 +924,7 @@
+ Void VAXtime(s)
+ char *s;
+ {
+-    long clock;
++    time_t clock;
+     char *c;
+     int i;
+ 
diff -urN /usr/ports/lang/p2c/files/patch-parse.c lang/p2c/files/patch-parse.c
--- /usr/ports/lang/p2c/files/patch-parse.c	1970-01-01 09:00:00.000000000 +0900
+++ lang/p2c/files/patch-parse.c	2013-12-17 00:00:00.000000000 +0900
@@ -0,0 +1,31 @@
+--- parse.c.orig
++++ parse.c
+@@ -4392,7 +4392,7 @@
+     long saveserial;
+ 
+     if (verbose)
+-	fprintf(logf, "%s, %d/%d: Translating %s (in %s)\n",
++	fprintf(p2c_logf, "%s, %d/%d: Translating %s (in %s)\n",
+ 		infname, inf_lnum, outf_lnum,
+ 		curctx->name, curctx->ctx->name);
+     notephase = 1;
+@@ -5477,8 +5477,8 @@
+     if (!fp) {
+         if (need)
+             perror(infnbuf);
+-	if (logf)
+-	    fprintf(logf, "(Unable to open search file \"%s\")\n", infnbuf);
++	if (p2c_logf)
++	    fprintf(p2c_logf, "(Unable to open search file \"%s\")\n", infnbuf);
+         return 0;
+     }
+     flushcomments(NULL, -1, -1);
+@@ -5515,7 +5515,7 @@
+ 	    else
+ 		printf("Reading import text for \"%s\"\n", mod->name);
+ 	if (verbose)
+-	    fprintf(logf, "%s, %d/%d: Reading import text for \"%s\"\n",
++	    fprintf(p2c_logf, "%s, %d/%d: Reading import text for \"%s\"\n",
+ 		    infname, inf_lnum, outf_lnum, mod->name);
+         pushctx(mod);
+         gettok();
diff -urN /usr/ports/lang/p2c/files/patch-tc lang/p2c/files/patch-tc
--- /usr/ports/lang/p2c/files/patch-tc	2013-11-06 21:56:34.000000000 +0900
+++ lang/p2c/files/patch-tc	1970-01-01 09:00:00.000000000 +0900
@@ -1,109 +0,0 @@
-*** src/p2clib.c.orig	Wed Dec 15 14:38:38 1999
---- src/p2clib.c	Wed Dec 15 14:42:12 1999
-***************
-*** 890,896 ****
-  {
-  #ifndef NO_TIME
-      struct tm *tm;
-!     long clock;
-  
-      time(&clock);
-      tm = localtime(&clock);
---- 890,896 ----
-  {
-  #ifndef NO_TIME
-      struct tm *tm;
-!     time_t clock;
-  
-      time(&clock);
-      tm = localtime(&clock);
-***************
-*** 908,914 ****
-  Void VAXdate(s)
-  char *s;
-  {
-!     long clock;
-      char *c;
-      int i;
-      static int where[] = {8, 9, 0, 4, 5, 6, 0, 20, 21, 22, 23};
---- 908,914 ----
-  Void VAXdate(s)
-  char *s;
-  {
-!     time_t clock;
-      char *c;
-      int i;
-      static int where[] = {8, 9, 0, 4, 5, 6, 0, 20, 21, 22, 23};
-***************
-*** 924,930 ****
-  Void VAXtime(s)
-  char *s;
-  {
-!     long clock;
-      char *c;
-      int i;
-  
---- 924,930 ----
-  Void VAXtime(s)
-  char *s;
-  {
-!     time_t clock;
-      char *c;
-      int i;
-  
-*** src/trans.c.orig	Wed Dec 15 14:33:23 1999
---- src/trans.c	Wed Dec 15 14:44:29 1999
-***************
-*** 575,581 ****
-  # endif
-  #endif
-  
-! Static long starting_time;
-  
-  Static void openlogfile()
-  {
---- 575,581 ----
-  # endif
-  #endif
-  
-! Static time_t starting_time;
-  
-  Static void openlogfile()
-  {
-***************
-*** 608,614 ****
-  
-  void closelogfile()
-  {
-!     long ending_time;
-  
-      if (logf) {
-  	fprintf(logf, "\n\n");
---- 608,614 ----
-  
-  void closelogfile()
-  {
-!     time_t ending_time;
-  
-      if (logf) {
-  	fprintf(logf, "\n\n");
-*** src/makeproto.c.orig	Wed Dec 15 15:00:46 1999
---- src/makeproto.c	Wed Dec 15 15:01:58 1999
-***************
-*** 157,163 ****
-      char argdecls[MAXARGS][256], argnames[MAXARGS][80];
-      char *cp, *cp2, *cp3;
-      int i, j, pos, len, thistab, numstars, whichf, nargs, incomment, errors = 0;
-!     long li;
-      int typetab = 15, argtab = 30, width = 80, usenames = 0, usemacros = 0;
-      int useextern = 0, staticness = -1, hasheader = 0, useifdefs = 0;
-      int stupid = 1, firstdecl;
---- 157,163 ----
-      char argdecls[MAXARGS][256], argnames[MAXARGS][80];
-      char *cp, *cp2, *cp3;
-      int i, j, pos, len, thistab, numstars, whichf, nargs, incomment, errors = 0;
-!     time_t li;
-      int typetab = 15, argtab = 30, width = 80, usenames = 0, usemacros = 0;
-      int useextern = 0, staticness = -1, hasheader = 0, useifdefs = 0;
-      int stupid = 1, firstdecl;
-
diff -urN /usr/ports/lang/p2c/files/patch-trans.c lang/p2c/files/patch-trans.c
--- /usr/ports/lang/p2c/files/patch-trans.c	1970-01-01 09:00:00.000000000 +0900
+++ lang/p2c/files/patch-trans.c	2013-12-17 00:00:00.000000000 +0900
@@ -0,0 +1,82 @@
+--- trans.c.orig
++++ trans.c
+@@ -23,6 +23,8 @@
+ #include "trans.h"
+ 
+ #include <time.h>
++#include <sys/types.h>
++#include <unistd.h>
+ 
+ 
+ 
+@@ -575,7 +577,7 @@
+ # endif
+ #endif
+ 
+-Static long starting_time;
++Static time_t starting_time;
+ 
+ Static void openlogfile()
+ {
+@@ -588,17 +590,17 @@
+     if (!name)
+ 	name = format_s("%s.log", codefname);
+     saveoldfile(name);
+-    logf = fopen(name, "w");
+-    if (logf) {
+-	fprintf(logf, "\nTranslation of %s to %s by p2c %s\n",
++    p2c_logf = fopen(name, "w");
++    if (p2c_logf) {
++	fprintf(p2c_logf, "\nTranslation of %s to %s by p2c %s\n",
+ 		infname, codefname, P2C_VERSION);
+-	fprintf(logf, "Translated");
++	fprintf(p2c_logf, "Translated");
+ 	uname = getenv("USER");
+ 	if (uname)
+-	    fprintf(logf, " by %s", uname);
++	    fprintf(p2c_logf, " by %s", uname);
+ 	time(&starting_time);
+-	fprintf(logf, " on %s", ctime(&starting_time));
+-	fprintf(logf, "\n\n");
++	fprintf(p2c_logf, " on %s", ctime(&starting_time));
++	fprintf(p2c_logf, "\n\n");
+     } else {
+ 	perror(name);
+ 	verbose = 0;
+@@ -608,20 +610,20 @@
+ 
+ void closelogfile()
+ {
+-    long ending_time;
++    time_t ending_time;
+ 
+-    if (logf) {
+-	fprintf(logf, "\n\n");
++    if (p2c_logf) {
++	fprintf(p2c_logf, "\n\n");
+ #if defined(unix) || defined(__unix)
+-	fprintf(logf, "Total memory used: %ld bytes.\n", (long)sbrk(0));
++	fprintf(p2c_logf, "Total memory used: %ld bytes.\n", (long)sbrk(0));
+ #endif
+ 	time(&ending_time);
+-	fprintf(logf, "Processed %d source lines in %ld:%ld seconds.\n",
++	fprintf(p2c_logf, "Processed %d source lines in %ld:%ld seconds.\n",
+ 		inf_ltotal,
+ 		(ending_time - starting_time) / 60,
+ 		(ending_time - starting_time) % 60);
+-	fprintf(logf, "\n\nTranslation completed on %s", ctime(&ending_time));
+-	fclose(logf);
++	fprintf(p2c_logf, "\n\nTranslation completed on %s", ctime(&ending_time));
++	fclose(p2c_logf);
+     }
+ }
+ 
+@@ -949,7 +951,7 @@
+         setbuf(codef, NULL);      /* for debugging */
+     outf = codef;
+     outf_lnum = 1;
+-    logf = NULL;
++    p2c_logf = NULL;
+     if (verbose)
+ 	openlogfile();
+     setup_complete = 0;
diff -urN /usr/ports/lang/p2c/files/patch-trans.h lang/p2c/files/patch-trans.h
--- /usr/ports/lang/p2c/files/patch-trans.h	1970-01-01 09:00:00.000000000 +0900
+++ lang/p2c/files/patch-trans.h	2013-12-17 00:00:00.000000000 +0900
@@ -0,0 +1,22 @@
+--- trans.h.orig
++++ trans.h
+@@ -1773,7 +1773,7 @@
+ 
+ extern char *infname, *outfname, *codefname, *hdrfname;
+ extern char *requested_module;
+-extern FILE *inf, *outf, *codef, *hdrf, *logf;
++extern FILE *inf, *outf, *codef, *hdrf, *p2c_logf;
+ extern short setup_complete, found_module;
+ extern short regression, verbose, conserve_mem;
+ extern int inf_lnum, inf_ltotal;
+@@ -1861,8 +1861,10 @@
+ 
+ /* Our library omits declarations for these functions! */
+ 
++#ifndef __FreeBSD__
+ int link           PP( (char *, char *) );
+ int unlink         PP( (char *) );
++#endif
+ 
+ 
+ 
diff -urN /usr/ports/lang/p2c/scripts/configure lang/p2c/scripts/configure
--- /usr/ports/lang/p2c/scripts/configure	2013-11-06 21:56:34.000000000 +0900
+++ lang/p2c/scripts/configure	1970-01-01 09:00:00.000000000 +0900
@@ -1,21 +0,0 @@
-#!/bin/sh
-
-cat >>$WRKSRC/Makefile <<END || exit 1;
-
-all:
-	cd src; make OPT=-O
-END
-
-mv $WRKSRC/src/p2cc.perl $WRKSRC/src/p2cc.perl.orig || exit 1;
-sed -e 1s/--.*// < $WRKSRC/src/p2cc.perl.orig > $WRKSRC/src/p2cc.perl || exit 1;
-
-cat >>$WRKSRC/src/Makefile <<END || exit 1;
-HOMEDIR=$PREFIX/lib/p2c
-INCDIR=$PREFIX/include/p2c
-BINDIR=$PREFIX/bin
-LIBDIR=$PREFIX/lib
-MANDIR=$PREFIX/man/man1
-ABSHOMEDIR=$PREFIX/lib/p2c
-END
-
-exit 0;
>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20131217024959.3920727da268d3ada2e71311>