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