]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - tools/tools/locale/Makefile
stress2: Cap total runtime
[FreeBSD/FreeBSD.git] / tools / tools / locale / Makefile
1 # See https://wiki.freebsd.org/LocaleNewApproach
2 # Taken from FreeBSD svn [base]/user/edwin/locale/cldr
3 #
4 # needs:
5 # devel/p5-Tie-IxHash
6 #
7 # Modified by John Marino to suit DragonFly needs
8 #
9
10 CLDRVERSION=    43.0
11 UCDVERSION=     15.0.0
12
13 .if ${.CURDIR} == ${.OBJDIR}
14 .error Do make obj first.
15 .endif
16
17 LOCALESRCDIR?=  ${SRCTOP}/share
18 TMPDIR?=        /tmp
19
20 BASEDIR=        ${.CURDIR}
21 ETCDIR=         ${BASEDIR}/etc
22 TOOLSDIR=       ${BASEDIR}/tools
23 PATCHDIR=       ${BASEDIR}/patch
24 UNIDIR=         ${.OBJDIR:tA}/unicode
25
26 PKGS=   openjdk11 p5-XML-Parser p5-Tie-IxHash p5-Text-Iconv utf8proc
27 tools-test:
28         @pkg info -e ${PKGS} || ( echo required packages: ${PKGS}; exit 1 )
29
30 KNOWN=          monetdef numericdef msgdef colldef ctypedef # timedef
31 TYPES?=         ${KNOWN}
32
33 SETENV= env -i \
34         PATH="${PATH}" \
35         TMPDIR="${TMPDIR}" \
36         UNIDIR="${UNIDIR}" \
37         BASEDIR="${BASEDIR}" \
38         TOOLSDIR="${TOOLSDIR}" \
39         ETCDIR="${ETCDIR}"
40
41 all: tools-test posix build afterbuild widths
42 .ORDER: tools-test posix build afterbuild widths
43
44 afterbuild: build
45         @echo ""
46         @find . -name *failed
47
48 .for t in ${TYPES}
49 .  if ${KNOWN:M${t}}
50 build: build-${t}
51 .ORDER: build-${t} afterbuild
52 .  endif
53 .endfor
54
55 diff:
56 .for t in ${TYPES}
57 .  if ${KNOWN:M${t}}
58 diff: diff-${t}
59 diff-${t}:
60         -/usr/bin/diff -ruN -x Makefile -x Makefile.depend \
61             ${LOCALESRCDIR}/${t} ${t}
62 .  endif
63 .endfor
64
65 install:
66 .for t in ${TYPES:Nctypedef}
67 .  if ${KNOWN:M${t}}
68 install: install-${t}
69 install-${t}:
70         cd ${LOCALESRCDIR}/${t}_unicode && \
71             rm -f Makefile *.src && \
72             cd ${.OBJDIR} && \
73             install -m 644 ${t}/* ${LOCALESRCDIR}/${t}_unicode
74 .  endif
75 .endfor
76 install: install-ctypedef
77 install-ctypedef:
78         cd ${LOCALESRCDIR}/ctypedef && \
79                 rm -f C.UTF-8.src && \
80                 cd ${.OBJDIR} && \
81                 install -m 644 ctypedef/C.UTF-8.src ${LOCALESRCDIR}/ctypedef
82
83 post-install:
84 .for t in ${TYPES}
85 .  if ${KNOWN:M${t}}
86         cd ${LOCALSRCDIR}/${t} && \
87             make && make install && make clean
88 .  endif
89 .endfor
90
91 .for t in ${TYPES}
92 CLEANDIRS+=     ${t} ${t}.draft
93 ${t}:
94         mkdir -p ${t} ${t}.draft && \
95         perl -I ${TOOLSDIR} ${TOOLSDIR}/cldr2def.pl \
96                 --unidir=${UNIDIR:tA} \
97                 --etc=${ETCDIR:tA} \
98                 --type=${t}
99
100 build-${t}: ${t}
101         ${SETENV} OUTBASEDIR="${.OBJDIR}/${t}" ${TOOLSDIR}/finalize ${t}
102 .endfor
103
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 \
114         uk_UA \
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
120
121 ENCODINGS=      UTF-8 \
122                 UTF-32
123
124 # CLDR files
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
129
130 # fetch and extract targets
131 ${UNIDIR}:
132         mkdir -p ${UNIDIR}
133 .for N in CORE KEY TOOLS UCD
134 ${CLDRFILES_${N}:T}:
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}
140 .endfor
141         echo ${CLDRVERSION} > ${UNIDIR}/cldr-version
142         mkdir -p ${UNIDIR}/seed/main
143 patch::
144 .if exists(${PATCHDIR})
145         cd ${UNIDIR} && cat ${PATCHDIR}/patch-* | patch
146 .endif
147
148 JAVA_CLDR= java -DCLDR_DIR=${UNIDIR:Q} -jar ${.OBJDIR:tA}/${CLDRFILES_TOOLS:T}
149
150 posix: posixcm post-posixcm posixsrc
151 .ORDER: posixcm post-posixcm posixsrc
152 ${UNIDIR}/posix: ${UNIDIR}
153         ln -s -f ../posix ${.TARGET}
154 clean-posix:
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 \
158             --unidir=${UNIDIR}
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
163 posix/${enc}.cm:
164         mkdir -p posix && \
165             ${JAVA_CLDR} org.unicode.cldr.posix.GenerateCharmap \
166                 -d posix -c ${enc}
167 .endfor
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:
172         mkdir -p posix && \
173             ${JAVA_CLDR} org.unicode.cldr.posix.GeneratePOSIX \
174                 -d posix -m ${area} -c UTF-8
175 .endfor
176
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
181
182 U8CFLAGS!=pkgconf --cflags libutf8proc
183 U8LIBS!=pkgconf --libs libutf8proc
184 CFLAGS+=${U8CFLAGS}
185 LDFLAGS+=${U8LIBS}
186
187 CLEANFILES+=${TOOLSDIR}/getwidths
188
189 widths: ${WIDTHS}
190 ${WIDTHS}: posixcm ${GETWIDTHS}
191         ${GETWIDTHS} | ${MKWIDTHS} ${.OBJDIR}/posix/UTF-8.cm ${.TARGET}
192
193 .include <bsd.obj.mk>