build_darwin.sh 903 B

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