From 5a951b9398060e9194b9d32050c0e1169186b55f Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Thu, 24 Oct 2019 20:03:13 +0200 Subject: [PATCH 1/2] Add unbound for linux --- .gitignore | 3 +- .gitmodules | 3 ++ client | 2 +- cmake/FindOpus.cmake | 65 +++++++++++++++++------------ cmake/Findunbound.cmake | 67 ++++++++++++++++++++++++++++++ cmake/config/tearoot-client.cmake | 1 + third_party/.build_jsoncpp.sh.swp | Bin 1024 -> 0 bytes third_party/boringssl | 2 +- third_party/build_boringssl.sh | 17 ++++---- third_party/build_unbound.sh | 51 +++++++++++++++++++++++ third_party/unbound | 1 + 11 files changed, 176 insertions(+), 36 deletions(-) create mode 100644 cmake/Findunbound.cmake delete mode 100644 third_party/.build_jsoncpp.sh.swp create mode 100755 third_party/build_unbound.sh create mode 160000 third_party/unbound diff --git a/.gitignore b/.gitignore index 562b66d..9ba640d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .idea/ -out/ \ No newline at end of file +out/ +**/.build_*_*.txt diff --git a/.gitmodules b/.gitmodules index eae8cb4..f404fd5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -70,3 +70,6 @@ [submodule "build-helpers"] path = build-helpers url = https://github.com/WolverinDEV/build-helpers.git +[submodule "third_party/unbound"] + path = third_party/unbound + url = https://github.com/NLnetLabs/unbound.git diff --git a/client b/client index 6def999..a39f573 160000 --- a/client +++ b/client @@ -1 +1 @@ -Subproject commit 6def99931862133eaa37b5de6146f97ff3802188 +Subproject commit a39f573a5fedb43167ce841f51b30d7d75905135 diff --git a/cmake/FindOpus.cmake b/cmake/FindOpus.cmake index f162ec5..53d4ff1 100644 --- a/cmake/FindOpus.cmake +++ b/cmake/FindOpus.cmake @@ -21,33 +21,46 @@ include(tearoot-helper) include(FindPackageHandleStandardArgs) -find_path(opus_ROOT_DIR - NAMES include/opus/opus.h - HINTS ${opus_ROOT_DIR} ${opus_ROOT_DIR}/${BUILD_OUTPUT} -) +function(resolve_opus) + find_path(opus_ROOT_DIR + NAMES include/opus/opus.h + HINTS ${opus_ROOT_DIR} ${opus_ROOT_DIR}/${BUILD_OUTPUT} + ) -find_path(opus_INCLUDE_DIR - NAMES opus/opus.h opus/opus_defines.h - HINTS ${opus_ROOT_DIR} ${opus_ROOT_DIR}/include/ -) + find_path(opus_INCLUDE_DIR + NAMES opus/opus.h opus/opus_defines.h + HINTS ${opus_ROOT_DIR} ${opus_ROOT_DIR}/include/ + ) -find_library(opus_LIBRARIES_STATIC - NAMES libopus.a opus.a opus.lib - HINTS ${opus_ROOT_DIR} ${opus_ROOT_DIR}/lib -) + find_library(opus_LIBRARIES_STATIC + NAMES libopus.a opus.a opus.lib + HINTS ${opus_ROOT_DIR} ${opus_ROOT_DIR}/lib + ) + + if(opus_LIBRARIES_STATIC) + add_library(opus::static SHARED IMPORTED) + set_target_properties(opus::static PROPERTIES + IMPORTED_LOCATION ${opus_LIBRARIES_STATIC} + INTERFACE_INCLUDE_DIRECTORIES ${opus_INCLUDE_DIR} + ) + endif() -find_library(opus_LIBRARIES_SHARED - NAMES opus.dll libopus.so opus.so - HINTS ${opus_ROOT_DIR} ${opus_ROOT_DIR}/lib -) + find_library(opus_LIBRARIES_SHARED + NAMES opus.dll libopus.so opus.so + HINTS ${opus_ROOT_DIR} ${opus_ROOT_DIR}/lib + ) + + if(opus_LIBRARIES_SHARED) + add_library(opus::shared SHARED IMPORTED) + set_target_properties(opus::shared PROPERTIES + IMPORTED_LOCATION ${opus_LIBRARIES_SHARED} + INTERFACE_INCLUDE_DIRECTORIES ${opus_INCLUDE_DIR} + ) + endif() + + find_package_handle_standard_args(opus DEFAULT_MSG + opus_INCLUDE_DIR + ) +endfunction() +resolve_opus() -find_package_handle_standard_args(opus DEFAULT_MSG - opus_INCLUDE_DIR -) - -mark_as_advanced( - opus_ROOT_DIR - opus_INCLUDE_DIR - opus_LIBRARIES_STATIC - opus_LIBRARIES_SHARED -) \ No newline at end of file diff --git a/cmake/Findunbound.cmake b/cmake/Findunbound.cmake new file mode 100644 index 0000000..9f21a2c --- /dev/null +++ b/cmake/Findunbound.cmake @@ -0,0 +1,67 @@ +# - Try to find unbound include dirs and libraries +# +# Usage of this module as follows: +# +# find_package(unbound) +# +# Variables used by this module, they can change the default behaviour and need +# to be set before calling find_package: +# +# unbound_ROOT_DIR Set this variable to the root installation of +# unbound if the module has problems finding the +# proper installation path. +# +# Variables defined by this module: +# +# unbound_FOUND System has unbound, include and library dirs found +# unbound_INCLUDE_DIR The unbound include directories. +# unbound_LIBRARIES_STATIC The unbound libraries. +# unbound_LIBRARIES_SHARED The unbound libraries. + +include(tearoot-helper) +include(FindPackageHandleStandardArgs) + +function(resolve_unbound) + find_path(unbound_ROOT_DIR + NAMES include/unbound.h include/unbound-event.h + HINTS ${unbound_ROOT_DIR} ${unbound_ROOT_DIR}/${BUILD_OUTPUT} + ) + + find_path(unbound_INCLUDE_DIR + NAMES include/unbound.h include/unbound-event.h + HINTS ${unbound_ROOT_DIR} + ) + + find_library(unbound_LIBRARIES_STATIC + NAMES libunbound.a unbound.a unbound.lib + HINTS ${unbound_ROOT_DIR} ${unbound_ROOT_DIR}/lib + ) + + if(unbound_LIBRARIES_STATIC) + add_library(unbound::static SHARED IMPORTED) + set_target_properties(unbound::static PROPERTIES + IMPORTED_LOCATION ${unbound_LIBRARIES_STATIC} + INTERFACE_INCLUDE_DIRECTORIES ${unbound_INCLUDE_DIR} + ) + endif() + + find_library(unbound_LIBRARIES_SHARED + NAMES unbound.dll libunbound.so unbound.so + HINTS ${unbound_ROOT_DIR} ${unbound_ROOT_DIR}/lib + ) + + if(unbound_LIBRARIES_SHARED) + add_library(unbound::shared SHARED IMPORTED) + set_target_properties(unbound::shared PROPERTIES + IMPORTED_LOCATION ${unbound_LIBRARIES_SHARED} + INTERFACE_INCLUDE_DIRECTORIES ${unbound_INCLUDE_DIR} + ) + endif() + + find_package_handle_standard_args(unbound DEFAULT_MSG + unbound_INCLUDE_DIR + ) +endfunction() +resolve_unbound() + + diff --git a/cmake/config/tearoot-client.cmake b/cmake/config/tearoot-client.cmake index 865af21..48dba5b 100644 --- a/cmake/config/tearoot-client.cmake +++ b/cmake/config/tearoot-client.cmake @@ -27,6 +27,7 @@ SET(PortAudio_ROOT_DIR "${LIBRARY_PATH}/portaudio/${BUILD_OUTPUT}") SET(fvad_ROOT_DIR "${LIBRARY_PATH}/libfvad/${BUILD_OUTPUT}") SET(opus_ROOT_DIR "${LIBRARY_PATH}/opus/${BUILD_OUTPUT}") SET(breakpad_ROOT_DIR "${LIBRARY_PATH}/breakpad/${BUILD_OUTPUT}") +SET(unbound_ROOT_DIR "${LIBRARY_PATH}/unbound/${BUILD_OUTPUT}") SET(TeaSpeak_SharedLib_ROOT_DIR "${LIBRARY_PATH}/../shared/") set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${LIBRARY_PATH}/spdlog/${BUILD_OUTPUT}") \ No newline at end of file diff --git a/third_party/.build_jsoncpp.sh.swp b/third_party/.build_jsoncpp.sh.swp deleted file mode 100644 index c7500c10d56e3ad6b69dadddef036ee8e4468866..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1024 zcmYc?$V<%2S1{7E)H7y40=jYx4CVPbWvNA(c`2!7NHUnraHu*L*Dy>;B$1@j%$$_? atm6E< /dev/null if [[ $? -ne 0 ]]; then echo "#if false @@ -64,4 +67,4 @@ else fi cd ../../../ -set_build_successful ${library_path} \ No newline at end of file +set_build_successful ${library_path} diff --git a/third_party/build_unbound.sh b/third_party/build_unbound.sh new file mode 100755 index 0000000..980df7c --- /dev/null +++ b/third_party/build_unbound.sh @@ -0,0 +1,51 @@ +#!/usr/bin/env bash + +source ../scripts/build_helper.sh +library_path="unbound" +requires_rebuild ${library_path} +[[ $? -eq 0 ]] && exit 0 + +generate_build_path "${library_path}" +library_event=`pwd`/libevent/out/${build_os_type}_${build_os_arch}/ +library_boringssl=`pwd`/boringssl/lib/ + + +if [[ -d ${build_path} ]]; then + echo "Removing old build directory" + rm -r ${build_path} +fi + +mkdir -p ${build_path} +check_err_exit ${library_path} "Failed to create build directory" +cd ${build_path} +check_err_exit ${library_path} "Failed to enter build directory" + +if [[ ${build_os_type} == "linux" ]]; then + #Failed to build with BoringSSL, so we using openssl. No ABI stuff should be changed! + # --with-ssl=${library_boringssl} + ../../configure --with-libunbound-only --with-libevent=${library_event} --enable-event-api --enable-shared=no --enable-static=yes --with-pthreads --enable-pic --prefix=`pwd` + check_err_exit ${library_path} "Failed to configure build" + make CXXFLAGS="${CXX_FLAGS}" CFLAGS="${C_FLAGS}" ${MAKE_OPTIONS} + check_err_exit ${library_path} "Failed to build" + make install + check_err_exit ${library_path} "Failed to install" +elif [[ ${build_os_type} == "win32" ]]; then + exit 1 #TODO + cmake ../../ -G"Visual Studio 14 2015 Win64" -DOPENSSL_NO_ASM=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=. -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded" + check_err_exit ${library_path} "Failed generate build files!" + + cmake --build . --target crypto --config release -j 8 + #MSBuild.exe //p:Configuration=Release //p:Platform=x64 crypto/crypto.vcxproj + check_err_exit ${library_path} "Failed to build crytp!" + + cmake --build . --target ssl --config release -j 8 + #MSBuild.exe //p:Configuration=Release //p:Platform=x64 ssl/ssl.vcxproj + check_err_exit ${library_path} "Failed to build ssl!" +else + echo "Invalid OS!" + exit 1 +fi +cd ../../../ + +set_build_successful ${library_path} + diff --git a/third_party/unbound b/third_party/unbound new file mode 160000 index 0000000..7dfbcdf --- /dev/null +++ b/third_party/unbound @@ -0,0 +1 @@ +Subproject commit 7dfbcdf276e7a1070978209d2533b3b8cc504f86 From 67839ab85eedb795a76c857ddb8c929b731cac23 Mon Sep 17 00:00:00 2001 From: WolverinDEV Date: Thu, 24 Oct 2019 20:03:59 +0200 Subject: [PATCH 2/2] Fixed shared rev --- shared | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared b/shared index 5fff436..c532266 160000 --- a/shared +++ b/shared @@ -1 +1 @@ -Subproject commit 5fff4369ef7fad88d6872e3ce7d92e4b88c000c6 +Subproject commit c532266cb8b1ba577e063c6ed14a810374c8c84f