[vlc-commits] [Git][videolan/vlc][master] 2 commits: contrib: caca: allow building in UWP
Felix Paul Kühne (@fkuehne)
gitlab at videolan.org
Sun Jun 11 23:13:23 UTC 2023
Felix Paul Kühne pushed to branch master at VideoLAN / VLC
Commits:
c3b8dcaa by Steve Lhomme at 2023-06-11T19:15:19+00:00
contrib: caca: allow building in UWP
The console API's have been allowed for a while.
The patches have been sent upstream.
- - - - -
f1d93bca by Steve Lhomme at 2023-06-11T19:15:19+00:00
contrib: aribb25: update Winstore build block
It doesn't matter what calls it does, winscard is not allowed which renders
the library useless.
- - - - -
7 changed files:
- contrib/src/aribb25/rules.mak
- + contrib/src/caca/0001-win32-don-t-for-_WIN32_WINNT-to-Win2K.patch
- + contrib/src/caca/0002-win32-don-t-redefine-GetCurrentConsoleFont-with-ming.patch
- + contrib/src/caca/0003-win32-use-ANSI-calls-explicitly.patch
- + contrib/src/caca/0004-win32-use-CreateFile2-when-compiling-for-Win8.patch
- + contrib/src/caca/0005-canvas-use-GetCurrentProcessId-on-Windows.patch
- contrib/src/caca/rules.mak
Changes:
=====================================
contrib/src/aribb25/rules.mak
=====================================
@@ -4,7 +4,7 @@ ARIBB25_VERSION := 0.2.7
ARIBB25_URL := $(VIDEOLAN)/aribb25/$(ARIBB25_VERSION)/aribb25-$(ARIBB25_VERSION).tar.gz
ifdef HAVE_WIN32
-ifndef HAVE_WINSTORE # aribb25 uses ANSI strings in WIDE APIs
+ifndef HAVE_WINSTORE # winscard is not allowed
PKGS += aribb25
endif
endif
=====================================
contrib/src/caca/0001-win32-don-t-for-_WIN32_WINNT-to-Win2K.patch
=====================================
@@ -0,0 +1,27 @@
+From 93b558f26b53f4a677bd1b5afaf60a8849292afc Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Thu, 8 Jun 2023 09:07:01 +0200
+Subject: [PATCH 1/5] win32: don't for _WIN32_WINNT to Win2K
+
+If the system allows newer API's we should downversion it.
+---
+ caca/driver/win32.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/caca/driver/win32.c b/caca/driver/win32.c
+index 439b8dc..53ff881 100644
+--- a/caca/driver/win32.c
++++ b/caca/driver/win32.c
+@@ -19,7 +19,9 @@
+
+ #if defined(USE_WIN32)
+
++#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x500 /* _WIN32_WINNT_WIN2K */
+ #define _WIN32_WINNT 0x500 /* Require WinXP or later */
++#endif
+ #define WIN32_LEAN_AND_MEAN
+ #include <windows.h>
+
+--
+2.37.3.windows.1
+
=====================================
contrib/src/caca/0002-win32-don-t-redefine-GetCurrentConsoleFont-with-ming.patch
=====================================
@@ -0,0 +1,27 @@
+From ceed13243b729e8795a0897f432cbd8a021805bc Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Thu, 8 Jun 2023 09:08:12 +0200
+Subject: [PATCH 2/5] win32: don't redefine GetCurrentConsoleFont with
+ mingw-w64
+
+It's already defined properly.
+---
+ caca/driver/win32.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/caca/driver/win32.c b/caca/driver/win32.c
+index 53ff881..9509172 100644
+--- a/caca/driver/win32.c
++++ b/caca/driver/win32.c
+@@ -25,7 +25,7 @@
+ #define WIN32_LEAN_AND_MEAN
+ #include <windows.h>
+
+-#ifdef __MINGW32__
++#if defined(__MINGW32__) && !defined(__MINGW64_VERSION_MAJOR)
+ /* This is missing from the MinGW headers. */
+ # if (_WIN32_WINNT >= 0x0500)
+ BOOL WINAPI GetCurrentConsoleFont(HANDLE hConsoleOutput, BOOL bMaximumWindow,
+--
+2.37.3.windows.1
+
=====================================
contrib/src/caca/0003-win32-use-ANSI-calls-explicitly.patch
=====================================
@@ -0,0 +1,26 @@
+From 3b4670c82c650fb9aff07bdd9b98896821d6a2d0 Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Thu, 8 Jun 2023 09:09:18 +0200
+Subject: [PATCH 3/5] win32: use ANSI calls explicitly
+
+If the environment forces the UNICODE define it will use the wrong call.
+---
+ caca/driver/win32.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/caca/driver/win32.c b/caca/driver/win32.c
+index 9509172..40aeeed 100644
+--- a/caca/driver/win32.c
++++ b/caca/driver/win32.c
+@@ -196,7 +196,7 @@ static int win32_end_graphics(caca_display_t *dp)
+
+ static int win32_set_display_title(caca_display_t *dp, char const *title)
+ {
+- SetConsoleTitle(title);
++ SetConsoleTitleA(title);
+ return 0;
+ }
+
+--
+2.37.3.windows.1
+
=====================================
contrib/src/caca/0004-win32-use-CreateFile2-when-compiling-for-Win8.patch
=====================================
@@ -0,0 +1,49 @@
+From 43a0870bbb4cfba5d3c9472f04ea9a31dc39a527 Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Thu, 8 Jun 2023 09:13:36 +0200
+Subject: [PATCH 4/5] win32: use CreateFile2 when compiling for Win8+
+
+The API is always available in Win8+ even in UWP builds, unlike CreateFileW.
+The API is pretty much the same. CONOUT is also supported [1].
+
+[1] https://learn.microsoft.com/en-us/windows/win32/api/fileapi/nf-fileapi-createfile2#consoles
+---
+ caca/driver/win32.c | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+diff --git a/caca/driver/win32.c b/caca/driver/win32.c
+index 40aeeed..0c84470 100644
+--- a/caca/driver/win32.c
++++ b/caca/driver/win32.c
+@@ -104,6 +104,9 @@ static int win32_init_graphics(caca_display_t *dp)
+ CONSOLE_CURSOR_INFO cci_screen;
+ SMALL_RECT rect;
+ COORD size;
++#if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
++ CREATEFILE2_EXTENDED_PARAMETERS createExParams;
++#endif
+
+ dp->drv.p = malloc(sizeof(struct driver_private));
+
+@@ -111,9 +114,18 @@ static int win32_init_graphics(caca_display_t *dp)
+ dp->drv.p->new_console = AllocConsole();
+
+ dp->drv.p->hin = GetStdHandle(STD_INPUT_HANDLE);
++#if _WIN32_WINNT >= 0x0602 /* _WIN32_WINNT_WIN8 */
++ ZeroMemory(&createExParams, sizeof(createExParams));
++ createExParams.dwSize = sizeof(CREATEFILE2_EXTENDED_PARAMETERS);
++ createExParams.dwFileAttributes = FILE_ATTRIBUTE_NORMAL;
++ dp->drv.p->hout = CreateFile2(L"CONOUT$", GENERIC_READ | GENERIC_WRITE,
++ FILE_SHARE_READ | FILE_SHARE_WRITE,
++ OPEN_EXISTING, &createExParams);
++#else
+ dp->drv.p->hout = CreateFile("CONOUT$", GENERIC_READ | GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
+ OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
++#endif
+ if(dp->drv.p->hout == INVALID_HANDLE_VALUE)
+ return -1;
+
+--
+2.37.3.windows.1
+
=====================================
contrib/src/caca/0005-canvas-use-GetCurrentProcessId-on-Windows.patch
=====================================
@@ -0,0 +1,43 @@
+From d78bdde484524c737c9285d5332cf5e7dbbf9a56 Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Thu, 8 Jun 2023 09:15:53 +0200
+Subject: [PATCH 5/5] canvas: use GetCurrentProcessId() on Windows
+
+getpid() or _getpid() are not available in UWP builds [1] but we can use
+GetCurrentProcessId() instead.
+
+[1] https://learn.microsoft.com/en-us/cpp/cppcx/crt-functions-not-supported-in-universal-windows-platform-apps#unsupported-crt-functions
+---
+ caca/canvas.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/caca/canvas.c b/caca/canvas.c
+index 7beff5b..c7021d8 100644
+--- a/caca/canvas.c
++++ b/caca/canvas.c
+@@ -27,6 +27,10 @@
+ # include <unistd.h>
+ # endif
+ #endif
++#ifdef _WIN32
++#define WIN32_LEAN_AND_MEAN
++#include <windows.h>
++#endif
+
+ #include "caca.h"
+ #include "caca_internals.h"
+@@ -351,7 +355,11 @@ int caca_rand(int min, int max)
+
+ if(need_init)
+ {
++#ifdef _WIN32
++ srand(GetCurrentProcessId() + _caca_getticks(&timer));
++#else
+ srand(getpid() + _caca_getticks(&timer));
++#endif
+ need_init = 0;
+ }
+
+--
+2.37.3.windows.1
+
=====================================
contrib/src/caca/rules.mak
=====================================
@@ -4,11 +4,9 @@ CACA_URL := $(GITHUB)/cacalabs/libcaca/releases/download/v$(CACA_VERSION)/libcac
ifndef HAVE_DARWIN_OS
ifndef HAVE_LINUX # see VLC Trac 17251
-ifndef HAVE_WINSTORE # FIXME uses ANSI calls improperly
PKGS += caca
endif
endif
-endif
ifeq ($(call need_pkg,"caca >= 0.99.beta19"),)
PKGS_FOUND += caca
@@ -23,6 +21,11 @@ caca: libcaca-$(CACA_VERSION).tar.gz .sum-caca
$(UNPACK)
$(APPLY) $(SRC)/caca/caca-fix-compilation-llvmgcc.patch
$(APPLY) $(SRC)/caca/caca-fix-pkgconfig.patch
+ $(APPLY) $(SRC)/caca/0001-win32-don-t-for-_WIN32_WINNT-to-Win2K.patch
+ $(APPLY) $(SRC)/caca/0002-win32-don-t-redefine-GetCurrentConsoleFont-with-ming.patch
+ $(APPLY) $(SRC)/caca/0003-win32-use-ANSI-calls-explicitly.patch
+ $(APPLY) $(SRC)/caca/0004-win32-use-CreateFile2-when-compiling-for-Win8.patch
+ $(APPLY) $(SRC)/caca/0005-canvas-use-GetCurrentProcessId-on-Windows.patch
$(call pkg_static,"caca/caca.pc.in")
$(UPDATE_AUTOCONFIG)
$(MOVE)
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7ea69dccac21ba737f1389403efb3989a096d457...f1d93bcaa6dc989dc1d7163f8baa34b3d2ca1eff
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/7ea69dccac21ba737f1389403efb3989a096d457...f1d93bcaa6dc989dc1d7163f8baa34b3d2ca1eff
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list