Bug 269120

Summary: misc/mc: is nox11 variant really necessary?
Product: Ports & Packages Reporter: Yury V. Zaytsev <yury>
Component: Individual Port(s)Assignee: Alexey Dokuchaev <danfe>
Status: Closed FIXED    
Severity: Affects Only Me Flags: bugzilla: maintainer-feedback? (danfe)
Priority: ---    
Version: Latest   
Hardware: Any   
OS: Any   
See Also: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=238425

Description Yury V. Zaytsev 2023-01-23 19:58:40 UTC
Hi there,

Honest question from the maintainer: is the nox11 variant really necessary?

If --with-x is supplied, we will use X11 headers during build time, but at runtime X11 libraries will be dlopen'ed if available, but if not, mc will start anyways with X11 support disabled. The same applies to aspell support.

The reason why I'm asking is that some distros didn't know about this and thought that building mc with X11 will cause a runtime dependency, hence useless nox11 variants not having runtime dependency that wasn't there in the first place... not sure whether FreeBSD has its own reasons to have a separate port (e.g. allow building on systems without X11 headers?).

All the best,
Yury
Comment 1 commit-hook freebsd_committer freebsd_triage 2024-01-15 10:40:00 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=a5ade24bb0d77d5ca30a27dc33748ff644a09588

commit a5ade24bb0d77d5ca30a27dc33748ff644a09588
Author:     Alexey Dokuchaev <danfe@FreeBSD.org>
AuthorDate: 2024-01-15 10:38:18 +0000
Commit:     Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2024-01-15 10:38:18 +0000

    misc/mc: drop needless run-time dependencies on Aspell and Xlib

    Yury V. Zaytsev points out that for X11 and Aspell support, header
    files <X11/Xlib.h> and <aspell.h> are only needed during the build,
    while their corresponding libraries would be loaded dynamically if
    available; if not, mc(1) would still work fine, just without those
    features.  The source code and ldd(1) output confirm his findings:

      % cd $WRKDIR/mc-4.8.30 && grep -R -A1 g_module_build_path *
      lib/tty/x11conn.c:  x11_module_fname = g_module_build_path (NULL, "X11");
      lib/tty/x11conn.c-  x11_module = g_module_open (x11_module_fname, G_MODULE_BIND_LAZY);
      --
      src/editor/spell.c: spell_module_fname = g_module_build_path (NULL, "libaspell");
      src/editor/spell.c- spell_module = g_module_open (spell_module_fname, G_MODULE_BIND_LAZY);

    This allows to enable Aspell support by default and drop X11-less
    slave port now that both of these dependencies are build-time only
    yet still can be completely disabled via options.

    PR:     269120

 MOVED                         |  1 +
 misc/Makefile                 |  1 -
 misc/mc-nox11/Makefile (gone) |  4 ----
 misc/mc/Makefile              | 11 +++++------
 4 files changed, 6 insertions(+), 11 deletions(-)
Comment 2 Alexey Dokuchaev freebsd_committer freebsd_triage 2024-01-15 10:54:52 UTC
(In reply to Yury V. Zaytsev from comment #0)
> [...] useless nox11 variants not having runtime dependency that wasn't
> there in the first place... not sure whether FreeBSD has its own reasons
> to have a separate port (e.g. allow building on systems without X11
> headers?)
Yes, that was the original intention and also because USE_XORG components register both build- and run-time dependencies.  I've now converted both to build-time only as you correctly describe, and `mc-nox11' port is not longer needed (those who build from ports can easily disable the option and package users won't even notice it).
Comment 3 Yury V. Zaytsev 2024-01-15 15:43:09 UTC
Hey Alexey, thanks for looking into this!