[zeromq,ffmpeg] Fix zeromq, integrate in ffmpeg (#48949)

Co-authored-by: Kim Syehoon <syehoon.kim@sbs.co.kr>
This commit is contained in:
Kai Pastor
2025-12-23 21:34:37 +01:00
committed by GitHub
parent 1d99da1dcc
commit 33bed9bc9f
11 changed files with 121 additions and 57 deletions

View File

@@ -591,6 +591,14 @@ else()
set(WITH_VAAPI OFF)
endif()
if("zmq" IN_LIST FEATURES)
set(OPTIONS "${OPTIONS} --enable-libzmq")
set(WITH_ZMQ ON)
else()
set(OPTIONS "${OPTIONS} --disable-libzmq")
set(WITH_ZMQ OFF)
endif()
set(OPTIONS_CROSS "--enable-cross-compile")
# ffmpeg needs --cross-prefix option to use appropriate tools for cross-compiling.

View File

@@ -305,6 +305,14 @@ if(@WITH_VAAPI@)
endif()
endif()
if(@WITH_ZMQ@)
pkg_check_modules(libzmq IMPORTED_TARGET libzmq)
list(APPEND FFMPEG_LIBRARIES PkgConfig::libzmq)
if(vcpkg_no_avformat_target AND TARGET FFmpeg::avformat)
target_link_libraries(FFmpeg::avformat INTERFACE PkgConfig::libzmq)
endif()
endif()
endif()
unset(z_vcpkg_using_vcpkg_find_ffmpeg)

View File

@@ -1,7 +1,7 @@
{
"name": "ffmpeg",
"version": "7.1.2",
"port-version": 3,
"port-version": 4,
"description": [
"A library to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created.",
"FFmpeg is the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, filter and play pretty much anything that humans and machines have created. It supports the most obscure ancient formats up to the cutting edge. No matter if they were designed by some standards committee, the community or a corporation. It is also highly portable: FFmpeg compiles, runs, and passes our testing infrastructure FATE across Linux, Mac OS X, Microsoft Windows, the BSDs, Solaris, etc. under a wide variety of build environments, machine architectures, and configurations."
@@ -730,6 +730,12 @@
"dependencies": [
"zlib"
]
},
"zmq": {
"description": "Enable ZeroMQ support",
"dependencies": [
"zeromq"
]
}
}
}

View File

@@ -1,38 +1,3 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index dd3d8eb..c08cad9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -551,6 +551,8 @@ if(ZMQ_HAVE_WINDOWS)
set(CMAKE_REQUIRED_LIBRARIES "")
# TODO: This not the symbol we're looking for. What is the symbol?
check_library_exists(ws2 fopen "" HAVE_WS2)
+
+ check_cxx_symbol_exists(CryptAcquireContext "windows.h;wincrypt.h" HAVE_ADVAPI32)
else()
check_cxx_symbol_exists(if_nametoindex net/if.h HAVE_IF_NAMETOINDEX)
check_cxx_symbol_exists(SO_PEERCRED sys/socket.h ZMQ_HAVE_SO_PEERCRED)
@@ -1452,6 +1454,10 @@ if(BUILD_SHARED)
elseif(HAVE_WS2)
target_link_libraries(libzmq ws2)
endif()
+
+ if (HAVE_ADVAPI32)
+ target_link_libraries(libzmq advapi32)
+ endif()
if(HAVE_RPCRT4)
target_link_libraries(libzmq rpcrt4)
@@ -1497,6 +1503,10 @@ if(BUILD_STATIC)
elseif(HAVE_WS2)
target_link_libraries(libzmq-static ws2)
endif()
+
+ if (HAVE_ADVAPI32)
+ target_link_libraries(libzmq-static advapi32)
+ endif()
if(HAVE_RPCRT4)
target_link_libraries(libzmq-static rpcrt4)
diff --git a/src/clock.cpp b/src/clock.cpp
index 79522ad..0667c59 100644
--- a/src/clock.cpp

View File

@@ -0,0 +1,40 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0346227..56d34e6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -569,6 +569,23 @@ else()
check_cxx_symbol_exists(SO_BUSY_POLL sys/socket.h ZMQ_HAVE_BUSY_POLL)
endif()
+if(WITH_LIBSODIUM)
+ string(APPEND pkg_config_names_private " libsodium")
+endif()
+if(WIN32)
+ string(APPEND pkg_config_libs_private " -ladvapi32 -liphlpapi -lrpcrt4 -lws2_32")
+endif()
+string(APPEND pkg_config_libs_private " ${CMAKE_THREAD_LIBS_INIT}")
+foreach(lib IN LISTS CMAKE_CXX_IMPLICIT_LINK_LIBRARIES)
+ if(lib IN_LIST CMAKE_C_IMPLICIT_LINK_LIBRARIES)
+ continue()
+ elseif(EXISTS "${lib}")
+ string(APPEND pkg_config_libs_private " ${lib}")
+ else()
+ string(APPEND pkg_config_libs_private " -l${lib}")
+ endif()
+endforeach()
+
if(NOT MINGW)
find_library(RT_LIBRARY rt)
if(RT_LIBRARY)
diff --git a/src/libzmq.pc.in b/src/libzmq.pc.in
index 233bc3a..3c2bf0d 100644
--- a/src/libzmq.pc.in
+++ b/src/libzmq.pc.in
@@ -7,6 +7,6 @@ Name: libzmq
Description: 0MQ c++ library
Version: @VERSION@
Libs: -L${libdir} -lzmq
-Libs.private: -lstdc++ @pkg_config_libs_private@
+Libs.private: @pkg_config_libs_private@
Requires.private: @pkg_config_names_private@
Cflags: -I${includedir} @pkg_config_defines@

