diff options
Diffstat (limited to 'vcpkg/ports/librtmp')
| -rw-r--r-- | vcpkg/ports/librtmp/CMakeLists.txt | 68 | ||||
| -rw-r--r-- | vcpkg/ports/librtmp/fix_strncasecmp.patch | 20 | ||||
| -rw-r--r-- | vcpkg/ports/librtmp/hide_netstackdump.patch | 58 | ||||
| -rw-r--r-- | vcpkg/ports/librtmp/librtmp.def | 109 | ||||
| -rw-r--r-- | vcpkg/ports/librtmp/pkgconfig.patch | 15 | ||||
| -rw-r--r-- | vcpkg/ports/librtmp/portfile.cmake | 29 | ||||
| -rw-r--r-- | vcpkg/ports/librtmp/usage | 5 | ||||
| -rw-r--r-- | vcpkg/ports/librtmp/vcpkg.json | 15 |
8 files changed, 319 insertions, 0 deletions
diff --git a/vcpkg/ports/librtmp/CMakeLists.txt b/vcpkg/ports/librtmp/CMakeLists.txt new file mode 100644 index 0000000..9890bb7 --- /dev/null +++ b/vcpkg/ports/librtmp/CMakeLists.txt @@ -0,0 +1,68 @@ +cmake_minimum_required(VERSION 3.10) + +project(librtmp C) + +find_package(ZLIB REQUIRED) +find_package(OpenSSL REQUIRED) + +include_directories(${ZLIB_INCLUDE_DIRS}) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + +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 +) + +if(MSVC) + set(SRCS_MSVC "librtmp/librtmp.def") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /wd4996") +endif() + +add_library(rtmp ${SRCS} ${HEADERS} ${SRCS_MSVC}) + +target_include_directories(rtmp PRIVATE ./librtmp) +target_link_libraries(rtmp PRIVATE ${ZLIB_LIBRARIES} ${OPENSSL_LIBRARIES}) +if(MSVC OR MINGW) + target_link_libraries(rtmp PRIVATE Ws2_32.lib Winmm.lib) +endif() + +set(libdir [[${prefix}/lib]]) +set(VERSION 2.6) # from ChangeLog +set(CRYPTO_REQ "libssl,libcrypto") +if(MSVC OR MINGW) + set(PRIVATE_LIBS "-lWS2_32 -lWinMM") +endif() +configure_file(librtmp/librtmp.pc.in librtmp.pc @ONLY) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/librtmp.pc + DESTINATION lib/pkgconfig +) + +install(TARGETS rtmp + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) + +install(DIRECTORY ${PROJECT_SOURCE_DIR}/librtmp DESTINATION include FILES_MATCHING PATTERN "*.h") diff --git a/vcpkg/ports/librtmp/fix_strncasecmp.patch b/vcpkg/ports/librtmp/fix_strncasecmp.patch new file mode 100644 index 0000000..3e0c7ea --- /dev/null +++ b/vcpkg/ports/librtmp/fix_strncasecmp.patch @@ -0,0 +1,20 @@ +diff --git a/librtmp/rtmp_sys.h b/librtmp/rtmp_sys.h +index 6a3f215..1b5ac2a 100644 +--- a/librtmp/rtmp_sys.h ++++ b/librtmp/rtmp_sys.h +@@ -28,11 +28,13 @@ + #include <ws2tcpip.h> + + #ifdef _MSC_VER /* MSVC */ ++#if _MSC_VER < 1900 + #define snprintf _snprintf +-#define strcasecmp stricmp +-#define strncasecmp strnicmp + #define vsnprintf _vsnprintf + #endif ++#define strcasecmp _stricmp ++#define strncasecmp _strnicmp ++#endif + + #define GetSockError() WSAGetLastError() + #define SetSockError(e) WSASetLastError(e) diff --git a/vcpkg/ports/librtmp/hide_netstackdump.patch b/vcpkg/ports/librtmp/hide_netstackdump.patch new file mode 100644 index 0000000..1cc7c8c --- /dev/null +++ b/vcpkg/ports/librtmp/hide_netstackdump.patch @@ -0,0 +1,58 @@ +diff --git a/librtmp/rtmp.c b/librtmp/rtmp.c +index 0865689..b00710e 100644 +--- a/librtmp/rtmp.c ++++ b/librtmp/rtmp.c +@@ -155,7 +155,7 @@ static int clk_tck; + uint32_t + RTMP_GetTime() + { +-#ifdef _DEBUG ++#if defined(_DEBUG) && !defined(LIBRTMP_ONLY) + return 0; + #elif defined(_WIN32) + return timeGetTime(); +@@ -1381,7 +1381,7 @@ RTMP_ClientPacket(RTMP *r, RTMPPacket *packet) + return bHasMediaPacket; + } + +-#ifdef _DEBUG ++#if defined(_DEBUG) && !defined(LIBRTMP_ONLY) + extern FILE *netstackdump; + extern FILE *netstackdump_read; + #endif +@@ -1469,7 +1469,7 @@ ReadN(RTMP *r, char *buffer, int n) + return FALSE; + } + /*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 + +@@ -3757,7 +3757,7 @@ HandShake(RTMP *r, int FP9HandShake) + + memset(&clientsig[4], 0, 4); + +-#ifdef _DEBUG ++#if defined(_DEBUG) && !defined(LIBRTMP_ONLY) + for (i = 8; i < RTMP_SIG_SIZE; i++) + clientsig[i] = 0xff; + #else +@@ -3829,7 +3829,7 @@ SHandShake(RTMP *r) + memcpy(serversig, &uptime, 4); + + memset(&serversig[4], 0, 4); +-#ifdef _DEBUG ++#if defined(_DEBUG) && !defined(LIBRTMP_ONLY) + for (i = 8; i < RTMP_SIG_SIZE; i++) + serversig[i] = 0xff; + #else +@@ -4298,7 +4298,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 + diff --git a/vcpkg/ports/librtmp/librtmp.def b/vcpkg/ports/librtmp/librtmp.def new file mode 100644 index 0000000..837e6a3 --- /dev/null +++ b/vcpkg/ports/librtmp/librtmp.def @@ -0,0 +1,109 @@ +EXPORTS + AMF3_Decode + AMF3CD_AddProp + AMF3CD_GetProp + AMF3Prop_Decode + AMF3ReadInteger + AMF3ReadString + + 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 + + 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_debuglevel + 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_Init + RTMP_ToggleStream + RTMP_UpdateBufferMS + RTMP_UserInterrupt + RTMP_Write + RTMPPacket_Alloc + RTMPPacket_Dump + RTMPPacket_Free + RTMPPacket_Reset + RTMPSockBuf_Close + RTMPSockBuf_Fill + RTMPSockBuf_Send diff --git a/vcpkg/ports/librtmp/pkgconfig.patch b/vcpkg/ports/librtmp/pkgconfig.patch new file mode 100644 index 0000000..c5be81d --- /dev/null +++ b/vcpkg/ports/librtmp/pkgconfig.patch @@ -0,0 +1,15 @@ +diff --git a/librtmp/librtmp.pc.in b/librtmp/librtmp.pc.in
+--- a/librtmp/librtmp.pc.in
++++ b/librtmp/librtmp.pc.in
+@@ -5,9 +5,9 @@
+
+ Name: librtmp
+ Description: RTMP implementation
+ Version: @VERSION@
+-Requires: @CRYPTO_REQ@
++Requires: zlib,@CRYPTO_REQ@
+ URL: http://rtmpdump.mplayerhq.hu
+-Libs: -L${libdir} -lrtmp -lz @PUBLIC_LIBS@
++Libs: -L${libdir} -lrtmp @PUBLIC_LIBS@
+ Libs.private: @PRIVATE_LIBS@
+ Cflags: -I${incdir}
diff --git a/vcpkg/ports/librtmp/portfile.cmake b/vcpkg/ports/librtmp/portfile.cmake new file mode 100644 index 0000000..1e717e2 --- /dev/null +++ b/vcpkg/ports/librtmp/portfile.cmake @@ -0,0 +1,29 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO mirror/rtmpdump + REF 6f6bb1353fc84f4cc37138baa99f586750028a01 + SHA512 e6c108576fdd3430d81e2f72b343864eee5d6be396c9378a2ae2bfc871e9464e20d7bd057a47ef2449a301d933b29265e7ffd3383631b24fc035f5483337bbce + PATCHES + fix_strncasecmp.patch + hide_netstackdump.patch + pkgconfig.patch +) + +file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}") +file(COPY "${CMAKE_CURRENT_LIST_DIR}/librtmp.def" DESTINATION "${SOURCE_PATH}/librtmp") + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" +) + +vcpkg_cmake_install() +vcpkg_fixup_pkgconfig() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") + +# License and man +file(INSTALL "${SOURCE_PATH}/librtmp/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) +file(COPY "${CURRENT_PORT_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") +file(INSTALL "${SOURCE_PATH}/librtmp/librtmp.3.html" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}") + +vcpkg_copy_pdbs() diff --git a/vcpkg/ports/librtmp/usage b/vcpkg/ports/librtmp/usage new file mode 100644 index 0000000..abf5c3e --- /dev/null +++ b/vcpkg/ports/librtmp/usage @@ -0,0 +1,5 @@ +librtmp can be imported via CMake FindPkgConfig module:
+
+ find_package(PkgConfig REQUIRED)
+ pkg_check_modules(librtmp REQUIRED IMPORTED_TARGET librtmp)
+ target_link_libraries(main PkgConfig::librtmp)
diff --git a/vcpkg/ports/librtmp/vcpkg.json b/vcpkg/ports/librtmp/vcpkg.json new file mode 100644 index 0000000..7b6acc4 --- /dev/null +++ b/vcpkg/ports/librtmp/vcpkg.json @@ -0,0 +1,15 @@ +{ + "name": "librtmp", + "version-date": "2024-03-01", + "port-version": 1, + "description": "RTMPDump Real-Time Messaging Protocol API", + "homepage": "https://rtmpdump.mplayerhq.hu", + "dependencies": [ + "openssl", + { + "name": "vcpkg-cmake", + "host": true + }, + "zlib" + ] +} |