Note to packagers regarding OpenWrt intl and iconv support

Jo-Philipp Wich jow at openwrt.org
Wed Feb 2 16:41:17 EST 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

following the discussion about stubbed libintl and libiconv
implementations in OpenWrt [1], 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 [2]. 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 [3] 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,
                  else unset
 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
                  CONFIG_BUILD_NLS symbol
 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,
                  else unset
 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
                  CONFIG_BUILD_NLS symbol
 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"
   include

 - 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.
   "EXTRA_CPPFLAGS+=-I$(STAGING_DIR)/usr/lib/libiconv/include" to
   "EXTRA_CPPFLAGS+=$(ICONV_CPPFLAGS)" or
   "EXTRA_CPPFLAGS+=-I$(ICONV_PREFIX)/include")

 - 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 $(ICONV_FULL),--with-libiconv=gnu)"

 - 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.

Regards,
Jow


1)
http://lists.en.qi-hardware.com/pipermail/discussion/2011-January/006770.html
2) https://dev.openwrt.org/changeset/25302
3) https://dev.openwrt.org/changeset/25319
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk1Jz30ACgkQdputYINPTPNeVwCdGESiq8L4sVHRzVlY0EVJNfSW
4gsAni4B2GROqtBRwYz5yKx10EPy3yQ3
=gSoQ
-----END PGP SIGNATURE-----




More information about the discussion mailing list


interactive