Merge branch 'master' of github.com:dch/glazier to bring in Windows SDK 7.0 branch

Conflicts:
	README.md
diff --git a/README.md b/README.md
index 244e8be..30e57ab 100644
--- a/README.md
+++ b/README.md
@@ -189,32 +189,18 @@
 # ICU 4.4.2
 ################################################################################
 Ideally ICU would compile with current VC runtime using VC++ directly but
-it doesn't. Instead we use cygwin make tools and VC++ compiler.
+it doesn't directly, so a stubdata.obj is built first, then the rest is compiled
+using the latest VC runtimes.
 
-* download ICU 4.4.2 unix source from [icu442]
+* Download ICU 4.4.2 windows source from [icu442]
 * either re-use the "shell.cmd" from before, or open a Windows SDK prompt
 via `setenv /release /x86` again
-    
-        cd $RELAX
-        DEST=`pwd`/icu
-        tar xzf bits/icu4c-4_4_2-src.tgz
-        cd $DEST/source
-        ./runConfigureICU Cygwin/MSVC --prefix=$DEST
-        make
-        make install
-        cp $DEST/lib/*.dll $DEST/bin/
 
-* the last line is because CouchDB still looks in icu/bin/ for the DLLs even though the build puts them
- in icu/lib/. This should probably be changed in CouchDB
+        %relax%\bin\build_icu.cmd
+
 * confirm that the resulting ICU DLLs have the appropriate manifests
 
-[icu442]: http://download.icu-project.org/files/icu4c/4.4.2/icu4c-4_4_2-src.tgz
-
-
-* then run the following 4 scripts in order
-
-        couchdb_config.sh
-        couchdb_build.sh
+[icu442]: http://download.icu-project.org/files/icu4c/4.4.2/icu4c-4_4_2-src.zip
 
 # LibcURL
 ################################################################################
@@ -296,14 +282,11 @@
         /relax/bin/couchdb_config_js180.sh
         /relax/bin/couchdb_build.sh
 
-For CouchDB 1.2.x, most patches are already in trunk, apart from 1 patch
-[COUCHDB-1197], and a filthy hack. The hack is needed until `configure.ac` is
-updated to identify that curl is not required and that the cygwin library version
-of it should not be pulled into CouchDB by accident.
+For CouchDB 1.2.x, patches are in trunk from a small, filthy hack, which
+is needed until `configure.ac` avoids detection of cygwin's curl.
 
         cd /relax && svn checkout https://svn.apache.org/repos/asf/couchdb/trunk
         cd trunk
-        patch -p1 < ../bits/COUCHDB-1197_libtool_sed_hackery.patch
         mv /usr/bin/curl-config /usr/bin/curl-config.dist
         ./bootstrap
         /relax/bin/couchdb_config_js185.sh
diff --git a/bin/build_icu.cmd b/bin/build_icu.cmd
index 36c6f27..3894acb 100755
--- a/bin/build_icu.cmd
+++ b/bin/build_icu.cmd
@@ -1,42 +1,46 @@
 path=%path%;%relax%\7zip;

-:: obsolete for the moment, we build under cygwin to get a working

-:: BIND_TO_CURRENT_VCLIBS_VERSION during build of the icu data dll

-goto eof

+setlocal

+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

+:: icu doesn't have a version name in the archive path

 set ICU_PATH=%RELAX%\icu

-

-:: set path for ICU compilation later on

-set INCLUDE=%INCLUDE%;%ICU_PATH%\include;

-set LIBPATH=%LIBPATH%;%ICU_PATH%\lib;

-set LIB=%LIB%;%ICU_PATH%\lib

-

-:: set LINK & CL to resolve manifest binding issues & virtualisation hack in ld.sh#171

-set CL=/D_BIND_TO_CURRENT_VCLIBS_VERSION=1

-::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

-:: clean up existing installs

+setx ICU_PATH %icu_path%

+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

+:: ensure we have a fresh source tree to build from

 if exist "%icu_path%" rd /s/q %icu_path%

-setx icu_path %icu_path%

-7z x "%RELAX%\bits\icu4c-*src.zip" -o%RELAX% -y

-

-::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

-pushd "%icu_path%\source\allinone"

-vcbuild /useenv /platform:Win32 /M8 allinone.sln "Release|Win32" 

-:: can we try using --with-data-packaging=archive to reduce ICU size?

-::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

-::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

-popd

-

-::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

-:: trying this on cygwin instead of windows, to compile with

-:: current vclibs.

+7z x "%relax%\bits\icu4c-*src.zip" -o%relax% -y > NUL:

+pushd %icu_path%

+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

+:: in ICU, the data DLL icudt44.dll built by VC++ is actually a stub, and it

+:: gets modified and expanded later on. The stub doesn't compile correctly under

+:: BIND_TO_CURRENT_VCLIBS_VERSION so we first compile it without this flag to

+:: avoid this error:

+:: 1>   Creating library ..\..\lib\icudt.lib and object ..\..\lib\icudt.exp

+:: 1>stubdata.obj : error LNK2001: unresolved external symbol __forceCRTManifestCUR

+:: 1>..\..\bin\icudt44.dll : fatal error LNK1120: 1 unresolved externals

+:: try adding stubdata.c int __forceCRTManifestCUR=0; or similar

+:: TODO can we try using --with-data-packaging=archive to reduce ICU size?

+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

+set icu_source=%icu_path%\source

+set CL=

+vcbuild /useenv /platform:Win32 /M8 %icu_source%\stubdata\stubdata.vcproj "Release|Win32"

+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

+:: set CL to resolve manifest binding issues & virtualisation hack in ld.sh#171

+set CL=/D_BIND_TO_CURRENT_VCLIBS_VERSION=1

+vcbuild /useenv /platform:Win32 /M8 %icu_source%\allinone\allinone.sln "Release|Win32"

+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

+:: trying this on cygwin instead of windows, to compile with current vclibs

+:: doesn't actually build the data DLL correctly - YMMV

 :: use .tgz package & untar

 :: start SDK setenv.cmd /release /x86

 :: set CL=/D_BIND_TO_CURRENT_VCLIBS_VERSION=1

-:: call \cygwin\bin\bash.exe

-:: export PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin

+:: call \cygwin\cygwin.bat

+:: # check path export PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin

 :: cd $RELAX/icu442/source

 :: ./runConfigureICU Cygwin/MSVC --prefix=$RELAX/icu442/build

-:: make

-::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

-::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

-::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

+:: make && make install

+:: cp ../lib/*.dll ../bin/

+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

+::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

 :eof

+endlocal

diff --git a/bin/couchdb_config_js185.sh b/bin/couchdb_config_js185.sh
index 50ef187..c42176a 100755
--- a/bin/couchdb_config_js185.sh
+++ b/bin/couchdb_config_js185.sh
@@ -14,5 +14,6 @@
 --with-js-include=/relax/js-1.8.5/js/src/dist/include \
 2>&1 | tee $COUCH_TOP/build_configure.txt
 ### --enable-static \
+### --with-win32-curl=/relax/curl \
 
 echo DONE. | tee -a $COUCH_TOP/build_configure.txt
diff --git a/downloads.md b/downloads.md
index 7b603e5..08c691e 100644
--- a/downloads.md
+++ b/downloads.md
@@ -49,8 +49,8 @@
 # bits required to build couch
 ### libicu	icu4c-4_4_2-src.zip
 # http://download.icu-project.org/files/icu4c/4.4.2/icu4c-4_4_2-src.zip
-### libicu	icu4c-4_4_2-src.tgz
-http://download.icu-project.org/files/icu4c/4.4.2/icu4c-4_4_2-src.tgz
+### libicu	icu4c-4_4_2-src.tgz (unix variant for cygwin wrapped build)
+## http://download.icu-project.org/files/icu4c/4.4.2/icu4c-4_4_2-src.tgz
 ### inno5_setup	isetup-5.4.2-unicode.exe
 http://www.jrsoftware.org/download.php/is-unicode.exe
 ### spidermonkey	57a6ad20eae9.tar.gz