12e5b6d6dSopenharmony_ci#
22e5b6d6dSopenharmony_ci# Copyright (C) 2017 and later: Unicode, Inc. and others.
32e5b6d6dSopenharmony_ci# License & terms of use: http://www.unicode.org/copyright.html
42e5b6d6dSopenharmony_ci#
52e5b6d6dSopenharmony_ci#
62e5b6d6dSopenharmony_ci# Copyright (C) 2010-2012 IBM Corporation and Others, All Rights Reserved.
72e5b6d6dSopenharmony_ci#
82e5b6d6dSopenharmony_ciall: glurens ii plugs testprog
92e5b6d6dSopenharmony_ci
102e5b6d6dSopenharmony_ci# extra files that need generation.
112e5b6d6dSopenharmony_ciPLUG_EXTRA_DEPS=
122e5b6d6dSopenharmony_ciUNAME=$(shell uname)
132e5b6d6dSopenharmony_ciDOT=../../c
142e5b6d6dSopenharmony_ciSOBJ=ao
152e5b6d6dSopenharmony_ciifeq ($(UNAME),Linux)
162e5b6d6dSopenharmony_ciLIBPATH_VAR=LD_LIBRARY_PATH
172e5b6d6dSopenharmony_ciPLUG_EXTRA_LDFLAGS=-fPIC
182e5b6d6dSopenharmony_ciPBLD_EXTRA_FLAGS=-fPIC
192e5b6d6dSopenharmony_ciGLUE_EXTRA_CFLAGS= -fPIC
202e5b6d6dSopenharmony_ciPLUGLIB_SO=so
212e5b6d6dSopenharmony_cielse
222e5b6d6dSopenharmony_ciifeq ($(UNAME),Darwin)
232e5b6d6dSopenharmony_ciLIBPATH_VAR=DYLD_LIBRARY_PATH
242e5b6d6dSopenharmony_ciPLUG_EXTRA_LDFLAGS=-exported_symbols_list $(GLUE_EXPORT) -dynamiclib -dynamic
252e5b6d6dSopenharmony_ciPLUG_EXTRA_DEPS+=$(GLUE_EXPORT)
262e5b6d6dSopenharmony_ciPLUGLIB_SO=dylib
272e5b6d6dSopenharmony_cielse
282e5b6d6dSopenharmony_ciifeq ($(UNAME),AIX)
292e5b6d6dSopenharmony_ciLIBPATH_VAR=LIBPATH
302e5b6d6dSopenharmony_ci#PLUG_EXTRA_LDFLAGS=-exported_symbols_list $(GLUE_EXPORT) -dynamiclib -dynamic
312e5b6d6dSopenharmony_ciPLUG_EXTRA_DEPS+=$(GLUE_EXPORT)
322e5b6d6dSopenharmony_ciPLUGLIB_SO=a
332e5b6d6dSopenharmony_ciSOBJ=o
342e5b6d6dSopenharmony_cielse
352e5b6d6dSopenharmony_ci$(warning **********************************)
362e5b6d6dSopenharmony_ci$(warning this script may not know how to handle your $(UNAME) system)
372e5b6d6dSopenharmony_ciendif
382e5b6d6dSopenharmony_ciendif
392e5b6d6dSopenharmony_ciendif
402e5b6d6dSopenharmony_ci
412e5b6d6dSopenharmony_ciSUBHEAD="*** ICU"
422e5b6d6dSopenharmony_ci
432e5b6d6dSopenharmony_cisrcdir=$(shell pwd)
442e5b6d6dSopenharmony_ci
452e5b6d6dSopenharmony_ciPROVIDER=provider
462e5b6d6dSopenharmony_ciLIBPROVIDER=lib$(PROVIDER).a
472e5b6d6dSopenharmony_ci
482e5b6d6dSopenharmony_ci#libs: $(ICU_TARBALLS_VERS:%=$(OUT)/%/lib/$(LIBPROVIDER))
492e5b6d6dSopenharmony_ci
502e5b6d6dSopenharmony_ciPLUGLIB_INST=$(C_INS)/r$(PLUGLIB)
512e5b6d6dSopenharmony_ciPLUGLIB_ICU_CONFIG=$(PLUGLIB_INST)/bin/icu-config
522e5b6d6dSopenharmony_ci#PLUGLIB_SO=$(shell $(PLUGLIB_ICU_CONFIG) --so 2>/dev/null )
532e5b6d6dSopenharmony_ciPLUGLIB_NAME=libicuprov.$(PLUGLIB_MAJ).$(PLUGLIB_SO)
542e5b6d6dSopenharmony_ci#PLUGLIB_MAJ=$(echo $(PLUGLIB) | cut -d_ -f-1 | tr -d _ )
552e5b6d6dSopenharmony_ci#GLOUT_ICU=$(ICU_TARBALLS_VERS:%=$(GLOUT)/%/$(OK))
562e5b6d6dSopenharmony_ciPLUGLIB_AVAILABLE=$(shell echo $(PROVIDER_AVAILABLE) | tr '.' '_')
572e5b6d6dSopenharmony_ciPLUGLIB_AVAILABLE_DATA=$(PLUGLIB_AVAILABLE:%=$(BUILD)/%/data/out/tmp/*.o)
582e5b6d6dSopenharmony_ciPLUGLIB_AVAILABLE_STATICS=$(PLUGLIB_AVAILABLE:%=$(BUILD)/%/[ci]*/*.$(SOBJ))
592e5b6d6dSopenharmony_ciPLUGLIB_OUTLIBS=$(PLUGLIB:%=$(OUT)/%/lib/$(PLUGLIB_NAME))
602e5b6d6dSopenharmony_ci
612e5b6d6dSopenharmony_ci
622e5b6d6dSopenharmony_ci
632e5b6d6dSopenharmony_ci## configuration
642e5b6d6dSopenharmony_ci# Absolute path to this dir. 
652e5b6d6dSopenharmony_ci# dir holding ICUs to be built
662e5b6d6dSopenharmony_ciMULTICU_ROOT=../..
672e5b6d6dSopenharmony_ciinclude $(MULTICU_ROOT)/c/Makefile-c.inc
682e5b6d6dSopenharmony_ciICU_CONFIG=icu-config-nosanity
692e5b6d6dSopenharmony_ciICU_CONFIG_ORIG=icu-config
702e5b6d6dSopenharmony_ci
712e5b6d6dSopenharmony_ci# subdirs...
722e5b6d6dSopenharmony_ci# prefix to distinguish it from non-provider builds
732e5b6d6dSopenharmony_ciP_PREFIX=p
742e5b6d6dSopenharmony_ciBUILD=$(M_TMP)/$(P_PREFIX)bld
752e5b6d6dSopenharmony_ciINST=$(M_TMP)/$(P_PREFIX)ins
762e5b6d6dSopenharmony_ciSRC=$(M_TMP)/$(P_PREFIX)src
772e5b6d6dSopenharmony_ciOUT=$(TOP)/out
782e5b6d6dSopenharmony_ciSOURCE=$(S_SRCDIR)
792e5b6d6dSopenharmony_ciGLUE=glue
802e5b6d6dSopenharmony_ciGLUE_EXPORT=$(GLUE)/export.txt
812e5b6d6dSopenharmony_ciGLOUT=$(M_TMP)/$(P_PREFIX)glout
822e5b6d6dSopenharmony_ci# header locations
832e5b6d6dSopenharmony_ciINCGLUE=$(TOP)/$(GLUE)/include
842e5b6d6dSopenharmony_ci# relative path to icuglue within glout
852e5b6d6dSopenharmony_ciGLUREN=gluren/include/icuglue
862e5b6d6dSopenharmony_ci# relative path to gluren.h
872e5b6d6dSopenharmony_ciGLUREN_H=$(GLUREN)/gluren.h
882e5b6d6dSopenharmony_ci# Special 'configure' caller
892e5b6d6dSopenharmony_ciSUPERCONF=$(TOP)/$(MULTICU_ROOT)/c/superconf.sh
902e5b6d6dSopenharmony_ci# options to compilation (such as, debug)
912e5b6d6dSopenharmony_ciXOPTS=$(EXTRA_COMPILE_OPTS)
922e5b6d6dSopenharmony_ciOK=ok
932e5b6d6dSopenharmony_ciMOPTS=
942e5b6d6dSopenharmony_ci
952e5b6d6dSopenharmony_ci# directories that need to be built
962e5b6d6dSopenharmony_ciALLDIRS=$(INST) $(BUILD) $(SRC) $(GLOUT) $(OUT) $(GLOUT)/$(PLUGLIB) $(OUT)/$(PLUGLIB)/bin
972e5b6d6dSopenharmony_ci# The 'ok' flag file for installations
982e5b6d6dSopenharmony_ciINST_ICU=$(PLUGLIB_AVAILABLE:%=$(INST)/%/$(OK))
992e5b6d6dSopenharmony_ciBUILD_ICU=$(PLUGLIB_AVAILABLE:%=$(BUILD)/%/$(OK))
1002e5b6d6dSopenharmony_ci# this has to do with the pluglib
1012e5b6d6dSopenharmony_ciGLOUT_ICU=$(PLUGLIB:%=$(GLOUT)/%/obj-$(OK))
1022e5b6d6dSopenharmony_ci#SRC_ICU=$(ICU_TARBALLS_VERS:%=$(SRC)/%/$(OK))
1032e5b6d6dSopenharmony_ci# gluren.h files for each version
1042e5b6d6dSopenharmony_ciGLUREN_ICU=$(PLUGLIB_AVAILABLE:%=$(BUILD)/%/$(GLUREN_H))
1052e5b6d6dSopenharmony_ci#?
1062e5b6d6dSopenharmony_ciCONFIGURE_CMD=
1072e5b6d6dSopenharmony_ci# Options passed to configure
1082e5b6d6dSopenharmony_ciCONFIGURE_OPTS=--enable-static --disable-shared --with-data-packaging=static --disable-extras --disable-icuio --disable-layout --disable-tests --disable-samples  $(EXTRA_CONFIGURE_OPTS) 
1092e5b6d6dSopenharmony_ci# additional options passed to make
1102e5b6d6dSopenharmony_ciMAKE_XTRA_OPTS="PKGDATA_MODE=static"
1112e5b6d6dSopenharmony_ci# additional options passed to make install
1122e5b6d6dSopenharmony_ciMAKE_INSTALL_XTRA_OPTS=$(MAKE_XTRA_OPTS)
1132e5b6d6dSopenharmony_ci
1142e5b6d6dSopenharmony_ci# Munged source names: list of C++, O etc files for Frontend
1152e5b6d6dSopenharmony_ciPARTSUFF=_fe
1162e5b6d6dSopenharmony_ciGL_FE_CXX=$(notdir $(wildcard $(GLUE)/*$(PARTSUFF).cpp))
1172e5b6d6dSopenharmony_ciGL_FE_FILES=$(GL_FE_CXX:%.cpp=$(GLUE)/%.cpp)
1182e5b6d6dSopenharmony_ciGL_FE_O=$(GL_FE_CPP:%.cpp=%.o)
1192e5b6d6dSopenharmony_ciGL_PARTS=$(GL_FE_CXX:%$(PARTSUFF).cpp=%)
1202e5b6d6dSopenharmony_ci# C flags used in Glue compilation
1212e5b6d6dSopenharmony_ciGLUE_CFLAGS=-I$(INCGLUE) $(GLUE_EXTRA_CFLAGS)
1222e5b6d6dSopenharmony_ci
1232e5b6d6dSopenharmony_ci# icu-config switches for compiling: C and C++
1242e5b6d6dSopenharmony_ciICU_CONFIG_COMMON=--cppflags
1252e5b6d6dSopenharmony_ci# icu-config switches for C
1262e5b6d6dSopenharmony_ciICU_CONFIG_CC=--cc $(ICU_CONFIG_COMMON) --cflags 
1272e5b6d6dSopenharmony_ci# icu-config switches for C++
1282e5b6d6dSopenharmony_ciICU_CONFIG_CXX=--cxx $(ICU_CONFIG_COMMON) --cxxflags
1292e5b6d6dSopenharmony_ci
1302e5b6d6dSopenharmony_ci# sigh, include common.
1312e5b6d6dSopenharmony_ciPLUG_EXTRA_FLAGS=-I$(BUILD)/$(PLUGLIB)/common -I$(M_TMP)/build/r$(PLUGLIB)/icu/source/common
1322e5b6d6dSopenharmony_ci
1332e5b6d6dSopenharmony_ciinclude Makefile.local
1342e5b6d6dSopenharmony_ci
1352e5b6d6dSopenharmony_ci
1362e5b6d6dSopenharmony_ci
1372e5b6d6dSopenharmony_ci# Usage:  $(call SILENT_COMPILE,logfile,cmd)
1382e5b6d6dSopenharmony_ciifndef VERBOSE
1392e5b6d6dSopenharmony_ci	LOG_COMPILE=echo build with VERBOSE=1 to unhide compile ;  ( ($(2) 2>&1) > $(1) || (echo "Compile failed, see logfile in $(1) for details." ;exit 1))
1402e5b6d6dSopenharmony_cielse
1412e5b6d6dSopenharmony_ci	LOG_COMPILE=$(2) 2>&1 | tee $(1)
1422e5b6d6dSopenharmony_ciendif
1432e5b6d6dSopenharmony_ci
1442e5b6d6dSopenharmony_ciECHO_COMPILE=echo "\# ${subst ",\",$(1)}" ; ( $(1) || (  exit 1) )
1452e5b6d6dSopenharmony_ci
1462e5b6d6dSopenharmony_ciPLUGLIB=$(shell echo $(PROVIDER_TARGET)  | tr '.' '_' )
1472e5b6d6dSopenharmony_ciPLUGLIB_MAJ=$(shell  ./icu2symver.sh $(PLUGLIB))
1482e5b6d6dSopenharmony_ci
1492e5b6d6dSopenharmony_ci## @build All installed ICUs
1502e5b6d6dSopenharmony_ciii: $(GLOUT_ICU)
1512e5b6d6dSopenharmony_ci
1522e5b6d6dSopenharmony_ci# Don't delete these files
1532e5b6d6dSopenharmony_ci.PRECIOUS: (INST_ICU) $(BUILD_ICU) $(SRC_ICU) $(ICU_TARBALLS_VERS:%=$(BUILD)/%/config.status) $(ICU_TARBALLS_VERS:%=$(GLOUT)/%/obj-$(OK))  $(ICU_TARBALLS_VERS:%=$(BUILD)/%/config/$(ICU_CONFIG)) $(PLUGLIB_ICU_CONFIG)
1542e5b6d6dSopenharmony_ci
1552e5b6d6dSopenharmony_ci# cleanup
1562e5b6d6dSopenharmony_ciclean:
1572e5b6d6dSopenharmony_ci	-rm -rf $(ALLDIRS)
1582e5b6d6dSopenharmony_ci	-$(MAKE) -C ../.. clean
1592e5b6d6dSopenharmony_ci
1602e5b6d6dSopenharmony_ci# create all empty work dirs
1612e5b6d6dSopenharmony_ci$(ALLDIRS):
1622e5b6d6dSopenharmony_ci	-mkdir -p $(@)
1632e5b6d6dSopenharmony_ci
1642e5b6d6dSopenharmony_ci# Build r$(PLUGLIB) from ../../c
1652e5b6d6dSopenharmony_ci$(PLUGLIB_ICU_CONFIG):
1662e5b6d6dSopenharmony_ci	@echo "$(SUBHEAD) "$(PLUGLIB) "(plugin) building..."
1672e5b6d6dSopenharmony_ci	$(call LOG_COMPILE,../../c/ricus$(PLUGLIB).log,$(MAKE) MAKE_OPTS=$(MAKE_OPTS) XTRA_RICU_CPPFLAGS=$(XTRA_RICU_CPPFLAGS) -C ../../c ICUVERS=$(PLUGLIB) ricus)
1682e5b6d6dSopenharmony_ci
1692e5b6d6dSopenharmony_ci# build the glue objects for TARGET
1702e5b6d6dSopenharmony_ci# used to be %/* instead of $(PLUGLIB) - now, wire it down to pluglib.
1712e5b6d6dSopenharmony_ci$(GLOUT)/$(PLUGLIB)/obj-$(OK): $(GLOUT) glurens  $(PLUGLIB_ICU_CONFIG) $(GL_FE_FILES) $(ALLDIRS)
1722e5b6d6dSopenharmony_ci	@echo $(SUBHEAD) $(PLUGLIB) "(plugin) building glue.."
1732e5b6d6dSopenharmony_ci#	$(shell $(BUILD)/$(PLUGLIB)/config/$(ICU_CONFIG) $(ICU_CONFIG_CC)) $(GLUE_CFLAGS) -c -DICUGLUE_VER=$(PLUGLIB) -o $(GLOUT)/$(PLUGLIB)/gl_be_c_$(PLUGLIB).o $(GL_BE_C:%.c=$(GLUE)/%.c)
1742e5b6d6dSopenharmony_ci#	$(shell $(BUILD)/$(PLUGLIB)/config/$(ICU_CONFIG) $(ICU_CONFIG_CXX)) $(GLUE_CFLAGS) -c -DICUGLUE_VER=$(PLUGLIB) -o $(GLOUT)/$(PLUGLIB)/gl_be_cxx_$(PLUGLIB).o $(GL_BE_CXX:%.cpp=$(GLUE)/%.cpp)
1752e5b6d6dSopenharmony_ci	-rm -rf $(GLOUT)/$(PLUGLIB)/include
1762e5b6d6dSopenharmony_ci	mkdir -p $(GLOUT)/$(PLUGLIB)/include/icuglue/include
1772e5b6d6dSopenharmony_ci# for each version..  build all OTHER FE files
1782e5b6d6dSopenharmony_ci# TODO: check is unnecessary, not permitted.
1792e5b6d6dSopenharmony_ci# TODO: change to depend instead of for list. 
1802e5b6d6dSopenharmony_ci	@for ver in $(PLUGLIB_AVAILABLE) ; \
1812e5b6d6dSopenharmony_ci	do \
1822e5b6d6dSopenharmony_ci		echo "*$(SUBHEAD)" $$ver "(provider)" for  $(PLUGLIB) "(plugin)" ; \
1832e5b6d6dSopenharmony_ci		if [ ! "$$ver" = "$(PLUGLIB)" ]; \
1842e5b6d6dSopenharmony_ci		then \
1852e5b6d6dSopenharmony_ci			for part in $(GL_PARTS) ; \
1862e5b6d6dSopenharmony_ci			do \
1872e5b6d6dSopenharmony_ci				echo "**$(SUBHEAD)" $$ver "(provider) backend: ---- " "$$part" "----"  ; \
1882e5b6d6dSopenharmony_ci				$(call ECHO_COMPILE,$(shell $(PLUGLIB_ICU_CONFIG) --noverify $(ICU_CONFIG_CXX)) $(GLUE_CFLAGS) -c -I$(TOP)/$(BUILD)/$$ver/gluren/include -DICUGLUE_VER=$$ver -DICUGLUE_VER_STR=\"$$ver\" "-DGLUE_SYM(x)=glue ## x ## $$ver" -o $(GLOUT)/$(PLUGLIB)/$${part}_$${ver}_for_$(PLUGLIB).o $(GLUE)/$${part}$(PARTSUFF).cpp $(XOPTS) ) || exit 1 ; \
1892e5b6d6dSopenharmony_ci			done ; \
1902e5b6d6dSopenharmony_ci			echo " GLUE_VER( $$ver ) " >> $(GLOUT)/$(PLUGLIB)/include/icuglue/glver.h; \
1912e5b6d6dSopenharmony_ci		fi \
1922e5b6d6dSopenharmony_ci	done
1932e5b6d6dSopenharmony_ci# build 'this version' FE files
1942e5b6d6dSopenharmony_ci	@for part in $(GL_PARTS) ; \
1952e5b6d6dSopenharmony_ci	do \
1962e5b6d6dSopenharmony_ci		echo "ICU" $(PLUGLIB) "(plugin) building plugin for  ------- $$part -----" ; \
1972e5b6d6dSopenharmony_ci		$(call ECHO_COMPILE,$(shell $(PLUGLIB_ICU_CONFIG) --noverify $(ICU_CONFIG_CXX)) $(GLUE_CFLAGS) -I$(GLOUT)/$(PLUGLIB)/include -c -o $(GLOUT)/$(PLUGLIB)/$${part}_$(PLUGLIB).o $(GLUE)/$${part}$(PARTSUFF).cpp $(XOPTS) $(PLUG_EXTRA_FLAGS) ) || exit 1 ; \
1982e5b6d6dSopenharmony_ci	done
1992e5b6d6dSopenharmony_ci	touch $@
2002e5b6d6dSopenharmony_ci
2012e5b6d6dSopenharmony_ciplugs: $(PLUGLIB_OUTLIBS) $(OUT)/$(PLUGLIB_MAJ:%=icuplugins%.txt)
2022e5b6d6dSopenharmony_ci
2032e5b6d6dSopenharmony_ciinstall-plugs: $(PLUGLIB_INST)/lib/$(PLUGLIB_NAME) $(PLUGLIB_INST)/lib/icu/icuplugins$(PLUGLIB_MAJ).txt
2042e5b6d6dSopenharmony_ci	echo "Plugins installed for testing."
2052e5b6d6dSopenharmony_ci
2062e5b6d6dSopenharmony_ci#TODO: should be 'install' not 'cp'
2072e5b6d6dSopenharmony_ci$(PLUGLIB_INST)/lib/$(PLUGLIB_NAME) $(PLUGLIB_INST)/lib/icu/icuplugins$(PLUGLIB_MAJ).txt: $(PLUGLIB_OUTLIBS)
2082e5b6d6dSopenharmony_ci	cp $(PLUGLIB_OUTLIBS) $(PLUGLIB_INST)/lib
2092e5b6d6dSopenharmony_ci	echo "# Generated. " > $(PLUGLIB_INST)/lib/icu/icuplugins$(PLUGLIB_MAJ).txt
2102e5b6d6dSopenharmony_ci	@for part in $(GL_PARTS) ; \
2112e5b6d6dSopenharmony_ci	do \
2122e5b6d6dSopenharmony_ci		echo "$(PLUGLIB_NAME)	$${part}_provider_plugin" >> $(PLUGLIB_INST)/lib/icu/icuplugins$(PLUGLIB_MAJ).txt ; \
2132e5b6d6dSopenharmony_ci		echo " $${part}_provider_plugin" ; \
2142e5b6d6dSopenharmony_ci	done
2152e5b6d6dSopenharmony_ci
2162e5b6d6dSopenharmony_ci$(GLUE_EXPORT): Makefile $(GL_FE_FILES)
2172e5b6d6dSopenharmony_ci	echo "# Generated for installation. " > $@
2182e5b6d6dSopenharmony_ci	@for part in $(GL_PARTS) ; \
2192e5b6d6dSopenharmony_ci	do \
2202e5b6d6dSopenharmony_ci		echo "_$${part}_provider_plugin" >> $@ ; \
2212e5b6d6dSopenharmony_ci		echo " _$${part}_provider_plugin" ; \
2222e5b6d6dSopenharmony_ci	done
2232e5b6d6dSopenharmony_ci
2242e5b6d6dSopenharmony_ci$(OUT)/icuplugins$(PLUGLIB_MAJ).txt: $(PLUGLIB_OUTLIBS) Makefile
2252e5b6d6dSopenharmony_ci	echo "# Generated for testing." > $@
2262e5b6d6dSopenharmony_ci	@for part in $(GL_PARTS) ; \
2272e5b6d6dSopenharmony_ci	do \
2282e5b6d6dSopenharmony_ci		echo "$(PLUGLIB_NAME)	$${part}_provider_plugin" >> $@ ; \
2292e5b6d6dSopenharmony_ci		echo " $${part}_provider_plugin" ; \
2302e5b6d6dSopenharmony_ci	done
2312e5b6d6dSopenharmony_ci
2322e5b6d6dSopenharmony_ciTESTPROG=$(GL_PARTS:%=%diff$(EXEEXT))
2332e5b6d6dSopenharmony_ci
2342e5b6d6dSopenharmony_citestprog: $(PLUGLIB:%=$(OUT)/%/bin/$(TESTPROG)) 
2352e5b6d6dSopenharmony_ci
2362e5b6d6dSopenharmony_cicheck-icu2symver:
2372e5b6d6dSopenharmony_ci	./check-icu2symver.sh
2382e5b6d6dSopenharmony_ci
2392e5b6d6dSopenharmony_cigenerate-gdbrc:
2402e5b6d6dSopenharmony_ci	echo "# generated by $@" > .gdbrc
2412e5b6d6dSopenharmony_ci	echo "set environment ICU_PLUGINS=$(OUT)" >> .gdbrc
2422e5b6d6dSopenharmony_ci	echo "set environment $(LIBPATH_VAR)=$(OUT)/../$(PLUGLIB_INST)/lib:$(OUT)/$(PLUGLIB)/lib" >> .gdbrc
2432e5b6d6dSopenharmony_ci
2442e5b6d6dSopenharmony_ci
2452e5b6d6dSopenharmony_cicheck: check-icu2symver all testprog $(OUT)/icuplugins$(PLUGLIB_MAJ).txt
2462e5b6d6dSopenharmony_ci	ICU_PLUGINS=$(OUT) $(LIBPATH_VAR)=$(PLUGLIB_INST)/lib:out/$(PLUGLIB)/lib $(PLUGLIB_INST)/bin/icuinfo || ( echo "ICU broken." ; /bin/false )
2472e5b6d6dSopenharmony_ci	ICU_PLUGINS=$(OUT) $(LIBPATH_VAR)=$(PLUGLIB_INST)/lib:out/$(PLUGLIB)/lib $(PLUGLIB_INST)/bin/icuinfo -L || ( echo "Plugin broken." ; /bin/false )
2482e5b6d6dSopenharmony_ci	@for prog in $(TESTPROG) ; \
2492e5b6d6dSopenharmony_ci	do \
2502e5b6d6dSopenharmony_ci		echo "# ICU_PLUGINS=$(OUT) $(LIBPATH_VAR)=$(PLUGLIB_INST)/lib:out/$(PLUGLIB)/lib out/$(PLUGLIB)/bin/$${prog}" ; \
2512e5b6d6dSopenharmony_ci		ICU_PLUGINS=$(OUT) $(LIBPATH_VAR)=$(PLUGLIB_INST)/lib:out/$(PLUGLIB)/lib out/$(PLUGLIB)/bin/$${prog} || ( echo "$${prog} failed." ; exit 1 ) ; \
2522e5b6d6dSopenharmony_ci	done
2532e5b6d6dSopenharmony_ci
2542e5b6d6dSopenharmony_ciinstall-check: install-plugs
2552e5b6d6dSopenharmony_ci	$(LIBPATH_VAR)=$(PLUGLIB_INST)/lib $(PLUGLIB_INST)/bin/icuinfo -L || ( echo "Plugin broken." ; /bin/false )
2562e5b6d6dSopenharmony_ci	@for prog in $(TESTPROG) ; \
2572e5b6d6dSopenharmony_ci	do \
2582e5b6d6dSopenharmony_ci		echo "# $${prog}" ; \
2592e5b6d6dSopenharmony_ci		$(LIBPATH_VAR)=$(PLUGLIB_INST)/lib out/$(PLUGLIB)/bin/$${prog} || ( echo "$${prog} against installed failed." ; exit 1 ) ; \
2602e5b6d6dSopenharmony_ci	done
2612e5b6d6dSopenharmony_ci
2622e5b6d6dSopenharmony_ci$(OUT)/$(PLUGLIB)/bin/$(TESTPROG):  $(GLOUT)/$(PLUGLIB)/obj-$(OK) $(OUT)/$(PLUGLIB)/provider_version.h $(ALLDIRS)
2632e5b6d6dSopenharmony_ci	@for prog in $(TESTPROG) ; \
2642e5b6d6dSopenharmony_ci	do \
2652e5b6d6dSopenharmony_ci		${call ECHO_COMPILE,$(shell $(PLUGLIB_ICU_CONFIG) --cxx --cxxflags --cppflags --ldflags) -o $(OUT)/$(PLUGLIB)/bin/$${prog} -I$(OUT)/$(PLUGLIB) $(TESTPROG_XTRA_OPTS) $(srcdir)/$${prog}.cpp} || exit 1 ; \
2662e5b6d6dSopenharmony_ci	done
2672e5b6d6dSopenharmony_ci
2682e5b6d6dSopenharmony_ci$(OUT)/%/lib/$(PLUGLIB_NAME):  $(GLOUT)/%/obj-$(OK) $(PLUG_EXTRA_DEPS)
2692e5b6d6dSopenharmony_ci	-mkdir -p $(OUT)/$*/lib
2702e5b6d6dSopenharmony_ci	$(shell $(PLUGLIB_ICU_CONFIG) --cxx --cxxflags --cppflags --ldflags) $(PLUG_EXTRA_LDFLAGS) -shared -o $@ $(GLOUT)/$*/*.o $(PLUGLIB_AVAILABLE_DATA) $(PLUGLIB_AVAILABLE_STATICS)
2712e5b6d6dSopenharmony_ci
2722e5b6d6dSopenharmony_ci#	cp $@ $(C_INS)/r$*/lib/
2732e5b6d6dSopenharmony_ci
2742e5b6d6dSopenharmony_ci$(OUT)/%/lib/$(LIBPROVIDER):  $(GLOUT)/%/obj-$(OK)
2752e5b6d6dSopenharmony_ci	-mkdir -p $(OUT)/$*/lib
2762e5b6d6dSopenharmony_ci	echo copy includes
2772e5b6d6dSopenharmony_ci	ar -rv $@ $(GLOUT)/$*/*.o
2782e5b6d6dSopenharmony_ci	ranlib $@
2792e5b6d6dSopenharmony_ci
2802e5b6d6dSopenharmony_ci## @@ build glu rename files
2812e5b6d6dSopenharmony_ciglurens: $(GLUREN_ICU)
2822e5b6d6dSopenharmony_ci
2832e5b6d6dSopenharmony_ci# build single gluren.h 
2842e5b6d6dSopenharmony_ci$(BUILD)/%/$(GLUREN_H): $(BUILD)/%/ok Makefile makegluren.sh
2852e5b6d6dSopenharmony_ci	-mkdir -p $(BUILD)/$*/$(GLUREN)
2862e5b6d6dSopenharmony_ci	env SRC="$(SRC)" SOURCE="$(SOURCE)" GLUE="$(GLUE)" ./makegluren.sh $@ $*
2872e5b6d6dSopenharmony_ci	@fgrep -q OICU_ $@ || ( echo "Error: $@: no OICU_ symbols found. Removing gluren.h " ; rm -f $@ ; exit 1)
2882e5b6d6dSopenharmony_ci
2892e5b6d6dSopenharmony_ci$(BUILD)/%/config/$(ICU_CONFIG): $(BUILD)/%/config/$(ICU_CONFIG_ORIG) icu-config.sed $(BUILD)/%/ok 
2902e5b6d6dSopenharmony_ci	sed -f icu-config.sed < $(BUILD)/$*/config/$(ICU_CONFIG_ORIG) >  $(BUILD)/$*/config/$(ICU_CONFIG) && chmod a+rx  $(BUILD)/$*/config/$(ICU_CONFIG)
2912e5b6d6dSopenharmony_ci
2922e5b6d6dSopenharmony_ci# perform installation
2932e5b6d6dSopenharmony_ci$(INST)/%/ok: $(BUILD)/%/ok
2942e5b6d6dSopenharmony_ci	echo $(SUBHEAD) $* "(backend) installing..."
2952e5b6d6dSopenharmony_ci	echo "INST " "[" $* "]"
2962e5b6d6dSopenharmony_ci	mkdir -p $(INST)/$*
2972e5b6d6dSopenharmony_ci	-$(call LOG_COMPILE,$(BUILD)$*/ok.log,$(MAKE) $(MOPTS) -C $(BUILD)/$* install $(MAKE_INSTALL_XTRA_OPTS))
2982e5b6d6dSopenharmony_ci	touch $@
2992e5b6d6dSopenharmony_ci
3002e5b6d6dSopenharmony_ci# unpack ICU and patch
3012e5b6d6dSopenharmony_ci$(SRC)/%/ok: $(ICUS)/icu4c-%-src.tgz
3022e5b6d6dSopenharmony_ci	-[ -d $(SRC)/$* ] && rm -rf $(SRC)/$*
3032e5b6d6dSopenharmony_ci	@echo $(SUBHEAD) $* "(backend) unpacking..."
3042e5b6d6dSopenharmony_ci	mkdir -p $(SRC)/$*
3052e5b6d6dSopenharmony_ci	$(call LOG_COMPILE,$(SRC)/$*/unpack.log,( cd $(SRC)/$* && gunzip -d < $(TOP)/$(ICUS)/icu4c-$*-src.tgz | tar xvfp - ))
3062e5b6d6dSopenharmony_ci	([ -f $(DOT)/patch/$* ] && patch -d $(SRC)/$* -p1 < $(DOT)/patch/$*) || true
3072e5b6d6dSopenharmony_ci	touch $@
3082e5b6d6dSopenharmony_ci
3092e5b6d6dSopenharmony_ci# config 
3102e5b6d6dSopenharmony_ci$(BUILD)/%/config.status: $(SRC)/%/ok
3112e5b6d6dSopenharmony_ci	@echo $(SUBHEAD) $* "(backend) configuring..."
3122e5b6d6dSopenharmony_ci	-[ -d $(BUILD)/$* ] && rm -rf $(BUILD)/$*
3132e5b6d6dSopenharmony_ci	mkdir -p $(BUILD)/$*
3142e5b6d6dSopenharmony_ci	$(call LOG_COMPILE,$(BUILD)/$*/configure.log,( cd $(BUILD)/$* && env CFLAGS="$(CFLAGS) $(PBLD_EXTRA_FLAGS)" CXXFLAGS="$(CXXFLAGS) $(PBLD_EXTRA_FLAGS)" $(shell $(SUPERCONF) $(TOP)/$(SRC)/$*/$(SOURCE) $*) $(CONFIGURE_OPTS) --srcdir=$(TOP)/$(SRC)/$*/$(SOURCE) --prefix=$(TOP)/$(INST)/$* ))
3152e5b6d6dSopenharmony_ci
3162e5b6d6dSopenharmony_ci# build 
3172e5b6d6dSopenharmony_ci# note: regex had renaming problems, and spoof depends on regex. Nuke them.
3182e5b6d6dSopenharmony_ci$(BUILD)/%/ok: $(BUILD)/%/config.status
3192e5b6d6dSopenharmony_ci	@echo $(SUBHEAD) $* "(backend) building.."
3202e5b6d6dSopenharmony_ci	$(call LOG_COMPILE,$(BUILD)/$*/ok2.log,( $(MAKE)  $(MOPTS) -C $(BUILD)/$* all $(MAKE_XTRA_OPTS) ))
3212e5b6d6dSopenharmony_ci	@if [ ! -f $(BUILD)/$*/common/putil.$(SOBJ) ]; \
3222e5b6d6dSopenharmony_ci	then \
3232e5b6d6dSopenharmony_ci		echo re-unpacking $(BUILD)/$*/common ; \
3242e5b6d6dSopenharmony_ci		( cd $(BUILD)/$*/common && ar xf ../lib/libsicuuc.a || echo could not unpack ../lib/libsicuuc.a ) ; \
3252e5b6d6dSopenharmony_ci		echo re-unpacking $(BUILD)/$*/i18n ; \
3262e5b6d6dSopenharmony_ci		( cd $(BUILD)/$*/i18n && ar xf ../lib/libsicui18n.a || echo could not unpack ../lib/libsicui18n.a ) ; \
3272e5b6d6dSopenharmony_ci	fi
3282e5b6d6dSopenharmony_ci	@if [ ! -f $(BUILD)/$*/common/putil.$(SOBJ) ]; \
3292e5b6d6dSopenharmony_ci	then \
3302e5b6d6dSopenharmony_ci		echo ERROR: still could not find $(BUILD)/$*/common/putil.$(SOBJ) - build may fail.; \
3312e5b6d6dSopenharmony_ci	fi
3322e5b6d6dSopenharmony_ci	-rm -f $(BUILD)/$*/i18n/uregex*.* $(BUILD)/$*/i18n/uspoof*.*o*
3332e5b6d6dSopenharmony_ci	touch $@
3342e5b6d6dSopenharmony_ci
3352e5b6d6dSopenharmony_ciinfo help:
3362e5b6d6dSopenharmony_ci	@echo $(SUBHEAD) Provider Build
3372e5b6d6dSopenharmony_ci	@echo "Targetting Provider against ICU $(PROVIDER_TARGET) ($(PLUGLIB), major $(PLUGLIB_MAJ))"
3382e5b6d6dSopenharmony_ci	@echo "Available plugins: $(PROVIDER_AVAILABLE) ($(PLUGLIB_AVAILABLE))"
3392e5b6d6dSopenharmony_ci	@echo "Available keywords:"
3402e5b6d6dSopenharmony_ci	@for ver in $(PROVIDER_AVAILABLE); do \
3412e5b6d6dSopenharmony_ci		echo "   ...@provider=icu"`echo $$ver | ./icu2symver.sh`; \
3422e5b6d6dSopenharmony_ci	done
3432e5b6d6dSopenharmony_ci	@echo "Plugin library will be $(PLUGLIB_NAME)"
3442e5b6d6dSopenharmony_ci	@echo
3452e5b6d6dSopenharmony_ci	@echo Available ICU tarballs:  $(ICU_TARBALLS)
3462e5b6d6dSopenharmony_ci	@echo Available ICU versions: $(shell echo $(ICU_TARBALLS_VERS) | tr '_' '.')
3472e5b6d6dSopenharmony_ci
3482e5b6d6dSopenharmony_ci$(OUT)/$(PLUGLIB)/provider_version.h: Makefile.local Makefile $(ALLDIRS)
3492e5b6d6dSopenharmony_ci	@echo $(SUBHEAD) $(PLUGIN) "(plugin)" Generating $@ ..
3502e5b6d6dSopenharmony_ci	@echo "/* Generated file. */" > $@
3512e5b6d6dSopenharmony_ci	@echo "const char *provider_version[] = {" >> $@
3522e5b6d6dSopenharmony_ci	@for ver in $(PROVIDER_AVAILABLE); do \
3532e5b6d6dSopenharmony_ci		sym=`echo $$ver | ./icu2symver.sh` ; \
3542e5b6d6dSopenharmony_ci		echo Version $$ver, Symbol $$sym ; \
3552e5b6d6dSopenharmony_ci		echo "\"$$sym\"",  >> $@ ; \
3562e5b6d6dSopenharmony_ci	done
3572e5b6d6dSopenharmony_ci	@echo " }; " >> $@
3582e5b6d6dSopenharmony_ci	@echo "#define PROVIDER_COUNT (sizeof(provider_version)/sizeof(provider_version[0]))" >> $@
3592e5b6d6dSopenharmony_ci	@echo >> $@
3602e5b6d6dSopenharmony_ci	@echo $(SUBHEAD) $(PLUGIN) "(plugin)" Generated $@
3612e5b6d6dSopenharmony_ci
3622e5b6d6dSopenharmony_ci#-- for the prototype
363