ollama/scripts/build_darwin.sh

23 lines
972 B
Bash
Raw Normal View History

2023-07-28 16:38:48 +00:00
#!/bin/bash
mkdir -p dist
2023-07-28 19:23:50 +00:00
# build universal binary
CGO_ENABLED=1 GOARCH=arm64 go build -o dist/ollama-darwin-arm64
CGO_ENABLED=1 GOARCH=amd64 go build -o dist/ollama-darwin-amd64
lipo -create -output dist/ollama dist/ollama-darwin-arm64 dist/ollama-darwin-amd64
rm dist/ollama-darwin-amd64 dist/ollama-darwin-arm64
2023-07-28 19:23:50 +00:00
codesign --deep --force --options=runtime --sign "$APPLE_IDENTITY" --timestamp dist/ollama
2023-07-28 16:38:48 +00:00
# build and sign the mac app
2023-08-01 21:39:04 +00:00
npm install --prefix app
2023-07-28 16:38:48 +00:00
npm run --prefix app make:sign
2023-07-29 17:13:10 +00:00
cp app/out/make/zip/darwin/universal/Ollama-darwin-universal-${VERSION:-0.0.0}.zip dist/Ollama-darwin.zip
2023-07-28 16:38:48 +00:00
2023-07-28 19:23:50 +00:00
# sign the binary and rename it
codesign -f --timestamp -s "$APPLE_IDENTITY" --identifier ai.ollama.ollama --options=runtime dist/ollama
ditto -c -k --keepParent dist/ollama dist/temp.zip
xcrun notarytool submit dist/temp.zip --wait --timeout 10m --apple-id $APPLE_ID --password $APPLE_PASSWORD --team-id $APPLE_TEAM_ID
2023-07-28 16:38:48 +00:00
mv dist/ollama dist/ollama-darwin
2023-07-28 19:23:50 +00:00
rm dist/temp.zip