Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[libavif] Create a new port #18244

Merged
merged 10 commits into from
Jun 3, 2021
Merged
26 changes: 26 additions & 0 deletions ports/libavif/always-install-configs.patch
Original file line number Diff line number Diff line change
@@ -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

12 changes: 12 additions & 0 deletions ports/libavif/disable-source-utf8.patch
Original file line number Diff line number Diff line change
@@ -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")
13 changes: 13 additions & 0 deletions ports/libavif/fix-assigning-size_t.patch
Original file line number Diff line number Diff line change
@@ -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)

38 changes: 38 additions & 0 deletions ports/libavif/portfile.cmake
Original file line number Diff line number Diff line change
@@ -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)
19 changes: 19 additions & 0 deletions ports/libavif/vcpkg.json
Original file line number Diff line number Diff line change
@@ -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
}
]
}
4 changes: 4 additions & 0 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions versions/l-/libavif.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"versions": [
{
"git-tree": "b2592851defcaf39a20d88d4edb670188254bade",
"version-semver": "0.9.1",
"port-version": 0
}
]
}