aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Mingrone <jrm@FreeBSD.org>2022-06-23 09:06:19 +0000
committerJoseph Mingrone <jrm@FreeBSD.org>2022-06-23 17:40:42 +0000
commitb001febccb5de5467426a52b68d355007ddc8c86 (patch)
tree43b1700533069fb484b3a0528f779499591f0ec0
parentca019fdd73f22fe912971ef92ea251abb26bf3de (diff)
textproc/peg: [New port] recursive-descent parser generators for C
WWW: https://www.piumarta.com/software/peg/ Sponsored by: The FreeBSD Foundation
-rw-r--r--textproc/Makefile1
-rw-r--r--textproc/peg/Makefile21
-rw-r--r--textproc/peg/distinfo3
-rw-r--r--textproc/peg/files/patch-Makefile19
-rw-r--r--textproc/peg/pkg-descr17
5 files changed, 61 insertions, 0 deletions
diff --git a/textproc/Makefile b/textproc/Makefile
index 41820b06ecc3..70847ef88fa9 100644
--- a/textproc/Makefile
+++ b/textproc/Makefile
@@ -1219,6 +1219,7 @@
SUBDIR += pecl-xdiff2
SUBDIR += pecl-yaml
SUBDIR += peco
+ SUBDIR += peg
SUBDIR += perl2html
SUBDIR += php-mecab
SUBDIR += php74-ctype
diff --git a/textproc/peg/Makefile b/textproc/peg/Makefile
new file mode 100644
index 000000000000..609978d62fc4
--- /dev/null
+++ b/textproc/peg/Makefile
@@ -0,0 +1,21 @@
+PORTNAME= peg
+DISTVERSION= 0.1.18
+CATEGORIES= textproc
+MASTER_SITES= https://www.piumarta.com/software/peg/
+
+MAINTAINER= jrm@FreeBSD.org
+COMMENT= Recursive-descent parser generators for C
+
+LICENSE= MIT
+
+USES= gmake
+
+PLIST_FILES= bin/leg \
+ bin/peg \
+ man/man1/peg.1.gz
+
+post-patch:
+ @${REINPLACE_CMD} -e 's,%%STAGEDIR%%,${STAGEDIR},g' \
+ -e 's,%%PREFIX%%,${PREFIX},g' ${WRKSRC}/Makefile
+
+.include <bsd.port.mk>
diff --git a/textproc/peg/distinfo b/textproc/peg/distinfo
new file mode 100644
index 000000000000..09745daa3e9f
--- /dev/null
+++ b/textproc/peg/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1655934585
+SHA256 (peg-0.1.18.tar.gz) = 20193bdd673fc7487a38937e297fff08aa73751b633a086ac28c3b34890f9084
+SIZE (peg-0.1.18.tar.gz) = 57776
diff --git a/textproc/peg/files/patch-Makefile b/textproc/peg/files/patch-Makefile
new file mode 100644
index 000000000000..dcba9dc57e3a
--- /dev/null
+++ b/textproc/peg/files/patch-Makefile
@@ -0,0 +1,19 @@
+--- Makefile.orig 2016-07-22 00:55:15 UTC
++++ Makefile
+@@ -1,4 +1,4 @@
+-CFLAGS = -g -Wall $(OFLAGS) $(XFLAGS) -Isrc
++CFLAGS = -Wall $(OFLAGS) $(XFLAGS) -Isrc
+ OFLAGS = -O3 -DNDEBUG
+ #OFLAGS = -pg
+
+@@ -14,8 +14,8 @@ leg : leg.o $(OBJS)
+ $(CC) $(CFLAGS) -o $@-new leg.o $(OBJS)
+ mv $@-new $@
+
+-ROOT =
+-PREFIX = /usr/local
++ROOT = %%STAGEDIR%%
++PREFIX = %%PREFIX%%
+ BINDIR = $(ROOT)$(PREFIX)/bin
+ MANDIR = $(ROOT)$(PREFIX)/man/man1
+
diff --git a/textproc/peg/pkg-descr b/textproc/peg/pkg-descr
new file mode 100644
index 000000000000..66f68871348f
--- /dev/null
+++ b/textproc/peg/pkg-descr
@@ -0,0 +1,17 @@
+peg and leg are tools for generating recursive-descent parsers: programs
+that perform pattern matching on text. They processes a Parsing
+Expression Grammar (PEG) [Ford 2004] to produce a program that
+recognises legal sentences of that grammar. peg processes PEGs written
+using the original syntax described by Ford; leg processes PEGs written
+using slightly different syntax and conventions that are intended to
+make it an attractive replacement for parsers built with lex and
+yacc. Unlike lex and yacc, peg and leg support unlimited backtracking,
+provide ordered choice as a means for disambiguation, and can combine
+scanning (lexical analysis) and parsing (syntactic analysis) into a
+single activity.
+
+[Ford 2004] Bryan Ford, Parsing Expression Grammars: A Recognition-Based
+Syntactic Foundation. ACM SIGPLAN Symposium on Principles of Programming
+Languages (POPL), 2004.
+
+WWW: https://www.piumarta.com/software/peg/