Skip to content

Commit

Permalink
[libwebp] Update, cleanup (#23864)
Browse files Browse the repository at this point in the history
* Update to v1.2.2

* Fix libwebpmux Windows name breakage

The pc file relies on the original output name:
No 'lib' prefix for MSVC. No 'liblib' prefix for mingw.

* Minor portfile updates

* Don't self-depend on default features

* Fix the libwebpmux feature

* Fix internal tool dependencies

* Drop Xrandr patch (fixed in freeglut)

* Drop X11 patch (fixed in freeglut)

* Cleanup CMake config patch, no extra case hacks

* Adjust webp lib names in skia, qt5-imageformats

* Adjust downstream WEBP cmake usage

* Debug qtimageformats [skip actions]

* [tiff] Drive-by fix for CMake warning

* Drop non-standard debug postfix

* Update indentation

* Update port versions

* Update versions

* Revert qtimageformat debug change

* Fixup qt5-imageformats change

* Update versions
  • Loading branch information
dg0yt authored Apr 13, 2022
1 parent feef13c commit 99346bb
Show file tree
Hide file tree
Showing 31 changed files with 185 additions and 203 deletions.
9 changes: 0 additions & 9 deletions ports/libwebp/0001-build.patch
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,6 @@ index bd1bebb..4ce801d 100644
else()
add_definitions(-Wall)
endif()
@@ -482,7 +485,7 @@ if(WEBP_BUILD_LIBWEBPMUX)
"${CMAKE_CURRENT_SOURCE_DIR}/src/webp/mux.h;\
${CMAKE_CURRENT_SOURCE_DIR}/src/webp/mux_types.h;\
${CMAKE_CURRENT_SOURCE_DIR}/src/webp/types.h;")
- set_target_properties(libwebpmux PROPERTIES OUTPUT_NAME webpmux)
+ set_target_properties(libwebpmux PROPERTIES OUTPUT_NAME $<$<PLATFORM_ID:Windows>:lib>webpmux)
list(APPEND INSTALLED_LIBRARIES libwebpmux)
configure_pkg_config("src/mux/libwebpmux.pc")
endif()
@@ -586,8 +589,12 @@ if(WEBP_BUILD_EXTRAS)
# webp_quality
add_executable(webp_quality ${WEBP_QUALITY_SRCS} ${WEBP_EXTRAS_SRCS})
Expand Down
69 changes: 0 additions & 69 deletions ports/libwebp/0002-cmake-config-add-backwards-compatibility.patch

This file was deleted.

24 changes: 24 additions & 0 deletions ports/libwebp/0002-cmake-config.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diff --git a/cmake/WebPConfig.cmake.in b/cmake/WebPConfig.cmake.in
index 822fc59..fb31829 100644
--- a/cmake/WebPConfig.cmake.in
+++ b/cmake/WebPConfig.cmake.in
@@ -5,7 +5,17 @@ set(WEBP_VERSION ${WebP_VERSION})

include ("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake")

-set(WebP_INCLUDE_DIRS "@CMAKE_INSTALL_FULL_INCLUDEDIR@")
+get_filename_component(_vcpkg_libwebp_root "${CMAKE_CURRENT_LIST_DIR}/../.." ABSOLUTE)
+set(WebP_INCLUDE_DIRS "${_vcpkg_libwebp_root}/include")
set(WEBP_INCLUDE_DIRS ${WebP_INCLUDE_DIRS})
-set(WebP_LIBRARIES "@INSTALLED_LIBRARIES@")
+set(WebP_LIBRARIES "")
+include(SelectLibraryConfigurations)
+foreach(_vcpkg_libwebp_lib IN ITEMS @INSTALLED_LIBRARIES@)
+ string(REPLACE "libwebpmux" "webpmux" _vcpkg_libwebp_lib "${_vcpkg_libwebp_lib}") # offical OUTPUT_NAME
+ find_library(_vcpkg_${_vcpkg_libwebp_lib}_LIBRARY_RELEASE NAMES ${_vcpkg_libwebp_lib} NAMES_PER_DIR PATHS "${_vcpkg_libwebp_root}/lib" NO_DEFAULT_PATH)
+ find_library(_vcpkg_${_vcpkg_libwebp_lib}_LIBRARY_DEBUG NAMES ${_vcpkg_libwebp_lib}d ${_vcpkg_libwebp_lib} NAMES_PER_DIR PATHS "${_vcpkg_libwebp_root}/debug/lib" NO_DEFAULT_PATH)
+ select_library_configurations(_vcpkg_${_vcpkg_libwebp_lib})
+ list(APPEND WebP_LIBRARIES ${_vcpkg_${_vcpkg_libwebp_lib}_LIBRARIES})
+endforeach()
set(WEBP_LIBRARIES "${WebP_LIBRARIES}")
+unset(_vcpkg_libwebp_root)
13 changes: 0 additions & 13 deletions ports/libwebp/0003-always-mux.patch

