Skip to content

Commit

Permalink
[libvpx] Bump to 1.13.1
Browse files Browse the repository at this point in the history
Based on #34814 by @LilyWangLL
but tailored for RustDesk to build on arm64-ios, arm*-linux etc.

Signed-off-by: Vasyl Gello <[email protected]>
  • Loading branch information
basilgello committed Nov 13, 2023
1 parent d8079ec commit 0237c04
Show file tree
Hide file tree
Showing 7 changed files with 128 additions and 57 deletions.
27 changes: 10 additions & 17 deletions ports/libvpx/0003-add-uwp-v142-and-v143-support.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/build/make/configure.sh b/build/make/configure.sh
index 119d206..41bac75 100644
index 110f16e..c161d0e 100644
--- a/build/make/configure.sh
+++ b/build/make/configure.sh
@@ -1038,7 +1038,7 @@ EOF
Expand Down Expand Up @@ -85,21 +85,19 @@ index 58bb66b..b4cad6c 100644
fi
fi
diff --git a/configure b/configure
index beea650..91ae3c8 100644
index ae289f7..78f5fc1 100644
--- a/configure
+++ b/configure
@@ -102,16 +102,24 @@ all_platforms="${all_platforms} arm64-darwin-gcc"
all_platforms="${all_platforms} arm64-darwin20-gcc"
@@ -103,6 +103,8 @@ all_platforms="${all_platforms} arm64-darwin20-gcc"
all_platforms="${all_platforms} arm64-darwin21-gcc"
all_platforms="${all_platforms} arm64-darwin22-gcc"
all_platforms="${all_platforms} arm64-linux-gcc"
+all_platforms="${all_platforms} arm64-uwp-vs16"
+all_platforms="${all_platforms} arm64-uwp-vs17"
all_platforms="${all_platforms} arm64-win64-gcc"
all_platforms="${all_platforms} arm64-win64-vs15"
+all_platforms="${all_platforms} arm64-win64-vs16"
+all_platforms="${all_platforms} arm64-win64-vs17"
all_platforms="${all_platforms} armv7-android-gcc" #neon Cortex-A8
all_platforms="${all_platforms} armv7-darwin-gcc" #neon Cortex-A8
all_platforms="${all_platforms} arm64-win64-vs16"
@@ -112,6 +114,8 @@ all_platforms="${all_platforms} armv7-darwin-gcc" #neon Cortex-A8
all_platforms="${all_platforms} armv7-linux-rvct" #neon Cortex-A8
all_platforms="${all_platforms} armv7-linux-gcc" #neon Cortex-A8
all_platforms="${all_platforms} armv7-none-rvct" #neon Cortex-A8
Expand All @@ -108,12 +106,7 @@ index beea650..91ae3c8 100644
all_platforms="${all_platforms} armv7-win32-gcc"
all_platforms="${all_platforms} armv7-win32-vs14"
all_platforms="${all_platforms} armv7-win32-vs15"
+all_platforms="${all_platforms} armv7-win32-vs16"
+all_platforms="${all_platforms} armv7-win32-vs17"
all_platforms="${all_platforms} armv7s-darwin-gcc"
all_platforms="${all_platforms} armv8-linux-gcc"
all_platforms="${all_platforms} loongarch32-linux-gcc"
@@ -138,6 +146,8 @@ all_platforms="${all_platforms} x86-linux-gcc"
@@ -143,6 +147,8 @@ all_platforms="${all_platforms} x86-linux-gcc"
all_platforms="${all_platforms} x86-linux-icc"
all_platforms="${all_platforms} x86-os2-gcc"
all_platforms="${all_platforms} x86-solaris-gcc"
Expand All @@ -122,7 +115,7 @@ index beea650..91ae3c8 100644
all_platforms="${all_platforms} x86-win32-gcc"
all_platforms="${all_platforms} x86-win32-vs14"
all_platforms="${all_platforms} x86-win32-vs15"
@@ -161,6 +171,8 @@ all_platforms="${all_platforms} x86_64-iphonesimulator-gcc"
@@ -167,6 +173,8 @@ all_platforms="${all_platforms} x86_64-iphonesimulator-gcc"
all_platforms="${all_platforms} x86_64-linux-gcc"
all_platforms="${all_platforms} x86_64-linux-icc"
all_platforms="${all_platforms} x86_64-solaris-gcc"
Expand All @@ -131,7 +124,7 @@ index beea650..91ae3c8 100644
all_platforms="${all_platforms} x86_64-win64-gcc"
all_platforms="${all_platforms} x86_64-win64-vs14"
all_platforms="${all_platforms} x86_64-win64-vs15"
@@ -485,11 +497,10 @@ process_targets() {
@@ -491,11 +499,10 @@ process_targets() {
! enabled multithread && DIST_DIR="${DIST_DIR}-nomt"
! enabled install_docs && DIST_DIR="${DIST_DIR}-nodocs"
DIST_DIR="${DIST_DIR}-${tgt_isa}-${tgt_os}"
Expand All @@ -147,7 +140,7 @@ index beea650..91ae3c8 100644
if [ -f "${source_path}/build/make/version.sh" ]; then
ver=`"$source_path/build/make/version.sh" --bare "$source_path"`
DIST_DIR="${DIST_DIR}-${ver}"
@@ -578,6 +589,10 @@ process_detect() {
@@ -584,6 +591,10 @@ process_detect() {

# Specialize windows and POSIX environments.
case $toolchain in
Expand Down
13 changes: 13 additions & 0 deletions ports/libvpx/0005-fix-arm64-build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/vp9/encoder/arm/neon/vp9_diamond_search_sad_neon.c b/vp9/encoder/arm/neon/vp9_diamond_search_sad_neon.c
index 33753f7..997775a 100644
--- a/vp9/encoder/arm/neon/vp9_diamond_search_sad_neon.c
+++ b/vp9/encoder/arm/neon/vp9_diamond_search_sad_neon.c
@@ -220,7 +220,7 @@ int vp9_diamond_search_sad_neon(const MACROBLOCK *x,
// Look up the component cost of the residual motion vector
{
uint32_t cost[4];
- int16_t __attribute__((aligned(16))) rowcol[8];
+ DECLARE_ALIGNED(16, int16_t, rowcol[8]);
vst1q_s16(rowcol, v_diff_mv_w);

// Note: This is a use case for gather instruction
96 changes: 73 additions & 23 deletions ports/libvpx/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)

set(LIBVPX_VERSION 1.12.0)

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO webmproject/libvpx
REF v${LIBVPX_VERSION}
SHA512 dc059bc3102b75524ae29989372334b3e0f2acf1520e5a4daa4073831bb55949d82897c498fb9d2d38b59f1a66bb0ad24407d0d086b1e3a8394a4933f04f2ed0
REF "v${VERSION}"
SHA512 49706838563c92fab7334376848d0f374efcbc1729ef511e967c908fd2ecd40e8d197f1d85da6553b3a7026bdbc17e5a76595319858af26ce58cb9a4c3854897
HEAD_REF master
PATCHES
0002-Fix-nasm-debug-format-flag.patch
0003-add-uwp-v142-and-v143-support.patch
0004-remove-library-suffixes.patch
0005-fix-arm64-build.patch # Upstream commit: https://github.com/webmproject/libvpx/commit/858a8c611f4c965078485860a6820e2135e6611b
)

vcpkg_find_acquire_program(PERL)
Expand All @@ -27,11 +26,10 @@ else()
set(ENV{PATH} "${MSYS_ROOT}/usr/bin:$ENV{PATH}:${PERL_EXE_PATH}")
endif()

vcpkg_find_acquire_program(NASM)
get_filename_component(NASM_EXE_PATH ${NASM} DIRECTORY)
vcpkg_add_to_path(${NASM_EXE_PATH})

if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
vcpkg_find_acquire_program(NASM)
get_filename_component(NASM_EXE_PATH ${NASM} DIRECTORY)
vcpkg_add_to_path(${NASM_EXE_PATH})

file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-tmp")

Expand Down Expand Up @@ -108,11 +106,11 @@ if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
)

if (VCPKG_TARGET_ARCHITECTURE STREQUAL arm64)
set(LIBVPX_INCLUDE_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/vpx-vp8-vp9-nopost-nodocs-${LIBVPX_TARGET_ARCH}${LIBVPX_CRT_SUFFIX}-${LIBVPX_TARGET_VS}-v${LIBVPX_VERSION}/include/vpx")
set(LIBVPX_INCLUDE_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/vpx-vp8-vp9-nopost-nodocs-${LIBVPX_TARGET_ARCH}${LIBVPX_CRT_SUFFIX}-${LIBVPX_TARGET_VS}-v${VERSION}/include/vpx")
elseif (VCPKG_TARGET_ARCHITECTURE STREQUAL arm)
set(LIBVPX_INCLUDE_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/vpx-vp8-vp9-nopost-nomt-nodocs-${LIBVPX_TARGET_ARCH}${LIBVPX_CRT_SUFFIX}-${LIBVPX_TARGET_VS}-v${LIBVPX_VERSION}/include/vpx")
set(LIBVPX_INCLUDE_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/vpx-vp8-vp9-nopost-nomt-nodocs-${LIBVPX_TARGET_ARCH}${LIBVPX_CRT_SUFFIX}-${LIBVPX_TARGET_VS}-v${VERSION}/include/vpx")
else()
set(LIBVPX_INCLUDE_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/vpx-vp8-vp9-nodocs-${LIBVPX_TARGET_ARCH}${LIBVPX_CRT_SUFFIX}-${LIBVPX_TARGET_VS}-v${LIBVPX_VERSION}/include/vpx")
set(LIBVPX_INCLUDE_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/vpx-vp8-vp9-nodocs-${LIBVPX_TARGET_ARCH}${LIBVPX_CRT_SUFFIX}-${LIBVPX_TARGET_VS}-v${VERSION}/include/vpx")
endif()
file(
INSTALL
Expand All @@ -132,6 +130,7 @@ if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
endif()

else()
yasm_tool_helper(APPEND_TO_PATH)

set(OPTIONS "--disable-examples --disable-tools --disable-docs --disable-unit-tests --enable-pic")

Expand All @@ -156,20 +155,65 @@ else()
set(LIBVPX_TARGET_ARCH "x86")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL x64)
set(LIBVPX_TARGET_ARCH "x86_64")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL arm)
set(LIBVPX_TARGET_ARCH "armv7")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL arm64)
set(LIBVPX_TARGET_ARCH "arm64")
else()
message(FATAL_ERROR "libvpx does not support architecture ${VCPKG_TARGET_ARCHITECTURE}")
endif()

if(VCPKG_TARGET_IS_MINGW)
if(LIBVPX_TARGET_ARCH STREQUAL "x86")
set(LIBVPX_TARGET "x86-win32-gcc")
else()
set(LIBVPX_TARGET "x86_64-win64-gcc")
endif()
elseif(VCPKG_TARGET_IS_LINUX)
vcpkg_cmake_get_vars(cmake_vars_file)
include("${cmake_vars_file}")

# Set environment variables for configure
if(VCPKG_DETECTED_CMAKE_C_COMPILER MATCHES "([^\/]*-)gcc$")
message(STATUS "Cross-building for ${VCPKG_TARGET_TRIPLET} with ${CMAKE_MATCH_1}")
set(ENV{CROSS} ${CMAKE_MATCH_1})
else()
set(ENV{CC} ${VCPKG_DETECTED_CMAKE_C_COMPILER})
set(ENV{CXX} ${VCPKG_DETECTED_CMAKE_CXX_COMPILER})
set(ENV{AR} ${VCPKG_DETECTED_CMAKE_AR})
set(ENV{LD} ${VCPKG_DETECTED_CMAKE_LINKER})
set(ENV{RANLIB} ${VCPKG_DETECTED_CMAKE_RANLIB})
set(ENV{STRIP} ${VCPKG_DETECTED_CMAKE_STRIP})
endif()

if(VCPKG_TARGET_IS_MINGW)
if(LIBVPX_TARGET_ARCH STREQUAL "x86")
set(LIBVPX_TARGET "x86-win32-gcc")
else()
set(LIBVPX_TARGET "x86_64-win64-gcc")
endif()
elseif(VCPKG_TARGET_IS_LINUX)
set(LIBVPX_TARGET "${LIBVPX_TARGET_ARCH}-linux-gcc")
unset(ENV{CC})
unset(ENV{CXX})
unset(ENV{AR})
unset(ENV{LD})
unset(ENV{RANLIB})
unset(ENV{STRIP})
elseif(VCPKG_TARGET_IS_ANDROID)
set(LIBVPX_TARGET "generic-gnu")
# Settings
if(VCPKG_TARGET_ARCHITECTURE STREQUAL x86)
set(ANDROID_TARGET_TRIPLET i686-linux-android)
set(OPTIONS "${OPTIONS} --disable-sse4_1 --disable-avx --disable-avx2 --disable-avx512")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL x64)
set(ANDROID_TARGET_TRIPLET x86_64-linux-android)
set(OPTIONS "${OPTIONS} --disable-avx --disable-avx2 --disable-avx512")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL arm)
set(ANDROID_TARGET_TRIPLET armv7a-linux-androideabi)
set(OPTIONS "${OPTIONS} --enable-thumb --disable-neon")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL arm64)
set(ANDROID_TARGET_TRIPLET aarch64-linux-android)
set(OPTIONS "${OPTIONS} --enable-thumb")
endif()
# Set environment variables for configure
set(ENV{AS} ${VCPKG_DETECTED_CMAKE_C_COMPILER})
set(ENV{LDFLAGS} "${LDFLAGS} --target=${VCPKG_DETECTED_CMAKE_C_COMPILER_TARGET}")
# Set clang target
set(OPTIONS "${OPTIONS} --extra-cflags=--target=${VCPKG_DETECTED_CMAKE_C_COMPILER_TARGET} --extra-cxxflags=--target=${VCPKG_DETECTED_CMAKE_CXX_COMPILER_TARGET}")
elseif(VCPKG_TARGET_IS_OSX)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
set(LIBVPX_TARGET "arm64-darwin20-gcc")
Expand All @@ -179,6 +223,14 @@ else()
else()
set(LIBVPX_TARGET "${LIBVPX_TARGET_ARCH}-darwin17-gcc") # enable latest CPU instructions for best performance and less CPU usage on MacOS
endif()
elseif(VCPKG_TARGET_IS_IOS)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL arm)
set(LIBVPX_TARGET "armv7-darwin-gcc")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL arm64)
set(LIBVPX_TARGET "arm64-darwin-gcc")
else()
message(FATAL_ERROR "libvpx does not support architecture ${VCPKG_TARGET_ARCHITECTURE} on iOS")
endif()
else()
set(LIBVPX_TARGET "generic-gnu") # use default target
endif()
Expand All @@ -196,14 +248,13 @@ else()
${OPTIONS}
${OPTIONS_RELEASE}
${MAC_OSX_MIN_VERSION_CFLAGS}
--as=nasm
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel"
LOGNAME configure-${TARGET_TRIPLET}-rel)

message(STATUS "Building libvpx for Release")
vcpkg_execute_required_process(
COMMAND
${BASH} --noprofile --norc -c "make -j8"
${BASH} --noprofile --norc -c "make -j${VCPKG_CONCURRENCY}"
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel"
LOGNAME build-${TARGET_TRIPLET}-rel
)
Expand All @@ -230,14 +281,13 @@ else()
${OPTIONS}
${OPTIONS_DEBUG}
${MAC_OSX_MIN_VERSION_CFLAGS}
--as=nasm
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg"
LOGNAME configure-${TARGET_TRIPLET}-dbg)

