Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libjuice] Add new port #13703

Merged
merged 12 commits into from
Oct 23, 2020
8 changes: 8 additions & 0 deletions ports/libjuice/CONTROL
Original file line number Diff line number Diff line change
@@ -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
51 changes: 51 additions & 0 deletions ports/libjuice/fix-for-vcpkg.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index be72a2a..299fee5 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)
@@ -100,8 +103,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 +136,8 @@ if(NOT NO_TESTS)
target_link_libraries(juice-tests juice)
endif()

+install(
+ EXPORT libjuice-config
+ NAMESPACE LibJuice::
+ DESTINATION share/cmake/libjuice
+)
31 changes: 31 additions & 0 deletions ports/libjuice/portfile.cmake
Original file line number Diff line number Diff line change
@@ -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)