Improved build helper scripts for the server

This commit is contained in:
WolverinDEV 2020-01-24 14:02:19 +01:00
parent a651eb879e
commit 45a32496ba
5 changed files with 108 additions and 85 deletions

View File

@ -5,12 +5,16 @@ set(CMAKE_CXX_STANDARD 20)
set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/Modules") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/Modules")
set(TEASPEAK_SERVER ON) set(TEASPEAK_SERVER ON)
set(CMAKE_VERBOSE_MAKEFILE ON)
#end now #end now
#set(MEMORY_DEBUG_FLAGS " -fsanitize=leak -fsanitize=address -fstack-protector-all ") #set(MEMORY_DEBUG_FLAGS " -fsanitize=leak -fsanitize=address -fstack-protector-all ")
#set(MEMORY_DEBUG_FLAGS "-fsanitize=address") #set(MEMORY_DEBUG_FLAGS "-fsanitize=address")
set(LIBRARY_PATH "${CMAKE_SOURCE_DIR}/../libraries/") set(LIBRARY_PATH "${CMAKE_SOURCE_DIR}/../libraries/")
if (BUILD_INCLUDE_FILE)
include(${BUILD_INCLUDE_FILE})
endif ()
set(CMAKE_PREFIX_PATH "/home/wolverindev/clib/qt/5.6.1/5.6/gcc_64/lib/cmake") set(CMAKE_PREFIX_PATH "/home/wolverindev/clib/qt/5.6.1/5.6/gcc_64/lib/cmake")
set(LIBEVENT_PATH "${LIBRARY_PATH}/event/build/lib/") set(LIBEVENT_PATH "${LIBRARY_PATH}/event/build/lib/")
@ -41,20 +45,40 @@ if (NOT BUILD_OS_ARCH)
set(BUILD_OS_ARCH $ENV{build_os_arch}) set(BUILD_OS_ARCH $ENV{build_os_arch})
endif () endif ()
resolve_library(LIBRARY_TOM_MATH OFF "${LIBRARY_PATH}/tommath/build/libtommathStatic.a") find_package(TomMath REQUIRED)
resolve_library(LIBRARY_TOM_CRYPT OFF "${LIBRARY_PATH}/tomcrypt/libtomcrypt.a") find_package(TomCrypt REQUIRED)
resolve_library(LIBRARY_PATH_BREAKPAD OFF "${LIBRARY_PATH}/breakpad/build/src/client/linux/libbreakpad_client.a") find_package(Breakpad REQUIRED)
resolve_library(LIBRARY_PATH_PROTOBUF OFF "${LIBRARY_PATH}/protobuf/build/libprotobuf.a") find_package(Protobuf REQUIRED)
resolve_library(LIBRARY_PATH_BORINGSSL_SSL OFF "${LIBRARY_PATH}/boringssl/build/ssl/libssl.so") find_package(Boringssl REQUIRED)
resolve_library(LIBRARY_PATH_BORINGSSL_CRYPTO OFF "${LIBRARY_PATH}/boringssl/build/crypto/libcrypto.so") find_package(ThreadPool REQUIRED)
resolve_library(LIBRARY_PATH_THREAD_POOL OFF "${LIBRARY_PATH}/Thread-Pool/build/libThreadPoolStatic.a") find_package(CXXTerminal REQUIRED)
resolve_library(LIBRARY_PATH_TERMINAL OFF "${LIBRARY_PATH}/CXXTerminal/build/libCXXTerminalStatic.a") find_package(StringVariable REQUIRED)
resolve_library(LIBRARY_PATH_VARIBALES OFF "${LIBRARY_PATH}/StringVariable/build/libStringVariablesStatic.a")
resolve_library(LIBRARY_PATH_YAML OFF "${LIBRARY_PATH}/yaml-cpp/build/libyaml-cpp.a") find_package(yaml-cpp REQUIRED)
resolve_library(LIBRARY_PATH_JSON OFF "${LIBRARY_PATH}/jsoncpp/build/src/lib_json/libjsoncpp.a")
resolve_library(LIBRARY_PATH_ED255 OFF "${LIBRARY_PATH}/ed25519/build/libed25519.a") find_package(Libevent REQUIRED)
resolve_library(LIBRARY_PATH_DATA_PIPES OFF "${LIBRARY_PATH}/DataPipes/build/libDataPipes.so" "${LIBRARY_PATH}/DataPipes/cmake-build-release/libDataPipes.so" "${LIBRARY_PATH}/DataPipes/cmake-build-debug/libDataPipes.so") find_package(jsoncpp REQUIRED)
resolve_library(LIBRARY_PATH_OPUS OFF "${LIBRARY_PATH}/opus/build/.libs/libopus.a") find_package(Ed25519 REQUIRED)
find_package(DataPipes REQUIRED)
find_package(Opus REQUIRED)
find_package(spdlog REQUIRED)
find_package(Jemalloc REQUIRED)
find_package(Protobuf REQUIRED)
#resolve_library(LIBRARY_TOM_MATH OFF "${LIBRARY_PATH}/tommath/build/libtommathStatic.a")
#resolve_library(LIBRARY_TOM_CRYPT OFF "${LIBRARY_PATH}/tomcrypt/libtomcrypt.a")
#resolve_library(LIBRARY_PATH_BREAKPAD OFF "${LIBRARY_PATH}/breakpad/build/src/client/linux/libbreakpad_client.a")
#resolve_library(LIBRARY_PATH_PROTOBUF OFF "${LIBRARY_PATH}/protobuf/build/libprotobuf.a")
#resolve_library(LIBRARY_PATH_BORINGSSL_SSL OFF "${LIBRARY_PATH}/boringssl/build/ssl/libssl.so")
#resolve_library(LIBRARY_PATH_BORINGSSL_CRYPTO OFF "${LIBRARY_PATH}/boringssl/build/crypto/libcrypto.so")
#resolve_library(LIBRARY_PATH_THREAD_POOL OFF "${LIBRARY_PATH}/Thread-Pool/build/libThreadPoolStatic.a")
#resolve_library(LIBRARY_PATH_TERMINAL OFF "${LIBRARY_PATH}/CXXTerminal/build/libCXXTerminalStatic.a")
#resolve_library(LIBRARY_PATH_VARIBALES OFF "${LIBRARY_PATH}/StringVariable/build/libStringVariablesStatic.a")
#resolve_library(LIBRARY_PATH_YAML OFF "${LIBRARY_PATH}/yaml-cpp/build/libyaml-cpp.a")
#resolve_library(LIBRARY_PATH_JSON OFF "${LIBRARY_PATH}/jsoncpp/build/src/lib_json/libjsoncpp.a")
#resolve_library(LIBRARY_PATH_ED255 OFF "${LIBRARY_PATH}/ed25519/build/libed25519.a")
#resolve_library(LIBRARY_PATH_DATA_PIPES OFF "${LIBRARY_PATH}/DataPipes/build/libDataPipes.so" "${LIBRARY_PATH}/DataPipes/cmake-build-release/libDataPipes.so" "${LIBRARY_PATH}/DataPipes/cmake-build-debug/libDataPipes.so")
#resolve_library(LIBRARY_PATH_OPUS OFF "${LIBRARY_PATH}/opus/build/.libs/libopus.a")
resolve_library(LIBRARY_PATH_NICE OFF "${LIBRARY_PATH}/libnice/linux_${BUILD_OS_ARCH}/lib/libnice.a") resolve_library(LIBRARY_PATH_NICE OFF "${LIBRARY_PATH}/libnice/linux_${BUILD_OS_ARCH}/lib/libnice.a")
message("Found libnice at ${LIBRARY_PATH_NICE}") message("Found libnice at ${LIBRARY_PATH_NICE}")
@ -66,7 +90,7 @@ else()
message(FATAL_ERROR "Failed to find glibc") message(FATAL_ERROR "Failed to find glibc")
endif () endif ()
message("Found GLIBC lib dir at ${GLIBC_LIB_DIR}") message("Found GLIBC lib dir at ${GLIBC_LIB_DIR}")
set(LIBRARY_PATH_GLIBC "${GLIBC_LIB_DIR}/libgio-2.0.a;${GLIBC_LIB_DIR}/libgmodule-2.0.a;${GLIBC_LIB_DIR}/libglib-2.0.a;${GLIBC_LIB_DIR}/libgobject-2.0.a;${GLIBC_LIB_DIR}/libffi.a;resolv") set(LIBRARY_PATH_GLIBC "${GLIBC_LIB_DIR}/libgio-2.0.a;${GLIBC_LIB_DIR}/libgmodule-2.0.a;${GLIBC_LIB_DIR}/libgobject-2.0.a;${GLIBC_LIB_DIR}/libglib-2.0.a;${GLIBC_LIB_DIR}/libffi.a;resolv")
add_definitions(-DINET -DINET6) add_definitions(-DINET -DINET6)
add_subdirectory(shared/) add_subdirectory(shared/)

