Skip to content

Commit f63a8bb

Browse files
committed
ICU-20600 build icu-data-bin files
make dist will now produce: - icu4c-67.1-data-bin-b.zip - icu4c-67.1-data-bin-l.zip
1 parent 24b3cf1 commit f63a8bb

File tree

2 files changed

+107
-1
lines changed

2 files changed

+107
-1
lines changed

icu4c/source/config/dist-data.sh

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
#!/bin/bash
2+
# Copyright (C) 2020 and later: Unicode, Inc. and others.
3+
4+
# set VERSION to the ICU version. set top_srcdir to the parent of icurc
5+
# Note: You need to set LD_LIBRARY_PATH/etc before calling this script.
6+
export LD_LIBRARY_PATH=./lib:${LD_LIBRARY_PATH-/lib:/usr/lib:/usr/local/lib}
7+
export DYLD_LIBRARY_PATH=./lib:${DYLD_LIBRARY_PATH-/lib:/usr/lib:/usr/local/lib}
8+
9+
if [ ! -d "${top_srcdir}" ]
10+
then
11+
echo >&2 "$0: please set 'top_srcdir' to the icu/icu4c/source dir"
12+
exit 1
13+
fi
14+
LICENSE=${LICENSE-${top_srcdir}/../LICENSE}
15+
16+
if [ ! -f "${LICENSE}" ]
17+
then
18+
echo >&2 "$0: could not load license file ${LICENSE}"
19+
exit 1
20+
fi
21+
22+
DATFILE=${DATFILE-$(ls data/out/tmp/icudt*.dat| head -1)}
23+
24+
if [ ! -f "${DATFILE}" ]
25+
then
26+
echo >&2 "$0: could not find DATFILE ${DATFILE}"
27+
exit 1
28+
fi
29+
30+
VERS=$(echo ${DATFILE} | tr -d a-z/.)
31+
VERSION=${VERSION-unknown}
32+
33+
if [[ "${VERSION}" = "unknown" ]];
34+
then
35+
VERSION=${VERS}.0
36+
echo "$0: VERSION not set, using ${VERSION}"
37+
else
38+
if [[ "${VERS}" != $(echo ${VERSION} | cut -d. -f1) ]]
39+
then
40+
echo >&2 "$0: Warning: Expected version ${VERSION} to start with ${VERS}..."
41+
fi
42+
fi
43+
44+
# yeah, override ENDIANS if you want a different flavor.
45+
#ENDIANS="b l e"
46+
ENDIANS=${ENDIANS-"b l"}
47+
DISTY_DIR=${DISTY_DIR-./dist/}
48+
49+
if [ ! -x ./bin/icupkg ]
50+
then
51+
echo >&2 "$0: could not find executable ./bin/icupkg"
52+
exit 1
53+
fi
54+
55+
echo "# Packing ${DATFILE} into data zips in dist/ for version ${VERSION}"
56+
mkdir -p ${DISTY_DIR}/tmp
57+
58+
for endian in $ENDIANS;
59+
do
60+
base=icu4c-${VERSION}-data-bin-${endian}.zip
61+
filename=icudt${VERS}${endian}.dat
62+
if [ -f ${DISTY_DIR}/${base} ];
63+
then
64+
echo ${DISTY_DIR}/${base} exists, skipping
65+
continue
66+
fi
67+
rm -f ${DISTY_DIR}/tmp/${filename}
68+
echo ./bin/icupkg -t${endian} ${DATFILE} ${DISTY_DIR}/tmp/${filename}
69+
./bin/icupkg -t${endian} ${DATFILE} ${DISTY_DIR}/tmp/${filename}
70+
README=icu4c-${VERSION}-data-bin-${endian}-README.md
71+
cat >> ${DISTY_DIR}/tmp/${README} <<EOF
72+
# ICU Data Zip for ${VERSION}
73+
74+
For information on Unicode ICU, see [http://icu-project.org](http://icu-project.org)
75+
76+
## Contents
77+
78+
This .zip file contains:
79+
80+
- this README
81+
- [LICENSE](./LICENSE)
82+
- ${filename}
83+
84+
## How to use this file
85+
86+
This file contains prebuilt data in form **${endian}**.
87+
("l" for Little Endian, "b" for Big Endian, "e" for EBCDIC.)
88+
It may be used to simplify build and installation of ICU.
89+
See [http://icu-project.org](http://icu-project.org) for further information.
90+
91+
## License
92+
93+
See [LICENSE](./LICENSE).
94+
95+
> Copyright © 2016 and later Unicode, Inc. and others. All Rights Reserved.
96+
Unicode and the Unicode Logo are registered trademarks
97+
of Unicode, Inc. in the U.S. and other countries.
98+
[Terms of Use and License](http://www.unicode.org/copyright.html)
99+
100+
EOF
101+
zip -v -j ${DISTY_DIR}/${base} \
102+
${LICENSE} \
103+
${DISTY_DIR}/tmp/${README} \
104+
${DISTY_DIR}/tmp/${filename}
105+
ls -lh ${DISTY_DIR}/${base}
106+
done

icu4c/source/config/dist.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ $(DISTY_FILE_TGZ) $(DISTY_FILE_ZIP) $(DISTY_DATA_ZIP): $(DISTY_DAT) $(DISTY_TMP
8383
ln -f $(DISTY_DATA_ZIP) $(DISTY_FILE_DIR)/icu4c-$(DISTY_VER)-data.zip
8484
ls -l $(DISTY_FILE_TGZ) $(DISTY_FILE_ZIP) $(DISTY_DATA_ZIP)
8585

86-
8786
dist-local: $(DISTY_FILES)
87+
VERSION=$(VERSION) $(SHELL) $(top_srcdir)/config/dist-data.sh
8888

8989
distcheck: distcheck-tgz
9090

0 commit comments

Comments
 (0)