From patchwork Mon Dec 10 23:44:52 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: 205087 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 0F83E2C0322 for ; Tue, 11 Dec 2012 10:50:04 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 06916A0193; Mon, 10 Dec 2012 23:50:02 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id vQy5YVxN6m-A; Mon, 10 Dec 2012 23:49:57 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id B101CA0139; Mon, 10 Dec 2012 23:48:01 +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 45D828F74B for ; Mon, 10 Dec 2012 23:46:52 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id D4AF08A35E for ; Mon, 10 Dec 2012 23:46:46 +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 anjBwZoYA5a5 for ; Mon, 10 Dec 2012 23:46:34 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wi0-f177.google.com (mail-wi0-f177.google.com [209.85.212.177]) by whitealder.osuosl.org (Postfix) with ESMTPS id 0B4C78ACA7 for ; Mon, 10 Dec 2012 23:45:51 +0000 (UTC) Received: by mail-wi0-f177.google.com with SMTP id hm2so1427071wib.10 for ; Mon, 10 Dec 2012 15:45:51 -0800 (PST) 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=fXIYHx4cMD3aNoyjY9fQZ/G/GnSxbYaaHspz4hKJP5w=; b=aWqSK6H4EMFeN92NRwhrvDGPeSilOS7NX56jqskPeOuJSe9mlQ6O710CAmS2CC5lL3 A/uAcr6RdcIEDfJZkGy/JKCP0jaIUlKzKrJst1VZHyeWX3XDn1j3+9ZBYnZXGaBbFKWm aTkh3uL0IcBUhCMCLLoTKUd+raXF03R/u2W2GMq+d3DO1MmQJ2Y3DYBIjcLFNVBQRuXl kgUw0ijDYFDvAk/YW06xnkzaZkN48z+pgmyLFyuMtazENk2O9g3+pG+fjD0QWQORaNnQ 55Na67BTFZiFLf5+nUuJ6JoJLirMr3uX7QaWz2OMM/rbDs4JYNnhCo3lJTWHRgfjnDA3 5x0A== Received: by 10.180.95.169 with SMTP id dl9mr13664955wib.20.1355183151684; Mon, 10 Dec 2012 15:45:51 -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 bz12sm13895257wib.5.2012.12.10.15.45.50 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 10 Dec 2012 15:45:51 -0800 (PST) From: "Yann E. MORIN" To: buildroot@busybox.net Date: Tue, 11 Dec 2012 00:44:52 +0100 Message-Id: <1355183112-10735-33-git-send-email-yann.morin.1998@free.fr> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1355183112-10735-1-git-send-email-yann.morin.1998@free.fr> References: <1355183112-10735-1-git-send-email-yann.morin.1998@free.fr> Cc: "Yann E. MORIN" Subject: [Buildroot] [PATCH 32/52] 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 bf4aeb9..9ed6d6f 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