-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable arm builds for OPA envoy plugin
Signed-off-by: Tyler Schade <tyler.schade@solo.io>
- Loading branch information
1 parent
b374ea9
commit ab360ef
Showing
5 changed files
with
184 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ opa_* | |
_release | ||
site.tar.gz | ||
*.bak | ||
.go/ | ||
|
||
# runtime artifacts | ||
policies | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/usr/bin/env bash | ||
set -eo pipefail | ||
|
||
case "$(uname -m | tr '[:upper:]' '[:lower:]')" in | ||
amd64 | x86_64 | x64) | ||
HOST_ARCH=amd64 | ||
;; | ||
arm64 | aarch64) | ||
HOST_ARCH=arm64 | ||
;; | ||
*) | ||
echo "Error: Host architecture not supported." >&2 | ||
exit 1 | ||
;; | ||
esac | ||
|
||
# Native build | ||
if [ "${GOARCH}" = "${HOST_ARCH}" ]; then | ||
if ! [ -x "$(command -v gcc)" ]; then | ||
echo "Error: gcc not found." >&2 | ||
exit 1 | ||
fi | ||
exit 0 | ||
fi | ||
|
||
# Cross-compile | ||
case "${GOARCH}" in | ||
amd64) | ||
PKG=gcc-x86-64-linux-gnu | ||
CC=x86_64-linux-gnu-gcc | ||
;; | ||
arm64) | ||
PKG=gcc-aarch64-linux-gnu | ||
CC=aarch64-linux-gnu-gcc | ||
;; | ||
*) | ||
echo "Error: Target architecture ${GOARCH} not supported." >&2 | ||
exit 1 | ||
;; | ||
esac | ||
|
||
type -f ${CC} 2>/dev/null && exit 0 | ||
|
||
if ! [ -x "$(command -v apt-get)" ]; then | ||
echo "Error: apt-get not found. Could not install missing toolchain." >&2 | ||
exit 1 | ||
fi | ||
|
||
apt-get update >/dev/null && \ | ||
apt-get install -y ${PKG} >/dev/null | ||
|
||
echo ${CC} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters