From 35550d22e401eec96b76107635ef8c2055712f1f Mon Sep 17 00:00:00 2001
From: Adrien Beraud <adrien.beraud@savoirfairelinux.com>
Date: Wed, 29 Mar 2017 03:09:39 +0200
Subject: [PATCH] contrib: bump opendht and fix uwp build

Bump OpenDHT to commit 09b4e71d (30/03/2017) to fix various bugs since
last bump and to add new API to fix issues with certificate memory
management.

This includes a patch for UWP to build this new version.

Change-Id: I80dc2aa5113a394b725764fa6c71b35b4b18a853
Tuleap: #1548
Reviewed-by: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com>
---
 contrib/src/opendht/fetch_and_patch.bat |  6 +++++-
 contrib/src/opendht/opendht-uwp.patch   | 14 ++++++++++++++
 contrib/src/opendht/rules.mak           |  2 +-
 3 files changed, 20 insertions(+), 2 deletions(-)
 create mode 100644 contrib/src/opendht/opendht-uwp.patch

diff --git a/contrib/src/opendht/fetch_and_patch.bat b/contrib/src/opendht/fetch_and_patch.bat
index b834f12f3f..6e6a8f275d 100644
--- a/contrib/src/opendht/fetch_and_patch.bat
+++ b/contrib/src/opendht/fetch_and_patch.bat
@@ -1,6 +1,6 @@
 set BUILD=%SRC%..\build
 
-set OPENDHT_VERSION=b08b2f14f20e0dbaa00fc2c70347d578c70e49da
+set OPENDHT_VERSION=09b4e71dc5743d67f35a9604ec93c51c1e109ebe
 set OPENDHT_URL=https://github.com/savoirfairelinux/opendht/archive/%OPENDHT_VERSION%.tar.gz
 
 mkdir %BUILD%
@@ -15,4 +15,8 @@ if %USE_CACHE%==1 (
 del %OPENDHT_VERSION%.tar && del %OPENDHT_VERSION%.tar.gz && del %BUILD%\pax_global_header
 rename %BUILD%\opendht-%OPENDHT_VERSION% opendht
 
+cd %BUILD%\opendht
+
+git apply --reject --whitespace=fix %SRC%\opendht\opendht-uwp.patch
+
 cd %SRC%
\ No newline at end of file
diff --git a/contrib/src/opendht/opendht-uwp.patch b/contrib/src/opendht/opendht-uwp.patch
new file mode 100644
index 0000000000..8f82897610
--- /dev/null
+++ b/contrib/src/opendht/opendht-uwp.patch
@@ -0,0 +1,14 @@
+--- a/MSVC/opendht.vcxproj
++++ b/MSVC/opendht.vcxproj
+@@ -208,7 +208,7 @@ copy ..\include\opendht.h $(OutDir)\include\</Command>
+       <FunctionLevelLinking>true</FunctionLevelLinking>
+       <IntrinsicFunctions>true</IntrinsicFunctions>
+       <SDLCheck>true</SDLCheck>
+-      <AdditionalIncludeDirectories>$(ProjectDir)contrib\build\include;$(ProjectDir)..\include;$(ProjectDir)..\include\opendht;$(ProjectDir)contrib\build\msgpack-c\include;$(ProjectDir)..\argon2</AdditionalIncludeDirectories>
++      <AdditionalIncludeDirectories>$(ProjectDir)contrib\build\include;$(ProjectDir)..\include;$(ProjectDir)..\include\opendht;$(ProjectDir)contrib\build\msgpack-c\include;$(ProjectDir)..\argon2;$(ProjectDir)..\..\include</AdditionalIncludeDirectories>
+       <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32_NATIVE;WIN32_LEAN_AND_MEAN;_MBCS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+       <DisableSpecificWarnings>4804;4800;4101;4267;4244;4503;</DisableSpecificWarnings>
+       <AdditionalOptions>-D_SCL_SECURE_NO_WARNINGS %(AdditionalOptions)</AdditionalOptions>
+-- 
+2.8.1.windows.1
+
diff --git a/contrib/src/opendht/rules.mak b/contrib/src/opendht/rules.mak
index e130d063a0..6973d74508 100644
--- a/contrib/src/opendht/rules.mak
+++ b/contrib/src/opendht/rules.mak
@@ -1,5 +1,5 @@
 # OPENDHT
-OPENDHT_VERSION := b08b2f14f20e0dbaa00fc2c70347d578c70e49da
+OPENDHT_VERSION := 09b4e71dc5743d67f35a9604ec93c51c1e109ebe
 OPENDHT_URL := https://github.com/savoirfairelinux/opendht/archive/$(OPENDHT_VERSION).tar.gz
 
 PKGS += opendht
-- 
GitLab