diff --git a/res/vcpkg/mfx-dispatch/portfile.cmake b/res/vcpkg/mfx-dispatch/portfile.cmake index 7bf0a58bf..4b2951150 100644 --- a/res/vcpkg/mfx-dispatch/portfile.cmake +++ b/res/vcpkg/mfx-dispatch/portfile.cmake @@ -18,42 +18,65 @@ vcpkg_from_github( ${MISSING_CSTDINT_IMPORT_PATCH} ) -# mfx_dispatch's configure.ac uses LT_INIT, but autoreconf 1.17+ (Debian 13, -# Ubuntu 24.04+) sometimes fails to trace it -- reporting "not using Libtool" -# and skipping libtoolize. When libtoolize doesn't run, libtool's m4 macros -# never get installed into the source tree, and automake then fails with -# "Libtool library used but 'LIBTOOL' is undefined" on Makefile.am:7. -# -# Force libtoolize to run before autoreconf so the m4 macros are guaranteed -# to be present regardless of autoreconf's introspection result. -if(NOT VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_MINGW) - find_program(LIBTOOLIZE NAMES libtoolize glibtoolize) - if(LIBTOOLIZE) - message(STATUS "mfx-dispatch: pre-running libtoolize to install libtool m4 macros") - file(MAKE_DIRECTORY "${SOURCE_PATH}/m4") - vcpkg_execute_required_process( - COMMAND "${LIBTOOLIZE}" --force --copy --install - WORKING_DIRECTORY "${SOURCE_PATH}" - LOGNAME "libtoolize-${TARGET_TRIPLET}" - ) - else() - message(WARNING "libtoolize not found; mfx-dispatch build is likely to fail") - endif() -endif() - if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) vcpkg_cmake_configure( - SOURCE_PATH "${SOURCE_PATH}" + SOURCE_PATH "${SOURCE_PATH}" ) vcpkg_cmake_install() vcpkg_copy_pdbs() else() + # autotools 1.17+ (Debian 13, Ubuntu 24.04+) has a tracing bug: even though + # configure.ac calls LT_INIT, autoreconf reports "configure.ac: not using + # Libtool" and skips libtoolize, leaving libtool's m4 macros uninstalled. + # automake then fails with "Libtool library used but 'LIBTOOL' is undefined". + # + # Running libtoolize *before* `autoreconf -vfi` doesn't help because the -i + # flag has autoreconf re-introspect and clean things up, undoing libtoolize. + # Solution: run the full autotools chain ourselves, in order, with libtoolize + # before aclocal, then call vcpkg_configure_make *without* AUTOCONFIG so it + # uses the configure script we produced. + file(MAKE_DIRECTORY "${SOURCE_PATH}/m4") + + find_program(LIBTOOLIZE NAMES libtoolize glibtoolize REQUIRED) + find_program(ACLOCAL NAMES aclocal REQUIRED) + find_program(AUTOCONF NAMES autoconf REQUIRED) + find_program(AUTOMAKE NAMES automake REQUIRED) + message(STATUS "mfx-dispatch: running explicit autotools chain") + message(STATUS " libtoolize: ${LIBTOOLIZE}") + message(STATUS " aclocal : ${ACLOCAL}") + message(STATUS " autoconf : ${AUTOCONF}") + message(STATUS " automake : ${AUTOMAKE}") + + vcpkg_execute_required_process( + COMMAND "${LIBTOOLIZE}" --force --copy --install + WORKING_DIRECTORY "${SOURCE_PATH}" + LOGNAME "step1-libtoolize-${TARGET_TRIPLET}") + if(NOT EXISTS "${SOURCE_PATH}/m4/libtool.m4") + message(FATAL_ERROR "libtoolize did not produce ${SOURCE_PATH}/m4/libtool.m4 -- libtool package missing or broken") + endif() + + vcpkg_execute_required_process( + COMMAND "${ACLOCAL}" --force -I m4 + WORKING_DIRECTORY "${SOURCE_PATH}" + LOGNAME "step2-aclocal-${TARGET_TRIPLET}") + + vcpkg_execute_required_process( + COMMAND "${AUTOCONF}" --force + WORKING_DIRECTORY "${SOURCE_PATH}" + LOGNAME "step3-autoconf-${TARGET_TRIPLET}") + + vcpkg_execute_required_process( + COMMAND "${AUTOMAKE}" --add-missing --copy --force-missing + WORKING_DIRECTORY "${SOURCE_PATH}" + LOGNAME "step4-automake-${TARGET_TRIPLET}") + if(VCPKG_TARGET_IS_MINGW) vcpkg_check_linkage(ONLY_STATIC_LIBRARY) endif() vcpkg_configure_make( SOURCE_PATH "${SOURCE_PATH}" - AUTOCONFIG + # NOT AUTOCONFIG -- we ran the chain manually above. Letting vcpkg + # rerun autoreconf -vfi would re-trigger the broken introspection. ) vcpkg_install_make() endif()