From eca6b6ad8d4acae3d29ece69585dbc26739b1f04 Mon Sep 17 00:00:00 2001 From: Jason Rhinelander Date: Fri, 8 Jan 2021 15:42:33 -0400 Subject: [PATCH] Disable Trezor by default Trezor support currently doesn't work (Trezor's hardware wallet is hard-coded for a Monero net-id), and this saves needing to muck around with protobuf. --- CMakeLists.txt | 7 +++++-- cmake/CheckTrezor.cmake | 1 - cmake/StaticBuild.cmake | 38 ++++++++++++++++++----------------- src/wallet/api/CMakeLists.txt | 7 ++++++- 4 files changed, 31 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 81b3d7eab..f3123f59c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -247,6 +247,8 @@ if (BUILD_TESTS) add_definitions(-DUNIT_TEST) endif() +OPTION(USE_DEVICE_TREZOR "Build Trezor support (currently non-functional)" OFF) + find_package(Git) if(NOT MANUAL_SUBMODULES) if(GIT_FOUND) @@ -496,8 +498,9 @@ add_subdirectory(external) target_compile_definitions(easylogging PRIVATE AUTO_INITIALIZE_EASYLOGGINGPP) -# Trezor support check -include(CheckTrezor) +if(USE_DEVICE_TREZOR) + include(CheckTrezor) +endif() if(MSVC) add_definitions("/bigobj /MP /W3 /GS- /D_CRT_SECURE_NO_WARNINGS /wd4996 /wd4345 /D_WIN32_WINNT=0x0600 /DWIN32_LEAN_AND_MEAN /DGTEST_HAS_TR1_TUPLE=0 /FIinline_c.h /D__SSE4_1__") diff --git a/cmake/CheckTrezor.cmake b/cmake/CheckTrezor.cmake index 2633326f4..153fe468b 100644 --- a/cmake/CheckTrezor.cmake +++ b/cmake/CheckTrezor.cmake @@ -1,4 +1,3 @@ -OPTION(USE_DEVICE_TREZOR "Trezor support compilation" ON) OPTION(USE_DEVICE_TREZOR_LIBUSB "Trezor LibUSB compilation" ON) OPTION(USE_DEVICE_TREZOR_UDP_RELEASE "Trezor UdpTransport in release mode" OFF) OPTION(USE_DEVICE_TREZOR_DEBUG "Trezor Debugging enabled" OFF) diff --git a/cmake/StaticBuild.cmake b/cmake/StaticBuild.cmake index 36a4f0a6e..5a2f5c02a 100644 --- a/cmake/StaticBuild.cmake +++ b/cmake/StaticBuild.cmake @@ -540,25 +540,27 @@ endif() -set(protobuf_extra "") -if(ANDROID) - set(protobuf_extra "LDFLAGS=-llog") +if(USE_DEVICE_TREZOR) + set(protobuf_extra "") + if(ANDROID) + set(protobuf_extra "LDFLAGS=-llog") + endif() + build_external(protobuf + CONFIGURE_COMMAND + ./configure ${cross_host} --disable-shared --prefix=${DEPS_DESTDIR} --with-pic + "CC=${deps_cc}" "CXX=${deps_cxx}" "CFLAGS=${deps_CFLAGS}" "CXXFLAGS=${deps_CXXFLAGS}" + ${cross_extra} ${protobuf_extra} + "CPP=${deps_cc} -E" "CXXCPP=${deps_cxx} -E" + "CC_FOR_BUILD=${deps_cc}" "CXX_FOR_BUILD=${deps_cxx}" # Thanks Google for making people hunt for undocumented magic variables + BUILD_BYPRODUCTS + ${DEPS_DESTDIR}/lib/libprotobuf-lite.a + ${DEPS_DESTDIR}/lib/libprotobuf.a + ${DEPS_DESTDIR}/lib/libprotoc.a + ${DEPS_DESTDIR}/include/google/protobuf + ) + add_static_target(protobuf_lite protobuf_external libprotobuf-lite.a) + add_static_target(protobuf_bloated protobuf_external libprotobuf.a) endif() -build_external(protobuf - CONFIGURE_COMMAND - ./configure ${cross_host} --disable-shared --prefix=${DEPS_DESTDIR} --with-pic - "CC=${deps_cc}" "CXX=${deps_cxx}" "CFLAGS=${deps_CFLAGS}" "CXXFLAGS=${deps_CXXFLAGS}" - ${cross_extra} ${protobuf_extra} - "CPP=${deps_cc} -E" "CXXCPP=${deps_cxx} -E" - "CC_FOR_BUILD=${deps_cc}" "CXX_FOR_BUILD=${deps_cxx}" # Thanks Google for making people hunt for undocumented magic variables - BUILD_BYPRODUCTS - ${DEPS_DESTDIR}/lib/libprotobuf-lite.a - ${DEPS_DESTDIR}/lib/libprotobuf.a - ${DEPS_DESTDIR}/lib/libprotoc.a - ${DEPS_DESTDIR}/include/google/protobuf -) -add_static_target(protobuf_lite protobuf_external libprotobuf-lite.a) -add_static_target(protobuf_bloated protobuf_external libprotobuf.a) diff --git a/src/wallet/api/CMakeLists.txt b/src/wallet/api/CMakeLists.txt index e8312be07..8141fd678 100644 --- a/src/wallet/api/CMakeLists.txt +++ b/src/wallet/api/CMakeLists.txt @@ -95,6 +95,11 @@ function(combine_archives output_archive) endfunction(combine_archives) if (STATIC AND BUILD_STATIC_DEPS) + set(merged_protobuf) + if(TARGET protobuf_lite) + set(merged_protobuf protobuf_lite) + endif() + combine_archives(wallet_merged wallet_api wallet @@ -124,7 +129,7 @@ if (STATIC AND BUILD_STATIC_DEPS) expat libunbound sqlite3 - protobuf_lite + ${merged_protobuf} sodium libzmq CURL::libcurl