Skip to content

Commit

Permalink
Update libheif process
Browse files Browse the repository at this point in the history
Transfer the CMakeLists edits to patch.
Add shared option.
And some cosmetics.
  • Loading branch information
L4cache committed Dec 7, 2024
1 parent a594d51 commit b0c6401
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
16 changes: 9 additions & 7 deletions build/media-suite_compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=()
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions media-autobuild_suite.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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 -------------------------------------------------------------------------------
Expand All @@ -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
Expand Down

0 comments on commit b0c6401

Please sign in to comment.