diff --git a/recipes/bison/all/conandata.yml b/recipes/bison/all/conandata.yml index cab26f5d149a0..67b0780a7f658 100644 --- a/recipes/bison/all/conandata.yml +++ b/recipes/bison/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.8.2": + url: "https://ftp.gnu.org/gnu/bison/bison-3.8.2.tar.gz" + sha256: "06c9e13bdf7eb24d4ceb6b59205a4f67c2c7e7213119644430fe82fbd14a0abb" "3.7.6": url: "https://ftp.gnu.org/gnu/bison/bison-3.7.6.tar.gz" sha256: "69dc0bb46ea8fc307d4ca1e0b61c8c355eb207d0b0c69f4f8462328e74d7b9ea" @@ -9,6 +12,13 @@ sources: url: "https://ftp.gnu.org/gnu/bison/bison-3.5.3.tar.gz" sha256: "34e201d963156618a0ea5bc87220f660a1e08403dd3c7c7903d4f38db3f40039" patches: + "3.8.2": + - patch_file: "patches/0001-3.8-create_pipe-uses-O_TEXT-not-O_BINARY-mode.patch" + base_path: "source_subfolder" + - patch_file: "patches/0002-3.7.6-open-source-file-in-binary-mode-MS-ftell-bug-ks-68337.patch" + base_path: "source_subfolder" + - patch_file: "patches/0005-gnulib-limit-search-range-of-_setmaxstdio.patch" + base_path: "source_subfolder" "3.7.6": - patch_file: "patches/0001-create_pipe-uses-O_TEXT-not-O_BINARY-mode.patch" base_path: "source_subfolder" diff --git a/recipes/bison/all/conanfile.py b/recipes/bison/all/conanfile.py index e52d761c606cd..86d0e584d5c46 100644 --- a/recipes/bison/all/conanfile.py +++ b/recipes/bison/all/conanfile.py @@ -1,8 +1,11 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, apply_conandata_patches, replace_in_file +from conans import AutoToolsBuildEnvironment, tools import contextlib import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.47.0" class BisonConan(ConanFile): @@ -43,16 +46,20 @@ def configure(self): def requirements(self): self.requires("m4/1.4.19") + def validate(self): + if self.settings.compiler == "Visual Studio" and self.version == "3.8.2": + raise ConanInvalidConfiguration("bison/3.8.2 is not yet ready for Visual Studio, use previous version or open a pull request on https://github.com/conan-io/conan-center-index/pulls") + def build_requirements(self): if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): self.build_requires("msys2/cci.latest") if self.settings.compiler == "Visual Studio": - self.build_requires("automake/1.16.4") + self.build_requires("automake/1.16.5") if self.settings.os != "Windows": self.build_requires("flex/2.6.4") def source(self): - tools.get(**self.conan_data["sources"][self.version], + get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) @contextlib.contextmanager @@ -105,31 +112,30 @@ def _configure_autotools(self): return self._autotools def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) if self.settings.os == "Windows": # replace embedded unix paths by windows paths - tools.replace_in_file(os.path.join(self._source_subfolder, "Makefile.in"), + replace_in_file(self, os.path.join(self._source_subfolder, "Makefile.in"), "echo '#define BINDIR \"$(bindir)\"';", "echo '#define BINDIR \"$(shell cygpath -m \"$(bindir)\")\"';") - tools.replace_in_file(os.path.join(self._source_subfolder, "Makefile.in"), + replace_in_file(self, os.path.join(self._source_subfolder, "Makefile.in"), "echo '#define PKGDATADIR \"$(pkgdatadir)\"';", "echo '#define PKGDATADIR \"$(shell cygpath -m \"$(pkgdatadir)\")\"';") - tools.replace_in_file(os.path.join(self._source_subfolder, "Makefile.in"), + replace_in_file(self, os.path.join(self._source_subfolder, "Makefile.in"), "echo '#define DATADIR \"$(datadir)\"';", "echo '#define DATADIR \"$(shell cygpath -m \"$(datadir)\")\"';") - tools.replace_in_file(os.path.join(self._source_subfolder, "Makefile.in"), + replace_in_file(self, os.path.join(self._source_subfolder, "Makefile.in"), "echo '#define DATAROOTDIR \"$(datarootdir)\"';", "echo '#define DATAROOTDIR \"$(shell cygpath -m \"$(datarootdir)\")\"';") - tools.replace_in_file(os.path.join(self._source_subfolder, "Makefile.in"), + replace_in_file(self, os.path.join(self._source_subfolder, "Makefile.in"), "dist_man_MANS = $(top_srcdir)/doc/bison.1", "dist_man_MANS =") - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "yacc.in"), + replace_in_file(self, os.path.join(self._source_subfolder, "src", "yacc.in"), "@prefix@", "${}_ROOT".format(self.name.upper())) - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "yacc.in"), + replace_in_file(self, os.path.join(self._source_subfolder, "src", "yacc.in"), "@bindir@", "${}_ROOT/bin".format(self.name.upper())) diff --git a/recipes/bison/all/patches/0001-3.8-create_pipe-uses-O_TEXT-not-O_BINARY-mode.patch b/recipes/bison/all/patches/0001-3.8-create_pipe-uses-O_TEXT-not-O_BINARY-mode.patch new file mode 100644 index 0000000000000..b40517e5083c9 --- /dev/null +++ b/recipes/bison/all/patches/0001-3.8-create_pipe-uses-O_TEXT-not-O_BINARY-mode.patch @@ -0,0 +1,29 @@ +From dffa2a21edeba243ef76b75e0c2081ec15fe95bd Mon Sep 17 00:00:00 2001 +From: SSE4 +Date: Wed, 3 Apr 2019 19:48:12 +0700 +Subject: [PATCH 3/4] 0003 + +--- + lib/spawn-pipe.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/lib/spawn-pipe.c b/lib/spawn-pipe.c +index 3af5167..09e9cad 100644 +--- a/lib/spawn-pipe.c ++++ b/lib/spawn-pipe.c +@@ -213,10 +213,10 @@ create_pipe (const char *progname, + xalloc_die (); + + if (pipe_stdout) +- if (pipe2_safer (ifd, O_BINARY | O_CLOEXEC) < 0) ++ if (pipe2_safer (ifd, O_TEXT | O_CLOEXEC) < 0) + error (EXIT_FAILURE, errno, _("cannot create pipe")); + if (pipe_stdin) +- if (pipe2_safer (ofd, O_BINARY | O_CLOEXEC) < 0) ++ if (pipe2_safer (ofd, O_TEXT | O_CLOEXEC) < 0) + error (EXIT_FAILURE, errno, _("cannot create pipe")); + /* Data flow diagram: + * +-- +2.7.4.windows.1 + diff --git a/recipes/bison/config.yml b/recipes/bison/config.yml index c06b3140cfec4..7e22e455ae51e 100644 --- a/recipes/bison/config.yml +++ b/recipes/bison/config.yml @@ -1,4 +1,6 @@ versions: + "3.8.2": + folder: all "3.7.6": folder: all "3.7.1":