Debian Codegraph @

localedata/Makefile

raw symbols SCIP
1 # Copyright (C) 1996-2026 Free Software Foundation, Inc.
2 # Copyright The GNU Toolchain Authors.
3 # This file is part of the GNU C Library.
4
5 # The GNU C Library is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU Lesser General Public
7 # License as published by the Free Software Foundation; either
8 # version 2.1 of the License, or (at your option) any later version.
9
10 # The GNU C Library is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # Lesser General Public License for more details.
14
15 # You should have received a copy of the GNU Lesser General Public
16 # License along with the GNU C Library; if not, see
17 # <https://www.gnu.org/licenses/>.
18
19 # Makefile for installing locale data source files.
20
21 subdir := localedata
22
23 include ../Makeconfig
24
25 # List with all available character set descriptions.
26 charmaps := $(wildcard charmaps/[A-I]*) $(wildcard charmaps/[J-Z]*)
27
28 # List with all available character set descriptions.
29 locales := $(wildcard locales/*)
30
31 subdir-dirs = tests-mbwc
32 vpath %.c tests-mbwc
33 vpath %.h tests-mbwc
34
35 test-srcs := \
36 collate-test \
37 tst-ctype \
38 tst-fmon \
39 tst-langinfo-newlocale \
40 tst-langinfo-newlocale-static \
41 tst-langinfo-setlocale \
42 tst-langinfo-setlocale-static \
43 tst-numeric \
44 tst-rpmatch \
45 tst-trans \
46 xfrm-test \
47 # test-srcs
48 # List of test input files (list sorted alphabetically):
49 test-input := \
50 C.UTF-8 \
51 am_ET.UTF-8 \
52 az_AZ.UTF-8 \
53 be_BY.UTF-8 \
54 ber_DZ.UTF-8 \
55 ber_MA.UTF-8 \
56 bg_BG.UTF-8 \
57 br_FR.UTF-8 \
58 bs_BA.UTF-8 \
59 ckb_IQ.UTF-8 \
60 cmn_TW.UTF-8 \
61 crh_UA.UTF-8 \
62 cs_CZ.UTF-8 \
63 csb_PL.UTF-8 \
64 cv_RU.UTF-8 \
65 cy_GB.UTF-8 \
66 da_DK.ISO-8859-1 \
67 de_DE.ISO-8859-1 \
68 dsb_DE.UTF-8 \
69 dz_BT.UTF-8 \
70 en_US.ISO-8859-1 \
71 en_US.UTF-8 \
72 eo.UTF-8 \
73 es_ES.UTF-8 \
74 et_EE.UTF-8 \
75 fa_IR.UTF-8 \
76 fi_FI.UTF-8 \
77 fil_PH.UTF-8 \
78 fr_CA.UTF-8 \
79 fr_FR.UTF-8 \
80 fur_IT.UTF-8 \
81 gez_ER.UTF-8@abegede \
82 ha_NG.UTF-8 \
83 hr_HR.ISO-8859-2 \
84 hr_HR.UTF-8 \
85 hsb_DE.UTF-8 \
86 hu_HU.UTF-8 \
87 ig_NG.UTF-8 \
88 ik_CA.UTF-8 \
89 is_IS.UTF-8 \
90 kk_KZ.UTF-8 \
91 ku_TR.UTF-8 \
92 ky_KG.UTF-8 \
93 ln_CD.UTF-8 \
94 lt_LT.UTF-8 \
95 ltg_LV.UTF-8 \
96 lv_LV.UTF-8 \
97 mdf_RU.UTF-8 \
98 mi_NZ.UTF-8 \
99 ml_IN.UTF-8 \
100 mn_MN.UTF-8 \
101 mr_IN.UTF-8 \
102 mt_MT.UTF-8 \
103 nan_TW.UTF-8@latin \
104 nb_NO.UTF-8 \
105 om_KE.UTF-8 \
106 or_IN.UTF-8 \
107 os_RU.UTF-8 \
108 pl_PL.UTF-8 \
109 ps_AF.UTF-8 \
110 rif_MA.UTF-8 \
111 ro_RO.UTF-8 \
112 ru_RU.UTF-8 \
113 sah_RU.UTF-8 \
114 sc_IT.UTF-8 \
115 se_NO.UTF-8 \
116 si_LK.UTF-8 \
117 sq_AL.UTF-8 \
118 sr_RS.UTF-8 \
119 sv_SE.ISO-8859-1 \
120 sv_SE.UTF-8 \
121 syr.UTF-8 \
122 szl_PL.UTF-8 \
123 tg_TJ.UTF-8 \
124 th_TH.UTF-8 \
125 tk_TM.UTF-8 \
126 tr_TR.UTF-8 \
127 tt_RU.UTF-8 \
128 tt_RU.UTF-8@iqtelif \
129 ug_CN.UTF-8 \
130 uk_UA.UTF-8 \
131 uz_UZ.UTF-8 \
132 vi_VN.UTF-8 \
133 yi_US.UTF-8 \
134 yo_NG.UTF-8 \
135 zh_CN.UTF-8 \
136 # test-input
137
138 test-input-data = $(addsuffix .in, $(test-input))
139 test-output := $(foreach s, .out .xout, \
140 $(addsuffix $s, $(basename $(test-input))))
141 ld-test-names := test1 test2 test3 test4 test5 test6 test7
142 ld-test-srcs := $(addprefix tests/,$(addsuffix .cm,$(ld-test-names)) \
143 $(addsuffix .def,$(ld-test-names)) \
144 $(addsuffix .ds,test5 test6) \
145 test6.c trans.def)
146
147 fmon-tests = \
148 n01y12 \
149 n02n40 \
150 n10y31 \
151 n11y41 \
152 n12y11 \
153 n20n32 \
154 n30y20 \
155 n41n00 \
156 y01y10 \
157 y02n22 \
158 y22n42 \
159 y30y21 \
160 y32n31 \
161 y40y00 \
162 y42n21 \
163 # fmon-tests
164
165 generated += \
166 $(test-input) \
167 $(test-output) \
168 mtrace-tst-leaks.out \
169 sort-test.out \
170 tst-leaks.mtrace \
171 tst-locale.out \
172 # generated
173 generated-dirs += \
174 $(addprefix tstfmon_,$(fmon-tests)) \
175 $(ld-test-names) \
176 de_DE.437 \
177 tt_TT \
178 # generated-dirs
179
180 ifeq ($(run-built-tests),yes)
181 locale_test_suite := \
182 tst_iswalnum \
183 tst_iswalpha \
184 tst_iswcntrl \
185 tst_iswctype \
186 tst_iswdigit \
187 tst_iswgraph \
188 tst_iswlower \
189 tst_iswprint \
190 tst_iswpunct \
191 tst_iswspace \
192 tst_iswupper \
193 tst_iswxdigit \
194 tst_mblen \
195 tst_mbrlen \
196 tst_mbrtowc \
197 tst_mbsrtowcs \
198 tst_mbstowcs \
199 tst_mbtowc \
200 tst_strcoll \
201 tst_strfmon \
202 tst_strxfrm \
203 tst_swscanf \
204 tst_towctrans \
205 tst_towlower \
206 tst_towupper \
207 tst_wcrtomb \
208 tst_wcscat \
209 tst_wcschr \
210 tst_wcscmp \
211 tst_wcscoll \
212 tst_wcscpy \
213 tst_wcscspn \
214 tst_wcslen \
215 tst_wcsncat \
216 tst_wcsncmp \
217 tst_wcsncpy \
218 tst_wcspbrk \
219 tst_wcsrtombs \
220 tst_wcsspn \
221 tst_wcsstr \
222 tst_wcstod \
223 tst_wcstok \
224 tst_wcstombs \
225 tst_wcswidth \
226 tst_wcsxfrm \
227 tst_wctob \
228 tst_wctomb \
229 tst_wctrans \
230 tst_wctype \
231 tst_wcwidth \
232 # locale_test_suite
233
234 tests = \
235 $(locale_test_suite) \
236 bug-iconv-trans \
237 bug-setlocale1 \
238 bug-usesetlocale \
239 tst-bz12701-lc \
240 tst-bz13988 \
241 tst-c-utf8-consistency \
242 tst-digits \
243 tst-iconv-emojis-trans \
244 tst-iconv-math-trans \
245 tst-leaks \
246 tst-locale-loadlocale \
247 tst-mbswcs1 \
248 tst-mbswcs2 \
249 tst-mbswcs3 \
250 tst-mbswcs4 \
251 tst-mbswcs5 \
252 tst-mbswcs6 \
253 tst-scanf-width-digit \
254 tst-scanf-width-point \
255 tst-setlocale \
256 tst-setlocale2 \
257 tst-setlocale3 \
258 tst-sscanf \
259 tst-strfmon1 \
260 tst-wctype \
261 tst-xlocale1 \
262 tst-xlocale2 \
263 # tests
264
265 tests-static = bug-setlocale1-static
266 tests += $(tests-static)
267 ifeq (yes,$(build-shared))
268 ifneq (no,$(PERL))
269 tests-special += $(objpfx)mtrace-tst-leaks.out
270 endif
271 endif
272 endif
273 tests-container = \
274 tst-localedef-hardlinks \
275 # tests-container
276
277 # Files to install.
278 ifeq ($(INSTALL_UNCOMPRESSED),yes)
279 # This option is for testing inside the testroot container, as the
280 # container does not include a working gunzip program.
281 install-others := $(addprefix $(inst_i18ndir)/, \
282 $(charmaps) \
283 $(locales))
284 else
285 install-others := $(addprefix $(inst_i18ndir)/, \
286 $(addsuffix .gz, $(charmaps)) \
287 $(locales))
288 endif
289
290 tests: $(objdir)/iconvdata/gconv-modules
291
292 tests-static += \
293 tst-langinfo-newlocale-static \
294 tst-langinfo-setlocale-static \
295 # tests-static
296
297 ifeq ($(run-built-tests),yes)
298 tests-special += \
299 $(objpfx)sort-test.out \
300 $(objpfx)tst-ctype.out \
301 $(objpfx)tst-fmon.out \
302 $(objpfx)tst-langinfo-newlocale-static.out \
303 $(objpfx)tst-langinfo-newlocale.out \
304 $(objpfx)tst-langinfo-setlocale-static.out \
305 $(objpfx)tst-langinfo-setlocale.out \
306 $(objpfx)tst-locale.out \
307 $(objpfx)tst-numeric.out \
308 $(objpfx)tst-rpmatch.out \
309 $(objpfx)tst-trans.out \
310 # tests-special
311 # We have to generate locales (list sorted alphabetically)
312 LOCALES := \
313 C.UTF-8 \
314 am_ET.UTF-8 \
315 az_AZ.UTF-8 \
316 be_BY.UTF-8 \
317 ber_DZ.UTF-8 \
318 ber_MA.UTF-8 \
319 bg_BG.UTF-8 \
320 br_FR.UTF-8 \
321 bs_BA.UTF-8 \
322 ckb_IQ.UTF-8 \
323 cmn_TW.UTF-8 \
324 crh_UA.UTF-8 \
325 cs_CZ.UTF-8 \
326 csb_PL.UTF-8 \
327 cv_RU.UTF-8 \
328 cy_GB.UTF-8 \
329 da_DK.ISO-8859-1 \
330 de_DE.ISO-8859-1 \
331 de_DE.UTF-8 \
332 dsb_DE.UTF-8 \
333 dz_BT.UTF-8 \
334 en_GB.UTF-8 \
335 en_US \
336 en_US.ANSI_X3.4-1968 \
337 en_US.ISO-8859-1\
338 en_US.UTF-8 \
339 eo.UTF-8 \
340 es_ES.UTF-8 \
341 et_EE.UTF-8 \
342 fa_IR.UTF-8 \
343 fi_FI.UTF-8 \
344 fil_PH.UTF-8 \
345 fr_CA.UTF-8 \
346 fr_FR.ISO-8859-1 \
347 fr_FR.UTF-8 \
348 fur_IT.UTF-8 \
349 gez_ER.UTF-8@abegede \
350 ha_NG.UTF-8 \
351 hr_HR.ISO-8859-2 \
352 hr_HR.UTF-8 \
353 hsb_DE.UTF-8 \
354 hu_HU.UTF-8 \
355 ig_NG.UTF-8 \
356 ik_CA.UTF-8 \
357 is_IS.UTF-8 \
358 ja_JP.EUC-JP \
359 ja_JP.SJIS \
360 ja_JP.UTF-8 \
361 kk_KZ.UTF-8 \
362 ku_TR.UTF-8 \
363 ky_KG.UTF-8 \
364 ln_CD.UTF-8 \
365 lt_LT.UTF-8 \
366 ltg_LV.UTF-8 \
367 lv_LV.UTF-8 \
368 mdf_RU.UTF-8 \
369 mi_NZ.UTF-8 \
370 ml_IN.UTF-8 \
371 mn_MN.UTF-8 \
372 mr_IN.UTF-8 \
373 mt_MT.UTF-8 \
374 nan_TW.UTF-8@latin \
375 nb_NO.ISO-8859-1 \
376 nb_NO.UTF-8 \
377 nl_NL.UTF-8 \
378 nn_NO.ISO-8859-1 \
379 om_KE.UTF-8 \
380 or_IN.UTF-8 \
381 os_RU.UTF-8 \
382 pl_PL.UTF-8 \
383 ps_AF.UTF-8 \
384 rif_MA.UTF-8 \
385 ro_RO.UTF-8 \
386 ru_RU.UTF-8 \
387 sah_RU.UTF-8 \
388 sc_IT.UTF-8 \
389 se_NO.UTF-8 \
390 si_LK.UTF-8 \
391 sq_AL.UTF-8 \
392 sr_RS.UTF-8 \
393 sv_SE.ISO-8859-1 \
394 sv_SE.UTF-8 \
395 syr.UTF-8 \
396 szl_PL.UTF-8 \
397 tg_TJ.UTF-8 \
398 th_TH.UTF-8 \
399 tk_TM.UTF-8 \
400 tr_TR.ISO-8859-9 \
401 tr_TR.UTF-8 \
402 tt_RU.UTF-8 \
403 tt_RU.UTF-8@iqtelif \
404 ug_CN.UTF-8 \
405 uk_UA.UTF-8 \
406 uz_UZ.UTF-8 \
407 vi_VN.UTF-8 \
408 yi_US.UTF-8 \
409 yo_NG.UTF-8 \
410 zh_CN.UTF-8 \
411 zh_TW.EUC-TW \
412 # LOCALES
413
414 include ../gen-locales.mk
415
416 $(objpfx)tst-iconv-emojis-trans.out: $(gen-locales)
417
418 $(objpfx)tst-iconv-math-trans.out: $(gen-locales)
419 # tst-locale-loadlocale: Needs an en_US-named locale for the test.
420 $(objpfx)tst-locale-loadlocale.out: $(gen-locales)
421 endif
422
423 include ../Rules
424
425 ifeq ($(INSTALL_UNCOMPRESSED),yes)
426 # Install the charmap files as-is. This option is for testing inside
427 # the testroot container, as the container does not include a working
428 # gunzip program.
429 $(inst_i18ndir)/charmaps/%: charmaps/% $(+force)
430 $(make-target-directory)
431 rm -f $@
432 $(INSTALL_DATA) $< $@
433 else
434 # Install the charmap files in gzipped format.
435 $(inst_i18ndir)/charmaps/%.gz: charmaps/% $(+force)
436 $(make-target-directory)
437 rm -f $(@:.gz=) $@
438 $(INSTALL_DATA) $< $(@:.gz=)
439 gzip -9n $(@:.gz=)
440 endif
441
442 # Install the locale source files in the appropriate directory.
443 $(inst_i18ndir)/locales/%: locales/% $(+force); $(do-install)
444
445 ifeq ($(run-built-tests),yes)
446 generated-dirs += $(LOCALES)
447
448 $(addsuffix .out,$(addprefix $(objpfx),$(tests))): %: \
449 $(addprefix $(objpfx),$(CTYPE_FILES))
450
451 $(objpfx)sort-test.out: sort-test.sh $(objpfx)collate-test $(objpfx)xfrm-test \
452 $(test-input-data) $(addprefix $(objpfx),$(CTYPE_FILES))
453 $(SHELL) $< $(common-objpfx) '$(test-program-prefix-before-env)' \
454 '$(run-program-env)' '$(test-program-prefix-after-env)' \
455 $(test-input) \
456 > $@; \
457 $(evaluate-test)
458 $(objpfx)tst-fmon.out: tst-fmon.sh $(objpfx)tst-fmon tst-fmon.data \
459 $(objpfx)sort-test.out \
460 $(addprefix $(objpfx),$(CTYPE_FILES))
461 $(SHELL) $< $(common-objpfx) '$(run-program-prefix-before-env)' \
462 '$(run-program-env)' '$(run-program-prefix-after-env)' \
463 '$(test-program-prefix)' tst-fmon.data \
464 > $@; \
465 $(evaluate-test)
466 $(objpfx)tst-numeric.out: tst-numeric.sh $(objpfx)tst-numeric tst-numeric.data \
467 $(objpfx)sort-test.out \
468 $(addprefix $(objpfx),$(CTYPE_FILES))
469 $(SHELL) $< $(common-objpfx) '$(test-program-prefix)' tst-numeric.data \
470 > $@; \
471 $(evaluate-test)
472 $(objpfx)tst-locale.out: tst-locale.sh $(common-objpfx)locale/localedef \
473 $(ld-test-srcs) $(addprefix $(objpfx),$(CTYPE_FILES))
474 $(SHELL) $< $(common-objpfx) '$(built-program-cmd-before-env)' \
475 '$(run-program-env)' '$(built-program-cmd-after-env)' > $@; \
476 $(evaluate-test)
477 $(objpfx)tst-rpmatch.out: tst-rpmatch.sh $(objpfx)tst-rpmatch \
478 $(objpfx)tst-fmon.out \
479 $(addprefix $(objpfx),$(CTYPE_FILES))
480 $(SHELL) $< $(common-objpfx) '$(test-program-cmd)' > $@; \
481 $(evaluate-test)
482 $(objpfx)tst-trans.out: tst-trans.sh $(objpfx)tst-trans \
483 $(addprefix $(objpfx),$(CTYPE_FILES))
484 $(SHELL) $< $(common-objpfx) '$(run-program-prefix-before-env)' \
485 '$(run-program-env)' '$(run-program-prefix-after-env)' \
486 '$(test-program-prefix-before-env)' \
487 '$(test-program-prefix-after-env)'; \
488 $(evaluate-test)
489 $(objpfx)tst-ctype.out: tst-ctype.sh $(objpfx)tst-ctype \
490 $(objpfx)sort-test.out \
491 $(addprefix $(objpfx),$(CTYPE_FILES))
492 $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
493 '$(run-program-env)' '$(test-program-cmd-after-env)'; \
494 $(evaluate-test)
495 $(objpfx)tst-langinfo-newlocale.out: tst-langinfo.sh \
496 $(objpfx)tst-langinfo-newlocale \
497 $(objpfx)sort-test.out \
498 $(addprefix $(objpfx),$(CTYPE_FILES))
499 $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
500 '$(run-program-env)' '$(test-program-cmd-after-env)' > $@; \
501 $(evaluate-test)
502 $(objpfx)tst-langinfo-newlocale-static.out: tst-langinfo.sh \
503 $(objpfx)tst-langinfo-newlocale-static \
504 $(objpfx)sort-test.out \
505 $(addprefix $(objpfx),$(CTYPE_FILES))
506 $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
507 '$(run-program-env)' '$(test-program-cmd-after-env)' > $@; \
508 $(evaluate-test)
509 # Static use of newlocale is known not to work. See Bug 23164.
510 test-xfail-tst-langinfo-newlocale-static = yes
511
512 $(objpfx)tst-langinfo-setlocale.out: tst-langinfo.sh \
513 $(objpfx)tst-langinfo-setlocale \
514 $(objpfx)sort-test.out \
515 $(addprefix $(objpfx),$(CTYPE_FILES))
516 $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
517 '$(run-program-env)' '$(test-program-cmd-after-env)' > $@; \
518 $(evaluate-test)
519 $(objpfx)tst-langinfo-setlocale-static.out: tst-langinfo.sh \
520 $(objpfx)tst-langinfo-setlocale-static \
521 $(objpfx)sort-test.out \
522 $(addprefix $(objpfx),$(CTYPE_FILES))
523 $(SHELL) $< $(common-objpfx) '$(test-program-cmd-before-env)' \
524 '$(run-program-env)' '$(test-program-cmd-after-env)' > $@; \
525 $(evaluate-test)
526
527 $(objpfx)tst-digits.out: $(objpfx)tst-locale.out
528 $(objpfx)tst-mbswcs6.out: $(addprefix $(objpfx),$(CTYPE_FILES))
529 endif
530
531 include SUPPORTED
532
533 INSTALL-SUPPORTED-LOCALE-ARCHIVE=$(addprefix install-archive-, $(SUPPORTED-LOCALES))
534 INSTALL-SUPPORTED-LOCALE-FILES=$(addprefix install-files-, $(SUPPORTED-LOCALES))
535
536 # Sometimes the whole collection of locale files should be installed.
537 LOCALEDEF=I18NPATH=. GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
538 $(rtld-prefix) $(common-objpfx)locale/localedef
539 install-locales: install-locale-archive
540
541 # Create and install the locale-archive file.
542 install-locale-archive: $(INSTALL-SUPPORTED-LOCALE-ARCHIVE)
543 # Create and install the locales individually (no archive).
544 install-locale-files: $(INSTALL-SUPPORTED-LOCALE-FILES)
545
546 install-locales-dir:
547 $(..)./scripts/mkinstalldirs $(inst_complocaledir)
548
549 # The SHIFT_JIS and SHIFT_JISX0213 character maps are not ASCII compatible,
550 # therefore we have to use --no-warnings=ascii to disable the ASCII check.
551 # See localedata/gen-locale.sh for the same logic.
552 define build-one-locale
553 locale=`echo $@ | sed -e 's/^install-[a-z]*-//'`; \
554 charset=`echo $$locale | sed -e 's,.*/,,'`; \
555 locale=`echo $$locale | sed -e 's,/[^/]*,,'`; \
556 if [ "$$charset" = 'SHIFT_JIS' ] \
557 || [ "$$charset" = 'SHIFT_JISX0213' ]; then \
558 flags="$$flags --no-warnings=ascii"; \
559 fi; \
560 echo -n `echo $$locale | sed 's/\([^.\@]*\).*/\1/'`; \
561 echo -n ".$$charset"; \
562 echo -n `echo $$locale | sed 's/\([^\@]*\)\(\@.*\)*/\2/'`; \
563 echo -n '...'; \
564 input=`echo $$locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; \
565 $(LOCALEDEF) $$flags --alias-file=../intl/locale.alias \
566 -i locales/$$input -f charmaps/$$charset \
567 $(addprefix --prefix=,$(install_root)) $$locale \
568 && echo ' done';
569 endef
570
571 $(INSTALL-SUPPORTED-LOCALE-ARCHIVE): install-locales-dir
572 @flags=""; \
573 $(build-one-locale)
574
575 $(INSTALL-SUPPORTED-LOCALE-FILES): install-locales-dir
576 @flags="--no-archive --no-hard-links"; \
577 $(build-one-locale)
578
579 tst-setlocale-ENV = LC_ALL=ja_JP.EUC-JP
580 tst-wctype-ENV = LC_ALL=ja_JP.EUC-JP
581
582 tst-leaks-ENV = MALLOC_TRACE=$(objpfx)tst-leaks.mtrace \
583 LD_PRELOAD=$(common-objpfx)/malloc/libc_malloc_debug.so
584 $(objpfx)mtrace-tst-leaks.out: $(objpfx)tst-leaks.out
585 $(common-objpfx)malloc/mtrace $(objpfx)tst-leaks.mtrace > $@; \
586 $(evaluate-test)
587
588 bug-setlocale1-ENV-only = LOCPATH=$(objpfx) LC_CTYPE=de_DE.UTF-8
589 bug-setlocale1-static-ENV-only = $(bug-setlocale1-ENV-only)
590
591 $(objdir)/iconvdata/gconv-modules:
592 $(MAKE) -C ../iconvdata subdir=iconvdata $@