From patchwork Wed Apr 29 14:07:29 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Charlie Turner X-Patchwork-Id: 1279420 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.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=igalia.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=igalia.com header.i=@igalia.com header.a=rsa-sha256 header.s=20170329 header.b=VqZpuJ07; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49C0jD6fYtz9sSl for ; Thu, 30 Apr 2020 00:08:16 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 9D61787A05; Wed, 29 Apr 2020 14:08:14 +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 XCxWB7hB1sv2; Wed, 29 Apr 2020 14:08:13 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 52A17879C2; Wed, 29 Apr 2020 14:08:13 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id D27F31BF3A8 for ; Wed, 29 Apr 2020 14:08:11 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id CD33D88476 for ; Wed, 29 Apr 2020 14:08:11 +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 yjw70s3sUb5i for ; Wed, 29 Apr 2020 14:08:10 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from fanzine.igalia.com (fanzine.igalia.com [178.60.130.6]) by hemlock.osuosl.org (Postfix) with ESMTPS id 76B3C88453 for ; Wed, 29 Apr 2020 14:08:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=p/rhHpB29rHh3cgGHD2Xczkpdvt0NDeRTelWO+Koa/I=; b=VqZpuJ07N8RirSww6IH7DAWJqAPureQnge3vMV8LG9tX8ImzCDwOF/xrrbQYL5XC2G8/Mrhr5FUFuid+MKw25mxNOyVIS+TnrxTWGZmHRww2+RWXAhCeRQFqICTxw92kHMILNAaqkgtGIBCYTOx3wRhZ+9f+l77PArhsIHB/JAQfI1d+zMRmVhfYBYRBFipom0mXt5y0789uDKNeFrWwbvBH545Zyq4/IWocbEcF2u8WYcqumQt5H2d+6PdIk273YYCrdvVQHZLua6dqVtyMRFoT9apYycXHIMaieJAIqFEniQphAlTVIYCNHSBUtp10xprHdCa29hwWroyhAQePqg==; Received: from 79-72-51-95.dynamic.dsl.as9105.com ([79.72.51.95] helo=deimos.home) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim) id 1jTnNf-0004GG-Dz; Wed, 29 Apr 2020 16:08:07 +0200 From: Charlie Turner To: buildroot@buildroot.org Date: Wed, 29 Apr 2020 15:07:29 +0100 Message-Id: <20200429140729.3325-2-cturner@igalia.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200429140729.3325-1-cturner@igalia.com> References: <20200429140729.3325-1-cturner@igalia.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH 1/1] [RFC] add support for icecc 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: Thomas De Schampheleire , Romain Naour , yann.morin.1998@free.fr, thomas.petazzoni@bootlin.com, Charlie Turner Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Signed-off-by: Charlie Turner --- Config.in | 9 +++++++++ Makefile | 2 ++ toolchain/toolchain-wrapper.c | 26 ++++++++++++++++++++++++++ toolchain/toolchain-wrapper.mk | 4 ++++ 4 files changed, 41 insertions(+) diff --git a/Config.in b/Config.in index 48fd36ff98..bda65e8daf 100644 --- a/Config.in +++ b/Config.in @@ -367,6 +367,15 @@ config BR2_CCACHE_USE_BASEDIR endif +config BR2_ICECC + bool "Enable distributed compilation" + help + Write a nice explanation. + +if BR2_ICECC + +endif + config BR2_ENABLE_DEBUG bool "build packages with debugging symbols" help diff --git a/Makefile b/Makefile index ae29b042ec..30000b2390 100644 --- a/Makefile +++ b/Makefile @@ -472,6 +472,8 @@ BR_PATH = "$(HOST_DIR)/bin:$(HOST_DIR)/sbin:$(PATH)" # should not be used as the root filesystem. TARGET_DIR_WARNING_FILE = $(TARGET_DIR)/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM +# FIXME: Add the appropriate stuff for BR2_ICECC for accelerated host +# builds? ifeq ($(BR2_CCACHE),y) CCACHE = $(HOST_DIR)/bin/ccache BR_CACHE_DIR ?= $(call qstrip,$(BR2_CCACHE_DIR)) diff --git a/toolchain/toolchain-wrapper.c b/toolchain/toolchain-wrapper.c index 8cfc963ccd..3e6c9c2603 100644 --- a/toolchain/toolchain-wrapper.c +++ b/toolchain/toolchain-wrapper.c @@ -28,6 +28,9 @@ #ifdef BR_CCACHE static char ccache_path[PATH_MAX]; #endif +#ifdef BR_ICECC +static char icecc_path[PATH_MAX]; +#endif static char path[PATH_MAX]; static char sysroot[PATH_MAX]; /* As would be defined by gcc: @@ -59,6 +62,13 @@ static char _date_[sizeof("-D__DATE__=\"MMM DD YYYY\"")]; static char *predef_args[] = { #ifdef BR_CCACHE ccache_path, +#endif +#if defined(BR_ICECC) && !defined(BR_CCACHE) +/* When icecc and ccache are used together, ccache is used as the + * wrapper, which then rewraps with icecc via the CCACHE_PREFIX + * environment variable, see below. + */ + icecc_path, #endif path, "--sysroot", sysroot, @@ -312,6 +322,15 @@ int main(int argc, char **argv) return 3; } #endif + +#ifdef BR_ICECC + /* FIXME: hardcoding. Copy how ccache is installed in the abspath in output/host? */ + ret = snprintf(icecc_path, sizeof(icecc_path), "/home/cht/local/bin/icecc"); + if (ret >= sizeof(icecc_path)) { + perror(__FILE__ ": overflow"); + return 3; + } +#endif ret = snprintf(sysroot, sizeof(sysroot), "%s/" BR_SYSROOT, absbasedir); if (ret >= sizeof(sysroot)) { perror(__FILE__ ": overflow"); @@ -532,6 +551,13 @@ int main(int argc, char **argv) } #endif +#if defined(BR_CCACHE) && defined(BR_ICECC) + if (setenv("CCACHE_PREFIX", icecc_path, 0)) { + perror(__FILE__ ": Failed to set CCACHE_PREFIX"); + return 3; + } +#endif + if (execv(exec_args[0], exec_args)) perror(path); diff --git a/toolchain/toolchain-wrapper.mk b/toolchain/toolchain-wrapper.mk index 09dda17890..1a8532208c 100644 --- a/toolchain/toolchain-wrapper.mk +++ b/toolchain/toolchain-wrapper.mk @@ -39,6 +39,10 @@ ifeq ($(BR2_CCACHE),y) TOOLCHAIN_WRAPPER_ARGS += -DBR_CCACHE endif +ifeq ($(BR2_ICECC),y) +TOOLCHAIN_WRAPPER_ARGS += -DBR_ICECC +endif + ifeq ($(BR2_x86_x1000),y) TOOLCHAIN_WRAPPER_ARGS += -DBR_OMIT_LOCK_PREFIX endif