Note to packagers regarding OpenWrt intl and iconv support
jow at openwrt.org
Wed Feb 2 16:41:17 EST 2011
-----BEGIN PGP SIGNED MESSAGE-----
following the discussion about stubbed libintl and libiconv
implementations in OpenWrt , I decided to implement a switching
mechanism for those libraries in the OpenWrt buildroot.
This is a short explanation for packagers and image builders on howto
prepare packages to work with the switching.
The OpenWrt menuconfig gained a new boolean symbol called
"CONFIG_BUILD_NLS" which is disabled by default . Turning it on will
enable the building of the full gettext (libintl) and libiconv packages.
The setting can be found in the "Global Build Settings" menu, called
"Compile with full language support".
Packages using either iconv or intl have been changed  to include the
new convenience file "include/nls.mk" which exports variables to use
within Makefiles to pull in the right iconv or intl implementation.
The exported variables are:
ICONV_FULL - set to 1 if the full iconv implementation is used,
ICONV_PREFIX - path to the location of the include/ and lib/ dirs
of the currently used iconv implementation
ICONV_DEPENDS - expands to a dependency specification that results
either in +libiconv-full or nothing, depending on the
ICONV_CFLAGS - contains the appropriate CFLAGS to make programs find
the iconv headers
ICONV_CPPFLAGS - alias to ICONV_CFLAGS
ICONV_LDFLAGS - contains the appropriate LDFLAGS to make programs link
to the iconv implementation
INTL_FULL - set to 1 if the full libintl implementation is used,
INTL_PREFIX - path to the location of the include/ and lib/ dirs
of the currently used libintl implementation
INTL_DEPENDS - expands to a dependency specification that results
either in +libintl-full or nothing, depending on the
INTL_CFLAGS - contains the appropriate CFLAGS to make programs find
the libintl headers
INTL_CPPFLAGS - alias to INTL_CFLAGS
INTL_LDFLAGS - contains the appropriate LDFLAGS to make programs link
to the libintl implementation
Additionally the include automatically extends the TARGET_CFLAGS,
TARGET_CPPFLAGS and TARGET_LDFLAGS variables so that most programs
should pick up the libs automatically in their configure/make process.
To adapt existing package Makefiles to the new mechanism, the following
changes must be made:
- Add "include $(INCLUDE_DIR)/nls.mk" below the existing "package.mk"
- Remove existing extensions to TARGET_CFLAGS/CPPFLAGS/LDFLAGS like
"TARGET_CFLAGS+=-I$(STAGING_DIR)/usr/lib/libintl/include/" (if any)
- Replace existing extensions to other variables with $(ICONV_PREFIX),
$(INTL_PREFIX) where applicable (e.g.
- Replace dependency specifications like +libiconv, +libiconv-full,
+libintl or +libintl-full with $(ICONV_DEPENDS) or $(INTL_DEPENDS)
- Some packages have configure switches like "--with-libiconv=gnu",
those should be wrapped similar to this:
- If a program is known to fail with the stub implementation, a
dependency like "DEPENDS:=@BUILD_NLS" can be specified to hide and
disable the package from menuconfig if CONFIG_BUILD_NLS is unset
Neither the stub nor the full packages install their (shared) objects
and headers into a "standard" location ($(STAGING_DIR)/usr/...) anymore
so programs that must use them have to use the nls.mk facility.
Programs with optional iconv/intl support will just skip over them as
they're not detectable without extra flags anymore.
As the current Backfire branch and Trunk share the same packages feed,
the BUILD_NLS support has been merged into the latest branch as well.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
-----END PGP SIGNATURE-----
More information about the discussion