commit:     47ef0df167d122fd4d0ee6e39e472cf2496902ce
Author:     Eli Schwartz <eschwartz <AT> gentoo <DOT> org>
AuthorDate: Tue Jun 17 17:17:00 2025 +0000
Commit:     Eli Schwartz <eschwartz <AT> gentoo <DOT> org>
CommitDate: Fri Jun 20 06:05:53 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=47ef0df1

dev-util/dialog: remove broken USE=minimal

USE=minimal was never actually minimal, and nobody noticed or cared.
Even if I fix it to work, the end result produces a difference of:

```
 *   SIZE: 1.35MiB -> 1.51MiB, 4 -> 14 files
 * ------> FILES(+10) SONAME(+1) SIZE(+12.01%)
```

"minimal" is generally an antipattern, and there's no compelling reason
to fix it so we can keep it (or even keep it at all, if it had worked).

It's also conceptually broken today, since any software that links to
the library needs to depend on `dev-util/dialog:=[-minimal]`. And
nothing does -- but at minimum sys-block/whdd would need to.

Historically, the library support was added for bug 266065, and from its
first addition was behind a USE flag. No real argument was given for why
it should be a USE flag, it just kinda "was" that way.

So what was the problem?

`foo && bar || baz` is a mindworm. If bar fails, both bar and baz get
run. The correct grammatical construct is an if/then/else statement, no
(or rare) exceptions.

More on that at https://mywiki.wooledge.org/BashPitfalls#pf22

In this case, we run `default_src_install`, which internally invokes
make install, and then also always run emake install-full, even for
minimal builds.

The reason is because portage is absolutely full of this too. It
constantly runs things like `[[ -n ${VAR} ]] && do_thing_with "${VAR}"`
or else `use foo && bar`. The return value is therefore 1, but no "die"
was called so it "rarely ever matters". Here the issue is that
`default_src_install` finishes by running `einstalldocs`, which
error-returns if there are no docs.

The general rule of thumb is: assume ALL functions defined by PMS or an
eclass *can* and *will* return nonzero at total whimsy unless explicitly
documented to have explicit return values explicitly intended for
explicit testing (such as `use`).

If you write your own ebuild-local functions, then good job, you! You
may assume they are sanely written (because you wrote them), rather than
assuming they are written in `die`-centric ebuildism code golf.

And finally, for bonus points:

Even without install-full, a static library is installed by bad
autoconf-dickey macros. Fixing the install rule only solves 7 out of 8
files.

Bug: https://bugs.gentoo.org/266065
Closes: https://bugs.gentoo.org/958297
Closes: https://github.com/gentoo/gentoo/pull/42641
Acked-by: Sam James <sam <AT> gentoo.org>
Signed-off-by: Eli Schwartz <eschwartz <AT> gentoo.org>

 dev-util/dialog/dialog-1.3.20250116-r1.ebuild | 62 +++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)

diff --git a/dev-util/dialog/dialog-1.3.20250116-r1.ebuild 
b/dev-util/dialog/dialog-1.3.20250116-r1.ebuild
new file mode 100644
index 000000000000..3b2d2ce1c173
--- /dev/null
+++ b/dev-util/dialog/dialog-1.3.20250116-r1.ebuild
@@ -0,0 +1,62 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+MY_P=${PN}-$(ver_rs 2 -)
+VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/thomasdickey.asc
+inherit verify-sig
+
+DESCRIPTION="Tool to display dialog boxes from a shell"
+HOMEPAGE="https://invisible-island.net/dialog/";
+SRC_URI="https://invisible-island.net/archives/dialog/${MY_P}.tgz";
+SRC_URI+=" verify-sig? ( 
https://invisible-island.net/archives/dialog/${MY_P}.tgz.asc )"
+S="${WORKDIR}"/${MY_P}
+
+LICENSE="LGPL-2.1"
+SLOT="0/15"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~m68k ~mips ~ppc ~ppc64 
~riscv ~s390 ~sparc ~x86"
+IUSE="examples nls unicode"
+
+RDEPEND=">=sys-libs/ncurses-5.2-r5:=[unicode(+)?]"
+DEPEND="
+       ${RDEPEND}
+       nls? ( sys-devel/gettext )
+"
+BDEPEND="
+       dev-build/libtool
+       virtual/pkgconfig
+       verify-sig? ( sec-keys/openpgp-keys-thomasdickey )
+"
+
+src_prepare() {
+       default
+
+       sed -i -e '/LIB_CREATE=/s:${CC}:& ${LDFLAGS}:g' configure || die
+       sed -i '/$(LIBTOOL_COMPILE)/s:$: $(LIBTOOL_OPTS):' makefile.in || die
+}
+
+src_configure() {
+       if [[ ${CHOST} == *-darwin* ]] ; then
+               export ac_cv_prog_LIBTOOL=glibtool
+       fi
+
+       econf \
+               --disable-rpath-hack \
+               --with-pkg-config \
+               --enable-pc-files \
+               $(use_enable nls) \
+               --with-libtool \
+               --with-libtool-opts='-shared' \
+               --with-ncurses$(usev unicode w)
+}
+
+src_install() {
+       emake DESTDIR="${D}" install-full
+
+       use examples && dodoc -r samples
+
+       dodoc CHANGES README
+
+       find "${ED}" -name '*.la' -delete || die
+}

Reply via email to