|
| 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 |
0 commit comments