2 # See https://wiki.freebsd.org/LocaleNewApproach
3 # Taken from FreeBSD svn [base]/user/edwin/locale/cldr
8 # Modified by John Marino to suit DragonFly needs
14 .if ${.CURDIR} == ${.OBJDIR}
15 .error Do make obj first.
18 LOCALESRCDIR?= ${SRCTOP}/share
22 ETCDIR= ${BASEDIR}/etc
23 TOOLSDIR= ${BASEDIR}/tools
24 PATCHDIR= ${BASEDIR}/patch
25 UNIDIR= ${.OBJDIR:tA}/unicode
27 PKGS= openjdk11 p5-XML-Parser p5-Tie-IxHash p5-Text-Iconv utf8proc
29 @pkg info -e ${PKGS} || ( echo required packages: ${PKGS}; exit 1 )
31 KNOWN= monetdef numericdef msgdef colldef ctypedef # timedef
38 BASEDIR="${BASEDIR}" \
39 TOOLSDIR="${TOOLSDIR}" \
42 all: tools-test posix build afterbuild widths
43 .ORDER: tools-test posix build afterbuild widths
52 .ORDER: build-${t} afterbuild
61 -/usr/bin/diff -ruN -x Makefile -x Makefile.depend \
62 ${LOCALESRCDIR}/${t} ${t}
67 .for t in ${TYPES:Nctypedef}
71 cd ${LOCALESRCDIR}/${t}_unicode && \
72 rm -f Makefile *.src && \
74 install -m 644 ${t}/* ${LOCALESRCDIR}/${t}_unicode
77 install: install-ctypedef
79 cd ${LOCALESRCDIR}/ctypedef && \
80 rm -f C.UTF-8.src && \
82 install -m 644 ctypedef/C.UTF-8.src ${LOCALESRCDIR}/ctypedef
87 cd ${LOCALSRCDIR}/${t} && \
88 make && make install && make clean
93 CLEANDIRS+= ${t} ${t}.draft
95 mkdir -p ${t} ${t}.draft && \
96 perl -I ${TOOLSDIR} ${TOOLSDIR}/cldr2def.pl \
97 --unidir=${UNIDIR:tA} \
102 ${SETENV} OUTBASEDIR="${.OBJDIR}/${t}" ${TOOLSDIR}/finalize ${t}
105 BASE_LOCALES_OF_INTEREST?= \
106 af_ZA am_ET ar_AE ar_EG ar_JO ar_MA ar_QA ar_SA \
107 be_BY bg_BG ca_AD ca_ES ca_FR ca_IT \
108 cs_CZ da_DK de_AT de_CH de_DE el_GR en_AU en_CA \
109 en_GB en_HK en_IE en_NZ en_PH en_SG en_US en_ZA \
110 es_AR es_CR es_ES es_MX et_EE eu_ES fa_AF fa_IR fi_FI fr_BE \
111 fr_CA fr_CH fr_FR ga_IE he_IL hi_IN hr_HR hu_HU hy_AM \
112 is_IS it_CH it_IT ja_JP ko_KR lt_LT lv_LV \
113 nb_NO nl_BE nl_NL nn_NO pl_PL pt_BR pt_PT ro_RO \
114 ru_RU se_FI se_NO sk_SK sl_SI sv_FI sv_SE tr_TR \
116 kk_KZ mn_MN sr_Cyrl_RS sr_Latn_RS \
117 zh_Hans_CN zh_Hant_HK zh_Hant_TW \
118 bn_IN gu_IN or_IN ta_IN te_IN kn_IN ml_IN si_LK \
119 th_TH lo_LA bo_IN my_MM pa_Guru_IN ka_GE chr_US \
120 km_KH shi_Tfng_MA ii_CN vai_Vaii_LR vi_VN
126 CLDRFILES_CORE= https://unicode.org/Public/cldr/${CLDRVERSION:R}/core.zip
127 CLDRFILES_KEY= https://unicode.org/Public/cldr/${CLDRVERSION:R}/cldr-keyboards-${CLDRVERSION}.zip
128 CLDRFILES_TOOLS=https://unicode.org/Public/cldr/${CLDRVERSION:R}/cldr-tools-${CLDRVERSION}.jar
129 CLDRFILES_UCD= https://www.unicode.org/Public/zipped/${UCDVERSION}/UCD.zip
131 # fetch and extract targets
134 .for N in CORE KEY TOOLS UCD
136 fetch ${CLDRFILES_${N}}
137 fetch: ${CLDRFILES_${N}:T}
138 extract-${CLDRFILES_${N}:T}:: ${CLDRFILES_${N}:T} ${UNIDIR}
139 cd ${UNIDIR} && unzip -o ../${CLDRFILES_${N}:T}
140 extract: extract-${CLDRFILES_${N}:T}
142 echo ${CLDRVERSION} > ${UNIDIR}/cldr-version
143 mkdir -p ${UNIDIR}/seed/main
145 .if exists(${PATCHDIR})
146 cd ${UNIDIR} && cat ${PATCHDIR}/patch-* | patch
149 JAVA_CLDR= java -DCLDR_DIR=${UNIDIR:Q} -jar ${.OBJDIR:tA}/${CLDRFILES_TOOLS:T}
151 posix: posixcm post-posixcm posixsrc
152 .ORDER: posixcm post-posixcm posixsrc
153 ${UNIDIR}/posix: ${UNIDIR}
154 ln -s -f ../posix ${.TARGET}
156 rm -rf posix ${UNIDIR}/posix
157 ${UNIDIR}/posix/xx_Comm_C.UTF-8.src: ${UNIDIR}/posix
158 perl -I ${TOOLSDIR} ${TOOLSDIR}/utf8-rollup.pl \
160 post-posixcm: ${UNIDIR}/posix/xx_Comm_C.UTF-8.src
161 .for enc in ${ENCODINGS}
162 posixcm: posix/${enc}.cm
163 .ORDER: posix/${enc}.cm
166 ${JAVA_CLDR} org.unicode.cldr.posix.GenerateCharmap \
169 .for area in ${BASE_LOCALES_OF_INTEREST}
170 posixsrc: posix/${area}.UTF-8.src
171 .ORDER: posix/${area}.UTF-8.src
172 posix/${area}.UTF-8.src:
174 ${JAVA_CLDR} org.unicode.cldr.posix.GeneratePOSIX \
175 -d posix -m ${area} -c UTF-8
178 # generate widths.txt using the data from libut8proc
179 GETWIDTHS=${TOOLSDIR}/getwidths
180 MKWIDTHS=${TOOLSDIR}/mkwidths.pl
181 WIDTHS= ${ETCDIR}/final-maps/widths.txt
183 U8CFLAGS!=pkgconf --cflags libutf8proc
184 U8LIBS!=pkgconf --libs libutf8proc
188 CLEANFILES+=${TOOLSDIR}/getwidths
191 ${WIDTHS}: posixcm ${GETWIDTHS}
192 ${GETWIDTHS} | ${MKWIDTHS} ${.OBJDIR}/posix/UTF-8.cm ${.TARGET}
194 .include <bsd.obj.mk>