| 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 |
# Short (major) version, i.e. 70 |
| 31 |
VERS=$(echo ${DATFILE} | tr -d a-z/.) |
| 32 |
# Version number, i.e. 70.1 |
| 33 |
VERSION=${VERSION-unknown} |
| 34 |
# Version number for files, i.e. 70_1 |
| 35 |
VERSION_FILE=$(echo ${VERSION} | tr . _) |
| 36 |
|
| 37 |
if [[ "${VERSION}" = "unknown" ]]; |
| 38 |
then |
| 39 |
VERSION=${VERS}.0 |
| 40 |
echo "$0: VERSION not set, using ${VERSION}" |
| 41 |
else |
| 42 |
if [[ "${VERS}" != $(echo ${VERSION} | cut -d. -f1) ]] |
| 43 |
then |
| 44 |
echo >&2 "$0: Warning: Expected version ${VERSION} to start with ${VERS}..." |
| 45 |
fi |
| 46 |
fi |
| 47 |
|
| 48 |
# yeah, override ENDIANS if you want a different flavor. |
| 49 |
#ENDIANS="b l e" |
| 50 |
ENDIANS=${ENDIANS-"b l"} |
| 51 |
DISTY_DIR=${DISTY_DIR-./dist/} |
| 52 |
|
| 53 |
if [ ! -x ./bin/icupkg ] |
| 54 |
then |
| 55 |
echo >&2 "$0: could not find executable ./bin/icupkg" |
| 56 |
exit 1 |
| 57 |
fi |
| 58 |
|
| 59 |
echo "# Packing ${DATFILE} into data zips in dist/ for version ${VERSION}" |
| 60 |
mkdir -p ${DISTY_DIR}/tmp |
| 61 |
|
| 62 |
for endian in $ENDIANS; |
| 63 |
do |
| 64 |
base=icu4c-${VERSION_FILE}-data-bin-${endian}.zip |
| 65 |
filename=icudt${VERS}${endian}.dat |
| 66 |
if [ -f ${DISTY_DIR}/${base} ]; |
| 67 |
then |
| 68 |
echo ${DISTY_DIR}/${base} exists, skipping |
| 69 |
continue |
| 70 |
fi |
| 71 |
rm -f ${DISTY_DIR}/tmp/${filename} |
| 72 |
echo ./bin/icupkg -t${endian} ${DATFILE} ${DISTY_DIR}/tmp/${filename} |
| 73 |
./bin/icupkg -t${endian} ${DATFILE} ${DISTY_DIR}/tmp/${filename} |
| 74 |
README=icu4c-${VERSION_FILE}-data-bin-${endian}-README.md |
| 75 |
cat >> ${DISTY_DIR}/tmp/${README} <<EOF |
| 76 |
# ICU Data Zip for ${VERSION} |
| 77 |
|
| 78 |
For information on Unicode ICU, see [http://icu-project.org](http://icu-project.org) |
| 79 |
|
| 80 |
## Contents |
| 81 |
|
| 82 |
This .zip file contains: |
| 83 |
|
| 84 |
- this README |
| 85 |
- [LICENSE](./LICENSE) |
| 86 |
- ${filename} |
| 87 |
|
| 88 |
## How to use this file |
| 89 |
|
| 90 |
This file contains prebuilt data in form **${endian}**. |
| 91 |
("l" for Little Endian, "b" for Big Endian, "e" for EBCDIC.) |
| 92 |
It may be used to simplify build and installation of ICU. |
| 93 |
See [http://icu-project.org](http://icu-project.org) for further information. |
| 94 |
|
| 95 |
## License |
| 96 |
|
| 97 |
See [LICENSE](./LICENSE). |
| 98 |
|
| 99 |
> Copyright © 2016 and later Unicode, Inc. and others. All Rights Reserved. |
| 100 |
Unicode and the Unicode Logo are registered trademarks |
| 101 |
of Unicode, Inc. in the U.S. and other countries. |
| 102 |
[Terms of Use and License](http://www.unicode.org/copyright.html) |
| 103 |
|
| 104 |
EOF |
| 105 |
zip -v -j ${DISTY_DIR}/${base} \ |
| 106 |
${LICENSE} \ |
| 107 |
${DISTY_DIR}/tmp/${README} \ |
| 108 |
${DISTY_DIR}/tmp/${filename} |
| 109 |
ls -lh ${DISTY_DIR}/${base} |
| 110 |
done |