From patchwork Wed Oct 24 21:25:55 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: 193980 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id 785B22C008F for ; Thu, 25 Oct 2012 08:30:21 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 1F40D3107D; Wed, 24 Oct 2012 21:30:18 +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 cG14f0gLp2tu; Wed, 24 Oct 2012 21:30:12 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id ABB4431046; Wed, 24 Oct 2012 21:30:09 +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 2651C8F74A for ; Wed, 24 Oct 2012 21:27:05 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id C7C0A8C867 for ; Wed, 24 Oct 2012 21:27:01 +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 DeaOSNI3AKyy for ; Wed, 24 Oct 2012 21:26:53 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wg0-f53.google.com (mail-wg0-f53.google.com [74.125.82.53]) by whitealder.osuosl.org (Postfix) with ESMTPS id A57F28C814 for ; Wed, 24 Oct 2012 21:26:46 +0000 (UTC) Received: by mail-wg0-f53.google.com with SMTP id dr1so619614wgb.10 for ; Wed, 24 Oct 2012 14:26:46 -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:x-mailer:in-reply-to :references; bh=qQCfDKcGu0EMVHbCv+QdvjT/eJ3hE2kzqyMrvsMhkdw=; b=Ufd86W8+ALpFCRdFja8XQE1Ge/TopYrgn4dwmeOK489VzupcUjPnZl4/+yuv2oNDpY u1cSrH+Sm3Z8E0nua3psBcwSijSEcbQ4Ty7q2g70z2CH7YJGjSa74GU/AVhXukfOTOqv ELB4ruRKLpyrw0lju3OXOOoDjEfJsU4WtjTBJahOmJdWEUYN3GTH//CAhn9/j5RsKnXx Za58+VdTZZAG8mtbdPuVnlei9ydziVa1/3UHn7Zhusa8wMhefrUJ5eKc3T/eEZjDHIBL 8Y1Zatsq2wdsKrlJ8cei0z0CxJjG4ATLn3FcB4xnuqPO0VYlE+aMXyIQo2uKis64emwL PClA== Received: by 10.216.201.80 with SMTP id a58mr10509731weo.15.1351114006219; Wed, 24 Oct 2012 14:26:46 -0700 (PDT) Received: from localhost.localdomain (ARennes-256-1-66-54.w90-32.abo.wanadoo.fr. [90.32.145.54]) by mx.google.com with ESMTPS id hb6sm6371161wib.7.2012.10.24.14.26.45 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 24 Oct 2012 14:26:45 -0700 (PDT) From: "Yann E. MORIN" To: buildroot@busybox.net Date: Wed, 24 Oct 2012 23:25:55 +0200 Message-Id: <1351113973-17237-30-git-send-email-yann.morin.1998@free.fr> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1351113973-17237-1-git-send-email-yann.morin.1998@free.fr> References: <1351113973-17237-1-git-send-email-yann.morin.1998@free.fr> Cc: bjornar.ness@gmail.com, "Yann E. MORIN" Subject: [Buildroot] [PATCH 29/47] 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 ab82bf8..65d1ffd 100644 --- a/package/qemu/Config.in +++ b/package/qemu/Config.in @@ -131,4 +131,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 3d1ec44..8684d66 100644 --- a/package/qemu/qemu.mk +++ b/package/qemu/qemu.mk @@ -87,6 +87,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 can # not use the autotools-package infrastructure. So we have to use the