Server-Root/libraries/build_datapipes.sh

45 lines
2.1 KiB
Bash
Raw Normal View History

2020-01-24 08:41:44 -05:00
[[ -z "${build_helper_file}" ]] && {
echo "Missing build helper file. Please define \"build_helper_file\""
exit 1
}
source ${build_helper_file}
[[ $build_helpers_defined -ne 1 ]] && {
echo "Failed to include build helpers."
2019-11-11 16:49:38 -05:00
exit 1
}
2020-01-24 08:41:44 -05:00
2020-01-24 08:48:21 -05:00
requires_rebuild ${library_path}
[[ $? -eq 0 ]] && exit 0
2020-01-24 14:17:29 -05:00
[[ -z "${datapipes_webrtc}" ]] && datapipes_webrtc=1
[[ "${datapipes_webrtc}" -eq 1 ]] && _datapipes_webrtc="ON" || datapipes_webrtc="OFF"
web_cmake_flags="-DBUILD_WEBRTC=${_datapipes_webrtc}"
2020-01-24 14:17:29 -05:00
if [[ ${build_os_type} != "win32" && "${_datapipes_webrtc}" == "ON" ]]; then
2020-03-25 15:38:29 -04:00
# -DLibevent_DIR="/mnt/d/TeaSpeak/server/libraries/event/out/linux_amd64/lib/cmake/libevent"
glib20_dir=$(realpath "$(pwd)/glibc/linux_${build_os_arch}/")
# shellcheck disable=SC2125
glib20_lib_path=$(realpath "$glib20_dir/lib/"*"/")
# TODO: pcre really required here?
2020-03-25 15:38:29 -04:00
web_cmake_flags="$web_cmake_flags -DGLIB_PREBUILD_INCLUDES=\"$glib20_dir/include;$glib20_dir/include/glib-2.0/;$glib20_lib_path/glib-2.0/include/\""
2020-01-26 10:42:01 -05:00
web_cmake_flags="$web_cmake_flags -DGLIB_PREBUILD_LIBRARIES=\"$glib20_lib_path/libgio-2.0.so;z;resolv;$glib20_lib_path/libgmodule-2.0.so;$glib20_lib_path/libgobject-2.0.so;$glib20_lib_path/libffi.so;$glib20_lib_path/libglib-2.0.so;pcre\""
web_cmake_flags="$web_cmake_flags -DLIBNICE_PREBUILD_PATH=\"../libnice/linux_${build_os_arch}\""
echo "WebRTC flags: $web_cmake_flags"
2020-01-24 08:41:44 -05:00
fi
_cxx_options=""
[[ ${build_os_type} != "win32" ]] && _cxx_options="-fPIC -static-libgcc -static-libstdc++"
[[ ${build_os_type} == "win32" ]] && _cxx_options="-DWIN32"
2020-03-25 15:38:29 -04:00
general_options="-DCMAKE_C_FLAGS=\"-fPIC\" -DCMAKE_CXX_FLAGS=\"$_cxx_options\" -DBUILD_EXAMPLES=OFF -DBUILD_STATIC=1 -DBUILD_SHARED=1 -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}"
2020-03-02 12:43:38 -05:00
#crypto_options="-DCrypto_ROOT_DIR=\"$(pwd)/boringssl/lib/\" -DCRYPTO_TYPE=\"boringssl\""
crypto_options="-DCRYPTO_TYPE=\"openssl\" -DCrypto_ROOT_DIR=\"$(pwd)/openssl-prebuild/${build_os_type}_${build_os_arch}/\""
command="cmake_build ${library_path} ${general_options} ${crypto_options} ${web_cmake_flags} ${CMAKE_OPTIONS}"
eval "$command"
2020-01-24 08:41:44 -05:00
check_err_exit ${library_path} "Failed to build DataPipes!"
set_build_successful ${library_path}