[libjuice] Update to 1.5.2, cleanup (#40335)

This commit is contained in:
Kai Pastor 2024-08-13 01:51:34 +02:00 committed by GitHub
parent 791aeb5cb6
commit a741645198
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 86 additions and 46 deletions

View File

@ -0,0 +1,44 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5712462..dd6c669 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -120,11 +120,14 @@ if(WIN32)
endif()
if (USE_NETTLE)
- find_package(Nettle REQUIRED)
+ find_path(NETTLE_INCLUDE_PATH "nettle/hmac.h" REQUIRED)
+ find_library(NETTLE_LIBRARY_PATH NAMES nettle libnettle NAMES_PER_DIR REQUIRED)
+ target_include_directories(juice PRIVATE ${NETTLE_INCLUDE_PATH})
+ target_include_directories(juice-static PRIVATE ${NETTLE_INCLUDE_PATH})
target_compile_definitions(juice PRIVATE USE_NETTLE=1)
- target_link_libraries(juice PRIVATE Nettle::Nettle)
+ target_link_libraries(juice PRIVATE ${NETTLE_LIBRARY_PATH})
target_compile_definitions(juice-static PRIVATE USE_NETTLE=1)
- target_link_libraries(juice-static PRIVATE Nettle::Nettle)
+ target_link_libraries(juice-static PRIVATE ${NETTLE_LIBRARY_PATH})
else()
target_compile_definitions(juice PRIVATE USE_NETTLE=0)
target_compile_definitions(juice-static PRIVATE USE_NETTLE=0)
@@ -137,8 +140,6 @@ endif()
if(APPLE)
# This seems to be necessary on MacOS
- target_include_directories(juice PRIVATE /usr/local/include)
- target_include_directories(juice-static PRIVATE /usr/local/include)
endif()
set_target_properties(juice PROPERTIES EXPORT_NAME LibJuice)
diff --git a/cmake/LibJuiceConfig.cmake.in b/cmake/LibJuiceConfig.cmake.in
index 247e53f..f049d9a 100644
--- a/cmake/LibJuiceConfig.cmake.in
+++ b/cmake/LibJuiceConfig.cmake.in
@@ -1,4 +1,8 @@
@PACKAGE_INIT@
+include(CMakeFindDependencyMacro)
+set(THREADS_PREFER_PTHREAD_FLAG ON)
+find_dependency(Threads)
+
include("${CMAKE_CURRENT_LIST_DIR}/LibJuiceTargets.cmake")

View File

@ -1,32 +0,0 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3e2a2dc..011a4ca 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -66,7 +66,7 @@ set(TESTS_SOURCES
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
-add_library(juice SHARED ${LIBJUICE_SOURCES})
+add_library(juice ${LIBJUICE_SOURCES})
set_target_properties(juice PROPERTIES VERSION ${PROJECT_VERSION})
target_include_directories(juice PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
@@ -96,11 +96,15 @@ if(WIN32)
endif()
if (USE_NETTLE)
- find_package(Nettle REQUIRED)
+ find_path(NETTLE_INCLUDE_PATH "nettle/hmac.h" REQUIRED)
+ find_library(NETTLE_LIBRARY_PATH NAMES nettle libnettle REQUIRED)
+ target_include_directories(juice PRIVATE ${NETTLE_INCLUDE_PATH})
+ target_include_directories(juice-static PRIVATE ${NETTLE_INCLUDE_PATH})
+
target_compile_definitions(juice PRIVATE USE_NETTLE=1)
- target_link_libraries(juice PRIVATE Nettle::Nettle)
+ target_link_libraries(juice PRIVATE ${NETTLE_LIBRARY_PATH})
target_compile_definitions(juice-static PRIVATE USE_NETTLE=1)
- target_link_libraries(juice-static PRIVATE Nettle::Nettle)
+ target_link_libraries(juice-static PRIVATE ${NETTLE_LIBRARY_PATH})
else()
target_compile_definitions(juice PRIVATE USE_NETTLE=0)
target_compile_definitions(juice-static PRIVATE USE_NETTLE=0)

View File

@ -0,0 +1,25 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index dd6c669..18e4166 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -148,11 +148,20 @@ add_library(LibJuice::LibJuice ALIAS juice)
set_target_properties(juice-static PROPERTIES EXPORT_NAME LibJuiceStatic)
add_library(LibJuice::LibJuiceStatic ALIAS juice-static)
+if(BUILD_SHARED_LIBS)
install(TARGETS juice EXPORT LibJuiceTargets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
+else()
+ set_target_properties(juice PROPERTIES EXCLUDE_FROM_ALL 1)
+ set_target_properties(juice PROPERTIES OUTPUT_NAME juice-shared)
+ set_target_properties(juice-static PROPERTIES EXCLUDE_FROM_ALL 0)
+ set_target_properties(juice-static PROPERTIES OUTPUT_NAME juice)
+ set_target_properties(juice-static PROPERTIES EXPORT_NAME LibJuice)
+ install(TARGETS juice-static EXPORT LibJuiceTargets)
+endif()
install(FILES ${LIBJUICE_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/juice)

View File

@ -1,11 +1,12 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO paullouisageneau/libjuice
REF "v${VERSION}"
SHA512 5696ada382b70e5e8edc123c021cc1bf48a091253e20c705d1a23de3e5a9a240c138090228d02c5937a2418202e10216fafce4579195d5c2c92e7f7be107e622
REF "v${VERSION}"
SHA512 8a7e26daf05219ee2e490052b36be732bad35d570b66e9c08c36e4364ba183a511ea01e4444a8bf94dffd764a3f45f38900f7f4e26a531568b6c3adbd2bd7b53
HEAD_REF master
PATCHES
fix-for-vcpkg.patch
dependencies.diff
library-linkage.diff
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
@ -21,16 +22,13 @@ vcpkg_cmake_configure(
)
vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/LibJuice)
vcpkg_fixup_pkgconfig()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/juice/juice.h" "#ifndef JUICE_STATIC" "#if 0")
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
vcpkg_cmake_config_fixup(PACKAGE_NAME libjuice CONFIG_PATH lib/cmake/LibJuice)
vcpkg_fixup_pkgconfig()
file(READ "${CURRENT_PACKAGES_DIR}/share/libjuice/LibJuiceConfig.cmake" DATACHANNEL_CONFIG)
file(WRITE "${CURRENT_PACKAGES_DIR}/share/libjuice/LibJuiceConfig.cmake" "
include(CMakeFindDependencyMacro)
find_dependency(Threads)
${DATACHANNEL_CONFIG}")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

View File

@ -1,6 +1,6 @@
{
"name": "libjuice",
"version": "1.4.2",
"version": "1.5.2",
"description": "The library is a simplified implementation of the Interactive Connectivity Establishment (ICE) protocol in C for POSIX platforms (including Linux and Apple macOS) and Microsoft Windows.",
"homepage": "https://github.com/paullouisageneau/libjuice",
"license": "LGPL-2.1-only",

View File

@ -4625,7 +4625,7 @@
"port-version": 0
},
"libjuice": {
"baseline": "1.4.2",
"baseline": "1.5.2",
"port-version": 0
},
"libjxl": {

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "af2772dfdd1fa67081aa49c250c0bbc9b7e94d3b",
"version": "1.5.2",
"port-version": 0
},
{
"git-tree": "ac2cd791b2bea7ccbe226e924b3c3e9493c784b5",
"version": "1.4.2",