From 2c6ad1e699efdae733217bbdb7b96b5a1cf1dde9 Mon Sep 17 00:00:00 2001 From: Alexander Schneider Date: Mon, 29 Apr 2024 15:09:05 +0200 Subject: [PATCH] Add arm --- lib/download-neko-task.js | 16 +++++++++++++--- lib/haxe-url.js | 11 ++++++++++- package.json | 3 ++- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/lib/download-neko-task.js b/lib/download-neko-task.js index 8bcabd1..40a825c 100644 --- a/lib/download-neko-task.js +++ b/lib/download-neko-task.js @@ -10,13 +10,19 @@ DownloadNekoTask.prototype.run = function(executeNextStep) { console.log("Getting NekoVM " + this.nekoVersion ); var version = this.nekoVersion.split('.').join('-'); var osPlatform = os.platform() - var plateform=""; + var plateform= ""; + var arch = os.arch(); + switch ( osPlatform ) { case 'linux': plateform = 'linux.tar.gz'; - if( os.arch() == 'x64' ) { + + if (arch === 'x64') { plateform = 'linux64.tar.gz'; + } else if (arch === 'arm64') { + plateform = 'arm64'; } + break; case 'darwin': plateform = 'osx64.tar.gz'; @@ -31,8 +37,12 @@ DownloadNekoTask.prototype.run = function(executeNextStep) { console.error('Haxe is not compatible with your platform'); throw 'error'; } - var url = "https://github.com/HaxeFoundation/neko/releases/download/v"+version+"/neko-"+this.nekoVersion+"-"+plateform; + + var url = plateform === 'arm64' + ? "https://build.haxe.org/builds/neko/linux-arm64/neko_latest.tar.gz" + : "https://github.com/HaxeFoundation/neko/releases/download/v"+version+"/neko-"+this.nekoVersion+"-"+plateform; var cache = new Cache(); + cache.download( url , vars.neko.dir, executeNextStep, (err) => { if (osPlatform == 'win64'){ // fallback to win32 diff --git a/lib/haxe-url.js b/lib/haxe-url.js index d2a193c..3e792ef 100644 --- a/lib/haxe-url.js +++ b/lib/haxe-url.js @@ -5,8 +5,14 @@ module.exports = function ( platform, arch, majorVersion, nightly ) { var isNightly = !!nightly; var url; + + if (platform === 'linux' && arch === 'arm64') { + isNightly = true; + nightly = nightly || 'latest'; + } + switch ( isNightly ) { - case true: + case true: url = 'https://build.haxe.org/builds/haxe/'; switch( platform ) { case 'linux': @@ -18,6 +24,9 @@ module.exports = function ( platform, arch, majorVersion, nightly ) { case 'ia32': url += '32'; break; + case 'arm64': + url += '-arm64'; + break; } break; case 'darwin': diff --git a/package.json b/package.json index c120e31..9340196 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,8 @@ ], "cpu": [ "x64", - "ia32" + "ia32", + "arm64" ], "engines" : { "node" : ">=8.0.0" }, "dependencies": {