build.ck 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*++
  2. Copyright (c) 2013 Minoca Corp.
  3. This file is licensed under the terms of the GNU General Public License
  4. version 3. Alternative licensing terms are available. Contact
  5. info@minocacorp.com for details. See the LICENSE file at the root of this
  6. project for complete licensing information.
  7. Module Name:
  8. TzComp
  9. Abstract:
  10. This tool compiles textual time zone data into a binary format.
  11. Author:
  12. Evan Green 2-Aug-2013
  13. Environment:
  14. Test
  15. --*/
  16. from menv import application, binplace, group, mconfig;
  17. function build() {
  18. var almanac;
  19. var buildApp;
  20. var entries;
  21. var sources;
  22. var tzcompTool;
  23. var tzCutoffYear = "1980";
  24. var tzDataDir = "data/";
  25. var tzDataFiles;
  26. var tzDefault = "America/Los_Angeles";
  27. var tzDefaultData;
  28. var tzFiles;
  29. var tzSourceFiles;
  30. sources = [
  31. "tzcomp.c",
  32. ];
  33. tzSourceFiles = [
  34. "africa",
  35. "antarctica",
  36. "asia",
  37. "australasia",
  38. "etcetera",
  39. "europe",
  40. "leapseconds",
  41. "northamerica",
  42. "southamerica"
  43. ];
  44. tzFiles = [];
  45. for (file in tzSourceFiles) {
  46. tzFiles += [tzDataDir + file];
  47. }
  48. buildApp = {
  49. "label": "build_tzcomp",
  50. "output": "tzcomp",
  51. "inputs": sources,
  52. "build": true
  53. };
  54. entries = application(buildApp);
  55. //
  56. // Add the tzcomp tool.
  57. //
  58. tzcompTool = {
  59. "type": "tool",
  60. "name": "tzcomp",
  61. "command": "$O/apps/tzcomp/tzcomp $TZCOMP_FLAGS -o $OUT $IN",
  62. "description": "Compiling Time Zone Data - $OUT"
  63. };
  64. entries += [tzcompTool];
  65. //
  66. // Add entries for the time zone almanac and time zone default.
  67. //
  68. almanac = {
  69. "type": "target",
  70. "label": "tzdata",
  71. "output": mconfig.binroot + "/skel/usr/share/tz/tzdata",
  72. "inputs": tzFiles,
  73. "implicit": [":build_tzcomp"],
  74. "tool": "tzcomp",
  75. "config": {"TZCOMP_FLAGS": ["-y" + tzCutoffYear]}
  76. };
  77. tzDefaultData = {
  78. "type": "target",
  79. "label": "tz",
  80. "output": mconfig.binroot + "/skel/etc/tz",
  81. "inputs": tzFiles,
  82. "implicit": [":build_tzcomp"],
  83. "tool": "tzcomp",
  84. "config": {"TZCOMP_FLAGS": ["-z" + tzDefault, "-y" + tzCutoffYear]},
  85. };
  86. entries += [almanac, tzDefaultData];
  87. //
  88. // Create a group for the data files.
  89. //
  90. tzDataFiles = [":tzdata", ":tz"];
  91. entries += group("tz_files", tzDataFiles);
  92. return entries;
  93. }