[libjuice] Add new port (#13703)

* libjuice port

* Various fix from pr.

* Remove unused code

* Update to v0.5.2

* Add the private include file for datachannel

* Smaller patch for vcpkg

* Update ports/libjuice/CONTROL

Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>

* Update scripts/ci.baseline.txt

Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>

* Update libjuice to support uwp ?

* Add nettle include path

* Fix the nettle library name

Co-authored-by: Nemirtingas <nanaki89@hotmail.fr>
Co-authored-by: NancyLi1013 <46708020+NancyLi1013@users.noreply.github.com>
Co-authored-by: NancyLi1013 <lirui09@beyondsoft.com>
This commit is contained in:
Nemirtingas 2020-10-23 09:32:18 +02:00 committed by GitHub
parent 58601b3e0a
commit 5b93dabe79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 107 additions and 0 deletions

8
ports/libjuice/CONTROL Normal file
View File

@ -0,0 +1,8 @@
Source: libjuice
Version: 0.5.2
Homepage: https://github.com/paullouisageneau/libjuice
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.
Feature: nettle
Build-Depends: nettle
Description: Use nettle for HMAC computation instead of the Builtin

View File

@ -0,0 +1,68 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index be72a2a..8a631e8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -41,6 +41,9 @@ set(LIBJUICE_SOURCES
set(LIBJUICE_HEADERS
${CMAKE_CURRENT_SOURCE_DIR}/include/juice/juice.h
)
+set(LIBJUICE_PRIVATE_HEADERS
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/socket.h
+)
set(TESTS_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/test/main.c
@@ -54,10 +57,10 @@ 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 ${CMAKE_CURRENT_SOURCE_DIR}/include)
+target_include_directories(juice PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include>)
target_include_directories(juice PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include/juice)
target_include_directories(juice PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_link_libraries(juice PUBLIC Threads::Threads)
@@ -77,10 +80,14 @@ endif()
if (USE_NETTLE)
find_package(Nettle REQUIRED)
+ find_path(NETTLE_INCLUDE_PATH "nettle/hmac.h" 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)
target_compile_definitions(juice-static PRIVATE USE_NETTLE=1)
- target_link_libraries(juice-static PRIVATE Nettle::Nettle)
+ target_link_libraries(juice-static PRIVATE nettle)
else()
target_compile_definitions(juice PRIVATE USE_NETTLE=0)
target_compile_definitions(juice-static PRIVATE USE_NETTLE=0)
@@ -100,8 +107,13 @@ endif()
add_library(LibJuice::LibJuice ALIAS juice)
add_library(LibJuice::LibJuiceStatic ALIAS juice-static)
-install(TARGETS juice LIBRARY DESTINATION lib)
+install(TARGETS juice EXPORT libjuice-config
+ RUNTIME DESTINATION bin
+ LIBRARY DESTINATION lib
+ ARCHIVE DESTINATION lib
+)
install(FILES ${LIBJUICE_HEADERS} DESTINATION include/juice)
+install(FILES ${LIBJUICE_PRIVATE_HEADERS} DESTINATION include/juice/src)
if(NOT MSVC)
target_compile_options(juice PRIVATE -Wall -Wextra)
@@ -128,3 +140,8 @@ if(NOT NO_TESTS)
target_link_libraries(juice-tests juice)
endif()
+install(
+ EXPORT libjuice-config
+ NAMESPACE LibJuice::
+ DESTINATION share/cmake/libjuice
+)

View File

@ -0,0 +1,31 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO paullouisageneau/libjuice
REF 92fc9e7a9d8cd19a5c5d59cbc0a11cc9f684483b
SHA512 80e9898c51bc98a60ca317030bc5394fda412c2bc822adc656f88bfa60b42501d4945a8692771afb8241ec7994fbe48c3e8360f919a0859cfb47288fd3292dd4
HEAD_REF master
PATCHES
fix-for-vcpkg.patch
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
nettle USE_NETTLE
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
${FEATURE_OPTIONS}
-DNO_TESTS=ON
)
vcpkg_install_cmake()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
vcpkg_fixup_cmake_targets(CONFIG_PATH share/cmake/libjuice)
vcpkg_fixup_pkgconfig()
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)