• src/doors/syncscumm/door/CMakeLists.txt

    From Rob Swindell (on Debian Linux)@VERT to Git commit to main/sbbs/master on Wed Jul 22 16:22:51 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/85eee29699c3bd67950ab783
    Modified Files:
    src/doors/syncscumm/door/CMakeLists.txt
    Log Message:
    syncscumm: link libsndfile when termgfx finds it via find_package CONFIG

    The Linux build transcribes termgfx's external link deps across the seam
    to ScummVM's hand-rolled link (build.sh appends them to config.mk's
    LIBS). For libsndfile, door/CMakeLists.txt reconstructed the -lsndfile
    flag from termgfx's INTERFACE_LINK_LIBRARIES, and that reconstruction
    had a hole:

    - if(TARGET SndFile::sndfile) is false in the parent scope -- an
    imported target created by find_package() inside the termgfx
    add_subdirectory() is directory-scoped and not visible one level up
    in door/; and
    - the bare-"sndfile" regex fallback does not match the target-name
    string "SndFile::sndfile" that the CONFIG path leaves in
    INTERFACE_LINK_LIBRARIES.

    So on any host where termgfx finds libsndfile via find_package(SndFile
    CONFIG) -- Arch and other distros that ship SndFileConfig.cmake (which
    CMake prefers over pkg-config), and vcpkg -- both branches miss, sndfile_libs.txt is written empty, build.sh's [ -s ] check skips it, and
    no -lsndfile reaches the link. But termgfx still compiled with TERMGFX_WITH_SNDFILE, so libtermgfx.a references sf_*, and the door fails
    to link with undefined references to sf_format_check / sf_open_virtual / sf_command / sf_writef_short / sf_close from termgfx/audio.c. Hosts that
    find libsndfile via pkg-config (bare "sndfile" in the link interface)
    were unaffected, which is why it went unseen.

    Add a safety net keyed on the real invariant -- termgfx compiled with TERMGFX_WITH_SNDFILE means libtermgfx.a references sf_*, so the final
    link needs libsndfile. The compile definition is readable on the regular termgfx target from any scope, so when neither existing branch produced a token, fall back to -lsndfile. No effect on the working pkg-config path
    (the existing branch already sets it).

    Reported by Accession on IRC: the door failed to link on Arch with
    exactly those undefined sf_* references, and build/libs/sndfile_libs.txt
    was confirmed empty.

    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

    ---
    þ Synchronet þ Vertrauen þ Home of Synchronet þ [vert/cvs/bbs].synchro.net