|
2 | 2 | GOTEST=$(GOCMD) test
|
3 | 3 | GOVET=$(GOCMD) vet
|
4 | 4 | BINARY_NAME=local-ai
|
| 5 | +LAUNCHER_BINARY_NAME=local-ai-launcher |
5 | 6 |
|
6 | 7 | GORELEASER?=
|
7 | 8 |
|
@@ -90,7 +91,17 @@ build: protogen-go install-go-tools ## Build the project
|
90 | 91 | $(info ${GREEN}I LD_FLAGS: ${YELLOW}$(LD_FLAGS)${RESET})
|
91 | 92 | $(info ${GREEN}I UPX: ${YELLOW}$(UPX)${RESET})
|
92 | 93 | rm -rf $(BINARY_NAME) || true
|
93 |
| - CGO_LDFLAGS="$(CGO_LDFLAGS)" $(GOCMD) build -ldflags "$(LD_FLAGS)" -tags "$(GO_TAGS)" -o $(BINARY_NAME) ./ |
| 94 | + CGO_LDFLAGS="$(CGO_LDFLAGS)" $(GOCMD) build -ldflags "$(LD_FLAGS)" -tags "$(GO_TAGS)" -o $(BINARY_NAME) ./cli/local-ai |
| 95 | + |
| 96 | +build-launcher: ## Build the launcher application |
| 97 | + $(info ${GREEN}I local-ai launcher build info:${RESET}) |
| 98 | + $(info ${GREEN}I BUILD_TYPE: ${YELLOW}$(BUILD_TYPE)${RESET}) |
| 99 | + $(info ${GREEN}I GO_TAGS: ${YELLOW}$(GO_TAGS)${RESET}) |
| 100 | + $(info ${GREEN}I LD_FLAGS: ${YELLOW}$(LD_FLAGS)${RESET}) |
| 101 | + rm -rf $(LAUNCHER_BINARY_NAME) || true |
| 102 | + CGO_LDFLAGS="$(CGO_LDFLAGS)" $(GOCMD) build -ldflags "$(LD_FLAGS)" -tags "$(GO_TAGS)" -o $(LAUNCHER_BINARY_NAME) ./ |
| 103 | + |
| 104 | +build-all: build build-launcher ## Build both server and launcher |
94 | 105 |
|
95 | 106 | dev-dist:
|
96 | 107 | $(GORELEASER) build --snapshot --clean
|
@@ -499,3 +510,59 @@ docs-clean:
|
499 | 510 | .PHONY: docs
|
500 | 511 | docs: docs/static/gallery.html
|
501 | 512 | cd docs && hugo serve
|
| 513 | + |
| 514 | +######################################################## |
| 515 | +## Platform-specific builds |
| 516 | +######################################################## |
| 517 | + |
| 518 | +# macOS builds |
| 519 | +build-launcher-darwin-amd64: ## Build launcher for macOS AMD64 |
| 520 | + GOOS=darwin GOARCH=amd64 CGO_ENABLED=1 $(GOCMD) build -ldflags "$(LD_FLAGS)" -o $(LAUNCHER_BINARY_NAME)-darwin-amd64 ./ |
| 521 | + |
| 522 | +build-launcher-darwin-arm64: ## Build launcher for macOS ARM64 |
| 523 | + GOOS=darwin GOARCH=arm64 CGO_ENABLED=1 $(GOCMD) build -ldflags "$(LD_FLAGS)" -o $(LAUNCHER_BINARY_NAME)-darwin-arm64 ./ |
| 524 | + |
| 525 | +# Linux builds |
| 526 | +build-launcher-linux-amd64: ## Build launcher for Linux AMD64 |
| 527 | + GOOS=linux GOARCH=amd64 CGO_ENABLED=1 $(GOCMD) build -ldflags "$(LD_FLAGS)" -o $(LAUNCHER_BINARY_NAME)-linux-amd64 ./ |
| 528 | + |
| 529 | +build-launcher-linux-arm64: ## Build launcher for Linux ARM64 |
| 530 | + GOOS=linux GOARCH=arm64 CGO_ENABLED=1 $(GOCMD) build -ldflags "$(LD_FLAGS)" -o $(LAUNCHER_BINARY_NAME)-linux-arm64 ./ |
| 531 | + |
| 532 | +# Windows builds |
| 533 | +build-launcher-windows-amd64: ## Build launcher for Windows AMD64 |
| 534 | + GOOS=windows GOARCH=amd64 CGO_ENABLED=1 $(GOCMD) build -ldflags "$(LD_FLAGS)" -o $(LAUNCHER_BINARY_NAME)-windows-amd64.exe ./ |
| 535 | + |
| 536 | +# macOS DMG creation (requires macOS) |
| 537 | +create-dmg: build-launcher-darwin-amd64 build-launcher-darwin-arm64 ## Create macOS DMG |
| 538 | +ifeq ($(OS),Darwin) |
| 539 | + @echo "Creating macOS DMG package..." |
| 540 | + mkdir -p dist/LocalAI-Launcher |
| 541 | + cp $(LAUNCHER_BINARY_NAME)-darwin-$(shell uname -m) dist/LocalAI-Launcher/LocalAI-Launcher |
| 542 | + ln -sf /Applications dist/LocalAI-Launcher/Applications |
| 543 | + hdiutil create -volname "LocalAI Launcher" -srcfolder dist/LocalAI-Launcher -ov -format UDZO dist/LocalAI-Launcher.dmg |
| 544 | + rm -rf dist/LocalAI-Launcher |
| 545 | + @echo "DMG created: dist/LocalAI-Launcher.dmg" |
| 546 | +else |
| 547 | + @echo "DMG creation requires macOS" |
| 548 | +endif |
| 549 | + |
| 550 | +# Linux package creation |
| 551 | +create-linux-package: build-launcher-linux-amd64 build-launcher-linux-arm64 ## Create Linux packages |
| 552 | + @echo "Creating Linux packages..." |
| 553 | + mkdir -p dist/linux-amd64/usr/local/bin |
| 554 | + mkdir -p dist/linux-arm64/usr/local/bin |
| 555 | + cp $(LAUNCHER_BINARY_NAME)-linux-amd64 dist/linux-amd64/usr/local/bin/local-ai-launcher |
| 556 | + cp $(LAUNCHER_BINARY_NAME)-linux-arm64 dist/linux-arm64/usr/local/bin/local-ai-launcher |
| 557 | + chmod +x dist/linux-amd64/usr/local/bin/local-ai-launcher |
| 558 | + chmod +x dist/linux-arm64/usr/local/bin/local-ai-launcher |
| 559 | + cd dist && tar -czf LocalAI-Launcher-linux-amd64.tar.gz -C linux-amd64 . |
| 560 | + cd dist && tar -czf LocalAI-Launcher-linux-arm64.tar.gz -C linux-arm64 . |
| 561 | + rm -rf dist/linux-amd64 dist/linux-arm64 |
| 562 | + @echo "Linux packages created in dist/" |
| 563 | + |
| 564 | +# Cross-platform builds |
| 565 | +build-launcher-all: build-launcher-darwin-amd64 build-launcher-darwin-arm64 build-launcher-linux-amd64 build-launcher-linux-arm64 build-launcher-windows-amd64 ## Build launcher for all platforms |
| 566 | + |
| 567 | +# Package creation for all platforms |
| 568 | +package-launcher: build-launcher-all create-dmg create-linux-package ## Create packages for all platforms |
0 commit comments