Add new port: libtwolame - MPEG Audio Layer 2 encoder for broadcast-quality audio#51728
Add new port: libtwolame - MPEG Audio Layer 2 encoder for broadcast-quality audio#51728Greisby wants to merge 9 commits into
Conversation
|
sorry, forgot to switch to master first... |
dg0yt
left a comment
There was a problem hiding this comment.
Same buildsystem comment as in the other PR.
|
|
||
| if("tool" IN_LIST FEATURES) | ||
| # twolame binary is installed in tools/libtwolame/bin by vcpkg_configure_make's custom bindir | ||
| vcpkg_copy_tools(TOOL_NAMES twolame AUTO_CLEAN SEARCH_DIR "${CURRENT_PACKAGES_DIR}/tools/libtwolame/bin") | ||
| endif() |
There was a problem hiding this comment.
| if("tool" IN_LIST FEATURES) | |
| # twolame binary is installed in tools/libtwolame/bin by vcpkg_configure_make's custom bindir | |
| vcpkg_copy_tools(TOOL_NAMES twolame AUTO_CLEAN SEARCH_DIR "${CURRENT_PACKAGES_DIR}/tools/libtwolame/bin") | |
| endif() |
In general tools are not moved from tools/<port>/bin to tools/<port>.
| # For static builds, autotools puts -lm in Libs.Private which is only used with pkg-config --static. | ||
| # Consumers like FFmpeg use plain --libs, so the link test fails on math symbols (pow, cos, lrintf...). | ||
| # Move -lm into Libs. | ||
| if(NOT VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL "static") | ||
| foreach(_pc_suffix IN ITEMS "lib/pkgconfig/twolame.pc" "debug/lib/pkgconfig/twolame.pc") | ||
| set(_pc_file "${CURRENT_PACKAGES_DIR}/${_pc_suffix}") | ||
| if(EXISTS "${_pc_file}") | ||
| file(READ "${_pc_file}" _pc_content) | ||
| string(REPLACE "-ltwolame" "-ltwolame -lm" _pc_content "${_pc_content}") | ||
| string(REGEX REPLACE "Libs\\.Private:[^\n]*" "Libs.Private:" _pc_content "${_pc_content}") | ||
| file(WRITE "${_pc_file}" "${_pc_content}") | ||
| endif() | ||
| endforeach() | ||
| endif() | ||
|
|
There was a problem hiding this comment.
vcpkg_fixup_pkgconfig does the merging of xxx.Private into xxx.
| option(BUILD_SHARED_LIBS "Build shared library" OFF) | ||
|
|
There was a problem hiding this comment.
| option(BUILD_SHARED_LIBS "Build shared library" OFF) | |
Set by the vcpkg toolchain.
| install(TARGETS twolame | ||
| EXPORT twolame-targets | ||
| RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
| LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
| ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
| PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} | ||
| ) | ||
|
|
||
| install(EXPORT twolame-targets | ||
| FILE twolameConfig.cmake | ||
| NAMESPACE twolame:: | ||
| DESTINATION share/twolame | ||
| ) |
There was a problem hiding this comment.
Unofficial targets should be namespaced (unofficial::twolame)
There was a problem hiding this comment.
Full rules covers the CMake package name, too: unofficial-<PORT>.
|
|
||
| Name: TwoLAME | ||
| Description: Optimised MPEG Audio Layer 2 (MP2) encoder | ||
| Version: ${PROJECT_VERSION} |
| vcpkg_cmake_build() | ||
| vcpkg_cmake_install() |
There was a problem hiding this comment.
| vcpkg_cmake_build() | |
| vcpkg_cmake_install() | |
| vcpkg_cmake_install() | |
| vcpkg_cmake_fixup_config(PACKAGE_NAME unofficial-twolame) |
| vcpkg_from_github( | ||
| OUT_SOURCE_PATH SOURCE_PATH | ||
| REPO njh/twolame | ||
| REF 0.4.0 |
There was a problem hiding this comment.
| REF 0.4.0 | |
| REF "${VERSION}" |
VERSION is filled automatically and matches the version declared in vcpkg.json
| if(VCPKG_TARGET_IS_WINDOWS) | ||
| # Upstream has no CMakeLists.txt suitable for library-only builds. | ||
| # Use our own minimal CMakeLists.txt. | ||
| file(COPY "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" DESTINATION "${SOURCE_PATH}") |
There was a problem hiding this comment.
Why not use vcpkg_configure_make on Windows? It should work alright but you will need to add pkgconfig to path for .pc files to work.
vcpkg_find_acquire_program(PKGCONFIG)
get_filename_component(PKGCONFIG_DIR "${PKGCONFIG}" DIRECTORY)
vcpkg_add_to_path("${PKGCONFIG_DIR}")There was a problem hiding this comment.
Good question.
This is also based on a port I made a few years ago.
I'll try to get it working with autotools.
| patches/001-fix-tl-api-export.patch | ||
| patches/002-disable-doc-subdir.patch | ||
| patches/003-fix-kr-declaration.patch |
There was a problem hiding this comment.
Have you submitted patches 001 and 003 upstream?
There was a problem hiding this comment.
No, but they were already submitted and merged upstream:
- 001: https://github.com/njh/twolame/pull/97/changes (Jul 2021)
- 003: https://github.com/njh/twolame/pull/105/changes (Feb this year)
Since then (2021!), no new version was tagged, so I included them.
|
It was pretty straightforward, BUT The -lm was not moved from Any clue? |
Case issue. |
|
This is a strange check error. so my last commit was correct. |
Co-authored-by: Kai Pastor <dg0yt@darc.de>
|
By the way, could the “check for common mistakes” failure be caused by the branch being out of date? |
These checks are usually made agains merge commits. So either it sees a fresh picture, or it doesn't start due to merge conflict. |
I've seen it happen when the branch is more than 50 commits out of date. |
|
Thanks, I hesitated to do it myself. |
Description
TwoLAME is a MPEG Audio Layer 2 encoder for broadcast-quality audio.
It is an optimised encoder based on tooLAME by Mike Cheng, which itself was based on the ISO reference encoder
dist10.MP2 remains the standard audio codec for European broadcasting (DVB, DAB) and is widely used in professional media workflows.
TwoLAME is the highest-quality open-source MP2 encoder available and an encoder used by FFmpeg for MP2 output (
-c:a libtwolame).Why this port is needed
libtwolameencoder wraps this library (port must be modified later).Building FFmpeg with
--enable-libtwolameprovides a broadcast-compliant MP2 encoder far superior to FFmpeg's built-inmp2encoder.TwoLAME produces ISO 11172-3 / 13818-3 compliant bitstreams.
Build strategy
CMakeLists.txt(library-only build)./configureviavcpkg_configure_make(AUTOCONFIG)Upstream ships an autotools build system only.
On Windows, a custom
CMakeLists.txtis provided for MSVC compatibility (library build only — no CLI tool).Patches
001-fix-tl-api-export.patchTWOLAME_DLL/dllexportfor shared builds002-disable-doc-subdir.patchdocsubdir from build; fixpkgdoc_DATAfilenames (README.md,NEWS.md)Additional portfile fix (no upstream source patch):
-lminLibs.Owner-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.