diff options
Diffstat (limited to '')
-rw-r--r-- | debian/patches/0002-Use-system-libsexpp-library.patch | 175 |
1 files changed, 175 insertions, 0 deletions
diff --git a/debian/patches/0002-Use-system-libsexpp-library.patch b/debian/patches/0002-Use-system-libsexpp-library.patch new file mode 100644 index 0000000..4338313 --- /dev/null +++ b/debian/patches/0002-Use-system-libsexpp-library.patch @@ -0,0 +1,175 @@ +From: Daniel Kahn Gillmor <dkg@fifthhorseman.net> +Date: Wed, 21 Jun 2023 14:12:26 +0200 +Subject: Use system libsexpp library + +cherry picked the necessary pieces from upstream commits: + + 3e9831ac3409095db40b7967866b9197eb36ff64 + df4f24bd48b6691692379f1370fde3c12e96e3ab + f9147e72a369f1e412d2f2385cf23a3e9dd6882d + 82d9747f1da36db0393c122b451a847cf561bb7c +--- + CMakeLists.txt | 29 +++++++++++++++++++++++++---- + src/lib/CMakeLists.txt | 28 +++++++++++++++++++--------- + src/librekey/g23_sexp.hpp | 4 ++-- + src/tests/CMakeLists.txt | 3 ++- + 4 files changed, 48 insertions(+), 16 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index bb6d40c..1d75f1a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -58,6 +58,8 @@ option(ENABLE_COVERAGE "Enable code coverage testing.") + option(ENABLE_SANITIZERS "Enable ASan and other sanitizers.") + option(ENABLE_FUZZERS "Enable fuzz targets.") + option(DOWNLOAD_GTEST "Download Googletest" On) ++option(SYSTEM_LIBSEXPP "Use system sexpp library" OFF) ++ + # crypto components + function(tristate_feature_auto NAME DESCRIPTION) + set(${NAME} Auto CACHE STRING ${DESCRIPTION}) +@@ -176,10 +178,29 @@ if (ENABLE_FUZZERS) + endif() + add_subdirectory(src/common) + +-set(WITH_SEXP_CLI OFF) +-set(WITH_SEXP_TESTS OFF) +-set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME development) +-add_subdirectory(src/libsexp EXCLUDE_FROM_ALL) ++if (SYSTEM_LIBSEXPP) ++ find_package(PkgConfig QUIET) ++ pkg_check_modules(REQUIRED sexpp>=0.8.7) ++ find_library(SEXPP_LIBRARY ++ NAMES ++ "libsexpp" ++ "sexpp" ++ HINTS ++ "${SEXPP_LIBRARY_DIRS}" ++ ) ++ add_library(sexpp UNKNOWN IMPORTED) ++ set_target_properties(sexpp ++ PROPERTIES ++ INTERFACE_INCLUDE_DIRECTORIES "${SEXPP_INCLUDE_DIR}" ++ IMPORTED_LINK_INTERFACE_LANGUAGES "CXX" ++ IMPORTED_LOCATION "${SEXPP_LIBRARY}" ++ ) ++else (SYSTEM_LIBSEXPP) ++ set(WITH_SEXP_CLI OFF) ++ set(WITH_SEXP_TESTS OFF) ++ set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME development) ++ add_subdirectory(src/libsexp EXCLUDE_FROM_ALL) ++endif(SYSTEM_LIBSEXPP) + + add_subdirectory(src/lib) + add_subdirectory(src/rnp) +diff --git a/src/lib/CMakeLists.txt b/src/lib/CMakeLists.txt +index 086ac57..e05d1c1 100755 +--- a/src/lib/CMakeLists.txt ++++ b/src/lib/CMakeLists.txt +@@ -320,6 +320,7 @@ target_include_directories(librnp-obj + PRIVATE + "${CMAKE_CURRENT_SOURCE_DIR}" + "${PROJECT_SOURCE_DIR}/src" ++ "${SEXPP_INCLUDE_DIRS}" + ) + target_link_libraries(librnp-obj PRIVATE JSON-C::JSON-C) + if (CRYPTO_BACKEND_BOTAN) +@@ -328,7 +329,7 @@ elseif (CRYPTO_BACKEND_OPENSSL) + target_link_libraries(librnp-obj PRIVATE OpenSSL::Crypto) + endif() + +-target_link_libraries(librnp-obj PRIVATE sexp) ++target_link_libraries(librnp-obj PRIVATE sexpp) + + set_target_properties(librnp-obj PROPERTIES CXX_VISIBILITY_PRESET hidden) + if (TARGET BZip2::BZip2) +@@ -384,7 +385,7 @@ foreach (prop LINK_LIBRARIES INTERFACE_LINK_LIBRARIES INCLUDE_DIRECTORIES INTERF + get_target_property(val librnp-obj ${prop}) + if (BUILD_SHARED_LIBS) + set_property(TARGET librnp-static PROPERTY ${prop} ${val}) +- list(REMOVE_ITEM val "$<LINK_ONLY:sexp>") ++ list(REMOVE_ITEM val "$<LINK_ONLY:sexpp>") + set_property(TARGET librnp PROPERTY ${prop} ${val}) + else() + set_property(TARGET librnp PROPERTY ${prop} ${val}) +@@ -417,8 +418,8 @@ endif() + # On Unix like systems we will build/install/pack shared and static libraries librnp.so and librnp.a + # On Windows we will build/install/pack dynamic, import and static libraries rnp.dll, rnp.lib and rnp-static.lib + +-# If a client application uses shared rnp library, sexp is statically linked to librnp.so +-# If a client application uses static rnp library, it still needs libsexp.a ++# If a client application uses shared rnp library, sexpp is statically linked to librnp.so ++# If a client application uses static rnp library, it still needs libsexpp.a + + if (BUILD_SHARED_LIBS) + # both static and shared libraries +@@ -432,21 +433,30 @@ install(TARGETS librnp + DESTINATION "${CMAKE_INSTALL_LIBDIR}" + COMPONENT development + ) +- +- install(TARGETS librnp-static sexp ++ install(TARGETS librnp-static + EXPORT rnp-targets + ARCHIVE + DESTINATION "${CMAKE_INSTALL_LIBDIR}" + COMPONENT development + ) + else(BUILD_SHARED_LIBS) +-# static libraries only +-install(TARGETS librnp sexp ++# static libraries ++# install libsexpp unless system-installed libsexpp is used ++ if (SYSTEM_LIBSEXPP) ++ install(TARGETS librnp ++ EXPORT rnp-targets ++ ARCHIVE ++ DESTINATION "${CMAKE_INSTALL_LIBDIR}" ++ COMPONENT development ++ ) ++ else (SYSTEM_LIBSEXPP) ++ install(TARGETS librnp sexpp + EXPORT rnp-targets + ARCHIVE + DESTINATION "${CMAKE_INSTALL_LIBDIR}" + COMPONENT development +-) ++ ) ++ endif (SYSTEM_LIBSEXPP) + endif(BUILD_SHARED_LIBS) + + # install dll only for windows +diff --git a/src/librekey/g23_sexp.hpp b/src/librekey/g23_sexp.hpp +index b888680..b062c52 100644 +--- a/src/librekey/g23_sexp.hpp ++++ b/src/librekey/g23_sexp.hpp +@@ -27,8 +27,8 @@ + #ifndef RNP_G23_SEXP_HPP + #define RNP_G23_SEXP_HPP + +-#include "sexp/sexp.h" +-#include "sexp/ext-key-format.h" ++#include "sexpp/sexp.h" ++#include "sexpp/ext-key-format.h" + + #define SXP_MAX_DEPTH 30 + +diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt +index 7d2a6b0..16d30fb 100644 +--- a/src/tests/CMakeLists.txt ++++ b/src/tests/CMakeLists.txt +@@ -171,12 +171,13 @@ target_include_directories(rnp_tests + "${PROJECT_SOURCE_DIR}/src" + "${PROJECT_SOURCE_DIR}/src/lib" + "${BOTAN2_INCLUDE_DIRS}" ++ "${SEXPP_INCLUDE_DIRS}" + ) + target_link_libraries(rnp_tests + PRIVATE + librnp-static + JSON-C::JSON-C +- sexp ++ sexpp + ${GTestMain} + ) + if (CRYPTO_BACKEND_LOWERCASE STREQUAL "openssl") |