Subject: Re: CVS commit: pkgsrc/converters/libiconv
To: Jeremy C. Reed <reed@reedmedia.net>
From: Johnny C. Lam <jlam@NetBSD.org>
List: tech-pkg
Date: 04/27/2004 07:43:47
On Tue, Apr 27, 2004 at 12:13:26AM -0700, Jeremy C. Reed wrote:
> On Mon, 26 Apr 2004, Johnny C. Lam wrote:
> 
> > 	pkgsrc/converters/libiconv: builtin.mk
> >
> > Log Message:
> > Do previous in a different way.  We want USE_GNU_ICONV to always use
> > a GNU libiconv, whether it be builtin or not, and PREFER_{NATIVE,PKGSRC}
> > can be used to decide which iconv we use if USE_GNU_ICONV isn't defined.
> > On NetBSD, the native iconv implementation (if it exists) is considered
> > GNUish enough unless USE_GNU_ICONV is explicitly defined.
> 
> I don't want converters/libiconv ever installed under Linux. What can I
> do?
> 
> My Makefile has:
> 
> .include "../../mk/bsd.prefs.mk"
> .if ${OPSYS} == "Linux"
> # don't use PKG_SKIP_REASON yet so we can make sure the buildlinking is correct
> PKG_FAIL_REASON+=       "${PKGNAME} is not needed for Linux; it is
> included in GNU libc."
> .endif
> 
> What can we do for the converters/libiconv/builtin.mk so I can choose to
> never use libiconv package even if USE_GNU_ICONV is defined?
> 
> I think I provided to this list before a patch for this. It could check
> /usr/include/iconv.h for "This file is part of the GNU C Library."
> 
> (Most Linux distributions don't even have any libiconv package. It is not
> needed.)

There's a section in libiconv/builtin.mk for NetBSD that assumes the
native iconv is GNUish enough unless we explicitly prefer the pkgsrc
version.  A similar clause for Linux can be added there as well, e.g.
by adding the following after line 89 of the file:

.    if (${OPSYS} == "Linux") && exists(${_ICONV_H})
USE_BUILTIN.iconv!=	\
	if ${GREP} -q "This file is part of the GNU C Library" ${_ICONV_H}; then \
		${ECHO} "yes";						\
	else								\
		${ECHO} "no";						\
	fi
.    endif

It's important _NOT_ to add this clause earlier in the builtin.mk file
where we set the value of IS_BUILTIN.iconv because we're already
acknowledging that this iconv implementation is not truly GNU libiconv.
Instead, we set the value of USE_BUILTIN.iconv which merely determines
if we are using the builtin iconv regardless of whether it's truly
GNU libiconv.

	Cheers,

	-- Johnny Lam <jlam@NetBSD.org>