commit:     b4afce4f330a0ea9eded0dda8dbba28da040b321
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Oct  9 05:03:32 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Oct 20 01:45:49 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b4afce4f

dev-util/kbuild: workaround build failure with Bison 3.7

Force usage of either byacc or yacc or older-not-in-tree Bison (< 3.7);
it's not enough to just depend on these because we can't really be sure
what kbuild will try to use, especially if a newer Bison is installed
(it'll just try to use it and die).

We choose byacc > yacc > older Bison but allow the user to override
it via the environment if they wish.

Right now, manual intervention seems to be required for people
to install this if, as is likely, users have modern Bison
installed (they'd need to unmerge (ugh!) Bison and then
install byacc or yacc & hope the build system picks it up).

Bug: https://bugs.gentoo.org/734354
Signed-off-by: Sam James <sam <AT> gentoo.org>
Closes: https://github.com/gentoo/gentoo/pull/22522
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-util/kbuild/kbuild-0.1.9998.3499.ebuild | 21 ++++++++++++++++++++-
 dev-util/kbuild/kbuild-9999.ebuild          | 22 ++++++++++++++++++++--
 2 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/dev-util/kbuild/kbuild-0.1.9998.3499.ebuild 
b/dev-util/kbuild/kbuild-0.1.9998.3499.ebuild
index 574abc5324a..1679cabf9a2 100644
--- a/dev-util/kbuild/kbuild-0.1.9998.3499.ebuild
+++ b/dev-util/kbuild/kbuild-0.1.9998.3499.ebuild
@@ -65,7 +65,26 @@ src_prepare() {
 }
 
 src_compile() {
-       kBuild/env.sh --full emake -f bootstrap.gmk AUTORECONF=true 
AR="$(tc-getAR)" \
+       if [[ -z ${YACC} ]] ; then
+               # If the user hasn't picked one, let's prefer byacc > yacc > 
old bison for now.
+               # See bug #734354 - bison doesn't work here.
+               # We can remove this once Bison works again!
+               if has_version "dev-util/byacc" ; then
+                       export YACC=byacc
+               elif has_version "dev-util/yacc" ; then
+                       export YACC=yacc
+               elif has_version "<sys-devel/bison-3.7" ; then
+                       export YACC=bison
+               else
+                       die "This case shouldn't be possible; no suitable YACC 
impl installed."
+               fi
+
+               einfo "Chosen YACC=${YACC} for build..."
+       else
+               einfo "Chosen user-provided YACC=${YACC} for build..."
+       fi
+
+       kBuild/env.sh --full emake -f bootstrap.gmk AUTORECONF=true 
AR="$(tc-getAR)" YACC="${YACC}" \
                || die "bootstrap failed"
 }
 

diff --git a/dev-util/kbuild/kbuild-9999.ebuild 
b/dev-util/kbuild/kbuild-9999.ebuild
index 92a4a2a2543..942718bd4bf 100644
--- a/dev-util/kbuild/kbuild-9999.ebuild
+++ b/dev-util/kbuild/kbuild-9999.ebuild
@@ -67,8 +67,26 @@ src_prepare() {
 }
 
 src_compile() {
-       kBuild/env.sh --full \
-               emake -f bootstrap.gmk AUTORECONF=true AR="$(tc-getAR)" \
+       if [[ -z ${YACC} ]] ; then
+               # If the user hasn't picked one, let's prefer byacc > yacc > 
old bison for now.
+               # See bug #734354 - bison doesn't work here.
+               # We can remove this once Bison works again!
+               if has_version "dev-util/byacc" ; then
+                       export YACC=byacc
+               elif has_version "dev-util/yacc" ; then
+                       export YACC=yacc
+               elif has_version "<sys-devel/bison-3.7" ; then
+                       export YACC=bison
+               else
+                       die "This case shouldn't be possible; no suitable YACC 
impl installed."
+               fi
+
+               einfo "Chosen YACC=${YACC} for build..."
+       else
+               einfo "Chosen user-provided YACC=${YACC} for build..."
+       fi
+
+       kBuild/env.sh --full emake -f bootstrap.gmk AUTORECONF=true 
AR="$(tc-getAR)" YACC="${YACC}" \
                || die "bootstrap failed"
 }
 

Reply via email to