From 3ae6811c2110e39b169cedaee1215b4e7ddf9d44 Mon Sep 17 00:00:00 2001
From: atraczyk <andreastraczyk@gmail.com>
Date: Tue, 31 Jan 2017 17:36:37 -0500
Subject: [PATCH] build: change to archive downloads only on UWP build

- Changes fetch scripts urls to archived tarballs if possible to
  facilitate caching of the contrib source on the UWP Jenkins
  build machine.

Change-Id: I51eac783eea964bfe08727baf1ad7b9e08a5096d
Tuleap: #790
---
 contrib/src/boost/fetch_and_patch.bat      |  8 ++-
 contrib/src/cryptopp/fetch_and_patch.bat   | 17 ++++--
 contrib/src/ffmpeg/fetch_and_patch.bat     | 55 ++++++++++++-----
 contrib/src/gmp/fetch_and_patch.bat        | 18 ++++--
 contrib/src/gnutls/fetch_and_patch.bat     | 17 +++++-
 contrib/src/gnutls/gnutls-uwp.patch        | 11 +---
 contrib/src/iconv/fetch_and_patch.bat      | 17 ++++--
 contrib/src/jsoncpp/fetch_and_patch.bat    | 17 ++++--
 contrib/src/msgpack/fetch_and_patch.bat    | 17 ++++--
 contrib/src/nettle/fetch_and_patch.bat     | 17 ++++--
 contrib/src/opendht/fetch_and_patch.bat    | 15 +++--
 contrib/src/pcre/fetch_and_patch.bat       |  8 ++-
 contrib/src/pjproject/fetch_and_patch.bat  |  8 ++-
 contrib/src/portaudio/fetch_and_patch.bat  |  8 ++-
 contrib/src/pthreads/fetch_and_patch.bat   |  8 ++-
 contrib/src/restbed/fetch_and_patch.bat    | 71 ++++++++++++++++++----
 contrib/src/restbed/openssl-repo-uwp.patch | 13 ----
 contrib/src/samplerate/fetch_and_patch.bat |  8 ++-
 contrib/src/upnp/fetch_and_patch.bat       |  8 ++-
 contrib/src/yaml-cpp/fetch_and_patch.bat   | 17 ++++--
 contrib/src/zlib/fetch_and_patch.bat       | 17 ++++--
 21 files changed, 273 insertions(+), 102 deletions(-)
 delete mode 100644 contrib/src/restbed/openssl-repo-uwp.patch

diff --git a/contrib/src/boost/fetch_and_patch.bat b/contrib/src/boost/fetch_and_patch.bat
index 723d61fd1e..fd9f419ebd 100644
--- a/contrib/src/boost/fetch_and_patch.bat
+++ b/contrib/src/boost/fetch_and_patch.bat
@@ -5,7 +5,13 @@ set BOOST_VERSION_2=1_61_0
 set BOOST_URL="https://sourceforge.net/projects/boost/files/boost/%BOOST_VERSION_1%/boost_%BOOST_VERSION_2%.zip"
 
 mkdir %BUILD%
-wget %BOOST_URL%
+
+if %USE_CACHE%==1 (
+    copy %CACHE_DIR%\boost_%BOOST_VERSION_2%.zip %cd%
+) else (
+    wget %BOOST_URL%
+)
+
 unzip -q boost_%BOOST_VERSION_2%.zip -d %BUILD%
 del boost_%BOOST_VERSION_2%.zip
 rename %BUILD%\boost_%BOOST_VERSION_2% boost
diff --git a/contrib/src/cryptopp/fetch_and_patch.bat b/contrib/src/cryptopp/fetch_and_patch.bat
index cbad5321b0..3af781c50a 100644
--- a/contrib/src/cryptopp/fetch_and_patch.bat
+++ b/contrib/src/cryptopp/fetch_and_patch.bat
@@ -1,14 +1,21 @@
 set BUILD=%SRC%..\build
 
 set CRYPTOPP_VERSION=54557b18275053bbfc34594f7e65808dd92dd1a6
-set CRYPTOPP_URL="https://github.com/weidai11/cryptopp.git"
+set CRYPTOPP_URL=https://github.com/weidai11/cryptopp/archive/%CRYPTOPP_VERSION%.tar.gz
 
 mkdir %BUILD%
-cd %BUILD%
 
