Add icudt.dll for Windows

1. Generate and add windows/icudt.dll with the procedure outlined
in README.chromium. It uses a out-of-tree copy of the upstream ICU
along with our custom-built icudtl.dat and a locally modified version
of makedata.mak.

We used to have a separate build/ directory for VS solution/project files
to build icudtl.dll. Maintaining them is rather cumbersom now that we
want to update our ICU (major version changes) more frequently. 

Note that icudt.dll is not used by default (icu_use_data_file_flag=1). 
The GN build still uses it by default and we should not break that build.

2. Add scripts/make_mac_assembly.sh to simplify the generation of the icu
data assembly source file for Mac.

3. Update README.chromium accordingly.

This CL was uploaded and reviewed at 

https://codereview.chromium.org/255943004/

Due to a malfunction at codereview.chromium.org, I'm landing this CL 
manually in two parts. 
This check-in is the 2nd part of the CL dealing with #2 and #3
above.

BUG=132145
TEST=None until icu is rolled to this version.


git-svn-id: http://src.chromium.org/svn/trunk/deps/third_party/icu52@266602 4ff67af0-8c30-449e-8e8b-ad334ec8d88c
diff --git a/README.chromium b/README.chromium
index 022c846..d654a82 100644
--- a/README.chromium
+++ b/README.chromium
@@ -145,8 +145,7 @@
   - patches/data.build.patch :
       Remove unnecessary resources : invuca, unames, collator source, stringprep
   - patches/data.build.win.patch :
-      Windows-only data build patch. Add a new target DATALIB to makedata.mak
-  - add an empty file (stubdatabuilt.txt) to source/stubdata
+      Windows-only data build patch.
 
 9. Pre-built data files are checked in with the following steps on Linux:
 
@@ -172,32 +171,15 @@
       {BUILD_DIR_ROOT}/data/out/tmp and copied to the above location with a
       version number (52) dropped.
 
