Skip to content

Commit

Permalink
Fetch the correct architecture mutagen binary for the host
Browse files Browse the repository at this point in the history
In MacOS M1's case though amd64 is the host architecture, but support linux aarch64 still
  • Loading branch information
andytson-inviqa committed Nov 5, 2021
1 parent 301c0a6 commit c883d99
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/_base/harness/scripts/latest-mutagen-release.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,19 @@
throw new Exception('Could not find latest stable release.');
}

$goArchMap = [
'i386' => '386',
'x86_64' => 'amd64',
'aarch64' => 'arm64',
'armv7l' => 'armv7',
'armv6l' => 'armv6',
];

$osFamily = strtolower(PHP_OS_FAMILY);
$releaseAssets = array_filter($latestStableRelease['assets'], function ($asset) use ($osFamily) {
return preg_match("/^mutagen_.*${osFamily}.*amd64.*/", $asset['name']) > 0;
$hostArch = php_uname('m');
$goArch = $goArchMap[php_uname('m')] ?? $hostArch;
$releaseAssets = array_filter($latestStableRelease['assets'], function ($asset) use ($osFamily, $goArch) {
return preg_match("/^mutagen_.*${osFamily}.*${goArch}.*/", $asset['name']) > 0;
});
$releaseAsset = reset($releaseAssets);
if (!$releaseAsset) {
Expand Down

0 comments on commit c883d99

Please sign in to comment.