build_darwin.sh 972 B

12345678910111213141516171819202122
  1. #!/bin/bash
  2. mkdir -p dist
  3. # build universal binary
  4. CGO_ENABLED=1 GOARCH=arm64 go build -o dist/ollama-darwin-arm64
  5. CGO_ENABLED=1 GOARCH=amd64 go build -o dist/ollama-darwin-amd64
  6. lipo -create -output dist/ollama dist/ollama-darwin-arm64 dist/ollama-darwin-amd64
  7. rm dist/ollama-darwin-amd64 dist/ollama-darwin-arm64
  8. codesign --deep --force --options=runtime --sign "$APPLE_IDENTITY" --timestamp dist/ollama
  9. # build and sign the mac app
  10. npm install --prefix app
  11. npm run --prefix app make:sign
  12. cp app/out/make/zip/darwin/universal/Ollama-darwin-universal-${VERSION:-0.0.0}.zip dist/Ollama-darwin.zip
  13. # sign the binary and rename it
  14. codesign -f --timestamp -s "$APPLE_IDENTITY" --identifier ai.ollama.ollama --options=runtime dist/ollama
  15. ditto -c -k --keepParent dist/ollama dist/temp.zip
  16. xcrun notarytool submit dist/temp.zip --wait --timeout 10m --apple-id $APPLE_ID --password $APPLE_PASSWORD --team-id $APPLE_TEAM_ID
  17. mv dist/ollama dist/ollama-darwin
  18. rm dist/temp.zip