build_darwin.sh 903 Bytes
Newer Older
Jeffrey Morgan's avatar
Jeffrey Morgan committed
1
2
3
4
#!/bin/bash

mkdir -p dist

5
# build universal binary
Jeffrey Morgan's avatar
Jeffrey Morgan committed
6
7
8
9
CGO_ENABLED=1 GOARCH=arm64 go build -o dist/ollama_arm64
CGO_ENABLED=1 GOARCH=amd64 go build -o dist/ollama_amd64
lipo -create -output dist/ollama dist/ollama_arm64 dist/ollama_amd64
rm dist/ollama_amd64 dist/ollama_arm64
10
codesign --deep --force --options=runtime --sign "$APPLE_IDENTITY" --timestamp dist/ollama
Jeffrey Morgan's avatar
Jeffrey Morgan committed
11
12
13

# build and sign the mac app
npm run --prefix app make:sign
14
cp app/out/make/zip/darwin/universal/Ollama-darwin-universal-${VERSION:-0.0..zip dist/Ollama-darwin.zip
Jeffrey Morgan's avatar
Jeffrey Morgan committed
15

16
17
18
19
# 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
Jeffrey Morgan's avatar
Jeffrey Morgan committed
20
mv dist/ollama dist/ollama-darwin
21
rm dist/temp.zip