From patchwork Mon Jun 10 15:40:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Athaariq Ardhiansyah X-Patchwork-Id: 1945940 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=140.211.166.137; helo=smtp4.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=patchwork.ozlabs.org) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Vybdd3H48z20V0 for ; Tue, 11 Jun 2024 01:41:57 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id 0AC61402BC; Mon, 10 Jun 2024 15:41:54 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id GXerxnxqASSF; Mon, 10 Jun 2024 15:41:53 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org EB8C0404C6 Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp4.osuosl.org (Postfix) with ESMTP id EB8C0404C6; Mon, 10 Jun 2024 15:41:52 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id BCD861BF3BE for ; Mon, 10 Jun 2024 15:41:51 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id A9969404C6 for ; Mon, 10 Jun 2024 15:41:51 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id qtuzZB_iboh4 for ; Mon, 10 Jun 2024 15:41:51 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=117.53.144.211; helo=mail.athaariq.my.id; envelope-from=foss@athaariq.my.id; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org BF30C402BC DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org BF30C402BC Received: from mail.athaariq.my.id (unknown [117.53.144.211]) by smtp4.osuosl.org (Postfix) with ESMTP id BF30C402BC for ; Mon, 10 Jun 2024 15:41:50 +0000 (UTC) Received: from localhost.localdomain (unknown [192.168.100.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by mail.athaariq.my.id (Postfix) with ESMTPSA id A491E4305B; Mon, 10 Jun 2024 15:41:34 +0000 (UTC) From: Athaariq Ardhiansyah To: buildroot@buildroot.org Date: Mon, 10 Jun 2024 22:40:22 +0700 Message-ID: <20240610154028.792440-1-foss@athaariq.my.id> X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=none dis=none) header.from=athaariq.my.id Subject: [Buildroot] [PATCH 1/3] package/go: expose option to enable via configurator X-BeenThere: buildroot@buildroot.org 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: Athaariq Ardhiansyah , Anisse Astier , Christian Stewart , Thomas Perale Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" Just in case you forgot it, I re-exposed the configuration option for enabling host-go virtual package before I'm adding host-go-bin subpackage. Signed-off-by: Athaariq Ardhiansyah --- package/go/Config.in.host | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/go/Config.in.host b/package/go/Config.in.host index 483393f8e4..32483871e7 100644 --- a/package/go/Config.in.host +++ b/package/go/Config.in.host @@ -34,7 +34,7 @@ config BR2_PACKAGE_HOST_GO_HOST_ARCH_SUPPORTS # Go packages should select BR2_PACKAGE_HOST_GO config BR2_PACKAGE_HOST_GO - bool + bool "host go" depends on BR2_PACKAGE_HOST_GO_HOST_ARCH_SUPPORTS if BR2_PACKAGE_HOST_GO From patchwork Mon Jun 10 15:40:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Athaariq Ardhiansyah X-Patchwork-Id: 1945941 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Vybdn5Z0bz20V0 for ; Tue, 11 Jun 2024 01:42:05 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id F22426086B; Mon, 10 Jun 2024 15:41:59 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id aePAGKasT1uY; Mon, 10 Jun 2024 15:41:59 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org C87A6607FD Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id C87A6607FD; Mon, 10 Jun 2024 15:41:58 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id E5EF61BF3BE for ; Mon, 10 Jun 2024 15:41:56 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id D1504408A4 for ; Mon, 10 Jun 2024 15:41:56 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id FMohR1rbjOND for ; Mon, 10 Jun 2024 15:41:55 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=117.53.144.211; helo=mail.athaariq.my.id; envelope-from=foss@athaariq.my.id; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org 4D6D8406EE DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 4D6D8406EE Received: from mail.athaariq.my.id (unknown [117.53.144.211]) by smtp4.osuosl.org (Postfix) with ESMTP id 4D6D8406EE for ; Mon, 10 Jun 2024 15:41:55 +0000 (UTC) Received: from localhost.localdomain (unknown [192.168.100.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by mail.athaariq.my.id (Postfix) with ESMTPSA id 403B943056; Mon, 10 Jun 2024 15:41:49 +0000 (UTC) From: Athaariq Ardhiansyah To: buildroot@buildroot.org Date: Mon, 10 Jun 2024 22:40:23 +0700 Message-ID: <20240610154028.792440-2-foss@athaariq.my.id> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240610154028.792440-1-foss@athaariq.my.id> References: <20240610154028.792440-1-foss@athaariq.my.id> MIME-Version: 1.0 X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=none dis=none) header.from=athaariq.my.id Subject: [Buildroot] [PATCH 2/3] package/go: move source-specific to go-src X-BeenThere: buildroot@buildroot.org 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: Athaariq Ardhiansyah , Anisse Astier , Christian Stewart , Thomas Perale Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" Some of package/go/go.mk includes source compilation specific requirements, which are not effective for prebuilt Go compiler option. Therefore, I moved some of source-specific conditionals and variables to the host-go-src before adding host-go-bin support. Signed-off-by: Athaariq Ardhiansyah --- package/go/go-src/go-src.mk | 68 +++++++++++++++++++++++++++++++++++ package/go/go.mk | 71 ------------------------------------- 2 files changed, 68 insertions(+), 71 deletions(-) diff --git a/package/go/go-src/go-src.mk b/package/go/go-src/go-src.mk index 1e061e20bc..a0c903282f 100644 --- a/package/go/go-src/go-src.mk +++ b/package/go/go-src/go-src.mk @@ -16,6 +16,67 @@ HOST_GO_SRC_DEPENDENCIES = host-go-bootstrap-stage3 ifeq ($(BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS),y) +ifeq ($(BR2_arm),y) +GO_GOARCH = arm +ifeq ($(BR2_ARM_CPU_ARMV5),y) +GO_GOARM = 5 +else ifeq ($(BR2_ARM_CPU_ARMV6),y) +GO_GOARM = 6 +else ifeq ($(BR2_ARM_CPU_ARMV7A),y) +GO_GOARM = 7 +else ifeq ($(BR2_ARM_CPU_ARMV8A),y) +# Go doesn't support 32-bit GOARM=8 (https://github.com/golang/go/issues/29373) +# but can still benefit from armv7 optimisations +GO_GOARM = 7 +endif +else ifeq ($(BR2_aarch64),y) +GO_GOARCH = arm64 +else ifeq ($(BR2_i386),y) +GO_GOARCH = 386 +# i386: use softfloat if no SSE2: https://golang.org/doc/go1.16#386 +ifneq ($(BR2_X86_CPU_HAS_SSE2),y) +GO_GO386 = softfloat +endif +else ifeq ($(BR2_x86_64),y) +GO_GOARCH = amd64 +else ifeq ($(BR2_powerpc64),y) +GO_GOARCH = ppc64 +else ifeq ($(BR2_powerpc64le),y) +GO_GOARCH = ppc64le +else ifeq ($(BR2_mips64),y) +GO_GOARCH = mips64 +else ifeq ($(BR2_mips64el),y) +GO_GOARCH = mips64le +else ifeq ($(BR2_riscv),y) +GO_GOARCH = riscv64 +else ifeq ($(BR2_s390x),y) +GO_GOARCH = s390x +endif + +# For the convienience of target packages. +HOST_GO_TOOLDIR = $(HOST_GO_ROOT)/pkg/tool/linux_$(GO_GOARCH) +HOST_GO_TARGET_ENV = \ + $(HOST_GO_COMMON_ENV) \ + GOOS="linux" \ + GOARCH=$(GO_GOARCH) \ + CC="$(TARGET_CC)" \ + CXX="$(TARGET_CXX)" \ + CGO_CFLAGS="$(TARGET_CFLAGS)" \ + CGO_CXXFLAGS="$(TARGET_CXXFLAGS)" \ + CGO_LDFLAGS="$(TARGET_LDFLAGS)" \ + GOTOOLDIR="$(HOST_GO_TOOLDIR)" + +# The go compiler's cgo support uses threads. If BR2_TOOLCHAIN_HAS_THREADS is +# set, build in cgo support for any go programs that may need it. Note that +# any target package needing cgo support must include +# 'depends on BR2_TOOLCHAIN_HAS_THREADS' in its config file. +ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y) +HOST_GO_DEPENDENCIES += toolchain +HOST_GO_CGO_ENABLED = 1 +else +HOST_GO_CGO_ENABLED = 0 +endif + HOST_GO_SRC_CROSS_ENV = \ CC_FOR_TARGET="$(TARGET_CC)" \ CXX_FOR_TARGET="$(TARGET_CXX)" \ @@ -25,6 +86,11 @@ HOST_GO_SRC_CROSS_ENV = \ $(if $(GO_GOARM),GOARM=$(GO_GOARM)) \ GO_ASSUME_CROSSCOMPILING=1 +else # !BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS +# host-go can still be used to build packages for the host. No need to set all +# the arch stuff since we will not be cross-compiling. +HOST_GO_CGO_ENABLED = 1 + endif # The go build system is not compatible with ccache, so use @@ -52,3 +118,5 @@ define HOST_GO_SRC_INSTALL_CMDS endef $(eval $(host-generic-package)) + +include $(sort $(wildcard package/go/go-bootstrap-*/*.mk)) diff --git a/package/go/go.mk b/package/go/go.mk index dfcb633aa7..489d749d46 100644 --- a/package/go/go.mk +++ b/package/go/go.mk @@ -26,75 +26,6 @@ HOST_GO_COMMON_ENV = \ GOBIN= \ CGO_ENABLED=$(HOST_GO_CGO_ENABLED) -ifeq ($(BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS),y) - -ifeq ($(BR2_arm),y) -GO_GOARCH = arm -ifeq ($(BR2_ARM_CPU_ARMV5),y) -GO_GOARM = 5 -else ifeq ($(BR2_ARM_CPU_ARMV6),y) -GO_GOARM = 6 -else ifeq ($(BR2_ARM_CPU_ARMV7A),y) -GO_GOARM = 7 -else ifeq ($(BR2_ARM_CPU_ARMV8A),y) -# Go doesn't support 32-bit GOARM=8 (https://github.com/golang/go/issues/29373) -# but can still benefit from armv7 optimisations -GO_GOARM = 7 -endif -else ifeq ($(BR2_aarch64),y) -GO_GOARCH = arm64 -else ifeq ($(BR2_i386),y) -GO_GOARCH = 386 -# i386: use softfloat if no SSE2: https://golang.org/doc/go1.16#386 -ifneq ($(BR2_X86_CPU_HAS_SSE2),y) -GO_GO386 = softfloat -endif -else ifeq ($(BR2_x86_64),y) -GO_GOARCH = amd64 -else ifeq ($(BR2_powerpc64),y) -GO_GOARCH = ppc64 -else ifeq ($(BR2_powerpc64le),y) -GO_GOARCH = ppc64le -else ifeq ($(BR2_mips64),y) -GO_GOARCH = mips64 -else ifeq ($(BR2_mips64el),y) -GO_GOARCH = mips64le -else ifeq ($(BR2_riscv),y) -GO_GOARCH = riscv64 -else ifeq ($(BR2_s390x),y) -GO_GOARCH = s390x -endif - -# For the convienience of target packages. -HOST_GO_TOOLDIR = $(HOST_GO_ROOT)/pkg/tool/linux_$(GO_GOARCH) -HOST_GO_TARGET_ENV = \ - $(HOST_GO_COMMON_ENV) \ - GOOS="linux" \ - GOARCH=$(GO_GOARCH) \ - CC="$(TARGET_CC)" \ - CXX="$(TARGET_CXX)" \ - CGO_CFLAGS="$(TARGET_CFLAGS)" \ - CGO_CXXFLAGS="$(TARGET_CXXFLAGS)" \ - CGO_LDFLAGS="$(TARGET_LDFLAGS)" \ - GOTOOLDIR="$(HOST_GO_TOOLDIR)" - -# The go compiler's cgo support uses threads. If BR2_TOOLCHAIN_HAS_THREADS is -# set, build in cgo support for any go programs that may need it. Note that -# any target package needing cgo support must include -# 'depends on BR2_TOOLCHAIN_HAS_THREADS' in its config file. -ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y) -HOST_GO_DEPENDENCIES += toolchain -HOST_GO_CGO_ENABLED = 1 -else -HOST_GO_CGO_ENABLED = 0 -endif - -else # !BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS -# host-go can still be used to build packages for the host. No need to set all -# the arch stuff since we will not be cross-compiling. -HOST_GO_CGO_ENABLED = 1 -endif # BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS - # For the convenience of host golang packages HOST_GO_HOST_ENV = \ $(HOST_GO_COMMON_ENV) \ @@ -130,5 +61,3 @@ define GO_BINARIES_INSTALL endef $(eval $(host-virtual-package)) - -include $(sort $(wildcard package/go/*/*.mk)) From patchwork Mon Jun 10 15:40:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Athaariq Ardhiansyah X-Patchwork-Id: 1945942 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Vybdv53Hhz20V0 for ; Tue, 11 Jun 2024 01:42:11 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 0419C6089E; Mon, 10 Jun 2024 15:42:10 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id v2cVfcVHujeB; Mon, 10 Jun 2024 15:42:07 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 78D3B6087F Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id 78D3B6087F; Mon, 10 Jun 2024 15:42:07 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id CBF891BF3BE for ; Mon, 10 Jun 2024 15:42:06 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id B876640873 for ; Mon, 10 Jun 2024 15:42:06 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 76s-avbfLule for ; Mon, 10 Jun 2024 15:42:05 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=117.53.144.211; helo=mail.athaariq.my.id; envelope-from=foss@athaariq.my.id; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp4.osuosl.org 4C5EF40506 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp4.osuosl.org 4C5EF40506 Received: from mail.athaariq.my.id (unknown [117.53.144.211]) by smtp4.osuosl.org (Postfix) with ESMTP id 4C5EF40506 for ; Mon, 10 Jun 2024 15:42:05 +0000 (UTC) Received: from localhost.localdomain (unknown [192.168.100.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by mail.athaariq.my.id (Postfix) with ESMTPSA id 3508543052; Mon, 10 Jun 2024 15:41:57 +0000 (UTC) From: Athaariq Ardhiansyah To: buildroot@buildroot.org Date: Mon, 10 Jun 2024 22:40:24 +0700 Message-ID: <20240610154028.792440-3-foss@athaariq.my.id> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240610154028.792440-1-foss@athaariq.my.id> References: <20240610154028.792440-1-foss@athaariq.my.id> MIME-Version: 1.0 X-Mailman-Original-Authentication-Results: smtp4.osuosl.org; dmarc=pass (p=none dis=none) header.from=athaariq.my.id Subject: [Buildroot] [PATCH 3/3] package/go: add prebuilt Go compiler option X-BeenThere: buildroot@buildroot.org 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: Christian Stewart , Athaariq Ardhiansyah , Thomas Perale , Thomas Petazzoni , Anisse Astier Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" According to the TO-DO list, the prebuilt Go compiler is considered as important to be implemented. So, I'm trying to help you to add the prebuilt Go compiler support into Buildroot. Signed-off-by: Athaariq Ardhiansyah --- package/go/Config.in.host | 22 +++++++++++++++- package/go/go-bin/go-bin.hash | 8 ++++++ package/go/go-bin/go-bin.mk | 47 +++++++++++++++++++++++++++++++++++ 3 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 package/go/go-bin/go-bin.hash create mode 100644 package/go/go-bin/go-bin.mk diff --git a/package/go/Config.in.host b/package/go/Config.in.host index 32483871e7..ffd2594a80 100644 --- a/package/go/Config.in.host +++ b/package/go/Config.in.host @@ -32,6 +32,16 @@ config BR2_PACKAGE_HOST_GO_HOST_ARCH_SUPPORTS default y depends on BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE3_ARCH_SUPPORTS +# Only required for prebuilt Go compiler +config BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS + bool + default y if (BR2_HOSTARCH = "arm" && BR2_TOOLCHAIN_SUPPORTS_PIE) + default y if BR2_HOSTARCH = "aarch64" + default y if BR2_HOSTARCH = "powerpc64le" + default y if BR2_HOSTARCH = "s390x" + default y if BR2_HOSTARCH = "x86" + default y if BR2_HOSTARCH = "x86_64" + # Go packages should select BR2_PACKAGE_HOST_GO config BR2_PACKAGE_HOST_GO bool "host go" @@ -52,12 +62,22 @@ config BR2_PACKAGE_HOST_GO_SRC help This package will build the go compiler for the host. +config BR2_PACKAGE_HOST_GO_BIN + bool "host go (prebuilt)" + depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS + help + This package will download the go compiler binary for + the host without build process. + +comment "host-go-bin doesn't support $(BR2_HOSTARCH) host architecture." + depends on !BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS + endchoice config BR2_PACKAGE_PROVIDES_HOST_GO string - # Default to host-go-src default "host-go-src" if BR2_PACKAGE_HOST_GO_SRC + default "host-go-bin" if BR2_PACKAGE_HOST_GO_BIN endif diff --git a/package/go/go-bin/go-bin.hash b/package/go/go-bin/go-bin.hash new file mode 100644 index 0000000000..52b6c6355f --- /dev/null +++ b/package/go/go-bin/go-bin.hash @@ -0,0 +1,8 @@ +# From https://go.dev/dl +sha256 fefba30bb0d3dd1909823ee38c9f1930c3dc5337a2ac4701c2277a329a386b57 go1.22.3.linux-386.tar.gz +sha256 8920ea521bad8f6b7bc377b4824982e011c19af27df88a815e3586ea895f1b36 go1.22.3.linux-amd64.tar.gz +sha256 6c33e52a5b26e7aa021b94475587fce80043a727a54ceb0eee2f9fc160646434 go1.22.3.linux-arm64.tar.gz +sha256 f2bacad20cd2b96f23a86d4826525d42b229fd431cc6d0dec61ff3bc448ef46e go1.22.3.linux-armv6l.tar.gz +sha256 04b7b05283de30dd2da20bf3114b2e22cc727938aed3148babaf35cc951051ac go1.22.3.linux-ppc64le.tar.gz +sha256 2aba796417a69be5f3ed489076bac79c1c02b36e29422712f9f3bf51da9cf2d4 go1.22.3.linux-s390x.tar.gz +sha256 2d36597f7117c38b006835ae7f537487207d8ec407aa9d9980794b2030cbc067 LICENSE diff --git a/package/go/go-bin/go-bin.mk b/package/go/go-bin/go-bin.mk new file mode 100644 index 0000000000..cb320f44fa --- /dev/null +++ b/package/go/go-bin/go-bin.mk @@ -0,0 +1,47 @@ +################################################################################ +# +# go-bin +# +################################################################################ + +# Translate Buildroot's arch enumeration to Go's arch +ifeq ($(BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS), y) + +ifeq ($(BR2_HOSTARCH), "arm") +GO_GOARCH = "armv6l" +else ifeq ($(BR2_HOSTARCH), "aarch64") +GO_GOARCH = "arm64" +else ifeq ($(BR2_HOSTARCH), "powerpc64le") +GO_GOARCH = "ppc64le" +else ifeq ($(BR2_HOSTARCH), "powerpc64le") +GO_GOARCH = "ppc64le" +else ifeq ($(BR2_HOSTARCH), "x86") +GO_GOARCH = "386" +else ifeq ($(BR2_HOSTARCH), "x86_64") +GO_GOARCH = "amd64" +else +GO_GOARCH = $(BR2_HOSTARCH) +endif + +endif # BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS + +GO_BIN_SITE = https://storage.googleapis.com/golang +GO_BIN_SOURCE = go$(GO_VERSION).linux-$(GO_GOARCH).tar.gz + +GO_BIN_LICENSE = BSD-3-Clause +GO_BIN_LICENSE_FILES = LICENSE +GO_BIN_CPE_ID_VENDOR = golang + +HOST_GO_SRC_PROVIDES = host-go + +ifeq ($(BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS),y) +ifeq ($(BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS), y) + +define HOST_GO_BIN_INSTALL_CMDS + $(GO_BINARIES_INSTALL) +endef + +endif # BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS +endif # BR2_PACKAGE_HOST_GO_TARGET_ARCH_SUPPORTS + +$(eval $(host-generic-package))