From 1c9c650d2d2ecc122249c9bef6520937e4dd25b3 Mon Sep 17 00:00:00 2001
From: atraczyk <andreastraczyk@gmail.com>
Date: Tue, 24 Jan 2017 11:52:59 -0500
Subject: [PATCH] contrib: fix gmp for UWP build

Change-Id: Ibf33e5c472287f4b6e2be2b0fff101d7e5b2c7b8
Tuleap: #790
---
 MSVC/ring-daemon.vcxproj            |  1 +
 contrib/src/gmp/fetch_and_patch.bat |  7 +++++--
 contrib/src/gmp/gmp-uwp.patch       | 11 +++++++++++
 src/logger.cpp                      |  7 ++++++-
 4 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/MSVC/ring-daemon.vcxproj b/MSVC/ring-daemon.vcxproj
index 11fdfa2bdd..cbdfc40e6b 100644
--- a/MSVC/ring-daemon.vcxproj
+++ b/MSVC/ring-daemon.vcxproj
@@ -389,6 +389,7 @@
       <BasicRuntimeChecks>
       </BasicRuntimeChecks>
       <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
     </ClCompile>
     <Link>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
diff --git a/contrib/src/gmp/fetch_and_patch.bat b/contrib/src/gmp/fetch_and_patch.bat
index 653212be16..2a4937d89c 100644
--- a/contrib/src/gmp/fetch_and_patch.bat
+++ b/contrib/src/gmp/fetch_and_patch.bat
@@ -1,11 +1,14 @@
 set BUILD=%SRC%..\build
 
-set REPOURL="https://github.com/ShiftMediaProject/gmp.git"
+set GMP_VERSION=3c8f5a0ae0c2ac9ff0ea31b27f71b152979b556d
+set GMP_URL="https://github.com/ShiftMediaProject/gmp.git"
 
 mkdir %BUILD%
 cd %BUILD%
 
-git clone %REPOURL%
+git clone %GMP_URL%
+cd %GMP_URL%
+git checkout %GMP_VERSION%
 
 cd gmp
 git apply --reject --whitespace=fix %SRC%\gmp\gmp-uwp.patch
diff --git a/contrib/src/gmp/gmp-uwp.patch b/contrib/src/gmp/gmp-uwp.patch
index 7e39970c50..e32ef9ae99 100644
--- a/contrib/src/gmp/gmp-uwp.patch
+++ b/contrib/src/gmp/gmp-uwp.patch
@@ -94,6 +94,17 @@
      <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
    </PropertyGroup>
    <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+--- a/SMP/config.h
++++ b/SMP/config.h
+@@ -202,7 +202,7 @@
+ /* #undef HAVE_NATIVE_mpn_add_n_sub_n */
+ #define HAVE_NATIVE_mpn_add_nc 1
+ #if defined(__x86_64) || defined(_M_X64)
+-#define HAVE_NATIVE_mpn_addaddmul_1msb0 1
++#define HAVE_NATIVE_mpn_addaddmul_1msb0 0
+ #define HAVE_NATIVE_mpn_addlsh1_n 1
+ #define HAVE_NATIVE_mpn_addlsh2_n 1
+ #define HAVE_NATIVE_mpn_addlsh_n 1
 -- 
 2.8.1.windows.1
 
diff --git a/src/logger.cpp b/src/logger.cpp
index 4822ea1f45..fa5640a78a 100644
--- a/src/logger.cpp
+++ b/src/logger.cpp
@@ -118,8 +118,13 @@ getHeader(const char* ctx)
     out.fill(prev_fill);
 
     // Context
-    if (ctx)
+    if (ctx) {
+#ifdef RING_UWP
+        out << "|" << std::setw(32) << ctx;
+#else
         out << "|" << std::setw(24) << ctx;
+#endif
+    }
 
     out << "] ";
 
-- 
GitLab