2023-07-28 12:38:48 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
mkdir -p dist
|
|
|
|
|
2023-08-21 18:24:42 -07:00
|
|
|
GO_LDFLAGS="-X github.com/jmorganca/ollama/version.Version=$VERSION"
|
2023-08-22 09:48:35 -07:00
|
|
|
GO_LDFLAGS="$GO_LDFLAGS -X github.com/jmorganca/ollama/server.mode=release"
|
2023-08-21 18:24:42 -07:00
|
|
|
|
2023-07-28 12:23:50 -07:00
|
|
|
# build universal binary
|
2023-09-05 12:53:57 -04:00
|
|
|
GOARCH=arm64 go generate ./...
|
|
|
|
GOARCH=arm64 go build -ldflags "$GO_LDFLAGS" -o dist/ollama-darwin-arm64
|
2023-09-11 16:31:46 -04:00
|
|
|
rm -rf llm/llama.cpp/*/build/*/bin
|
2023-09-05 12:53:57 -04:00
|
|
|
GOARCH=amd64 go generate ./...
|
|
|
|
GOARCH=amd64 go build -ldflags "$GO_LDFLAGS" -o dist/ollama-darwin-amd64
|
2023-07-31 20:50:30 -04:00
|
|
|
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 12:23:50 -07:00
|
|
|
codesign --deep --force --options=runtime --sign "$APPLE_IDENTITY" --timestamp dist/ollama
|
2023-08-07 18:10:37 -04:00
|
|
|
chmod +x dist/ollama
|
2023-07-28 12:38:48 -04:00
|
|
|
|
|
|
|
# build and sign the mac app
|
2023-08-01 17:39:04 -04:00
|
|
|
npm install --prefix app
|
2023-07-28 12:38:48 -04:00
|
|
|
npm run --prefix app make:sign
|
2023-07-29 10:13:10 -07:00
|
|
|
cp app/out/make/zip/darwin/universal/Ollama-darwin-universal-${VERSION:-0.0.0}.zip dist/Ollama-darwin.zip
|
2023-07-28 12:38:48 -04:00
|
|
|
|
2023-07-28 12:23:50 -07: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 12:38:48 -04:00
|
|
|
mv dist/ollama dist/ollama-darwin
|
2023-07-28 12:23:50 -07:00
|
|
|
rm dist/temp.zip
|