From ba1c3aa63e17e15b59e17d53cf8fde9a2a9080ac Mon Sep 17 00:00:00 2001 From: "Matthias C. M. Troffaes" Date: Tue, 29 Dec 2020 23:43:54 +0000 Subject: [PATCH] [libvpx] switch from yasm to nasm (#14545) * [libvpx] switch from yasm to nasm * [vcpkg] install nasm on azure for osx * Revert "[vcpkg] install nasm on azure for osx" This reverts commit f65ad1bdadb7b7b3a3b056186665f102b4f9aded. * [VMSS] Install nasm on OSX * [libvpx] bump port version * [libvpx] Add --as=nasm for non-MSVC triplets * [libvpx] Fix nasm debug format flag * Back out nasm change applied in https://github.com/microsoft/vcpkg/pull/15258 Co-authored-by: JackBoosY Co-authored-by: Long Nguyen Co-authored-by: Billy Robert O'Neal III --- ports/libvpx/0001-vcxproj-nasm.patch | 22 +++++++++++++++++++ .../0002-Fix-nasm-debug-format-flag.patch | 21 ++++++++++++++++++ ports/libvpx/CONTROL | 3 +-- ports/libvpx/portfile.cmake | 11 ++++++++-- 4 files changed, 53 insertions(+), 4 deletions(-) create mode 100644 ports/libvpx/0001-vcxproj-nasm.patch create mode 100644 ports/libvpx/0002-Fix-nasm-debug-format-flag.patch diff --git a/ports/libvpx/0001-vcxproj-nasm.patch b/ports/libvpx/0001-vcxproj-nasm.patch new file mode 100644 index 00000000000000..eb6333c81a0aea --- /dev/null +++ b/ports/libvpx/0001-vcxproj-nasm.patch @@ -0,0 +1,22 @@ +diff --git a/build/make/gen_msvs_vcxproj.sh b/build/make/gen_msvs_vcxproj.sh +index bb1c31d23..b634b0609 100755 +--- a/build/make/gen_msvs_vcxproj.sh ++++ b/build/make/gen_msvs_vcxproj.sh +@@ -247,13 +247,13 @@ libs=${libs// /;} + case "$target" in + x86_64*) + platforms[0]="x64" +- asm_Debug_cmdline="yasm -Xvc -g cv8 -f win64 ${yasmincs} "%(FullPath)"" +- asm_Release_cmdline="yasm -Xvc -f win64 ${yasmincs} "%(FullPath)"" ++ asm_Debug_cmdline="nasm -Xvc -gcv8 -f win64 ${yasmincs} "%(FullPath)"" ++ asm_Release_cmdline="nasm -Xvc -f win64 ${yasmincs} "%(FullPath)"" + ;; + x86*) + platforms[0]="Win32" +- asm_Debug_cmdline="yasm -Xvc -g cv8 -f win32 ${yasmincs} "%(FullPath)"" +- asm_Release_cmdline="yasm -Xvc -f win32 ${yasmincs} "%(FullPath)"" ++ asm_Debug_cmdline="nasm -Xvc -gcv8 -f win32 ${yasmincs} "%(FullPath)"" ++ asm_Release_cmdline="nasm -Xvc -f win32 ${yasmincs} "%(FullPath)"" + ;; + arm64*) + platforms[0]="ARM64" diff --git a/ports/libvpx/0002-Fix-nasm-debug-format-flag.patch b/ports/libvpx/0002-Fix-nasm-debug-format-flag.patch new file mode 100644 index 00000000000000..92f1bbac510bda --- /dev/null +++ b/ports/libvpx/0002-Fix-nasm-debug-format-flag.patch @@ -0,0 +1,21 @@ +diff --git a/build/make/configure.sh b/build/make/configure.sh +index 206b54f..49cd13e 100644 +--- a/build/make/configure.sh ++++ b/build/make/configure.sh +@@ -1361,12 +1361,14 @@ EOF + case ${tgt_os} in + win32) + add_asflags -f win32 +- enabled debug && add_asflags -g cv8 ++ enabled debug && [ "${AS}" = yasm ] && add_asflags -g cv8 ++ enabled debug && [ "${AS}" = nasm ] && add_asflags -gcv8 + EXE_SFX=.exe + ;; + win64) + add_asflags -f win64 +- enabled debug && add_asflags -g cv8 ++ enabled debug && [ "${AS}" = yasm ] && add_asflags -g cv8 ++ enabled debug && [ "${AS}" = nasm ] && add_asflags -gcv8 + EXE_SFX=.exe + ;; + linux*|solaris*|android*) diff --git a/ports/libvpx/CONTROL b/ports/libvpx/CONTROL index 1b171c91ad776b..484cd3bbeaa45d 100644 --- a/ports/libvpx/CONTROL +++ b/ports/libvpx/CONTROL @@ -1,7 +1,6 @@ Source: libvpx Version: 1.9.0 -Port-Version: 4 +Port-Version: 5 Homepage: https://github.com/webmproject/libvpx Description: The reference software implementation for the video coding formats VP8 and VP9. Supports: !(uwp&arm) -Build-Depends: yasm-tool-helper diff --git a/ports/libvpx/portfile.cmake b/ports/libvpx/portfile.cmake index fb6a161edbfbb4..706b68b946c977 100644 --- a/ports/libvpx/portfile.cmake +++ b/ports/libvpx/portfile.cmake @@ -8,6 +8,9 @@ vcpkg_from_github( REF v${LIBVPX_VERSION} SHA512 8d544552b35000ea5712aec220b78bb5f7dc210704b2f609365214cb95a4f5a0e343b362723d829cb4a9ac203b10d5443700ba84b28fd6b2fefbabb40663e298 HEAD_REF master + PATCHES + 0001-vcxproj-nasm.patch + 0002-Fix-nasm-debug-format-flag.patch ) vcpkg_find_acquire_program(PERL) @@ -23,8 +26,9 @@ else() set(ENV{PATH} "${MSYS_ROOT}/usr/bin:$ENV{PATH}:${PERL_EXE_PATH}") endif() -include(${CURRENT_INSTALLED_DIR}/share/yasm-tool-helper/yasm-tool-helper.cmake) -yasm_tool_helper(PREPEND_TO_PATH OUT_VAR ENV{AS}) +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) @@ -64,6 +68,7 @@ if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) --disable-examples --disable-tools --disable-docs + --as=nasm WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}" LOGNAME configure-${TARGET_TRIPLET}) @@ -164,6 +169,7 @@ else() --target=${LIBVPX_TARGET} ${OPTIONS} ${OPTIONS_RELEASE} + --as=nasm WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel" LOGNAME configure-${TARGET_TRIPLET}-rel) @@ -196,6 +202,7 @@ else() --target=${LIBVPX_TARGET} ${OPTIONS} ${OPTIONS_DEBUG} + --as=nasm WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg" LOGNAME configure-${TARGET_TRIPLET}-dbg)