-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmacos-build-sbagen+.sh
executable file
·64 lines (51 loc) · 2.01 KB
/
macos-build-sbagen+.sh
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
#!/bin/bash
# SBaGen+ macOS build script
# Builds a universal binary (ARM64 + x86_64) with MP3 and OGG support
# Source common library
. ./lib.sh
section_header "Building SBaGen+ universal binary (ARM64 + x86_64) with MP3 and OGG support..."
# Create libs directory if it doesn't exist
create_dir_if_not_exists "libs"
# Check distribution directory
create_dir_if_not_exists "dist"
# Check if libraries exist instead of building them automatically
LIB_PATH="libs/macos-universal-libmad.a"
OGG_LIB_PATH="libs/macos-universal-libogg.a"
TREMOR_LIB_PATH="libs/macos-universal-libvorbisidec.a"
# Define compilation flags
CFLAGS="-DT_MACOSX -arch arm64 -arch x86_64 -mmacosx-version-min=11.0 -I."
LIBS="-framework CoreAudio"
# Check for MP3 support
if [ -f "$LIB_PATH" ]; then
info "Including MP3 support using: $LIB_PATH"
CFLAGS="$CFLAGS -DMP3_DECODE"
LIBS="$LIBS $LIB_PATH"
else
warning "MP3 library not found at $LIB_PATH"
warning "MP3 support will not be included"
warning "Run ./macos-build-libs.sh to build the required libraries"
fi
# Check for OGG support (need both libogg and libvorbisidec)
if [ -f "$OGG_LIB_PATH" ] && [ -f "$TREMOR_LIB_PATH" ]; then
info "Including OGG support using: $OGG_LIB_PATH and $TREMOR_LIB_PATH"
CFLAGS="$CFLAGS -DOGG_DECODE"
# Order is important: first tremor, then ogg
LIBS="$LIBS $TREMOR_LIB_PATH $OGG_LIB_PATH"
else
warning "OGG libraries not found at $OGG_LIB_PATH or $TREMOR_LIB_PATH"
warning "OGG support will not be included"
warning "Run ./macos-build-libs.sh to build the required libraries"
fi
# Compile sbagen+
section_header "Starting sbagen+ compilation..."
info "Compilation flags: $CFLAGS"
info "Libraries: $LIBS"
gcc $CFLAGS sbagen+.c -o dist/sbagen+-macos-universal $LIBS
if [ $? -eq 0 ]; then
success "Compilation successful! Universal binary created: dist/sbagen+-macos-universal"
# info "Supported architectures:"
# lipo -info dist/sbagen+-macOS
else
error "Compilation failed!"
fi
section_header "Build process completed!"