From d79ae103add7664c2582e6e010182dc6b4ba7053 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Mon, 22 Mar 2021 21:44:24 +0000 Subject: [PATCH] Build for amd64 and arm64 on macOS --- build/macos.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/build/macos.sh b/build/macos.sh index b40f392f..c0019b10 100755 --- a/build/macos.sh +++ b/build/macos.sh @@ -1,6 +1,24 @@ #!/usr/bin/env bash VERS=$(git describe --tags --abbrev=0) +NAME=surreal-${VERS}.darwin-universal +HASH=${NAME}.txt +FILE=${NAME}.tgz + +GOOS=darwin GOARCH=amd64 go build -v -o surreal-amd64 -ldflags "$(bash build/flags.sh)" +GOOS=darwin GOARCH=arm64 go build -v -o surreal-arm64 -ldflags "$(bash build/flags.sh)" +lipo -create -output surreal surreal-amd64 surreal-arm64 +tar -zcvf $FILE -s "#^#${NAME}/#" surreal + +echo $(shasum -a 256 $FILE | cut -f1 -d' ') > $HASH + +aws s3 cp --region eu-west-2 --cache-control "no-store" ./$FILE s3://download.surrealdb.com/ +aws s3 cp --region eu-west-2 --cache-control "no-store" ./$HASH s3://download.surrealdb.com/ + +rm -rf $FILE $HASH surreal.exe surreal surreal-amd64 surreal-arm64 + +# amd64 + NAME=surreal-${VERS}.darwin-amd64 HASH=${NAME}.txt FILE=${NAME}.tgz @@ -14,3 +32,19 @@ aws s3 cp --region eu-west-2 --cache-control "no-store" ./$FILE s3://download.su aws s3 cp --region eu-west-2 --cache-control "no-store" ./$HASH s3://download.surrealdb.com/ rm -rf $FILE $HASH surreal.exe surreal + +# arm64 + +NAME=surreal-${VERS}.darwin-arm64 +HASH=${NAME}.txt +FILE=${NAME}.tgz + +GOOS=darwin GOARCH=amd64 go build -v -ldflags "$(bash build/flags.sh)" +tar -zcvf $FILE -s "#^#${NAME}/#" surreal + +echo $(shasum -a 256 $FILE | cut -f1 -d' ') > $HASH + +aws s3 cp --region eu-west-2 --cache-control "no-store" ./$FILE s3://download.surrealdb.com/ +aws s3 cp --region eu-west-2 --cache-control "no-store" ./$HASH s3://download.surrealdb.com/ + +rm -rf $FILE $HASH surreal.exe surreal