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

Adding arm binaries #37

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion bin/build.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/usr/bin/env bash
package=../example/mongo_client/sidecar.go
package=../../gotask/example/mongo_client/sidecar.go
package_name=mongo-proxy

#the full list of the platforms: https://golang.org/doc/install/source#environment
platforms=(
"darwin/amd64"
"linux/amd64"
"darwin/arm64"
"linux/arm64"
)

for platform in "${platforms[@]}"
Expand Down
Binary file modified bin/mongo-proxy-darwin-amd64
Binary file not shown.
Binary file added bin/mongo-proxy-darwin-arm64
Binary file not shown.
Binary file modified bin/mongo-proxy-linux-amd64
Binary file not shown.
Binary file added bin/mongo-proxy-linux-arm64
Binary file not shown.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"analyse": "phpstan analyse --memory-limit 300M -l 0 ./src",
"cs-fix": "php-cs-fixer fix $1"
},
"bin": ["bin/mongo-proxy-darwin-amd64", "bin/mongo-proxy-linux-amd64"],
"bin": ["bin/mongo-proxy-darwin-amd64", "bin/mongo-proxy-linux-amd64","bin/mongo-proxy-darwin-arm64", "bin/mongo-proxy-linux-arm64"],
"extra": {
"hyperf": {
"config": "Reasno\\Fastmongo\\ConfigProvider"
Expand Down
11 changes: 7 additions & 4 deletions src/DomainConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ public function __construct(ConfigInterface $config)

public function getExecutable(): string
{
if ($this->isMac()) {
return BASE_PATH . '/vendor/bin/mongo-proxy-darwin-amd64';
}
return BASE_PATH . '/vendor/bin/mongo-proxy-linux-amd64';
$os = ($this->isMac()) ? "darwin" : "linux";
$arch = ($this->isArm()) ? "arm64" : "amd64";
return BASE_PATH . '/vendor/bin/mongo-proxy-' . $os . '-' . $arch;
}

public function getArgs(): array
Expand Down Expand Up @@ -73,4 +72,8 @@ private function isMac()
'Darwin',
]);
}
private function isArm()
{
return php_uname('m') === 'aarch64';
}
}