Skip to content

Commit a3796a0

Browse files
bitskcmaglie
andauthored
Add riscv64 linux tools download support (#2700)
* Add riscv64 linux tools download support * fix style * Updated docs --------- Co-authored-by: Cristian Maglie <c.maglie@arduino.cc>
1 parent 9e5deed commit a3796a0

File tree

3 files changed

+33
-26
lines changed

3 files changed

+33
-26
lines changed

docs/package_index_json-specification.md

+15-14
Original file line numberDiff line numberDiff line change
@@ -170,20 +170,21 @@ Each tool version may come in different build flavours for different OS. Each fl
170170
array. The IDE will take care to install the right flavour for the user's OS by matching the `host` value with the
171171
following table or fail if a needed flavour is missing.
172172

173-
| OS flavour | `host` regexp value | `host` suggested value |
174-
| ------------ | ------------------------------------- | ---------------------------------- |
175-
| Linux 32 | `i[3456]86-.*linux-gnu` | `i686-linux-gnu` |
176-
| Linux 64 | `x86_64-.*linux-gnu` | `x86_64-linux-gnu` |
177-
| Linux Arm | `arm.*-linux-gnueabihf` | `arm-linux-gnueabihf` |
178-
| Linux Arm64 | `(aarch64\|arm64)-linux-gnu` | `aarch64-linux-gnu` |
179-
| Windows 32 | `i[3456]86-.*(mingw32\|cygwin)` | `i686-mingw32` or `i686-cygwin` |
180-
| Windows 64 | `(amd64\|x86_64)-.*(mingw32\|cygwin)` | `x86_64-migw32` or `x86_64-cygwin` |
181-
| MacOSX 32 | `i[3456]86-apple-darwin.*` | `i686-apple-darwin` |
182-
| MacOSX 64 | `x86_64-apple-darwin.*` | `x86_64-apple-darwin` |
183-
| MacOSX Arm64 | `arm64-apple-darwin.*` | `arm64-apple-darwin` |
184-
| FreeBSD 32 | `i?[3456]86-freebsd[0-9]*` | `i686-freebsd` |
185-
| FreeBSD 64 | `amd64-freebsd[0-9]*` | `amd64-freebsd` |
186-
| FreeBSD Arm | `arm.*-freebsd[0-9]*` | `arm-freebsd` |
173+
| OS flavour | `host` regexp | suggested `host` value |
174+
| --------------- | ------------------------------------- | ---------------------------------- |
175+
| Linux 32 | `i[3456]86-.*linux-gnu` | `i686-linux-gnu` |
176+
| Linux 64 | `x86_64-.*linux-gnu` | `x86_64-linux-gnu` |
177+
| Linux Arm | `arm.*-linux-gnueabihf` | `arm-linux-gnueabihf` |
178+
| Linux Arm64 | `(aarch64\|arm64)-linux-gnu` | `aarch64-linux-gnu` |
179+
| Linux RISC-V 64 | `riscv64-linux-gnu` | `riscv64-linux-gnu` |
180+
| Windows 32 | `i[3456]86-.*(mingw32\|cygwin)` | `i686-mingw32` or `i686-cygwin` |
181+
| Windows 64 | `(amd64\|x86_64)-.*(mingw32\|cygwin)` | `x86_64-migw32` or `x86_64-cygwin` |
182+
| MacOSX 32 | `i[3456]86-apple-darwin.*` | `i686-apple-darwin` |
183+
| MacOSX 64 | `x86_64-apple-darwin.*` | `x86_64-apple-darwin` |
184+
| MacOSX Arm64 | `arm64-apple-darwin.*` | `arm64-apple-darwin` |
185+
| FreeBSD 32 | `i?[3456]86-freebsd[0-9]*` | `i686-freebsd` |
186+
| FreeBSD 64 | `amd64-freebsd[0-9]*` | `amd64-freebsd` |
187+
| FreeBSD Arm | `arm.*-freebsd[0-9]*` | `arm-freebsd` |
187188

188189
The `host` value is matched with the regexp, this means that a more specific value for the `host` field is allowed (for
189190
example you may write `x86_64-apple-darwin14.1` for MacOSX instead of the suggested `x86_64-apple-darwin`), by the way,

internal/arduino/cores/tools.go

+15-12
Original file line numberDiff line numberDiff line change
@@ -127,18 +127,19 @@ func (tr *ToolRelease) RuntimeProperties() *properties.Map {
127127
}
128128

129129
var (
130-
regexpLinuxArm = regexp.MustCompile("arm.*-linux-gnueabihf")
131-
regexpLinuxArm64 = regexp.MustCompile("(aarch64|arm64)-linux-gnu")
132-
regexpLinux64 = regexp.MustCompile("x86_64-.*linux-gnu")
133-
regexpLinux32 = regexp.MustCompile("i[3456]86-.*linux-gnu")
134-
regexpWindows32 = regexp.MustCompile("i[3456]86-.*(mingw32|cygwin)")
135-
regexpWindows64 = regexp.MustCompile("(amd64|x86_64)-.*(mingw32|cygwin)")
136-
regexpMac64 = regexp.MustCompile("x86_64-apple-darwin.*")
137-
regexpMac32 = regexp.MustCompile("i[3456]86-apple-darwin.*")
138-
regexpMacArm64 = regexp.MustCompile("arm64-apple-darwin.*")
139-
regexpFreeBSDArm = regexp.MustCompile("arm.*-freebsd[0-9]*")
140-
regexpFreeBSD32 = regexp.MustCompile("i?[3456]86-freebsd[0-9]*")
141-
regexpFreeBSD64 = regexp.MustCompile("amd64-freebsd[0-9]*")
130+
regexpLinuxArm = regexp.MustCompile("arm.*-linux-gnueabihf")
131+
regexpLinuxArm64 = regexp.MustCompile("(aarch64|arm64)-linux-gnu")
132+
regexpLinuxRiscv64 = regexp.MustCompile("riscv64-linux-gnu")
133+
regexpLinux64 = regexp.MustCompile("x86_64-.*linux-gnu")
134+
regexpLinux32 = regexp.MustCompile("i[3456]86-.*linux-gnu")
135+
regexpWindows32 = regexp.MustCompile("i[3456]86-.*(mingw32|cygwin)")
136+
regexpWindows64 = regexp.MustCompile("(amd64|x86_64)-.*(mingw32|cygwin)")
137+
regexpMac64 = regexp.MustCompile("x86_64-apple-darwin.*")
138+
regexpMac32 = regexp.MustCompile("i[3456]86-apple-darwin.*")
139+
regexpMacArm64 = regexp.MustCompile("arm64-apple-darwin.*")
140+
regexpFreeBSDArm = regexp.MustCompile("arm.*-freebsd[0-9]*")
141+
regexpFreeBSD32 = regexp.MustCompile("i?[3456]86-freebsd[0-9]*")
142+
regexpFreeBSD64 = regexp.MustCompile("amd64-freebsd[0-9]*")
142143
)
143144

144145
func (f *Flavor) isExactMatchWith(osName, osArch string) bool {
@@ -151,6 +152,8 @@ func (f *Flavor) isExactMatchWith(osName, osArch string) bool {
151152
return regexpLinuxArm.MatchString(f.OS)
152153
case "linux,arm64":
153154
return regexpLinuxArm64.MatchString(f.OS)
155+
case "linux,riscv64":
156+
return regexpLinuxRiscv64.MatchString(f.OS)
154157
case "linux,amd64":
155158
return regexpLinux64.MatchString(f.OS)
156159
case "linux,386":

internal/arduino/cores/tools_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ func TestFlavorCompatibility(t *testing.T) {
3434
linuxArm := &os{"linux", "arm"}
3535
linuxArmbe := &os{"linux", "armbe"}
3636
linuxArm64 := &os{"linux", "arm64"}
37+
linuxRiscv64 := &os{"linux", "riscv64"}
3738
darwin32 := &os{"darwin", "386"}
3839
darwin64 := &os{"darwin", "amd64"}
3940
darwinArm64 := &os{"darwin", "arm64"}
@@ -47,6 +48,7 @@ func TestFlavorCompatibility(t *testing.T) {
4748
linuxArm,
4849
linuxArmbe,
4950
linuxArm64,
51+
linuxRiscv64,
5052
darwin32,
5153
darwin64,
5254
darwinArm64,
@@ -82,6 +84,7 @@ func TestFlavorCompatibility(t *testing.T) {
8284
{&Flavor{OS: "x86_64-pc-linux-gnu"}, []*os{linux64}, []*os{linux64}},
8385
{&Flavor{OS: "aarch64-linux-gnu"}, []*os{linuxArm64}, []*os{linuxArm64}},
8486
{&Flavor{OS: "arm64-linux-gnu"}, []*os{linuxArm64}, []*os{linuxArm64}},
87+
{&Flavor{OS: "riscv64-linux-gnu"}, []*os{linuxRiscv64}, []*os{linuxRiscv64}},
8588
}
8689

8790
checkCompatible := func(test *test, os *os) {

0 commit comments

Comments
 (0)