From 995ffec8bb4ceea06e3f360958e482dc790cf220 Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Fri, 13 Mar 2020 18:19:07 -0700 Subject: [PATCH] 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 --- icu4c/source/config/dist-data.sh | 106 +++++++++++++++++++++++++++++++ icu4c/source/config/dist.mk | 2 +- 2 files changed, 107 insertions(+), 1 deletion(-) create mode 100755 icu4c/source/config/dist-data.sh diff --git a/icu4c/source/config/dist-data.sh b/icu4c/source/config/dist-data.sh new file mode 100755 index 000000000000..442267108bae --- /dev/null +++ b/icu4c/source/config/dist-data.sh @@ -0,0 +1,106 @@ +#!/bin/bash +# Copyright (C) 2020 and later: Unicode, Inc. and others. + +# set VERSION to the ICU version. set top_srcdir to the parent of icurc +# Note: You need to set LD_LIBRARY_PATH/etc before calling this script. +export LD_LIBRARY_PATH=./lib:${LD_LIBRARY_PATH-/lib:/usr/lib:/usr/local/lib} +export DYLD_LIBRARY_PATH=./lib:${DYLD_LIBRARY_PATH-/lib:/usr/lib:/usr/local/lib} + +if [ ! -d "${top_srcdir}" ] +then + echo >&2 "$0: please set 'top_srcdir' to the icu/icu4c/source dir" + exit 1 +fi +LICENSE=${LICENSE-${top_srcdir}/../LICENSE} + +if [ ! -f "${LICENSE}" ] +then + echo >&2 "$0: could not load license file ${LICENSE}" + exit 1 +fi + +DATFILE=${DATFILE-$(ls data/out/tmp/icudt*.dat| head -1)} + +if [ ! -f "${DATFILE}" ] +then + echo >&2 "$0: could not find DATFILE ${DATFILE}" + exit 1 +fi + +VERS=$(echo ${DATFILE} | tr -d a-z/.) +VERSION=${VERSION-unknown} + +if [[ "${VERSION}" = "unknown" ]]; +then + VERSION=${VERS}.0 + echo "$0: VERSION not set, using ${VERSION}" +else + if [[ "${VERS}" != $(echo ${VERSION} | cut -d. -f1) ]] + then + echo >&2 "$0: Warning: Expected version ${VERSION} to start with ${VERS}..." + fi +fi + +# yeah, override ENDIANS if you want a different flavor. +#ENDIANS="b l e" +ENDIANS=${ENDIANS-"b l"} +DISTY_DIR=${DISTY_DIR-./dist/} + +if [ ! -x ./bin/icupkg ] +then + echo >&2 "$0: could not find executable ./bin/icupkg" + exit 1 +fi + +echo "# Packing ${DATFILE} into data zips in dist/ for version ${VERSION}" +mkdir -p ${DISTY_DIR}/tmp + +for endian in $ENDIANS; +do + base=icu4c-${VERSION}-data-bin-${endian}.zip + filename=icudt${VERS}${endian}.dat + if [ -f ${DISTY_DIR}/${base} ]; + then + echo ${DISTY_DIR}/${base} exists, skipping + continue + fi + rm -f ${DISTY_DIR}/tmp/${filename} + echo ./bin/icupkg -t${endian} ${DATFILE} ${DISTY_DIR}/tmp/${filename} + ./bin/icupkg -t${endian} ${DATFILE} ${DISTY_DIR}/tmp/${filename} + README=icu4c-${VERSION}-data-bin-${endian}-README.md + cat >> ${DISTY_DIR}/tmp/${README} < Copyright © 2016 and later Unicode, Inc. and others. All Rights Reserved. +Unicode and the Unicode Logo are registered trademarks +of Unicode, Inc. in the U.S. and other countries. +[Terms of Use and License](http://www.unicode.org/copyright.html) + +EOF + zip -v -j ${DISTY_DIR}/${base} \ + ${LICENSE} \ + ${DISTY_DIR}/tmp/${README} \ + ${DISTY_DIR}/tmp/${filename} + ls -lh ${DISTY_DIR}/${base} +done diff --git a/icu4c/source/config/dist.mk b/icu4c/source/config/dist.mk index a990181cec66..f45133eddb51 100644 --- a/icu4c/source/config/dist.mk +++ b/icu4c/source/config/dist.mk @@ -83,8 +83,8 @@ $(DISTY_FILE_TGZ) $(DISTY_FILE_ZIP) $(DISTY_DATA_ZIP): $(DISTY_DAT) $(DISTY_TMP ln -f $(DISTY_DATA_ZIP) $(DISTY_FILE_DIR)/icu4c-$(DISTY_VER)-data.zip ls -l $(DISTY_FILE_TGZ) $(DISTY_FILE_ZIP) $(DISTY_DATA_ZIP) - dist-local: $(DISTY_FILES) + VERSION=$(VERSION) $(SHELL) $(top_srcdir)/config/dist-data.sh distcheck: distcheck-tgz