From 57fdbe29025cf93097ac055ff0cef23e7a259c09 Mon Sep 17 00:00:00 2001 From: wowario Date: Wed, 14 Jul 2021 14:54:11 +0300 Subject: [PATCH] add back unbound --- .github/workflows/build.yml | 2 +- .gitmodules | 4 ++++ CMakeLists.txt | 4 +++- contrib/depends/packages/expat.mk | 6 +++--- contrib/depends/packages/ldns.mk | 6 +++--- contrib/depends/packages/packages.mk | 2 +- contrib/depends/packages/unbound.mk | 8 ++++---- contrib/depends/toolchain.cmake.in | 2 -- external/CMakeLists.txt | 20 +++++++++++++++++--- external/unbound | 1 + src/common/CMakeLists.txt | 2 +- 11 files changed, 38 insertions(+), 19 deletions(-) create mode 160000 external/unbound diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 68312ac04..36eab5027 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -54,7 +54,7 @@ jobs: - uses: eine/setup-msys2@v2 with: update: true - install: mingw-w64-x86_64-toolchain make mingw-w64-x86_64-cmake mingw-w64-x86_64-ccache mingw-w64-x86_64-boost mingw-w64-x86_64-openssl mingw-w64-x86_64-zeromq mingw-w64-x86_64-libsodium mingw-w64-x86_64-hidapi mingw-w64-x86_64-protobuf-c mingw-w64-x86_64-libusb mingw-w64-x86_64-unbound git + install: mingw-w64-x86_64-toolchain make mingw-w64-x86_64-cmake mingw-w64-x86_64-ccache mingw-w64-x86_64-boost mingw-w64-x86_64-openssl mingw-w64-x86_64-zeromq mingw-w64-x86_64-libsodium mingw-w64-x86_64-hidapi mingw-w64-x86_64-protobuf-c mingw-w64-x86_64-libusb git - name: build run: | ccache --max-size=150M diff --git a/.gitmodules b/.gitmodules index d9842110a..b71641c43 100644 --- a/.gitmodules +++ b/.gitmodules @@ -12,3 +12,7 @@ path = external/RandomWOW url = https://git.wownero.com/wownero/RandomWOW branch = 1.1.9-wow +[submodule "external/unbound"] + path = external/unbound + url = https://github.com/monero-project/unbound + branch = monero diff --git a/CMakeLists.txt b/CMakeLists.txt index d1e53ba0a..20571f043 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -307,6 +307,7 @@ if(NOT MANUAL_SUBMODULES) message(STATUS "Checking submodules") check_submodule(external/miniupnp) + check_submodule(external/unbound) check_submodule(external/rapidjson) check_submodule(external/RandomWOW) check_submodule(external/supercop) @@ -611,7 +612,8 @@ include_directories("${CMAKE_CURRENT_BINARY_DIR}/translations") add_subdirectory(external) # Final setup for libunbound -include_directories(${UNBOUND_INCLUDE_DIR}) +include_directories(${UNBOUND_INCLUDE}) +link_directories(${UNBOUND_LIBRARY_DIRS}) # Final setup for easylogging++ include_directories(${EASYLOGGING_INCLUDE}) diff --git a/contrib/depends/packages/expat.mk b/contrib/depends/packages/expat.mk index 1e1b9dbb8..d73a5e307 100644 --- a/contrib/depends/packages/expat.mk +++ b/contrib/depends/packages/expat.mk @@ -1,8 +1,8 @@ package=expat -$(package)_version=2.4.1 -$(package)_download_path=https://github.com/libexpat/libexpat/releases/download/R_2_4_1 +$(package)_version=2.2.4 +$(package)_download_path=https://github.com/libexpat/libexpat/releases/download/R_2_2_4 $(package)_file_name=$(package)-$($(package)_version).tar.bz2 -$(package)_sha256_hash=2f9b6a580b94577b150a7d5617ad4643a4301a6616ff459307df3e225bcfbf40 +$(package)_sha256_hash=03ad85db965f8ab2d27328abcf0bc5571af6ec0a414874b2066ee3fdd372019e define $(package)_set_vars $(package)_config_opts=--enable-static diff --git a/contrib/depends/packages/ldns.mk b/contrib/depends/packages/ldns.mk index 90c63e821..6fbcc3466 100644 --- a/contrib/depends/packages/ldns.mk +++ b/contrib/depends/packages/ldns.mk @@ -1,8 +1,8 @@ package=ldns -$(package)_version=1.7.1 -$(package)_download_path=https://www.nlnetlabs.nl/downloads/$(package)/ +$(package)_version=1.6.17 +$(package)_download_path=https://www.nlnetlabs.nl/downloads/ldns/ $(package)_file_name=$(package)-$($(package)_version).tar.gz -$(package)_sha256_hash=8ac84c16bdca60e710eea75782356f3ac3b55680d40e1530d7cea474ac208229 +$(package)_sha256_hash=8b88e059452118e8949a2752a55ce59bc71fa5bc414103e17f5b6b06f9bcc8cd $(package)_dependencies=openssl define $(package)_set_vars diff --git a/contrib/depends/packages/packages.mk b/contrib/depends/packages/packages.mk index 56ce425bb..95b23a37e 100644 --- a/contrib/depends/packages/packages.mk +++ b/contrib/depends/packages/packages.mk @@ -1,4 +1,4 @@ -packages:=boost openssl zeromq libiconv expat ldns unbound +packages:=boost openssl zeromq libiconv native_packages := native_ccache diff --git a/contrib/depends/packages/unbound.mk b/contrib/depends/packages/unbound.mk index 328a059c6..733a7f232 100644 --- a/contrib/depends/packages/unbound.mk +++ b/contrib/depends/packages/unbound.mk @@ -1,12 +1,12 @@ package=unbound -$(package)_version=1.13.1 -$(package)_download_path=https://www.nlnetlabs.nl/downloads/$(package)/ +$(package)_version=1.6.8 +$(package)_download_path=https://www.unbound.net/downloads/ $(package)_file_name=$(package)-$($(package)_version).tar.gz -$(package)_sha256_hash=8504d97b8fc5bd897345c95d116e0ee0ddf8c8ff99590ab2b4bd13278c9f50b8 +$(package)_sha256_hash=e3b428e33f56a45417107448418865fe08d58e0e7fea199b855515f60884dd49 $(package)_dependencies=openssl expat ldns define $(package)_set_vars - $(package)_config_opts=--disable-shared --enable-static --without-pyunbound --prefix=$(host_prefix) --with-libexpat=$(host_prefix) --with-ssl=$(host_prefix) --with-libevent=no --without-pythonmodule --disable-flto --with-pthreads --with-libunbound-only + $(package)_config_opts=--disable-shared --enable-static --without-pyunbound --prefix=$(host_prefix) --with-libexpat=$(host_prefix) --with-ssl=$(host_prefix) --with-libevent=no --without-pythonmodule --disable-flto --with-pthreads $(package)_config_opts_linux=--with-pic $(package)_config_opts_w64=--enable-static-exe --sysconfdir=/etc --prefix=$(host_prefix) --target=$(host_prefix) $(package)_build_opts_mingw32=LDFLAGS="$($(package)_ldflags) -lpthread" diff --git a/contrib/depends/toolchain.cmake.in b/contrib/depends/toolchain.cmake.in index a87b9c058..96ac69a5d 100644 --- a/contrib/depends/toolchain.cmake.in +++ b/contrib/depends/toolchain.cmake.in @@ -24,8 +24,6 @@ SET(Readline_INCLUDE_DIR @prefix@/include) SET(Readline_LIBRARY @prefix@/lib/libreadline.a) SET(Terminfo_LIBRARY @prefix@/lib/libtinfo.a) -SET(UNBOUND_INCLUDE_DIR @prefix@/include) -SET(UNBOUND_LIBRARIES @prefix@/lib/libunbound.a) SET(LRELEASE_PATH @prefix@/native/bin CACHE FILEPATH "path to lrelease" FORCE) diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 29ebcd69d..af203aa61 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -55,12 +55,26 @@ set(UPNP_LIBRARIES "libminiupnpc-static" PARENT_SCOPE) find_package(Unbound) -if(NOT UNBOUND_INCLUDE_DIR) - die("Could not find libunbound") +if(NOT UNBOUND_INCLUDE_DIR OR STATIC) + # NOTE: If STATIC is true, CMAKE_FIND_LIBRARY_SUFFIXES has been reordered. + # unbound has config tests which used OpenSSL libraries, so -ldl may need to + # be set in this case. + # The unbound CMakeLists.txt can set it, since it's also needed for the + # static OpenSSL libraries set up there after with target_link_libraries. + add_subdirectory(unbound) + + set(UNBOUND_STATIC true PARENT_SCOPE) + set(UNBOUND_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/unbound/libunbound" PARENT_SCOPE) + set(UNBOUND_LIBRARY "unbound" PARENT_SCOPE) + set(UNBOUND_LIBRARY_DIRS "${LIBEVENT2_LIBDIR}" PARENT_SCOPE) else() message(STATUS "Found libunbound include (unbound.h) in ${UNBOUND_INCLUDE_DIR}") if(UNBOUND_LIBRARIES) - message(STATUS "Found libunbound library") + message(STATUS "Found libunbound shared library") + set(UNBOUND_STATIC false PARENT_SCOPE) + set(UNBOUND_INCLUDE ${UNBOUND_INCLUDE_DIR} PARENT_SCOPE) + set(UNBOUND_LIBRARY ${UNBOUND_LIBRARIES} PARENT_SCOPE) + set(UNBOUND_LIBRARY_DIRS "" PARENT_SCOPE) else() die("Found libunbound includes, but could not find libunbound library. Please make sure you have installed libunbound or libunbound-dev or the equivalent") endif() diff --git a/external/unbound b/external/unbound new file mode 160000 index 000000000..0f6c0579d --- /dev/null +++ b/external/unbound @@ -0,0 +1 @@ +Subproject commit 0f6c0579d66b65f86066e30e7876105ba2775ef4 diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 99d9bd8bf..8e427b6b8 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -99,7 +99,7 @@ monero_add_library(common target_link_libraries(common PUBLIC cncrypto - ${UNBOUND_LIBRARIES} + ${UNBOUND_LIBRARY} ${LIBUNWIND_LIBRARIES} ${Boost_DATE_TIME_LIBRARY} ${Boost_FILESYSTEM_LIBRARY}