Skip to content

Commit

Permalink
[exiv2] Update, cleanup (microsoft#29732)
Browse files Browse the repository at this point in the history
  • Loading branch information
dg0yt authored Feb 21, 2023
1 parent baf8db0 commit bf4822b
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 84 deletions.
58 changes: 5 additions & 53 deletions ports/exiv2/fix-find_expat.patch
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,15 @@ diff --git a/cmake/findDependencies.cmake b/cmake/findDependencies.cmake
index ec3a43f..d8637cc 100644
--- a/cmake/findDependencies.cmake
+++ b/cmake/findDependencies.cmake
@@ -42,7 +42,8 @@ if (EXIV2_ENABLE_XMP AND EXIV2_ENABLE_EXTERNAL_XMP)
@@ -42,7 +42,10 @@ if (EXIV2_ENABLE_XMP AND EXIV2_ENABLE_EXTERNAL_XMP)
message(FATAL_ERROR "EXIV2_ENABLE_XMP AND EXIV2_ENABLE_EXTERNAL_XMP are mutually exclusive. You can only choose one of them")
else()
if (EXIV2_ENABLE_XMP)
- find_package(EXPAT REQUIRED)
+ find_package(expat CONFIG REQUIRED)
+ set(EXPAT_FOUND 1)
+ find_package(EXPAT NAMES expat CONFIG REQUIRED)
+ set(EXPAT_INCLUDE_DIR "")
+ set(EXPAT_LIBRARY expat::expat)
+ set(EXPAT_LIBRARIES expat::expat)
elseif (EXIV2_ENABLE_EXTERNAL_XMP)
find_package(XmpSdk REQUIRED)
endif ()
diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt
index de8aa1d..524724c 100644
--- a/samples/CMakeLists.txt
+++ b/samples/CMakeLists.txt
@@ -77,11 +77,10 @@ if( EXPAT_FOUND )
target_link_libraries(geotag
PRIVATE
exiv2-xmp
- ${EXPAT_LIBRARIES}
+ expat::expat
)
target_include_directories(geotag PRIVATE ${CMAKE_BINARY_DIR}) # exv_conf.h
target_include_directories(geotag PRIVATE ${CMAKE_SOURCE_DIR}/include) # <exiv2/exiv2.hpp>
- target_include_directories(geotag PRIVATE ${EXPAT_INCLUDE_DIR})
target_include_directories(geotag PRIVATE ${CMAKE_SOURCE_DIR}/src) # To find unused.h

if (WIN32)
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 26e5a95..5dc722c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -154,8 +154,7 @@ target_include_directories(exiv2lib SYSTEM PRIVATE
)

if (EXIV2_ENABLE_XMP OR EXIV2_ENABLE_EXTERNAL_XMP)
- target_include_directories(exiv2lib PRIVATE ${EXPAT_INCLUDE_DIR})
- target_link_libraries(exiv2lib PRIVATE ${EXPAT_LIBRARIES})
+ target_link_libraries(exiv2lib PRIVATE expat::expat)

if (WIN32)
target_compile_definitions(exiv2lib PRIVATE XML_STATIC)
diff --git a/xmpsdk/CMakeLists.txt b/xmpsdk/CMakeLists.txt
index a22698f..55102ce 100644
--- a/xmpsdk/CMakeLists.txt
+++ b/xmpsdk/CMakeLists.txt
@@ -28,13 +28,12 @@ add_library(exiv2-xmp STATIC

target_link_libraries(exiv2-xmp
PRIVATE
- $<BUILD_INTERFACE:${EXPAT_LIBRARY}>
+ $<BUILD_INTERFACE:expat::expat>
)

target_include_directories(exiv2-xmp
PRIVATE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/xmpsdk/include>
- ${EXPAT_INCLUDE_DIR}
)

# Prevent a denial-service-attack related to XML entity expansion
26 changes: 10 additions & 16 deletions ports/exiv2/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Exiv2/exiv2
REF ad5484cb1eaba3ad0e49b290d244f6b1ee9ff076 #v0.27.5
SHA512 33b8c60990b05f1599860974d6fe44baba8369356acd2cab3ce4919a48bb44348ed0496ffc4581d9fd5eb8a1b36d48a0eaa3fafe4584bfd655d0a88e7a9458ef
REF "v${VERSION}"
SHA512 7d7121770a9394efd31acb74709583e587351fc48c485a2f684cacce4ed19a2d07a6cb1cea986c16bf64851fd53b22a7277c1e1ae1a6cd69a5761afae3c5c731
HEAD_REF master
PATCHES
fix-find_expat.patch
Expand Down Expand Up @@ -47,11 +47,6 @@ vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/exiv2)
vcpkg_fixup_pkgconfig()

if("nls" IN_LIST FEATURES)
set(EXIV2_ENABLE_NLS ON)
else()
set(EXIV2_ENABLE_NLS OFF)
endif()
configure_file(
${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake
${CURRENT_PACKAGES_DIR}/share/${PORT}
Expand All @@ -60,13 +55,12 @@ configure_file(

vcpkg_copy_pdbs()

# Clean
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include" "${CURRENT_PACKAGES_DIR}/debug/share")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/lib/exiv2" "${CURRENT_PACKAGES_DIR}/lib/exiv2")

if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/lib/exiv2"
"${CURRENT_PACKAGES_DIR}/debug/share"
"${CURRENT_PACKAGES_DIR}/lib/exiv2"
"${CURRENT_PACKAGES_DIR}/share/man"
)

# Handle copyright
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")
12 changes: 5 additions & 7 deletions ports/exiv2/vcpkg-cmake-wrapper.cmake
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
_find_package(${ARGS})

if("@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static")
if(NOT @VCPKG_TARGET_IS_WINDOWS@)
if(NOT "@VCPKG_TARGET_IS_WINDOWS@")
find_package(Iconv REQUIRED)
endif()
if(@EXIV2_ENABLE_NLS@)
if("@EXIV2_ENABLE_NLS@")
find_package(Intl REQUIRED)
endif()
if(TARGET exiv2lib)
if(NOT @VCPKG_TARGET_IS_WINDOWS@)
set_property(TARGET exiv2lib APPEND PROPERTY INTERFACE_LINK_LIBRARIES
Iconv::Iconv
)
if(NOT "@VCPKG_TARGET_IS_WINDOWS@")
set_property(TARGET exiv2lib APPEND PROPERTY INTERFACE_LINK_LIBRARIES Iconv::Iconv)
endif()
if(@EXIV2_ENABLE_NLS@)
if("@EXIV2_ENABLE_NLS@")
set_property(TARGET exiv2lib APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${Intl_LIBRARIES})
endif()
endif()
Expand Down
12 changes: 6 additions & 6 deletions ports/exiv2/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"name": "exiv2",
"version": "0.27.5",
"port-version": 3,
"version": "0.27.6",
"description": "Image metadata library and tools",
"homepage": "https://www.exiv2.org",
"license": "GPL-2.0",
"homepage": "https://exiv2.org",
"license": "GPL-2.0-or-later",
"supports": "!uwp",
"dependencies": [
{
Expand All @@ -24,6 +23,7 @@
"nls": {
"description": "Build native language support",
"dependencies": [
"gettext",
{
"name": "gettext",
"host": true,
Expand All @@ -34,14 +34,14 @@
]
},
"png": {
"description": "Build with png support (requires libz)",
"description": "Build with png support",
"dependencies": [
"libpng",
"zlib"
]
},
"unicode": {
"description": "Compile with unicode support on windows",
"description": "Compile with Unicode support on Windows",
"supports": "windows"
},
"video": {
Expand Down
4 changes: 2 additions & 2 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -2293,8 +2293,8 @@
"port-version": 7
},
"exiv2": {
"baseline": "0.27.5",
"port-version": 3
"baseline": "0.27.6",
"port-version": 0
},
"expat": {
"baseline": "2.5.0",
Expand Down
5 changes: 5 additions & 0 deletions versions/e-/exiv2.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "19442ed87a9f3827ddb22debf6b446e4cdca2d4f",
"version": "0.27.6",
"port-version": 0
},
{
"git-tree": "13c2dda832a1eaa7093a44089a029adbd32f487e",
"version": "0.27.5",
Expand Down

0 comments on commit bf4822b

Please sign in to comment.