[vlc-commits] contribs: gcrypt: Fix winrt build

Hugo Beauzée-Luyssen git at videolan.org
Tue May 10 13:56:32 CEST 2016


vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Mon May  9 17:36:27 2016 +0200| [710e993a31abb420670a0a188d6388d775d08e2d] | committer: Hugo Beauzée-Luyssen

contribs: gcrypt: Fix winrt build

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=710e993a31abb420670a0a188d6388d775d08e2d
---

 contrib/src/gcrypt/rules.mak   |    3 ++
 contrib/src/gcrypt/winrt.patch |  108 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 111 insertions(+)

diff --git a/contrib/src/gcrypt/rules.mak b/contrib/src/gcrypt/rules.mak
index 2fed2cd..1026f96 100644
--- a/contrib/src/gcrypt/rules.mak
+++ b/contrib/src/gcrypt/rules.mak
@@ -15,6 +15,9 @@ libgcrypt: libgcrypt-$(GCRYPT_VERSION).tar.bz2 .sum-gcrypt
 	$(APPLY) $(SRC)/gcrypt/0001-Fix-assembly-division-check.patch
 	$(APPLY) $(SRC)/gcrypt/disable-doc-compilation.patch
 	$(APPLY) $(SRC)/gcrypt/disable-tests-compilation.patch
+ifdef HAVE_WINRT
+	$(APPLY) $(SRC)/gcrypt/winrt.patch
+endif
 	$(MOVE)
 
 DEPS_gcrypt = gpg-error
diff --git a/contrib/src/gcrypt/winrt.patch b/contrib/src/gcrypt/winrt.patch
new file mode 100644
index 0000000..ed29bcc
--- /dev/null
+++ b/contrib/src/gcrypt/winrt.patch
@@ -0,0 +1,108 @@
+--- libgcrypt/random/rndw32.c.orig	2016-05-09 16:48:42.495200068 +0200
++++ libgcrypt/random/rndw32.c	2016-05-09 16:55:07.423179353 +0200
+@@ -337,6 +337,7 @@
+   HANDLE hMBMData;
+   SharedData *mbmDataPtr;
+ 
++#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
+   hMBMData = OpenFileMapping (FILE_MAP_READ, FALSE, "$M$B$M$5$S$D$" );
+   if (hMBMData)
+     {
+@@ -351,6 +352,7 @@
+         }
+       CloseHandle (hMBMData);
+     }
++#endif
+ }
+ 
+ 
+@@ -594,6 +596,7 @@
+       }
+   }
+ 
++#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
+   /* Get disk I/O statistics for all the hard drives.  100 is an
+      arbitrary failsafe limit.  */
+   for (drive_no = 0; drive_no < 100 ; drive_no++)
+@@ -628,6 +631,7 @@
+         }
+       CloseHandle (hDevice);
+     }
++#endif
+ 
+   /* In theory we should be using the Win32 performance query API to obtain
+      unpredictable data from the system, however this is so unreliable (see
+@@ -786,12 +790,16 @@
+ 
+   if (!is_initialized)
+     {
++#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
+       OSVERSIONINFO osvi = { sizeof( osvi ) };
+ 
+       GetVersionEx( &osvi );
+       if (osvi.dwPlatformId != VER_PLATFORM_WIN32_NT)
+         log_fatal ("can only run on a Windows NT platform\n" );
+       system_is_w2000 = (osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0);
++#else
++      system_is_w2000 = 0;
++#endif
+       init_system_rng ();
+       is_initialized = 1;
+     }
+@@ -842,14 +850,11 @@
+                         ADDINT((SIZE_T)aptr);                      \
+                       } while (0)
+ 
++#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
+     ADDPTR ( GetActiveWindow ());
+     ADDPTR ( GetCapture ());
+     ADDPTR ( GetClipboardOwner ());
+     ADDPTR ( GetClipboardViewer ());
+-    ADDPTR ( GetCurrentProcess ());
+-    ADDINT ( GetCurrentProcessId ());
+-    ADDPTR ( GetCurrentThread ());
+-    ADDINT ( GetCurrentThreadId ());
+     ADDPTR ( GetDesktopWindow ());
+     ADDPTR ( GetFocus ());
+     ADDINT ( GetInputState ());
+@@ -858,6 +863,11 @@
+     ADDPTR ( GetOpenClipboardWindow ());
+     ADDPTR ( GetProcessHeap ());
+     ADDPTR ( GetProcessWindowStation ());
++#endif
++    ADDPTR ( GetCurrentProcess ());
++    ADDINT ( GetCurrentProcessId ());
++    ADDPTR ( GetCurrentThread ());
++    ADDINT ( GetCurrentThreadId ());
+     /* Following function in some cases stops returning events, and cannot
+        be used as an entropy source.  */
+     /*ADDINT ( GetQueueStatus (QS_ALLEVENTS));*/
+@@ -871,6 +881,7 @@
+ 
+   /* Get multiword system information: Current caret position, current
+      mouse cursor position.  */
++#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
+   {
+     POINT point;
+ 
+@@ -922,10 +933,12 @@
+     (*add) ( &minimumWorkingSetSize, sizeof (int), origin );
+     (*add) ( &maximumWorkingSetSize, sizeof (int), origin );
+   }
++#endif
+ 
+ 
+   /* The following are fixed for the lifetime of the process so we only
+    * add them once */
++#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
+   if (!addedFixedItems)
+     {
+       STARTUPINFO startupInfo;
+@@ -938,6 +951,7 @@
+       (*add) ( &startupInfo, sizeof (STARTUPINFO), origin );
+       addedFixedItems = 1;
+     }
++#endif
+ 
+   /* The performance of QPC varies depending on the architecture it's
+      running on and on the OS, the MS documentation is vague about the



More information about the vlc-commits mailing list