Changeset View
Changeset View
Standalone View
Standalone View
tools/tools/locale/Makefile
# $FreeBSD$ | # $FreeBSD$ | ||||
# See https://wiki.freebsd.org/LocaleNewApproach | # See https://wiki.freebsd.org/LocaleNewApproach | ||||
# Taken from FreeBSD svn [base]/user/edwin/locale/cldr | # Taken from FreeBSD svn [base]/user/edwin/locale/cldr | ||||
# | # | ||||
# needs: | # needs: | ||||
# devel/p5-Tie-IxHash | # devel/p5-Tie-IxHash | ||||
# | # | ||||
# Modified by John Marino to suit DragonFly needs | # Modified by John Marino to suit DragonFly needs | ||||
# | # | ||||
.if ${.CURDIR} == ${.OBJDIR} | |||||
.error Do make obj first. | |||||
.endif | |||||
.OBJDIR: . | LOCALESRCDIR?= ${DESTDIR}/usr/src/share | ||||
TMPDIR?= /tmp | |||||
.if !defined(UNIDIR) | BASEDIR= ${.CURDIR} | ||||
.error UNIDIR is not set | ETCDIR= ${BASEDIR}/etc | ||||
.endif | TOOLSDIR= ${BASEDIR}/tools | ||||
PASSON= UNIDIR="${UNIDIR}" | PATCHDIR= ${BASEDIR}/patch | ||||
UNIDIR= ${.OBJDIR:tA}/unicode | |||||
ETCDIR= ${.CURDIR}/etc | PKGS= openjdk8 \ | ||||
apache-ant \ | |||||
p5-XML-Parser \ | |||||
p5-Tie-IxHash \ | |||||
p5-Text-Iconv | |||||
tools-test: | |||||
pkg info -e ${PKGS} | |||||
@echo tools ok. | |||||
KNOWN= monetdef numericdef msgdef colldef ctypedef # timedef | KNOWN= monetdef numericdef msgdef colldef ctypedef # timedef | ||||
TYPES?= ${KNOWN} | TYPES?= ${KNOWN} | ||||
LOCALE_DESTDIR?= /tmp/generated-locales/ | |||||
COLLATION_SPECIAL?= \ | COLLATION_SPECIAL?= \ | ||||
cs_CZ ISO8859-2 \ | cs_CZ ISO8859-2 \ | ||||
da_DK ISO8859-1 \ | da_DK ISO8859-1 \ | ||||
da_DK ISO8859-15 \ | da_DK ISO8859-15 \ | ||||
hr_HR ISO8859-2 \ | hr_HR ISO8859-2 \ | ||||
hu_HU ISO8859-2 \ | hu_HU ISO8859-2 \ | ||||
nb_NO ISO8859-1 \ | nb_NO ISO8859-1 \ | ||||
nb_NO ISO8859-15 \ | nb_NO ISO8859-15 \ | ||||
sk_SK ISO8859-2 \ | sk_SK ISO8859-2 \ | ||||
sr_Latn_RS ISO8859-2 \ | sr_Latn_RS ISO8859-2 \ | ||||
sr_Cyrl_RS ISO8859-5 \ | sr_Cyrl_RS ISO8859-5 \ | ||||
zh_Hans_CN GB2312 \ | zh_Hans_CN GB2312 \ | ||||
zh_Hans_CN eucCN \ | zh_Hans_CN eucCN \ | ||||
zh_Hant_TW Big5 \ | zh_Hant_TW Big5 \ | ||||
zh_Hans_CN GB18030 \ | zh_Hans_CN GB18030 \ | ||||
zh_Hans_CN GBK \ | zh_Hans_CN GBK \ | ||||
ja_JP eucJP \ | ja_JP eucJP \ | ||||
nn_NO ISO8859-15 \ | nn_NO ISO8859-15 \ | ||||
nn_NO ISO8859-1 | nn_NO ISO8859-1 | ||||
.for area enc in ${COLLATION_SPECIAL} | .for area enc in ${COLLATION_SPECIAL} | ||||
COLLATIONS_SPECIAL_ENV+= ${area}.${enc} | COLLATIONS_SPECIAL_ENV+= ${area}.${enc} | ||||
.endfor | .endfor | ||||
PASSON+= COLLATIONS_SPECIAL="${COLLATIONS_SPECIAL_ENV}" | SETENV= env -i \ | ||||
PATH="${PATH}" \ | |||||
TMPDIR="${TMPDIR}" \ | |||||
COLLATIONS_SPECIAL="${COLLATIONS_SPECIAL_ENV}" \ | |||||
UNIDIR="${UNIDIR}" \ | |||||
BASEDIR="${BASEDIR}" \ | |||||
TOOLSDIR="${TOOLSDIR}" \ | |||||
ETCDIR="${ETCDIR}" | |||||
all: | all: posix build afterbuild | ||||
.ORDER: posix build afterbuild | |||||
afterbuild: build | |||||
@echo "" | |||||
@find . -name *failed | |||||
.for t in ${TYPES} | .for t in ${TYPES} | ||||
. if ${KNOWN:M${t}} | . if ${KNOWN:M${t}} | ||||
test -d ${t} || mkdir ${t} | build: build-${t} | ||||
make build-${t} | .ORDER: build-${t} afterbuild | ||||
. endif | . endif | ||||
.endfor | .endfor | ||||
@echo "" | |||||
@find . -name *failed | |||||
diff: | |||||
.for t in ${TYPES} | .for t in ${TYPES} | ||||
. if ${KNOWN:M${t}} | |||||
diff: diff-${t} | |||||
diff-${t}: | |||||
-/usr/bin/diff -ruN -x Makefile -x Makefile.depend \ | |||||
${LOCALESRCDIR}/${t} ${t} | |||||
. endif | |||||
.endfor | |||||
install: | |||||
.for t in ${TYPES} | |||||
. if ${KNOWN:M${t}} | |||||
install: install-${t} | install: install-${t} | ||||
install-${t}: | install-${t}: | ||||
. if ${KNOWN:M${t}} | cd ${LOCALESRCDIR}/${t} && \ | ||||
rm -rf ${.CURDIR}/${t}.draft | rm -f Makefile *.src && \ | ||||
rm -f ${.CURDIR}/../../../share/${t}/Makefile | install -c ${t}/* ${LOCALESRCDIR}/${t} | ||||
rm -f ${.CURDIR}/../../../share/${t}/*.src | |||||
mv ${.CURDIR}/${t}/* ${.CURDIR}/../../../share/${t}/ | |||||
. endif | . endif | ||||
.endfor | .endfor | ||||
post-install: | post-install: | ||||
.for t in ${TYPES} | .for t in ${TYPES} | ||||
. if ${KNOWN:M${t}} | . if ${KNOWN:M${t}} | ||||
(cd ${.CURDIR}/../../../share/${t} && \ | cd ${LOCALSRCDIR}/${t} && \ | ||||
make && make install && make clean) | make && make install && make clean | ||||
. endif | . endif | ||||
.endfor | .endfor | ||||
.for t in ${TYPES} | .for t in ${TYPES} | ||||
gen-${t}: | CLEANDIRS+= ${t} ${t}.draft | ||||
mkdir -p ${t} ${t}.draft | ${t}: | ||||
perl -I tools tools/cldr2def.pl \ | mkdir -p ${t} ${t}.draft && \ | ||||
--unidir=$$(realpath ${UNIDIR}) \ | perl -I ${TOOLSDIR} ${TOOLSDIR}/cldr2def.pl \ | ||||
--etc=$$(realpath ${ETCDIR}) \ | --unidir=${UNIDIR:tA} \ | ||||
--etc=${ETCDIR:tA} \ | |||||
--type=${t} | --type=${t} | ||||
build-${t}: gen-${t} | build-${t}: ${t} | ||||
env ${PASSON} tools/finalize ${t} | ${SETENV} OUTBASEDIR="${.OBJDIR}/${t}" ${TOOLSDIR}/finalize ${t} | ||||
.endfor | .endfor | ||||
gen-ctypedef: ctype-rollup | static-colldef: colldef | ||||
static-colldef: gen-colldef | |||||
build-colldef: static-colldef | build-colldef: static-colldef | ||||
static-colldef: | static-colldef: | ||||
.for area enc in ${COLLATION_SPECIAL} | .for area enc in ${COLLATION_SPECIAL} | ||||
awk -f tools/extract-colldef.awk ${UNIDIR}/posix/${area}.${enc}.src > \ | colldef.draft/${area}.${enc}.src: posix/${area}.${enc}.src | ||||
colldef.draft/${area}.${enc}.src | awk -f ${TOOLSDIR}/extract-colldef.awk \ | ||||
${.ALLSRC} > ${.TARGET} || (rm -f ${.TARGET} && false) | |||||
.endfor | .endfor | ||||
ctype-rollup: | |||||
perl -I tools tools/utf8-rollup.pl --unidir=$$(realpath ${UNIDIR}) | |||||
clean: | |||||
.for t in ${TYPES} | |||||
rm -rf ${t} ${t}.draft | |||||
.endfor | |||||
BASE_LOCALES_OF_INTEREST?= \ | BASE_LOCALES_OF_INTEREST?= \ | ||||
af_ZA am_ET ar_AE ar_EG ar_JO ar_MA ar_QA ar_SA \ | af_ZA am_ET ar_AE ar_EG ar_JO ar_MA ar_QA ar_SA \ | ||||
be_BY bg_BG ca_AD ca_ES ca_FR ca_IT \ | be_BY bg_BG ca_AD ca_ES ca_FR ca_IT \ | ||||
cs_CZ da_DK de_AT de_CH de_DE el_GR en_AU en_CA \ | cs_CZ da_DK de_AT de_CH de_DE el_GR en_AU en_CA \ | ||||
en_GB en_HK en_IE en_NZ en_PH en_SG en_US en_ZA \ | en_GB en_HK en_IE en_NZ en_PH en_SG en_US en_ZA \ | ||||
es_AR es_CR es_ES es_MX et_EE eu_ES fi_FI fr_BE \ | es_AR es_CR es_ES es_MX et_EE eu_ES fi_FI fr_BE \ | ||||
fr_CA fr_CH fr_FR ga_IE he_IL hi_IN hr_HR hu_HU hy_AM \ | fr_CA fr_CH fr_FR ga_IE he_IL hi_IN hr_HR hu_HU hy_AM \ | ||||
is_IS it_CH it_IT ja_JP ko_KR lt_LT lv_LV \ | is_IS it_CH it_IT ja_JP ko_KR lt_LT lv_LV \ | ||||
Show All 24 Lines | ENCODINGS= Big5 \ | ||||
ISO8859-7 \ | ISO8859-7 \ | ||||
ISO8859-9 \ | ISO8859-9 \ | ||||
KOI8-R \ | KOI8-R \ | ||||
KOI8-U \ | KOI8-U \ | ||||
SJIS \ | SJIS \ | ||||
US-ASCII \ | US-ASCII \ | ||||
UTF-8 | UTF-8 | ||||
POSIX: posixsrc posixcol posixcm | # CLDR files | ||||
CLDRFILES_CORE= https://unicode.org/Public/cldr/35/core.zip | |||||
CLDRFILES_KEY= https://unicode.org/Public/cldr/35/keyboards.zip | |||||
CLDRFILES_TOOLS=https://unicode.org/Public/cldr/35/tools.zip | |||||
CLDRFILES_UCD= http://www.unicode.org/Public/zipped/latest/UCD.zip | |||||
# fetch and extract targets | |||||
${UNIDIR}: | |||||
mkdir -p ${UNIDIR} | |||||
.for N in CORE KEY TOOLS UCD | |||||
${CLDRFILES_${N}:T}: | |||||
fetch ${CLDRFILES_${N}} | |||||
fetch: ${CLDRFILES_${N}:T} | |||||
extract-${CLDRFILES_${N}:T}:: ${CLDRFILES_${N}:T} ${UNIDIR} | |||||
cd ${UNIDIR} && unzip -o ../${CLDRFILES_${N}:T} | |||||
extract: extract-${CLDRFILES_${N}:T} | |||||
.endfor | |||||
patch:: | |||||
.if exists(${PATCHDIR}) | |||||
cd ${UNIDIR} && cat ${PATCHDIR}/patch-* | patch | |||||
.endif | |||||
.if !exists(${UNIDIR}/tools/java/cldr.jar) | .if !exists(${UNIDIR}/tools/java/cldr.jar) | ||||
.error check README about building cldr.jar | .ORDER: extract patch | ||||
build-tools: extract patch tools-test ${UNIDIR} | |||||
cd ${UNIDIR}/tools/java && ${SETENV} ant all jar | |||||
.else | |||||
build-tools: | |||||
@echo cldr.jar is ready. | |||||
.endif | .endif | ||||
JAVA_CLDR= java -DCLDR_DIR=${UNIDIR:Q} -jar ${UNIDIR}/tools/java/cldr.jar | |||||
posix: posixcm post-posixcm posixsrc posixcol | |||||
.ORDER: posixcm post-posixcm posixsrc posixcol | |||||
${UNIDIR}/posix: | |||||
ln -s -f ../posix ${.TARGET} | |||||
clean-posix: | |||||
rm -rf posix ${UNIDIR}/posix | |||||
post-posixcm: ${UNIDIR}/posix | |||||
perl -I ${TOOLSDIR} ${TOOLSDIR}/utf8-rollup.pl \ | |||||
--unidir=${UNIDIR} | |||||
.for enc in ${ENCODINGS} | |||||
posixcm: build-tools posix/${enc}.cm | |||||
.ORDER: build-tools posix/${enc}.cm | |||||
posix/${enc}.cm: | |||||
mkdir -p posix && \ | |||||
${JAVA_CLDR} org.unicode.cldr.posix.GenerateCharmap \ | |||||
-d posix -c ${enc} | |||||
.endfor | |||||
.for area in ${BASE_LOCALES_OF_INTEREST} | .for area in ${BASE_LOCALES_OF_INTEREST} | ||||
posixsrc: ${UNIDIR}/posix/${area}.UTF-8.src | posixsrc: build-tools posix/${area}.UTF-8.src | ||||
${UNIDIR}/posix/${area}.UTF-8.src: | .ORDER: build-tools posix/${area}.UTF-8.src | ||||
java -DCLDR_DIR=${UNIDIR:Q} -jar ${UNIDIR}/tools/java/cldr.jar \ | posix/${area}.UTF-8.src: | ||||
org.unicode.cldr.posix.GeneratePOSIX \ | mkdir -p posix && \ | ||||
-d ${UNIDIR}/posix -m ${area} -c UTF-8 | ${JAVA_CLDR} org.unicode.cldr.posix.GeneratePOSIX \ | ||||
-d posix -m ${area} -c UTF-8 | |||||
.endfor | .endfor | ||||
.for area encoding in ${COLLATION_SPECIAL} | .for area encoding in ${COLLATION_SPECIAL} | ||||
posixcol: ${UNIDIR}/posix/${area}.${encoding}.src | posixcol: build-tools posix/${area}.${encoding}.src | ||||
${UNIDIR}/posix/${area}.${encoding}.src: | .ORDER: build-tools posix/${area}.${encoding}.src | ||||
java -DCLDR_DIR=${UNIDIR:Q} -jar ${UNIDIR}/tools/java/cldr.jar \ | posix/${area}.${encoding}.src: | ||||
org.unicode.cldr.posix.GeneratePOSIX \ | mkdir -p posix && \ | ||||
-d ${UNIDIR}/posix -m ${area} -c ${encoding} | ${JAVA_CLDR} org.unicode.cldr.posix.GeneratePOSIX \ | ||||
-d posix -m ${area} -c ${encoding} | |||||
.endfor | .endfor | ||||
.for enc in ${ENCODINGS} | |||||
posixcm: ${UNIDIR}/posix/${enc}.cm | |||||
${UNIDIR}/posix/${enc}.cm: | |||||
java -DCLDR_DIR=${UNIDIR:Q} -jar ${UNIDIR}/tools/java/cldr.jar \ | |||||
org.unicode.cldr.posix.GenerateCharmap \ | |||||
-d ${UNIDIR}/posix -c ${enc} | |||||
.endfor | |||||
clean-POSIX: | .include <bsd.obj.mk> | ||||
rm -f ${UNIDIR}/posix/* |