fix: support webkit2gtk-4.1 (Ubuntu 24.04) in Linux build script

- Detect webkit2gtk-4.1 and add webkit2_41 build tag for Wails
- Accept either webkit2gtk-4.0 or 4.1 in prerequisite check
- Use CGO_ENABLED=0 + notray for server build (consistent with GoReleaser)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
jim800121chen 2026-03-24 21:48:01 +08:00
parent e46d179165
commit 75885c5691

View File

@ -43,7 +43,10 @@ command -v wails >/dev/null 2>&1 || missing+=("Wails (go install github.com/wa
# Check Wails Linux dependencies
pkg-config --exists gtk+-3.0 2>/dev/null || missing+=("libgtk-3-dev (sudo apt-get install libgtk-3-dev)")
pkg-config --exists webkit2gtk-4.0 2>/dev/null || missing+=("libwebkit2gtk-4.0-dev (sudo apt-get install libwebkit2gtk-4.0-dev)")
# Ubuntu 24.04+ uses webkit2gtk-4.1, older versions use 4.0
if ! pkg-config --exists webkit2gtk-4.1 2>/dev/null && ! pkg-config --exists webkit2gtk-4.0 2>/dev/null; then
missing+=("libwebkit2gtk-4.1-dev (sudo apt-get install libwebkit2gtk-4.1-dev)")
fi
if [ ${#missing[@]} -gt 0 ]; then
echo -e "${RED}Missing prerequisites:${NC}"
@ -77,7 +80,8 @@ step "3/5 Building server"
mkdir -p dist
cd server
CGO_ENABLED=1 go build \
CGO_ENABLED=0 go build \
-tags notray \
-ldflags="-s -w" \
-o ../dist/edge-ai-server \
main.go
@ -124,7 +128,15 @@ info "Payload staged: $file_count files."
step "5/5 Building Wails installer"
cd installer
wails build -clean
# Ubuntu 24.04+ uses webkit2gtk-4.1; Wails needs a build tag for it
WAILS_EXTRA_TAGS=""
if pkg-config --exists webkit2gtk-4.1 2>/dev/null && ! pkg-config --exists webkit2gtk-4.0 2>/dev/null; then
WAILS_EXTRA_TAGS="-tags webkit2_41"
info "Detected webkit2gtk-4.1, using webkit2_41 build tag"
fi
wails build -clean $WAILS_EXTRA_TAGS
cd "$BASE_DIR"
output="installer/build/bin/EdgeAI-Installer"