Repository navigation
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·377 lines (320 loc) · 10.8 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·377 lines (320 loc) · 10.8 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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
#!/bin/bash
# Animus Audio Visualizer - Cross-Platform Build Script
#
# This script helps prepare builds for all platforms.
# Processing 4 handles the actual compilation and bundling.
#
# Usage:
# ./build.sh [command] [options]
#
# Commands:
# install - Install prerequisites for current OS
# macos - Build for macOS (calls build-macos.sh for signing)
# windows - Build for Windows
# linux - Build for Linux
# all - Build for all platforms
#
# Options:
# --help - Show this help
set -e
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
APP_NAME="Animus"
VERSION="2.0.0"
# Processing library paths by OS
case "$(uname -s)" in
Darwin) PROCESSING_LIBS="$HOME/Documents/Processing/libraries" ;;
Linux) PROCESSING_LIBS="$HOME/sketchbook/libraries" ;;
MINGW*|CYGWIN*|MSYS*) PROCESSING_LIBS="$HOME/Documents/Processing/libraries" ;;
esac
print_header() {
echo ""
echo -e "${BLUE}=========================================="
echo " $1"
echo -e "==========================================${NC}"
echo ""
}
# Install prerequisites based on OS
install_deps() {
print_header "Installing Prerequisites"
OS="$(uname -s)"
echo "Detected OS: $OS"
echo ""
case "$OS" in
Darwin)
install_macos_deps
;;
Linux)
install_linux_deps
;;
MINGW*|CYGWIN*|MSYS*)
install_windows_deps
;;
*)
echo -e "${RED}Unsupported OS: $OS${NC}"
exit 1
;;
esac
# Install Processing libraries (cross-platform)
install_processing_libs
echo ""
echo -e "${GREEN}All prerequisites installed!${NC}"
}
install_macos_deps() {
echo -e "${BLUE}Installing macOS dependencies...${NC}"
# Check for Homebrew
if ! command -v brew &> /dev/null; then
echo -e "${YELLOW}Installing Homebrew...${NC}"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
else
echo -e "${GREEN}✓ Homebrew${NC}"
fi
# Install Processing
if [ ! -d "/Applications/Processing.app" ] && [ ! -d "$HOME/Applications/Processing.app" ]; then
echo -e "${YELLOW}Installing Processing 4...${NC}"
brew install --cask processing
else
echo -e "${GREEN}✓ Processing${NC}"
fi
}
install_linux_deps() {
echo -e "${BLUE}Installing Linux dependencies...${NC}"
# Detect package manager
if command -v apt-get &> /dev/null; then
PKG_MANAGER="apt"
elif command -v dnf &> /dev/null; then
PKG_MANAGER="dnf"
elif command -v pacman &> /dev/null; then
PKG_MANAGER="pacman"
else
echo -e "${YELLOW}Unknown package manager. Please install Processing manually.${NC}"
return
fi
# Install Java if needed
if ! command -v java &> /dev/null; then
echo -e "${YELLOW}Installing Java...${NC}"
case "$PKG_MANAGER" in
apt) sudo apt-get update && sudo apt-get install -y default-jdk ;;
dnf) sudo dnf install -y java-latest-openjdk ;;
pacman) sudo pacman -S --noconfirm jdk-openjdk ;;
esac
else
echo -e "${GREEN}✓ Java${NC}"
fi
# Check for Processing
if ! command -v processing-java &> /dev/null && [ ! -d "$HOME/processing-4"* ]; then
echo -e "${YELLOW}Processing not found.${NC}"
echo "Please download from: https://processing.org/download"
echo "Extract to ~/processing-4.x.x and add to PATH"
else
echo -e "${GREEN}✓ Processing${NC}"
fi
}
install_windows_deps() {
echo -e "${BLUE}Installing Windows dependencies...${NC}"
# Check for Chocolatey or Scoop
if command -v choco &> /dev/null; then
if ! command -v processing-java &> /dev/null; then
echo -e "${YELLOW}Installing Processing via Chocolatey...${NC}"
choco install processing -y
else
echo -e "${GREEN}✓ Processing${NC}"
fi
elif command -v scoop &> /dev/null; then
if ! command -v processing-java &> /dev/null; then
echo -e "${YELLOW}Installing Processing via Scoop...${NC}"
scoop bucket add extras
scoop install processing
else
echo -e "${GREEN}✓ Processing${NC}"
fi
else
echo -e "${YELLOW}Please install Processing manually:${NC}"
echo " https://processing.org/download"
echo ""
echo "Or install Chocolatey/Scoop for automatic installation:"
echo " Chocolatey: https://chocolatey.org/install"
echo " Scoop: https://scoop.sh"
fi
}
install_processing_libs() {
echo ""
echo -e "${BLUE}Installing Processing libraries...${NC}"
mkdir -p "$PROCESSING_LIBS"
# Install Minim (official URL from Processing contribution manager)
if [ ! -d "$PROCESSING_LIBS/minim" ]; then
echo -e "${YELLOW}Installing Minim...${NC}"
install_lib "minim" "http://code.compartmental.net/minim/distro/minim_for_processing.zip"
else
echo -e "${GREEN}✓ Minim${NC}"
fi
# Install ControlP5 (official URL from Processing contribution manager)
if [ ! -d "$PROCESSING_LIBS/controlP5" ]; then
echo -e "${YELLOW}Installing ControlP5...${NC}"
install_lib "controlP5" "http://www.sojamo.de/libraries/controlP5/controlP5.zip"
else
echo -e "${GREEN}✓ ControlP5${NC}"
fi
}
# Helper to download and install a library with fallbacks
install_lib() {
local name=$1
local url=$2
local tmp="/tmp/${name}.zip"
# Try download
if curl -fsSL -o "$tmp" "$url" 2>/dev/null && unzip -t "$tmp" &>/dev/null; then
unzip -q "$tmp" -d "$PROCESSING_LIBS/"
rm -f "$tmp"
echo -e "${GREEN} ✓ $name installed${NC}"
else
rm -f "$tmp"
echo -e "${RED} Failed to download $name${NC}"
echo -e "${YELLOW} Install manually: Processing → Sketch → Import Library → Manage Libraries → '$name'${NC}"
fi
}
check_processing() {
# Check for Processing installation
if command -v processing-java &> /dev/null; then
echo -e "${GREEN}Found processing-java CLI${NC}"
return 0
fi
# Check common installation paths
PROCESSING_PATHS=(
"/Applications/Processing.app/Contents/MacOS/processing-java"
"$HOME/Applications/Processing.app/Contents/MacOS/processing-java"
"/usr/local/bin/processing-java"
"$HOME/processing-4.3/processing-java"
)
for path in "${PROCESSING_PATHS[@]}"; do
if [ -x "$path" ]; then
echo -e "${GREEN}Found Processing at: $path${NC}"
PROCESSING_JAVA="$path"
return 0
fi
done
echo -e "${YELLOW}processing-java CLI not found${NC}"
echo "Run: ./build.sh install"
echo ""
return 1
}
build_platform() {
local platform=$1
local output_dir="build/$platform"
print_header "Building for $platform"
# Create output directory
mkdir -p "$output_dir"
if [ -n "$PROCESSING_JAVA" ] || command -v processing-java &> /dev/null; then
# Use CLI if available
local cli="${PROCESSING_JAVA:-processing-java}"
echo "Exporting with processing-java CLI..."
"$cli" --sketch="$(pwd)" --output="$output_dir" --platform="$platform" --export
echo -e "${GREEN}Export complete: $output_dir${NC}"
else
echo -e "${YELLOW}Manual export required:${NC}"
echo "1. Open Animus.pde in Processing 4"
echo "2. File → Export Application"
echo "3. Select '$platform' platform"
echo "4. Check 'Embed Java' if available"
echo "5. Export to: $(pwd)/$output_dir"
echo ""
read -p "Press Enter when export is complete..."
fi
}
case "${1:-help}" in
install)
install_deps
;;
macos)
print_header "macOS Build"
if [ -f "build-macos.sh" ]; then
chmod +x build-macos.sh
./build-macos.sh "${@:2}"
else
build_platform "macosx"
fi
;;
windows)
build_platform "windows"
# Create Windows distribution info
cat > "build/windows/README.txt" << EOF
Animus Audio Visualizer v$VERSION
INSTALLATION:
1. Extract this folder to your preferred location
2. Run Animus.exe
REQUIREMENTS:
- Windows 10 or later
- Java is bundled (no separate installation needed)
For system audio visualization:
- Use a virtual audio cable like VB-Audio or Voicemeeter
- Route your audio app's output through the virtual cable
- Select the virtual cable as input in Animus
https://github.com/yourusername/animus-visualizer
EOF
echo -e "${GREEN}Windows build prepared${NC}"
;;
linux)
build_platform "linux"
# Create Linux distribution info
cat > "build/linux/README.txt" << EOF
Animus Audio Visualizer v$VERSION
INSTALLATION:
1. Extract this folder to your preferred location
2. Make the executable runnable: chmod +x Animus
3. Run: ./Animus
REQUIREMENTS:
- Linux (Ubuntu 18.04+, Fedora 30+, or similar)
- Java is bundled (no separate installation needed)
- PulseAudio or ALSA for audio
For system audio visualization:
- Use PulseAudio's monitor devices
- Or use PipeWire with virtual sinks
https://github.com/yourusername/animus-visualizer
EOF
echo -e "${GREEN}Linux build prepared${NC}"
;;
all)
print_header "Building All Platforms"
check_processing || true
echo "This will build for macOS, Windows, and Linux"
echo ""
$0 macos
$0 windows
$0 linux
print_header "All Builds Complete!"
echo "Output directories:"
echo " - macOS: build/macos/"
echo " - Windows: build/windows/"
echo " - Linux: build/linux/"
;;
help|--help|-h)
echo "Animus Audio Visualizer - Build Script"
echo ""
echo "Usage: $0 <command> [options]"
echo ""
echo "Commands:"
echo " install Install prerequisites (Processing, Minim, ControlP5)"
echo " macos Build for macOS (with signing/notarization)"
echo " windows Build for Windows"
echo " linux Build for Linux"
echo " all Build for all platforms"
echo " help Show this help message"
echo ""
echo "Examples:"
echo " $0 install # Install dependencies"
echo " $0 macos # Build signed macOS app"
echo " $0 macos --skip-notarize # Build without notarization"
echo " $0 all # Build for all platforms"
exit 0
;;
*)
echo "Unknown command: $1"
echo "Run '$0 help' for usage"
exit 1
;;
esac
echo ""
echo -e "${GREEN}Done!${NC}"