Subject: How to enable USE_GNU_ICONV for glib2?
To: None <tech-pkg@NetBSD.org>
From: Bernd Ernesti <netbsd@lists.veego.de>
List: tech-pkg
Date: 01/06/2006 18:41:19
Hi,

irssi needs an glib2 build with USE_GNU_ICONV to enable the recode
function.

From the not yet commited irrsi update to 0.8.10 MESSAGE file:
 This version of irssi has support for character set conversions. Irssi is
 able to transliterate unavailable characters if transliteration is
 supported by GLib. If you want to use transliteration, rebuild devel/glib2
 with USE_GNU_ICONV=yes.

I tried to build irssi with a glib2 which used our iconv, but then it wasn't
possible to enable the special new feature. Where it was possible to use it
with glib2 and USE_GNU_ICONV, but this fails with other packages which
knows nothing about USE_GNU_ICONV for glib2.

This is how i Did it, adding the follwoing patch to pkgsrc/devel/glib2/options.mk
and used 'PKG_OPTIONS.glib2 += gnu-iconv' in /etc/mk.conf.

--- options.mk	25 Nov 2005 21:30:17 -0000	1.1
+++ options.mk	6 Jan 2006 14:35:03 -0000
@@ -1,10 +1,15 @@
 # $NetBSD: options.mk,v 1.1 2005/11/25 21:30:17 wiz Exp $
 
 PKG_OPTIONS_VAR=	PKG_OPTIONS.glib2
-PKG_SUPPORTED_OPTIONS=	debug
+PKG_SUPPORTED_OPTIONS=	debug gnu-iconv
 
 .include "../../mk/bsd.options.mk"
 
 .if !empty(PKG_OPTIONS:Mdebug)
 CONFIGURE_ARGS+=	--enable-debug=yes
 .endif
+
+.if !empty(PKG_OPTIONS:Mgnu-iconv)
+USE_GNU_ICONV=	YES
+.endif
+

Later I discovered that some packages, like arts and ORBit2 doesn't build
shared libraries for some of the libraries anymore:

/bin/sh ../../libtool --mode=link cc  -O2 -I/usr/pkg/include -I/usr/include  -L/usr/pkg/lib -Wl,-R/usr/pkg/lib -L/usr/lib -Wl,-R/usr/lib -o libORBit-2.la -rpath /usr/pkg/lib -version-info 0:0:0 -no-undefined -Wl,-R/usr/pkg/lib -pthread -Wl,--export-dynamic -L/usr/pkg/lib -lgobject-2.0 -lgthread-2.0 -lgmodule-2.0 -lglib-2.0 -liconv   -lpopt orbit-init.lo util/liborb-util.la GIOP/libGIOP.la orb-core/liborb-core.la poa/liborb-poa.la dynamic/liborb-dynamic.la ../../linc2/src/liblinc.la -lintl

*** Warning: linker path does not have real file for library -liconv.
*** I have the capability to make that library automatically link in when
*** you link to this library.  But I can only do this if you have a
*** shared version of the library, which you do not appear to have
*** because I did check the linker path looking for a file starting
*** with libiconv but no candidates were found. (...for regex pattern test)
*** The inter-library dependencies that have been dropped here will be
*** automatically added whenever a program is linked with this library
*** or is declared to -dlopen it.

*** Since this library must not contain undefined symbols,
*** because either the platform does not support them or
*** it was explicitly requested with -no-undefined,
*** libtool will only create a static version of it.

libbonobo later failed to build:

/pkgsrc/devel/libgnome/work.i386/.buildlink/lib/libbonobo-2.so: undefined reference to `TC_CORBA_char_struct'
/pkgsrc/devel/libgnome/work.i386/.buildlink/lib/libbonobo-2.so: undefined reference to `CORBA_Object_is_equivalent'
/pkgsrc/devel/libgnome/work.i386/.buildlink/lib/libbonobo-activation.so: undefined reference to `CORBA_ORB_get_default_context'
/pkgsrc/devel/libgnome/work.i386/.buildlink/lib/libbonobo-2.so: undefined reference to `CORBA_TypeCode_equivalent'

It seems our native iconv is not good enough for glib2, but then using
converters/libiconv doesn't work either.

Bernd