-git clone %CRYPTOPP_URL%
-cd cryptopp
-git checkout %CRYPTOPP_VERSION%
+if %USE_CACHE%==1 (
+    copy %CACHE_DIR%\%CRYPTOPP_VERSION%.tar.gz %cd%
+) else (
+    wget %CRYPTOPP_URL%
+)
+
+7z -y x %CRYPTOPP_VERSION%.tar.gz && 7z -y x %CRYPTOPP_VERSION%.tar -o%BUILD%
+del %CRYPTOPP_VERSION%.tar && del %CRYPTOPP_VERSION%.tar.gz && del %BUILD%\pax_global_header
+rename %BUILD%\cryptopp-%CRYPTOPP_VERSION% cryptopp
+
+cd %BUILD%\cryptopp
 
 git apply --reject --whitespace=fix %SRC%\cryptopp\cryptopp-uwp.patch
 
diff --git a/contrib/src/ffmpeg/fetch_and_patch.bat b/contrib/src/ffmpeg/fetch_and_patch.bat
index 8002be719b..87b6090740 100644
--- a/contrib/src/ffmpeg/fetch_and_patch.bat
+++ b/contrib/src/ffmpeg/fetch_and_patch.bat
@@ -1,16 +1,41 @@
-set BUILD=%SRC%..\build
-
-set FFMPEG_URL=git://github.com/Microsoft/FFmpegInterop.git
-
-mkdir %BUILD%
-cd %BUILD%
-
-git clone --recursive %FFMPEG_URL%
-
-cd FFmpegInterop
-git apply --reject --whitespace=fix %SRC%\ffmpeg\ffmpeg-uwp.patch
-
-cd ffmpeg
-git apply --reject --whitespace=fix %SRC%\ffmpeg\0004-avformat-fix-find_stream_info-not-considering-extradata.patch
-
+set BUILD=%SRC%..\build
+
+set FFMPEGINTEROP_VERSION=6f8062f68176a23d4cbc953668677edb07fd7984
+set FFMPEGINTEROP_URL=https://github.com/Microsoft/FFmpegInterop/archive/%FFMPEGINTEROP_VERSION%.tar.gz
+
+mkdir %BUILD%
+
+if %USE_CACHE%==1 (
+    copy %CACHE_DIR%\%FFMPEGINTEROP_VERSION%.tar.gz %cd%
+) else (
+    wget %FFMPEGINTEROP_URL%
+)
+
+7z -y x %FFMPEGINTEROP_VERSION%.tar.gz && 7z -y x %FFMPEGINTEROP_VERSION%.tar -o%BUILD%
+del %FFMPEGINTEROP_VERSION%.tar && del %FFMPEGINTEROP_VERSION%.tar.gz && del %BUILD%\pax_global_header
+rename %BUILD%\FFmpegInterop-%FFMPEGINTEROP_VERSION% FFmpegInterop
+
+cd %BUILD%\FFmpegInterop
+
+rmdir /s /q ffmpeg
+
+git apply --reject --whitespace=fix %SRC%\ffmpeg\ffmpeg-uwp.patch
+
+set FFMPEG_VERSION=12320c08221f0eecf6d9af3a6f12f42e656f0674
+set FFMPEG_URL=https://github.com/FFmpeg/FFmpeg/archive/%FFMPEG_VERSION%.tar.gz
+
+if %USE_CACHE%==1 (
+    copy %CACHE_DIR%\%FFMPEG_VERSION%.tar.gz %cd%
+) else (
+    wget %FFMPEG_URL%
+)
+
+7z -y x %FFMPEG_VERSION%.tar.gz && 7z -y x %FFMPEG_VERSION%.tar
+del %FFMPEG_VERSION%.tar && del %FFMPEG_VERSION%.tar.gz && del pax_global_header
+rename FFmpeg-%FFMPEG_VERSION% ffmpeg
+
+cd ffmpeg
+
+git apply --reject --whitespace=fix %SRC%\ffmpeg\0004-avformat-fix-find_stream_info-not-considering-extradata.patch
+
 cd %SRC%
\ No newline at end of file
diff --git a/contrib/src/gmp/fetch_and_patch.bat b/contrib/src/gmp/fetch_and_patch.bat
index 2a4937d89c..1fb83c7614 100644
--- a/contrib/src/gmp/fetch_and_patch.bat
+++ b/contrib/src/gmp/fetch_and_patch.bat
@@ -1,16 +1,22 @@
 set BUILD=%SRC%..\build
 
 set GMP_VERSION=3c8f5a0ae0c2ac9ff0ea31b27f71b152979b556d
