diff --git a/contrib/src/freetype2/0001-builds-windows-Add-support-for-legacy-UWP-builds.patch b/contrib/src/freetype2/0001-builds-windows-Add-support-for-legacy-UWP-builds.patch new file mode 100644 index 0000000000..fa1b540776 --- /dev/null +++ b/contrib/src/freetype2/0001-builds-windows-Add-support-for-legacy-UWP-builds.patch @@ -0,0 +1,49 @@ +From 20ec99be7ecfd1a07e1ff7a7ef3e510203ea33bd Mon Sep 17 00:00:00 2001 +From: Steve Lhomme +Date: Thu, 17 Feb 2022 13:35:52 -0500 +Subject: [PATCH] [builds/windows] Add support for legacy UWP builds. + +* builds/windows/ftsystem.c: Add neccessary macro substitutions to +enable strict UWP builds. + +See !141. + +Co-authored-by: Alexei Podtelezhnikov +--- + builds/windows/ftsystem.c | 20 +++++++++++++++++++- + 1 file changed, 19 insertions(+), 1 deletion(-) + +diff --git a/builds/windows/ftsystem.c b/builds/windows/ftsystem.c +index 1c49f30db..d4fc95675 100644 +--- a/builds/windows/ftsystem.c ++++ b/builds/windows/ftsystem.c +@@ -196,7 +196,25 @@ + } + + +-#ifdef _WIN32_WCE ++#if defined( NTDDI_VERSION ) && NTDDI_VERSION < 0x0A000007 && \ ++ defined( WINAPI_FAMILY_PARTITION ) && \ ++ !WINAPI_FAMILY_PARTITION( WINAPI_PARTITION_DESKTOP ) ++ ++#define PACK_DWORD64( hi, lo ) ( ( (DWORD64)(hi) << 32 ) | (DWORD)(lo) ) ++ ++#define CreateFileW( a, b, c, d, e, f, g ) \ ++ CreateFileFromAppW( a, b, c, d, e, f, g ) ++#define CreateFileMapping( a, b, c, d, e, f ) \ ++ CreateFileMappingFromApp( a, b, c, PACK_DWORD64( d, e ), f ) ++#define MapViewOfFile( a, b, c, d, e ) \ ++ MapViewOfFileFromApp( a, b, PACK_DWORD64( c, d ), e ) ++ ++#define UWP_LEGACY ++ ++#endif ++ ++ ++#if defined( _WIN32_WCE ) || defined( UWP_LEGACY ) + + FT_LOCAL_DEF( HANDLE ) + CreateFileA( LPCSTR lpFileName, +-- +2.27.0.windows.1 + diff --git a/contrib/src/freetype2/0001-builds-windows-Guard-some-non-ancient-API.patch b/contrib/src/freetype2/0001-builds-windows-Guard-some-non-ancient-API.patch new file mode 100644 index 0000000000..07b8a8fada --- /dev/null +++ b/contrib/src/freetype2/0001-builds-windows-Guard-some-non-ancient-API.patch @@ -0,0 +1,79 @@ +From 1f951898751365e9bd2a920ce76652f2a59c3305 Mon Sep 17 00:00:00 2001 +From: Cameron Cawley +Date: Mon, 6 Dec 2021 23:08:46 -0500 +Subject: [PATCH] [builds/windows] Guard some non-ancient API. + +We can support Windows 98 and NT 4.0 in principle... + +* builds/windows/ftdebug.c, builds/windows/ftsystem.c: Check for the +ancient SDK using _WIN32_WINDOWS, _WIN32_WCE, or _WIN32_WINNT. +--- + builds/windows/ftdebug.c | 6 ++++++ + builds/windows/ftsystem.c | 6 +++++- + 2 files changed, 11 insertions(+), 1 deletion(-) + +diff --git a/builds/windows/ftdebug.c b/builds/windows/ftdebug.c +index 94c22da75..ff5d4b481 100644 +--- a/builds/windows/ftdebug.c ++++ b/builds/windows/ftdebug.c +@@ -136,6 +136,8 @@ + + va_start( ap, fmt ); + vfprintf( stderr, fmt, ap ); ++#if ( defined( _WIN32_WINNT ) && _WIN32_WINNT >= 0x0400 ) || \ ++ ( defined( _WIN32_WCE ) && _WIN32_WCE >= 0x0600 ) + if ( IsDebuggerPresent() ) + { + static char buf[1024]; +@@ -144,6 +146,7 @@ + vsnprintf( buf, sizeof buf, fmt, ap ); + OutputDebugStringA( buf ); + } ++#endif + va_end( ap ); + } + +@@ -159,6 +162,8 @@ + + va_start( ap, fmt ); + vfprintf( stderr, fmt, ap ); ++#if ( defined( _WIN32_WINNT ) && _WIN32_WINNT >= 0x0400 ) || \ ++ ( defined( _WIN32_WCE ) && _WIN32_WCE >= 0x0600 ) + if ( IsDebuggerPresent() ) + { + static char buf[1024]; +@@ -167,6 +172,7 @@ + vsnprintf( buf, sizeof buf, fmt, ap ); + OutputDebugStringA( buf ); + } ++#endif + va_end( ap ); + + exit( EXIT_FAILURE ); +diff --git a/builds/windows/ftsystem.c b/builds/windows/ftsystem.c +index 1ebadd49f..0433d6151 100644 +--- a/builds/windows/ftsystem.c ++++ b/builds/windows/ftsystem.c +@@ -233,6 +233,10 @@ + dwFlagsAndAttributes, hTemplateFile ); + } + ++#endif ++ ++#if defined( _WIN32_WCE ) || defined ( _WIN32_WINDOWS ) || \ ++ !defined( _WIN32_WINNT ) || _WIN32_WINNT <= 0x0400 + + FT_LOCAL_DEF( BOOL ) + GetFileSizeEx( HANDLE hFile, +@@ -248,7 +252,7 @@ + return TRUE; + } + +-#endif /* _WIN32_WCE */ ++#endif + + + /* documentation is in ftobjs.h */ +-- +2.27.0.windows.1 + diff --git a/contrib/src/freetype2/rules.mak b/contrib/src/freetype2/rules.mak index a7b789e0de..8d517d78c8 100644 --- a/contrib/src/freetype2/rules.mak +++ b/contrib/src/freetype2/rules.mak @@ -15,7 +15,8 @@ $(TARBALLS)/freetype-$(FREETYPE2_VERSION).tar.xz: freetype: freetype-$(FREETYPE2_VERSION).tar.xz .sum-freetype2 $(UNPACK) - $(APPLY) $(SRC)/freetype2/uwpfixes.patch + $(APPLY) $(SRC)/freetype2/0001-builds-windows-Guard-some-non-ancient-API.patch + $(APPLY) $(SRC)/freetype2/0001-builds-windows-Add-support-for-legacy-UWP-builds.patch $(call pkg_static, "builds/unix/freetype2.in") $(MOVE) diff --git a/contrib/src/freetype2/uwpfixes.patch b/contrib/src/freetype2/uwpfixes.patch deleted file mode 100644 index 4f1f71b570..0000000000 --- a/contrib/src/freetype2/uwpfixes.patch +++ /dev/null @@ -1,38 +0,0 @@ -diff --git a/builds/windows/ftsystem.c b/builds/windows/ftsystem.c -index 1ebadd49f..ac8ff1f92 100644 ---- a/builds/windows/ftsystem.c -+++ b/builds/windows/ftsystem.c -@@ -28,6 +28,7 @@ - /* memory mapping and allocation includes and definitions */ - #define WIN32_LEAN_AND_MEAN - #include -+#include - - - /************************************************************************** -@@ -296,7 +297,11 @@ - goto Fail_Open; - } - -+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) - fm = CreateFileMapping( file, NULL, PAGE_READONLY, 0, 0, NULL ); -+#else -+ fm = CreateFileMappingFromApp( file, NULL, PAGE_READONLY, 0, NULL ); -+#endif - if ( fm == NULL ) - { - FT_ERROR(( "FT_Stream_Open: can not map file\n" )); -@@ -308,8 +313,13 @@ - /* a size greater than LONG_MAX */ - stream->size = size.LowPart; - stream->pos = 0; -+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) - stream->base = (unsigned char *) - MapViewOfFile( fm, FILE_MAP_READ, 0, 0, 0 ); -+#else -+ stream->base = (unsigned char *) -+ MapViewOfFileFromApp( fm, FILE_MAP_READ, 0, 0 ); -+#endif - - CloseHandle( fm ); -