44# by Yuchen Jin (cainmagi) / 04062022
55# ---------------------------------------------------------
66# This script has been tested on
7- # `ubuntu:jammy `
7+ # `debian:bullseye `
88# docker image.
99# ---------------------------------------------------------
1010# Currently, it is only designed for a full installation
@@ -48,16 +48,23 @@ function mcd {
4848 cd " $1 " || fail
4949}
5050
51+ function apt_dependency {
52+ apt-get -y install $( apt-cache depends $1 | grep Depends | sed " s/.*ends:\ //" | tr ' \n' ' ' ) || fail
53+ }
54+
5155
5256SET_HELP=false
5357SET_DEBUG=false
5458SET_SUDOFIX=false
5559SET_NVCUDA=false
5660SET_ALL=false
5761SET_BASIC=false
62+ SET_CMAKE=false
63+ SET_SSH=false
64+ SET_VORBIS=false
65+ SET_OPENMPT=false
5866SET_KRB5=false
5967SET_RUSTC=false
60- SET_CMAKE=false
6168SET_NASM=false
6269SET_YASM=false
6370SET_SRT=false
99106 --all) SET_ALL=true ;;
100107 --basic) SET_BASIC=true ;;
101108 --nvcuda) SET_NVCUDA=true ;;
109+ --cmake) SET_CMAKE=true ;;
110+ --ssh) SET_SSH=true ;;
111+ --vorbis) SET_VORBIS=true ;;
112+ --openmpt) SET_OPENMPT=true ;;
102113 --krb5) SET_KRB5=true ;;
103114 --rustc) SET_RUSTC=true ;;
104- --cmake) SET_CMAKE=true ;;
105115 --nasm) SET_NASM=true ;;
106116 --yasm) SET_YASM=true ;;
107117 --srt) SET_SRT=true ;;
@@ -144,12 +154,18 @@ where the usages are:
144154 Install the basic dependencies by apt.
145155 ${COLOR_OPT} --nvcuda${RESET} [not included by --all]:
146156 Install NVIDA drivers and CUDA, This option will not be set by --all.
157+ ${COLOR_OPT} --cmake${RESET} :
158+ Install CMake.
159+ ${COLOR_OPT} --ssh${RESET} :
160+ Install libssh.
161+ ${COLOR_OPT} --vorbis${RESET} :
162+ Install Vorbis audio codec.
163+ ${COLOR_OPT} --openmpt${RESET} :
164+ Install OpenMPT audio codec (requiring vorbis).
147165 ${COLOR_OPT} --krb5${RESET} :
148166 Install libkrb5, with a higher version compared to apt distribution.
149167 ${COLOR_OPT} --rustc${RESET} :
150168 Install Rust-lang, Cargo-C and meson.
151- ${COLOR_OPT} --cmake${RESET} :
152- Install CMake.
153169 ${COLOR_OPT} --nasm${RESET} :
154170 Install NASM (Netwide Assembler).
155171 ${COLOR_OPT} --yasm${RESET} :
@@ -218,9 +234,12 @@ then
218234 SET_BASIC=true
219235 # SET_SUDOFIX=true # should not be specified when not using root mode.
220236 # SET_NVCUDA=true # not included, because this option may be not necessary if CUDA has been installed.
237+ SET_CMAKE=true
238+ SET_SSH=true
239+ SET_VORBIS=true
240+ SET_OPENMPT=true
221241 SET_KRB5=true
222242 SET_RUSTC=true
223- SET_CMAKE=true
224243 SET_NASM=true
225244 SET_YASM=true
226245 SET_SRT=true
@@ -265,12 +284,13 @@ if [ "x${SET_BASIC}" = "xtrue" ]; then
265284 sudo apt-get -y full-upgrade || fail
266285 sudo apt-get -y install curl autoconf automake build-essential \
267286 cmake git-core libass-dev libfreetype6-dev libgnutls28-dev \
268- libsdl2-dev libtool libva-dev libvdpau-dev libogg-dev \
287+ libsdl2-dev libtool libva-dev libvdpau-dev libogg-dev libcmocka-dev \
269288 libvorbis-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev \
270- libunistring-dev libopenmpt-dev libopencore-amrwb-dev \
271- libc6 libc6-dev unzip python3-pip libnuma1 libnuma-dev \
272- gcc g++ bison perl clang libomp-dev libssh-dev libssl-dev \
273- ninja-build pkg-config texinfo wget zlib1g-dev || fail
289+ libunistring-dev libopencore-amrwb-dev libmpg123-dev libltdl-dev \
290+ libc6 libc6-dev unzip python3-pip libnuma1 libnuma-dev portaudio19-dev \
291+ gcc g++ bison perl clang libomp-dev libssl-dev libpulse-dev libsndfile-dev \
292+ ninja-build pkg-config texinfo wget zlib1g-dev libgcrypt20-dev \
293+ software-properties-common || fail
274294fi
275295
276296
@@ -280,14 +300,73 @@ if [ "x${SET_NVCUDA}" = "xtrue" ]; then
280300 sudo apt-get update -qq || fail
281301 sudo apt-get -y install gcc g++ curl wget freeglut3-dev build-essential \
282302 libx11-dev libxmu-dev libxi-dev libglu1-mesa libglu1-mesa-dev \
283- libfreeimage-dev || fail
284- sudo apt-get -y install nvidia-cuda-toolkit || fail
303+ libfreeimage-dev software-properties-common || fail
304+ # The following line only works with Ubuntu
305+ # sudo apt-get -y install nvidia-cuda-toolkit || fail
306+ # The following commands are working with Debian.
307+ sudo add-apt-repository -y " deb http://deb.debian.org/debian/ bullseye main contrib non-free" || fail
308+ sudo apt-get update -qq || fail
309+ sudo apt-mark hold nvidia-persistenced || fail
310+ sudo apt-get -y install nvidia-cuda-toolkit || fail
311+ fi
312+
313+
314+ # Install dependencies: CMake
315+ if [ " x${SET_CMAKE} " = " xtrue" ]; then
316+ msg " ${COLOR_OPT} --cmake): ${COLOR_OPT_TEXT} Install CMake 3.23.0."
317+ cd $SOURCE_PATH || fail
318+ wget -O- https://cmake.org/files/v3.23/cmake-3.23.0.tar.gz | tar xz -C . || fail
319+ cd cmake-3.23.0 || fail
320+ ./bootstrap || fail
321+ make -j$( nproc) || fail
322+ sudo make install || fail
323+ fi
324+
325+
326+ # Install dependencies: libssh
327+ if [ " x${SET_SSH} " = " xtrue" ]; then
328+ msg " ${COLOR_OPT} --ssh): ${COLOR_OPT_TEXT} Install libssh 0.9.6."
329+ # sudo apt-get -y install gcc g++ cmake libssl-dev libgcrypt20-dev zlib1g-dev || fail
330+ cd $SOURCE_PATH || fail
331+ wget -O- https://git.libssh.org/projects/libssh.git/snapshot/libssh-0.9.6.tar.gz | tar xz -C . || fail
332+ cd libssh-0.9.6 || fail
333+ mkdir -p build || fail
334+ cd build || fail
335+ PKG_CONFIG_PATH=" $BUILD_PATH /lib/pkgconfig:$PKG_CONFIG_PATH " cmake -DUNIT_TESTING=OFF -DCMAKE_INSTALL_PREFIX=" $BUILD_PATH " -DCMAKE_BUILD_TYPE=Release .. || fail
336+ PATH=" $BIN_PATH :$PATH " make -j$( nproc) || fail
337+ sudo make install || fail
338+ fi
339+
340+
341+ # Install dependencies: libvorbis
342+ if [ " x${SET_VORBIS} " = " xtrue" ]; then
343+ msg " ${COLOR_OPT} --vorbis): ${COLOR_OPT_TEXT} Install libvorbis 1.3.7."
344+ # sudo apt-get -y install libogg-dev libvorbis0a libvorbisenc2 libvorbisfile3 || fail
345+ cd $SOURCE_PATH || fail
346+ wget -O- https://downloads.xiph.org/releases/vorbis/libvorbis-1.3.7.tar.gz | tar xz -C . || fail
347+ cd libvorbis-1.3.7 || fail
348+ PATH=" $BIN_PATH :$PATH " ./configure --prefix=/usr --disable-static || fail
349+ PATH=" $BIN_PATH :$PATH " make -j$( nproc) || fail
350+ sudo make install || fail
351+ fi
352+
353+
354+
355+ # Install dependencies: libopenmpt
356+ if [ " x${SET_OPENMPT} " = " xtrue" ]; then
357+ msg " ${COLOR_OPT} --openmpt): ${COLOR_OPT_TEXT} Install libopenmpt 0.6.2."
358+ # sudo apt-get -y install libmpg123-dev libltdl-dev libogg-dev libvorbis-dev zlib1g-dev libsndfile-dev portaudio19-dev libpulse-dev || fail
359+ cd $SOURCE_PATH || fail
360+ wget -O- https://lib.openmpt.org/files/libopenmpt/src/libopenmpt-0.6.2+release.autotools.tar.gz | tar xz -C . || fail
361+ cd libopenmpt-0.6.2+release.autotools || fail
362+ PATH=" $BIN_PATH :$PATH " ./configure || fail
363+ PATH=" $BIN_PATH :$PATH " make -j$( nproc) || fail
364+ sudo make install || fail
285365fi
286366
287367
288368# Install libkrb5 1.19.3 (require yacc (bison)).
289369if [ " x${SET_KRB5} " = " xtrue" ]; then
290- msg_err " Not compatible with xvid, so these codes are dropped."
291370 msg " ${COLOR_OPT} --krb5): ${COLOR_OPT_TEXT} Install libkrb5 1.19.3."
292371 sudo apt-get update -qq || fail
293372 sudo apt-get -y install comerr-dev bison || fail
@@ -335,18 +414,6 @@ if [ "x${SET_DEBUG}" = "xtrue" ] || [ "x${SET_BASIC}" = "xtrue" ] || [ "x${SET_R
335414fi
336415
337416
338- # Install dependencies: CMake
339- if [ " x${SET_CMAKE} " = " xtrue" ]; then
340- msg " ${COLOR_OPT} --cmake): ${COLOR_OPT_TEXT} Install CMake 3.23.0."
341- cd $SOURCE_PATH || fail
342- wget -O- https://cmake.org/files/v3.23/cmake-3.23.0.tar.gz | tar xz -C . || fail
343- cd cmake-3.23.0 || fail
344- ./bootstrap || fail
345- make -j$( nproc) || fail
346- sudo make install || fail
347- fi
348-
349-
350417# Install dependencies: NASM
351418if [ " x${SET_NASM} " = " xtrue" ]; then
352419 msg " ${COLOR_OPT} --nasm): ${COLOR_OPT_TEXT} Install NASM 2.15.05."
0 commit comments