-
Notifications
You must be signed in to change notification settings - Fork 1
/
pull-deps.sh
executable file
·74 lines (63 loc) · 2.75 KB
/
pull-deps.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
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
set -e
# Copyright 2023 Sam Johnson
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
USERNAME=sfjohnson
rm -rf lib/macos-arm64 lib/macos12 lib/android30 lib/rpi lib/rpi-arm64 lib/linux-x64 include/deps
if [[ "$OSTYPE" == "darwin"* ]]; then
if [[ $(uname -m) == 'arm64' ]]; then
ARCH=macos-arm64
else
ARCH=macos12
fi
mkdir -p bin lib/$ARCH lib/android30 lib/rpi lib/rpi-arm64 lib/linux-x64 licenses
elif [[ "$OSTYPE" == "linux-gnu"* && $(uname -m) == 'x86_64' ]]; then
ARCH=linux
mkdir -p bin lib/android30 lib/rpi lib/rpi-arm64 lib/linux-x64 licenses
else
echo "This script only runs on x86_64 macOS, arm64 macOS or x86_64 Linux";
exit 1;
fi
download () {
echo "Downloading $3 $2 platform $1"
if [ $1 != "macos" ]; then
curl https://github.com/$USERNAME/$3/releases/download/$2/$4-android30.a --output lib/android30/$4.a -s -L
curl https://github.com/$USERNAME/$3/releases/download/$2/$4-rpi-arm64.a --output lib/rpi-arm64/$4.a -s -L
curl https://github.com/$USERNAME/$3/releases/download/$2/$4-linux-x64.a --output lib/linux-x64/$4.a -s -L
fi
if [[ $1 != "linux" && $ARCH != "linux" ]]; then
curl https://github.com/$USERNAME/$3/releases/download/$2/$4-$ARCH.a --output lib/$ARCH/$4.a -s -L
fi
mkdir -p include/deps/$3
pushd include/deps/$3 > /dev/null
curl https://github.com/$USERNAME/$3/releases/download/$2/include.zip --output include.zip -s -L
unzip -qq include.zip
rm include.zip
popd > /dev/null
curl https://github.com/$USERNAME/$3/releases/download/$2/LICENSE --output licenses/$3.txt -s -L
if [ $3 = "protobuf" ]; then
echo "Downloading protoc binary..."
if [ $ARCH = "linux" ]; then
curl https://github.com/$USERNAME/$3/releases/download/$2/protoc-linux --output bin/protoc -s -L
else
curl https://github.com/$USERNAME/$3/releases/download/$2/protoc-$ARCH --output bin/protoc -s -L
fi
chmod +x bin/protoc
fi
}
download all v25.3.1 protobuf libprotobuf-lite
download all v0.8.2 ck libck
download linux v2.2.2 tinyalsa libtinyalsa
download macos v19.8.0 portaudio libportaudio
download all v6.6.1 r8brain-free-src libr8brain
download all v1.5.4 opus libopus
download all v2.0.14 raptorq libraptorq
download all v19.8.3 uWebSockets libuwebsockets
download all v0.8.4 boringtun libboringtun
echo "Fixing protobuf include paths..."
cp -r include/deps/protobuf/absl include/deps
mkdir -p include/deps/google
cp -a include/deps/protobuf include/deps/google
rm -rf include/deps/protobuf