From patchwork Fri May 11 20:50:34 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anisse Astier X-Patchwork-Id: 912205 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=none (p=none dis=none) header.from=astier.eu Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=astier-eu.20150623.gappssmtp.com header.i=@astier-eu.20150623.gappssmtp.com header.b="FEUVh5dH"; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40jMhc0ZzZz9s28 for ; Sat, 12 May 2018 06:51:44 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 9212384C36; Fri, 11 May 2018 20:51:42 +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 VWmfxD_0nS-F; Fri, 11 May 2018 20:51:42 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id ED6E7854C1; Fri, 11 May 2018 20:51:41 +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 3EFCE1CEF80 for ; Fri, 11 May 2018 20:51:39 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 3C3C2854C1 for ; Fri, 11 May 2018 20:51:39 +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 xU2wnXHG4eam for ; Fri, 11 May 2018 20:51:37 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm0-f66.google.com (mail-wm0-f66.google.com [74.125.82.66]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 9309284C58 for ; Fri, 11 May 2018 20:51:06 +0000 (UTC) Received: by mail-wm0-f66.google.com with SMTP id t11-v6so4502942wmt.0 for ; Fri, 11 May 2018 13:51:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=astier-eu.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=4Ji7SNOJ34lRb/qdr1PmqokNESxevdflLXt3ZBWeHoQ=; b=FEUVh5dHEcLNTWzvL2lBiWPGJQiZElzIjIZbBAEObu6UXumolFBhkkkocokzJyGZ19 b6JpUVvlQw/LIuxnKwOgChzewZ/XzOH+xEMHV/LoYRSFVjzaH0KhCbz+/SCogbDO3BdR 563WXTfmz2QK3K1/+76wKjt1D/BM5ptyt/1v+nocUQLVqtOL9B1hhys8DVw5+qEZofbW AHXJqY3lx3IYLef3WbhIuqyBmOj3QHXyeHEMuj/uWOjfjC7ir+TLBzGNCOZetm1HEnFh IcYDh1aD1cWReI3X/Xn6evHuDAMz0X/TYzPABVsTLyW/o8Jm0+UJBaQf9PrSXtXEM7mT 0kkA== 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; bh=4Ji7SNOJ34lRb/qdr1PmqokNESxevdflLXt3ZBWeHoQ=; b=riNvOGjCrN+jlDOpbMgVQ9XNmlV5Wf6KnU6u5AmKJk2EQ2Nde76kSNvrIAEkI10MNj X1YzucVIATy3BjlpDyIYTKNc/DT3O+igYI8/FrWPol5Bgz67SZYOEaitYoyGGL2TwA5W mbU+/Che+0XvwAd7bVbANExoJZCFdLiR+HoU328FUifGnR/enGXrHF7c4E1bV9Z0noof TNz30zysY6M+m4D4w7D36jr4oJV1fwqAxqwp2zvEwNXtAfztd4BaaT0x7CISNnnHN9w/ fNOcwN1AzZFMAoq9dCAJIHxt9SrCHl2X5h2rkUWb/hSfcYI417JFa06hfRGsm1h1pquU zn7Q== X-Gm-Message-State: ALKqPwf07Hs6Uda64B636Vd1PsXfoO2OfslUPDCI49dfWvvRbknocOf9 lvu7lCoPtYPUcEgAefLXifKowB9Tns4= X-Google-Smtp-Source: AB8JxZqYIdOwMGt/uhAbWxIi2letiMhfeiUxOVWLrIiqkIlP0JdatOP0zvPglYSFGQSx6FAv7fAtYg== X-Received: by 2002:a1c:2084:: with SMTP id g126-v6mr3138078wmg.52.1526071864607; Fri, 11 May 2018 13:51:04 -0700 (PDT) Received: from localhost.localdomain ([2a01:e34:ef92:b70:7ee9:d3ff:fef0:777c]) by smtp.gmail.com with ESMTPSA id 135-v6sm2115551wmx.21.2018.05.11.13.51.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 11 May 2018 13:51:03 -0700 (PDT) From: Anisse Astier To: buildroot@buildroot.org Date: Fri, 11 May 2018 22:50:34 +0200 Message-Id: <20180511205037.10078-3-anisse@astier.eu> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180511205037.10078-1-anisse@astier.eu> References: <20180511205037.10078-1-anisse@astier.eu> Subject: [Buildroot] [PATCH v2 2/5] go: cleanup cross-compilation support X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.24 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Geoff Levand , Thomas Petazzoni , Anisse Astier MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Now that we fixed cross-compilation in the go package, cleanup the build to remove the workaround added in 60c5c96ae109dcea48e0997b5e6e6645ac9b86 "package/go: Build host tools with host CC". We only need a single pass to build the go toolchain. Signed-off-by: Anisse Astier --- package/go/go.mk | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/package/go/go.mk b/package/go/go.mk index 6af58f04be..b70c5d49d8 100644 --- a/package/go/go.mk +++ b/package/go/go.mk @@ -58,13 +58,7 @@ else HOST_GO_CGO_ENABLED = 0 endif -# The go build system doesn't have the notion of cross compiling, but just the -# notion of architecture. When the host and target architectures are different -# it expects to be given a target cross compiler in CC_FOR_TARGET. When the -# architectures are the same it will use CC_FOR_TARGET for both host and target -# compilation. To work around this limitation build and install a set of -# compiler and tool binaries built with CC_FOR_TARGET set to the host compiler. -# Also, the go build system is not compatible with ccache, so use +# The go build system is not compatible with ccache, so use # HOSTCC_NOCCACHE. See https://github.com/golang/go/issues/11685. HOST_GO_MAKE_ENV = \ GOROOT_BOOTSTRAP=$(HOST_GO_BOOTSTRAP_ROOT) \ @@ -82,25 +76,14 @@ HOST_GO_TARGET_CC = \ CC_FOR_TARGET="$(TARGET_CC)" \ CXX_FOR_TARGET="$(TARGET_CXX)" -HOST_GO_HOST_CC = \ - CC_FOR_TARGET=$(HOSTCC_NOCCACHE) \ - CXX_FOR_TARGET=$(HOSTCXX_NOCCACHE) - -HOST_GO_TMP = $(@D)/host-go-tmp - define HOST_GO_BUILD_CMDS - cd $(@D)/src && \ - $(HOST_GO_MAKE_ENV) $(HOST_GO_HOST_CC) CGO_ENABLED=0 ./make.bash - mkdir -p $(HOST_GO_TMP) - mv $(@D)/pkg/tool $(HOST_GO_TMP)/ - mv $(@D)/bin/ $(HOST_GO_TMP)/ cd $(@D)/src && \ $(HOST_GO_MAKE_ENV) $(HOST_GO_TARGET_CC) CGO_ENABLED=$(HOST_GO_CGO_ENABLED) ./make.bash endef define HOST_GO_INSTALL_CMDS - $(INSTALL) -D -m 0755 $(HOST_GO_TMP)/bin/go $(HOST_GO_ROOT)/bin/go - $(INSTALL) -D -m 0755 $(HOST_GO_TMP)/bin/gofmt $(HOST_GO_ROOT)/bin/gofmt + $(INSTALL) -D -m 0755 $(@D)/bin/go $(HOST_GO_ROOT)/bin/go + $(INSTALL) -D -m 0755 $(@D)/bin/gofmt $(HOST_GO_ROOT)/bin/gofmt ln -sf ../lib/go/bin/go $(HOST_DIR)/bin/ ln -sf ../lib/go/bin/gofmt $(HOST_DIR)/bin/ @@ -109,7 +92,7 @@ define HOST_GO_INSTALL_CMDS mkdir -p $(HOST_GO_ROOT)/pkg cp -a $(@D)/pkg/include $(@D)/pkg/linux_* $(HOST_GO_ROOT)/pkg/ - cp -a $(HOST_GO_TMP)/tool $(HOST_GO_ROOT)/pkg/ + cp -a $(@D)/pkg/tool $(HOST_GO_ROOT)/pkg/ # There is a known issue which requires the go sources to be installed # https://golang.org/issue/2775 @@ -117,7 +100,7 @@ define HOST_GO_INSTALL_CMDS # Set all file timestamps to prevent the go compiler from rebuilding any # built in packages when programs are built. - find $(HOST_GO_ROOT) -type f -exec touch -r $(HOST_GO_TMP)/bin/go {} \; + find $(HOST_GO_ROOT) -type f -exec touch -r $(@D)/bin/go {} \; endef $(eval $(host-generic-package))