Add new port: libzvbi - VBI decoding library (teletext)#51729
Conversation
dg0yt
left a comment
There was a problem hiding this comment.
I don't want to review the CMakeLists.txt before it is accepted to vendor a CMake build system into the new port.
| if(VCPKG_TARGET_IS_WINDOWS) | ||
| vcpkg_cmake_configure( | ||
| SOURCE_PATH "${SOURCE_PATH}/src" | ||
| ) | ||
| vcpkg_cmake_install() | ||
| vcpkg_copy_pdbs() | ||
| vcpkg_fixup_pkgconfig() | ||
| file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include") | ||
| else() | ||
| vcpkg_find_acquire_program(PKGCONFIG) | ||
| vcpkg_configure_make( |
There was a problem hiding this comment.
In general, we want:
- use the official build systems
- use the same build system for all targets
- use the latest maintainer function from port vcpkg-make instead of the legacy
vcpkg_..._makefunctions.
| -static void init_hcrc(void) __attribute__ ((constructor)); | ||
| +static void init_hcrc(void); | ||
| + | ||
| +#ifdef _MSC_VER | ||
| +/* MSVC: .CRT$XCU section provides C startup initializers (like GCC __attribute__((constructor))). */ | ||
| +#pragma section(".CRT$XCU", read) | ||
| +static void __cdecl init_hcrc_crt_init(void) { init_hcrc(); } | ||
| +__declspec(allocate(".CRT$XCU")) static void (__cdecl *init_hcrc_crt_init_fn)(void) = init_hcrc_crt_init; | ||
| +#endif |
There was a problem hiding this comment.
Loosing the constructor property for other toolchains. Please adjust the patch to handle both implementations. (Hint: Put #if/else/endif in front of the line, define a macro to carry the attribute when applicable.)
| # autopoint (gettext) is not available in vcpkg's msys2 environment (Windows) | ||
| # nor on the Android CI hosts; since NLS is disabled anyway, skip it. | ||
| if(VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_ANDROID) | ||
| set(ENV{AUTOPOINT} true) | ||
| endif() |
There was a problem hiding this comment.
gettext including autopoint would be available via dependencies.
So get rid of the misleading comment, and clarify what "true" means here:
| # autopoint (gettext) is not available in vcpkg's msys2 environment (Windows) | |
| # nor on the Android CI hosts; since NLS is disabled anyway, skip it. | |
| if(VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_ANDROID) | |
| set(ENV{AUTOPOINT} true) | |
| endif() | |
| if(VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_ANDROID) | |
| set(ENV{AUTOPOINT} true) # the program | |
| endif() |
| if(NOT VCPKG_TARGET_IS_WINDOWS) | ||
| # The MSVC-compat patch creates Windows-only shim headers that shadow POSIX equivalents. | ||
| # Remove them so the autotools build uses the real system headers on Unix/macOS. | ||
| file(REMOVE "${SOURCE_PATH}/src/unistd.h") | ||
| file(REMOVE "${SOURCE_PATH}/src/strings.h") | ||
| file(REMOVE_RECURSE "${SOURCE_PATH}/src/sys") | ||
| endif() |
There was a problem hiding this comment.
I don't like this pattern. Avoid the shims. Or put the shims in a subdir, and adjust the include path as needed. Or create them with portfile commands in the binary dirs, between configure and build.
| vcpkg_make_install() | ||
| vcpkg_fixup_pkgconfig() | ||
|
|
||
| # Remove tools (not needed; avoids RPATH/headerpad issues on macOS). |
There was a problem hiding this comment.
There shouldn't be RPATH issues if upstream isn't doing crazy things.
If we don't want the tools, the port shouldn't build them.
Often it is just removing one SUBDIRS entry Makefile.am.
|
Well, when I originally created this port, I ended up writing a CMake build for Windows because I couldn’t get it to build otherwise. The Azure CI suggested a neat trick — set(ENV{AUTOPOINT} true) — but it still doesn’t build without autopoint. Ok, now I'll examine your comments from yesterday and adjust accordingly. |
I assume I know where Copilot took the idea from. |
Description
libzvbi (ZVBI) is a library for decoding VBI (Vertical Blanking Interval) data services, including:
Why this port is needed
libzvbi is needed by FFmpeg to decode teletext pages from MPEG-2 Transport Streams (M2TS).
When FFmpeg is built with
--enable-libzvbi, thelibzvbiteletext decoder becomes available, enabling extraction of teletext subtitle pages from DVB broadcasts and recordings.This is the standard approach used by broadcast and media-processing pipelines worldwide.
Without libzvbi, FFmpeg cannot decode teletext data embedded in DVB streams.
Build strategy
CMakeLists.txt+ MSVC-compat patch + pre-generatedconfig.h/site_def.h./configureviavcpkg_configure_make(AUTOCONFIG)The upstream project uses autotools exclusively.
On Windows, a custom CMake build file is provided because autotools is impractical with MSVC.
The MSVC-compat patch (
001-msvc-compat.patch) adds shim headers (unistd.h,strings.h,sys/) for POSIX APIs;these shims are removed on non-Windows platforms before the autotools build runs.
Dependencies
Patches
001-msvc-compat.patchOwner-Projectform.vcpkg.json, or explicitly disabled through patches or build system arguments such as CMAKE_DISABLE_FIND_PACKAGE_Xxx or VCPKG_LOCK_FIND_PACKAGEvcpkg.jsonmatches what upstream says.vcpkg.jsonmatches what upstream says../vcpkg x-add-version --alland committing the result.