build_darwin.sh 993 B

1234567891011121314151617181920212223
  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. chmod +x dist/ollama
  10. # build and sign the mac app
  11. npm install --prefix app
  12. npm run --prefix app make:sign
  13. cp app/out/make/zip/darwin/universal/Ollama-darwin-universal-${VERSION:-0.0.0}.zip dist/Ollama-darwin.zip
  14. # sign the binary and rename it
  15. codesign -f --timestamp -s "$APPLE_IDENTITY" --identifier ai.ollama.ollama --options=runtime dist/ollama
  16. ditto -c -k --keepParent dist/ollama dist/temp.zip
  17. xcrun notarytool submit dist/temp.zip --wait --timeout 10m --apple-id $APPLE_ID --password $APPLE_PASSWORD --team-id $APPLE_TEAM_ID
  18. mv dist/ollama dist/ollama-darwin
  19. rm dist/temp.zip