diff --git a/autotools/bison/bison.py b/autotools/bison/bison.py new file mode 100644 index 00000000..47f9b4e4 --- /dev/null +++ b/autotools/bison/bison.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +import info +from Package.AutoToolsPackageBase import * + + +class subinfo(info.infoclass): + def setDependencies(self): + self.buildDependencies["dev-util/msys"] = "default" + self.runtimeDependencies["virtual/base"] = "default" + + def setTargets(self): + self.description = "Bison is a general-purpose parser generator that converts an annotated context-free grammar into a deterministic LR or generalized LR (GLR) parser employing LALR(1) parser tables" + self.svnTargets['master'] = 'git://git.savannah.gnu.org/bison.git' + for ver in ["3.0.4"]: + self.targets[ver] = f"http://ftp.gnu.org/gnu/bison/bison-{ver}.tar.xz" + self.targetInstSrc[ver] = f"bison-{ver}" + self.defaultTarget = '3.0.4' + self.patchToApply["3.0.4"] = [("vasnprintf-macos.diff", 1)] + + +class Package(AutoToolsPackageBase): + def __init__( self, **args ): + AutoToolsPackageBase.__init__( self ) + + def install( self ): + if not AutoToolsPackageBase.install(self): + return False + return self.copyToMsvcImportLib() diff --git a/autotools/bison/vasnprintf-macos.diff b/autotools/bison/vasnprintf-macos.diff new file mode 100644 index 00000000..7d347e12 --- /dev/null +++ b/autotools/bison/vasnprintf-macos.diff @@ -0,0 +1,30 @@ +Binary files bison-3.0.4.orig/.DS_Store and bison-3.0.4/.DS_Store differ +diff -Nrub -x '*~' -x '*\.rej' -x '*\.orig' -x'*\.o' -x '*\.pyc' bison-3.0.4.orig/lib/vasnprintf.c bison-3.0.4/lib/vasnprintf.c +--- bison-3.0.4.orig/lib/vasnprintf.c 2015-01-04 17:46:03.000000000 +0100 ++++ bison-3.0.4/lib/vasnprintf.c 2018-03-12 14:23:57.000000000 +0100 +@@ -4858,7 +4858,10 @@ + #endif + *fbp = dp->conversion; + #if USE_SNPRINTF +-# if !(((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) && !defined __UCLIBC__) || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) ++# if ! (((__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 3)) \ ++ && !defined __UCLIBC__) \ ++ || (defined __APPLE__ && defined __MACH__) \ ++ || ((defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__)) + fbp[1] = '%'; + fbp[2] = 'n'; + fbp[3] = '\0'; +@@ -4872,6 +4875,13 @@ + in format strings in writable memory may crash the program + (if compiled with _FORTIFY_SOURCE=2), so we should avoid it + in this situation. */ ++ /* On Mac OS X 10.3 or newer, we know that snprintf's return ++ value conforms to ISO C 99: the tests gl_SNPRINTF_RETVAL_C99 ++ and gl_SNPRINTF_TRUNCATION_C99 pass. ++ Therefore we can avoid using %n in this situation. ++ On Mac OS X 10.13 or newer, the use of %n in format strings ++ in writable memory by default crashes the program, so we ++ should avoid it in this situation. */ + /* On native Windows systems (such as mingw), we can avoid using + %n because: + - Although the gl_SNPRINTF_TRUNCATION_C99 test fails,