View File

@ -132,8 +132,8 @@ set(SERVER_SOURCE_FILES
src/weblist/TeamSpeakWebClient.cpp src/weblist/TeamSpeakWebClient.cpp
src/manager/ConversationManager.cpp src/manager/ConversationManager.cpp
) )
if(COMPILE_WEB_CLIENT) if (COMPILE_WEB_CLIENT)
add_definitions(-DCOMPILE_WEB_CLIENT) add_definitions(-DCOMPILE_WEB_CLIENT)
set(SERVER_SOURCE_FILES set(SERVER_SOURCE_FILES
@ -141,13 +141,13 @@ if(COMPILE_WEB_CLIENT)
src/server/WebServer.cpp src/server/WebServer.cpp
src/client/web/WebClient.cpp src/client/web/WebClient.cpp
# src/server/web/WebRTCServer.cpp # src/server/web/WebRTCServer.cpp
src/client/web/WSWebClient.cpp src/client/web/WSWebClient.cpp
src/client/web/SampleHandler.cpp src/client/web/SampleHandler.cpp
src/client/SpeakingClientHandshake.cpp src/client/SpeakingClientHandshake.cpp
src/client/web/VoiceBridge.cpp src/client/web/VoiceBridge.cpp
) )
endif() endif ()
add_executable(PermHelper helpers/permgen.cpp) add_executable(PermHelper helpers/permgen.cpp)
target_link_libraries(PermHelper target_link_libraries(PermHelper
@ -186,7 +186,7 @@ target_link_libraries(PermHelper
${LIBRARY_PATH_BORINGSSL_CRYPTO} ${LIBRARY_PATH_BORINGSSL_CRYPTO}
dl dl
jemalloc jemalloc
) )
add_executable(PermMapHelper helpers/PermMapGen.cpp) add_executable(PermMapHelper helpers/PermMapGen.cpp)
target_link_libraries(PermMapHelper target_link_libraries(PermMapHelper
@ -231,35 +231,34 @@ target_link_libraries(PermMapHelper
SET(CPACK_PACKAGE_VERSION_MAJOR "1") SET(CPACK_PACKAGE_VERSION_MAJOR "1")
SET(CPACK_PACKAGE_VERSION_MINOR "4") SET(CPACK_PACKAGE_VERSION_MINOR "4")
SET(CPACK_PACKAGE_VERSION_PATCH "4") SET(CPACK_PACKAGE_VERSION_PATCH "4")
if(BUILD_TYPE_NAME EQUAL OFF) if (BUILD_TYPE_NAME EQUAL OFF)
SET(CPACK_PACKAGE_VERSION_DATA "beta") SET(CPACK_PACKAGE_VERSION_DATA "beta")
elseif(BUILD_TYPE_NAME STREQUAL "") elseif (BUILD_TYPE_NAME STREQUAL "")
SET(CPACK_PACKAGE_VERSION_DATA "") SET(CPACK_PACKAGE_VERSION_DATA "")
else() else ()
SET(CPACK_PACKAGE_VERSION_DATA "-${BUILD_TYPE_NAME}") SET(CPACK_PACKAGE_VERSION_DATA "-${BUILD_TYPE_NAME}")
endif() endif ()
if(BUILD_TYPE EQUAL OFF) if (BUILD_TYPE EQUAL OFF)
SET(BUILD_TYPE "1") SET(BUILD_TYPE "1")
endif() endif ()
set_source_files_properties(src/build.cpp PROPERTIES set_source_files_properties(src/build.cpp PROPERTIES
COMPILE_FLAGS "-DBUILD_MAJOR=${CPACK_PACKAGE_VERSION_MAJOR} -DBUILD_MINOR=${CPACK_PACKAGE_VERSION_MINOR} -DBUILD_PATCH=${CPACK_PACKAGE_VERSION_PATCH} -DBUILD_DATA=\"${CPACK_PACKAGE_VERSION_DATA}\" -DBUILD_TYPE=${BUILD_TYPE} -DBUILD_COUNT=0") COMPILE_FLAGS "-DBUILD_MAJOR=${CPACK_PACKAGE_VERSION_MAJOR} -DBUILD_MINOR=${CPACK_PACKAGE_VERSION_MINOR} -DBUILD_PATCH=${CPACK_PACKAGE_VERSION_PATCH} -DBUILD_DATA=\"${CPACK_PACKAGE_VERSION_DATA}\" -DBUILD_TYPE=${BUILD_TYPE} -DBUILD_COUNT=0")
file(WRITE repro/env/buildVersion.txt "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}${CPACK_PACKAGE_VERSION_DATA}") file(WRITE repro/env/buildVersion.txt "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}${CPACK_PACKAGE_VERSION_DATA}")
add_executable(TeaSpeakServer ${SERVER_SOURCE_FILES}) add_executable(TeaSpeakServer ${SERVER_SOURCE_FILES})
target_link_libraries(TeaSpeakServer target_link_libraries(TeaSpeakServer
${LIBRARY_PATH_THREAD_POOL} #Static threadpool::static #Static
TeaSpeak #Static TeaSpeak #Static
TeaLicenseHelper #Static TeaLicenseHelper #Static
TeaMusic #Static TeaMusic #Static
${LIBRARY_PATH_TERMINAL} #Static CXXTerminal::static #Static
${LIBRARY_PATH_VARIBALES} ${StringVariable_LIBRARIES_STATIC}
${LIBRARY_PATH_YAML} ${YAML_CPP_LIBRARIES}
pthread pthread
stdc++fs stdc++fs
${LIBEVENT_PATH}/libevent.a event_static event_pthreads
${LIBEVENT_PATH}/libevent_pthreads.a opus::static
${LIBRARY_PATH_OPUS} yaml-cpp
${LIBRARY_PATH_JSON}
${LIBRARY_PATH_PROTOBUF} ${LIBRARY_PATH_PROTOBUF}
#We're forsed to use boringssl caused by the fact that boringssl is already within webrtc! #We're forsed to use boringssl caused by the fact that boringssl is already within webrtc!
@ -267,43 +266,43 @@ target_link_libraries(TeaSpeakServer
#Require a so #Require a so
sqlite3 sqlite3
${LIBRARY_PATH_BREAKPAD} breakpad::static
${LIBRARY_PATH_PROTOBUF} protobuf::libprotobuf
jemalloc::shared
#${LIBWEBRTC_LIBRARIES} #ATTENTIAN! WebRTC does not work with crypto! (Already contains a crypto version) tomcrypt::static
${LIBRARY_TOM_CRYPT} tommath::static
${LIBRARY_TOM_MATH}
mysqlclient.a mysqlclient.a
jsoncpp_lib
${ed25519_LIBRARIES_STATIC}
)
${LIBRARY_PATH_ED255} if (${COMPILE_WEB_CLIENT})
)
if(${COMPILE_WEB_CLIENT})
find_package(UsrSCTP REQUIRED) find_package(UsrSCTP REQUIRED)
target_link_libraries(TeaSpeakServer target_link_libraries(TeaSpeakServer
${LIBRARY_PATH_DATA_PIPES} ${DataPipes_LIBRARIES_SHARED}
${LIBRARY_PATH_NICE} ${LIBRARY_PATH_NICE}
${LIBRARY_PATH_GLIBC} ${LIBRARY_PATH_GLIBC}
) )
#target_link_options(TeaSpeakServer PUBLIC "-Wl,--no-as-needed" "${LIBRARY_PATH_DATA_PIPES}" "${LIBRARY_PATH_NICE}" "-Wl,--as-needed") #target_link_options(TeaSpeakServer PUBLIC "-Wl,--no-as-needed" "${LIBRARY_PATH_DATA_PIPES}" "${LIBRARY_PATH_NICE}" "-Wl,--as-needed")
endif() endif ()
include_directories(${LIBRARY_PATH}/boringssl/include/) include_directories(${LIBRARY_PATH}/boringssl/include/)
target_link_libraries(TeaSpeakServer target_link_libraries(TeaSpeakServer
${LIBRARY_PATH_BORINGSSL_SSL} openssl::ssl::shared
${LIBRARY_PATH_BORINGSSL_CRYPTO} openssl::crypto::shared
dl dl
z z
) )
set(DISABLE_JEMALLOC ON) set(DISABLE_JEMALLOC ON)
if(NOT DISABLE_JEMALLOC) if (NOT DISABLE_JEMALLOC)
target_link_libraries(TeaSpeakServer target_link_libraries(TeaSpeakServer
jemalloc jemalloc
) )
add_definitions(-DHAVE_JEMALLOC) add_definitions(-DHAVE_JEMALLOC)
endif() endif ()
#Fix RPATH #Fix RPATH
#patchelf --set-rpath ./libs/ TeaSpeakServer #patchelf --set-rpath ./libs/ TeaSpeakServer

View File

@ -540,10 +540,10 @@ namespace ts {
CommandResult handleCommandMusicBotPlayerInfo(Command&); //TODO: Use cached permission values CommandResult handleCommandMusicBotPlayerInfo(Command&); //TODO: Use cached permission values
CommandResult handleCommandMusicBotPlayerAction(Command&); //TODO: Use cached permission values CommandResult handleCommandMusicBotPlayerAction(Command&); //TODO: Use cached permission values
CommandResult handleCommandMusicBotQueueList(Command&); //TODO: Use cached permission values command_result handleCommandMusicBotQueueList(Command&); //TODO: Use cached permission values
CommandResult handleCommandMusicBotQueueAdd(Command&); //TODO: Use cached permission values command_result handleCommandMusicBotQueueAdd(Command&); //TODO: Use cached permission values
CommandResult handleCommandMusicBotQueueRemove(Command&); //TODO: Use cached permission values command_result handleCommandMusicBotQueueRemove(Command&); //TODO: Use cached permission values
CommandResult handleCommandMusicBotQueueReorder(Command&); //TODO: Use cached permission values command_result handleCommandMusicBotQueueReorder(Command&); //TODO: Use cached permission values
CommandResult handleCommandMusicBotPlaylistAssign(Command&); CommandResult handleCommandMusicBotPlaylistAssign(Command&);

View File

@ -330,10 +330,10 @@ CommandResult ConnectedClient::handleCommand(Command &cmd) {
else if (command == "musicbotsetsubscription") return this->handleCommandMusicBotSetSubscription(cmd); else if (command == "musicbotsetsubscription") return this->handleCommandMusicBotSetSubscription(cmd);
else if (command == "musicbotplayerinfo") return this->handleCommandMusicBotPlayerInfo(cmd); else if (command == "musicbotplayerinfo") return this->handleCommandMusicBotPlayerInfo(cmd);
else if (command == "musicbotplayeraction") return this->handleCommandMusicBotPlayerAction(cmd); else if (command == "musicbotplayeraction") return this->handleCommandMusicBotPlayerAction(cmd);
else if (command == "musicbotqueuelist") return this->handleCommandMusicBotQueueList(cmd); else if (command == "musicbotqueuelist") return this->handleCommandMusicBotQueueList(cmd).as_command_result();
else if (command == "musicbotqueueadd") return this->handleCommandMusicBotQueueAdd(cmd); else if (command == "musicbotqueueadd") return this->handleCommandMusicBotQueueAdd(cmd).as_command_result();
else if (command == "musicbotqueueremove") return this->handleCommandMusicBotQueueRemove(cmd); else if (command == "musicbotqueueremove") return this->handleCommandMusicBotQueueRemove(cmd).as_command_result();
else if (command == "musicbotqueuereorder") return this->handleCommandMusicBotQueueReorder(cmd); else if (command == "musicbotqueuereorder") return this->handleCommandMusicBotQueueReorder(cmd).as_command_result();
else if (command == "musicbotplaylistassign") return this->handleCommandMusicBotPlaylistAssign(cmd); else if (command == "musicbotplaylistassign") return this->handleCommandMusicBotPlaylistAssign(cmd);
else if (command == "help") return this->handleCommandHelp(cmd); else if (command == "help") return this->handleCommandHelp(cmd);
@ -5738,7 +5738,7 @@ CommandResult ConnectedClient::handleCommandVersion(Command &) {
res["version"] = build::version()->string(false); res["version"] = build::version()->string(false);
res["build_count"] = build::buildCount(); res["build_count"] = build::buildCount();
res["build"] = duration_cast<seconds>(build::version()->timestamp.time_since_epoch()).count(); res["build"] = duration_cast<seconds>(build::version()->timestamp.time_since_epoch()).count();
#ifdef WINDOWS #ifdef WIN32
res["platform"] = "Windows"; res["platform"] = "Windows";
#else #else
res["platform"] = "Linux"; res["platform"] = "Linux";
@ -7114,8 +7114,8 @@ CommandResult ConnectedClient::handleCommandPlaylistSongRemove(ts::Command &cmd)
return CommandResult::Success; return CommandResult::Success;
} }
CommandResult ConnectedClient::handleCommandMusicBotQueueList(Command& cmd) { command_result ConnectedClient::handleCommandMusicBotQueueList(Command& cmd) {
return CommandResult::NotImplemented; //FIXME return command_result{error::not_implemented}; //FIXME
/* /*
CMD_REQ_SERVER; CMD_REQ_SERVER;
@ -7195,8 +7195,8 @@ CommandResult ConnectedClient::handleCommandMusicBotQueueList(Command& cmd) {
*/ */
} }
CommandResult ConnectedClient::handleCommandMusicBotQueueAdd(Command& cmd) { command_result ConnectedClient::handleCommandMusicBotQueueAdd(Command& cmd) {
return CommandResult::NotImplemented; //FIXME return command_result{error::not_implemented}; //FIXME
/* /*
CMD_REQ_SERVER; CMD_REQ_SERVER;
@ -7231,8 +7231,8 @@ CommandResult ConnectedClient::handleCommandMusicBotQueueAdd(Command& cmd) {
*/ */
} }
CommandResult ConnectedClient::handleCommandMusicBotQueueRemove(Command& cmd) { command_result ConnectedClient::handleCommandMusicBotQueueRemove(Command& cmd) {
return CommandResult::NotImplemented; //FIXME return command_result{error::not_implemented}; //FIXME
/* /*
CMD_REQ_SERVER; CMD_REQ_SERVER;
@ -7263,8 +7263,8 @@ CommandResult ConnectedClient::handleCommandMusicBotQueueRemove(Command& cmd) {
*/ */
} }
CommandResult ConnectedClient::handleCommandMusicBotQueueReorder(Command& cmd) { command_result ConnectedClient::handleCommandMusicBotQueueReorder(Command& cmd) {
return CommandResult::NotImplemented; //FIXME return command_result{error::not_implemented}; //FIXME
/* /*
CMD_REQ_SERVER; CMD_REQ_SERVER;

2
shared

@ -1 +1 @@
Subproject commit b85c51951cd01b3535b9dd782908d02cac8f1455 Subproject commit 73f292f9517c82260a5d1b6e3beee3cfcf0a6f5f