From patchwork Fri May 3 13:18:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Norbert Lange X-Patchwork-Id: 1094888 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.133; helo=hemlock.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="gAftKp/Z"; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44wXlv1fC5z9sBb for ; Fri, 3 May 2019 23:19:22 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id BE41488058; Fri, 3 May 2019 13:19:18 +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 iBIkZOtbeDfJ; Fri, 3 May 2019 13:19:15 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 8228487FB9; Fri, 3 May 2019 13:19:15 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 6227E1BF391 for ; Fri, 3 May 2019 13:19:14 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 5D96285F53 for ; Fri, 3 May 2019 13:19:14 +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 tzXIziwOkH3j for ; Fri, 3 May 2019 13:19:13 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f50.google.com (mail-wr1-f50.google.com [209.85.221.50]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 628A785EA5 for ; Fri, 3 May 2019 13:19:13 +0000 (UTC) Received: by mail-wr1-f50.google.com with SMTP id k16so7869287wrn.5 for ; Fri, 03 May 2019 06:19:13 -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:mime-version :content-transfer-encoding; bh=KDbzaE4S95xHsxqk5sqzuZB/wHHpePHsB5wglPHsiWg=; b=gAftKp/Zm9IH7hjECGebfEySJv+mt6q/LV87DYzFBKf4PJP+LYzBZ+x/huflbNcAUQ ZVEf7dh9nq4ROezzRdutSrWCIZboZIprKjspcOqMM4hMSFFD/FJFn7sFi31LU2fr7j+v kSxbaSmR53cV1WsJpZcCIf43MteD7MWWEL8pQK1Ny0oVWh1Q+umR6Acv3A603eNBZwZj ixmIftyboTWyEqUGDnOxwH9QLJcuqK2sGnlLUB+ZbeS6IxrMGcAlM50iXVKXP8LLaf1K G8pviACw/dw2vpu4P5BcNBD/wRx0VJlExgxcgmoTCSL82jc1KgHyYkv/ckNcmKbe6wbG BedA== 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:mime-version :content-transfer-encoding; bh=KDbzaE4S95xHsxqk5sqzuZB/wHHpePHsB5wglPHsiWg=; b=kkX+Ui+S1iBZ36AFa7oN21wubdES6eYamY2xvv0TWBwlQP8A4o3nyhopeXRX1+ALXf 5A0t+wsxIOqrCgKPI3FMwQfOEA1MqgmOty/osks6YooYWMXwh56/UNSpJ2prlVhPW9Fy xIeKD4oB2gtekJJj7MFBH7FVLwEWMcRhpg7d4XF9XJQmzVOrj8wrWyPnDkBWlCOFjxcf HJeQ6eQb6jbwTRlyFmDmYOr3SN3kN24hhU+JNdQ+m9f4udzq8ZOfL4nykzwpSKkfHk2S yNEyajZJwWqolfpO8oBX3Ikc/HRCzcnCQcBuiARKGZgAz8DVs6Ovzpj76m+8o8b4n7AW geow== X-Gm-Message-State: APjAAAXXI8BC5uLij3lDdhsDGoOrlDSfvqKvv5Jm2rk9kyR1B5NXPFDb PCnUJBaR3Gmp3oepnl7EQ7shxNWE X-Google-Smtp-Source: APXvYqxsuLm3cDL3ZSBTixN1XZ/ozh2JWlS2X/vEXINgQngeQ0xrVFvQfGbqW2rMoBvKtxmjFgAgiA== X-Received: by 2002:a05:6000:1184:: with SMTP id g4mr5656820wrx.70.1556889551748; Fri, 03 May 2019 06:19:11 -0700 (PDT) Received: from lano-work.andritz.com ([80.120.136.76]) by smtp.gmail.com with ESMTPSA id z6sm2264004wrw.87.2019.05.03.06.19.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 May 2019 06:19:10 -0700 (PDT) From: Norbert Lange X-Google-Original-From: Norbert Lange To: buildroot@buildroot.org Date: Fri, 3 May 2019 15:18:50 +0200 Message-Id: <20190503131851.12315-1-norbert.lange@andritz.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Subject: [Buildroot] [PATCH 1/2] allow build infrastructure to pick up installed meson 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: Norbert Lange Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Norbert Lange Automatically check for an available meson tool, and use it aslond the version is fitting. Some concerns are about being able to figure out the correct version for all available packages in buildroot. The min version could be set to version 1.0 to postpone the problem, but still have the infrastructure in place to allow users to override the version. Currently host-ninja will still be always built. Signed-off-by: Norbert Lange --- package/meson/meson.mk | 1 - package/pkg-meson.mk | 4 +-- support/dependencies/check-host-meson.mk | 16 +++++++++ support/dependencies/check-host-meson.sh | 45 ++++++++++++++++++++++++ 4 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 support/dependencies/check-host-meson.mk create mode 100755 support/dependencies/check-host-meson.sh -- 2.20.1 diff --git a/package/meson/meson.mk b/package/meson/meson.mk index cf62b0ddde..2ce7a26ab5 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 HOST_MESON_TARGET_ENDIAN = $(call LOWERCASE,$(BR2_ENDIAN)) diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk index 7f1838c09a..25e9bb814e 100644 --- a/package/pkg-meson.mk +++ b/package/pkg-meson.mk @@ -25,7 +25,7 @@ # $(HOST_DIR)/bin/python3 will not look for Meson modules in # $HOME/.local/lib/python3.x/site-packages # -MESON = PYTHONNOUSERSITE=y $(HOST_DIR)/bin/meson +MESON = PYTHONNOUSERSITE=y $(BR2_MESON) NINJA = PYTHONNOUSERSITE=y $(HOST_DIR)/bin/ninja NINJA_OPTS = $(if $(VERBOSE),-v) -j$(PARALLEL_JOBS) @@ -105,7 +105,7 @@ endef endif endif -$(2)_DEPENDENCIES += host-meson +$(2)_DEPENDENCIES += $(BR2_MESON_HOST_DEPENDENCY) # # Build step. Only define it if not already defined by the package .mk diff --git a/support/dependencies/check-host-meson.mk b/support/dependencies/check-host-meson.mk new file mode 100644 index 0000000000..6c779b3e6d --- /dev/null +++ b/support/dependencies/check-host-meson.mk @@ -0,0 +1,16 @@ +# Set this to either 0.49 or higher, depending on the highest minimum +# version required by any of the packages bundled in Buildroot. If a +# package is bumped or a new one added, and it requires a higher +# version, our meson infra will catch it and build its own. +# +BR2_MESON_VERSION_MIN = 0.49 + +BR2_MESON_CANDIDATES ?= meson +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 +else +BR2_MESON_HOST_DEPENDENCY = host-ninja +endif diff --git a/support/dependencies/check-host-meson.sh b/support/dependencies/check-host-meson.sh new file mode 100755 index 0000000000..805fac9349 --- /dev/null +++ b/support/dependencies/check-host-meson.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +# prevent shift error +[ $# -lt 2 ] && 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. + meson=$(which "${candidate}" 2>/dev/null) + [ -n "${meson}" ] || continue + + split_version cur "$("${meson}" --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 "${meson}" + exit +done + +# echo nothing: no suitable meson found +exit 1 From patchwork Fri May 3 13:18:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Norbert Lange X-Patchwork-Id: 1094887 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) 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="MbvSnSZr"; 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 44wXlr6CNKz9sBb for ; Fri, 3 May 2019 23:19:18 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 1477E85F87; Fri, 3 May 2019 13:19:17 +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 D_8Xahxlg_ox; Fri, 3 May 2019 13:19:16 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 5437785F53; Fri, 3 May 2019 13:19:16 +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 327C41BF391 for ; Fri, 3 May 2019 13:19:15 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 2F6B386FEA for ; Fri, 3 May 2019 13:19:15 +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 voQOh0WsLqen for ; Fri, 3 May 2019 13:19:14 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com [209.85.221.43]) by whitealder.osuosl.org (Postfix) with ESMTPS id 5789E86EAC for ; Fri, 3 May 2019 13:19:14 +0000 (UTC) Received: by mail-wr1-f43.google.com with SMTP id c12so7858437wrt.8 for ; Fri, 03 May 2019 06:19:14 -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=j8F1t5AM28gUerTCTu26beRzt2sjvBcE1mEg3HgOYv8=; b=MbvSnSZryJNCSeXPOQV27ZeQEPhMrsshbMS2gkSx2+729uIJnOyMgg+cOOHMj8c7hQ FEud+lC42gMZnxq8D80RigySOdXjFGaM3GcAq4eXDsBsfKeN/u7e/h+qk7bAB44shiAy V8AbUBkOW7zKV1TFm94GosNl/zohWJwSLi5DVi72RZDXwo0umojGkivCIJW0rS/5+oY+ p8g14QJeEHCO8ImLcv0qhI4Aq/zlDLkpgsG6H4UTDj15tMYDC3VUnNX3POzaCzWf2KQz Jpl0OdUauEj+3+TWWvkmP3b46UY4d2+j16sxCpqKN9HTkwaxcLRAVpThYV6858/mn/II yS+Q== 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=j8F1t5AM28gUerTCTu26beRzt2sjvBcE1mEg3HgOYv8=; b=DF0XTF6bDuzELEPWafJES6GSclzU9ll6qFjT+LDHCYUeEPNybLW/QkXE6615mk4UZ7 a0PRdInJyH/UrhL00z9DkBY9p0jAmwVUsP+oorsqSUKJmvWa+HD3jrXiCDy+dAGeLJWS UzMMxGCRYXhEaOyA7hQBlXSyPjs1tYxesztcRsnbFJ+yFW734XroycjhfjvZGAgbACIj 9t805Khe1zEA8Ij/a0308KFMx/wBLYoTpZMV7gDjpbW+ehs0WCXGHxgHZhWCukaLXciS ax1xQsvy1FC/YtQlH582uRngjWr7lKTcky8KYG0KplXL4ZjhF1ad0i0Gr4OyYJJT8ByQ K1Mg== X-Gm-Message-State: APjAAAVRLqj2fpsec4vRsLfY5Zu2DFBxUZuU3H+eL5qoXz4PiVlBU8c7 2rUvW0WA01NYcBXVSqMKzBZnBPW9 X-Google-Smtp-Source: APXvYqzoHJWm76tvQfY8X2+W3NgA4JE2q1pQVs/E5hjk0koEQyGb7sFK0yJ3JvSgPvaKCo3sktkOug== X-Received: by 2002:adf:eb02:: with SMTP id s2mr6912953wrn.29.1556889552647; Fri, 03 May 2019 06:19:12 -0700 (PDT) Received: from lano-work.andritz.com ([80.120.136.76]) by smtp.gmail.com with ESMTPSA id z6sm2264004wrw.87.2019.05.03.06.19.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 May 2019 06:19:12 -0700 (PDT) From: Norbert Lange X-Google-Original-From: Norbert Lange To: buildroot@buildroot.org Date: Fri, 3 May 2019 15:18:51 +0200 Message-Id: <20190503131851.12315-2-norbert.lange@andritz.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190503131851.12315-1-norbert.lange@andritz.com> References: <20190503131851.12315-1-norbert.lange@andritz.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH 2/2] allow 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: Norbert Lange Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Norbert Lange If a fitting ninja tool is detected it will be used, otherwise the tool will be built from source. Replace the fixed dependencies to host-ninja, notably from the meson infrastructure. Signed-off-by: Norbert Lange --- package/pkg-meson.mk | 2 +- support/dependencies/check-host-meson.mk | 4 +-- support/dependencies/check-host-ninja.mk | 14 ++++++++ support/dependencies/check-host-ninja.sh | 45 ++++++++++++++++++++++++ 4 files changed, 62 insertions(+), 3 deletions(-) create mode 100644 support/dependencies/check-host-ninja.mk create mode 100755 support/dependencies/check-host-ninja.sh -- 2.20.1 diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk index 25e9bb814e..c4cf682ee8 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 6c779b3e6d..36fc9129d1 100644 --- a/support/dependencies/check-host-meson.mk +++ b/support/dependencies/check-host-meson.mk @@ -10,7 +10,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..6d89255ee5 --- /dev/null +++ b/support/dependencies/check-host-ninja.mk @@ -0,0 +1,14 @@ +# Set this to either 1.8.2 or higher, depending on the highest minimum +# version required by any of the packages bundled in Buildroot. If a +# package is bumped or a new one added, and it requires a higher +# version, our ninja infra will catch it and build its own. +# +BR2_NINJA_VERSION_MIN = 1.8.0 + +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..7f531da98e --- /dev/null +++ b/support/dependencies/check-host-ninja.sh @@ -0,0 +1,45 @@ +#!/bin/sh + +# prevent shift error +[ $# -lt 2 ] && 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. + ninja=$(which "${candidate}" 2>/dev/null) + [ -n "${ninja}" ] || continue + + split_version cur "$("${ninja}" --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 "${ninja}" + exit +done + +# echo nothing: no suitable ninja found +exit 1