From patchwork Sun Feb 23 16:17:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Hadjinlian X-Patchwork-Id: 323339 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 3F9732C00CD for ; Mon, 24 Feb 2014 03:17:51 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 5107E9360B; Sun, 23 Feb 2014 16:17:50 +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 KzOSEHW-J4Qz; Sun, 23 Feb 2014 16:17:49 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id B185193639; Sun, 23 Feb 2014 16:17:49 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 9A3631BFA34 for ; Sun, 23 Feb 2014 16:17:48 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 96F8A93620 for ; Sun, 23 Feb 2014 16:17:48 +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 xnG3hpC2LG54 for ; Sun, 23 Feb 2014 16:17:47 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-we0-f176.google.com (mail-we0-f176.google.com [74.125.82.176]) by hemlock.osuosl.org (Postfix) with ESMTPS id 3FBF89360B for ; Sun, 23 Feb 2014 16:17:47 +0000 (UTC) Received: by mail-we0-f176.google.com with SMTP id q58so3992976wes.35 for ; Sun, 23 Feb 2014 08:17:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=5EiXjdZouSH1ayns8SkWOsuUyhSxrxTdDkiGiMOtljE=; b=pUxPoZ4NmlRr4SLBMen1lKKePFQX7VR684l8NG7jKtNhXd292D1ZV41dfXKaerxxSs MqHq2SkD+fQQfCCQJ1ea8nGm/iqwIcKYe4l6bLcmf16OFdtG4AKeWW7PBcMHMXJoNJYC lNwsXLwVc8+FvHFeAqK1ozQW/LXMXTBNsj9S9BFlFobvv+HAnbxnBs4Ge7SfOBEraX5H aG+BgPjm+08awasVDeCsSWHKg6XL2xxBRfBc0jrvmmZKLAJVp3eOEgj8okNqWtBLr9NE 0/eJrNzYHsq0SGtTAqHbUxhWNGn27odYbzfZQmH767hzM9HlyyJXs/F9Vy1PuX2Idu6o +pJg== X-Received: by 10.194.179.69 with SMTP id de5mr15316703wjc.4.1393172265469; Sun, 23 Feb 2014 08:17:45 -0800 (PST) Received: from localhost (13-105-190-109.dsl.ovh.fr. [109.190.105.13]) by mx.google.com with ESMTPSA id ux5sm34513514wjc.6.2014.02.23.08.17.44 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sun, 23 Feb 2014 08:17:44 -0800 (PST) From: Maxime Hadjinlian To: buildroot@buildroot.org Date: Sun, 23 Feb 2014 17:17:40 +0100 Message-Id: <1393172261-17421-1-git-send-email-maxime.hadjinlian@gmail.com> X-Mailer: git-send-email 1.8.5.3 Subject: [Buildroot] [PATCH v2 1/2] infra: Add generic check_prog_host function 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 Avoid copy/pasting the same block of code to check if a program is available on the host machine. Also, introduce, BR2_NEEDS_HOST_JAVAC and BR2_NEEDS_HOST_JAR. In a following patch, we will remove the specific check done for classpath, and the classpath package will use these generic variant. Signed-off-by: Maxime Hadjinlian --- Changes v1 -> v2: - Uses check_prog_host for which and sed too (Thomas Petazzoni) --- Config.in | 10 ++++++++++ support/dependencies/dependencies.sh | 38 +++++++++++++++++++++--------------- 2 files changed, 32 insertions(+), 16 deletions(-) diff --git a/Config.in b/Config.in index 55f5fd8..a24421f 100644 --- a/Config.in +++ b/Config.in @@ -23,6 +23,16 @@ config BR2_EXTERNAL config BR2_NEEDS_HOST_JAVA bool +# Hidden boolean selected by packages in need of javac in order to build +# (example: classpath) +config BR2_NEEDS_HOST_JAVAC + bool + +# Hidden boolean selected by packages in need of jar in order to build +# (example: classpath) +config BR2_NEEDS_HOST_JAR + bool + # Hidden boolean selected by pre-built packages for x86, when they # need to run on x86-64 machines (example: pre-built external # toolchains, binary tools like SAM-BA, etc.). diff --git a/support/dependencies/dependencies.sh b/support/dependencies/dependencies.sh index a8261b3..b18a888 100755 --- a/support/dependencies/dependencies.sh +++ b/support/dependencies/dependencies.sh @@ -51,18 +51,20 @@ if test -n "$PERL_MM_OPT" ; then exit 1 fi -# Verify that which is installed -if ! which which > /dev/null ; then - echo - echo "You must install 'which' on your build machine"; - exit 1; -fi; +check_prog_host() +{ + prog="$1" + if ! which $prog > /dev/null ; then + echo >&2 + echo "You must install '$prog' on your build machine" >&2 + exit 1 + fi +} -if ! which sed > /dev/null ; then - echo - echo "You must install 'sed' on your build machine" - exit 1 -fi +# Verify that which is installed +check_prog_host "which" +# Verify that sed is installed +check_prog_host "sed" # Check make MAKE=$(which make 2> /dev/null) @@ -192,11 +194,15 @@ if grep -q ^BR2_PACKAGE_CLASSPATH=y $BR2_CONFIG ; then fi if grep -q ^BR2_NEEDS_HOST_JAVA=y $BR2_CONFIG ; then - if ! which java > /dev/null ; then - echo >&2 - echo "You must install 'java' on your build machine" >&2 - exit 1 - fi + check_prog_host "java" +fi + +if grep -q ^BR2_NEEDS_HOST_JAVAC=y $BR2_CONFIG ; then + check_prog_host "javac" +fi + +if grep -q ^BR2_NEEDS_HOST_JAR=y $BR2_CONFIG ; then + check_prog_host "jar" fi if grep -q ^BR2_HOSTARCH_NEEDS_IA32_LIBS=y $BR2_CONFIG ; then