commit:     04d3f4f98d5336a1e8456bbe975abad22bc00471
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Fri Dec  2 04:22:56 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Fri Dec  2 21:09:49 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=04d3f4f9

app-alternatives/yacc: new package to control yacc symlinks

Signed-off-by: Sam James <sam <AT> gentoo.org>

 app-alternatives/lex/lex-0.ebuild    | 18 ++++++++--------
 app-alternatives/yacc/metadata.xml   | 16 ++++++++++++++-
 app-alternatives/yacc/yacc-1.ebuild  | 40 ++++++++++++++++++++++++++++++++++++
 profiles/arch/riscv/package.use.mask |  4 ++++
 4 files changed, 68 insertions(+), 10 deletions(-)

diff --git a/app-alternatives/lex/lex-0.ebuild 
b/app-alternatives/lex/lex-0.ebuild
index 88a00b0f7b8f..eee421a1179c 100644
--- a/app-alternatives/lex/lex-0.ebuild
+++ b/app-alternatives/lex/lex-0.ebuild
@@ -15,25 +15,25 @@ IUSE="+flex reflex"
 REQUIRED_USE="^^ ( flex reflex )"
 
 RDEPEND="
-       flex? ( sys-devel/flex )
+       flex? ( >=sys-devel/flex-2.6.4-r5 )
        reflex? ( sys-devel/reflex )
        !<sys-devel/flex-2.6.4-r5
 "
 
 src_install() {
-       if use reflex; then
-               dosym reflex /bin/lex
-               newman - lex.1 <<<".so reflex.1"
+       if use flex; then
+               dosym flex /bin/lex
+               newman - lex.1 <<<".so flex.1"
 
                newenvd - 90lex <<-EOF
-               LEX=reflex
+                       LEX=flex
                EOF
-       elif use flex; then
-               dosym flex /bin/lex
-               newman - lex.1 <<<".so flex.1"
+       elif use reflex; then
+               dosym reflex /bin/lex
+               newman - lex.1 <<<".so reflex.1"
 
                newenvd - 90lex <<-EOF
-               LEX=flex
+                       LEX=reflex
                EOF
        else
                die "Invalid USE flag combination (broken REQUIRED_USE?)"

diff --git a/app-alternatives/yacc/metadata.xml 
b/app-alternatives/yacc/metadata.xml
index de9d78424186..0672d9fe1a27 100644
--- a/app-alternatives/yacc/metadata.xml
+++ b/app-alternatives/yacc/metadata.xml
@@ -5,5 +5,19 @@
                <email>base-sys...@gentoo.org</email>
                <name>Gentoo Base System</name>
        </maintainer>
-       <stabilize-allarches/>
+       <maintainer type="person">
+               <email>mgo...@gentoo.org</email>
+               <name>Michał Górny</name>
+       </maintainer>
+       <use>
+               <flag name="bison">
+                       Symlink to <pkg>sys-devel/bison</pkg>.
+               </flag>
+               <flag name="byacc">
+                       Symlink to <pkg>dev-util/byacc</pkg>.
+               </flag>
+               <flag name="reference">
+                       Symlink to <pkg>dev-util/yacc</pkg>.
+               </flag>
+       </use>
 </pkgmetadata>

diff --git a/app-alternatives/yacc/yacc-1.ebuild 
b/app-alternatives/yacc/yacc-1.ebuild
new file mode 100644
index 000000000000..93e55d2d17fd
--- /dev/null
+++ b/app-alternatives/yacc/yacc-1.ebuild
@@ -0,0 +1,40 @@
+# Copyright 2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+DESCRIPTION="yacc symlinks"
+HOMEPAGE="https://wiki.gentoo.org/wiki/Project:Base/Alternatives";
+SRC_URI=""
+S=${WORKDIR}
+
+LICENSE="CC0-1.0"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 
~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos 
~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="+bison byacc reference"
+REQUIRED_USE="^^ ( bison byacc reference )"
+
+RDEPEND="
+       bison? ( >=sys-devel/bison-3.8.2-r1 )
+       byacc? ( dev-util/byacc )
+       reference? ( >=dev-util/yacc-1.9.1-r7 )
+       !<dev-util/yacc-1.9.1-r7
+       !<sys-devel/bison-3.8.2-r1
+"
+
+src_install() {
+       if use bison; then
+               # bison installs its own small wrapper script 'yacc-bison'
+               # around bison(1).
+               dosym yacc.bison /usr/bin/yacc
+               newman - yacc.1 <<<".so yacc.bison.1"
+       elif use byacc; then
+               dosym byacc /usr/bin/yacc
+               newman - yacc.1 <<<".so byacc.1"
+       elif use reference; then
+               dosym yacc-reference /usr/bin/yacc
+               newman - yacc.1 <<<".so yacc-reference.1"
+       else
+               die "Invalid USE flag combination (broken REQUIRED_USE?)"
+       fi
+}

diff --git a/profiles/arch/riscv/package.use.mask 
b/profiles/arch/riscv/package.use.mask
index 47edcc93058e..911542bee9bf 100644
--- a/profiles/arch/riscv/package.use.mask
+++ b/profiles/arch/riscv/package.use.mask
@@ -1,6 +1,10 @@
 # Copyright 2019-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
+# Sam James <s...@gentoo.org> (2022-12-02)
+# Not keyworded here
+app-alternatives/yacc reference
+
 # Sam James <s...@gentoo.org> (2022-12-02)
 # Not keyworded here
 app-alternatives/lex reflex

Reply via email to