summaryrefslogtreecommitdiff
path: root/lang
diff options
context:
space:
mode:
authordholland <dholland@pkgsrc.org>2011-12-18 16:54:08 +0000
committerdholland <dholland@pkgsrc.org>2011-12-18 16:54:08 +0000
commit6fbdfe0a9793de0da20b2dd7a4532a4f46253a62 (patch)
treede45071f1ee43b694d05c0649a59b7760a615d95 /lang
parent26842719bda528dd13245e9383457ea788ffa933 (diff)
downloadpkgsrc-6fbdfe0a9793de0da20b2dd7a4532a4f46253a62.tar.gz
Assorted fixes:
- explain why we need post-extract chmods - sort PLIST - add patch comments - clean up some pkglint - fix a symbol name conflict with logf (from math.h + a gcc builtin) - fix some other bugs/issues found by gcc - add standard headers - remove some bogus BSD/System V include probing - probably fix gcc 4.5 build (not fully tested) - bump PKGREVISION
Diffstat (limited to 'lang')
-rw-r--r--lang/p2c/Makefile7
-rw-r--r--lang/p2c/PLIST10
-rw-r--r--lang/p2c/distinfo19
-rw-r--r--lang/p2c/patches/patch-aa22
-rw-r--r--lang/p2c/patches/patch-ab4
-rw-r--r--lang/p2c/patches/patch-ac89
-rw-r--r--lang/p2c/patches/patch-ad4
-rw-r--r--lang/p2c/patches/patch-ae36
-rw-r--r--lang/p2c/patches/patch-comment_c61
-rw-r--r--lang/p2c/patches/patch-decl_c33
-rw-r--r--lang/p2c/patches/patch-expr_c15
-rw-r--r--lang/p2c/patches/patch-makeproto_c38
-rw-r--r--lang/p2c/patches/patch-out_c15
-rw-r--r--lang/p2c/patches/patch-trans_c155
-rw-r--r--lang/p2c/patches/patch-trans_h93
15 files changed, 574 insertions, 27 deletions
diff --git a/lang/p2c/Makefile b/lang/p2c/Makefile
index b6b0b32b7b2..0323e18830a 100644
--- a/lang/p2c/Makefile
+++ b/lang/p2c/Makefile
@@ -1,6 +1,7 @@
-# $NetBSD: Makefile,v 1.12 2011/12/16 17:18:52 marino Exp $
+# $NetBSD: Makefile,v 1.13 2011/12/18 16:54:08 dholland Exp $
DISTNAME= p2c-1.20
+PKGREVISION= 1
CATEGORIES= lang
MASTER_SITES= ftp://csvax.cs.caltech.edu/pub/
EXTRACT_SUFX= .tar.Z
@@ -19,7 +20,9 @@ INSTALL_MAKE_FLAGS= PREFIX=${DESTDIR}${PREFIX}
.include "../../mk/bsd.prefs.mk"
post-extract:
- # fix work dir permissions, set to 777 after extraction (why?)
+ # The distfile contains a number of world-writable files, including
+ # an entry for '.' that causes pkgsrc to become upset. Fix it.
${CHMOD} 755 ${WRKDIR}
+ ${CHMOD} -R o-w ${WRKDIR}
.include "../../mk/bsd.pkg.mk"
diff --git a/lang/p2c/PLIST b/lang/p2c/PLIST
index 31a9f146fab..b106a1438de 100644
--- a/lang/p2c/PLIST
+++ b/lang/p2c/PLIST
@@ -1,11 +1,11 @@
-@comment $NetBSD: PLIST,v 1.2 2009/06/14 18:03:38 joerg Exp $
+@comment $NetBSD: PLIST,v 1.3 2011/12/18 16:54:08 dholland Exp $
bin/p2c
-lib/libp2c.a
-man/man1/p2c.1
include/p2c/p2c.h
-libdata/p2c/p2crc
+lib/libp2c.a
libdata/p2c/loc.p2crc
+libdata/p2c/p2crc
+libdata/p2c/string.pas
libdata/p2c/system.imp
libdata/p2c/system.m2
libdata/p2c/turbo.imp
-libdata/p2c/string.pas
+man/man1/p2c.1
diff --git a/lang/p2c/distinfo b/lang/p2c/distinfo
index 5fc6612037f..639c1d74e30 100644
--- a/lang/p2c/distinfo
+++ b/lang/p2c/distinfo
@@ -1,10 +1,17 @@
-$NetBSD: distinfo,v 1.4 2009/09/03 13:14:10 joerg Exp $
+$NetBSD: distinfo,v 1.5 2011/12/18 16:54:08 dholland Exp $
SHA1 (p2c-1.20.tar.Z) = 797c5394d50567d5195548d3919c5a66ab90f680
RMD160 (p2c-1.20.tar.Z) = 9917ef3f501b1506f2992d572f439398862fba4c
Size (p2c-1.20.tar.Z) = 579294 bytes
-SHA1 (patch-aa) = 0cd351023774bd4ffa50d10b1a02bf37cb54f781
-SHA1 (patch-ab) = 852981992cefacd660ae8f136d64e22fb323fb03
-SHA1 (patch-ac) = 25003bcfdaa806bc556c182f33d6c0b95eda83f3
-SHA1 (patch-ad) = 54368e2cead224e1b696d7a1f1c8b0152d7783f1
-SHA1 (patch-ae) = a9299dc05cd831e6ca9977a2fb4c14a09c8f8b24
+SHA1 (patch-aa) = 0da0ac982bfc799dae3d291a66abb50239ffa9da
+SHA1 (patch-ab) = ceeda201cff0dfb975fec7f489fdaaca94984935
+SHA1 (patch-ac) = d169a0c722bebd53f9de25c0f6e208236650939a
+SHA1 (patch-ad) = f2ecb3a2f0cf51024b221e02eb92b9e517455d93
+SHA1 (patch-ae) = 43d37b979e0b111b5314802584207abc739a723c
+SHA1 (patch-comment_c) = e9a03bc63787e042678a7f18996e4e11168bbe19
+SHA1 (patch-decl_c) = 7a0afaa3ebc94159a8e54ae48300456d11dfa3f1
+SHA1 (patch-expr_c) = 314559cb335fac66f25bbf1d3343a7a8f4f88f9a
+SHA1 (patch-makeproto_c) = 55b947e8f1de54ab072bd4b32cf0f71973906083
+SHA1 (patch-out_c) = bd78a599ed5f2d34e58aee717555c1dc57ea76ec
+SHA1 (patch-trans_c) = b64b5dd8f6ef9e03007478ade7495877fa2d7f81
+SHA1 (patch-trans_h) = fb935075574c15b8ba2622392ceb9c0352459ca6
diff --git a/lang/p2c/patches/patch-aa b/lang/p2c/patches/patch-aa
index ba5e23c3cc1..bcffab8b211 100644
--- a/lang/p2c/patches/patch-aa
+++ b/lang/p2c/patches/patch-aa
@@ -1,6 +1,11 @@
-$NetBSD: patch-aa,v 1.1.1.1 1999/01/31 03:47:27 jwise Exp $
---- Makefile.orig Fri Jan 29 14:52:07 1999
-+++ Makefile Fri Jan 29 15:15:47 1999
+$NetBSD: patch-aa,v 1.2 2011/12/18 16:54:08 dholland Exp $
+
+ - configure for pkgsrc
+ - use ranlib properly
+ - fix install permissions
+
+--- Makefile.orig 1991-04-24 20:30:37.000000000 +0000
++++ Makefile
@@ -18,13 +18,13 @@
@@ -22,7 +27,7 @@ $NetBSD: patch-aa,v 1.1.1.1 1999/01/31 03:47:27 jwise Exp $
#MANFILE = p2c.man.Z # compressed nroff source (for man.1.Z)
# Directories (public version)
-@@ -39,7 +39,7 @@
+@@ -39,7 +39,7 @@ MANFILE = p2c.cat # human-reada
CC = cc # you may wish to use gcc here instead
OPT = # -O # uncomment this for optimization
DEB = # -g # uncomment this for debugging
@@ -31,7 +36,7 @@ $NetBSD: patch-aa,v 1.1.1.1 1999/01/31 03:47:27 jwise Exp $
CFLAGS = $(OPT) $(DEB) $(DEFS)
LFLAGS =
-@@ -63,9 +63,9 @@
+@@ -63,9 +63,9 @@ LIBSRCS = p2clib.c loc.p2clib.c
LIBOBJS = p2clib.o loc.p2clib.o
OTHERLIBOBJS =
@@ -44,7 +49,7 @@ $NetBSD: patch-aa,v 1.1.1.1 1999/01/31 03:47:27 jwise Exp $
MISCSRCS = makeproto.c
PROTOS = p2c.proto p2c.hdrs
-@@ -129,7 +129,8 @@
+@@ -129,7 +129,8 @@ p2c.cat: p2c.man.inst
# Third, execute "make install" to compile and set things up.
# (You may need to have a system operator do these steps for you.)
@@ -54,7 +59,7 @@ $NetBSD: patch-aa,v 1.1.1.1 1999/01/31 03:47:27 jwise Exp $
newhome:
rm -f trans.o # force trans.c to be recompiled (if HOMEDIR changes)
-@@ -156,35 +157,35 @@
+@@ -156,35 +157,35 @@ makedirs:
if [ ! -d $(INCDIR) ]; then mkdir $(INCDIR); fi
$(BINDIR)/p2c: p2c
@@ -63,8 +68,9 @@ $NetBSD: patch-aa,v 1.1.1.1 1999/01/31 03:47:27 jwise Exp $
$(LIBDIR)/libp2c.a: libp2c.a
- $(COPY) libp2c.a $(LIBDIR)/libp2c.a
+- if [ -f /usr/bin/ranlib -o -f /bin/ranlib ]; then ranlib $(LIBDIR)/libp2c.a; fi
+ $(COPYDATA) libp2c.a $(LIBDIR)/libp2c.a
- if [ -f /usr/bin/ranlib -o -f /bin/ranlib ]; then ranlib $(LIBDIR)/libp2c.a; fi
++ ranlib $(LIBDIR)/libp2c.a || true
$(MANDIR)/p2c.1: $(MANFILE)
- $(COPY) $(MANFILE) $(MANDIR)/p2c.1
diff --git a/lang/p2c/patches/patch-ab b/lang/p2c/patches/patch-ab
index 97273ff3ea4..a70e2da0c32 100644
--- a/lang/p2c/patches/patch-ab
+++ b/lang/p2c/patches/patch-ab
@@ -1,4 +1,6 @@
-$NetBSD: patch-ab,v 1.2 1999/12/08 09:47:21 rh Exp $
+$NetBSD: patch-ab,v 1.3 2011/12/18 16:54:09 dholland Exp $
+
+- use standard headers
--- p2clib.c.orig Wed Apr 24 22:30:49 1991
+++ p2clib.c Wed Dec 8 10:47:00 1999
diff --git a/lang/p2c/patches/patch-ac b/lang/p2c/patches/patch-ac
index 06ab5bde23f..ed49926e637 100644
--- a/lang/p2c/patches/patch-ac
+++ b/lang/p2c/patches/patch-ac
@@ -1,7 +1,74 @@
-$NetBSD: patch-ac,v 1.1 2009/09/03 13:14:10 joerg Exp $
+$NetBSD: patch-ac,v 1.2 2011/12/18 16:54:09 dholland Exp $
---- lex.c.orig 1991-04-24 22:30:40.000000000 +0200
+- fix symbol conflict with getline (which is now a POSIX thing)
+- fix symbol conflict with logf (from math.h)
+- fix wrong printf format
+
+--- lex.c.orig 1991-04-24 20:30:40.000000000 +0000
+++ lex.c
+@@ -500,7 +500,7 @@ void counterror()
+ if (outf != stdout)
+ printf("Translation aborted: Too many errors.\n");
+ if (verbose)
+- fprintf(logf, "Translation aborted: Too many errors.\n");
++ fprintf(loggf, "Translation aborted: Too many errors.\n");
+ closelogfile();
+ exit(EXIT_FAILURE);
+ }
+@@ -521,9 +521,9 @@ char *msg;
+ printf("Translation aborted.\n");
+ }
+ if (verbose) {
+- fprintf(logf, "%s, line %d/%d: %s\n",
++ fprintf(loggf, "%s, line %d/%d: %s\n",
+ infname, inf_lnum, outf_lnum, msg);
+- fprintf(logf, "Translation aborted.\n");
++ fprintf(loggf, "Translation aborted.\n");
+ }
+ closelogfile();
+ exit(EXIT_FAILURE);
+@@ -542,7 +542,7 @@ char *msg;
+ {
+ if (checkeatnote(msg)) {
+ if (verbose)
+- fprintf(logf, "%s, %d/%d: Omitted warning: %s\n",
++ fprintf(loggf, "%s, %d/%d: Omitted warning: %s\n",
+ infname, inf_lnum, outf_lnum, msg);
+ return;
+ }
+@@ -557,7 +557,7 @@ char *proc, *msg;
+ {
+ if (checkeatnote(msg)) {
+ if (verbose)
+- fprintf(logf, "%s, %d/%d: Omitted internal error in %s: %s\n",
++ fprintf(loggf, "%s, %d/%d: Omitted internal error in %s: %s\n",
+ infname, inf_lnum, outf_lnum, proc, msg);
+ return;
+ }
+@@ -576,7 +576,7 @@ char *msg;
+ {
+ if (blockkind == TOK_IMPORT || checkeatnote(msg)) {
+ if (verbose)
+- fprintf(logf, "%s, %d/%d: Omitted note: %s\n",
++ fprintf(loggf, "%s, %d/%d: Omitted note: %s\n",
+ infname, inf_lnum, outf_lnum, msg);
+ return;
+ }
+@@ -592,12 +592,12 @@ char *msg;
+ {
+ if (blockkind == TOK_IMPORT || checkeatnote(msg)) {
+ if (verbose)
+- fprintf(logf, "%s, %d/%d: Omitted end-note: %s\n",
++ fprintf(loggf, "%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(loggf, "%s, %d/%d: Recorded end-note: %s\n",
+ infname, inf_lnum, outf_lnum, msg);
+ (void) strlist_add(&endnotelist, msg);
+ }
@@ -969,7 +969,7 @@ void progress()
@@ -38,6 +105,15 @@ $NetBSD: patch-ac,v 1.1 2009/09/03 13:14:10 joerg Exp $
*inbuf = 0;
inbufptr = inbuf;
gettok();
+@@ -1251,7 +1251,7 @@ char *fn;
+ else
+ printf("Reading include file \"%s\"\n", fn);
+ if (verbose)
+- fprintf(logf, "Reading include file \"%s\"\n", fn);
++ fprintf(loggf, "Reading include file \"%s\"\n", fn);
+ if (expandincludes == 0) {
+ push_input_file(fp, fn, 2);
+ curtok = TOK_INCLUDE;
@@ -2206,7 +2206,7 @@ int starparen; /* 0={ }, 1=(* *), 2=C
else
commentline(CMT_POST);
@@ -65,6 +141,15 @@ $NetBSD: patch-ac,v 1.1 2009/09/03 13:14:10 joerg Exp $
break;
case ' ':
+@@ -2529,7 +2529,7 @@ void gettok()
+ case TOK_OCTLIT:
+ case TOK_INTLIT:
+ case TOK_MININT:
+- printf(", curtokint = %d", curtokint);
++ printf(", curtokint = %ld", curtokint);
+ break;
+ case TOK_REALLIT:
+ case TOK_STRLIT:
@@ -2559,7 +2559,7 @@ void gettok()
case 0:
if (commenting_flag)
diff --git a/lang/p2c/patches/patch-ad b/lang/p2c/patches/patch-ad
index 2aef62fd83b..304fa53b6ae 100644
--- a/lang/p2c/patches/patch-ad
+++ b/lang/p2c/patches/patch-ad
@@ -1,4 +1,6 @@
-$NetBSD: patch-ad,v 1.1 2009/09/03 13:14:10 joerg Exp $
+$NetBSD: patch-ad,v 1.2 2011/12/18 16:54:09 dholland Exp $
+
+- fix symbol conflict with getline (which is now a POSIX thing)
--- p2c.hdrs.orig 2009-09-03 14:57:47.000000000 +0200
+++ p2c.hdrs
diff --git a/lang/p2c/patches/patch-ae b/lang/p2c/patches/patch-ae
index e0a0308ba96..59336ef831c 100644
--- a/lang/p2c/patches/patch-ae
+++ b/lang/p2c/patches/patch-ae
@@ -1,7 +1,19 @@
-$NetBSD: patch-ae,v 1.1 2009/09/03 13:14:10 joerg Exp $
+$NetBSD: patch-ae,v 1.2 2011/12/18 16:54:09 dholland Exp $
---- parse.c.orig 2009-09-03 14:57:44.000000000 +0200
+- fix symbol conflict with getline (which is now a POSIX thing)
+- fix symbol conflict with logf (from math.h)
+
+--- parse.c.orig 1991-04-24 20:30:42.000000000 +0000
+++ parse.c
+@@ -3150,7 +3150,7 @@ Static Stmt *p_body()
+ long saveserial;
+
+ if (verbose)
+- fprintf(logf, "%s, %d/%d: Translating %s (in %s)\n",
++ fprintf(loggf, "%s, %d/%d: Translating %s (in %s)\n",
+ infname, inf_lnum, outf_lnum,
+ curctx->name, curctx->ctx->name);
+ notephase = 1;
@@ -3769,7 +3769,7 @@ Token blkind;
out_include(fname, 1);
outsection(majorspace);
@@ -11,3 +23,23 @@ $NetBSD: patch-ae,v 1.1 2009/09/03 13:14:10 joerg Exp $
gettok();
}
+@@ -4157,8 +4157,8 @@ int need;
+ if (!fp) {
+ if (need)
+ perror(infnbuf);
+- if (logf)
+- fprintf(logf, "(Unable to open search file \"%s\")\n", infnbuf);
++ if (loggf)
++ fprintf(loggf, "(Unable to open search file \"%s\")\n", infnbuf);
+ return 0;
+ }
+ flushcomments(NULL, -1, -1);
+@@ -4195,7 +4195,7 @@ int need;
+ else
+ printf("Reading import text for \"%s\"\n", mod->name);
+ if (verbose)
+- fprintf(logf, "%s, %d/%d: Reading import text for \"%s\"\n",
++ fprintf(loggf, "%s, %d/%d: Reading import text for \"%s\"\n",
+ infname, inf_lnum, outf_lnum, mod->name);
+ pushctx(mod);
+ gettok();
diff --git a/lang/p2c/patches/patch-comment_c b/lang/p2c/patches/patch-comment_c
new file mode 100644
index 00000000000..ee81434b074
--- /dev/null
+++ b/lang/p2c/patches/patch-comment_c
@@ -0,0 +1,61 @@
+$NetBSD: patch-comment_c,v 1.1 2011/12/18 16:54:09 dholland Exp $
+
+- fix symbol conflict with logf (from math.h)
+- fix wrong printf formats
+
+--- comment.c.orig 1991-04-24 20:30:39.000000000 +0000
++++ comment.c
+@@ -286,7 +286,7 @@ long serial;
+ else if (outf != stdout)
+ 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(loggf, "%s, %d/%d: %s\n", infname, inf_lnum, outf_lnum, msg);
+ if (notephase == 2 || regression)
+ prefix = format_s("\004 p2c: %s:", infname);
+ else
+@@ -368,7 +368,7 @@ int kind;
+ curcomments = savecmt;
+ grabbed_comment = 1;
+ if (cmtdebug > 1)
+- fprintf(outf, "Grabbed comment [%d] \"%s\"\n", cmt->value & CMT_MASK, cmt->s);
++ fprintf(outf, "Grabbed comment [%ld] \"%s\"\n", cmt->value & CMT_MASK, cmt->s);
+ return cmt;
+ }
+
+@@ -406,7 +406,7 @@ int kind, stamp;
+ while (cmt && !matchcomment(cmt, kind, stamp))
+ cmt = cmt->next;
+ if (cmt && cmtdebug > 1)
+- fprintf(outf, "Found comment [%d] \"%s\"\n", cmt->value & CMT_MASK, cmt->s);
++ fprintf(outf, "Found comment [%ld] \"%s\"\n", cmt->value & CMT_MASK, cmt->s);
+ return cmt;
+ }
+
+@@ -422,7 +422,7 @@ int kind, stamp;
+ while ((sl = *cmt)) {
+ if (matchcomment(sl, kind, stamp)) {
+ if (cmtdebug > 1)
+- fprintf(outf, "Extracted comment [%d] \"%s\"\n",
++ fprintf(outf, "Extracted comment [%ld] \"%s\"\n",
+ sl->value & CMT_MASK, sl->s);
+ *cmt = sl->next;
+ *last = sl;
+@@ -442,7 +442,7 @@ int okind, ostamp, kind, stamp;
+ while (cmt) {
+ if (matchcomment(cmt, okind, ostamp)) {
+ if (cmtdebug > 1)
+- fprintf(outf, "Changed comment [%s:%d] \"%s\" ",
++ fprintf(outf, "Changed comment [%s:%ld] \"%s\" ",
+ CMT_NAMES[getcommentkind(cmt)],
+ cmt->value & CMT_MASK, cmt->s);
+ if (kind >= 0)
+@@ -450,7 +450,7 @@ int okind, ostamp, kind, stamp;
+ if (stamp >= 0)
+ cmt->value = (cmt->value & ~CMT_MASK) | stamp;
+ if (cmtdebug > 1)
+- fprintf(outf, " to [%s:%d]\n",
++ fprintf(outf, " to [%s:%ld]\n",
+ CMT_NAMES[getcommentkind(cmt)], cmt->value & CMT_MASK);
+ }
+ cmt = cmt->next;
diff --git a/lang/p2c/patches/patch-decl_c b/lang/p2c/patches/patch-decl_c
new file mode 100644
index 00000000000..aa9e937e236
--- /dev/null
+++ b/lang/p2c/patches/patch-decl_c
@@ -0,0 +1,33 @@
+$NetBSD: patch-decl_c,v 1.1 2011/12/18 16:54:09 dholland Exp $
+
+- add missing casts to make printf calls correct
+
+--- decl.c~ 1991-04-24 20:30:43.000000000 +0000
++++ decl.c
+@@ -816,7 +816,7 @@ void handle_nameof()
+ sl2->value = sl->value;
+ if (debug > 0)
+ fprintf(outf, "symbol %s gets \"%s\" -> \"%s\"\n",
+- sp->name, sl2->s, sl2->value);
++ sp->name, sl2->s, (char *)sl2->value);
+ }
+ strlist_empty(&nameoflist);
+ }
+@@ -973,7 +973,7 @@ enum meaningkind kind, namekind;
+ sl = strlist_cifind(sym->symbolnames, curctx->sym->name);
+ if (sl) {
+ if (debug > 2)
+- fprintf(outf, "found \"%s\"\n", sl->value);
++ fprintf(outf, "found \"%s\"\n", (char *)sl->value);
+ name = (char *)sl->value;
+ wasaliased = 1;
+ }
+@@ -984,7 +984,7 @@ enum meaningkind kind, namekind;
+ sl = strlist_find(sym->symbolnames, "");
+ if (sl) {
+ if (debug > 2)
+- fprintf(outf, "found \"%s\"\n", sl->value);
++ fprintf(outf, "found \"%s\"\n", (char *)sl->value);
+ name = (char *)sl->value;
+ wasaliased = 1;
+ }
diff --git a/lang/p2c/patches/patch-expr_c b/lang/p2c/patches/patch-expr_c
new file mode 100644
index 00000000000..0bb798e0195
--- /dev/null
+++ b/lang/p2c/patches/patch-expr_c
@@ -0,0 +1,15 @@
+$NetBSD: patch-expr_c,v 1.1 2011/12/18 16:54:09 dholland Exp $
+
+- fix wrong printf format
+
+--- expr.c~ 1991-04-24 20:30:45.000000000 +0000
++++ expr.c
+@@ -207,7 +207,7 @@ Type *type;
+
+ case TK_REAL:
+ if (ord_type(val.type)->kind == TK_INTEGER) {
+- sprintf(buf, "%d.0", val.i);
++ sprintf(buf, "%ld.0", val.i);
+ val.s = stralloc(buf);
+ val.type = tp_real;
+ return val;
diff --git a/lang/p2c/patches/patch-makeproto_c b/lang/p2c/patches/patch-makeproto_c
new file mode 100644
index 00000000000..7cfbca81638
--- /dev/null
+++ b/lang/p2c/patches/patch-makeproto_c
@@ -0,0 +1,38 @@
+$NetBSD: patch-makeproto_c,v 1.1 2011/12/18 16:54:09 dholland Exp $
+
+- use standard headers
+- remove outdated and bogus system type probing
+- fix wrong printf call
+
+--- makeproto.c~ 1991-04-24 20:30:50.000000000 +0000
++++ makeproto.c
+@@ -9,18 +9,8 @@
+ #include <stdio.h>
+ #include <ctype.h>
+ #include <time.h>
+-
+-#ifdef FILE /* a #define in BSD, a typedef in SYSV (hp-ux, at least) */
+-# ifndef BSD
+-# define BSD 1
+-# endif
+-#endif
+-
+-#ifdef BSD
+-# include <strings.h>
+-#else
+-# include <string.h>
+-#endif
++#include <string.h>
++#include <stdlib.h>
+
+
+
+@@ -418,7 +408,7 @@ char **argv;
+ argdecls[i] + strlen(warntypes[j].bad));
+ strcpy(argdecls[i], temp);
+ fprintf(stderr, "Warning: Argument %s of %s has type %s\n",
+- argnames[i], fname, warntypes[j]);
++ argnames[i], fname, warntypes[j].bad);
+ }
+ }
+ }
diff --git a/lang/p2c/patches/patch-out_c b/lang/p2c/patches/patch-out_c
new file mode 100644
index 00000000000..de5e30bfac3
--- /dev/null
+++ b/lang/p2c/patches/patch-out_c
@@ -0,0 +1,15 @@
+$NetBSD: patch-out_c,v 1.1 2011/12/18 16:54:09 dholland Exp $
+
+- fix symbol conflict with logf (from math.h)
+
+--- out.c~ 1991-04-24 20:30:39.000000000 +0000
++++ out.c
+@@ -1136,7 +1136,7 @@ register char *msg;
+ " 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(loggf, "%s, %d/%d: Line breaker spent %ld tries\n",
+ infname, inf_lnum, outf_lnum, alts);
+ }
+ if (testinglinebreaker)
diff --git a/lang/p2c/patches/patch-trans_c b/lang/p2c/patches/patch-trans_c
new file mode 100644
index 00000000000..d9fca6a9208
--- /dev/null
+++ b/lang/p2c/patches/patch-trans_c
@@ -0,0 +1,155 @@
+$NetBSD: patch-trans_c,v 1.1 2011/12/18 16:54:09 dholland Exp $
+
+- fix symbol conflict with logf (from math.h)
+- fix wrong printf formats
+- don't try to use sbrk() to figure the heap size
+
+--- trans.c.orig 1991-04-24 20:30:37.000000000 +0000
++++ trans.c
+@@ -551,17 +551,17 @@ Static void openlogfile()
+ 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",
++ loggf = fopen(name, "w");
++ if (loggf) {
++ fprintf(loggf, "\nTranslation of %s to %s by p2c %s\n",
+ infname, codefname, P2C_VERSION);
+- fprintf(logf, "Translated");
++ fprintf(loggf, "Translated");
+ uname = getenv("USER");
+ if (uname)
+- fprintf(logf, " by %s", uname);
++ fprintf(loggf, " by %s", uname);
+ time(&starting_time);
+- fprintf(logf, " on %s", ctime(&starting_time));
+- fprintf(logf, "\n\n");
++ fprintf(loggf, " on %s", ctime(&starting_time));
++ fprintf(loggf, "\n\n");
+ } else {
+ perror(name);
+ verbose = 0;
+@@ -573,18 +573,18 @@ void closelogfile()
+ {
+ long ending_time;
+
+- if (logf) {
+- fprintf(logf, "\n\n");
+-#if defined(unix) || defined(__unix)
+- fprintf(logf, "Total memory used: %ld bytes.\n", (long)sbrk(0));
++ if (loggf) {
++ fprintf(loggf, "\n\n");
++#if 0
++ fprintf(loggf, "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(loggf, "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(loggf, "\n\nTranslation completed on %s", ctime(&ending_time));
++ fclose(loggf);
+ }
+ }
+
+@@ -833,7 +833,7 @@ char **argv;
+ setbuf(codef, NULL); /* for debugging */
+ outf = codef;
+ outf_lnum = 1;
+- logf = NULL;
++ loggf = NULL;
+ if (verbose)
+ openlogfile();
+ setup_complete = 0;
+@@ -1000,12 +1000,12 @@ Type *tp;
+ return;
+ }
+ if (ISBOGUS(tp)) {
+- fprintf(outf, "0x%lX\n", tp);
++ fprintf(outf, "%p\n", tp);
+ return;
+ }
+- fprintf(outf, " Type %lx, kind=%s", tp, typekindname(tp->kind));
++ fprintf(outf, " Type %p, kind=%s", tp, typekindname(tp->kind));
+ #ifdef HASDUMPS
+- fprintf(outf, ", meaning=%lx, basetype=%lx, indextype=%lx\n",
++ fprintf(outf, ", meaning=%p, basetype=%p, indextype=%p\n",
+ tp->meaning, tp->basetype, tp->indextype);
+ tp->dumped = 1;
+ if (tp->basetype)
+@@ -1026,13 +1026,13 @@ Meaning *mp;
+ return;
+ }
+ if (ISBOGUS(mp)) {
+- fprintf(outf, "0x%lX\n", mp);
++ fprintf(outf, "%p\n", mp);
+ return;
+ }
+- fprintf(outf, " Meaning %lx, name=%s, kind=%s", mp, ((mp->name) ? mp->name : "<null>"),
++ fprintf(outf, " Meaning %p, name=%s, kind=%s", mp, ((mp->name) ? mp->name : "<null>"),
+ meaningkindname(mp->kind));
+ #ifdef HASDUMPS
+- fprintf(outf, ", ctx=%lx, cbase=%lx, cnext=%lx, type=%lx\n",
++ fprintf(outf, ", ctx=%p, cbase=%p, cnext=%p, type=%p\n",
+ mp->ctx, mp->cbase, mp->cnext, mp->type);
+ if (mp->type && !mp->type->dumped)
+ dumptype(mp->type);
+@@ -1077,7 +1077,7 @@ int waddr;
+ return;
+ }
+ if (ISBOGUS(tp)) {
+- fprintf(outf, "0x%lX", tp);
++ fprintf(outf, "%p", tp);
+ return;
+ }
+ if (tp == tp_int) fprintf(outf, "I");
+@@ -1117,7 +1117,7 @@ int waddr;
+ waddr = 1;
+ }
+ if (waddr) {
+- fprintf(outf, "%lX", tp);
++ fprintf(outf, "%p", tp);
+ if (tp->dumped)
+ return;
+ fprintf(outf, ":");
+@@ -1251,7 +1251,7 @@ Expr *ex;
+ return;
+ }
+ if (ISBOGUS(ex)) {
+- fprintf(outf, "0x%lX", ex);
++ fprintf(outf, "p", ex);
+ return;
+ }
+ if (ex->kind == EK_CONST && ex->val.type == tp_integer &&
+@@ -1291,7 +1291,7 @@ Expr *ex;
+ }
+ }
+ if (ISBOGUS(ex->val.s))
+- fprintf(outf, "[0x%lX]", ex->val.s);
++ fprintf(outf, "[%p]", ex->val.s);
+ else if (ex->val.s) {
+ switch (ex->kind) {
+
+@@ -1310,7 +1310,7 @@ Expr *ex;
+ fprintf(outf, "[s=%s]", ex->val.s);
+ break;
+ default:
+- fprintf(outf, "[s=%lx]", ex->val.s);
++ fprintf(outf, "[s=%p]", ex->val.s);
+ }
+ break;
+ }
+@@ -1353,7 +1353,7 @@ int indent;
+ }
+ while (sp) {
+ if (ISBOGUS(sp)) {
+- fprintf(outf, "0x%lX\n", sp);
++ fprintf(outf, "%p\n", sp);
+ return;
+ }
+ fprintf(outf, "%s", stmtkindname(sp->kind));
diff --git a/lang/p2c/patches/patch-trans_h b/lang/p2c/patches/patch-trans_h
new file mode 100644
index 00000000000..b8f5cb269b3
--- /dev/null
+++ b/lang/p2c/patches/patch-trans_h
@@ -0,0 +1,93 @@
+$NetBSD: patch-trans_h,v 1.1 2011/12/18 16:54:09 dholland Exp $
+
+- use standard includes
+- remove ancient system type probing
+- fix symbol conflict with logf (from math.h)
+
+--- trans.h.orig 1991-04-24 20:30:53.000000000 +0000
++++ trans.h
+@@ -37,57 +37,12 @@ the Free Software Foundation, Inc., 675
+
+
+ #include <stdio.h>
+-
+-
+-/* If the following heuristic fails, compile -DBSD=0 for non-BSD systems,
+- or -DBSD=1 for BSD systems. */
+-
+-#ifdef M_XENIX
+-# define BSD 0
+-#endif
+-
+-#ifdef FILE /* a #define in BSD, a typedef in SYSV (hp-ux, at least) */
+-# ifndef BSD
+-# define BSD 1
+-# endif
+-#endif
+-
+-#ifdef BSD
+-# if !BSD
+-# undef BSD
+-# endif
+-#endif
+-
+-
+-#ifdef __STDC__
+-# include <stddef.h>
+-# include <stdlib.h>
+-# include <limits.h>
+-#else
+-# ifndef BSD
+-# include <malloc.h>
+-# include <memory.h>
+-# include <values.h>
+-# endif
+-# define EXIT_SUCCESS 0
+-# define EXIT_FAILURE 1
+-# define CHAR_BIT 8
+-# define LONG_MAX (((unsigned long)~0L) >> 1)
+-# define LONG_MIN (- LONG_MAX - 1)
+-#endif
+-
+-
+-
+-#if defined(BSD) && !defined(__STDC__)
+-# include <strings.h>
+-# define memcpy(a,b,n) bcopy(b,a,n)
+-# define memcmp(a,b,n) bcmp(a,b,n)
+-char *malloc(), *realloc();
+-#else
+-# include <string.h>
+-#endif
+-
++#include <stddef.h>
++#include <stdlib.h>
++#include <limits.h>
++#include <string.h>
+ #include <ctype.h>
++#include <unistd.h>
+
+
+ #ifdef __GNUC__ /* Fast, in-line version of strcmp */
+@@ -1678,7 +1633,7 @@ extern int final_parens, final_ptrdescs,
+
+ extern char *infname, *outfname, *codefname, *hdrfname;
+ extern char *requested_module;
+-extern FILE *inf, *outf, *codef, *hdrf, *logf;
++extern FILE *inf, *outf, *codef, *hdrf, *loggf;
+ extern short setup_complete, found_module;
+ extern short regression, verbose, conserve_mem;
+ extern int inf_lnum, inf_ltotal;
+@@ -1757,12 +1712,6 @@ extern Strlist *attrlist;
+
+
+
+-/* Our library omits declarations for these functions! */
+-
+-int link PP( (char *, char *) );
+-int unlink PP( (char *) );
+-
+-
+
+ #define minspcthresh ((minspacingthresh >= 0) ? minspacingthresh : minspacing)
+