#
-# Copyright (C) 2010-2011 IBM Corporation and Others, All Rights Reserved.
+# Copyright (C) 2010-2012 IBM Corporation and Others, All Rights Reserved.
#
all: glurens ii plugs testprog
LIBPROVIDER=lib$(PROVIDER).a
#libs: $(ICU_TARBALLS_VERS:%=$(OUT)/%/lib/$(LIBPROVIDER))
-PLUGLIB=$(shell echo $(PROVIDER_TARGET) | tr '.' '_' )
-PLUGLIB_MAJ=$(shell echo $(PROVIDER_TARGET) | cut -d. -f1-2 | tr -d '.' )
+
PLUGLIB_INST=$(C_INS)/r$(PLUGLIB)
PLUGLIB_ICU_CONFIG=$(PLUGLIB_INST)/bin/icu-config
#PLUGLIB_SO=$(shell $(PLUGLIB_ICU_CONFIG) --so 2>/dev/null )
ICU_CONFIG_CXX=--cxx $(ICU_CONFIG_COMMON) --cxxflags
include Makefile.local
-
+PLUGLIB=$(shell echo $(PROVIDER_TARGET) | tr '.' '_' )
+PLUGLIB_MAJ=$(shell ./icu2symver.sh $(PLUGLIB))
## @build All installed ICUs
ii: $(GLOUT_ICU)
testprog: $(PLUGLIB:%=$(OUT)/%/bin/$(TESTPROG))
-check: all testprog $(OUT)/icuplugins$(PLUGLIB_MAJ).txt
+check-icu2symver:
+ ./check-icu2symver.sh
+
+check: check-icu2symver all testprog $(OUT)/icuplugins$(PLUGLIB_MAJ).txt
ICU_PLUGINS=$(OUT) $(LIBPATH_VAR)=$(PLUGLIB_INST)/lib:out/$(PLUGLIB)/lib $(PLUGLIB_INST)/bin/icuinfo || ( echo "ICU broken." ; /bin/false )
ICU_PLUGINS=$(OUT) $(LIBPATH_VAR)=$(PLUGLIB_INST)/lib:out/$(PLUGLIB)/lib $(PLUGLIB_INST)/bin/icuinfo -L || ( echo "Plugin broken." ; /bin/false )
@for prog in $(TESTPROG) ; \
glurens: $(GLUREN_ICU)
# build single gluren.h
-$(BUILD)/%/$(GLUREN_H): $(BUILD)/%/ok Makefile
+$(BUILD)/%/$(GLUREN_H): $(BUILD)/%/ok Makefile makegluren.sh
-mkdir -p $(BUILD)/$*/$(GLUREN)
- cat $(GLUE)/gluren-top.h > $@
- echo "#define GLUREN_VER" $* >> $@
- echo "#define GLUREN_TINY" $(shell echo $* | cut -d_ -f1-2) >> $@
- echo >> $@
- echo '/* old style (<4.4)*/' >> $@
- grep "^#define.*$(shell echo $* | cut -d_ -f1-2)$$" $(SRC)/$*/$(SOURCE)/common/unicode/urename.h | fgrep -v '*' | \
- sed -e "s@^#define \([^ ]*\) \([^ ]*\)@#define OICU_\1 \2@" >> $@
- echo '/* new style (4.4+) */' >> $@
- fgrep " U_ICU_ENTRY_POINT_RENAME(" $(SRC)/$*/$(SOURCE)/common/unicode/urename.h | \
- sed -e "s@^#define \([^ ]*\) .*@#define OICU_\1 \1_$(shell echo $* | cut -d_ -f1-2 | tr -d '_')@" >> $@
- cat $(GLUE)/gluren-bottom.h >> $@
-
+ env SRC="$(SRC)" SOURCE="$(SOURCE)" GLUE="$(GLUE)" ./makegluren.sh $@ $*
$(BUILD)/%/config/$(ICU_CONFIG): $(BUILD)/%/config/$(ICU_CONFIG_ORIG) icu-config.sed $(BUILD)/%/ok
sed -f icu-config.sed < $(BUILD)/$*/config/$(ICU_CONFIG_ORIG) > $(BUILD)/$*/config/$(ICU_CONFIG) && chmod a+rx $(BUILD)/$*/config/$(ICU_CONFIG)
--- /dev/null
+#!/bin/sh
+# Copyright (C) 2010-2012 IBM Corporation and Others, All Rights Reserved.
+
+if [ $# -eq 1 ];
+then
+ VERBOSE=1
+else
+ VERBOSE=0
+fi
+
+function verbose()
+{
+ if [ ${VERBOSE} -eq 1 ];
+ then
+ echo "$*"
+ else
+ echo -n .
+ fi
+}
+
+function c()
+{
+ IN=$1
+ EXP=$2
+ OUT=`./icu2symver.sh $IN`
+ if [ "x${OUT}" != "x${EXP}" ];
+ then
+ echo "Error: \"${IN}\" -> \"${OUT}\", expected ${EXP}" >&2
+ exit 1
+ else
+ verbose "${IN} -> ${OUT}"
+ fi
+
+ OUT=`echo ${IN} | ./icu2symver.sh`
+ if [ "x${OUT}" != "x${EXP}" ];
+ then
+ echo "Error: \"${IN}\" -> \"${OUT}\", expected ${EXP} (via stream)" >&2
+ exit 1
+ else
+ verbose "${IN} -> ${OUT} (via stream)"
+ fi
+}
+
+c '3.6.2' '36'
+c '1.0' '10'
+c '4.8' '48'
+c '4.8.1.1' '48'
+c '4.0.2' '40'
+c '4.1.2' '41'
+c '49.1.2' '49'
+c '49' '49'
+c '50.0.3' '50'
+c '51.0.0.1' '51'
+
+echo " OK!"
+
+exit 0
--- /dev/null
+#!/bin/sh
+# Copyright (C) 2010-2012 IBM Corporation and Others, All Rights Reserved.
+
+INVER="0.0"
+if [ $# -eq 0 ];
+then
+ read INVER
+elif [ $# -eq 1 ];
+then
+ INVER=$1
+else
+ echo "$0: error: require one or zero arguments. If zero, read from stdin" >&2
+ exit 1
+fi
+
+UND=`echo ${INVER} | tr '.' '_'`
+MAJ0=`echo ${UND} | cut -d_ -f1`
+MIN1=`echo ${UND} | cut -d_ -f2`
+if [ ${MAJ0} -lt 49 ];
+then
+ # pre 50: paste together "4" and "8" to get 48
+ echo -n "${MAJ0}${MIN1}"
+else
+ # post 50: just use the first #
+ echo -n "${MAJ0}"
+fi
+
+exit 0
\ No newline at end of file
--- /dev/null
+#!/bin/sh
+# Copyright (C) 2010-2012 IBM Corporation and Others, All Rights Reserved.
+
+# $@
+OUT=$1
+shift
+# $*
+VER=$1
+shift
+
+TINY=`./icu2symver.sh $VER`
+
+echo "$0: Building ${OUT} for ${TINY} ------- " >&2
+#set -x
+
+(
+ cat ${GLUE}/gluren-top.h
+ echo "#define GLUREN_VER" ${TINY}
+ echo "#define GLUREN_TINY" ${TINY}
+ echo
+ echo '/* old style (<4.4)*/'
+ grep "^#define.*${TINY}$" ${SRC}/${VER}/${SOURCE}/common/unicode/urename.h | fgrep -v '*' | sed -e "s@^#define \([^ ]*\) \([^ ]*\)@#define OICU_\1 \2@"
+ echo '/* new style (4.4+) */'
+ fgrep " U_ICU_ENTRY_POINT_RENAME(" ${SRC}/${VER}/${SOURCE}/common/unicode/urename.h | sed -e "s@^#define \([^ ]*\) .*@#define OICU_\1 \1_${TINY}@"
+ cat ${GLUE}/gluren-bottom.h
+) |
+ cat > ${OUT}
+# tee ${OUT}
+