From patchwork Fri Aug 2 09:05:15 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas De Schampheleire X-Patchwork-Id: 264232 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (fraxinus.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id B1EDB2C0091 for ; Fri, 2 Aug 2013 19:05:54 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 5558C973E5; Fri, 2 Aug 2013 09:05:53 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Cxp-7sUmK1H6; Fri, 2 Aug 2013 09:05:52 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 0A6B18B982; Fri, 2 Aug 2013 09:05:52 +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 0829D1C2DD7 for ; Fri, 2 Aug 2013 09:06:07 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id A835E8CE0D for ; Fri, 2 Aug 2013 09:05:50 +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 IcZ7ne4ji5Jk for ; Fri, 2 Aug 2013 09:05:49 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-ee0-f54.google.com (mail-ee0-f54.google.com [74.125.83.54]) by whitealder.osuosl.org (Postfix) with ESMTPS id 262258C64A for ; Fri, 2 Aug 2013 09:05:48 +0000 (UTC) Received: by mail-ee0-f54.google.com with SMTP id e53so194159eek.13 for ; Fri, 02 Aug 2013 02:05:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:content-type:mime-version:content-transfer-encoding:subject :x-mercurial-node:message-id:in-reply-to:references:user-agent:date :from:to:cc; bh=k0PTGNvmMxV5C3pCQTsxdnrWbcr/6IBx4japIuImR9k=; b=WEbBqiw2rNQQ4QfLkjs2YpLHsnMK6ckIQIxJawvAuB0vpWP8iAHkX/GUU4q1/HSwmW 5lAXzYfTdYidyHR+AufEwJFe3+9R9ZnHwHGkngZuHLlaPscoWJU9HIM8gaPlZHRW4GUi 8yjQcK2Uv031iivNcBRzml8aX0VYFhvXKuO2XRXRRrwhCk0iQV7U4FSXkoM5OM49yLIi MIuDaD/dWqN7MjHQ1ll4Eu9pSPHucLingYHHvM3HiJJ3auhnK40n/RSQHUAEbRRozhmv bQTVGfIHeiv19oLIZoI0dx/ugWW+ACKqjuPkgjNiNjN9EzMLI4p7A+02MCASq55/kswa daqQ== X-Received: by 10.14.99.71 with SMTP id w47mr4877211eef.140.1375434347342; Fri, 02 Aug 2013 02:05:47 -0700 (PDT) Received: from [127.0.1.1] (d54C62EEB.access.telenet.be. [84.198.46.235]) by mx.google.com with ESMTPSA id cg12sm10499662eeb.7.2013.08.02.02.05.45 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 02 Aug 2013 02:05:46 -0700 (PDT) MIME-Version: 1.0 X-Mercurial-Node: a7969409ab53a2fc00c4a44b4680577af42e90f6 Message-Id: In-Reply-To: References: User-Agent: Mercurial-patchbomb/2.2.2 Date: Fri, 02 Aug 2013 11:05:15 +0200 From: Thomas De Schampheleire To: buildroot@busybox.net Cc: thomas.petazzoni@free-electrons.com Subject: [Buildroot] [PATCH 2 of 2 v3] xzcat: treat as host prerequisite and build if needed 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: , Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net If xzcat is not present on the host system, buildroot bails out early asking the developer to install it (xzcat is now a DL_TOOLS_DEPENDENCY) Conversely, when BR2_TARGET_ROOTFS_CPIO_XZ is enabled, then host-xz is a build dependency, and no manual action is required from the developer. Because the second approach is nicer, also build host-xz when xzcat is not available, using the host-prerequisite and suitable-host-pkg mechanisms, already used for tar. Signed-off-by: Thomas De Schampheleire --- v3: update after $(firstword) change v2: avoid filtering out xzcat from DL_TOOLS_DEPENDENCIES (comment ThomasP) package/pkg-generic.mk | 4 ++++ support/dependencies/check-host-xzcat.mk | 7 +++++++ support/dependencies/check-host-xzcat.sh | 14 ++++++++++++++ 3 files changed, 25 insertions(+), 0 deletions(-) diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk --- a/package/pkg-generic.mk +++ b/package/pkg-generic.mk @@ -541,7 +541,11 @@ endif # SITE_METHOD # $(firstword) is used here because the extractor can have arguments, like # ZCAT="gzip -d -c", and to check for the dependency we only want 'gzip'. +# Do not add xzcat to the list of required dependencies, as it gets built +# automatically if it isn't found. +ifneq ($(call suitable-extractor,$($(2)_SOURCE)),$(XZCAT)) DL_TOOLS_DEPENDENCIES += $(firstword $(call suitable-extractor,$($(2)_SOURCE))) +endif endif # $(2)_KCONFIG_VAR endef # inner-generic-package diff --git a/support/dependencies/check-host-xzcat.mk b/support/dependencies/check-host-xzcat.mk new file mode 100644 --- /dev/null +++ b/support/dependencies/check-host-xzcat.mk @@ -0,0 +1,7 @@ +# XZCAT is taken from BR2_XZCAT (defaults to 'xzcat') (see Makefile) +# If it is not present, build our own host-xzcat + +ifeq (,$(call suitable-host-package,xzcat,$(XZCAT))) + DEPENDENCIES_HOST_PREREQ += host-xz + XZCAT = $(HOST_DIR)/usr/bin/xzcat +endif diff --git a/support/dependencies/check-host-xzcat.sh b/support/dependencies/check-host-xzcat.sh new file mode 100755 --- /dev/null +++ b/support/dependencies/check-host-xzcat.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +candidate="$1" + +xzcat=`which $candidate 2>/dev/null` +if [ ! -x "$xzcat" ]; then + xzcat=`which xzcat 2>/dev/null` + if [ ! -x "$xzcat" ]; then + # echo nothing: no suitable xzcat found + exit 1 + fi +fi + +echo $xzcat