From d1e8683f11a9e0937e490794205b40e5b74c4d1c Mon Sep 17 00:00:00 2001 From: Byoungchan Lee Date: Thu, 26 Sep 2024 04:33:28 +0900 Subject: [PATCH] [libvmaf] New port (#41152) --- ports/libvmaf/android-off_t.patch | 16 ++++++++++++++++ ports/libvmaf/no-tools.patch | 10 ++++++++++ ports/libvmaf/portfile.cmake | 27 +++++++++++++++++++++++++++ ports/libvmaf/vcpkg.json | 14 ++++++++++++++ versions/baseline.json | 4 ++++ versions/l-/libvmaf.json | 9 +++++++++ 6 files changed, 80 insertions(+) create mode 100644 ports/libvmaf/android-off_t.patch create mode 100644 ports/libvmaf/no-tools.patch create mode 100644 ports/libvmaf/portfile.cmake create mode 100644 ports/libvmaf/vcpkg.json create mode 100644 versions/l-/libvmaf.json diff --git a/ports/libvmaf/android-off_t.patch b/ports/libvmaf/android-off_t.patch new file mode 100644 index 0000000000..4b70e7714c --- /dev/null +++ b/ports/libvmaf/android-off_t.patch @@ -0,0 +1,16 @@ +--- a/libvmaf/src/meson.build ++++ b/libvmaf/src/meson.build +@@ -13,6 +13,13 @@ if cc.get_id() != 'msvc' + '-pedantic', + '-DOC_NEW_STYLE_INCLUDES', + ] ++ # If the target is Android, define _LIBCPP_HAS_NO_OFF_T_FUNCTIONS unconditionally ++ # to work around the fact that meson always defines _FILE_OFFSET_BITS=64, which ++ # causes issues for API levels below 24 in 32-bit architectures. ++ # See https://github.com/mesonbuild/meson/issues/3049 for more details. ++ if target_machine.system() == 'android' ++ vmaf_cflags_common += '-D_LIBCPP_HAS_NO_OFF_T_FUNCTIONS' ++ endif + else + vmaf_cflags_common = [ + '-wd4028', # parameter different from declaration diff --git a/ports/libvmaf/no-tools.patch b/ports/libvmaf/no-tools.patch new file mode 100644 index 0000000000..d93d37cafe --- /dev/null +++ b/ports/libvmaf/no-tools.patch @@ -0,0 +1,10 @@ +Skip tools subdir in libvmaf to build only the library. +--- a/libvmaf/meson.build ++++ b/libvmaf/meson.build +@@ -51,6 +51,5 @@ endif + + subdir('include') + subdir('src') +-subdir('tools') + subdir('doc') + subdir('test') diff --git a/ports/libvmaf/portfile.cmake b/ports/libvmaf/portfile.cmake new file mode 100644 index 0000000000..1d4df5ef6a --- /dev/null +++ b/ports/libvmaf/portfile.cmake @@ -0,0 +1,27 @@ +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO Netflix/vmaf + REF "v${VERSION}" + SHA512 9e356bb274ce7d5d85a64d2a1a122ea9d267809edd83bb6e663fb348a1a46355882eb9044982bf679f03df7f93c6f66c9b0d9a94661979b2c722db30b21c4f32 + HEAD_REF master + PATCHES + no-tools.patch + android-off_t.patch +) + +vcpkg_find_acquire_program(NASM) +get_filename_component(NASM_PATH "${NASM}" DIRECTORY) +vcpkg_add_to_path("${NASM_PATH}") + +vcpkg_configure_meson( + SOURCE_PATH "${SOURCE_PATH}/libvmaf" + OPTIONS + -Denable_tests=false + -Denable_docs=false +) + +vcpkg_install_meson() +vcpkg_copy_pdbs() +vcpkg_fixup_pkgconfig() + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/ports/libvmaf/vcpkg.json b/ports/libvmaf/vcpkg.json new file mode 100644 index 0000000000..6908982de1 --- /dev/null +++ b/ports/libvmaf/vcpkg.json @@ -0,0 +1,14 @@ +{ + "name": "libvmaf", + "version": "3.0.0", + "description": "libvmaf is a library developed by Netflix to compute the VMAF (Video Multi-Method Assessment Fusion) metric.", + "homepage": "https://github.com/Netflix/vmaf", + "license": "BSD-2-Clause-Patent", + "supports": "!windows", + "dependencies": [ + { + "name": "vcpkg-tool-meson", + "host": true + } + ] +} diff --git a/versions/baseline.json b/versions/baseline.json index f64541098e..d0a0dfc116 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -5264,6 +5264,10 @@ "baseline": "20231127", "port-version": 0 }, + "libvmaf": { + "baseline": "3.0.0", + "port-version": 0 + }, "libvmdk": { "baseline": "20221124", "port-version": 1 diff --git a/versions/l-/libvmaf.json b/versions/l-/libvmaf.json new file mode 100644 index 0000000000..92fdcfe39f --- /dev/null +++ b/versions/l-/libvmaf.json @@ -0,0 +1,9 @@ +{ + "versions": [ + { + "git-tree": "01baad74661c761572624fd0eed900ee6fc7b2eb", + "version": "3.0.0", + "port-version": 0 + } + ] +}