Repository navigation
Build only what ffmpeg links - #846
Conversation
wader
left a comment
There was a problem hiding this comment.
Most things looks good 👍 all the disabling of things to build like tests etc i think can be merged. I'm a bit more reluctant about some that does manual/complex installs, could some of those break in confusing ways in future versions of deps?
| echo "$MP3LAME_SHA256 lame.tar.gz" | sha256sum -c - && \ | ||
| tar $TAR_OPTS lame.tar.gz && cd lame-* && \ | ||
| # configure never sets NDEBUG, the encoder is full of asserts | ||
| CFLAGS="$CFLAGS -DNDEBUG" \ |
There was a problem hiding this comment.
Looking at some of the asserts, ex in https://github.com/enzo1982/lame/blob/8723d2fdd074c32083fed338fe2d437157b75471/libmp3lame/quantize.c#L2065, it seem like they might assert things that are required or limits of the mp3 frame formats or standard? so would the result of not asserting produce a broken output?
| make -j$(nproc) xeve && \ | ||
| install -D -m644 src_main/libxeve.a /usr/local/lib/xeve/libxeve.a && \ | ||
| install -D -m644 -t /usr/local/include/xeve ../inc/xeve.h xeve_exports.h && \ | ||
| install -D -m644 xeve.pc /usr/local/lib/pkgconfig/xeve.pc |
There was a problem hiding this comment.
I wonder if doing manual install (here and some other places) might break in future versions? is it worth the build time save?
|
Thanks for looking it over. Some settings were more aggressive than I saw myself, so I pulled a few teeth:
What remains are the projects' own options, LTO off in svtav1 and vvenc (ffmpeg's final link got 52 s faster in CI), the library features ffmpeg cannot reach and the unused apk packages. Research and wording by Claude (Anthropic), directed and reviewed by me. |
No worries, i think both assert and produce broken frames is bad, but maybe assert it less confusing/bad? i wonder it this might be fixable in lame somehow but i don't know enough about lame. I've seen some of these asserts trigger in production systems so that why i noticed.
Just out of curiosity: Any idea if it would be possible to do whole binary LTO and if so how would if affect performance? would it "just" involved compile more things with LTO and the linker knows how to mix LTO with non-LTO? |
| ninja -j$(nproc) -vC build install | ||
| # only the targets with the install tags devel and bin-devel: libraries, headers, .pc files and build tools | ||
| ninja -j$(nproc) -vC build $(jq -r --arg b "$PWD/build/" '.targets | to_entries[] | select(.value.tag == "devel" or .value.tag == "bin-devel") | .key | ltrimstr($b)' build/meson-info/intro-install_plan.json) && \ | ||
| meson install -C build --no-rebuild --tags devel,bin-devel |
There was a problem hiding this comment.
There is no standard way to express "install only dev stuff"? but i do appreciate some jq :)
|
lame: Agreed, an abort is the clearer failure. lame's own configure calls the asserts "a quick and user-unfriendly fix", the real solution being proper error messages (configure.ac#L1092-L1096). Its history lists such asserts fixed once someone reported the input, e.g. ticket #501, so an input that triggers one in production is worth a report to lame. meson: For installing, yes: Whole binary LTO: A bigger undertaking than it looks, so I opened #848 for it. Research and wording by Claude (Anthropic), directed and reviewed by me. |
| -Dgobject=disabled \ | ||
| -Dsubset=disabled \ | ||
| -Draster=disabled \ | ||
| -Dvector=disabled \ |
There was a problem hiding this comment.
we don't need vector or raster because ffmpeg draw filter uses freetype for drawing? harfbuzz only for shaping?
There was a problem hiding this comment.
Yes, harfbuzz only shapes the text there and freetype draws it. raster and vector are separate libraries that nothing here links.
Research and wording by Claude (Anthropic), directed and reviewed by me.
|
Thanks! |
Most recipes build everything their project offers by default: tools, test suites, examples, docs and sometimes a shared library next to the static one. None of it ends up in ffmpeg, but it costs compile time and, for some test suites, a download during the build. This PR switches that off and drops library features and apk packages nothing uses. ffmpeg loses nothing, builds faster.
Tools, tests, examples and docs
Where a project has an option, it is set (table at the end). glib has none for its tools (
gio,gsettings,gdbusand others carry the install tagbin, gio/meson.build#L1056-L1139), so the recipe builds and installs only the targets taggeddevelandbin-devel: libraries, headers,.pcfiles and build tools. meson's install tags are meant for packagers (Installing.md#L152-L161); a static library isdevel(backends.py#L1746).Library features ffmpeg cannot reach
The code dropped here runs only through API calls ffmpeg n9.0.2 never makes:
-Dtee=disabledcairo_teecall in pango, librsvg, libass or ffmpeg (src/meson.build#L199-L201)-Dfreetype=disabledbd_register_overlay_proc(bluray.c#L4133-L4144), which ffmpeg's bluray.c does not call-DENABLE_SSL_SUPPORT=OFFamqp_tcp_socket_new(libamqp.c#L138)-DWITH_PCAP=OFFssh_set_pcap_file(pcap.c#L530-L541), which ffmpeg's libssh.c does not call-DJPEGXL_ENABLE_TRANSCODE_JPEG=OFFJXL_DEC_JPEG_RECONSTRUCTION(libjxldec.c#L75-L77)apk packages no recipe uses
graphite2-staticgraphite2isdisabledby default (meson_options.txt#L16-L19)tiff,libjpeg-turbo,giflib(+-dev)--without-jpeg --without-tiff(configure.ac#L101, #L119), used only by its toolsjpgiccandtificc(jpgicc, tificc); libjxl uses them only for tools or tests (lib/CMakeLists.txt#L187-L188), theora only for examples (configure.ac#L501-L513)tclconfigure(configure#L1); the recipe uses cmakecunit cunit-devBUILD_TESTS(src/CMakeLists.txt#L153-L156)Options per library
-Denable_tools=false-Dtests=false,-Dsysprof=disabled(autoclones sysprof, meson.build#L34-L45)gobject,subset,raster,vector,gpu,tests,utilitiesdisabled-Dbuild-testsuite=false,-Dbuild-examples=false, sostaticinstead ofboth-Denable_tools=false,-Denable_tests=false(tests clonecheckasm, tests/meson.build#L30-L36)-Denable_tools=false-DBUILD_APPS=OFF,-DSVT_AV1_LTO=OFF(LTO moves code generation to ffmpeg's final, serial link)--disable-tools-DENABLE_CLI=OFF-DJPEGXL_ENABLE_TOOLS=OFF--disable-perf,--disable-curve-keygen,--without-docs-DVVENC_LIBRARY_ONLY=ON,-DVVENC_ENABLE_LINK_TIME_OPT=OFF(as svtav1)Research and wording by Claude (Anthropic), directed and reviewed by me.