Skip to content

Commit

Permalink
Add exiv2 port
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Oct 9, 2024
1 parent 74c5bf3 commit 7ff9580
Show file tree
Hide file tree
Showing 3 changed files with 187 additions and 0 deletions.
69 changes: 69 additions & 0 deletions vcpkg/ports/exiv2/dependencies.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
diff --git a/cmake/exiv2Config.cmake.in b/cmake/exiv2Config.cmake.in
index c9e2eba..ca170e1 100644
--- a/cmake/exiv2Config.cmake.in
+++ b/cmake/exiv2Config.cmake.in
@@ -8,7 +8,15 @@ if(@EXIV2_ENABLE_PNG@) # if(EXIV2_ENABLE_PNG)
endif()

if(@EXIV2_ENABLE_XMP@) # if(EXIV2_ENABLE_XMP)
- find_dependency(EXPAT REQUIRED)
+ find_dependency(EXPAT REQUIRED)
+endif()
+
+if(@EXIV2_ENABLE_BMFF@ AND @EXIV2_ENABLE_BROTLI@)
+ find_dependency(unofficial-brotli)
+endif()
+
+if(@EXIV2_ENABLE_INIH@)
+ find_dependency(unofficial-inih)
endif()

include("${CMAKE_CURRENT_LIST_DIR}/exiv2Export.cmake")
diff --git a/cmake/findDependencies.cmake b/cmake/findDependencies.cmake
index b0897c3..e559666 100644
--- a/cmake/findDependencies.cmake
+++ b/cmake/findDependencies.cmake
@@ -49,7 +49,8 @@ if( EXIV2_ENABLE_PNG )
endif( )

if( EXIV2_ENABLE_BMFF AND EXIV2_ENABLE_BROTLI )
- find_package( Brotli REQUIRED )
+ find_package(BROTLI NAMES unofficial-brotli REQUIRED)
+ set(Brotli_LIBRARIES unofficial::brotli::brotlidec)
endif( )

if( EXIV2_ENABLE_WEBREADY )
@@ -62,7 +63,9 @@ 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 REQUIRED)
+ add_library(EXPAT::EXPAT ALIAS expat::expat)
+ set(EXPAT_LIBRARIES expat::expat)
elseif (EXIV2_ENABLE_EXTERNAL_XMP)
find_package(XmpSdk REQUIRED)
endif ()
@@ -79,7 +82,9 @@ if( ICONV_FOUND )
endif()

if( EXIV2_ENABLE_INIH )
- find_package(inih)
+ find_package(unofficial-inih CONFIG REQUIRED)
+ add_library(inih::libinih ALIAS unofficial::inih::libinih)
+ add_library(inih::inireader ALIAS unofficial::inih::inireader)
message ( "-- inih_INCLUDE_DIRS : " ${inih_INCLUDE_DIRS} )
message ( "-- inih_LIBRARIES : " ${inih_LIBRARIES} )
message ( "-- inih_inireader_INCLUDE_DIRS : " ${inih_inireader_INCLUDE_DIRS} )
diff --git a/xmpsdk/CMakeLists.txt b/xmpsdk/CMakeLists.txt
index 87c59c0..d2f23e6 100644
--- a/xmpsdk/CMakeLists.txt
+++ b/xmpsdk/CMakeLists.txt
@@ -31,6 +31,7 @@ target_include_directories(exiv2-xmp SYSTEM
${PROJECT_SOURCE_DIR}/xmpsdk/include
${EXPAT_INCLUDE_DIRS}
)
+target_link_libraries(exiv2-xmp PRIVATE expat::expat)

# Prevent a denial-service-attack related to XML entity expansion
# ("billion laughs attack").
58 changes: 58 additions & 0 deletions vcpkg/ports/exiv2/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO Exiv2/exiv2
REF "v${VERSION}"
SHA512 c8338a118feefa104d73932890c732247c884ab9ce1d170c43a22ab5884517a0e2a7fd1febde7705b8290fbbbc29e64738610404816e4db2b56a70fc444ca049
HEAD_REF master
PATCHES
dependencies.diff
)

vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
xmp EXIV2_ENABLE_XMP
png EXIV2_ENABLE_PNG
nls EXIV2_ENABLE_NLS
bmff EXIV2_ENABLE_BMFF
)
if(VCPKG_TARGET_IS_UWP)
list(APPEND FEATURE_OPTIONS -DEXIV2_ENABLE_FILESYSTEM_ACCESS=OFF)
endif()

string(COMPARE EQUAL "${VCPKG_CRT_LINKAGE}" "dynamic" EXIV2_CRT_DYNAMIC)

vcpkg_add_to_path(PREPEND "${CURRENT_HOST_INSTALLED_DIR}/tools/gettext/bin")

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${FEATURE_OPTIONS}
-DEXIV2_BUILD_EXIV2_COMMAND=OFF
-DEXIV2_BUILD_UNIT_TESTS=OFF
-DEXIV2_BUILD_SAMPLES=OFF
-DEXIV2_BUILD_DOC=OFF
-DEXIV2_ENABLE_EXTERNAL_XMP=OFF
-DEXIV2_ENABLE_LENSDATA=ON
-DEXIV2_ENABLE_DYNAMIC_RUNTIME=${EXIV2_CRT_DYNAMIC}
-DEXIV2_ENABLE_WEBREADY=OFF
-DEXIV2_ENABLE_CURL=OFF
-DEXIV2_ENABLE_VIDEO=OFF
-DEXIV2_TEAM_EXTRA_WARNINGS=OFF
-DEXIV2_TEAM_WARNINGS_AS_ERRORS=OFF
-DEXIV2_TEAM_PACKAGING=OFF
-DEXIV2_TEAM_USE_SANITIZERS=OFF
-DCMAKE_DISABLE_FIND_PACKAGE_Python3=ON
)

vcpkg_cmake_install()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/exiv2)
vcpkg_fixup_pkgconfig()
vcpkg_copy_pdbs()

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

vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")
60 changes: 60 additions & 0 deletions vcpkg/ports/exiv2/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"name": "exiv2",
"version": "0.28.3",
"port-version": 1,
"description": "Image metadata library and tools",
"homepage": "https://exiv2.org",
"license": "GPL-2.0-or-later",
"supports": "!xbox",
"dependencies": [
"inih",
{
"name": "libiconv",
"platform": "!windows"
},
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"features": {
"bmff": {
"description": "Support for BMFF files (e.g., CR3, HEIF, HEIC, AVIF, and JPEG XL)",
"dependencies": [
"brotli"
]
},
"nls": {
"description": "Build native language support",
"dependencies": [
{
"name": "gettext",
"host": true,
"features": [
"tools"
]
},
"gettext-libintl"
]
},
"png": {
"description": "Build with png support",
"dependencies": [
"zlib"
]
},
"video": {
"description": "Deprecated. it will be removed in the future."
},
"xmp": {
"description": "Build with XMP metadata support",
"dependencies": [
"expat"
]
}
}
}

0 comments on commit 7ff9580

Please sign in to comment.