This file was deleted.

13 changes: 13 additions & 0 deletions ports/libwebp/0003-fix-tool-dependencies.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 77a0f85..4a84ed1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -410,6 +410,8 @@ endif()

# Build the executables if asked for.
if(WEBP_BUILD_ANIM_UTILS
+ OR WEBP_BUILD_WEBPINFO
+ OR WEBP_BUILD_WEBPMUX
OR WEBP_BUILD_CWEBP
OR WEBP_BUILD_DWEBP
OR WEBP_BUILD_GIF2WEBP
15 changes: 0 additions & 15 deletions ports/libwebp/0004-add-missing-linked-library.patch

This file was deleted.

2 changes: 1 addition & 1 deletion ports/libwebp/0006-fix-dependecies-platform.patch
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ index 83edb3a..f634094 100644
+ target_compile_definitions(vwebp_sdl PRIVATE WEBP_HAVE_JUST_SDL_H)
target_include_directories(vwebp_sdl
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_BINARY_DIR}
10 changes: 0 additions & 10 deletions ports/libwebp/0009-glut.patch
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,3 @@ index 0799269..45b3306 100644
imageioutil
webp
webpdemux)
@@ -543,6 +543,9 @@ if(WEBP_BUILD_VWEBP)
if(UNIX AND NOT(ANDROID OR BLACKBERRY OR APPLE))
find_package(X11 REQUIRED)
target_link_libraries(vwebp ${X11_LIBRARIES} ${X11_Xxf86vm_LIB})
+ if(X11_Xrandr_FOUND) # due to glut linking xrandr if found
+ target_link_libraries(vwebp ${X11_Xrandr_LIB})
+ endif()
endif()
install(TARGETS vwebp RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
96 changes: 41 additions & 55 deletions ports/libwebp/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,84 +1,70 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO webmproject/libwebp
REF 9ce5843dbabcfd3f7c39ec7ceba9cbeb213cbfdf # v1.2.1
SHA512 43224caedb0d591ad1dd3872cd882c0fe255e24425f6da82fca212783ddb231326797a82ead0a1b8b15dc98db1cb05741e3a5e5131babbcc49a529a9f3253865
HEAD_REF master
PATCHES
0001-build.patch
0002-cmake-config-add-backwards-compatibility.patch
0003-always-mux.patch #always build libwebpmux
0004-add-missing-linked-library.patch
0006-fix-dependecies-platform.patch
0007-fix-arm-build.patch
0008-sdl.patch
0009-glut.patch
OUT_SOURCE_PATH SOURCE_PATH
REPO webmproject/libwebp
REF v1.2.2
SHA512 04a036b705316ea04add50c9ec2d6d7a8316c710556b97413015d7b8548fe31a8f7f5bf0632e76262ada504dcc35ead20189ee7fcb3cebbe568eb15736ad9a94
HEAD_REF master
PATCHES
0001-build.patch
0002-cmake-config.patch
0003-fix-tool-dependencies.patch
0006-fix-dependecies-platform.patch
0007-fix-arm-build.patch
0008-sdl.patch
0009-glut.patch
)

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
anim WEBP_BUILD_ANIM_UTILS
gif2webp WEBP_BUILD_GIF2WEBP
img2webp WEBP_BUILD_IMG2WEBP
vwebp WEBP_BUILD_VWEBP
vwebp-sdl WEBP_HAVE_SDL
info WEBP_BUILD_WEBPINFO
mux WEBP_BUILD_WEBPMUX
extras WEBP_BUILD_EXTRAS
nearlossless WEBP_NEAR_LOSSLESS
simd WEBP_ENABLE_SIMD
cwebp WEBP_BUILD_CWEBP
dwebp WEBP_BUILD_DWEBP
swap16bitcsp WEBP_ENABLE_SWAP_16BIT_CSP
unicode WEBP_UNICODE
libbwebpmux WEBP_BUILD_LIBWEBPMUX
FEATURES
anim WEBP_BUILD_ANIM_UTILS
gif2webp WEBP_BUILD_GIF2WEBP
img2webp WEBP_BUILD_IMG2WEBP
vwebp WEBP_BUILD_VWEBP
vwebp-sdl WEBP_HAVE_SDL
info WEBP_BUILD_WEBPINFO
mux WEBP_BUILD_WEBPMUX
extras WEBP_BUILD_EXTRAS
nearlossless WEBP_NEAR_LOSSLESS
simd WEBP_ENABLE_SIMD
cwebp WEBP_BUILD_CWEBP
dwebp WEBP_BUILD_DWEBP
swap16bitcsp WEBP_ENABLE_SWAP_16BIT_CSP
unicode WEBP_UNICODE
libwebpmux WEBP_BUILD_LIBWEBPMUX
)


