1# Notes specific to building ICU in Fuchsia tree 2 3This note is specific to compiling ICU for Fuchsia as a target, but only within 4the Fuchsia git source code repository. 5 6On Fuchsia we need to compile ICU at 3 separate but not always different ICU 7commit IDs. I call these ICU "flavors", and Fuchsia has "default", "stable", 8and "latest" flavors defined today. 9 10This setup fights a bit with the way the default ICU build works, since all of 11the above flavors end up wanting to place some of their outputs in 12`$root_build_dir` under the same name (e.g. `icudtl.dat`). Such a setup causes 13GN to complain about multiple build rules defining the same output, and fail 14the build. So the vanilla setup does not work for us. 15 16To have 3 possibly different ICUs coexist in peace in the Fuchsia tree, the 17following changes are needed in the ICU library proper: 18 19- We introduced a file `//build/icu.gni` which will live in the Fuchsia git 20 tree, and contains the shared configuration to be used instead of 21 `config.gni`. Without it, compilation will fail saying that multiple config 22 files define the same args. Since providing this config file to all 23 downstream deps would be tedious, and error prone, there is a 24 Fuchsia-specific branch in `config.gni` which will look for `//build/icu.gni` 25 only if the configuration indicates we are building Fuchsia, and building in 26 the Fuchsia git source tree. 27 28- Added some flags and conditionals to avoid 29 putting key artifacts into `$root_build_dir`. Without it, compilation will 30 fail because all ICU flavors we compile will want to put same-named artifacts 31 into the same spot in `$root_build_dir`. 32 33- The above conditionals caused some of the variables to become unused in some 34 code paths, so I marked those as `not_needed`. This should not adversely 35 affect any builds, Fuchsia or otherwise. 36 37- Started storing the major version of the library in a JSON file at the root 38 directory. This allows tools other than GN to read the file, and use 39 standardized tools for parsing the value. Without this, we'd need to rely on 40 possibly brittle parsing to achieve the same effect, which seemed unnecessary. 41 42- I modified [scripts/update.sh] to transition to updating the JSON file, so 43 the update process to update the above JSON file instead of the `.gni` file 44 directly so the ICU update process does not change for the human operator. 45 46These settings should only take effect in the Fuchsia in-tree build of ICU. 47While there might be some value in having `//build/icu.gni` defined in each 48downstream build, this seemed like an overkill at this time. 49 50