From 35a677c4f446a8d00fadc1e113fce043d59ebd57 Mon Sep 17 00:00:00 2001
From: Ilya Kitaev <mbg033@gmail.com>
Date: Thu, 13 Oct 2016 00:10:00 +0300
Subject: [PATCH 01/12] Windows build documentation in progress

---
 README.md | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/README.md b/README.md
index 072c29b9..6c506cc6 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,3 @@
-# Monero Core
 
 Copyright (c) 2014-2016, The Monero Project
 
@@ -144,4 +143,22 @@ TODO
   
 ### On Windows:
 
-TODO
+1. Install [msys2](http://msys2.github.io/), follow the instructions on that page on how to update packages to the latest versions
+2. Install monero dependencies as described in [monero documentation](https://github.com/monero-project/monero)
+3. Install git:
+
+    ```
+    pacman -S git
+    ```
+4. Install Qt5:
+- if you need to build x86 application, install:
+  
+     ```
+     pacman -S mingw-w64-i686-qt5
+     ```
+
+- if you need to build x64 application, install:
+
+    ```
+    pacman -S mingw-w64-x86_64-qt5
+    ```

From 82a6aff5a476051ea66b0087a38f49323371aa20 Mon Sep 17 00:00:00 2001
From: Ilya Kitaev <mbg033@gmail.com>
Date: Thu, 13 Oct 2016 14:28:11 +0300
Subject: [PATCH 02/12] fix: missed dependency for x86 target

---
 windeploy_helper.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/windeploy_helper.sh b/windeploy_helper.sh
index 7649db64..a3db022a 100644
--- a/windeploy_helper.sh
+++ b/windeploy_helper.sh
@@ -2,7 +2,7 @@
 
 TARGET=$1
 
-FILES="zlib1.dll libwinpthread-1.dll libtiff-5.dll libstdc++-6.dll libpng16-16.dll libpcre16-0.dll libpcre-1.dll libmng-2.dll liblzma-5.dll liblcms2-2.dll libjpeg-8.dll libjasper-1.dll libintl-8.dll libicuuc57.dll libicuin57.dll libicudt57.dll libiconv-2.dll libharfbuzz-0.dll libgraphite2.dll libglib-2.0-0.dll libgcc_s_seh-1.dll libfreetype-6.dll libbz2-1.dll"
+FILES="zlib1.dll libwinpthread-1.dll libtiff-5.dll libstdc++-6.dll libpng16-16.dll libpcre16-0.dll libpcre-1.dll libmng-2.dll liblzma-5.dll liblcms2-2.dll libjpeg-8.dll libjasper-1.dll libintl-8.dll libicuuc57.dll libicuin57.dll libicudt57.dll libiconv-2.dll libharfbuzz-0.dll libgraphite2.dll libglib-2.0-0.dll libgcc_s_seh-1.dll libgcc_s_dw2-1.dll libfreetype-6.dll libbz2-1.dll"
 
 for f in $FILES; do cp $MSYSTEM_PREFIX/bin/$f $TARGET; done
 

From 2d0a4caf763ff6d5d57a3c450929d737f5cd3a35 Mon Sep 17 00:00:00 2001
From: Ilya Kitaev <mbg033@gmail.com>
Date: Thu, 13 Oct 2016 15:35:57 +0300
Subject: [PATCH 03/12] documentation: updated build steps

---
 README.md | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 6c506cc6..924344e3 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,3 @@
-
 Copyright (c) 2014-2016, The Monero Project
 
 ## Development Resources
@@ -162,3 +161,24 @@ TODO
     ```
     pacman -S mingw-w64-x86_64-qt5
     ```
+5. Open ```mingw``` shell. MSYS2 will install start menu items for both mingw32 and mingw64 environments, so
+   you need to open appropriate one:
+   ```%MSYS_ROOT%\msys2_shell.cmd -mingw32``` for x86 targed
+   or 
+   ```%MSYS_ROOT%\msys2_shell.cmd -mingw64``` for x64 targed
+
+   Where ```%MSYS_ROOT%``` will be ```c:\msys32``` if your host OS is x86-based or ```c:\msys64``` if your host OS
+   is x64-based
+6. Clone git repository:
+    ```
+    git clone https://github.com/monero-project/monero-core.git
+    ```
+
+7. Build the project:
+  ```
+  cd monero-core
+  ./build.sh
+  ```
+8. Take result binary and dependencies in ```./build/release/bin```
+  
+   

From 39d74f1f200cb32ac4e99dd69f323d8a8c7dfc14 Mon Sep 17 00:00:00 2001
From: Ilya Kitaev <mbg033@gmail.com>
Date: Thu, 13 Oct 2016 15:41:15 +0300
Subject: [PATCH 04/12] windows-build: added missed runtime dlls to x86 config

---
 windeploy_helper.sh | 28 +++++++++++++++++-----------
 1 file changed, 17 insertions(+), 11 deletions(-)

diff --git a/windeploy_helper.sh b/windeploy_helper.sh
index a3db022a..f5dae1f1 100644
--- a/windeploy_helper.sh
+++ b/windeploy_helper.sh
@@ -2,19 +2,25 @@
 
 TARGET=$1
 
-FILES="zlib1.dll libwinpthread-1.dll libtiff-5.dll libstdc++-6.dll libpng16-16.dll libpcre16-0.dll libpcre-1.dll libmng-2.dll liblzma-5.dll liblcms2-2.dll libjpeg-8.dll libjasper-1.dll libintl-8.dll libicuuc57.dll libicuin57.dll libicudt57.dll libiconv-2.dll libharfbuzz-0.dll libgraphite2.dll libglib-2.0-0.dll libgcc_s_seh-1.dll libgcc_s_dw2-1.dll libfreetype-6.dll libbz2-1.dll"
+BUILD_TYPE=$2
+
+echo $BUILD_TYPE
+
+if [[ -z $BUILD_TYPE ]]; then
+	BUILD_TYPE=Release
+fi
+
+if [[ "$BUILD_TYPE" == "Release" ]]; then
+	ICU_FILES="libicuuc57.dll libicuin57.dll libicudt57.dll"
+else
+	echo "Debug build"
+	ICU_FILES="libicuucd57.dll libicuind57.dll libicudtd57.dll"
+fi
+
+FILES="zlib1.dll libwinpthread-1.dll libtiff-5.dll libstdc++-6.dll libpng16-16.dll libpcre16-0.dll libpcre-1.dll libmng-2.dll liblzma-5.dll liblcms2-2.dll libjpeg-8.dll libjasper-1.dll libintl-8.dll  libiconv-2.dll libharfbuzz-0.dll libgraphite2.dll libglib-2.0-0.dll libgcc_s_seh-1.dll libgcc_s_dw2-1.dll libfreetype-6.dll libbz2-1.dll"
 
 for f in $FILES; do cp $MSYSTEM_PREFIX/bin/$f $TARGET; done
 
-
-
-
-
-
-
-
-
-
-
+for f in $ICU_FILES; do cp $MSYSTEM_PREFIX/bin/$f $TARGET; done
 
 

From 4844bd317111f9c00b3ebbc84207fa6746abb45b Mon Sep 17 00:00:00 2001
From: Ilya Kitaev <mbg033@gmail.com>
Date: Thu, 13 Oct 2016 15:41:51 +0300
Subject: [PATCH 05/12] build: added "debug" build option

---
 build.sh | 28 +++++++++++++---------------
 1 file changed, 13 insertions(+), 15 deletions(-)

diff --git a/build.sh b/build.sh
index a8c2a2c3..8d2aebc1 100755
--- a/build.sh
+++ b/build.sh
@@ -1,17 +1,28 @@
 #!/bin/bash
 
+BUILD_TYPE=$1
+if [ -z $BUILD_TYPE ]; then
+    BUILD_TYPE=Release
+fi
+
+
 source ./utils.sh
 pushd $(pwd)
 ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
 MONERO_DIR=monero
 
 if [ ! -d $MONERO_DIR ]; then 
-    $SHELL get_libwallet_api.sh
+    $SHELL get_libwallet_api.sh $BUILD_TYPE
 fi
  
 if [ ! -d build ]; then mkdir build; fi
 
-CONFIG="CONFIG+=release"
+if [ $BUILD_TYPE == "Release" ]; then
+	CONFIG="CONFIG+=release";
+else
+	CONFIG="CONFIG+=debug"
+fi
+
 
 platform=$(get_platform)
 if [ "$platform" == "linux" ]; then
@@ -27,16 +38,3 @@ make
 make deploy
 popd
 
-
-
-
-
-
-
-
-
-
-
-
-
-

From 78274173017791ac46565b97e3cc9cccbd8730c5 Mon Sep 17 00:00:00 2001
From: Ilya Kitaev <mbg033@gmail.com>
Date: Thu, 13 Oct 2016 15:57:54 +0300
Subject: [PATCH 06/12] doc: note regarding 3D acceleration in virtual machine

---
 README.md | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/README.md b/README.md
index 924344e3..40b770f7 100644
--- a/README.md
+++ b/README.md
@@ -175,10 +175,13 @@ TODO
     ```
 
 7. Build the project:
-  ```
-  cd monero-core
-  ./build.sh
-  ```
+    ```
+    cd monero-core
+    ./build.sh
+    ```
 8. Take result binary and dependencies in ```./build/release/bin```
-  
+
+   **important: if you testing application within VirtualBox virtual machine, make sure 3D acceleration is enabled
+   in machine's settings:
+   Machine > Settings > Display > [v] Enable 3D Acceleration**
    

From 653e5f13edacdd5dd836f261ed783bf11eb6ac98 Mon Sep 17 00:00:00 2001
From: Ilya Kitaev <mbg033@gmail.com>
Date: Thu, 13 Oct 2016 16:07:47 +0300
Subject: [PATCH 07/12] doc: fixed formatting issues

---
 README.md | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/README.md b/README.md
index 40b770f7..42c38b1f 100644
--- a/README.md
+++ b/README.md
@@ -150,17 +150,17 @@ TODO
     pacman -S git
     ```
 4. Install Qt5:
-- if you need to build x86 application, install:
+    - if you need to build x86 application, install:
   
-     ```
-     pacman -S mingw-w64-i686-qt5
-     ```
+       ```
+      pacman -S mingw-w64-i686-qt5
+      ```
 
-- if you need to build x64 application, install:
+    - if you need to build x64 application, install:
 
-    ```
-    pacman -S mingw-w64-x86_64-qt5
-    ```
+      ```
+      pacman -S mingw-w64-x86_64-qt5
+      ```
 5. Open ```mingw``` shell. MSYS2 will install start menu items for both mingw32 and mingw64 environments, so
    you need to open appropriate one:
    ```%MSYS_ROOT%\msys2_shell.cmd -mingw32``` for x86 targed

From d35a185079b2c7a30ee13b236cfa48e439cc4118 Mon Sep 17 00:00:00 2001
From: Ilya Kitaev <mbg033@gmail.com>
Date: Tue, 18 Oct 2016 14:50:14 +0300
Subject: [PATCH 08/12] win-build: deploy different dlls for different
 platforms

---
 windeploy_helper.sh | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/windeploy_helper.sh b/windeploy_helper.sh
index f5dae1f1..45a797c5 100644
--- a/windeploy_helper.sh
+++ b/windeploy_helper.sh
@@ -1,26 +1,42 @@
 #!/bin/bash
 
+ROOT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+source $ROOT_DIR/utils.sh
+
+
 TARGET=$1
 
 BUILD_TYPE=$2
 
-echo $BUILD_TYPE
+
+
 
 if [[ -z $BUILD_TYPE ]]; then
 	BUILD_TYPE=Release
 fi
 
 if [[ "$BUILD_TYPE" == "Release" ]]; then
+	echo "Release build"
 	ICU_FILES="libicuuc57.dll libicuin57.dll libicudt57.dll"
 else
 	echo "Debug build"
 	ICU_FILES="libicuucd57.dll libicuind57.dll libicudtd57.dll"
 fi
 
-FILES="zlib1.dll libwinpthread-1.dll libtiff-5.dll libstdc++-6.dll libpng16-16.dll libpcre16-0.dll libpcre-1.dll libmng-2.dll liblzma-5.dll liblcms2-2.dll libjpeg-8.dll libjasper-1.dll libintl-8.dll  libiconv-2.dll libharfbuzz-0.dll libgraphite2.dll libglib-2.0-0.dll libgcc_s_seh-1.dll libgcc_s_dw2-1.dll libfreetype-6.dll libbz2-1.dll"
+FILES="zlib1.dll libwinpthread-1.dll libtiff-5.dll libstdc++-6.dll libpng16-16.dll libpcre16-0.dll libpcre-1.dll libmng-2.dll liblzma-5.dll liblcms2-2.dll libjpeg-8.dll libjasper-1.dll libintl-8.dll  libiconv-2.dll libharfbuzz-0.dll libgraphite2.dll libglib-2.0-0.dll libfreetype-6.dll libbz2-1.dll"
+
+platform=$(get_platform)
+
+if [[ "$platform" == "mingw64" ]]; then
+	PLATFORM_FILES="libgcc_s_seh-1.dll" 
+elif [[ "$platform" == "mingw32" ]]; then 
+	PLATFORM_FILES="libgcc_s_dw2-1.dll" 
+fi
 
 for f in $FILES; do cp $MSYSTEM_PREFIX/bin/$f $TARGET; done
 
 for f in $ICU_FILES; do cp $MSYSTEM_PREFIX/bin/$f $TARGET; done
 
+for f in $PLATFORM_FILES; do cp $MSYSTEM_PREFIX/bin/$f $TARGET; done
+
 

From d7e03f9cdeac0415a5df7c16ae5a25328d0fe458 Mon Sep 17 00:00:00 2001
From: Ilya Kitaev <mbg033@gmail.com>
Date: Wed, 19 Oct 2016 15:42:26 +0300
Subject: [PATCH 09/12] build: fixed string comparsion

---
 build.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/build.sh b/build.sh
index 8d2aebc1..6ddcee10 100755
--- a/build.sh
+++ b/build.sh
@@ -17,7 +17,7 @@ fi
  
 if [ ! -d build ]; then mkdir build; fi
 
-if [ $BUILD_TYPE == "Release" ]; then
+if [ "$BUILD_TYPE" == "Release" ]; then
 	CONFIG="CONFIG+=release";
 else
 	CONFIG="CONFIG+=debug"
@@ -35,6 +35,6 @@ fi
 cd build
 qmake ../monero-core.pro "$CONFIG"
 make 
-make deploy
+# make deploy
 popd
 

From 15bfc853058c0917a2c40ab8116f6d7bdc4570c6 Mon Sep 17 00:00:00 2001
From: Ilya Kitaev <mbg033@gmail.com>
Date: Wed, 19 Oct 2016 15:44:03 +0300
Subject: [PATCH 10/12] windows-build: increased stack for x86 build as
 libwallet allocates 2Mb of stack internally

---
 monero-core.pro | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/monero-core.pro b/monero-core.pro
index f433fd41..d50f704c 100644
--- a/monero-core.pro
+++ b/monero-core.pro
@@ -73,6 +73,17 @@ win32 {
         -lwsock32 \
         -lIphlpapi \
         -lgdi32
+
+
+    !contains(QMAKE_TARGET.arch, x86_64) {
+        message("x86 build")
+        ## Windows x86 (32bit) specific build here
+        QMAKE_LFLAGS += -Wl,--stack,4194304
+    } else {
+        message("x64 build")
+    }
+
+
 }
 
 linux {

From 76c5c11a1be8e81110e136412ec5b543098230e3 Mon Sep 17 00:00:00 2001
From: Ilya Kitaev <mbg033@gmail.com>
Date: Wed, 19 Oct 2016 15:49:11 +0300
Subject: [PATCH 11/12] windows-build-x86: explained why stack is increased

---
 monero-core.pro | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/monero-core.pro b/monero-core.pro
index d50f704c..3121f109 100644
--- a/monero-core.pro
+++ b/monero-core.pro
@@ -78,6 +78,8 @@ win32 {
     !contains(QMAKE_TARGET.arch, x86_64) {
         message("x86 build")
         ## Windows x86 (32bit) specific build here
+        ## there's 2Mb stack in libwallet allocated internally
+        ## this fixes app crash for x86 Windows build
         QMAKE_LFLAGS += -Wl,--stack,4194304
     } else {
         message("x64 build")

From 5d498be956cf0214af2f05a78dd089702d14d8eb Mon Sep 17 00:00:00 2001
From: Ilya Kitaev <mbg033@gmail.com>
Date: Wed, 19 Oct 2016 21:17:46 +0300
Subject: [PATCH 12/12] removed extra line endings

---
 get_libwallet_api.sh | 10 ----------
 1 file changed, 10 deletions(-)

diff --git a/get_libwallet_api.sh b/get_libwallet_api.sh
index fbba689a..ea1d8b1c 100755
--- a/get_libwallet_api.sh
+++ b/get_libwallet_api.sh
@@ -84,13 +84,3 @@ fi
 
 popd
 
-
-
-
-
-
-
-
-
-
-