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