-    - windows/icudt.dll : With icudt52l.dat in place, all the patches applied
-      and header files moved (#11 below), generated by building icudt_build
-      project of build/icudt_build.sln on Windows. icudt52.dll is
-      generated in bin/{Release,Debug} and copied to windows/icudt.dll
-      and checked in. Note that we drop the version number ('52') from the
-      dll name to avoind having to update our build scripts/configuration
-      files everytime ICU is upgraded to a new version.
 
     - {mac,linux}/icudtl_dat.S : Built on Linux with all the
       patches above (except android/brkitr.patch) applied and checked in.
       This file will be generated in {BUILD_DIR_ROOT}/data/out/tmp as
       icudt52l_dat.S, but '52' is dropped while copying.
 
-      mac/icudtl_dat.S is identical to linux/icudtl_dat.S. It's made
-      by changing the header portion of the Linux version to read as following
-      (no leading whitespace) :
-
-          .globl _icudt52_dat
-          #ifdef U_HIDE_DATA_SYMBOL
-                 .private_extern _icudt52_dat
-          #endif
-                 .data
-                 .const
-                 .align 4
-          _icudt52_dat:
-
+      mac/icudtl_dat.S is identical to linux/icudtl_dat.S except for
+      the header portion. With "linux/icudtl_dat.S" in its place, 
+      run scripts/make_mac_assembly.sh to generate it.
 
     - android/icudtl_dat.S : Built on Linux with all the patches above and
       android/brkitr.patch applied and android/patch_locale.sh executed.
@@ -207,6 +189,25 @@
       {BUILD_DIR_ROOT}/data/out/tmp along with icudt52l_dat.S and
       copied to the above location with '52' dropped in its name.
 
+    - windows/icudt.dll (by default, we set icu_use_icu_data_flag to 1
+      and don't use this file.) 
+
+      a. check out a clean copy of icu52  from the upstream on Windows
+         outside the Chrome tree.
+
+        $ svn export --native-eol LF http://source.icu-project.org/repos/icu/icu/tags/release-52-1 ${SEPARATE_ICU_ROOT}/icu52
+
+      b. copy ${CHROME_ICU_ROOT}/source/data/in/icudtl.dat to 
+         ${SEPARATE_ICU_ROOT}/source/data/in/icudt52l.dat
+      c. copy ${CHROME_ICU_ROOT}/source/data/makedata.mak to
+         ${SEPARATE_ICU_ROOT}/source/data/makedata.mak
+      c. In Visual Studio, open source/allinone/allinone.sln solution
+         in ${SEPARATE_ICU_ROOT}
+      d. Build 'makedata' target 
+      e. icudt52.dll will be generated in ${SEPARATE_ICU_ROOT}/bin
+      f. Copy that icudt52.dll to ${CHROME_ICU_ROOT}/windows/icudt.dll 
+         and check that in.
+
 
 10. Change export of U_ICUDATA_ENTRY_POINT from U_IMPORT to U_EXPORT.
     - patches/declspec.patch
diff --git a/patches/data.build.win.patch b/patches/data.build.win.patch
index 96166f3..46642a5 100644
--- a/patches/data.build.win.patch
+++ b/patches/data.build.win.patch
@@ -1,27 +1,17 @@
 Index: source/data/makedata.mak
 ===================================================================
---- source/data/makedata.mak	(revision 68397)
+--- source/data/makedata.mak	(revision 266014)
 +++ source/data/makedata.mak	(working copy)
-@@ -480,7 +480,18 @@
+@@ -478,7 +478,7 @@
+ #				Building the common dll in $(ICUBLD_PKG) unconditionally copies it to $(DLL_OUTPUT) too.
+ #
  #############################################################################
- ALL : GODATA "$(ICU_LIB_TARGET)" "$(TESTDATAOUT)\testdata.dat"
+-ALL : GODATA "$(ICU_LIB_TARGET)" "$(TESTDATAOUT)\testdata.dat"
++ALL : GODATA "$(ICU_LIB_TARGET)"
  	@echo All targets are up to date
-+#############################################################################
-+#
-+# DATALIB
-+#     This target builds the data library. It's identical to 
-+#     ALL except that testdata.dat is not built.
-+#
-+#############################################################################
-+DATALIB : GODATA "$(ICU_LIB_TARGET)"
-+	@echo Data library is built
  
-+
-+
  # The core Unicode properties files (uprops.icu, ucase.icu, ubidi.icu)
- # are hardcoded in the common DLL and therefore not included in the data package any more.
- # They are not built by default but need to be built for ICU4J data and for getting the .c source files
-@@ -581,6 +592,7 @@
+@@ -597,6 +597,7 @@
  	cd "$(ICUBLD_PKG)"
  	"$(ICUPBIN)\icupkg" -x * --list "$(ICUDATA_SOURCE_ARCHIVE)" > "$(ICUTMP)\icudata.lst"
  	"$(ICUPBIN)\pkgdata" $(COMMON_ICUDATA_ARGUMENTS) "$(ICUTMP)\icudata.lst"
@@ -29,17 +19,3 @@
  	copy "$(U_ICUDATA_NAME).dll" "$(DLL_OUTPUT)"
  	-@erase "$(U_ICUDATA_NAME).dll"
  	copy "$(ICUTMP)\$(ICUPKG).dat" "$(ICUOUT)\$(U_ICUDATA_NAME)$(U_ICUDATA_ENDIAN_SUFFIX).dat"
-@@ -914,7 +926,7 @@
- # If you modify this, modify winmode.c in pkgdata.
- "$(ICUTMP)\icudata.res": "$(ICUMISC)\icudata.rc"
- 	@echo Creating data DLL version information from $**
--	@rc.exe /i "..\..\..\..\common" /r /fo $@ $**
-+	@rc.exe /i "..\..\..\..\common;..\..\..\..\..\public\common" /r /fo $@ $**
- 
- # Targets for converters
- "$(ICUBLD_PKG)\cnvalias.icu" : {"$(ICUSRCDATA)\$(ICUUCM)"}\convrtrs.txt "$(ICUTOOLS)\gencnval\$(CFG)\gencnval.exe"
-@@ -990,4 +1002,3 @@
- # See Jitterbug 4497 for details.
- $(BRK_SOURCE) : "$(ICUBLD_PKG)\unames.icu" "$(ICUBLD_PKG)\pnames.icu" "$(ICUBLD_PKG)\nfc.nrm"
- !ENDIF
--
diff --git a/scripts/make_mac_assembly.sh b/scripts/make_mac_assembly.sh
new file mode 100644
index 0000000..dafadd1
--- /dev/null
+++ b/scripts/make_mac_assembly.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+# Copyright (c) 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+ICUROOT="$(dirname $0)/.."
+LINUX_SOURCE="${ICUROOT}/linux/icudtl_dat.S"
+MAC_SOURCE="${ICUROOT}/mac/icudtl_dat.S"
+
+cat > ${MAC_SOURCE} <<PREAMBLE
+.globl _icudt52_dat
+#ifdef U_HIDE_DATA_SYMBOL
+       .private_extern _icudt52_dat
+#endif
+       .data
+       .const
+       .align 4
+_icudt52_dat:
+PREAMBLE
+
+PREAMBLE_LENGTH=$(($(egrep -n '^icudt' ${LINUX_SOURCE} | cut -d : -f 1) + 1))
+tail -n +${PREAMBLE_LENGTH} ${LINUX_SOURCE} >> ${MAC_SOURCE}
diff --git a/source/data/makedata.mak b/source/data/makedata.mak
index b87af24..837ede2 100644
--- a/source/data/makedata.mak
+++ b/source/data/makedata.mak
@@ -478,7 +478,7 @@
 #				Building the common dll in $(ICUBLD_PKG) unconditionally copies it to $(DLL_OUTPUT) too.
 #
 #############################################################################
-ALL : GODATA "$(ICU_LIB_TARGET)" "$(TESTDATAOUT)\testdata.dat"
+ALL : GODATA "$(ICU_LIB_TARGET)"
 	@echo All targets are up to date
 
 # The core Unicode properties files (uprops.icu, ucase.icu, ubidi.icu)
@@ -597,6 +597,7 @@
 	cd "$(ICUBLD_PKG)"
 	"$(ICUPBIN)\icupkg" -x * --list "$(ICUDATA_SOURCE_ARCHIVE)" > "$(ICUTMP)\icudata.lst"
 	"$(ICUPBIN)\pkgdata" $(COMMON_ICUDATA_ARGUMENTS) "$(ICUTMP)\icudata.lst"
+	editbin /NXCOMPAT /DYNAMICBASE "$(U_ICUDATA_NAME).dll"
 	copy "$(U_ICUDATA_NAME).dll" "$(DLL_OUTPUT)"
 	-@erase "$(U_ICUDATA_NAME).dll"
 	copy "$(ICUTMP)\$(ICUPKG).dat" "$(ICUOUT)\$(U_ICUDATA_NAME)$(U_ICUDATA_ENDIAN_SUFFIX).dat"