2023-07-28 16:38:48 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
mkdir -p dist
|
|
|
|
|
2023-08-22 01:24:42 +00:00
|
|
|
GO_LDFLAGS="-X github.com/jmorganca/ollama/version.Version=$VERSION"
|
2023-08-22 16:48:35 +00:00
|
|
|
GO_LDFLAGS="$GO_LDFLAGS -X github.com/jmorganca/ollama/server.mode=release"
|
2023-08-22 01:24:42 +00:00
|
|
|
|
2023-07-28 19:23:50 +00:00
|
|
|
# build universal binary
|
2023-09-05 16:53:57 +00:00
|
|
|
GOARCH=arm64 go generate ./...
|
|
|
|
GOARCH=arm64 go build -ldflags "$GO_LDFLAGS" -o dist/ollama-darwin-arm64
|
2023-09-11 20:31:46 +00:00
|
|
|
rm -rf llm/llama.cpp/*/build/*/bin
|
2023-09-05 16:53:57 +00:00
|
|
|
GOARCH=amd64 go generate ./...
|
|
|
|
GOARCH=amd64 go build -ldflags "$GO_LDFLAGS" -o dist/ollama-darwin-amd64
|
2023-08-01 00:50:30 +00: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 19:23:50 +00:00
|
|
|
codesign --deep --force --options=runtime --sign "$APPLE_IDENTITY" --timestamp dist/ollama
|
2023-08-07 22:10:37 +00:00
|
|
|
chmod +x 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
|