message(STATUS "Building libvpx for Debug")
vcpkg_execute_required_process(
COMMAND
${BASH} --noprofile --norc -c "make -j8"
${BASH} --noprofile --norc -c "make -j${VCPKG_CONCURRENCY}"
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg"
LOGNAME build-${TARGET_TRIPLET}-dbg
)
Expand Down Expand Up @@ -265,4 +315,4 @@ endif()

configure_file("${CMAKE_CURRENT_LIST_DIR}/unofficial-libvpx-config.cmake.in" "${CURRENT_PACKAGES_DIR}/share/unofficial-libvpx/unofficial-libvpx-config.cmake" @ONLY)

file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
15 changes: 13 additions & 2 deletions ports/libvpx/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
{
"name": "libvpx",
"version": "1.12.0",
"port-version": 2,
"version": "1.13.1",
"description": "The reference software implementation for the video coding formats VP8 and VP9.",
"homepage": "https://github.com/webmproject/libvpx",
"license": "BSD-3-Clause",
"dependencies": [
{
"name": "vcpkg-cmake-get-vars",
"host": true
},
{
"name": "vcpkg-msbuild",
"host": true,
"platform": "windows"
},
{
"name": "yasm",
"host": true,
"features": [
"tools"
],
"platform": "!(windows & !mingw)"
}
],
"features": {
Expand Down
25 changes: 12 additions & 13 deletions ports/libvpx/vpx.pc.in
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
prefix=@LIBVPX_PREFIX@
# pkg-config file from libvpx v1.10.0
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include

Name: vpx
Description: WebM Project VPx codec implementation
Version: @LIBVPX_VERSION@
Requires:
Conflicts:
Libs: -L"${libdir}" -lvpx
Cflags: -I"${includedir}"
prefix=@LIBVPX_PREFIX@
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include

Name: vpx
Description: WebM Project VPx codec implementation
Version: @VERSION@
Requires:
Conflicts:
Libs: -L"${libdir}" -lvpx
Cflags: -I"${includedir}"
4 changes: 2 additions & 2 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -4953,8 +4953,8 @@
"port-version": 2
},
"libvpx": {
"baseline": "1.12.0",
"port-version": 2
"baseline": "1.13.1",
"port-version": 0
},
"libwandio": {
"baseline": "4.2.1",
Expand Down
5 changes: 5 additions & 0 deletions versions/l-/libvpx.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [

Check failure on line 2 in versions/l-/libvpx.json

View check run for this annotation

Azure Pipelines / microsoft.vcpkg.pr (x86_windows)

versions/l-/libvpx.json#L2

versions/l-/libvpx.json(2,): error : while parsing versions for libvpx from version/l-/libvpx.json
{
"git-tree": "2f89cd64211c3c0105c1b377259978cd330430ec",
"version": "1.13.1",
"port-version": 0
},
{
"git-tree": "255c8c5ca6526bd7a0ac6f3a6a7838c77ee97e5e",
"version": "1.12.0",
Expand Down

0 comments on commit 0237c04

Please sign in to comment.