From patchwork Wed Apr 17 20:46:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vadym Kochan X-Patchwork-Id: 1087197 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.136; helo=silver.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="sgcCjlN/"; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44kvCf3TWZz9s4Y for ; Thu, 18 Apr 2019 06:36:29 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 6D622214F6; Wed, 17 Apr 2019 20:36:27 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id DqmNxsurN90p; Wed, 17 Apr 2019 20:36:24 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id CF7AD2280D; Wed, 17 Apr 2019 20:36:24 +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 CB0D91BF405 for ; Wed, 17 Apr 2019 20:36:23 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id C627986073 for ; Wed, 17 Apr 2019 20:36:23 +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 8ZsrPm5nt6Kl for ; Wed, 17 Apr 2019 20:36:23 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-lj1-f193.google.com (mail-lj1-f193.google.com [209.85.208.193]) by fraxinus.osuosl.org (Postfix) with ESMTPS id D2229851FB for ; Wed, 17 Apr 2019 20:36:22 +0000 (UTC) Received: by mail-lj1-f193.google.com with SMTP id r24so23759799ljg.3 for ; Wed, 17 Apr 2019 13:36:22 -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; bh=TaAx2rEriWl8Nmo+ZIR8tzEOhkxLdwR/kqUrU+tyFuM=; b=sgcCjlN/QCSTUSgZ2Ua74eppSL05wp1Y2ykvHqp/OEMrJbILfsAE78LF+vqHG7aUdE BSFrPZNAu5M1nDMaTUEmh7I+zeoR+DzGShepGAB9etmEY2vIiJPAgXGYTXk41bxZyKZ2 hlNrLEzTrJ4VyazbbK9kO9E9vkj6uULv/DPhoobWIH2RvThX2cPpULAtJ+PLaSK9yRMA FgFPwhVxHBPhpbhK8tRr8deUMu/HEgJIThFwCeVg88U9arzK8eviOmcdZfDv2v2kwxw+ YurjOE/fzo11zKCfk+FtAUsPR2ZHkat7j3AL5qOhIalxXTlP6ckf8yxqphr0QYpu91X4 uM1Q== 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; bh=TaAx2rEriWl8Nmo+ZIR8tzEOhkxLdwR/kqUrU+tyFuM=; b=S/mIp4mIDk1HrqSqRbs66O5GvNGAaaYfRwWZZss06CaqnjhYE88ZbrrO7q7yvBZG6d OIuRMUok74NbQS+GPrNyG12sT84sB86uhep9fWbdnK+49+/O844vFd2KdK3iP76LZjmc XU8PWTHnzySYn6xgkfr9lN1R54xC8o2snhzUmgcsct8idiQ0ORLzE8gKCGXPBkkw54Kn 6MPCNcaTq+j4Dm3/TRQ4Z5R3fLRGZGpWrZhMAdlpgVaCSFhuuJUn67x7GVvpc2TRLAU3 Yhjx6+fQZngA/8ARhRV9EQChNTgDxccWoQ6TDtzIumrWygAubUDtKUrNEsAu6zJT+CDa V4ZA== X-Gm-Message-State: APjAAAWtCA+HrA4Y+vOsRKw8gz1KsFQIFbknisHoybiXuHQRIkRMXlob phwJ5z8B+65lB/+hf0W0Kw3nOlCL X-Google-Smtp-Source: APXvYqxxRuwVavxR7m9W/8w60ciz78Ay4B3uNICzMBjtgTc94nluqsI32E4hxGNfq+Yjv7rCPCWX6A== X-Received: by 2002:a2e:7805:: with SMTP id t5mr47768830ljc.106.1555533380647; Wed, 17 Apr 2019 13:36:20 -0700 (PDT) Received: from vkochan-ThinkPad-T470p.lan ([93.75.250.209]) by smtp.gmail.com with ESMTPSA id r3sm11211527ljr.7.2019.04.17.13.36.19 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Apr 2019 13:36:19 -0700 (PDT) From: Vadim Kochan To: buildroot@buildroot.org Date: Wed, 17 Apr 2019 23:46:30 +0300 Message-Id: <20190417204630.18746-1-vadim4j@gmail.com> X-Mailer: git-send-email 2.14.1 Subject: [Buildroot] [RFC 1/1] br2-external: Alow to include toolchain from external tree 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: Vadim Kochan , Thomas De Schampheleire , Thomas Petazzoni , "Yann E . MORIN" MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Add possibility to select toolchain from br2-external tree which allows to easy use custom external toolchains by selecting them via menuconfig as if they were integrated into buildroot. The br2-external tree should contain: ${br2-external}/external-toolchain/Config.in file to be included into external toolchains list. All such picked toolchains are sourced in: toolchain/toolchain-external/Config.in from auto-generated file ${O}/build/.br2-external.in.toolchain. Added new '-t' option in support/scripts/br2-external to generate kconfig for the found toolchains from the all specified external trees. Signed-off-by: Vadim Kochan --- This is just PoC to rise the discussion about this concept. Makefile | 6 +++++- support/scripts/br2-external | 36 ++++++++++++++++++++++++++++++++-- toolchain/toolchain-external/Config.in | 2 ++ 3 files changed, 41 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 522c0b0606..4eceb88813 100644 --- a/Makefile +++ b/Makefile @@ -938,7 +938,7 @@ HOSTCFLAGS = $(CFLAGS_FOR_BUILD) export HOSTCFLAGS .PHONY: prepare-kconfig -prepare-kconfig: outputmakefile $(BUILD_DIR)/.br2-external.in +prepare-kconfig: outputmakefile $(BUILD_DIR)/.br2-external.in $(BUILD_DIR)/.br2-external.in.toolchain $(BUILD_DIR)/buildroot-config/%onf: mkdir -p $(@D)/lxdialog @@ -1042,6 +1042,10 @@ endif $(BUILD_DIR)/.br2-external.in: $(BUILD_DIR) $(Q)support/scripts/br2-external -k -o "$(@)" $(BR2_EXTERNAL) +.PHONY: $(BUILD_DIR)/.br2-external.in.toolchain +$(BUILD_DIR)/.br2-external.in.toolchain: $(BUILD_DIR) + $(Q)support/scripts/br2-external -t -o "$(@)" $(BR2_EXTERNAL) + # printvars prints all the variables currently defined in our # Makefiles. Alternatively, if a non-empty VARS variable is passed, # only the variables matching the make pattern passed in VARS are diff --git a/support/scripts/br2-external b/support/scripts/br2-external index 00cb57d1ed..3ec332d93e 100755 --- a/support/scripts/br2-external +++ b/support/scripts/br2-external @@ -16,10 +16,11 @@ main() { local OPT OPTARG local br2_ext ofile ofmt - while getopts :hkmo: OPT; do + while getopts :htkmo: OPT; do case "${OPT}" in h) help; exit 0;; o) ofile="${OPTARG}";; + t) ofmt="toolchain";; k) ofmt="kconfig";; m) ofmt="mk";; :) error "option '%s' expects a mandatory argument\n" "${OPTARG}";; @@ -30,7 +31,7 @@ main() { shift $((OPTIND-1)) case "${ofmt}" in - mk|kconfig) + mk|kconfig|toolchain) ;; *) error "no output format specified (-m/-k)\n";; esac @@ -188,6 +189,37 @@ do_kconfig() { printf "endmenu # User-provided options\n" } +# Generate the toolchain kconfig snippet for the br2-external tree. +do_toolchain() { + local br2_name br2_ext + + printf '#\n# Automatically generated file; DO NOT EDIT.\n#\n' + printf '\n' + + if [ ${#BR2_EXT_NAMES[@]} -eq 0 ]; then + printf '# No br2-external tree defined.\n' + return + fi + + for br2_name in "${BR2_EXT_NAMES[@]}"; do + eval br2_desc="\"\${BR2_EXT_DESCS_${br2_name}}\"" + eval br2_ext="\"\${BR2_EXT_PATHS_${br2_name}}\"" + + if [ ! -f "${br2_ext}/toolchain-external/Config.in" ]; then + continue + fi + + # we have to duplicate it here too because otherwise BR2_EXTERNAL_* + # is not evaluated in Config.in + printf 'config BR2_EXTERNAL_%s_PATH\n' "${br2_name}" + printf '\tstring\n' + printf '\tdefault "%s"\n' "${br2_ext}" + + printf 'source "%s/toolchain-external/Config.in"\n' "${br2_ext}" + printf '\n' + done +} + help() { cat <<-_EOF_ Usage: diff --git a/toolchain/toolchain-external/Config.in b/toolchain/toolchain-external/Config.in index d234c1c552..70e8a89e5e 100644 --- a/toolchain/toolchain-external/Config.in +++ b/toolchain/toolchain-external/Config.in @@ -50,6 +50,8 @@ source "toolchain/toolchain-external/toolchain-external-codesourcery-amd64/Confi # architecture. source "toolchain/toolchain-external/toolchain-external-custom/Config.in" +source "$BR2_BUILD_DIR/.br2-external.in.toolchain" + endchoice choice