[libsrt]Add new port. (#8712)

* [libsrt]Add new port.

* [libsrt]Add patch.

* [libsrt]Does not support uwp.

* [libsrt]Remove usless blank line.
This commit is contained in:
JackBoosY 2019-10-29 02:23:21 +08:00 committed by Robert Schumacher
parent c7d09309c1
commit d1d449e8e3
3 changed files with 123 additions and 0 deletions

8
ports/libsrt/CONTROL Normal file
View File

@ -0,0 +1,8 @@
Source: libsrt
Version: 1.3.4
Description: Secure Reliable Transport (SRT) is an open source transport technology that optimizes streaming performance across unpredictable networks, such as the Internet.
Homepage: https://github.com/Haivision/srt
Build-Depends: openssl, pthreads (windows)
Feature: tool
Description: Builds libsrt executable

View File

@ -0,0 +1,74 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ec91d08..f19d28d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -234,6 +234,10 @@ if (ENABLE_ENCRYPTION)
# fall back to find_package method otherwise
if (USE_OPENSSL_PC)
pkg_check_modules(SSL ${SSL_REQUIRED_MODULES})
+ else()
+ find_package(OpenSSL REQUIRED)
+ set(SSL_FOUND ${OpenSSL_FOUND})
+ set(SSL_LIBRARIES OpenSSL::SSL OpenSSL::Crypto)
endif()
if (SSL_FOUND)
# We have some cases when pkg-config is improperly configured
@@ -438,7 +442,7 @@ elseif (WIN32 AND NOT MINGW)
message(FATAL_ERROR "Failed to find pthread.h. Specify PTHREAD_INCLUDE_DIR.")
endif()
- find_library(PTHREAD_LIBRARY NAMES pthread pthread_dll pthread_lib HINTS C:/pthread-win32/lib C:/pthread-win64/lib)
+ find_library(PTHREAD_LIBRARY NAMES pthreadVC3 REQUIRED)
if (PTHREAD_LIBRARY)
message(STATUS "Pthread library: ${PTHREAD_LIBRARY}")
else()
@@ -637,6 +641,7 @@ if (ENABLE_SHARED)
target_compile_definitions(srt_virtual PUBLIC -DSRT_DYNAMIC)
target_compile_definitions(haicrypt_virtual PRIVATE -DHAICRYPT_EXPORTS)
endif()
+target_link_libraries(haicrypt_virtual PRIVATE ${SSL_LIBRARIES})
if (srt_libspec_shared)
if (MICROSOFT)
@@ -650,6 +655,7 @@ set (INSTALL_SHARED_DIR ${CMAKE_INSTALL_LIBDIR})
if (CYGWIN)
set (INSTALL_SHARED_DIR ${CMAKE_INSTALL_BINDIR})
endif()
+set(CMAKE_INSTALL_INCLUDEDIR include)
message(STATUS "INSTALL DIRS: bin=${CMAKE_INSTALL_BINDIR} lib=${CMAKE_INSTALL_LIBDIR} shlib=${INSTALL_SHARED_DIR} include=${CMAKE_INSTALL_INCLUDEDIR}")
@@ -730,7 +736,7 @@ macro(srt_add_program name)
add_executable(${name} ${ARGN})
target_include_directories(${name} PRIVATE apps)
target_include_directories(${name} PRIVATE common)
- install(TARGETS ${name} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+ install(TARGETS ${name} RUNTIME DESTINATION tools)
endmacro()
macro(srt_make_application name)
@@ -769,7 +775,7 @@ endmacro()
macro(srt_add_application name) # ARGN=sources...
srt_add_program(${name} apps/${name}.cpp ${ARGN})
srt_make_application(${name})
- install(TARGETS ${name} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+ install(TARGETS ${name} RUNTIME DESTINATION tools)
endmacro()
## FIXME: transmitmedia.cpp does not build on OpenBSD
@@ -923,7 +929,7 @@ if (ENABLE_UNITTESTS AND ENABLE_CXX11)
endif()
-install(PROGRAMS scripts/srt-ffplay DESTINATION ${CMAKE_INSTALL_BINDIR})
+install(PROGRAMS scripts/srt-ffplay DESTINATION tools)
if (DEFINED SRT_EXTRA_APPS_INC)
@@ -939,5 +945,5 @@ if ( ENABLE_SUFLIP )
)
srt_add_program(suflip ${SOURCES_suflip})
target_link_libraries(suflip ${srt_link_library})
- install(TARGETS suflip RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+ install(TARGETS suflip RUNTIME DESTINATION tools)
endif ()

View File

@ -0,0 +1,41 @@
vcpkg_fail_port_install(ON_TARGET "UWP")
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Haivision/srt
REF v1.3.4
SHA512 3a9f9a8fd8ba56ae9ca04203bdea9e9a25275e1f531ca10deee0e760e6beaf44e83ee7a616cfe3ade9676082d9cc8611214de876f64d141e1e8c3b1e16273001
HEAD_REF master
PATCHES fix-dependency-install.patch
)
if (VCPKG_LIBRARY_LINKAGE STREQUAL dynamic)
set(BUILD_DYNAMIC ON)
set(BUILD_STATIC OFF)
else()
set(BUILD_DYNAMIC OFF)
set(BUILD_STATIC ON)
endif()
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
tool ENABLE_APPS
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS ${FEATURE_OPTIONS}
-DENABLE_SHARED=${BUILD_DYNAMIC}
-DENABLE_STATIC=${BUILD_STATIC}
-DINSTALL_DOCS=ON
-DINSTALL_PKG_CONFIG_MODULE=ON
-DENABLE_SUFLIP=OFF # Since there are some file not found, disable this feature
-DENABLE_UNITTESTS=OFF
-DUSE_OPENSSL_PC=OFF
)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
# Handle copyright
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)