From patchwork Wed Oct 16 11:19:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Norbert Lange X-Patchwork-Id: 1177814 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.137; helo=fraxinus.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="fqmoTbm2"; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46tVFP4LHtz9sPF for ; Wed, 16 Oct 2019 22:19:53 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 9BA0A84537; Wed, 16 Oct 2019 11:19:50 +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 G-0vpIqYBZqL; Wed, 16 Oct 2019 11:19:48 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 194FA84428; Wed, 16 Oct 2019 11:19:48 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 306311BF484 for ; Wed, 16 Oct 2019 11:19:45 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 2D2DC87722 for ; Wed, 16 Oct 2019 11:19:45 +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 JpBMcSqQaiJa for ; Wed, 16 Oct 2019 11:19:42 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) by whitealder.osuosl.org (Postfix) with ESMTPS id 3A25D86A3C for ; Wed, 16 Oct 2019 11:19:42 +0000 (UTC) Received: by mail-wm1-f41.google.com with SMTP id a6so2463539wma.5 for ; Wed, 16 Oct 2019 04:19:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kB9ccFHCz5MUCha2Oo6LMcEhnJdb+LgFF8hxkbK2T48=; b=fqmoTbm2CToNwkeTzuJLVeiMAhB3NCF3AgdPw0L12vS59zlJIxPe2Lbh1Iwyx7dAF6 VM/0QTmj7AgXCiwoiwKVtiijo7ViqHDr1zmVFHjYC3zy8Hcx22Hyy1VyxTZ6qwhcVhWc 5wl7WGxl1lsyinFD8hE1WdczILEa1PWV8A9cfNyv7L1hFPW65GbfEJ7PtD5u+D9Fdu3s vU+iCltqmfLodC+0ARJJuJrk60U2Zy6qaop1dXPn5fuBW0gnFsX7rQl/f85reBerEueO e27hwwchYCTZLQJrj0DdrLFVwZRchowu0S/aQS+/eL+PKw8cfekY7bC7QlYiC9icf0D3 r6xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kB9ccFHCz5MUCha2Oo6LMcEhnJdb+LgFF8hxkbK2T48=; b=D/RnjEKLKqCQC2gdKq/pxMkOb15mNF4rv0/JIP2SsKZKIqo04AFavv4kGwvEAMrrma exjP0gIBDm5E5ogUUo2Dn0as3nMn6zMvvAdGReLBV1BlaPdTaNHjUuM5hZ9YDA3XvbFA 6C7gq/NavpUq5eiae782ztC1HfqRgSJsowmjhPfH+q0+hc7HTBsRKYKp/Ro/l3/7escA 4zJ8VoNFQ44cRdu3Jp6J1y+aTsMmUecrK9BwvqW8b5cYwfsQDHbU5y+Yy6l39KnDETMV OjKkaNfXIBvtCwO4UoE9k7eZ9+S52hV34xeYaJtEhJG2zUwlNF5au3ntLZhEV3a+T+Pi k/JA== X-Gm-Message-State: APjAAAXjkO5eGqgw2eiWNpc5oCtxCQuf/TvhJ0S/UnoPN1fwlpJzBzGl 2+JHHU/z6ggIrtHX92aGMVpubrgo X-Google-Smtp-Source: APXvYqx183E42b++/1+Ifsno6POrUEPyLPitDogaT71dIW1F4l5xSlwkKJnl3aMDUUtAXYHBuZd6+Q== X-Received: by 2002:a1c:4e15:: with SMTP id g21mr2778380wmh.148.1571224780402; Wed, 16 Oct 2019 04:19:40 -0700 (PDT) Received: from lano-work.andritz.com ([80.120.136.76]) by smtp.gmail.com with ESMTPSA id e18sm34118311wrv.63.2019.10.16.04.19.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2019 04:19:39 -0700 (PDT) From: Norbert Lange To: buildroot@buildroot.org Date: Wed, 16 Oct 2019 13:19:26 +0200 Message-Id: <20191016111927.14208-4-nolange79@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191016111927.14208-1-nolange79@gmail.com> References: <20191016111927.14208-1-nolange79@gmail.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH 3/4] prepare build infrastructure to pick up installed ninja tool X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eric Le Bihan , Norbert Lange Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" The only notable use is as dependency from meson, since using the system installed meson is not officially supported, netiher is using a system installed ninja. a user can force the use of the system installed ninja with make graph-depends BR2_NINJA_VERSION_MIN=0 Signed-off-by: Norbert Lange --- package/meson/meson.mk | 1 - package/pkg-meson.mk | 2 +- support/dependencies/check-host-meson.mk | 4 +-- support/dependencies/check-host-ninja.mk | 13 +++++++ support/dependencies/check-host-ninja.sh | 45 ++++++++++++++++++++++++ 5 files changed, 61 insertions(+), 4 deletions(-) create mode 100644 support/dependencies/check-host-ninja.mk create mode 100755 support/dependencies/check-host-ninja.sh -- 2.23.0 diff --git a/package/meson/meson.mk b/package/meson/meson.mk index 435f8d338e..98b816e2a7 100644 --- a/package/meson/meson.mk +++ b/package/meson/meson.mk @@ -10,7 +10,6 @@ MESON_LICENSE = Apache-2.0 MESON_LICENSE_FILES = COPYING MESON_SETUP_TYPE = setuptools -HOST_MESON_DEPENDENCIES = host-ninja HOST_MESON_NEEDS_HOST_PYTHON = python3 $(eval $(host-python-package)) diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk index 3a66ab8f5a..aa1ef15240 100644 --- a/package/pkg-meson.mk +++ b/package/pkg-meson.mk @@ -26,7 +26,7 @@ # $HOME/.local/lib/python3.x/site-packages # MESON = PYTHONNOUSERSITE=y $(BR2_MESON) -NINJA = PYTHONNOUSERSITE=y $(HOST_DIR)/bin/ninja +NINJA = PYTHONNOUSERSITE=y $(BR2_NINJA) NINJA_OPTS = $(if $(VERBOSE),-v) -j$(PARALLEL_JOBS) ################################################################################ diff --git a/support/dependencies/check-host-meson.mk b/support/dependencies/check-host-meson.mk index fbe0b7d7aa..fb07bea792 100644 --- a/support/dependencies/check-host-meson.mk +++ b/support/dependencies/check-host-meson.mk @@ -9,7 +9,7 @@ BR2_MESON ?= $(call suitable-host-package,meson,\ $(BR2_MESON_VERSION_MIN) $(BR2_MESON_CANDIDATES)) ifeq ($(BR2_MESON),) BR2_MESON = $(HOST_DIR)/bin/meson -BR2_MESON_HOST_DEPENDENCY = host-meson host-ninja +BR2_MESON_HOST_DEPENDENCY = host-meson $(BR2_NINJA_HOST_DEPENDENCY) else -BR2_MESON_HOST_DEPENDENCY = host-ninja +BR2_MESON_HOST_DEPENDENCY = $(BR2_NINJA_HOST_DEPENDENCY) endif diff --git a/support/dependencies/check-host-ninja.mk b/support/dependencies/check-host-ninja.mk new file mode 100644 index 0000000000..09ee45ef1e --- /dev/null +++ b/support/dependencies/check-host-ninja.mk @@ -0,0 +1,13 @@ +# Set this to a valid version like 1.8.2, depending on the highest +# minimum version required by any of the packages bundled in Buildroot. +# An empty version will never match a system executable +# +# BR2_NINJA_VERSION_MIN = 1.8.2 + +BR2_NINJA_CANDIDATES ?= ninja +BR2_NINJA ?= $(call suitable-host-package,ninja,\ + $(BR2_NINJA_VERSION_MIN) $(BR2_NINJA_CANDIDATES)) +ifeq ($(BR2_NINJA),) +BR2_NINJA = $(HOST_DIR)/bin/ninja +BR2_NINJA_HOST_DEPENDENCY = host-ninja +endif diff --git a/support/dependencies/check-host-ninja.sh b/support/dependencies/check-host-ninja.sh new file mode 100755 index 0000000000..62746822cc --- /dev/null +++ b/support/dependencies/check-host-ninja.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +# prevent shift error +[ $# -ge 2 ] && [ -n "$1" ] || exit 1 + +split_version() { + local VARPREFIX + local NUMBERS + local major + local minor + + VARPREFIX=$1 + NUMBERS=$2 + + major=${NUMBERS%%\.*} + NUMBERS=${NUMBERS#$major}; NUMBERS=${NUMBERS#\.} + minor=${NUMBERS%%\.*} + NUMBERS=${NUMBERS#$minor}; NUMBERS=${NUMBERS#\.} + + # ensure that missing values are 0 + eval "${VARPREFIX}_major=\$major; ${VARPREFIX}_minor=\$((minor + 0)); ${VARPREFIX}_bugfix=\$((NUMBERS + 0));" +} + +split_version req "$1" + +shift + +for candidate; do + + # Try to locate the candidate. Discard it if not located. + tool=$(which "${candidate}" 2>/dev/null) + [ -n "${tool}" ] || continue + + split_version cur "$("${tool}" --version)" + + [ -n "${cur_major}" -a "${cur_major}" -ge "${req_major}" ] || continue + [ "${cur_major}" -gt "${req_major}" ] || [ "${cur_minor}" -ge "${req_minor}" ] || continue + [ "${cur_minor}" -gt "${req_minor}" ] || [ "${cur_bugfix}" -ge "${req_bugfix}" ] || continue + + echo "${tool}" + exit +done + +# echo nothing: no suitable tool found +exit 1