if(VCPKG_TARGET_IS_LINUX)
message("WebP currently requires the following library from the system package manager:\n Xxf86vm\n\nThis can be installed on Ubuntu systems via apt-get install libxxf86vm-dev")
endif()

if(VCPKG_TARGET_IS_OSX)
if("vwebp" IN_LIST FEATURES OR "extras" IN_LIST FEATURES)
message(FATAL_ERROR "Due to GLUT Framework problems with CMake, at the moment it's not possible to build VWebP or extras on Mac!")
endif()
endif()

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${FEATURE_OPTIONS}
OPTIONS_DEBUG
-DCMAKE_DEBUG_POSTFIX=d
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${FEATURE_OPTIONS}
)

vcpkg_cmake_install()

file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")

vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup(PACKAGE_NAME WebP CONFIG_PATH share/WebP/cmake) # find_package is called with WebP not libwebp
vcpkg_cmake_config_fixup(PACKAGE_NAME WebP CONFIG_PATH share/WebP/cmake)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")

if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libwebp.pc" "-lwebp" "-lwebpd")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libwebpdecoder.pc" "-lwebpdecoder" "-lwebpdecoderd")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libwebpdemux.pc" "-lwebpdemux" "-lwebpdemuxd")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libwebpmux.pc" "-lwebpmux" "-lwebpmuxd")
endif()
vcpkg_fixup_pkgconfig()

set(BIN_NAMES get_disto gif2webp img2webp vwebp vwebp_sdl webpinfo webpmux webp_quality cwebp dwebp)
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/webp/")
foreach(tool ${BIN_NAMES})
if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/bin/${tool}${VCPKG_TARGET_EXECUTABLE_SUFFIX}")
file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/bin/${tool}${VCPKG_TARGET_EXECUTABLE_SUFFIX}")
endif()
if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/bin/${tool}${VCPKG_TARGET_EXECUTABLE_SUFFIX}")
file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/bin/${tool}${VCPKG_TARGET_EXECUTABLE_SUFFIX}")
endif()

if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/${tool}${VCPKG_TARGET_EXECUTABLE_SUFFIX}")
file(RENAME "${CURRENT_PACKAGES_DIR}/bin/${tool}${VCPKG_TARGET_EXECUTABLE_SUFFIX}" "${CURRENT_PACKAGES_DIR}/tools/webp/${tool}${VCPKG_TARGET_EXECUTABLE_SUFFIX}")
endif()
if(EXISTS "${CURRENT_PACKAGES_DIR}/bin/${tool}${VCPKG_TARGET_EXECUTABLE_SUFFIX}")
file(RENAME "${CURRENT_PACKAGES_DIR}/bin/${tool}${VCPKG_TARGET_EXECUTABLE_SUFFIX}" "${CURRENT_PACKAGES_DIR}/tools/webp/${tool}${VCPKG_TARGET_EXECUTABLE_SUFFIX}")
endif()
endforeach()
vcpkg_copy_tool_dependencies("${CURRENT_PACKAGES_DIR}/tools/webp")

Expand All @@ -89,8 +75,8 @@ if(RES_LEN EQUAL 0)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/tools/")
endif()

if(VCPKG_LIBRARY_LINKAGE STREQUAL static)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()

file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
Loading

0 comments on commit 99346bb

Please sign in to comment.