-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_sourceserver_dependencies.sh
More file actions
executable file
·171 lines (134 loc) · 3.91 KB
/
Copy pathbuild_sourceserver_dependencies.sh
File metadata and controls
executable file
·171 lines (134 loc) · 3.91 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
#!/bin/bash
# REGION Modules Check
git submodule update --init --recursive
if [[ ! -d "./media_converter" ]]; then
git clone https://github.com/LeandroTheDev/media_converter.git
fi
if [[ ! -d "./media_downloader" ]]; then
git clone https://github.com/LeandroTheDev/media_downloader.git
fi
if [[ ! -d "./media_converter" ]]; then
echo "Error: 'media_converter' module not found in current directory."
exit 1
fi
if [[ ! -d "./media_downloader" ]]; then
echo "Error: 'media_downloader' module not found in current directory."
exit 1
fi
# ENDREGION: Modules Check
# REGION: media_downloader COMPILATION
if ! command -v cargo &> /dev/null; then
echo "Error: 'cargo' from Rust does not exist. Please install it before building."
exit 1
fi
cd ./media_downloader || {
echo "Error: Folder './media_downloader' does not exist."
exit 1
}
cargo build --release
if [ $? -eq 0 ]; then
echo "Build completed successfully."
else
echo "Build failed."
exit 1
fi
OS="$(uname -s)"
case "$OS" in
Linux*)
echo "Detected OS: Linux"
cp -r ./target/release/media_downloader ../source_server/libraries/linux/
;;
Darwin*)
echo "Detected OS: macOS"
cp -r ./target/release/media_downloader ../source_server/libraries/macos/
;;
MINGW* | MSYS* | CYGWIN*)
echo "Detected OS: Windows"
cp -r ./target/release/media_downloader.exe ../source_server/libraries/windows/
;;
*)
echo "Unsupported OS: $OS"
exit 1
;;
esac
echo "Media Downloader Compiled!"
cd ..
# ENDREGION: media_downloader COMPILATION
# REGION: media_converter COMPILATION
if ! command -v cargo &> /dev/null; then
echo "Error: 'cargo' from Rust does not exist. Please install it before building."
exit 1
fi
cd ./media_converter || {
echo "Error: Folder './media_converter' does not exist."
exit 1
}
cargo build --release
if [ $? -eq 0 ]; then
echo "Build completed successfully."
else
echo "Build failed."
exit 1
fi
OS="$(uname -s)"
case "$OS" in
Linux*)
echo "Detected OS: Linux"
cp -r ./target/release/media_converter ../source_server/libraries/linux/
;;
Darwin*)
echo "Detected OS: macOS"
cp -r ./target/release/media_converter ../source_server/libraries/macos/
;;
MINGW* | MSYS* | CYGWIN*)
echo "Detected OS: Windows"
cp -r ./target/release/media_converter.exe ../source_server/libraries/windows/
;;
*)
echo "Unsupported OS: $OS"
exit 1
;;
esac
echo "Media Compiler Compiled!"
cd ..
# ENDREGION: media_converter COMPILATION
# REGION: Libraries Check
OS="$(uname -s)"
case "$OS" in
Linux*)
echo "Detected OS: Linux"
if ! command -v ffmpeg >/dev/null 2>&1; then
echo "WARNING: 'ffmpeg' not found in PATH"
fi
if ! command -v yt-dlp >/dev/null 2>&1; then
echo "WARNING: 'yt-dlp' not found in PATH"
fi
;;
Darwin*)
echo "Detected OS: macOS"
if ! command -v ffmpeg >/dev/null 2>&1; then
echo "WARNING: 'ffmpeg' not found in PATH"
exit 1
fi
if ! command -v yt-dlp >/dev/null 2>&1; then
echo "WARNING: 'yt-dlp' not found in PATH"
fi
;;
MINGW* | MSYS* | CYGWIN*)
echo "Detected OS: Windows"
FFMPEG_PATH="./source_server/libraries/windows/libraries/ffmpeg.exe"
YTDLP_PATH="./source_server/libraries/windows/libraries/yt-dlp.exe"
if [[ ! -f "$FFMPEG_PATH" ]]; then
echo "WARNING: ffmpeg not found at $FFMPEG_PATH"
fi
if [[ ! -f "$YTDLP_PATH" ]]; then
echo "WARNING: yt-dlp not found at $YTDLP_PATH"
fi
;;
*)
echo "Unsupported OS: $OS"
exit 1
;;
esac
# ENDREGION
echo "Source Server dependencies builded successfully!"