From d1287d14833fb48f48ef2056146e6115d00f9f8a Mon Sep 17 00:00:00 2001 From: bits Date: Thu, 5 Sep 2024 09:46:34 +0800 Subject: [PATCH 1/3] Add riscv64 linux tools download support --- internal/arduino/cores/tools.go | 3 +++ internal/arduino/cores/tools_test.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/internal/arduino/cores/tools.go b/internal/arduino/cores/tools.go index 3648119c483..1a76956b1c2 100644 --- a/internal/arduino/cores/tools.go +++ b/internal/arduino/cores/tools.go @@ -129,6 +129,7 @@ func (tr *ToolRelease) RuntimeProperties() *properties.Map { var ( regexpLinuxArm = regexp.MustCompile("arm.*-linux-gnueabihf") regexpLinuxArm64 = regexp.MustCompile("(aarch64|arm64)-linux-gnu") + regexpLinuxRiscv64 = regexp.MustCompile("riscv64-linux-gnu") regexpLinux64 = regexp.MustCompile("x86_64-.*linux-gnu") regexpLinux32 = regexp.MustCompile("i[3456]86-.*linux-gnu") regexpWindows32 = regexp.MustCompile("i[3456]86-.*(mingw32|cygwin)") @@ -151,6 +152,8 @@ func (f *Flavor) isExactMatchWith(osName, osArch string) bool { return regexpLinuxArm.MatchString(f.OS) case "linux,arm64": return regexpLinuxArm64.MatchString(f.OS) + case "linux,riscv64": + return regexpLinuxRiscv64.MatchString(f.OS) case "linux,amd64": return regexpLinux64.MatchString(f.OS) case "linux,386": diff --git a/internal/arduino/cores/tools_test.go b/internal/arduino/cores/tools_test.go index 4c0d54e953a..f4a3097a3ca 100644 --- a/internal/arduino/cores/tools_test.go +++ b/internal/arduino/cores/tools_test.go @@ -34,6 +34,7 @@ func TestFlavorCompatibility(t *testing.T) { linuxArm := &os{"linux", "arm"} linuxArmbe := &os{"linux", "armbe"} linuxArm64 := &os{"linux", "arm64"} + linuxRiscv64 := &os{"linux", "riscv64"} darwin32 := &os{"darwin", "386"} darwin64 := &os{"darwin", "amd64"} darwinArm64 := &os{"darwin", "arm64"} @@ -47,6 +48,7 @@ func TestFlavorCompatibility(t *testing.T) { linuxArm, linuxArmbe, linuxArm64, + linuxRiscv64, darwin32, darwin64, darwinArm64, @@ -82,6 +84,7 @@ func TestFlavorCompatibility(t *testing.T) { {&Flavor{OS: "x86_64-pc-linux-gnu"}, []*os{linux64}, []*os{linux64}}, {&Flavor{OS: "aarch64-linux-gnu"}, []*os{linuxArm64}, []*os{linuxArm64}}, {&Flavor{OS: "arm64-linux-gnu"}, []*os{linuxArm64}, []*os{linuxArm64}}, + {&Flavor{OS: "riscv64-linux-gnu"}, []*os{linuxRiscv64}, []*os{linuxRiscv64}}, } checkCompatible := func(test *test, os *os) { From 0569dbb91d48027e78c187a312966d6d671a76ef Mon Sep 17 00:00:00 2001 From: bits Date: Fri, 6 Sep 2024 09:39:18 +0800 Subject: [PATCH 2/3] fix style --- internal/arduino/cores/tools.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/internal/arduino/cores/tools.go b/internal/arduino/cores/tools.go index 1a76956b1c2..b858e7eab62 100644 --- a/internal/arduino/cores/tools.go +++ b/internal/arduino/cores/tools.go @@ -127,19 +127,19 @@ func (tr *ToolRelease) RuntimeProperties() *properties.Map { } var ( - regexpLinuxArm = regexp.MustCompile("arm.*-linux-gnueabihf") - regexpLinuxArm64 = regexp.MustCompile("(aarch64|arm64)-linux-gnu") + regexpLinuxArm = regexp.MustCompile("arm.*-linux-gnueabihf") + regexpLinuxArm64 = regexp.MustCompile("(aarch64|arm64)-linux-gnu") regexpLinuxRiscv64 = regexp.MustCompile("riscv64-linux-gnu") - regexpLinux64 = regexp.MustCompile("x86_64-.*linux-gnu") - regexpLinux32 = regexp.MustCompile("i[3456]86-.*linux-gnu") - regexpWindows32 = regexp.MustCompile("i[3456]86-.*(mingw32|cygwin)") - regexpWindows64 = regexp.MustCompile("(amd64|x86_64)-.*(mingw32|cygwin)") - regexpMac64 = regexp.MustCompile("x86_64-apple-darwin.*") - regexpMac32 = regexp.MustCompile("i[3456]86-apple-darwin.*") - regexpMacArm64 = regexp.MustCompile("arm64-apple-darwin.*") - regexpFreeBSDArm = regexp.MustCompile("arm.*-freebsd[0-9]*") - regexpFreeBSD32 = regexp.MustCompile("i?[3456]86-freebsd[0-9]*") - regexpFreeBSD64 = regexp.MustCompile("amd64-freebsd[0-9]*") + regexpLinux64 = regexp.MustCompile("x86_64-.*linux-gnu") + regexpLinux32 = regexp.MustCompile("i[3456]86-.*linux-gnu") + regexpWindows32 = regexp.MustCompile("i[3456]86-.*(mingw32|cygwin)") + regexpWindows64 = regexp.MustCompile("(amd64|x86_64)-.*(mingw32|cygwin)") + regexpMac64 = regexp.MustCompile("x86_64-apple-darwin.*") + regexpMac32 = regexp.MustCompile("i[3456]86-apple-darwin.*") + regexpMacArm64 = regexp.MustCompile("arm64-apple-darwin.*") + regexpFreeBSDArm = regexp.MustCompile("arm.*-freebsd[0-9]*") + regexpFreeBSD32 = regexp.MustCompile("i?[3456]86-freebsd[0-9]*") + regexpFreeBSD64 = regexp.MustCompile("amd64-freebsd[0-9]*") ) func (f *Flavor) isExactMatchWith(osName, osArch string) bool { From add9b2e4cb58f004636c95c27e93776f63c5fc97 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Wed, 11 Sep 2024 15:05:21 +0200 Subject: [PATCH 3/3] Updated docs --- docs/package_index_json-specification.md | 29 ++++++++++++------------ 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/docs/package_index_json-specification.md b/docs/package_index_json-specification.md index ef8bbdaa3f3..416a5e2e815 100644 --- a/docs/package_index_json-specification.md +++ b/docs/package_index_json-specification.md @@ -170,20 +170,21 @@ Each tool version may come in different build flavours for different OS. Each fl array. The IDE will take care to install the right flavour for the user's OS by matching the `host` value with the following table or fail if a needed flavour is missing. -| OS flavour | `host` regexp value | `host` suggested value | -| ------------ | ------------------------------------- | ---------------------------------- | -| Linux 32 | `i[3456]86-.*linux-gnu` | `i686-linux-gnu` | -| Linux 64 | `x86_64-.*linux-gnu` | `x86_64-linux-gnu` | -| Linux Arm | `arm.*-linux-gnueabihf` | `arm-linux-gnueabihf` | -| Linux Arm64 | `(aarch64\|arm64)-linux-gnu` | `aarch64-linux-gnu` | -| Windows 32 | `i[3456]86-.*(mingw32\|cygwin)` | `i686-mingw32` or `i686-cygwin` | -| Windows 64 | `(amd64\|x86_64)-.*(mingw32\|cygwin)` | `x86_64-migw32` or `x86_64-cygwin` | -| MacOSX 32 | `i[3456]86-apple-darwin.*` | `i686-apple-darwin` | -| MacOSX 64 | `x86_64-apple-darwin.*` | `x86_64-apple-darwin` | -| MacOSX Arm64 | `arm64-apple-darwin.*` | `arm64-apple-darwin` | -| FreeBSD 32 | `i?[3456]86-freebsd[0-9]*` | `i686-freebsd` | -| FreeBSD 64 | `amd64-freebsd[0-9]*` | `amd64-freebsd` | -| FreeBSD Arm | `arm.*-freebsd[0-9]*` | `arm-freebsd` | +| OS flavour | `host` regexp | suggested `host` value | +| --------------- | ------------------------------------- | ---------------------------------- | +| Linux 32 | `i[3456]86-.*linux-gnu` | `i686-linux-gnu` | +| Linux 64 | `x86_64-.*linux-gnu` | `x86_64-linux-gnu` | +| Linux Arm | `arm.*-linux-gnueabihf` | `arm-linux-gnueabihf` | +| Linux Arm64 | `(aarch64\|arm64)-linux-gnu` | `aarch64-linux-gnu` | +| Linux RISC-V 64 | `riscv64-linux-gnu` | `riscv64-linux-gnu` | +| Windows 32 | `i[3456]86-.*(mingw32\|cygwin)` | `i686-mingw32` or `i686-cygwin` | +| Windows 64 | `(amd64\|x86_64)-.*(mingw32\|cygwin)` | `x86_64-migw32` or `x86_64-cygwin` | +| MacOSX 32 | `i[3456]86-apple-darwin.*` | `i686-apple-darwin` | +| MacOSX 64 | `x86_64-apple-darwin.*` | `x86_64-apple-darwin` | +| MacOSX Arm64 | `arm64-apple-darwin.*` | `arm64-apple-darwin` | +| FreeBSD 32 | `i?[3456]86-freebsd[0-9]*` | `i686-freebsd` | +| FreeBSD 64 | `amd64-freebsd[0-9]*` | `amd64-freebsd` | +| FreeBSD Arm | `arm.*-freebsd[0-9]*` | `arm-freebsd` | The `host` value is matched with the regexp, this means that a more specific value for the `host` field is allowed (for example you may write `x86_64-apple-darwin14.1` for MacOSX instead of the suggested `x86_64-apple-darwin`), by the way,