Server-Root/build_teaspeak.sh

87 lines
2.3 KiB
Bash
Raw Normal View History

2020-01-24 14:17:29 -05:00
#!/bin/bash
2020-02-10 07:18:59 -05:00
_build_helper_dir="$(pwd)/build-helpers/"
2020-01-24 08:54:13 -05:00
2020-01-27 04:49:36 -05:00
_build_type="Debug"
if [[ -n "$1" ]]; then
echo "This is an automated jenkins build. Initializing variables."
if [[ "$1" == "debug" ]]; then
echo "Initializing debug session."
export _build_type="Debug"
# shellcheck disable=SC2089
2020-01-27 04:55:19 -05:00
export TEASPEAK_DEPLOY_TYPE_SPECIFIER="-DBUILD_TYPE=1 -DBUILD_TYPE_NAME=beta"
2020-01-27 04:49:36 -05:00
elif [[ "$1" == "optimized" ]]; then
echo "Initializing optimized session."
export _build_type="RelWithDebInfo"
# shellcheck disable=SC2089
2020-01-27 04:55:19 -05:00
export TEASPEAK_DEPLOY_TYPE_SPECIFIER="-DBUILD_TYPE=1 -DBUILD_TYPE_NAME=beta"
2020-01-27 04:49:36 -05:00
elif [[ "$1" == "stable" ]]; then
echo "Initializing stable session."
export _build_type="RelWithDebInfo"
# shellcheck disable=SC2089
2020-01-27 04:55:19 -05:00
export TEASPEAK_DEPLOY_TYPE_SPECIFIER="-DBUILD_TYPE=0 -DBUILD_TYPE_NAME="
2020-01-27 04:49:36 -05:00
else
echo "Unknown target build type: $1"
exit 1
fi
fi
2020-01-24 14:17:29 -05:00
# shellcheck disable=SC2154
if [[ "$no_web" == "1" ]]; then
echo "Disabling web support"
_web_flag="OFF"
else
_web_flag="ON"
fi
2020-01-24 08:54:13 -05:00
cd TeaSpeak || exit 1
2020-01-27 04:49:36 -05:00
if [[ -d build ]]; then
2018-08-08 15:51:41 -04:00
rm -r build
fi
2020-01-27 04:49:36 -05:00
mkdir build || exit 1
cd build || exit 1
2018-08-08 15:51:41 -04:00
2020-01-27 04:49:36 -05:00
echo "Build type: $_build_type"
2020-02-15 08:04:33 -05:00
_command="cmake .. -DCMAKE_BUILD_TYPE=\"$_build_type\" -DCMAKE_CXX_FLAGS=\"${CXX_FLAGS}\" -DBUILD_INCLUDE_FILE=\"$_build_helper_dir/cmake/config/tearoot-server.cmake\" -DCMAKE_MODULE_PATH=\"$_build_helper_dir/cmake/\" -DDISABLE_QT=1 -DDISABLE_CUSTOM_OUTPUT=ON -DDISABLE_QT=ON -DCOMPILE_WEB_CLIENT=\"$_web_flag\" $TEASPEAK_DEPLOY_TYPE_SPECIFIER"
echo "> $_command"
eval $_command
2020-01-24 14:17:29 -05:00
_code=$?
if [[ $_code -ne 0 ]]; then
2018-09-11 17:33:22 -04:00
echo "Failed to run CMAKE project"
exit 1
fi
2020-01-24 14:17:29 -05:00
cmake --build "$(pwd)" --target ProviderFFMpeg -- -j 12; _code=$?
if [[ $_code -ne 0 ]]; then
echo "Failed to build ffmpeg ($_code)"
2018-09-11 17:33:22 -04:00
exit 1
fi
2020-01-24 14:17:29 -05:00
cmake --build "$(pwd)" --target ProviderYT -- -j 12; _code=$?
if [[ $_code -ne 0 ]]; then
echo "Failed to build YT ($_code)"
2018-09-11 17:33:22 -04:00
exit 1
fi
2020-01-24 14:17:29 -05:00
cmake --build "$(pwd)" --target TeaSpeakServer -- -j 12; _code=$?
if [[ $_code -ne 0 ]]; then
echo "Failed to build server ($_code)"
2018-09-11 17:33:22 -04:00
exit 1
fi
2018-08-09 06:38:44 -04:00
#${CXX_FLAGS}
#${C_FLAGS}
2018-08-09 06:38:44 -04:00
#CMake specific
#${CMAKE_OPTIONS}
#${CMAKE_MAKE_OPTIONS}
2018-08-09 06:38:44 -04:00
#Make specific (without cmake)
#${MAKE_OPTIONS}
2018-08-09 06:38:44 -04:00
#CXXFLAGS="${CXX_FLAGS}" CFLAGS="${C_FLAGS}"
#CXXFLAGS="${CXX_FLAGS}" CFLAGS="${C_FLAGS}" ${CMAKE_OPTIONS}