pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

carburetta: Import version 0.8.4



Module Name:	pkgsrc-wip
Committed By:	Michael Baeuerle <micha%NetBSD.org@localhost>
Pushed By:	micha
Date:		Wed Nov 17 11:59:28 2021 +0100
Changeset:	e36f4aeabbff78392769906b9dad99eee1daae7b

Added Files:
	carburetta/DESCR
	carburetta/Makefile
	carburetta/PLIST
	carburetta/distinfo
	carburetta/patches/patch-Makefile
	carburetta/patches/patch-src_temp__output.c

Log Message:
carburetta: Import version 0.8.4

Carburetta is a fused scanner & parser generator for C and C++.
It aims to make parsing of smaller languages trivial and larger languages
doable.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=e36f4aeabbff78392769906b9dad99eee1daae7b

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 carburetta/DESCR                            | 11 ++++++
 carburetta/Makefile                         | 32 +++++++++++++++
 carburetta/PLIST                            |  8 ++++
 carburetta/distinfo                         |  8 ++++
 carburetta/patches/patch-Makefile           | 61 +++++++++++++++++++++++++++++
 carburetta/patches/patch-src_temp__output.c | 52 ++++++++++++++++++++++++
 6 files changed, 172 insertions(+)

diffs:
diff --git a/carburetta/DESCR b/carburetta/DESCR
new file mode 100644
index 0000000000..fe295d486a
--- /dev/null
+++ b/carburetta/DESCR
@@ -0,0 +1,11 @@
+Carburetta is an open source fused scanner parser generator for the C and C++
+languages. Fused means it can generate both the scanner and the parser from
+the same input which simplifies parsing languages. This is beneficial for the
+following reasons:
+
+* You won't have to manually ferry data and types back and forth between the
+  scanner and the parser.
+* The nuances of the scanner are available to the parser. If the type of a
+  "[0-9]+" patterned token is "int" then that is also the type the token appears
+  as in the parser's grammar. No longer a need to shovel everything into a
+  single "token" data type only to "unshovel" it later.
diff --git a/carburetta/Makefile b/carburetta/Makefile
new file mode 100644
index 0000000000..7a1759ec54
--- /dev/null
+++ b/carburetta/Makefile
@@ -0,0 +1,32 @@
+# $NetBSD$
+
+DISTNAME=	carburetta-0.8.4
+CATEGORIES=	devel
+MASTER_SITES=	${MASTER_SITE_GITHUB:=kingletbv/}
+GITHUB_TAG=	v${PKGVERSION_NOREV}
+
+MAINTAINER=	micha%NetBSD.org@localhost
+HOMEPAGE=	https://carburetta.com/
+COMMENT=	Fused scanner parser generator
+LICENSE=	apache-2.0
+
+USE_TOOLS=	gmake
+
+INSTALLATION_DIRS=	bin
+INSTALLATION_DIRS+=	share/doc/carburetta
+INSTALLATION_DIRS+=	share/doc/carburetta/examples
+INSTALLATION_DIRS+=	share/doc/carburetta/examples/calc
+INSTALLATION_DIRS+=	share/doc/carburetta/examples/inireader
+INSTALLATION_DIRS+=	share/doc/carburetta/examples/template_scan
+
+post-install:
+	${INSTALL_DATA} ${WRKSRC}/readme.md \
+		${DESTDIR}${PREFIX}/share/doc/carburetta
+	${INSTALL_DATA} ${WRKSRC}/examples/calc/* \
+		${DESTDIR}${PREFIX}/share/doc/carburetta/examples/calc
+	${INSTALL_DATA} ${WRKSRC}/examples/inireader/* \
+		${DESTDIR}${PREFIX}/share/doc/carburetta/examples/inireader
+	${INSTALL_DATA} ${WRKSRC}/examples/template_scan/* \
+		${DESTDIR}${PREFIX}/share/doc/carburetta/examples/template_scan
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/carburetta/PLIST b/carburetta/PLIST
new file mode 100644
index 0000000000..8af29568f3
--- /dev/null
+++ b/carburetta/PLIST
@@ -0,0 +1,8 @@
+@comment $NetBSD$
+bin/carburetta
+share/doc/carburetta/examples/calc/calc.cbrt
+share/doc/carburetta/examples/inireader/ini_reader.h
+share/doc/carburetta/examples/inireader/iniparser.cbrt
+share/doc/carburetta/examples/inireader/main.c
+share/doc/carburetta/examples/template_scan/template_scan.cbrt
+share/doc/carburetta/readme.md
diff --git a/carburetta/distinfo b/carburetta/distinfo
new file mode 100644
index 0000000000..0efda78da1
--- /dev/null
+++ b/carburetta/distinfo
@@ -0,0 +1,8 @@
+$NetBSD$
+
+SHA1 (carburetta-0.8.4.tar.gz) = 9396c3a1c772fbe52b7d621fc2c9068ceb05def2
+RMD160 (carburetta-0.8.4.tar.gz) = e7865b7c3d395f83f0a029f8dd4bb3142085b1b1
+SHA512 (carburetta-0.8.4.tar.gz) = 16317c740fcf9556572a30caccbb0f12993f67f8d343ff017156e3a4acf3b1fc83b9246fde67ef9c8cb7319c1fb519077a05f88b312b61a8636e9f0bae826500
+Size (carburetta-0.8.4.tar.gz) = 172164 bytes
+SHA1 (patch-Makefile) = 1040284f70a944a041f312bacb34df9bf0719737
+SHA1 (patch-src_temp__output.c) = 2534236b8c2537011646e8fa4342ddf88ee24ceb
diff --git a/carburetta/patches/patch-Makefile b/carburetta/patches/patch-Makefile
new file mode 100644
index 0000000000..982d040560
--- /dev/null
+++ b/carburetta/patches/patch-Makefile
@@ -0,0 +1,61 @@
+$NetBSD$
+
+Do not overwrite $CC from environment with specific compiler.
+Honor CPPFLAGS, CFLAGS and LDFLAGS for build.
+Honor DESTDIR and PREFIX for install.
+
+--- Makefile.orig	2021-04-09 12:00:52.000000000 +0000
++++ Makefile
+@@ -1,8 +1,8 @@
+-CC=gcc
++# Modified version for pkgsrc
+ 
+-OUT = build/linux
++OUT = build
+ SRC = src
+-INTERMEDIATE = build/linux/objs
++INTERMEDIATE = build/objs
+ 
+ SOURCES = $(filter-out src/tokens_generated_scanners.c,$(wildcard $(SRC)/*.c))
+ OBJECTS = $(patsubst $(SRC)/%.c,$(INTERMEDIATE)/%.o,$(SOURCES))
+@@ -12,10 +12,10 @@ all: $(OUT)/carburetta $(OUT)/calc $(OUT
+ 
+ $(INTERMEDIATE)/%.o: $(SRC)/%.c
+ 	@mkdir -p $(@D)
+-	$(CC) -c -o $@ $<
++	$(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
+ 
+ $(OUT)/carburetta: $(OBJECTS)
+-	$(CC) -o $(OUT)/carburetta $(OBJECTS)
++	$(CC) $(LDFLAGS) -o $(OUT)/carburetta $(OBJECTS)
+ 
+ $(INTERMEDIATE)/calc/calc.c: $(OUT)/carburetta examples/calc/calc.cbrt
+ 	mkdir -p $(@D)
+@@ -30,13 +30,13 @@ $(INTERMEDIATE)/template_scan/template_s
+ 	$(OUT)/carburetta examples/template_scan/template_scan.cbrt --c $(INTERMEDIATE)/template_scan/template_scan.c
+ 
+ $(OUT)/calc: $(INTERMEDIATE)/calc/calc.c
+-	$(CC) -o $(OUT)/calc $(INTERMEDIATE)/calc/calc.c
++	$(CC) $(CPPFLAGS) $(CFLAGS) -o $(OUT)/calc $(INTERMEDIATE)/calc/calc.c
+ 
+ $(OUT)/inireader: $(INTERMEDIATE)/inireader/iniparser.c examples/inireader/main.c
+-	$(CC) -o $(OUT)/inireader -I$(INTERMEDIATE)/inireader -Iexamples/inireader $(INTERMEDIATE)/inireader/iniparser.c examples/inireader/main.c
++	$(CC) $(CPPFLAGS) $(CFLAGS) -o $(OUT)/inireader -I$(INTERMEDIATE)/inireader -Iexamples/inireader $(INTERMEDIATE)/inireader/iniparser.c examples/inireader/main.c
+ 
+ $(OUT)/template_scan: $(INTERMEDIATE)/template_scan/template_scan.c
+-	$(CC) -o $(OUT)/template_scan $(INTERMEDIATE)/template_scan/template_scan.c
++	$(CC) $(CPPFLAGS) $(CFLAGS) -o $(OUT)/template_scan $(INTERMEDIATE)/template_scan/template_scan.c
+ 
+ .PHONY: clean
+ clean:
+@@ -44,8 +44,8 @@ clean:
+ 
+ .PHONY: install
+ install: all
+-	install $(OUT)/carburetta /usr/local/bin
++	install $(OUT)/carburetta $(DESTDIR)$(PREFIX)/bin
+ 
+ .PHONY: uninstall
+ uninstall:
+-	rm /usr/local/bin/carburetta
++	rm $(DESTDIR)$(PREFIX)/bin/carburetta
diff --git a/carburetta/patches/patch-src_temp__output.c b/carburetta/patches/patch-src_temp__output.c
new file mode 100644
index 0000000000..b6d089209d
--- /dev/null
+++ b/carburetta/patches/patch-src_temp__output.c
@@ -0,0 +1,52 @@
+$NetBSD$
+
+Unconditionally disable Windows code paths.
+Unconditionally enable POSIX code paths.
+
+--- src/temp_output.c.orig	2021-04-09 12:00:52.000000000 +0000
++++ src/temp_output.c
+@@ -38,7 +38,7 @@
+ #include <string.h>
+ #endif
+ 
+-#ifdef _WIN32
++#if 0  /* #ifdef _WIN32 */
+ #ifndef IO_H_INCLUDED
+ #define IO_H_INCLUDED
+ #include <io.h> /* _open_osfhandle */
+@@ -49,7 +49,7 @@
+ #endif
+ #endif
+ 
+-#ifdef __linux__
++#if 1  /* #ifdef __linux__ */
+ #ifndef SYS_TYPES_H_INCLUDED
+ #define SYS_TYPES_H_INCLUDED
+ #include <sys/types.h>
+@@ -74,7 +74,7 @@
+ #endif
+ 
+ static int to_get_random_bytes(void *buf, size_t num_bytes) {
+-#ifdef __linux__
++#if 1  /* #ifdef __linux__ */
+   FILE *fp = fopen("/dev/urandom", "rb");
+   if (!fp) {
+     return errno;
+@@ -147,7 +147,7 @@ FILE *to_make_temp(const char *final_des
+       return NULL;
+     }
+ 
+-#ifdef _WIN32
++#if 0  /* #ifdef _WIN32 */
+     HANDLE h = CreateFileA(temp_filename, GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL);
+     if (INVALID_HANDLE_VALUE == h) {
+       /* keep going; we're assuming a collision, which may be naive */
+@@ -173,7 +173,7 @@ FILE *to_make_temp(const char *final_des
+       continue;
+     }
+ #endif
+-#ifdef __linux__
++#if 1  /* #ifdef __linux__ */
+     int fd = open(temp_filename, O_CREAT|O_EXCL|O_RDWR, 0664);
+     if (fd == -1) {
+       if (attempt == last_attempt) {


Home | Main Index | Thread Index | Old Index