From patchwork Mon Jul 21 22:24:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 372286 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ozlabs.org (Postfix) with ESMTP id AA4F8140146 for ; Tue, 22 Jul 2014 08:25:12 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 4A16E83C33; Mon, 21 Jul 2014 22:25:11 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id puWwrq6lRagx; Mon, 21 Jul 2014 22:25:09 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id B78918767C; Mon, 21 Jul 2014 22:25:09 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 4CC561BF9B6 for ; Mon, 21 Jul 2014 22:25:08 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 4691A3004B for ; Mon, 21 Jul 2014 22:25:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id dBpyS6J-x6PT for ; Mon, 21 Jul 2014 22:25:06 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-we0-f173.google.com (mail-we0-f173.google.com [74.125.82.173]) by silver.osuosl.org (Postfix) with ESMTPS id 778E82CCEC for ; Mon, 21 Jul 2014 22:25:06 +0000 (UTC) Received: by mail-we0-f173.google.com with SMTP id q58so8391831wes.32 for ; Mon, 21 Jul 2014 15:25:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=Q67IiZKK/dhrPysVnNPciz5ylzwFmrkB3ik5D83FhJo=; b=usuw4dAHmPIJvtaEbj47Q+YfJyn+9X/EqxbbFg26TjwgLEHTYziAg9863kLQOI1qn9 dPRYjgxdbog5GX2KQtU/OKo/+Vgw+6ph6+YW/LDfwOnVE0RMHC7ztchaYMcrWsSvXGv3 6r8jFTB7gwKVNfyi/LpF4xWGSwdmrFdATl1PwkJ/McfPswYISvFlmrL3vAf/4uES/mqE XNrOalMD3HnS/YVPBxrxzMIJiCJLv6FoQt05ABDL1t4y6XWLPzrbPFeUUTGIBcCxZC8c C9BG9rkzwJkOJiZMqUYdi8Qa4pMpS8z68Ae5zRNAQq5s7W/nVYHuFNRdC6os2JmYxJEi jenw== X-Received: by 10.180.75.197 with SMTP id e5mr8642267wiw.76.1405981504835; Mon, 21 Jul 2014 15:25:04 -0700 (PDT) Received: from gourin.bzh.lan (ks3095497.kimsufi.com. [94.23.60.27]) by mx.google.com with ESMTPSA id h3sm40709455wjz.48.2014.07.21.15.25.02 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 21 Jul 2014 15:25:03 -0700 (PDT) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Tue, 22 Jul 2014 00:24:59 +0200 Message-Id: <1405981499-5943-1-git-send-email-yann.morin.1998@free.fr> X-Mailer: git-send-email 1.9.1 Cc: Bernd Kuhls , Eric Limpens , "Yann E. MORIN" Subject: [Buildroot] [PATCH] toolchain: add option to copy the gconv libraries X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net The gconv libraries are used to translate between different character sets (charsets). In (e)glibc they are implemented by the internal implemenation of iconv, called gconv, and are provided as dlopen-able libraries. Some packages need them to present text to the user (eg. XBMC Gotham). Signed-off-by: "Yann E. MORIN" Cc: Maxime Hadjinlian Cc: Bernd Kuhls Signed-off-by: Bernd Kuhls Cc: Eric Limpens --- Notes: - this is getting a bit urgent, as without it, XBMC is basically unusable, as it does not render the labels on the menus. I would really appreciate a review on this, so I have time to respin it before -rc1 if changes are required. - contrary to what Thomas asked, I did not provide a minimalist list of default gconv modules to install. Thomas was concerned about the size of the installed modules. But thos emodules are probably only used in GUIs, which would probably already pull one of the graphical frameworks such as Qt or GTK, which are already huge beasts. So, I still think that the default should be to install all modules. Changes v4 -> v5; - expunge gconv-module from not-installed modules (Thomas) Change v3 -> v4: - fix superfluous semi-colon before '||' Changes v2 -> v3: - properly fail if a specified lib is missing (e.g. typo) Changes v1 -> v2: - add option to install only a select list of gconv libs (Thomas) - rename the option (Thomas) --- Makefile | 24 ++++++++++++++++++++++++ support/scripts/expunge-gconv-modules | 26 ++++++++++++++++++++++++++ toolchain/toolchain-common.in | 22 ++++++++++++++++++++++ 3 files changed, 72 insertions(+) create mode 100755 support/scripts/expunge-gconv-modules diff --git a/Makefile b/Makefile index 1af51de..44cab77 100644 --- a/Makefile +++ b/Makefile @@ -551,6 +551,30 @@ endef TARGET_FINALIZE_HOOKS += PURGE_LOCALES endif +ifeq ($(BR2_TOOLCHAIN_GLIBC_GCONV_LIBS_COPY),y) +GCONV_LIBS = $(call qstrip,$(BR2_TOOLCHAIN_GLIBC_GCONV_LIBS_LIST)) +define COPY_GCONV_LIBS + $(Q)if [ -z "$(GCONV_LIBS)" ]; then \ + $(INSTALL) -m 0644 -D $(STAGING_DIR)/usr/lib/gconv/gconv-modules \ + $(TARGET_DIR)/usr/lib/gconv/gconv-modules; \ + $(INSTALL) -m 0644 $(STAGING_DIR)/usr/lib/gconv/*.so \ + $(TARGET_DIR)/usr/lib/gconv \ + || exit 1; \ + else \ + rm -f $(TARGET_DIR)/usr/lib/gconv/gconv-modules; \ + for l in $(GCONV_LIBS); do \ + $(INSTALL) -m 0644 -D $(STAGING_DIR)/usr/lib/gconv/$${l}.so \ + $(TARGET_DIR)/usr/lib/gconv/$${l}.so \ + || exit 1; \ + ./support/scripts/expunge-gconv-modules $${l} \ + <$(STAGING_DIR)/usr/lib/gconv/gconv-modules \ + >>$(TARGET_DIR)/usr/lib/gconv/gconv-modules; \ + done; \ + fi +endef +TARGET_FINALIZE_HOOKS += COPY_GCONV_LIBS +endif + $(TARGETS_ROOTFS): target-finalize target-finalize: $(TARGETS) diff --git a/support/scripts/expunge-gconv-modules b/support/scripts/expunge-gconv-modules new file mode 100755 index 0000000..3a88fde --- /dev/null +++ b/support/scripts/expunge-gconv-modules @@ -0,0 +1,26 @@ +#!/bin/bash + +gawk -v file="${1}" ' +$1 == "alias" { + aliases[$3] = aliases[$3] " " $2; +} +$1 == "module" && $2 != "INTERNAL" { + file2mods[$4] = file2mods[$4] " " $2; + mod2cost[$2] = $5; +} + +END { + printf( "# Modules and aliases for: %s\n\n", file ); + nb_mods = split( file2mods[file], mods ); + for( i=1; i<=nb_mods; i++ ) { + first = 0; + nb_aliases = split( aliases[mods[i]], mod_aliases ); + for( j=1; j<=nb_aliases; j++ ) { + printf( "alias\t%s\t%s\n", mod_aliases[j], mods[i] ); + } + printf( "module\t%s\t%s\t%s\t%d\n", mods[i], "INTERNAL", file, mod2cost[mods[i]] ); + printf( "module\t%s\t%s\t%s\t%d\n", "INTERNAL", mods[i], file, mod2cost[mods[i]] ); + printf( "\n" ); + } +} +' diff --git a/toolchain/toolchain-common.in b/toolchain/toolchain-common.in index a91d247..13de9e5 100644 --- a/toolchain/toolchain-common.in +++ b/toolchain/toolchain-common.in @@ -77,6 +77,28 @@ config BR2_GENERATE_LOCALE specified, UTF-8 is assumed. Examples of locales: en_US, fr_FR.UTF-8. +config BR2_TOOLCHAIN_GLIBC_GCONV_LIBS_COPY + bool "Copy gconv libraries" + depends on BR2_TOOLCHAIN_USES_GLIBC + help + The gconv libraries are used to convert between different + character sets (charsets). + + Say 'y' if you need to store and/or display different charsets. + +config BR2_TOOLCHAIN_GLIBC_GCONV_LIBS_LIST + string "Gconv libraries to copy" + depends on BR2_TOOLCHAIN_GLIBC_GCONV_LIBS_COPY + help + Set to the list of gconv libraries to copy. + Leave empty to copy all gconv libraries. + + Specify only the basename of the libraries, leave + out the .so extension. Eg.: + IBM850 ISO8859-15 UNICODE + + Note: the full set of gconv libs are ~8MiB (on ARM). + # glibc and eglibc directly include gettext, so a separatly compiled # gettext isn't needed and shouldn't be built to avoid conflicts. Some # packages always need gettext, other packages only need gettext when