build.ck 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. /*++
  2. Copyright (c) 2013 Minoca Corp. All Rights Reserved
  3. Module Name:
  4. TzComp
  5. Abstract:
  6. This tool compiles textual time zone data into a binary format.
  7. Author:
  8. Evan Green 2-Aug-2013
  9. Environment:
  10. Test
  11. --*/
  12. function build() {
  13. tz_default = "America/Los_Angeles";
  14. sources = [
  15. "tzcomp.c",
  16. ];
  17. tz_data_dir = "//tzcomp/data/";
  18. tz_source_files = [
  19. "africa",
  20. "antarctica",
  21. "asia",
  22. "australasia",
  23. "etcetera",
  24. "europe",
  25. "leapseconds",
  26. "northamerica",
  27. "southamerica"
  28. ];
  29. tz_files = [];
  30. for (file in tz_source_files) {
  31. tz_files += [tz_data_dir + file];
  32. }
  33. build_app = {
  34. "label": "build_tzcomp",
  35. "output": "tzcomp",
  36. "inputs": sources,
  37. "build": TRUE
  38. };
  39. entries = application(build_app);
  40. //
  41. // Add the tzcomp tool.
  42. //
  43. tzcomp_tool = {
  44. "type": "tool",
  45. "name": "tzcomp",
  46. "command": "$^//tzcomp/tzcomp $TZCOMP_FLAGS -o $OUT $IN",
  47. "description": "Compiling Time Zone Data - $OUT"
  48. };
  49. entries += [tzcomp_tool];
  50. //
  51. // Add entries for the time zone almanac and time zone default.
  52. //
  53. almanac = {
  54. "type": "target",
  55. "label": "tzdata",
  56. "inputs": tz_files,
  57. "implicit": [":build_tzcomp"],
  58. "tool": "tzcomp",
  59. "nostrip": TRUE
  60. };
  61. tz_default_config = {
  62. "TZCOMP_FLAGS": ["-f " + tz_default]
  63. };
  64. tz_default_data = {
  65. "type": "target",
  66. "label": "tzdflt",
  67. "inputs": tz_files,
  68. "implicit": [":build_tzcomp"],
  69. "tool": "tzcomp",
  70. "config": tz_default_config,
  71. "nostrip": TRUE
  72. };
  73. entries += binplace(almanac);
  74. entries += binplace(tz_default_data);
  75. //
  76. // Create a group for the data files.
  77. //
  78. tz_data_files = [":tzdata", ":tzdflt"];
  79. entries += group("tz_files", tz_data_files);
  80. return entries;
  81. }
  82. return build();