-set GMP_URL="https://github.com/ShiftMediaProject/gmp.git"
+set GMP_URL=https://github.com/ShiftMediaProject/gmp/archive/%GMP_VERSION%.tar.gz
 
 mkdir %BUILD%
-cd %BUILD%
 
-git clone %GMP_URL%
-cd %GMP_URL%
-git checkout %GMP_VERSION%
+if %USE_CACHE%==1 (
+    copy %CACHE_DIR%\%GMP_VERSION%.tar.gz %cd%
+) else (
+    wget %GMP_URL%
+)
+
+7z -y x %GMP_VERSION%.tar.gz && 7z -y x %GMP_VERSION%.tar -o%BUILD%
+del %GMP_VERSION%.tar && del %GMP_VERSION%.tar.gz && del %BUILD%\pax_global_header
+rename %BUILD%\gmp-%GMP_VERSION% gmp
+
+cd %BUILD%\gmp
 
-cd gmp
 git apply --reject --whitespace=fix %SRC%\gmp\gmp-uwp.patch
 
 cd %SRC%
\ No newline at end of file
diff --git a/contrib/src/gnutls/fetch_and_patch.bat b/contrib/src/gnutls/fetch_and_patch.bat
index 6486c0ed56..5c25b52ee8 100644
--- a/contrib/src/gnutls/fetch_and_patch.bat
+++ b/contrib/src/gnutls/fetch_and_patch.bat
@@ -1,10 +1,21 @@
 set BUILD=%SRC%..\build
 
+set GNUTLS_VERSION=f2d0ade53ff644da55244aed79d05eca78d11a2f
+set GNUTLS_URL=https://github.com/ShiftMediaProject/gnutls/archive/%GNUTLS_VERSION%.tar.gz
+
 mkdir %BUILD%
-cd %BUILD%
-git clone https://github.com/ShiftMediaProject/gnutls.git
 
-cd gnutls
+if %USE_CACHE%==1 (
+    copy %CACHE_DIR%\%GNUTLS_VERSION%.tar.gz %cd%
+) else (
+    wget %GNUTLS_URL%
+)
+
+7z -y x %GNUTLS_VERSION%.tar.gz && 7z -y x %GNUTLS_VERSION%.tar -o%BUILD%
+del %GNUTLS_VERSION%.tar && del %GNUTLS_VERSION%.tar.gz && del %BUILD%\pax_global_header
+rename %BUILD%\gnutls-%GNUTLS_VERSION% gnutls
+
+cd %BUILD%\gnutls
 
 git apply --reject --whitespace=fix %SRC%\gnutls\gnutls-no-egd.patch
 git apply --reject --whitespace=fix %SRC%\gnutls\read-file-limits.h.patch
diff --git a/contrib/src/gnutls/gnutls-uwp.patch b/contrib/src/gnutls/gnutls-uwp.patch
index a934b483e3..6085027964 100644
--- a/contrib/src/gnutls/gnutls-uwp.patch
+++ b/contrib/src/gnutls/gnutls-uwp.patch
@@ -119,16 +119,7 @@
 +    <OutDir>$(ProjectDir)..\..\</OutDir>
      <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
    </PropertyGroup>
