Commit a17ecb9f authored by Cristian Maglie's avatar Cristian Maglie Committed by Massimiliano Pippi

Added arm64 support (#204)

* Added arm64 support

Fix #203

* Fixed typo in test
parent 24fe3c61
......@@ -24,7 +24,7 @@ import (
"github.com/arduino/arduino-cli/arduino/resources"
"github.com/arduino/go-paths-helper"
properties "github.com/arduino/go-properties-orderedmap"
"go.bug.st/relaxed-semver"
semver "go.bug.st/relaxed-semver"
)
// Tool represents a single Tool, part of a Package.
......@@ -141,13 +141,14 @@ func (tr *ToolRelease) RuntimeProperties() *properties.Map {
}
var (
regexpArmLinux = regexp.MustCompile("arm.*-linux-gnueabihf")
regexpAmd64 = regexp.MustCompile("x86_64-.*linux-gnu")
regexpi386 = regexp.MustCompile("i[3456]86-.*linux-gnu")
regexpWindows = regexp.MustCompile("i[3456]86-.*(mingw32|cygwin)")
regexpMac64Bit = regexp.MustCompile("(i[3456]86|x86_64)-apple-darwin.*")
regexpmac32Bit = regexp.MustCompile("i[3456]86-apple-darwin.*")
regexpArmBSD = regexp.MustCompile("arm.*-freebsd[0-9]*")
regexpArmLinux = regexp.MustCompile("arm.*-linux-gnueabihf")
regexpArm64Linux = regexp.MustCompile("(aarch64|arm64)-linux-gnu")
regexpAmd64 = regexp.MustCompile("x86_64-.*linux-gnu")
regexpi386 = regexp.MustCompile("i[3456]86-.*linux-gnu")
regexpWindows = regexp.MustCompile("i[3456]86-.*(mingw32|cygwin)")
regexpMac64Bit = regexp.MustCompile("(i[3456]86|x86_64)-apple-darwin.*")
regexpmac32Bit = regexp.MustCompile("i[3456]86-apple-darwin.*")
regexpArmBSD = regexp.MustCompile("arm.*-freebsd[0-9]*")
)
func (f *Flavor) isCompatibleWithCurrentMachine() bool {
......@@ -162,6 +163,8 @@ func (f *Flavor) isCompatibleWith(osName, osArch string) bool {
switch osName + "," + osArch {
case "linux,arm", "linux,armbe":
return regexpArmLinux.MatchString(f.OS)
case "linux,arm64":
return regexpArm64Linux.MatchString(f.OS)
case "linux,amd64":
return regexpAmd64.MatchString(f.OS)
case "linux,386":
......
......@@ -34,8 +34,9 @@ func TestFlavorCompatibility(t *testing.T) {
linuxamd64 := &os{"linux", "amd64"}
linuxarm := &os{"linux", "arm"}
linuxarmbe := &os{"linux", "armbe"}
linuxarm64 := &os{"linux", "arm64"}
darwini386 := &os{"darwin", "386"}
darwinamd646 := &os{"darwin", "amd64"}
darwinamd64 := &os{"darwin", "amd64"}
freebsdi386 := &os{"freebsd", "386"}
freebsdamd64 := &os{"freebsd", "amd64"}
oses := []*os{
......@@ -45,8 +46,9 @@ func TestFlavorCompatibility(t *testing.T) {
linuxamd64,
linuxarm,
linuxarmbe,
linuxarm64,
darwini386,
darwinamd646,
darwinamd64,
freebsdi386,
freebsdamd64,
}
......@@ -57,8 +59,8 @@ func TestFlavorCompatibility(t *testing.T) {
}
tests := []*test{
{&Flavor{OS: "i686-mingw32"}, []*os{windowsi386, windowsx8664}},
{&Flavor{OS: "i386-apple-darwin11"}, []*os{darwini386, darwinamd646}},
{&Flavor{OS: "x86_64-apple-darwin"}, []*os{darwinamd646}},
{&Flavor{OS: "i386-apple-darwin11"}, []*os{darwini386, darwinamd64}},
{&Flavor{OS: "x86_64-apple-darwin"}, []*os{darwinamd64}},
// Raspberry PI, BBB or other ARM based host
// PI: "arm-linux-gnueabihf"
......@@ -74,6 +76,8 @@ func TestFlavorCompatibility(t *testing.T) {
{&Flavor{OS: "i686-pc-linux-gnu"}, []*os{linuxi386}},
{&Flavor{OS: "x86_64-linux-gnu"}, []*os{linuxamd64}},
{&Flavor{OS: "x86_64-pc-linux-gnu"}, []*os{linuxamd64}},
{&Flavor{OS: "aarch64-linux-gnu"}, []*os{linuxarm64}},
{&Flavor{OS: "arm64-linux-gnu"}, []*os{linuxarm64}},
}
check := func(test *test, os *os) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment