From d4d52a9e1937bfe355c73046bdb34529a9fd1b09 Mon Sep 17 00:00:00 2001 From: Nathan Robinson Date: Fri, 25 Sep 2020 00:27:13 -0400 Subject: [PATCH] WIP adding support for aarch64 at 00:27 of 2020-09-25 --- aur/PKGBUILD | 30 +++++++++++++++++++----------- neopo/neopo.py | 47 +++++++++++++++++++++++++++++++---------------- 2 files changed, 50 insertions(+), 27 deletions(-) diff --git a/aur/PKGBUILD b/aur/PKGBUILD index a25bcac..2ac885e 100644 --- a/aur/PKGBUILD +++ b/aur/PKGBUILD @@ -2,28 +2,36 @@ pkgname=neopo-git _gitname="neopo" -pkgver=2020.09.05 # TODO +pkgver=2020.09.25 # TODO pkgrel=1 pkgdesc="A lightweight solution for local Particle development." arch=('any') url="https://neopo.xyz" license=('custom') -depends=('libusb' 'lib32-glibc' 'python3' 'vim' 'git' 'perl-archive-zip') -install=neopo-git.install - -# To get debugger working in Workbench: -# gpg --keyserver hkp://keys.gnupg.net:80 --recv-keys C52048C0C0748FEE227D47A2702353E0F7E48EDB -# yay -S lib32-ncurses5-compat-libs - -validpgpkeys=('C52048C0C0748FEE227D47A2702353E0F7E48EDB') provides=('neopo') - +install=neopo-git.install source=('git+https://github.com/nrobinson2000/neopo.git') md5sums=('SKIP') +## On x86_64 +depends=('libusb' 'lib32-glibc' 'python3' 'vim' 'git' 'perl-archive-zip') +## On aarch64 +# depends=('libusb' python3' 'vim' 'git' 'perl-archive-zip' 'dfu-util' 'node') + package() { cd $_gitname install -Dm 755 "neopo/neopo.py" "$pkgdir/usr/local/bin/neopo" install -Dm 644 "neopo/neopo-completion" "$pkgdir/usr/share/bash-completion/completions/neopo" install -Dm 644 "LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE" -} \ No newline at end of file +} + +# To get debugger working in Workbench: + +# gpg --keyserver hkp://keys.gnupg.net:80 --recv-keys C52048C0C0748FEE227D47A2702353E0F7E48EDB +# yay -S lib32-ncurses5-compat-libs + +# Also on aarch64, the node executable provided by particle-cli wrapper is actually armv7l +# Hack! Create a link to the current installed version of node: + +# mv ~/.particle/node-v12*/bin/node ~/.particle/node-v12*/bin/node.old +# ln -s $(which node) ~/.particle/node-v12*/bin/node \ No newline at end of file diff --git a/neopo/neopo.py b/neopo/neopo.py index 9a7d523..d1ab919 100755 --- a/neopo/neopo.py +++ b/neopo/neopo.py @@ -24,16 +24,29 @@ CACHE_DIR = os.path.join(NEOPO_DEPS, "cache") SCRIPTS_DIR = os.path.join(NEOPO_DEPS, "scripts") -# Raspberry Pi gcc-arm downloads -RPI_GCC_ARM = { - "5.3.1": { - "url": "https://github.com/nrobinson2000/neopo/releases/download/0.0.1/gcc-arm-v5.3.1-raspberry-pi.tar.gz", - "sha256": "5ff9b9406da9be17c17e0ec475f092b211cd158d826423d17c9fe6d1215db301" +# Precompiled gcc-arm for ARM platforms +ARM_GCC_ARM = { + "aarch64": { + "5.3.1": { + "url": "gcc-arm-v5.3.1-aarch64.tar.gz", + "sha256": "STILL COMPILING" + }, + + "9.2.1": { + "url": "https://github.com/nrobinson2000/neopo/releases/download/0.0.3/gcc-arm-v9.2.1-aarch64.tar.gz", + "sha256": "83526b6512ff59a5130dcb24603d60f10120c0f5409d23bd7417b19e1328a163" + } }, - "9.2.1": { - "url": "https://github.com/nrobinson2000/neopo/releases/download/0.0.2/gcc-arm-v9.2.1-raspberry-pi.tar.gz", - "sha256": "d963b551122d57057aaacc82e61ca6a05a524df14bb9fe28ca55b67494639fce" - } + + "armv7l": { + "5.3.1": { + "url": "https://github.com/nrobinson2000/neopo/releases/download/0.0.1/gcc-arm-v5.3.1-raspberry-pi.tar.gz", + "sha256": "5ff9b9406da9be17c17e0ec475f092b211cd158d826423d17c9fe6d1215db301" + }, + "9.2.1": { + "url": "https://github.com/nrobinson2000/neopo/releases/download/0.0.2/gcc-arm-v9.2.1-raspberry-pi.tar.gz", + "sha256": "d963b551122d57057aaacc82e61ca6a05a524df14bb9fe28ca55b67494639fce" + }} } # Windows tricks @@ -323,12 +336,13 @@ def installOrUpdate(install, force): system = platform.system().lower() for dep in dependencies: depJSON.append(data[dep][system]["x64"][0]) - # To support Raspberry Pi use my precompiled gcc-arm toolchain - if platform.machine() == "armv7l": + # Use my precompiled gcc-arm for ARM + installPlatform = platform.machine() + if installPlatform != "x86_64": for dep in depJSON: if dep["name"] == "gcc-arm": - dep["url"] = RPI_GCC_ARM[dep["version"]]["url"] - dep["sha256"] = RPI_GCC_ARM[dep["version"]]["sha256"] + dep["url"] = ARM_GCC_ARM[installPlatform][dep["version"]]["url"] + dep["sha256"] = ARM_GCC_ARM[installPlatform][dep["version"]]["sha256"] break # Update JSON cache files @@ -541,11 +555,12 @@ def getCompilerData(version): system = platform.system().lower() compilers = data[system]["x64"] + installPlatform = platform.machine() for compiler in compilers: if compiler["version"] == version: - if platform.machine() == "armv7l": - compiler["url"] = RPI_GCC_ARM[version]["url"] - compiler["sha256"] = RPI_GCC_ARM[version]["sha256"] + if installPlatform != "x86_64": + compiler["url"] = ARM_GCC_ARM[installPlatform][version]["url"] + compiler["sha256"] = ARM_GCC_ARM[installPlatform][version]["sha256"] return compiler return False