Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support installation for arm64 architecture #452

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions npm_publish/postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ var path = require('path'),
var ARCH_MAPPING = {
"ia32": "386",
"x64": "amd64",
"arm": "arm"
"arm": "arm",
"arm64": "arm64"
};

// Mapping between Node's `process.platform` to Golang's
Expand Down Expand Up @@ -86,11 +87,9 @@ function validateConfiguration(packageJson) {
}

function parsePackageJson() {
if (process.arch !== "arm64" && process.platform !== "darwin") {
if (!(process.arch in ARCH_MAPPING)) {
console.error("Installation is not supported for this architecture: " + process.arch);
return;
}
if (!(process.arch in ARCH_MAPPING)) {
console.error("Installation is not supported for this architecture: " + process.arch);
return;
}

if (!(process.platform in PLATFORM_MAPPING)) {
Expand Down Expand Up @@ -146,10 +145,6 @@ async function install(callback) {
mkdirp.sync(opts.binPath);
console.info(`Copying the relevant binary for your platform ${process.platform}`);
let src = `./dist/go-ios-${PLATFORM_MAPPING[process.platform]}-${ARCH_MAPPING[process.arch]}_${PLATFORM_MAPPING[process.platform]}_${ARCH_MAPPING[process.arch]}/${opts.binName}`;
if (process.arch === "arm64" && process.platform === "darwin") {
console.log("using amd64 build on M1 mac")
src = `./dist/go-ios-${process.platform}-amd64_${process.platform}_amd64/${opts.binName}`;
}

if (process.arch === "ia32" && process.platform === "w32") {
src = `./dist/go-ios-${PLATFORM_MAPPING[process.platform]}-amd64_${PLATFORM_MAPPING[process.platform]}_amd64/${opts.binName}`;
Expand Down
Loading