From b0c64017cc4305c279078352bf9538180e84fbeb Mon Sep 17 00:00:00 2001 From: L4cache <42721712+L4cache@users.noreply.github.com> Date: Sat, 7 Dec 2024 10:09:27 +0800 Subject: [PATCH] Update libheif process Transfer the CMakeLists edits to patch. Add shared option. And some cosmetics. --- build/media-suite_compile.sh | 16 +++++++++------- media-autobuild_suite.bat | 7 ++++--- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/build/media-suite_compile.sh b/build/media-suite_compile.sh index a5bc05051a..7dbe55ad48 100644 --- a/build/media-suite_compile.sh +++ b/build/media-suite_compile.sh @@ -2433,7 +2433,7 @@ fi _check=(libde265.a) [[ $standalone = y ]] && _check+=(bin-video/dec265.exe) -if [[ $libheif = y ]] && +if [[ $libheif != n ]] && do_vcs "$SOURCE_REPO_LIBDE265"; then do_uninstall "${_check[@]}" extracommands=() @@ -2443,17 +2443,16 @@ if [[ $libheif = y ]] && fi _check=(bin-video/heif-{dec,enc,info,thumbnailer}.exe) -if [[ $libheif = y ]] && +[[ $libheif = shared ]] && _check+=(bin-video/libheif.dll) +if [[ $libheif != n ]] && do_vcs "$SOURCE_REPO_LIBHEIF"; then do_uninstall "${_check[@]}" - sed -i 's/find_package(vvdec 2.3.0)/find_package(vvdec 3.0.0)/' CMakeLists.txt - sed -i 's/find_package(Doxygen)/#/' CMakeLists.txt # no configurable option? - sed -i 's/find_package(Brotli)/#/' CMakeLists.txt # linking difficulties - sed -i 's/find_package(TIFF)/#/' heifio/CMakeLists.txt # configure & linking difficulties + do_patch https://raw.githubusercontent.com/m-ab-s/mabs-patches/master/libheif/0001-Edit-CMakeLists.patch extracflags=() extracommands=(-DWITH_HEADER_COMPRESSION=ON -DWITH_UNCOMPRESSED_CODEC=ON) + pc_exists "libde265" && extracommands+=(-DWITH_LIBDE265=ON -DWITH_LIBDE265_PLUGIN=OFF) && extracflags+=(-DLIBDE265_STATIC_BUILD=1) @@ -2494,9 +2493,12 @@ if [[ $libheif = y ]] && pc_exists "libavcodec" "libavutil" && extracommands+=(-DWITH_FFMPEG_DECODER=OFF -DWITH_FFMPEG_DECODER_PLUGIN=OFF) + # this depends on CMake overrides -DBUILD_SHARED_LIBS=off in do_cmake, may break if that behavior changes. + [[ $libheif = shared ]] && extracommands+=(-DBUILD_SHARED_LIBS=ON) CFLAGS+=" ${extracflags[@]}" CXXFLAGS+=" ${extracflags[@]}" \ do_cmakeinstall video -DBUILD_TESTING=OFF -DWITH_GDK_PIXBUF=OFF "${extracommands[@]}" - # this subfolder is for plugins and is empty so we delete it + + # this subfolder is for plugins and is empty since we did't build any plugin so we delete it rmdir "$LOCALDESTDIR/lib/libheif" > /dev/null 2>&1 do_checkIfExist fi diff --git a/media-autobuild_suite.bat b/media-autobuild_suite.bat index f901dba40f..90b098ef0d 100644 --- a/media-autobuild_suite.bat +++ b/media-autobuild_suite.bat @@ -408,12 +408,12 @@ if [0]==[%libheifINI%] ( echo. Build libheif [High Efficiency Image File Format encoder and decoder]? echo. 1 = Yes echo. 2 = No + echo. 3 = Shared (a single libheif.dll with multiple execatables) echo. - echo. Libheif binaries will always be built. echo. Will use available encoders and decoders supported by libheif. echo. If not found, built libheif will lack the corresponding encode/decode ability. echo. Additionally libde265 will be built. - echo. dec265 being built depends on "standalone=y" and are always static. + echo. dec265 of libde265 being built depends on "standalone=y" and is always static. echo. echo ------------------------------------------------------------------------------- echo ------------------------------------------------------------------------------- @@ -423,7 +423,8 @@ if [0]==[%libheifINI%] ( if "%buildlibheif%"=="" GOTO libheif if %buildlibheif%==1 set "libheif=y" if %buildlibheif%==2 set "libheif=n" -if %buildlibheif% GTR 2 GOTO libheif +if %buildlibheif%==3 set "libheif=shared" +if %buildlibheif% GTR 3 GOTO libheif if %deleteINI%==1 echo.libheif=^%buildlibheif%>>%ini% :jpegxl