Bug 252928 - emulators/mtools: need more direct libiconv dependency
Summary: emulators/mtools: need more direct libiconv dependency
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Steven Kreuzer
Depends on:
Reported: 2021-01-23 04:28 UTC by John Kennedy
Modified: 2021-02-23 16:10 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (skreuzer)

patch to add libiconv dependency (559 bytes, patch)
2021-01-23 04:28 UTC, John Kennedy
no flags Details | Diff
my original (unpatched) poudriere build log for mtools (50.18 KB, text/plain)
2021-01-23 04:44 UTC, John Kennedy
no flags Details
patch to add libiconv dependency, make mtools.conf usable without editing (867 bytes, patch)
2021-02-06 02:53 UTC, John Kennedy
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Kennedy 2021-01-23 04:28:54 UTC
Created attachment 221825 [details]
patch to add libiconv dependency

Noticed compiling net/ipxe-g20201129,1 on 13.0-ALPHA2 1300136

ipxe needs mtools (for mformat), which in turn requires libiconv.  The emulators/mtools port pulls in libiconv-1.16 indirectly, so mtools builds just fine but ipxe doesn't know to pull it in.

I'm not sure that this is exactly what should be done, but it seems like this is the place to do something.  Like I said, it pulled it in indirectly (via texinfo).  I also am a newbie for how to patch ports, so excuse me if I've done something wrong.

I also see that ipxe is barfing on the mtools.conf file that gets installed by default:

bash util/genefidsk -o bin-x86_64-efi/ipxe.usb -b bootx64.efi bin-x86_64-efi/ipxe.efi
Syntax error at line 19 column 0 in file /usr/local/etc/mtools.conf: unrecognized keyword

IE, right where "SAMPLE FILE" is.  Of course, this is a clean poudriere build so there is no chance for a user to customize that file.
Comment 1 John Kennedy 2021-01-23 04:44:44 UTC
Created attachment 221826 [details]
my original (unpatched) poudriere build log for mtools
Comment 2 John Kennedy 2021-01-23 18:40:26 UTC
This morning, I'm really-really questioning my patch since, again, new to trying to submit patch ports.

It seems like Freebsd > 10 has iconv built in, so not strictly necessary to use external library.  I'm guessing the configuration file finds the one present because of other packages and says "oh, well, I should probably be using that" and sets itself up that way.  I'm guessing the port maintainer wasn't necessarily expecting that possibility (or it's changed), thus the lack of dependency.

The options the maintainer make sense to me (per porters handbook using-iconv), but my use of empty(ICONV_LIB) working doesn't.  On my system, mformat is clearly linked to /usr/local/lib/libiconv.so.2, so that is what I should be triggering on but I'm not sure how to do that there.

It seems like you'd want to be ignoring the detect presence of libiconv but still using the functions (not sure if configure --without-iconv will do that).

Its also clear that I'm not totally savvy with options in BSD port Makefiles.

My pseudocode interpretation of the ICONV (default on) options is:

if portion option of ICONV is on
USES+= iconv is set
CPPFLAGS is set (but unnecessary > FreeBSD10, semi ICONV_CONFIGURE_*?)
LDFLAGS is set (but ICONV_LIB should be empty > FreeBSD10, but per handbook)
My possible kludge kicks in since ICONV_LIB is empty, setting LD_DEPENDS)
else ...
Comment 3 John Kennedy 2021-02-06 02:53:17 UTC
Created attachment 222194 [details]
patch to add libiconv dependency, make mtools.conf usable without editing

I beat on this a while more.  Without more patches inside the port, it seems like it really prefers to use libiconv from ports (vs FreeBSD builtin).  So I just make it depend on libiconv properly so it gets dragged in.

I also had the port comment-out the SAMPLE FILE line in mtools.conf so it doesn't break other ports (like net/ipxe) during it's cleanroom poudriere build.
Comment 4 commit-hook freebsd_committer 2021-02-23 16:09:56 UTC
A commit references this bug:

Author: skreuzer
Date: Tue Feb 23 16:09:20 UTC 2021
New revision: 566407
URL: https://svnweb.freebsd.org/changeset/ports/566407

  Add libiconv as a dependancy

  * Prefer to use libiconv from ports
  * Comment out the SAMPLE FILE line in mtools.conf to avoid breakng other ports

  PR:		252928
  Submitted by:	John Kennedy <warlock@phouka.net>

Comment 5 Steven Kreuzer freebsd_committer 2021-02-23 16:10:31 UTC
Committed! Thanks