aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Baryshev <dmitrymq@gmail.com>2021-06-03 22:56:33 +0300
committerGitHub <noreply@github.com>2021-06-03 12:56:33 -0700
commit9535ae5f7dad7a880369bb6725a1e755725bc147 (patch)
tree8bf114ae7d7bdc4cd7a9927f5293c5a18e7f71b1
parent5f32a49551c6101d294c7e73806999abab806570 (diff)
downloadvcpkg-9535ae5f7dad7a880369bb6725a1e755725bc147.tar.gz
vcpkg-9535ae5f7dad7a880369bb6725a1e755725bc147.zip
[libavif] Create a new port (#18244)
* [libavif] Added libavif * [libavif] vcpkg x-add-version --all * [libavif] Fixed compilation error * [libavif] vcpkg x-add-version --all --overwrite-version * [libavif] Install CMake configs in static mode as well * [libavif] vcpkg x-add-version --all --overwrite-version * [libavif] Fixed port name * [libavif] vcpkg x-add-version --all --overwrite-version * [libavif] Update the CMake-related patch * [libavif] vcpkg x-add-version --all --overwrite-version
-rw-r--r--ports/libavif/always-install-configs.patch26
-rw-r--r--ports/libavif/disable-source-utf8.patch12
-rw-r--r--ports/libavif/fix-assigning-size_t.patch13
-rw-r--r--ports/libavif/portfile.cmake38
-rw-r--r--ports/libavif/vcpkg.json19
-rw-r--r--versions/baseline.json4
-rw-r--r--versions/l-/libavif.json9
7 files changed, 121 insertions, 0 deletions
diff --git a/ports/libavif/always-install-configs.patch b/ports/libavif/always-install-configs.patch
new file mode 100644
index 000000000..982912421
--- /dev/null
+++ b/ports/libavif/always-install-configs.patch
@@ -0,0 +1,26 @@
+From 7d7fae33029d359423b26b60ea12174028ebcf3a Mon Sep 17 00:00:00 2001
+From: Dmitry Baryshev <dmitrymq@gmail.com>
+Date: Wed, 2 Jun 2021 21:01:59 +0300
+Subject: [PATCH] Enable CMake configs in VCPKG mode
+
+---
+ CMakeLists.txt | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index d773025..dd80d22 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -564,7 +564,8 @@ if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL)
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ )
+
+- if (BUILD_SHARED_LIBS)
++ # Enable CMake configs in VCPKG mode
++ if (BUILD_SHARED_LIBS OR VCPKG_TARGET_TRIPLET)
+ install(EXPORT ${PROJECT_NAME}-config
+ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME})
+
+--
+2.22.0.windows.1
+
diff --git a/ports/libavif/disable-source-utf8.patch b/ports/libavif/disable-source-utf8.patch
new file mode 100644
index 000000000..1e3d5d9bc
--- /dev/null
+++ b/ports/libavif/disable-source-utf8.patch
@@ -0,0 +1,12 @@
+diff -pruN v0.9.0-92388ab3ad.clean.o/CMakeLists.txt v0.9.0-92388ab3ad.clean/CMakeLists.txt
+--- a/CMakeLists.txt 2021-02-23 04:51:41.000000000 +0300
++++ b/CMakeLists.txt 2021-04-14 23:35:50.866487600 +0300
+@@ -165,7 +165,7 @@ elseif(CMAKE_C_COMPILER_ID MATCHES "MSVC
+ # A C4556 warning will be generated on violation.
+ # Commonly used /utf-8 flag assumes UTF-8 for both source and console, which is usually not the case.
+ # Warnings can be suppressed but there will still be random characters printed to the console.
+- /source-charset:utf-8 /execution-charset:us-ascii
++ #/source-charset:utf-8 /execution-charset:us-ascii
+ )
+ else()
+ MESSAGE(FATAL_ERROR "libavif: Unknown compiler, bailing out")
diff --git a/ports/libavif/fix-assigning-size_t.patch b/ports/libavif/fix-assigning-size_t.patch
new file mode 100644
index 000000000..b555decc8
--- /dev/null
+++ b/ports/libavif/fix-assigning-size_t.patch
@@ -0,0 +1,13 @@
+diff --git a/src/read.c b/src/read.c
+index bea0150..1132610 100644
+--- a/src/read.c
++++ b/src/read.c
+@@ -872,7 +872,7 @@ static avifResult avifDecoderItemRead(avifDecoderItem * item, avifIO * io, avifR
+ return AVIF_RESULT_BMFF_PARSE_FAILED;
+ }
+ offsetBuffer.data = idatBuffer->data + extent->offset;
+- offsetBuffer.size = idatBuffer->size - extent->offset;
++ offsetBuffer.size = (size_t)(idatBuffer->size - extent->offset);
+ } else {
+ // construction_method: file(0)
+
diff --git a/ports/libavif/portfile.cmake b/ports/libavif/portfile.cmake
new file mode 100644
index 000000000..6268cd723
--- /dev/null
+++ b/ports/libavif/portfile.cmake
@@ -0,0 +1,38 @@
+# AVIF depends on AOM, but AOM doesn't support ARM and UWP
+vcpkg_fail_port_install(ON_ARCH "arm" ON_TARGET "UWP")
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO AOMediaCodec/libavif
+ REF v0.9.1
+ SHA512 15fa857ee40aeae2ee077d244c6e11a34193f2348e922b5dfa8579a91fa6ceff05c7146e85f9222ebaa6ef2d76e876ea050e8056990cad80850fb4d9581de9a5
+ HEAD_REF master
+ PATCHES
+ disable-source-utf8.patch
+ fix-assigning-size_t.patch
+ always-install-configs.patch
+)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH ${SOURCE_PATH}
+ OPTIONS
+ -DAVIF_CODEC_AOM=ON
+ -DAVIF_BUILD_APPS=OFF
+)
+
+vcpkg_cmake_install()
+
+vcpkg_copy_pdbs()
+
+# Move cmake configs
+vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/${PORT})
+
+# Fix pkg-config files
+vcpkg_fixup_pkgconfig()
+
+# Remove duplicate files
+file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include
+ ${CURRENT_PACKAGES_DIR}/debug/share)
+
+# Handle copyright
+file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
diff --git a/ports/libavif/vcpkg.json b/ports/libavif/vcpkg.json
new file mode 100644
index 000000000..6703aad32
--- /dev/null
+++ b/ports/libavif/vcpkg.json
@@ -0,0 +1,19 @@
+{
+ "name": "libavif",
+ "version-semver": "0.9.1",
+ "description": "Library for encoding and decoding AVIF files",
+ "homepage": "https://github.com/AOMediaCodec/libavif",
+ "supports": "!uwp & !arm",
+ "dependencies": [
+ "aom",
+ "libyuv",
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ },
+ {
+ "name": "vcpkg-cmake-config",
+ "host": true
+ }
+ ]
+}
diff --git a/versions/baseline.json b/versions/baseline.json
index 7004eb245..57b9a8fd4 100644
--- a/versions/baseline.json
+++ b/versions/baseline.json
@@ -3000,6 +3000,10 @@
"baseline": "2.5.3",
"port-version": 1
},
+ "libavif": {
+ "baseline": "0.9.1",
+ "port-version": 0
+ },
"libb2": {
"baseline": "0.98.1",
"port-version": 5
diff --git a/versions/l-/libavif.json b/versions/l-/libavif.json
new file mode 100644
index 000000000..8673befd2
--- /dev/null
+++ b/versions/l-/libavif.json
@@ -0,0 +1,9 @@
+{
+ "versions": [
+ {
+ "git-tree": "b2592851defcaf39a20d88d4edb670188254bade",
+ "version-semver": "0.9.1",
+ "port-version": 0
+ }
+ ]
+}