-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.sh
executable file
·57 lines (48 loc) · 1.54 KB
/
setup.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
#!/bin/bash
# Check if Homebrew is installed (macOS)
if [[ "$OSTYPE" == "darwin"* ]]; then
if ! command -v brew &> /dev/null; then
echo "Installing Homebrew..."
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
fi
echo "Installing FFmpeg..."
brew install ffmpeg
echo "Creating cargo config..."
mkdir -p ~/.cargo
cat > ~/.cargo/config.toml << EOF
[target.aarch64-apple-darwin]
rustflags = [
"-C", "link-args=-L/opt/homebrew/lib",
"-C", "link-args=-framework",
"-C", "link-args=VideoToolbox",
"-C", "link-args=-framework",
"-C", "link-args=CoreMedia",
"-C", "link-args=-framework",
"-C", "link-args=CoreFoundation"
]
EOF
echo "Setting up environment variables..."
export PKG_CONFIG_PATH="/opt/homebrew/lib/pkgconfig:$PKG_CONFIG_PATH"
export FFMPEG_LIB_DIR="/opt/homebrew/lib"
export FFMPEG_INCLUDE_DIR="/opt/homebrew/include"
echo "Verifying FFmpeg capabilities..."
ffmpeg -encoders 2>/dev/null | grep videotoolbox
elif [[ "$OSTYPE" == "linux-gnu"* ]]; then
# Install FFmpeg on Linux with minimal configuration
echo "Installing FFmpeg..."
sudo apt-get update
sudo apt-get install -y \
ffmpeg \
libavcodec-dev \
libavformat-dev \
libavutil-dev \
libswscale-dev \
pkg-config
fi
# Clean and build
echo "Building project..."
# Remove target directory to ensure clean build
rm -rf target/
# Build project
cargo clean
cargo build --example simple_screen_share