From e7787d3eb34789ba51e1692b40e3b4f4482e26e0 Mon Sep 17 00:00:00 2001
From: WolverinDEV <Myhu2106>
Date: Sun, 9 Feb 2020 00:17:15 +0100
Subject: [PATCH] Updating revs

---
 build-helpers                  |  2 +-
 scripts                        |  1 -
 third_party/Thread-Pool        |  2 +-
 third_party/build.sh           | 37 ++++++++++++++++++++++++++++++++--
 third_party/build_boringssl.sh |  3 ++-
 try_build.sh                   | 12 +++++++++++
 6 files changed, 51 insertions(+), 6 deletions(-)
 delete mode 160000 scripts
 create mode 100644 try_build.sh

diff --git a/build-helpers b/build-helpers
index 4e3b448..c212df4 160000
--- a/build-helpers
+++ b/build-helpers
@@ -1 +1 @@
-Subproject commit 4e3b4489a7031067fbceaf1813c00e5f23658383
+Subproject commit c212df42345816ea0e73cd466718f75d9926c4a2
diff --git a/scripts b/scripts
deleted file mode 160000
index 0b83e74..0000000
--- a/scripts
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 0b83e74e2df4b084d256ea3cea0be64e01ef6da3
diff --git a/third_party/Thread-Pool b/third_party/Thread-Pool
index e1b135f..d858eb8 160000
--- a/third_party/Thread-Pool
+++ b/third_party/Thread-Pool
@@ -1 +1 @@
-Subproject commit e1b135f17de008fd1f5c036f153a5be9032a917d
+Subproject commit d858eb8b3aec7f9d2e9d308d0564a8a267710f64
diff --git a/third_party/build.sh b/third_party/build.sh
index 8665053..18b1f68 100755
--- a/third_party/build.sh
+++ b/third_party/build.sh
@@ -4,11 +4,24 @@
 cd $(dirname $0)
 
 export build_helper_file="../build-helpers/build_helper.sh"
+build_helper_scripts="../build-helpers/libraries"
+
 source ${build_helper_file}
 [[ $build_helpers_defined -ne 1 ]] && {
     echo "Failed to include build helpers."
     exit 1
 }
+
+[[ -z "${build_os_type}" ]] && {
+  echo "Missing build os type. Using \"linux\""
+  export build_os_type="linux"
+}
+
+[[ -z "${build_os_arch}" ]] && {
+  echo "Missing build os arch. Using \"amd64\""
+  export build_os_arch="amd64"
+}
+
 begin_task "build_third_party" "Building libraries"
 
 function exec_script() {
@@ -28,6 +41,26 @@ function exec_script() {
     echo ""
 }
 
+
+function exec_script_external() {
+    name=$(echo "$1" | sed -n -E 's:^build_(.*)\.sh:\1:p')
+    begin_task "build_$name" "Building $name"
+
+    echo -e "Building library with script $color_green${1}$color_normal"
+    _prefix="library_path=\"$2\" ${*:3}"
+    eval $_prefix ./${build_helper_scripts}/"${1}"
+    code=$?
+    if [[ $code -ne 0 ]]; then
+        echo "Failed to build library $name. Status code: $code"
+        exit 1
+    fi
+
+    #Log the result
+    end_task "build_$name" "Finished $name"
+    echo ""
+}
+
+
 exec_script build_boringssl.sh
 [[ ${build_os_type} != "win32" ]] && exec_script build_breakpad.sh #Not required for windows TeaClient
 exec_script build_libevent.sh
@@ -39,8 +72,8 @@ exec_script build_jsoncpp.sh
 exec_script build_opus.sh
 exec_script build_libfvad.sh
 exec_script build_soxr.sh
-exec_script build_portaudio.sh
-exec_script build_protobuf.sh
+#exec_script build_portaudio.sh
+exec_script_external build_protobuf.sh protobuf
 exec_script build_unbound.sh
 exec_script build_spdlog.sh
 exec_script build_stringvariable.sh
diff --git a/third_party/build_boringssl.sh b/third_party/build_boringssl.sh
index 053e8af..6841bcb 100755
--- a/third_party/build_boringssl.sh
+++ b/third_party/build_boringssl.sh
@@ -61,7 +61,8 @@ if [[ ${build_os_type} == "linux" ]]; then
     check_err_exit ${library_path} "Failed to build!"
     #make install
 elif [[ ${build_os_type} == "win32" ]]; then
-    cmake ../../ -G"Visual Studio 14 2015 Win64" -DOPENSSL_NO_ASM=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=. -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded"
+#    cmake ../../ -G"Visual Studio 14 2015 Win64" -DOPENSSL_NO_ASM=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=. -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded"
+    cmake ../../ ${build_cmake_generator} -DOPENSSL_NO_ASM=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=. -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreaded"
     check_err_exit ${library_path} "Failed generate build files!"
 
     cmake --build .  --target crypto --config release -j 8
diff --git a/try_build.sh b/try_build.sh
new file mode 100644
index 0000000..fdb8cf9
--- /dev/null
+++ b/try_build.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+
+#'/c/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/Tools/VsDevCmd.bat' -arch=amd64 -host_arch=amd64
+
+
+export build_os_type=win32
+export build_os_arch=amd64
+export build_cmake_generator="-Ax64"
+
+./third_party/build.sh || exit 1
+./build_shared.sh
+./build_client.sh