Skip to content

Commit

Permalink
Fetch the correct architecture mutagen binary for the host (#10)
Browse files Browse the repository at this point in the history
In MacOS M1's case though arm64 is the host architecture, but support linux aarch64 still (MacOS intel is x86_64)
  • Loading branch information
andytson-inviqa authored Nov 19, 2021
1 parent 4649cb6 commit de01946
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions 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' => 'arm',
'armv6l' => 'arm',
];

$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 de01946

Please sign in to comment.