のねのBlog

パソコンの問題や、ソフトウェアの開発で起きた問題など書いていきます。よろしくお願いします^^。

vcpkg diff patch失敗と修正

PS C:\MyGitHub\vcpkg> .\vcpkg remove harfbuzz
The following packages will be removed:
    harfbuzz:x86-windows
Removing package harfbuzz:x86-windows...
Removing package harfbuzz:x86-windows... done
Purging package harfbuzz:x86-windows...
Some files in C:\MyGitHub\vcpkg\packages\harfbuzz_x86-windows were unable to be removed. Close any editors operating in this directory and retry.
Purging package harfbuzz:x86-windows... done

もう一度

PS C:\MyGitHub\vcpkg> .\vcpkg remove harfbuzz
The following packages are not installed, so not removed:
    harfbuzz:x86-windows
Package harfbuzz:x86-windows is not installed
Purging package harfbuzz:x86-windows...
Purging package harfbuzz:x86-windows... done
PS C:\MyGitHub\vcpkg> .\vcpkg.exe install harfbuzz
The following packages will be built and installed:
    harfbuzz:x86-windows
Starting package 1/1: harfbuzz:x86-windows
Building package harfbuzz:x86-windows...
-- CURRENT_INSTALLED_DIR=C:/MyGitHub/vcpkg/installed/x86-windows
-- DOWNLOADS=C:/MyGitHub/vcpkg/downloads
-- CURRENT_PACKAGES_DIR=C:/MyGitHub/vcpkg/packages/harfbuzz_x86-windows
-- CURRENT_BUILDTREES_DIR=C:/MyGitHub/vcpkg/buildtrees/harfbuzz
-- CURRENT_PORT_DIR=C:/MyGitHub/vcpkg/ports/harfbuzz/.
-- Using cached C:/MyGitHub/vcpkg/downloads/harfbuzz-1.5.1.tar.bz2
-- Testing integrity of cached file...
-- Testing integrity of cached file... OK
-- Extracting done
-- Applying patch C:/MyGitHub/vcpkg/ports/harfbuzz/0001-fix-uwp-build.patch
-- Applying patch failed. This is expected if this patch was previously applied. <~~~~~~~~~~~~~~~~~~~~~~~
-- Applying patch C:/MyGitHub/vcpkg/ports/harfbuzz/0001-fix-uwp-build.patch done
-- Configuring x86-windows-rel
-- Configuring x86-windows-rel done
-- Configuring x86-windows-dbg
-- Configuring x86-windows-dbg done
-- Build x86-windows-rel
-- Build x86-windows-rel done
-- Build x86-windows-dbg
-- Build x86-windows-dbg done
-- Performing post-build validation
-- Performing post-build validation done
Building package harfbuzz:x86-windows... done
Installing package harfbuzz:x86-windows...
Installing package harfbuzz:x86-windows... done
Elapsed time for package harfbuzz:x86-windows: 58.05 s
Total time taken: 58.05 s

修正前

diff --git a/src/hb-ft.cc b/src/hb-ft.cc
index 492992e..5794d0e 100644
--- a/src/hb-ft.cc
+++ b/src/hb-ft.cc
@@ -31,6 +31,10 @@
 
 #include "hb-ft.h"
 
+#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
+#define generic GenericFromFreeTypeLibrary
+#endif
+
 #include "hb-font-private.hh"
 
 #include "hb-cache-private.hh" // Maybe use in the future?

修正後、"harfbuzz-1.5.1"を"src"の前につけてあげると、パッチが成功した。

diff --git a/harfbuzz-1.5.1/src/hb-ft.cc b/harfbuzz-1.5.1/src/hb-ft.cc
index 492992e..5794d0e 100644
--- a/harfbuzz-1.5.1/src/hb-ft.cc
+++ b/harfbuzz-1.5.1/src/hb-ft.cc
@@ -31,6 +31,10 @@
 
 #include "hb-ft.h"
 
+#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP)
+#define generic GenericFromFreeTypeLibrary
+#endif
+
 #include "hb-font-private.hh"
 
 #include "hb-cache-private.hh" // Maybe use in the future?
PS C:\MyGitHub\vcpkg> .\vcpkg.exe install harfbuzz
The following packages will be built and installed:
    harfbuzz:x86-windows
Starting package 1/1: harfbuzz:x86-windows
Building package harfbuzz:x86-windows...
-- CURRENT_INSTALLED_DIR= C:/MyGitHub/vcpkg/installed/x86-windows
-- DOWNLOADS=             C:/MyGitHub/vcpkg/downloads
-- CURRENT_PACKAGES_DIR=  C:/MyGitHub/vcpkg/packages/harfbuzz_x86-windows
-- CURRENT_BUILDTREES_DIR=C:/MyGitHub/vcpkg/buildtrees/harfbuzz
-- CURRENT_PORT_DIR=      C:/MyGitHub/vcpkg/ports/harfbuzz/.
-- Using cached           C:/MyGitHub/vcpkg/downloads/harfbuzz-1.5.1.tar.bz2
-- Testing integrity of cached file...
-- Testing integrity of cached file... OK
-- Extracting done
-- Applying patch C:/MyGitHub/vcpkg/ports/harfbuzz/0001-fix-uwp-build.patch
-- Applying patch C:/MyGitHub/vcpkg/ports/harfbuzz/0001-fix-uwp-build.patch done
-- Configuring x86-windows-rel
-- Configuring x86-windows-rel done
-- Configuring x86-windows-dbg
-- Configuring x86-windows-dbg done
-- Build x86-windows-rel
-- Build x86-windows-rel done
-- Build x86-windows-dbg
-- Build x86-windows-dbg done
-- Performing post-build validation
-- Performing post-build validation done
Building package harfbuzz:x86-windows... done
Installing package harfbuzz:x86-windows...
Installing package harfbuzz:x86-windows... done
Elapsed time for package harfbuzz:x86-windows: 1.031 min
Total time taken: 1.031 min