View File

@@ -5,6 +5,8 @@ vcpkg_from_github(
SHA512 108d9c5fa761c111585c30f9c651ed92942dda0ac661155bca52cc7b6dbeb3d27b0dd994abde206eacfc3bc88d19ed24e45b291050c38469e34dca5f8c9a037d
PATCHES
fix-arm.patch
pkgconfig.diff
rename-sha1.diff
)
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "static" BUILD_STATIC)
@@ -26,22 +28,24 @@ if(VCPKG_TARGET_IS_MINGW)
endif()
vcpkg_find_acquire_program(PKGCONFIG)
set(ENV{PKG_CONFIG} "${PKGCONFIG}")
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DZMQ_BUILD_TESTS=OFF
-DBUILD_STATIC=${BUILD_STATIC}
-DBUILD_SHARED=${BUILD_SHARED}
-DWITH_PERF_TOOL=OFF
-DWITH_DOCS=OFF
-DWITH_NSS=OFF
-DWITH_LIBBSD=OFF
-DCMAKE_POLICY_DEFAULT_CMP0057=NEW # IN_LIST
-DCMAKE_REQUIRE_FIND_PACKAGE_GnuTLS=ON
-DWITH_DOCS=OFF
-DWITH_PERF_TOOL=OFF
-DWITH_LIBBSD=OFF
-DWITH_LIBSODIUM_STATIC=${BUILD_STATIC}
-DWITH_NSS=OFF
-DZEROMQ_CMAKECONFIG_INSTALL_DIR=share/${PORT}
-DZMQ_BUILD_TESTS=OFF
${FEATURE_OPTIONS}
${PLATFORM_OPTIONS}
"-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}"
OPTIONS_DEBUG
"-DCMAKE_PDB_OUTPUT_DIRECTORY=${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg"
MAYBE_UNUSED_VARIABLES
@@ -52,13 +56,24 @@ vcpkg_cmake_configure(
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup()
vcpkg_fixup_pkgconfig()
if(VCPKG_TARGET_IS_WINDOWS)
vcpkg_cmake_config_fixup(CONFIG_PATH CMake)
else()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/ZeroMQ)
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
file(GLOB libzmq_release "${CURRENT_PACKAGES_DIR}/lib/libzmq*.lib")
cmake_path(GET libzmq_release STEM LAST_ONLY libzmq_spec)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/lib/pkgconfig/libzmq.pc" " -lzmq" " -l${libzmq_spec}")
if(NOT VCPKG_BUILD_TYPE)
file(GLOB libzmq_debug "${CURRENT_PACKAGES_DIR}/debug/lib/libzmq*.lib")
cmake_path(GET libzmq_debug STEM LAST_ONLY libzmq_spec)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libzmq.pc" " -lzmq" " -l${libzmq_spec}")
endif()
endif()
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/zmq.h" "defined ZMQ_STATIC" "(1)")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin" "${CURRENT_PACKAGES_DIR}/bin") # empty
endif()
file(COPY
@@ -66,12 +81,6 @@ file(COPY
DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}"
)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
# Handle copyright
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share" "${CURRENT_PACKAGES_DIR}/share/zmq")
vcpkg_fixup_pkgconfig()
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

View File

@@ -0,0 +1,18 @@
diff --git a/external/sha1/sha1.h b/external/sha1/sha1.h
index 7354d13..93d717a 100644
--- a/external/sha1/sha1.h
+++ b/external/sha1/sha1.h
@@ -45,6 +45,13 @@ extern "C" {
#include <stdlib.h>
#include "../../src/stdint.hpp"
+/* Avoid collision with libssh et al. */
+#define sha1_ctxt zmq_sha1_ctxt
+#define sha1_init zmq_sha1_init
+#define sha1_pad zmq_sha1_pad
+#define sha1_loop zmq_sha1_loop
+#define sha1_result zmq_sha1_result
+
struct sha1_ctxt
{
union

View File

@@ -1,7 +1,7 @@
{
"name": "zeromq",
"version": "4.3.5",
"port-version": 2,
"port-version": 3,
"description": "The ZeroMQ lightweight messaging kernel is a library which extends the standard socket interfaces with features traditionally provided by specialised messaging middleware products",
"homepage": "https://github.com/zeromq/libzmq",
"license": "MPL-2.0",

View File

@@ -2934,7 +2934,7 @@
},
"ffmpeg": {
"baseline": "7.1.2",
"port-version": 3
"port-version": 4
},
"ffnvcodec": {
"baseline": "13.0.19.0",
@@ -10914,7 +10914,7 @@
},
"zeromq": {
"baseline": "4.3.5",
"port-version": 2
"port-version": 3
},
"zfp": {
"baseline": "1.0.1",

View File

@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "4d296d54e7c2880504575318ca86ed35d6232eb6",
"version": "7.1.2",
"port-version": 4
},
{
"git-tree": "025013f583e57fa395a5479cc985af33fc52ad28",
"version": "7.1.2",

View File

@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "0868a363e9184119409ac1e4c4d93077dcb8318a",
"version": "4.3.5",
"port-version": 3
},
{
"git-tree": "454f5e2648cea10a305d0e781fd3093073153a2e",
"version": "4.3.5",