1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
|
## Makefile.in for ICU data
## Copyright (C) 2016 and later: Unicode, Inc. and others.
## License & terms of use: http://www.unicode.org/copyright.html
## Copyright (c) 1999-2015, International Business Machines Corporation and
## others. All Rights Reserved.
## Source directory information
srcdir = @srcdir@
top_srcdir = @top_srcdir@
# So that you have $(top_builddir)/config.status
top_builddir = ..
## All the flags and other definitions are included here.
include $(top_builddir)/icudefs.mk
## Build directory information
# So that $(top_builddir)/$(subdir) ~= "here"
subdir = data
#lib icu data for link
LIB_ICUDATA_NAME=$(LIBICU)$(DATA_STUBNAME)$(ICULIBSUFFIX)
LIB_STATIC_ICUDATA_NAME=$(LIBSICU)$(DATA_STUBNAME)$(ICULIBSUFFIX)
# Allow Windows to override these options
ifeq ($(PKGDATA_OPTS),)
PKGDATA_OPTS = -O $(top_builddir)/data/icupkg.inc
endif
ifeq ($(PKGDATA_VERSIONING),)
PKGDATA_VERSIONING = -r $(SO_TARGET_VERSION)
endif
# This allows all the data to be in one directory
ifeq ($(PKGDATA_MODE),dll)
ICUPKGDATA_OUTDIR = $(LIBDIR)
else
ifeq ($(PKGDATA_MODE),static)
ICUPKGDATA_OUTDIR = $(LIBDIR)
else
ICUPKGDATA_OUTDIR = $(OUTDIR)
endif
endif
CURDIR:=$(CURR_FULL_DIR)
# current directory should not be blank
ifeq ($(CURDIR),)
CURDIR=.
endif
ifeq ($(BUILD_HOST_ICU),OS390)
PKGDATA = $(TOOLBINDIR)/pkgdata $(PKGDATA_OPTS) -z -q -c -s $(CURDIR)/out/build/$(ICUDATA_PLATFORM_NAME) -d $(ICUPKGDATA_OUTDIR)
else
PKGDATA = $(TOOLBINDIR)/pkgdata $(PKGDATA_OPTS) -q -c -s $(CURDIR)/out/build/$(ICUDATA_PLATFORM_NAME) -d $(ICUPKGDATA_OUTDIR)
endif
# OBJDATADIR must be a short path (with ..'s) to the data.
ifeq ($(top_srcdir),..)
SRCDATADIR=.
else
SRCDATADIR=$(top_srcdir)/data
endif
ifeq ($(top_builddir),..)
OUTDIR=./out
else
OUTDIR=$(top_builddir)/data/out
endif
OUTTMPDIR=$(OUTDIR)/tmp
MAINBUILDDIR=$(OUTDIR)/build
BUILDDIR=$(MAINBUILDDIR)/$(ICUDATA_PLATFORM_NAME)
MISCSRCDIR=$(SRCDATADIR)/misc
SRCLISTDEPS=Makefile $(srcdir)/Makefile.in
# Variable names for rules.mk
OUT_DIR=$(BUILDDIR)
TMP_DIR=$(OUTTMPDIR)
# relative lib links from pkgdata are the same as for tmp
TOOLDIR=$(top_builddir)/tools
## List of phony targets
.PHONY : all all-local all-recursive install install-local install-files \
install-recursive clean clean-local clean-recursive distclean \
distclean-local distclean-recursive dist dist-local dist-recursive \
check check-local check-recursive clean-resindex icudata.jar \
check-exhaustive
## Clear suffix list
.SUFFIXES :
## List of standard targets
all: all-local
install: all-local install-local
clean: clean-local
distclean : distclean-local
dist:
check: all check-local
check-exhaustive: check
-include Makefile.local
distclean-local: clean
$(RMV) Makefile
all-local: icupkg.inc build-local packagedata $(POST_DATA_BUILD)
dist-local:
clean-map:
-test -z *.map || $(RMV) *.map
clean-local: cleanpackage cleanfiles clean-map
$(RMV) $(OUTDIR) build-local packagedata uni-core-data
cleanfiles:
test -z "$(CLEANFILES)" || $(RMV) $(CLEANFILES)
cleanpackage:
$(RMV) $(OUTDIR)
$(RMV) $(LIBDIR)/*$(LIB_ICUDATA_NAME)*.$(SO)* $(LIBDIR)/$(LIB_STATIC_ICUDATA_NAME).$(A)
check-local:
PYTHONPATH=$(top_srcdir)/python @PYTHON@ -m icutools.databuilder.test
# Find out if we have a source archive.
# If we have that, then use that instead of building everything from scratch.
ICUDATA_SOURCE_ARCHIVE = $(wildcard $(srcdir)/in/$(ICUDATA_PLATFORM_NAME).dat)
ifeq ($(ICUDATA_SOURCE_ARCHIVE),)
ICUDATA_ARCHIVE = $(firstword $(wildcard $(srcdir)/in/$(ICUDATA_BASENAME_VERSION)*.dat))
# We don't have the data in the current endianness or charset.
# See if we can find data of any archive type,
# and convert it to the current type.
ifneq ($(ICUDATA_ARCHIVE),)
ICUDATA_SOURCE_ARCHIVE = $(OUTDIR)/$(ICUDATA_PLATFORM_NAME).dat
$(ICUDATA_SOURCE_ARCHIVE): $(ICUDATA_ARCHIVE)
$(MKINSTALLDIRS) $(OUTDIR)
$(INVOKE) $(TOOLBINDIR)/icupkg -t$(ICUDATA_CHAR) $(ICUDATA_ARCHIVE) $(ICUDATA_SOURCE_ARCHIVE)
$(OUTDIR):
mkdir -p $(OUTDIR)
endif
else
ifneq ($(ENABLE_STATIC),YES)
ifeq ($(PKGDATA_MODE),common)
# We have a source data common archive in the native endianness,
# and it's what we want to build. Try to not run any of ICU's tools.
ICUDATA_SOURCE_IS_NATIVE_TARGET=YES
endif
endif
endif
packagedata: icupkg.inc $(PKGDATA_LIST) build-local
ifneq ($(ENABLE_STATIC),)
ifeq ($(PKGDATA_MODE),dll)
$(PKGDATA_INVOKE) $(PKGDATA) -e $(ICUDATA_ENTRY_POINT) -T $(OUTTMPDIR) -p $(ICUDATA_NAME) $(PKGDATA_LIBSTATICNAME) -m static $(PKGDATA_VERSIONING) $(PKGDATA_LIST)
endif
endif
ifneq ($(ICUDATA_SOURCE_IS_NATIVE_TARGET),YES)
$(PKGDATA_INVOKE) $(PKGDATA) -e $(ICUDATA_ENTRY_POINT) -T $(OUTTMPDIR) -p $(ICUDATA_NAME) -m $(PKGDATA_MODE) $(PKGDATA_VERSIONING) $(PKGDATA_LIBNAME) $(PKGDATA_LIST)
else
$(INSTALL_DATA) $(ICUDATA_SOURCE_ARCHIVE) $(OUTDIR)
endif
echo timestamp > $@
## Install ICU data.
install-local: $(PKGDATA_LIST) ./icupkg.inc packagedata
$(MKINSTALLDIRS) $(TMPDATADIR) $(DESTDIR)$(ICUPKGDATA_DIR)
ifeq ($(PKGDATA_MODE),files)
$(MKINSTALLDIRS) $(ICUPKGDATA_DIR)/$(ICUDATA_NAME)
$(MKINSTALLDIRS) $(ICUPKGDATA_DIR)/$(ICUDATA_NAME)/$(CURR_TREE)
$(MKINSTALLDIRS) $(ICUPKGDATA_DIR)/$(ICUDATA_NAME)/$(LANG_TREE)
$(MKINSTALLDIRS) $(ICUPKGDATA_DIR)/$(ICUDATA_NAME)/$(REGION_TREE)
$(MKINSTALLDIRS) $(ICUPKGDATA_DIR)/$(ICUDATA_NAME)/$(ZONE_TREE)
$(MKINSTALLDIRS) $(ICUPKGDATA_DIR)/$(ICUDATA_NAME)/$(UNIT_TREE)
$(MKINSTALLDIRS) $(ICUPKGDATA_DIR)/$(ICUDATA_NAME)/$(BREAK_TREE)
$(MKINSTALLDIRS) $(ICUPKGDATA_DIR)/$(ICUDATA_NAME)/$(COLLATION_TREE)
$(MKINSTALLDIRS) $(ICUPKGDATA_DIR)/$(ICUDATA_NAME)/$(RBNF_TREE)
$(MKINSTALLDIRS) $(ICUPKGDATA_DIR)/$(ICUDATA_NAME)/$(TRANSLIT_TREE)
endif
ifneq ($(ENABLE_STATIC),)
ifeq ($(PKGDATA_MODE),dll)
# For MinGW, do we want the DLL to go in the bin location?
ifeq ($(MINGW_MOVEDLLSTOBINDIR),YES)
$(PKGDATA_INVOKE) $(PKGDATA) -m static -e $(ICUDATA_ENTRY_POINT) -T $(OUTTMPDIR) -s $(BUILDDIR) -p $(ICUDATA_NAME) $(PKGDATA_LIBSTATICNAME) $(PKGDATA_LIST) -I $(DESTDIR)$(bindir)
else
$(PKGDATA_INVOKE) $(PKGDATA) -m static -e $(ICUDATA_ENTRY_POINT) -T $(OUTTMPDIR) -s $(BUILDDIR) -p $(ICUDATA_NAME) $(PKGDATA_LIBSTATICNAME) $(PKGDATA_LIST) -I $(ICUPKGDATA_INSTALL_LIBDIR)
endif
endif
endif
ifneq ($(ICUDATA_SOURCE_IS_NATIVE_TARGET),YES)
# For MinGW, do we want the DLL to go in the bin location?
ifeq ($(MINGW_MOVEDLLSTOBINDIR),YES)
$(PKGDATA_INVOKE) $(PKGDATA) -m $(PKGDATA_MODE) $(PKGDATA_VERSIONING) -e $(ICUDATA_ENTRY_POINT) -T $(OUTTMPDIR) -s $(BUILDDIR) -p $(ICUDATA_NAME) $(PKGDATA_LIBNAME) $(PKGDATA_LIST) -I $(DESTDIR)$(bindir)
else
$(PKGDATA_INVOKE) $(PKGDATA) -m $(PKGDATA_MODE) $(PKGDATA_VERSIONING) -e $(ICUDATA_ENTRY_POINT) -T $(OUTTMPDIR) -s $(BUILDDIR) -p $(ICUDATA_NAME) $(PKGDATA_LIBNAME) $(PKGDATA_LIST) -I $(ICUPKGDATA_INSTALL_DIR)
endif
else
$(INSTALL_DATA) $(ICUDATA_SOURCE_ARCHIVE) $(DESTDIR)$(ICUPKGDATA_DIR)
endif
## Include the main build rules for data files
include $(top_builddir)/$(subdir)/rules.mk
ifeq ($(ENABLE_SO_VERSION_DATA),1)
ifeq ($(PKGDATA_MODE),dll)
SO_VERSION_DATA = $(OUTTMPDIR)/icudata.res
$(SO_VERSION_DATA) : $(MISCSRCDIR)/icudata.rc | $(TMP_DIR)/dirs.timestamp
ifeq ($(MSYS_RC_MODE),1)
rc.exe -i$(srcdir)/../common -i$(top_builddir)/common -fo$@ $(CPPFLAGS) $<
else
rc.exe /i$(srcdir)/../common /i$(top_builddir)/common /fo$@ $(CPPFLAGS) $(SOURCE_FILE)
endif
endif
endif
PKGDATA_LIST = $(TMP_DIR)/icudata.lst
#####################################################
# General data build rules
## Files to remove for 'make clean'
CLEANFILES = *~ icupkg.inc *.x
ifeq ($(ICUDATA_SOURCE_ARCHIVE),)
build-local: $(SO_VERSION_DATA) $(ICUDATA_ALL_OUTPUT_FILES) $(PKGDATA_LIST)
echo timestamp > $@
else
build-local: $(SO_VERSION_DATA) $(PKGDATA_LIST)
echo timestamp > $@
$(PKGDATA_LIST): $(SRCLISTDEPS) $(ICUDATA_SOURCE_ARCHIVE)
ifneq ($(ICUDATA_SOURCE_IS_NATIVE_TARGET),YES)
$(MKINSTALLDIRS) $(OUTTMPDIR) $(BUILDDIR)
@echo "Unpacking $(ICUDATA_SOURCE_ARCHIVE) and generating $@ (list of data files)"
@-$(RMV) $@
$(INVOKE) $(TOOLBINDIR)/icupkg -d $(BUILDDIR) --list -x \* $(ICUDATA_SOURCE_ARCHIVE) -o $@
else
@echo "$@" > $@
endif
endif
# if the tzcode directory contains a new tzdata*.tar.gz file, use it for zoneinfo
ifeq ($(TZDATA),)
TZDATA = $(firstword $(wildcard $(top_builddir)/tools/tzcode/tzdata*.tar.gz) $(wildcard $(top_srcdir)/tools/tzcode/tzdata*.tar.gz))
endif
# TODO(ICU-20466): Make the TZDATA override part of Python icutools.databuilder
ifneq ($(TZDATA),)
TZCODE_DIR=$(top_builddir)/tools/tzcode
ZONEINFO=$(TZCODE_DIR)/zoneinfo64.txt
# Override the normal genrb for zoneinfo to always pull from
# icu/source/tools/tzcode/zoneinfo64.txt
$(BUILDDIR)/zoneinfo64.res: $(ZONEINFO) $(TOOLBINDIR)/genrb$(TOOLEXEEXT) | $(BUILDDIR)/cnvalias.icu
@echo Note: $(MISCSRCDIR)/zoneinfo.txt is IGNORED because $(TZDATA) is present.
$(INVOKE) $(TOOLBINDIR)/genrb $(GENRBOPTS) -q -i $(BUILDDIR) -d $(BUILDDIR) $(ZONEINFO)
# Create the tzcode tool and zoneinfo as needed.
$(ZONEINFO): $(TZDATA)
@echo "$(MAKE)[$(MAKELEVEL)]: Making \`$(ZONEINFO)' in \`$(TZCODE_DIR)'"; \
(cd $(TZCODE_DIR) && $(MAKE)) || exit; \
# end of zoneinfo-generation
endif
# Build the ICU4J icudata.jar.
# Command line:
# (Run this from the output data folder which may not be .../source/data in an out-of-source build.)
# ~/svn.icu/trunk/source/data> make JAR=jar ICU4J_ROOT=~/svn.icu4j/trunk icudata.jar
# You can omit the ICU4J_ROOT for just building the .jar files without copying them.
# You can omit the JAR if it's just jar.
JAR=jar
# For building the testdata.jar see ../test/testdata/Makefile.
ICU4J_TZDATA=$(OUTDIR)/icu4j/icutzdata.jar
ICU4J_TZDATA_FILES=zoneinfo64 metaZones timezoneTypes windowsZones
ICU4J_DATA_DIRNAME=com/ibm/icu/impl/data/icudata
ICU4J_TZDATA_PATHS=$(ICU4J_TZDATA_FILES:%="$(ICU4J_DATA_DIRNAME)/%.res")
# generate icu4j-related data to $(OUTDIR)/icu4j/com/ibm/icu/impl/data/...
generate-data: packagedata $(OUTTMPDIR)/$(ICUDATA_PLATFORM_NAME).dat
mkdir -p $(OUTDIR)/icu4j/$(ICU4J_DATA_DIRNAME)
mkdir -p $(OUTDIR)/icu4j/tzdata/$(ICU4J_DATA_DIRNAME)
$(INVOKE) $(TOOLBINDIR)/icupkg $(OUTTMPDIR)/$(ICUDATA_PLATFORM_NAME).dat $(OUTDIR)/icu4j/$(ICUDATA_BASENAME_VERSION)b.dat -s $(BUILDDIR) -x '*' -tb -d $(OUTDIR)/icu4j/$(ICU4J_DATA_DIRNAME)
mv $(ICU4J_TZDATA_PATHS:%=$(OUTDIR)/icu4j/%) "$(OUTDIR)/icu4j/tzdata/$(ICU4J_DATA_DIRNAME)"
$(OUTDIR)/icu4j/icutzdata.jar: generate-data
$(JAR) cf $(OUTDIR)/icu4j/icutzdata.jar -C $(OUTDIR)/icu4j/tzdata $(ICU4J_DATA_DIRNAME)/
# Build icudata.jar:
# - add the uni-core-data to the ICU package
# - swap the ICU data
# - extract all data items
# - package them into the .jar file
# TODO(ICU-20466): Move this to Python
# NOTE: If you get the error "No rule to make target 'out/build/icudt64l/uprops.icu'",
# you need to reconfigure with unicore data. See icu4j-readme.txt
$(OUTDIR)/icu4j/icudata.jar: generate-data | $(OUT_DIR)/uprops.icu
$(JAR) cf $(OUTDIR)/icu4j/icudata.jar -C $(OUTDIR)/icu4j $(ICU4J_DATA_DIRNAME)/
ICU4J_DATA=$(OUTDIR)/icu4j/icudata.jar
ifdef ICU4J_ROOT
ICU4J_DATA_INSTALLED=$(ICU4J_ROOT)/main/shared/data/icudata.jar $(ICU4J_ROOT)/main/shared/data/icutzdata.jar
$(ICU4J_ROOT)/main/shared/data/icudata.jar: $(OUTDIR)/icu4j/icudata.jar
mkdir -p $(ICU4J_ROOT)/main/shared/data
cp $(OUTDIR)/icu4j/icudata.jar $(ICU4J_ROOT)/main/shared/data
$(ICU4J_ROOT)/main/shared/data/icutzdata.jar: $(OUTDIR)/icu4j/icutzdata.jar
mkdir -p $(ICU4J_ROOT)/main/shared/data
cp $(OUTDIR)/icu4j/icutzdata.jar $(ICU4J_ROOT)/main/shared/data
icu4j-data-install: $(ICU4J_DATA_INSTALLED)
else
icu4j-data-install: icu4j-data
@echo data is built into $(OUTDIR)/icu4j
@echo '** Error:' ICU4J_ROOT was not set, could not install
exit 1
endif
icu4j-data: $(ICU4J_DATA) $(ICU4J_TZDATA)
###################################################################
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
icupkg.inc: pkgdataMakefile
$(MAKE) -f pkgdataMakefile
pkgdataMakefile:
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
###########
########### 390 (z/OS) support
UCMFILES390=ebcdic-xml-us.ucm ibm-37_P100-1995.ucm ibm-1047_P100-1995.ucm ibm-4909_P100-1999.ucm
# used to depend on pnames.icu uprops.icu ucase.icu ubidi.icu
# These are now hardcoded in ICU4C and only loaded in ICU4J.
ALLFILES390=cnvalias.icu $(UCMFILES390:.ucm=.cnv)
$(OUTTMPDIR)/icudata390.lst: $(SRCLISTDEPS)
@echo "generating $@ (list of 390 data files)"
@-$(RMV) $@
@for file in $(ALLFILES390); do \
echo $$file >> $@; \
done;
ifeq ($(POST_DATA_BUILD), os400-data-rebind)
os400-data-rebind: $(LIBICUUC)
$(LIBICUUC): $(LIBICUDT)
$(RMV) $(LIBICUUC)
(cd ../common && $(MAKE) RECURSIVE=YES) || exit;
endif
|