mirror of
https://github.com/microsoft/vcpkg.git
synced 2024-12-31 05:03:22 +08:00
Merge pull request #1928 from lazyhamster/librtmp
New port for librtmp 2.3
This commit is contained in:
commit
1946a8ca94
57
ports/librtmp/CMakeLists.txt
Normal file
57
ports/librtmp/CMakeLists.txt
Normal file
@ -0,0 +1,57 @@
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
|
||||
project(librtmp C)
|
||||
|
||||
find_package(zlib REQUIRED)
|
||||
find_package(openssl REQUIRED)
|
||||
|
||||
include_directories(${ZLIB_INCLUDE_DIRS})
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
set(CMAKE_DEBUG_POSTFIX "d")
|
||||
|
||||
if(MSVC)
|
||||
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
|
||||
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
|
||||
add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
add_definitions(-DLIBRTMP_ONLY)
|
||||
|
||||
# List the header files
|
||||
set(HEADERS librtmp/amf.h
|
||||
librtmp/bytes.h
|
||||
librtmp/dh.h
|
||||
librtmp/dhgroups.h
|
||||
librtmp/handshake.h
|
||||
librtmp/http.h
|
||||
librtmp/log.h
|
||||
librtmp/rtmp.h
|
||||
librtmp/rtmp_sys.h
|
||||
)
|
||||
|
||||
# List the source files
|
||||
set(SRCS librtmp/amf.c
|
||||
librtmp/hashswf.c
|
||||
librtmp/log.c
|
||||
librtmp/parseurl.c
|
||||
librtmp/rtmp.c
|
||||
librtmp/librtmp.def
|
||||
)
|
||||
|
||||
if(MSVC)
|
||||
set(SRCS_MSVC "librtmp/librtmp.def")
|
||||
endif()
|
||||
|
||||
add_library(librtmp ${SRCS} ${HEADERS} ${SRCS_MSVC})
|
||||
|
||||
target_include_directories(librtmp PRIVATE ./librtmp)
|
||||
target_link_libraries(librtmp PRIVATE ${ZLIB_LIBRARIES} ${OPENSSL_LIBRARIES})
|
||||
target_link_libraries(librtmp PRIVATE Ws2_32.lib Winmm.lib)
|
||||
|
||||
install(TARGETS librtmp
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib)
|
||||
|
||||
install(FILES librtmp/rtmp.h librtmp/amf.h DESTINATION include/librtmp)
|
4
ports/librtmp/CONTROL
Normal file
4
ports/librtmp/CONTROL
Normal file
@ -0,0 +1,4 @@
|
||||
Source: librtmp
|
||||
Version: 2.3
|
||||
Build-Depends: zlib, openssl
|
||||
Description: RTMPDump Real-Time Messaging Protocol API
|
16
ports/librtmp/fix_strncasecmp.patch
Normal file
16
ports/librtmp/fix_strncasecmp.patch
Normal file
@ -0,0 +1,16 @@
|
||||
diff --git a/librtmp/rtmp_sys.h b/librtmp/rtmp_sys.h
|
||||
index 0874cbe..b43d587 100644
|
||||
--- a/librtmp/rtmp_sys.h
|
||||
+++ b/librtmp/rtmp_sys.h
|
||||
@@ -37,6 +37,11 @@
|
||||
#include <ws2tcpip.h>
|
||||
#endif
|
||||
|
||||
+#ifdef _MSC_VER
|
||||
+#define strncasecmp _strnicmp
|
||||
+#define strcasecmp _stricmp
|
||||
+#endif
|
||||
+
|
||||
#define GetSockError() WSAGetLastError()
|
||||
#define SetSockError(e) WSASetLastError(e)
|
||||
#define setsockopt(a,b,c,d,e) (setsockopt)(a,b,c,(const char *)d,(int)e)
|
22
ports/librtmp/hide_netstackdump.patch
Normal file
22
ports/librtmp/hide_netstackdump.patch
Normal file
@ -0,0 +1,22 @@
|
||||
diff --git a/librtmp/rtmp.c b/librtmp/rtmp.c
|
||||
index f152648..0bf3f7d 100644
|
||||
--- a/librtmp/rtmp.c
|
||||
+++ b/librtmp/rtmp.c
|
||||
@@ -1316,7 +1316,7 @@ ReadN(RTMP *r, char *buffer, int n)
|
||||
SendBytesReceived(r);
|
||||
}
|
||||
/*RTMP_Log(RTMP_LOGDEBUG, "%s: %d bytes\n", __FUNCTION__, nBytes); */
|
||||
-#ifdef _DEBUG
|
||||
+#if defined(_DEBUG) && !defined(LIBRTMP_ONLY)
|
||||
fwrite(ptr, 1, nBytes, netstackdump_read);
|
||||
#endif
|
||||
|
||||
@@ -3527,7 +3527,7 @@ RTMPSockBuf_Send(RTMPSockBuf *sb, const char *buf, int len)
|
||||
{
|
||||
int rc;
|
||||
|
||||
-#ifdef _DEBUG
|
||||
+#if defined(_DEBUG) && !defined(LIBRTMP_ONLY)
|
||||
fwrite(buf, 1, len, netstackdump);
|
||||
#endif
|
||||
|
105
ports/librtmp/librtmp.def
Normal file
105
ports/librtmp/librtmp.def
Normal file
@ -0,0 +1,105 @@
|
||||
EXPORTS
|
||||
AMF_AddProp
|
||||
AMF_CountProp
|
||||
AMF_Decode
|
||||
AMF_DecodeArray
|
||||
AMF_DecodeBoolean
|
||||
AMF_DecodeInt16
|
||||
AMF_DecodeInt24
|
||||
AMF_DecodeInt32
|
||||
AMF_DecodeLongString
|
||||
AMF_DecodeNumber
|
||||
AMF_DecodeString
|
||||
AMF_Dump
|
||||
AMF_Encode
|
||||
AMF_EncodeBoolean
|
||||
AMF_EncodeInt16
|
||||
AMF_EncodeInt24
|
||||
AMF_EncodeInt32
|
||||
AMF_EncodeNamedBoolean
|
||||
AMF_EncodeNamedNumber
|
||||
AMF_EncodeNamedString
|
||||
AMF_EncodeNumber
|
||||
AMF_EncodeString
|
||||
AMF_GetProp
|
||||
AMF_Reset
|
||||
|
||||
AMF3_Decode
|
||||
AMF3CD_AddProp
|
||||
AMF3CD_GetProp
|
||||
AMF3Prop_Decode
|
||||
AMF3ReadInteger
|
||||
AMF3ReadString
|
||||
|
||||
AMFProp_Decode
|
||||
AMFProp_Dump
|
||||
AMFProp_Encode
|
||||
AMFProp_GetBoolean
|
||||
AMFProp_GetName
|
||||
AMFProp_GetNumber
|
||||
AMFProp_GetObject
|
||||
AMFProp_GetString
|
||||
AMFProp_GetType
|
||||
AMFProp_IsValid
|
||||
AMFProp_Reset
|
||||
AMFProp_SetName
|
||||
|
||||
RTMP_Alloc
|
||||
RTMP_ClientPacket
|
||||
RTMP_Close
|
||||
RTMP_Connect
|
||||
RTMP_Connect0
|
||||
RTMP_Connect1
|
||||
RTMP_ConnectStream
|
||||
RTMP_ctrlC
|
||||
RTMP_debuglevel
|
||||
RTMP_DefaultFlashVer
|
||||
RTMP_DeleteStream
|
||||
RTMP_DropRequest
|
||||
RTMP_EnableWrite
|
||||
RTMP_FindFirstMatchingProperty
|
||||
RTMP_FindPrefixProperty
|
||||
RTMP_Free
|
||||
RTMP_GetDuration
|
||||
RTMP_GetNextMediaPacket
|
||||
RTMP_GetTime
|
||||
RTMP_HashSWF
|
||||
RTMP_Init
|
||||
RTMP_IsConnected
|
||||
RTMP_IsTimedout
|
||||
RTMP_LibVersion
|
||||
RTMP_Log
|
||||
RTMP_LogGetLevel
|
||||
RTMP_LogHex
|
||||
RTMP_LogHexString
|
||||
RTMP_LogPrintf
|
||||
RTMP_LogSetCallback
|
||||
RTMP_LogSetLevel
|
||||
RTMP_LogSetOutput
|
||||
RTMP_LogStatus
|
||||
RTMP_ParsePlaypath
|
||||
RTMP_ParseURL
|
||||
RTMP_Pause
|
||||
RTMP_Read
|
||||
RTMP_ReadPacket
|
||||
RTMP_ReconnectStream
|
||||
RTMP_SendChunk
|
||||
RTMP_SendClientBW
|
||||
RTMP_SendCreateStream
|
||||
RTMP_SendCtrl
|
||||
RTMP_SendPacket
|
||||
RTMP_SendPause
|
||||
RTMP_SendSeek
|
||||
RTMP_SendServerBW
|
||||
RTMP_Serve
|
||||
RTMP_SetBufferMS
|
||||
RTMP_SetOpt
|
||||
RTMP_SetupStream
|
||||
RTMP_SetupURL
|
||||
RTMP_Socket
|
||||
RTMP_TLS_ctx
|
||||
RTMP_TLS_Init
|
||||
RTMP_ToggleStream
|
||||
RTMP_UpdateBufferMS
|
||||
RTMP_UserInterrupt
|
||||
RTMP_Write
|
36
ports/librtmp/portfile.cmake
Normal file
36
ports/librtmp/portfile.cmake
Normal file
@ -0,0 +1,36 @@
|
||||
include(vcpkg_common_functions)
|
||||
|
||||
set(RTMPDUMP_VERSION 2.3)
|
||||
set(RTMPDUMP_FILENAME rtmpdump-${RTMPDUMP_VERSION}.tgz)
|
||||
set(SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src/rtmpdump-${RTMPDUMP_VERSION})
|
||||
|
||||
vcpkg_download_distfile(ARCHIVE
|
||||
URLS "http://rtmpdump.mplayerhq.hu/download/${RTMPDUMP_FILENAME}"
|
||||
FILENAME "${RTMPDUMP_FILENAME}"
|
||||
SHA512 d8240ba372a704231286b81bbf75716d8b76874840538c4e1527f7f8b6ca66eeaba6b03167fe6fab06bf80f20f07d89ecb84cc428b3196234174a43f3328ec2a
|
||||
)
|
||||
vcpkg_extract_source_archive(${ARCHIVE})
|
||||
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt DESTINATION ${SOURCE_PATH})
|
||||
file(COPY ${CMAKE_CURRENT_LIST_DIR}/librtmp.def DESTINATION ${SOURCE_PATH}/librtmp)
|
||||
|
||||
vcpkg_apply_patches(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
PATCHES
|
||||
${CMAKE_CURRENT_LIST_DIR}/fix_strncasecmp.patch
|
||||
${CMAKE_CURRENT_LIST_DIR}/hide_netstackdump.patch
|
||||
)
|
||||
|
||||
vcpkg_configure_cmake(
|
||||
SOURCE_PATH ${SOURCE_PATH}
|
||||
)
|
||||
|
||||
vcpkg_install_cmake()
|
||||
|
||||
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
|
||||
|
||||
# License and man
|
||||
file(INSTALL ${SOURCE_PATH}/librtmp/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/librtmp RENAME copyright)
|
||||
file(INSTALL ${SOURCE_PATH}/librtmp/librtmp.3.html DESTINATION ${CURRENT_PACKAGES_DIR}/share/librtmp)
|
||||
|
||||
vcpkg_copy_pdbs()
|
Loading…
x
Reference in New Issue
Block a user