Skip to content

Commit

Permalink
[libjuice] Update to 1.5.2, cleanup (microsoft#40335)
Browse files Browse the repository at this point in the history
  • Loading branch information
dg0yt authored Aug 12, 2024
1 parent 791aeb5 commit a741645
Show file tree
Hide file tree
Showing 7 changed files with 86 additions and 46 deletions.
44 changes: 44 additions & 0 deletions ports/libjuice/dependencies.diff
Original file line number Diff line number Diff line change
@@ -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")

32 changes: 0 additions & 32 deletions ports/libjuice/fix-for-vcpkg.patch

This file was deleted.

25 changes: 25 additions & 0 deletions ports/libjuice/library-linkage.diff
Original file line number Diff line number Diff line change
@@ -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)

22 changes: 10 additions & 12 deletions ports/libjuice/portfile.cmake
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -21,16 +22,13 @@ vcpkg_cmake_configure(
)

vcpkg_cmake_install()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

vcpkg_cmake_config_fixup(PACKAGE_NAME libjuice CONFIG_PATH lib/cmake/LibJuice)
vcpkg_cmake_config_fixup(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}")
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_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
2 changes: 1 addition & 1 deletion ports/libjuice/vcpkg.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -4625,7 +4625,7 @@
"port-version": 0
},
"libjuice": {
"baseline": "1.4.2",
"baseline": "1.5.2",
"port-version": 0
},
"libjxl": {
Expand Down
5 changes: 5 additions & 0 deletions versions/l-/libjuice.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "af2772dfdd1fa67081aa49c250c0bbc9b7e94d3b",
"version": "1.5.2",
"port-version": 0
},
{
"git-tree": "ac2cd791b2bea7ccbe226e924b3c3e9493c784b5",
"version": "1.4.2",
Expand Down

0 comments on commit a741645

Please sign in to comment.