-   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-@@ -795,7 +795,7 @@
-     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
-   </PropertyGroup>
-   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
--    <IntDir>$(SolutionDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
-+    <IntDir>$(ProjectDir)obj\$(Configuration)\$(Platform)\$(ProjectName)\</IntDir>
-     <TargetName>libgnutls</TargetName>
-     <OutDir>$(ProjectDir)..\..\..\msvc\</OutDir>
-     <CustomBuildAfterTargets>Clean</CustomBuildAfterTargets>
+   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
 @@ -1834,7 +1834,7 @@ del /f /q $(OutDir)\licenses\gnutls.txt
        <BufferSecurityCheck>false</BufferSecurityCheck>
        <FloatingPointModel>Fast</FloatingPointModel>
diff --git a/contrib/src/iconv/fetch_and_patch.bat b/contrib/src/iconv/fetch_and_patch.bat
index 321d451389..b7503aa3fe 100644
--- a/contrib/src/iconv/fetch_and_patch.bat
+++ b/contrib/src/iconv/fetch_and_patch.bat
@@ -1,13 +1,22 @@
 set BUILD=%SRC%..\build
 
-set REPOURL="https://github.com/ShiftMediaProject/libiconv.git"
+set ICONV_VERSION=65ab92f7a1699ecc39e37fb81f66e5a42aaa35c4
+set ICONV_URL=https://github.com/ShiftMediaProject/libiconv/archive/%ICONV_VERSION%.tar.gz
 
 mkdir %BUILD%
-cd %BUILD%
 
-git clone %REPOURL%
+if %USE_CACHE%==1 (
+    copy %CACHE_DIR%\%ICONV_VERSION%.tar.gz %cd%
+) else (
+    wget %ICONV_URL%
+)
+
+7z -y x %ICONV_VERSION%.tar.gz && 7z -y x %ICONV_VERSION%.tar -o%BUILD%
+del %ICONV_VERSION%.tar && del %ICONV_VERSION%.tar.gz && del %BUILD%\pax_global_header
+rename %BUILD%\libiconv-%ICONV_VERSION% libiconv
+
+cd %BUILD%\libiconv
 
-cd libiconv
 git apply --reject --whitespace=fix %SRC%\iconv\libiconv-uwp.patch
 
 cd %SRC%
\ No newline at end of file
diff --git a/contrib/src/jsoncpp/fetch_and_patch.bat b/contrib/src/jsoncpp/fetch_and_patch.bat
index 9aa56ba1f8..57707f8900 100644
--- a/contrib/src/jsoncpp/fetch_and_patch.bat
+++ b/contrib/src/jsoncpp/fetch_and_patch.bat
@@ -1,12 +1,21 @@
 set BUILD=%SRC%..\build
 
-set REPOURL="https://github.com/open-source-parsers/jsoncpp.git"
+set JSONCPP_VERSION=81065748e315026017c633fca1bfc57cba5b246a
+set JSONCPP_URL=https://github.com/open-source-parsers/jsoncpp/archive/%JSONCPP_VERSION%.tar.gz
 
 mkdir %BUILD%
-cd %BUILD%
 
-git clone %REPOURL%
-cd jsoncpp
+if %USE_CACHE%==1 (
+    copy %CACHE_DIR%\%JSONCPP_VERSION%.tar.gz %cd%
+) else (
+    wget %JSONCPP_URL%
+)
+
+7z -y x %JSONCPP_VERSION%.tar.gz && 7z -y x %JSONCPP_VERSION%.tar -o%BUILD%
+del %JSONCPP_VERSION%.tar && del %JSONCPP_VERSION%.tar.gz && del %BUILD%\pax_global_header
+rename %BUILD%\jsoncpp-%JSONCPP_VERSION% jsoncpp
+
+cd %BUILD%\jsoncpp
 
 git apply --reject --whitespace=fix %SRC%\jsoncpp\jsoncpp-uwp.patch
 
diff --git a/contrib/src/msgpack/fetch_and_patch.bat b/contrib/src/msgpack/fetch_and_patch.bat
index a1103cbc22..424c36f1cf 100644
--- a/contrib/src/msgpack/fetch_and_patch.bat
+++ b/contrib/src/msgpack/fetch_and_patch.bat
@@ -1,14 +1,21 @@
 set BUILD=%SRC%..\build
 
 set MSGPACK_VERSION=1df97bc37b363a340c5ad06c5cbcc53310aaff80
-set MSGPACK_URL="https://github.com/msgpack/msgpack-c.git"
+set MSGPACK_URL=https://github.com/msgpack/msgpack-c/archive/%MSGPACK_VERSION%.tar.gz
 
 mkdir %BUILD%
-cd %BUILD%
 
-git clone %MSGPACK_URL%
-cd msgpack-c
-git checkout %MSGPACK_VERSION%
+if %USE_CACHE%==1 (
+    copy %CACHE_DIR%\%MSGPACK_VERSION%.tar.gz %cd%
+) else (
+    wget %MSGPACK_URL%
+)
+
+7z -y x %MSGPACK_VERSION%.tar.gz && 7z -y x %MSGPACK_VERSION%.tar -o%BUILD%
+del %MSGPACK_VERSION%.tar && del %MSGPACK_VERSION%.tar.gz && del %BUILD%\pax_global_header
+rename %BUILD%\msgpack-c-%MSGPACK_VERSION% msgpack-c
+
+cd %BUILD%\msgpack-c
 
 git apply --reject --whitespace=fix %SRC%\msgpack\msgpack-uwp.patch
 
diff --git a/contrib/src/nettle/fetch_and_patch.bat b/contrib/src/nettle/fetch_and_patch.bat
index 3d5a8291e0..6146062f97 100644
--- a/contrib/src/nettle/fetch_and_patch.bat
+++ b/contrib/src/nettle/fetch_and_patch.bat
@@ -1,13 +1,22 @@
 set BUILD=%SRC%..\build
 
-set REPOURL="https://github.com/ShiftMediaProject/nettle.git"
+set NETTLE_VERSION=4e0b2723b76d4163fa37b2b456d41534154ec97c
+set NETTLE_URL=https://github.com/ShiftMediaProject/nettle/archive/%NETTLE_VERSION%.tar.gz
 
 mkdir %BUILD%
-cd %BUILD%
 
-git clone %REPOURL%
+if %USE_CACHE%==1 (
+    copy %CACHE_DIR%\%NETTLE_VERSION%.tar.gz %cd%
+) else (
+    wget %NETTLE_URL%
+)
+
+7z -y x %NETTLE_VERSION%.tar.gz && 7z -y x %NETTLE_VERSION%.tar -o%BUILD%
+del %NETTLE_VERSION%.tar && del %NETTLE_VERSION%.tar.gz && del %BUILD%\pax_global_header
+rename %BUILD%\nettle-%NETTLE_VERSION% nettle
+
+cd %BUILD%\nettle
 
-cd nettle
 git apply --reject --whitespace=fix %SRC%\nettle\nettle-uwp.patch
 
 cd %SRC%
\ No newline at end of file
diff --git a/contrib/src/opendht/fetch_and_patch.bat b/contrib/src/opendht/fetch_and_patch.bat
index 6dd94dc1de..309623c1c5 100644
--- a/contrib/src/opendht/fetch_and_patch.bat
+++ b/contrib/src/opendht/fetch_and_patch.bat
@@ -1,13 +1,18 @@
 set BUILD=%SRC%..\build
 
 set OPENDHT_VERSION=3fb7c2acfe098b18908d1803e5aaa2437d878af4
-set OPENDHT_URL="https://github.com/savoirfairelinux/opendht.git"
+set OPENDHT_URL=https://github.com/savoirfairelinux/opendht/archive/%OPENDHT_VERSION%.tar.gz
 
 mkdir %BUILD%
-cd %BUILD%
 
-git clone %OPENDHT_URL%
-cd opendht
-git checkout %OPENDHT_VERSION%
+if %USE_CACHE%==1 (
+    copy %CACHE_DIR%\%OPENDHT_VERSION%.tar.gz %cd%
+) else (
+    wget %OPENDHT_URL%
+)
+
+7z -y x %OPENDHT_VERSION%.tar.gz && 7z -y x %OPENDHT_VERSION%.tar -o%BUILD%
+del %OPENDHT_VERSION%.tar && del %OPENDHT_VERSION%.tar.gz && del %BUILD%\pax_global_header
+rename %BUILD%\opendht-%OPENDHT_VERSION% opendht
 
 cd %SRC%
\ No newline at end of file
diff --git a/contrib/src/pcre/fetch_and_patch.bat b/contrib/src/pcre/fetch_and_patch.bat
index 7b14469efc..4227a3577f 100644
--- a/contrib/src/pcre/fetch_and_patch.bat
+++ b/contrib/src/pcre/fetch_and_patch.bat
@@ -5,7 +5,13 @@ set PCRE_URL=ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre
 set PCRE_NAME=pcre
 
 mkdir %BUILD%
-wget %PCRE_URL%/%PCRE_NAME%-%PCRE_VERSION%.zip
+
+if %USE_CACHE%==1 (
+    copy %CACHE_DIR%\%PCRE_NAME%-%PCRE_VERSION%.zip %cd%
+) else (
+    wget %PCRE_URL%/%PCRE_NAME%-%PCRE_VERSION%.zip
+)
+
 unzip -q %PCRE_NAME%-%PCRE_VERSION%.zip -d %BUILD%
 del %PCRE_NAME%-%PCRE_VERSION%.zip
 rename %BUILD%\%PCRE_NAME%-%PCRE_VERSION% %PCRE_NAME%
diff --git a/contrib/src/pjproject/fetch_and_patch.bat b/contrib/src/pjproject/fetch_and_patch.bat
index 1fd1bf7fff..a4ebf1dde2 100644
--- a/contrib/src/pjproject/fetch_and_patch.bat
+++ b/contrib/src/pjproject/fetch_and_patch.bat
@@ -1,7 +1,13 @@
 set BUILD=%SRC%..\build
 
 mkdir %BUILD%
-wget http://www.pjsip.org/release/2.5.5/pjproject-2.5.5.zip
+
+if %USE_CACHE%==1 (
+    copy %CACHE_DIR%\pjproject-2.5.5.zip %cd%
+) else (
+    wget http://www.pjsip.org/release/2.5.5/pjproject-2.5.5.zip
+)
+
 unzip -q pjproject-2.5.5.zip -d %BUILD%
 del pjproject-2.5.5.zip
 rename %BUILD%\pjproject-2.5.5 pjproject
diff --git a/contrib/src/portaudio/fetch_and_patch.bat b/contrib/src/portaudio/fetch_and_patch.bat
index 94a9cd832e..506997d03d 100644
--- a/contrib/src/portaudio/fetch_and_patch.bat
+++ b/contrib/src/portaudio/fetch_and_patch.bat
@@ -4,7 +4,13 @@ set PA_VERSION=v190600_20161030
 set PA_URL="http://www.portaudio.com/archives/pa_stable_%PA_VERSION%.tgz"
 
 mkdir %BUILD%
-wget %PA_URL%
+
+if %USE_CACHE%==1 (
+    copy %CACHE_DIR%\pa_stable_%PA_VERSION%.tgz %cd%
+) else (
+    wget %PA_URL%
+)
+
 7z -y e pa_stable_%PA_VERSION%.tgz && 7z -y x pa_stable_%PA_VERSION%.tar -o%BUILD%
 del pa_stable_%PA_VERSION%.tgz && del pa_stable_%PA_VERSION%.tar
 
diff --git a/contrib/src/pthreads/fetch_and_patch.bat b/contrib/src/pthreads/fetch_and_patch.bat
index 780a4e0605..42acb3500b 100644
--- a/contrib/src/pthreads/fetch_and_patch.bat
+++ b/contrib/src/pthreads/fetch_and_patch.bat
@@ -3,7 +3,13 @@ set BUILD=%SRC%..\build
 set PTHREADS_URL="ftp://sourceware.org/pub/pthreads-win32/pthreads-w32-2-9-1-release.zip"
 
 mkdir %BUILD%
-wget %PTHREADS_URL%
+
+if %USE_CACHE%==1 (
+    copy %CACHE_DIR%\pthreads-w32-2-9-1-release.zip %cd%
+) else (
+    wget %PTHREADS_URL%
+)
+
 7z -y x pthreads-w32-2-9-1-release.zip -o%BUILD%
 del pthreads-w32-2-9-1-release.zip
 rmdir /Q /S %BUILD%\QueueUserAPCEx && rmdir /Q /S %BUILD%\Pre-built.2
diff --git a/contrib/src/restbed/fetch_and_patch.bat b/contrib/src/restbed/fetch_and_patch.bat
index 61059c5904..644b0c1790 100644
--- a/contrib/src/restbed/fetch_and_patch.bat
+++ b/contrib/src/restbed/fetch_and_patch.bat
@@ -1,22 +1,69 @@
 set BUILD=%SRC%..\build
 
 set RESTBED_VERSION=34187502642144ab9f749ab40f5cdbd8cb17a54a
-set RESTBED_URL="https://github.com/Corvusoft/restbed.git"
+set RESTBED_URL=https://github.com/Corvusoft/restbed/archive/%RESTBED_VERSION%.tar.gz
 
 mkdir %BUILD%
-cd %BUILD%
-
-git clone %RESTBED_URL%
-cd restbed
-git checkout %RESTBED_VERSION%
-git apply --reject --whitespace=fix %SRC%\restbed\openssl-repo-uwp.patch
-git submodule update --init --recursive
-git submodule foreach git pull origin master
-cd dependency\asio
+
+if %USE_CACHE%==1 (
+    copy %CACHE_DIR%\%RESTBED_VERSION%.tar.gz %cd%
+) else (
+    wget %RESTBED_URL%
+)
+
+7z -y x %RESTBED_VERSION%.tar.gz && 7z -y x %RESTBED_VERSION%.tar -o%BUILD%
+del %RESTBED_VERSION%.tar && del %RESTBED_VERSION%.tar.gz && del %BUILD%\pax_global_header
+rename %BUILD%\restbed-%RESTBED_VERSION% restbed
+
+rmdir /s /q %BUILD%\restbed\dependency
+mkdir %BUILD%\restbed\dependency
+cd %BUILD%\restbed\dependency
+
+set ASIO_VERSION=276846097ab5073b67e772dbdfa12596224a54a5
+set ASIO_URL=https://github.com/Corvusoft/asio-dependency/archive/%ASIO_VERSION%.tar.gz
+
+if %USE_CACHE%==1 (
+    copy %CACHE_DIR%\%ASIO_VERSION%.tar.gz %cd%
+) else (
+    wget %ASIO_URL%
+)
+
+7z -y x %ASIO_VERSION%.tar.gz && 7z -y x %ASIO_VERSION%.tar
+del %ASIO_VERSION%.tar && del %ASIO_VERSION%.tar.gz && del pax_global_header
+rename asio-dependency-%ASIO_VERSION% asio
+
+cd asio
 git apply --reject --whitespace=fix %SRC%\restbed\asio-uwp.patch
 
-cd ..\openssl
-git checkout OpenSSL_1_0_2_WinRT-stable
+cd ..
+
+set CATCH_VERSION=35f510545d55a831372d3113747bf1314ff4f2ef
+set CATCH_URL=https://github.com/Corvusoft/catch-dependency/archive/%CATCH_VERSION%.tar.gz
+
+if %USE_CACHE%==1 (
+    copy %CACHE_DIR%\%CATCH_VERSION%.tar.gz %cd%
+) else (
+    wget %CATCH_URL%
+)
+
+7z -y x %CATCH_VERSION%.tar.gz && 7z -y x %CATCH_VERSION%.tar
+del %CATCH_VERSION%.tar && del %CATCH_VERSION%.tar.gz && del pax_global_header
+rename catch-dependency-%CATCH_VERSION% catch
+
+set OPENSSL_VERSION=c7ba244789ce9f9b6675ff88e61dd5d5e5cac53e
+set OPENSSL_URL=https://github.com/Microsoft/openssl/archive/%OPENSSL_VERSION%.tar.gz
+
+if %USE_CACHE%==1 (
+    copy %CACHE_DIR%\%OPENSSL_VERSION%.tar.gz %cd%
+) else (
+    wget %OPENSSL_URL%
+)
+
+7z -y x %OPENSSL_VERSION%.tar.gz && 7z -y x %OPENSSL_VERSION%.tar
+del %OPENSSL_VERSION%.tar && del %OPENSSL_VERSION%.tar.gz && del pax_global_header
+rename openssl-%OPENSSL_VERSION% openssl
+
+cd openssl
 git apply --reject --whitespace=fix %SRC%\restbed\openssl-uwp.patch
 
 cd %SRC%
\ No newline at end of file
diff --git a/contrib/src/restbed/openssl-repo-uwp.patch b/contrib/src/restbed/openssl-repo-uwp.patch
deleted file mode 100644
index 3626602167..0000000000
--- a/contrib/src/restbed/openssl-repo-uwp.patch
+++ /dev/null
@@ -1,13 +0,0 @@
---- a/.gitmodules
-+++ b/.gitmodules
-@@ -8,5 +8,5 @@
- 	branch = master
- [submodule "dependency/openssl"]
- 	path = dependency/openssl
--	url = https://github.com/corvusoft/openssl-dependency
--	branch = OpenSSL_1_0_2-stable
-+	url = https://github.com/Microsoft/openssl
-+	branch = OpenSSL_1_0_2_WinRT-stable
--- 
-2.8.1.windows.1
-
diff --git a/contrib/src/samplerate/fetch_and_patch.bat b/contrib/src/samplerate/fetch_and_patch.bat
index 99d76f3969..a9757c95ff 100644
--- a/contrib/src/samplerate/fetch_and_patch.bat
+++ b/contrib/src/samplerate/fetch_and_patch.bat
@@ -4,7 +4,13 @@ set SAMPLERATE_VERSION=0.1.8
 set SAMPLERATE_URL="http://www.mega-nerd.com/SRC/libsamplerate-%SAMPLERATE_VERSION%.tar.gz"
 
 mkdir %BUILD%
-wget %SAMPLERATE_URL%
+
+if %USE_CACHE%==1 (
+    copy %CACHE_DIR%\libsamplerate-%SAMPLERATE_VERSION%.tar.gz %cd%
+) else (
+    wget %SAMPLERATE_URL%
+)
+
 7z -y e libsamplerate-%SAMPLERATE_VERSION%.tar.gz  && 7z -y x libsamplerate-%SAMPLERATE_VERSION%.tar -o%BUILD%
 del libsamplerate-%SAMPLERATE_VERSION%.tar && del libsamplerate-%SAMPLERATE_VERSION%.tar.gz
 rename %BUILD%\libsamplerate-%SAMPLERATE_VERSION% libsamplerate
diff --git a/contrib/src/upnp/fetch_and_patch.bat b/contrib/src/upnp/fetch_and_patch.bat
index 9e33b15b49..df06dd19e4 100644
--- a/contrib/src/upnp/fetch_and_patch.bat
+++ b/contrib/src/upnp/fetch_and_patch.bat
@@ -4,7 +4,13 @@ set UPNP_VERSION=1.6.19
 set UPNP_URL=https://github.com/mrjimenez/pupnp/archive/release-%UPNP_VERSION%.tar.gz
 
 mkdir %BUILD%
-wget %UPNP_URL%
+
+if %USE_CACHE%==1 (
+    copy %CACHE_DIR%\release-%UPNP_VERSION%.tar.gz %cd%
+) else (
+    wget %UPNP_URL%
+)
+
 7z -y x release-%UPNP_VERSION%.tar.gz && 7z -y x release-%UPNP_VERSION%.tar -o%BUILD%
 del release-%UPNP_VERSION%.tar && del release-%UPNP_VERSION%.tar.gz && del %BUILD%\pax_global_header
 rename %BUILD%\pupnp-release-%UPNP_VERSION% libupnp
diff --git a/contrib/src/yaml-cpp/fetch_and_patch.bat b/contrib/src/yaml-cpp/fetch_and_patch.bat
index 48c30912eb..9d0e62eb56 100644
--- a/contrib/src/yaml-cpp/fetch_and_patch.bat
+++ b/contrib/src/yaml-cpp/fetch_and_patch.bat
@@ -1,14 +1,21 @@
 set BUILD=%SRC%..\build
 
 set YAMLCPP_VERSION=24fa1b33805c9a91df0f32c46c28e314dd7ad96f
-set YAMLCPP_URL="https://github.com/jbeder/yaml-cpp.git"
+set YAMLCPP_URL=https://github.com/jbeder/yaml-cpp/archive/%YAMLCPP_VERSION%.tar.gz
 
 mkdir %BUILD%
-cd %BUILD%
 
-git clone %YAMLCPP_URL%
-cd yaml-cpp
-git checkout %YAMLCPP_VERSION%
+if %USE_CACHE%==1 (
+    copy %CACHE_DIR%\%YAMLCPP_VERSION%.tar.gz %cd%
+) else (
+    wget %YAMLCPP_URL%
+)
+
+7z -y x %YAMLCPP_VERSION%.tar.gz && 7z -y x %YAMLCPP_VERSION%.tar -o%BUILD%
+del %YAMLCPP_VERSION%.tar && del %YAMLCPP_VERSION%.tar.gz && del %BUILD%\pax_global_header
+rename %BUILD%\yaml-cpp-%YAMLCPP_VERSION% yaml-cpp
+
+cd %BUILD%\yaml-cpp
 
 git apply --reject --whitespace=fix %SRC%\yaml-cpp\yaml-cpp-uwp.patch
 
diff --git a/contrib/src/zlib/fetch_and_patch.bat b/contrib/src/zlib/fetch_and_patch.bat
index 8f8937ca61..59f25a966c 100644
--- a/contrib/src/zlib/fetch_and_patch.bat
+++ b/contrib/src/zlib/fetch_and_patch.bat
@@ -1,13 +1,22 @@
 set BUILD=%SRC%..\build
 
-set REPOURL="https://github.com/ShiftMediaProject/zlib.git"
+set ZLIB_VERSION=3a062eb61d0c3d4aa30851cd1a6597b977b56597
+set ZLIB_URL=https://github.com/ShiftMediaProject/zlib/archive/%ZLIB_VERSION%.tar.gz
 
 mkdir %BUILD%
-cd %BUILD%
 
-git clone %REPOURL%
+if %USE_CACHE%==1 (
+    copy %CACHE_DIR%\%ZLIB_VERSION%.tar.gz %cd%
+) else (
+    wget %ZLIB_URL%
+)
+
+7z -y x %ZLIB_VERSION%.tar.gz && 7z -y x %ZLIB_VERSION%.tar -o%BUILD%
+del %ZLIB_VERSION%.tar && del %ZLIB_VERSION%.tar.gz && del %BUILD%\pax_global_header
+rename %BUILD%\zlib-%ZLIB_VERSION% zlib
+
+cd %BUILD%\zlib
 
-cd zlib
 git apply --reject --whitespace=fix %SRC%\zlib\zlib-uwp.patch
 
 cd %SRC%
\ No newline at end of file
-- 
GitLab