From 655399cf16db0cf931fffc05d9b0de9e6c48183d Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 16 Apr 2018 06:58:49 -0700 Subject: build: remove dubious license header from y.tab.c. The GNU Bison parser has a GPL header in the parser skeleton which gets copied to the generated parser. The GPL asserts that the entire file falls under the GPL (but as a special exception, it may be used in any manner whatsoever in a program, as long as it isn't used as the skeleton of a parser generator). The GPL assertion is false; the file is not entirely derived from the skeleton but contains code directly copied from parser.y, as well as tables generated from parser.y's original grammar. Since we are definitely not using this as a parser skeleton for a parser generator and are thus allowed to do whatever we want such as compiling this into proprietary object files, I'm removing the copyright header as a build step. You never know; someone could package up a built directory of TXR containing a Bison-generated y.tab.c, and then it looks like there is a GPL-ed file in the project. * Makefile (CM): New variable, needed for interpolating literal commas into macro calls. (BS_LIC_FROM, BS_LIC_TO): New variables. (y.tab.c): Filter y.tab.c to remove GPL comment. --- Makefile | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 108cdcc6..b2815e9c 100644 --- a/Makefile +++ b/Makefile @@ -241,6 +241,8 @@ define NL endef +CM := , + define DEP $(1): $(2) @@ -259,6 +261,9 @@ $(eval $(foreach item,lex.yy.o txr.o match.o parser.o,\ $(eval $(foreach item,y.tab.c y.tab.h lex.yy.c,\ $(call DEP,$(item),config.make config.h))) +BS_LIC_FROM := ^[/][*] Bison impl +BS_LIC_TO := Bison. [*][/] + lex.yy.c: $(top_srcdir)parser.l $(call ABBREV,LEX) $(call SH,rm -f $@) @@ -286,6 +291,11 @@ y.tab.c: $(top_srcdir)parser.y $(call SH,rm -f y.tab.c) $(call SH, \ if $(TXR_YACC) -v -d $< ; then \ + grep -qs '$(BS_LIC_FROM)' y.tab.c && \ + grep -qs '$(BS_LIC_TO)' y.tab.c && \ + sed -e '/$(BS_LIC_FROM)/$(CM)/$(BS_LIC_TO)/d' \ + < y.tab.c > y.tab.c.tmp && \ + mv y.tab.c.tmp y.tab.c ; \ chmod a-w y.tab.c ; \ sed -e '/yyparse/d' < y.tab.h > y.tab.h.tmp && \ mv y.tab.h.tmp y.tab.h ; \ -- cgit v1.2.3