Repository navigation
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·135 lines (108 loc) · 4.16 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·135 lines (108 loc) · 4.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/usr/bin/env bash
set -euo pipefail
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
BOLD='\033[1m'
RESET='\033[0m'
ok() { printf " ${GREEN}✓${RESET} %s\n" "$1"; }
warn() { printf " ${YELLOW}!${RESET} %s\n" "$1"; }
fail() { printf " ${RED}✗${RESET} %s\n" "$1"; }
cd "$(dirname "$0")"
printf "\n${BOLD}vkQuake + RmlUI — Setup${RESET}\n\n"
# ── 1. Check system dependencies ──────────────────────────────────
printf "${BOLD}Checking dependencies...${RESET}\n"
missing=()
check_cmd() {
if command -v "$1" &>/dev/null; then
ok "$1"
else
fail "$1 — not found"
missing+=("$1")
fi
}
check_pkg() {
if pkg-config --exists "$1" 2>/dev/null; then
ok "$1 ($(pkg-config --modversion "$1"))"
else
fail "$1 — not found"
missing+=("$1")
fi
}
check_cmd cmake
check_cmd meson
check_cmd ninja
check_cmd glslangValidator
check_cmd curl
check_cmd unzip
check_cmd pkg-config
check_pkg sdl2
check_pkg vulkan
check_pkg freetype2
if [ ${#missing[@]} -gt 0 ]; then
printf "\n${RED}Missing dependencies:${RESET} ${missing[*]}\n"
if command -v pacman &>/dev/null; then
printf "\nInstall with:\n"
printf " ${BOLD}sudo pacman -S cmake meson ninja sdl2 vulkan-devel glslang freetype2 curl unzip${RESET}\n\n"
elif command -v brew &>/dev/null; then
printf "\nInstall with:\n"
printf " ${BOLD}brew install cmake meson ninja sdl2 molten-vk vulkan-headers glslang freetype${RESET}\n\n"
fi
exit 1
fi
# ── 2. Initialize RmlUI submodule ─────────────────────────────────
printf "\n${BOLD}Checking RmlUI submodule...${RESET}\n"
if [ -f lib/rmlui/CMakeLists.txt ]; then
ok "RmlUI submodule already initialized"
else
warn "RmlUI submodule not initialized — cloning..."
git submodule update --init lib/rmlui
if [ -f lib/rmlui/CMakeLists.txt ]; then
ok "RmlUI submodule initialized"
else
fail "Failed to initialize RmlUI submodule"
exit 1
fi
fi
# ── 3. Ensure LibreQuake PAK files ──────────────────────────────
printf "\n${BOLD}Checking LibreQuake assets...${RESET}\n"
PAK_DIR="id1"
LEGACY_PAK_DIR="external/assets/id1"
PAK_URL="https://github.com/lavenderdotpet/LibreQuake/releases/download/v0.09-beta/full.zip"
if [ -f "$PAK_DIR/pak0.pak" ]; then
ok "PAK files already present"
elif [ -f "$LEGACY_PAK_DIR/pak0.pak" ]; then
warn "Found legacy PAK path at $LEGACY_PAK_DIR — migrating to $PAK_DIR"
mkdir -p "$PAK_DIR"
cp "$LEGACY_PAK_DIR"/pak*.pak "$PAK_DIR"/
ok "PAK files migrated from legacy path"
else
warn "PAK files missing — downloading LibreQuake..."
tmpdir=$(mktemp -d)
trap "rm -rf '$tmpdir'" EXIT
curl -L --fail --progress-bar "$PAK_URL" -o "$tmpdir/librequake.zip"
unzip -q "$tmpdir/librequake.zip" -d "$tmpdir/librequake"
mkdir -p "$PAK_DIR"
if ! cp "$tmpdir/librequake/full/id1/pak"*.pak "$PAK_DIR/" 2>/dev/null; then
fail "PAK files not found in expected zip structure"
exit 1
fi
ok "PAK files downloaded and extracted"
fi
# ── 4. Dev tooling (clang-format 17 for CI-matching format checks) ─
printf "\n${BOLD}Checking dev tooling...${RESET}\n"
if [ -x .venv/bin/clang-format ]; then
ok "clang-format 17 already installed (.venv/)"
elif command -v python3 &>/dev/null; then
warn "Installing clang-format 17 into .venv/..."
python3 -m venv .venv
.venv/bin/pip install -q clang-format==17.0.6
ok "clang-format 17 installed — use 'make format' / 'make format-check'"
else
warn "python3 not found — skipping clang-format 17 install (optional)"
fi
# ── 5. Summary ────────────────────────────────────────────────────
printf "\n${GREEN}${BOLD}Ready!${RESET} Build and run with:\n"
printf " ${BOLD}make run${RESET}\n\n"
printf "To compile QuakeC or maps, install optional tools with:\n"
printf " ${BOLD}./scripts/setup-tools.sh${RESET}\n\n"