Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 0f4719c

Browse files
committed
[[ TimeZoneLibrary ]] Add rules for building tz lib and data
1 parent 95e2e2d commit 0f4719c

File tree

4 files changed

+242
-0
lines changed

4 files changed

+242
-0
lines changed
Lines changed: 220 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,220 @@
1+
{
2+
3+
'includes':
4+
[
5+
'../../../../common.gypi',
6+
],
7+
8+
'variables':
9+
{
10+
'zic': '<(PRODUCT_DIR)/zic<(EXECUTABLE_SUFFIX)',
11+
},
12+
13+
'targets':
14+
[
15+
{
16+
'target_name': 'tz',
17+
'type': 'none',
18+
19+
'dependencies':
20+
[
21+
'libtz-build',
22+
'tzdata',
23+
],
24+
25+
'conditions':
26+
[
27+
[
28+
'OS == "ios" and "iphoneos" in target_sdk',
29+
{
30+
'copies':
31+
[
32+
{
33+
'destination': '<(PRODUCT_DIR)/packaged_extensions/com.livecode.library.timezone/code/<(platform_id)/',
34+
'files':
35+
[
36+
'<(PRODUCT_DIR)/tz<(STATIC_LIB_SUFFIX)',
37+
],
38+
},
39+
],
40+
},
41+
{
42+
43+
'copies':
44+
[
45+
{
46+
'destination': '<(PRODUCT_DIR)/packaged_extensions/com.livecode.library.timezone/code/<(platform_id)/',
47+
'files':
48+
[
49+
'<(PRODUCT_DIR)/tz<(SHARED_LIB_SUFFIX)',
50+
],
51+
},
52+
],
53+
},
54+
],
55+
],
56+
},
57+
{
58+
'target_name': 'tzdata',
59+
'type': 'none',
60+
61+
'dependencies':
62+
[
63+
'zic-build',
64+
'tzdata-build',
65+
],
66+
67+
'variables':
68+
{
69+
'install_folder': '<(PRODUCT_DIR)/packaged_extensions/com.livecode.library.timezone/resources/zoneinfo',
70+
},
71+
72+
'actions':
73+
[
74+
{
75+
'action_name': 'tzdata',
76+
77+
'inputs':
78+
[
79+
'<(zic)',
80+
'<(INTERMEDIATE_DIR)/tzdata.zi',
81+
],
82+
83+
'outputs':
84+
[
85+
'<(install_folder)/GMT',
86+
],
87+
88+
'message': 'Extracting zoneinfo',
89+
90+
'action':
91+
[
92+
'<(zic)',
93+
'-d',
94+
'<(install_folder)',
95+
'<(INTERMEDIATE_DIR)/tzdata.zi',
96+
],
97+
},
98+
],
99+
},
100+
{
101+
'target_name': 'tzdata-build',
102+
'type': 'none',
103+
104+
'sources':
105+
[
106+
'africa',
107+
'antarctica',
108+
'asia',
109+
'australasia',
110+
'europe',
111+
'northamerica',
112+
'southamerica',
113+
'etcetera',
114+
'systemv',
115+
'factory',
116+
],
117+
118+
'actions':
119+
[
120+
{
121+
'action_name': 'tzdata_zi',
122+
123+
'inputs':
124+
[
125+
'<@(_sources)',
126+
'ziguard.awk',
127+
],
128+
129+
'outputs':
130+
[
131+
'<(INTERMEDIATE_DIR)/tzdata.zi',
132+
],
133+
134+
'message': 'Building zoneinfo',
135+
136+
'conditions':
137+
[
138+
[
139+
'OS == "win"',
140+
{
141+
'variables':
142+
{
143+
'build_command': [ '$(ProjectDir)../../../../../../util/invoke-unix.bat', '$(ProjectDir)../../../../../../extensions/libraries/timezone/tz/tzdata.sh' ],
144+
},
145+
},
146+
{
147+
'variables':
148+
{
149+
'build_command': [ '../../../../extensions/libraries/timezone/tz/tzdata.sh' ],
150+
},
151+
},
152+
],
153+
],
154+
155+
'action':
156+
[
157+
'<@(build_command)',
158+
'<(INTERMEDIATE_DIR)',
159+
'ziguard.awk',
160+
'zishrink.awk',
161+
'version',
162+
'<@(_sources)',
163+
],
164+
},
165+
],
166+
},
167+
{
168+
'target_name': 'zic-build',
169+
'type': 'executable',
170+
'product_name': 'zic',
171+
172+
'variables':
173+
{
174+
'silence_warnings': 1,
175+
},
176+
177+
'sources':
178+
[
179+
'zic.c',
180+
],
181+
},
182+
{
183+
'target_name': 'libtz-build',
184+
'product_prefix': '',
185+
'product_name': 'tz',
186+
187+
'variables':
188+
{
189+
'silence_warnings': 1,
190+
},
191+
192+
'sources':
193+
[
194+
'tz.h',
195+
'asctime.c',
196+
'private.h',
197+
'localtime.c',
198+
],
199+
200+
'conditions':
201+
[
202+
[
203+
# loadable_module is overridden for iOS so hack around that
204+
'OS == "ios" and "iphoneos" in target_sdk',
205+
{
206+
'type': 'static_library',
207+
},
208+
'OS == "ios" and "iphoneos" not in target_sdk',
209+
{
210+
'type': 'shared_library',
211+
},
212+
{
213+
'type': 'loadable_module',
214+
},
215+
],
216+
],
217+
},
218+
],
219+
220+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
# Utility script called by the build system to build tzdata.zi
4+
5+
set -x
6+
7+
# Arguments 4 and above are the list of zone data files
8+
readonly output_dir=$1
9+
readonly ziguard=$2
10+
readonly zishrink=$3
11+
readonly version_file=$4
12+
shift 4
13+
14+
awk -v outfile='main.zi' -f "${ziguard}" $@ > "${output_dir}/main.zi"
15+
16+
version=`sed 1q ${version_file}` && \
17+
LC_ALL=C awk -v version="$$version" -f "${zishrink}" \
18+
${output_dir}/main.zi > ${output_dir}/tzdata.zi
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2018c-25-g04e846f
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
static char const PKGVERSION[]="(tzcode) ";
2+
static char const TZVERSION[]="2018c-25-g04e846f";
3+
static char const REPORT_BUGS_TO[]="tz@iana.org";

0 commit comments

Comments
 (0)