Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bison/3.8.2 #13091

Merged
merged 5 commits into from
Sep 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions recipes/bison/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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"
Expand Down
32 changes: 19 additions & 13 deletions recipes/bison/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -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
ericLemanissier marked this conversation as resolved.
Show resolved Hide resolved
from conans import AutoToolsBuildEnvironment, tools
import contextlib
import os

required_conan_version = ">=1.33.0"
required_conan_version = ">=1.47.0"


class BisonConan(ConanFile):
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()))

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
From dffa2a21edeba243ef76b75e0c2081ec15fe95bd Mon Sep 17 00:00:00 2001
From: SSE4 <tomskside@gmail.com>
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

2 changes: 2 additions & 0 deletions recipes/bison/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"3.8.2":
folder: all
"3.7.6":
folder: all
"3.7.1":
Expand Down