From patchwork Sun Dec 16 17:01:38 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 206715 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ozlabs.org (Postfix) with ESMTP id 70DCE2C007B for ; Mon, 17 Dec 2012 04:03:03 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 8AFBBA010B; Sun, 16 Dec 2012 17:03:02 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Ayf+R1o+bVna; Sun, 16 Dec 2012 17:02:55 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 8209BA00F6; Sun, 16 Dec 2012 17:02:33 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 46ACE8F74B for ; Sun, 16 Dec 2012 17:02:25 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id C367180C10 for ; Sun, 16 Dec 2012 17:02:19 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SQ1G+ZLHv32B for ; Sun, 16 Dec 2012 17:02:19 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wg0-f43.google.com (mail-wg0-f43.google.com [74.125.82.43]) by whitealder.osuosl.org (Postfix) with ESMTPS id BADE080C0E for ; Sun, 16 Dec 2012 17:02:18 +0000 (UTC) Received: by mail-wg0-f43.google.com with SMTP id e12so2204650wge.10 for ; Sun, 16 Dec 2012 09:02:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:in-reply-to:references; bh=6vmPg8KV+6iGDpHiyrkO01ZrJhYDYmaPIfDUQKpSzyk=; b=dbQv31ieW2GCS0xe5aJl5nPh/OiriEsUXzjDGPpLvigsSNWYz9n1N0iGD/YIGdWk2m vvEUfthNIGSplHmDCTivEfW13GX2zAqlJRL+flIHuqDNtDlb0wlo5cxIVT8+GuG8ur1m Oi2D+zsSGKHIHN+76xGc2Mj0i7T55w9rbHLF4P8bQ+LjL2LXYm4ohkc4GYXaLrUBSCgJ DNGNotZ+dPCMRJbYHB48IQg16zTnDG65yRgLcW4nkbOPUdT/QUYSCoiStHKiq8p34Vqi 94+nDuKz+mkvKwCwZjx8/Xv61Di7BSRjqdkY59Hl2Nr+KdfkfCj9ZGjJdOeErlY03VPK 1UgA== X-Received: by 10.180.92.74 with SMTP id ck10mr11598642wib.9.1355677337000; Sun, 16 Dec 2012 09:02:17 -0800 (PST) Received: from localhost.localdomain (ARennes-256-1-41-119.w90-32.abo.wanadoo.fr. [90.32.24.119]) by mx.google.com with ESMTPS id w5sm7363031wif.11.2012.12.16.09.02.15 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 16 Dec 2012 09:02:16 -0800 (PST) From: "Yann E. MORIN" To: buildroot@busybox.net Date: Sun, 16 Dec 2012 18:01:38 +0100 Message-Id: X-Mailer: git-send-email 1.7.2.5 In-Reply-To: References: In-Reply-To: References: Cc: "Yann E. MORIN" Subject: [Buildroot] [PATCH 09/27] package/qemu: add option to remove unwanted keymaps 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 Signed-off-by: "Yann E. MORIN" --- package/qemu/Config.in | 12 ++++++++++ package/qemu/qemu.mk | 55 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+), 0 deletions(-) diff --git a/package/qemu/Config.in b/package/qemu/Config.in index e530303..5181fdc 100644 --- a/package/qemu/Config.in +++ b/package/qemu/Config.in @@ -128,4 +128,16 @@ config BR2_PACKAGE_QEMU_BLOBS Note2: This has nothing to do with the licensing of the blobs; some (most?) even have a free and/or open source license. +config BR2_PACKAGE_QEMU_KEYMAPS + string "Keymaps to keep" + default "all" + help + Enter the list of keymap(s) to keep. To keep many keymaps, you can + use shell globs, or you can enter a space-separated list of keymaps: + - empty to remove all keymaps + - 'all' to keep all keymaps + - 'fr*' to keep all french keymaps + - 'de fr* en-*' for german, french and english keymaps + - and so on (see the QEMU source for all supported keymaps) + endif # BR2_PACKAGE_QEMU diff --git a/package/qemu/qemu.mk b/package/qemu/qemu.mk index f2cde9d..8a92b67 100644 --- a/package/qemu/qemu.mk +++ b/package/qemu/qemu.mk @@ -153,6 +153,61 @@ ifeq ($(BR2_PACKAGE_QEMU_BLOBS),) QEMU_OPTS += --disable-blobs endif +# Post-install removal of unwanted keymaps: +# - if we want 'all', we do nothing; +# - if we want none, we completely remove the keymap dir +# - otherwise: +# - we completely remove the keymap dir; and recreate it empty +# - we recursively copy only those keymaps we want (as keymaps may include +# some common files) +# +# NOTE-1: we need the un-quoted list of keymaps, so it is interpreted as a glob +# by the shell. +# NOTE-2: yes, all (current!) keymaps do include the 'common' keymap, which in +# turn includes the 'modifiers' keymap, so we could unconditionally +# copy those two, for a much simpler code. Doing it the way it's done +# is more generic, and will adapt to any future keymaps which has +# multiple includes, or none. +# NOTE-3: we can't use $(SED), because it expands to include the '-i' option, +# which we do *not* want here, because we are not munging a file, but +# using sed as a enhanced grep. +# +QEMU_KEYMAPS = $(call qstrip,$(BR2_PACKAGE_QEMU_KEYMAPS)) + +ifeq ($(QEMU_KEYMAPS),all) #--- Keep all keymaps ---# +define QEMU_POST_INSTALL_KEYMAPS + @: Nothing +endef + +else ifeq ($(QEMU_KEYMAPS),) #--- Remove all keymaps ---# +define QEMU_POST_INSTALL_KEYMAPS + rm -rf "$(TARGET_DIR)/usr/share/qemu/keymaps" +endef + +else #--- Keep selected keymaps ---# +define QEMU_POST_INSTALL_KEYMAPS + rm -rf "$(TARGET_DIR)/usr/share/qemu/keymaps" + mkdir -p "$(TARGET_DIR)/usr/share/qemu/keymaps" + add_keymap() { \ + local k="$${1}"; local dest="$${2}"; \ + if [ -n "$${k}" -a ! -f "$${dest}/$${k}" ]; then \ + cp -v "$${k}" "$${dest}"; \ + for k in $$(sed -r -e '/^include[[:space:]]+(.*)$$/!d;' \ + -e 's//\1/;' "$${k}" ); do \ + add_keymap "$${k}" "$${dest}"; \ + done; \ + fi; \ + }; \ + cd $(@D)/pc-bios/keymaps; \ + for k in $(QEMU_KEYMAPS); do \ + add_keymap "$${k}" "$(TARGET_DIR)/usr/share/qemu/keymaps"; \ + done +endef + +endif # Keymaps to keep + +QEMU_POST_INSTALL_TARGET_HOOKS += QEMU_POST_INSTALL_KEYMAPS + # Note: although QEMU uses a ./configure script, it is not compatible with # the traditional autotools options (eg. --target et al.), so we have # to override the default provided by the autotools-package infra, and