svn commit: r528172 - in head/Mk: Uses Wrappers

Baptiste Daroussin bapt at FreeBSD.org
Tue Mar 10 14:20:26 UTC 2020


Author: bapt
Date: Tue Mar 10 14:20:25 2020
New Revision: 528172
URL: https://svnweb.freebsd.org/changeset/ports/528172

Log:
  Create a bison wrapper on top of base byacc
  
  The wrapper deals with various simple incompatibilities between byacc and bison:
  * first deals with --version which might often be called
  * --verbose and -v are ignored
  * normally yacc is called like this: yacc [options] input, but with GNU programs like bison
  the input can be mixed in the middle of the arguments, unmangle that
  
  Add a new 'wrapper' argument to USES=bison use the wrapper
  
  Reviewed by:	mat
  Differential Revision:	https://reviews.freebsd.org/D24017

Added:
  head/Mk/Wrappers/bison   (contents, props changed)
Modified:
  head/Mk/Uses/bison.mk

Modified: head/Mk/Uses/bison.mk
==============================================================================
--- head/Mk/Uses/bison.mk	Tue Mar 10 14:20:06 2020	(r528171)
+++ head/Mk/Uses/bison.mk	Tue Mar 10 14:20:25 2020	(r528172)
@@ -26,6 +26,8 @@ BUILD_DEPENDS+=	${_BISON_DEPENDS}
 RUN_DEPENDS+=	${_BISON_DEPENDS}
 .elif ${bison_ARGS} == "alias"
 BINARY_ALIAS+=	bison=byacc
+.elif ${bison_ARGS} == "wrapper"
+BINARY_WRAPPERS+=	bison
 .else
 IGNORE=	USES=bison - invalid args: [${bison_ARGS}] specified
 .endif

Added: head/Mk/Wrappers/bison
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/Mk/Wrappers/bison	Tue Mar 10 14:20:25 2020	(r528172)
@@ -0,0 +1,19 @@
+#!/bin/sh
+#
+# $FreeBSD$
+
+# This wrappers allows to deals build system calling bison with certain long option
+# and messing with arguments orders
+
+case " $@ " in
+*" --version "*) echo "bison (GNU bison 3.5.2)" ; exit 0 ;;
+esac
+
+for arg; do
+	case "$arg" in
+	*.y) inputfile="$arg" ;;
+	--verbose|-v) ;; # ignore
+	*) args="$args $arg" ;;
+	esac
+done
+exec byacc -L $args $inputfile


More information about the svn-ports-all mailing list