forked from pterodactyl/yolks
-
Notifications
You must be signed in to change notification settings - Fork 270
/
Copy pathbuild.sh
155 lines (127 loc) · 3.71 KB
/
build.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
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
#!/bin/bash
# Mumble compile script.
# Runs on Debian 12
LOGFILE="/usr/src/mumble/build.log"
log() {
echo "$(date +'%Y-%m-%d %H:%M:%S') - $1" | tee -a $LOGFILE
}
install_dep(){
log "Installing dependencies..."
apt update && apt -y install \
build-essential \
cmake \
pkg-config \
qtbase5-dev \
qtchooser \
qt5-qmake \
qtbase5-dev-tools \
qttools5-dev \
qttools5-dev-tools \
libqt5svg5-dev \
libboost-dev \
libssl-dev \
libprotobuf-dev \
protobuf-compiler \
libprotoc-dev \
libcap-dev \
libxi-dev \
libasound2-dev \
libogg-dev \
libsndfile1-dev \
libspeechd-dev \
libavahi-compat-libdnssd-dev \
libxcb-xinerama0 \
libzeroc-ice-dev \
libpoco-dev \
jq \
python3 \
curl \
git
if [[ $? -ne 0 ]]; then
log "Failed to install dependencies"
exit 1
fi
log "Dependencies installed successfully"
}
# Function to install g++-multilib on amd64
install_amd64_multilib() {
apt -y install g++-multilib
if [[ $? -ne 0 ]]; then
log "Failed to install amd multilib dependency"
exit 1
fi
log "Multilib AMD64 installed successfully"
}
# Function to install multilib support on arm64
install_arm64_multilib() {
apt -y install g++-multilib-x86-64-linux-gnu g++-aarch64-linux-gnu libc6-dev-armhf-cross
if [[ $? -ne 0 ]]; then
log "Failed to install amd multilib dependency"
exit 1
fi
log "Multilib ARM64 installed successfully"
}
clone_mumble(){
log "Cloning the Mumble repository..."
# Create the necessary directories
mkdir -p /usr/src/mumble/git && cd /usr/src/mumble/git
# Fetch the latest release tag from the GitHub API
LATEST_TAG=$(curl -s "https://api.github.com/repos/mumble-voip/mumble/releases/latest" | jq -r .tag_name)
if [[ $? -ne 0 || -z "$LATEST_TAG" ]]; then
log "Failed to fetch the latest release tag"
exit 1
fi
echo "The latest tag is: $LATEST_TAG" | tee -a $LOGFILE
# Clone the repository
echo "Running: git clone --branch \"$LATEST_TAG\" https://github.com/mumble-voip/mumble.git ."
git clone --branch "$LATEST_TAG" https://github.com/mumble-voip/mumble.git .
if [[ $? -ne 0 ]]; then
log "Failed to clone the repository"
exit 1
fi
# Clone the submodules
git submodule update --init --recursive
if [[ $? -ne 0 ]]; then
log "Failed to update submodules"
exit 1
fi
# Create and navigate to the build directory
mkdir -p build && cd build
echo "$LATEST_TAG" > latest_tag.txt
# Run cmake with the specified options
cmake -Dbundled-opus=OFF -Dclient=OFF -Dstatic=ON -DCMAKE_BUILD_TYPE=Release ..
if [[ $? -ne 0 ]]; then
log "CMake configuration failed"
exit 1
fi
log "Repository cloned and configured successfully"
}
build_mumble(){
log "Building Mumble server..."
cd /usr/src/mumble/git/build
echo "Using $(nproc) threads to build Mumble server" | tee -a $LOGFILE
cmake --build . -j $(nproc)
if [[ $? -ne 0 ]]; then
log "Build failed"
exit 1
fi
ls -la | tee -a $LOGFILE
log "Build completed successfully"
}
# Install normal deps
install_dep
# Detect the architecture
ARCH=$(dpkg --print-architecture)
# Install ARCH specific deps
if [ "$ARCH" = "amd64" ]; then
echo "Detected architecture: amd64"
install_amd64_multilib
elif [ "$ARCH" = "arm64" ]; then
echo "Detected architecture: arm64"
install_arm64_multilib
else
echo "Unsupported architecture: $ARCH"
exit 1
fi
clone_mumble
build_mumble