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 | ||||
# | # | ||||
.OBJDIR: . | .OBJDIR: . | ||||
.if !defined(CLDRDIR) | .if !defined(UNIDIR) | ||||
CLDRDIR!= grep ^cldr etc/unicode.conf | cut -f 2 -d " " | .error UNIDIR is not set | ||||
.endif | .endif | ||||
.if !defined(UNIDATADIR) | PASSON= UNIDIR="${UNIDIR}" | ||||
UNIDATADIR!= grep ^unidata etc/unicode.conf | cut -f 2 -d " " | |||||
.endif | |||||
PASSON= CLDRDIR="${CLDRDIR}" UNIDATADIR="${UNIDATADIR}" | |||||
ETCDIR= ${.CURDIR}/etc | ETCDIR= ${.CURDIR}/etc | ||||
KNOWN= monetdef numericdef msgdef colldef ctypedef # timedef | KNOWN= monetdef numericdef msgdef colldef ctypedef # timedef | ||||
TYPES?= ${KNOWN} | TYPES?= ${KNOWN} | ||||
LOCALE_DESTDIR?= /tmp/generated-locales/ | LOCALE_DESTDIR?= /tmp/generated-locales/ | ||||
COLLATION_SPECIAL?= \ | COLLATION_SPECIAL?= \ | ||||
Show All 16 Lines | COLLATION_SPECIAL?= \ | ||||
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}" | PASSON+= COLLATIONS_SPECIAL="${COLLATIONS_SPECIAL_ENV}" | ||||
.if defined(LC) | |||||
LC:= --lc=${LC} | |||||
.endif | |||||
all: | all: | ||||
cp ${ETCDIR}/common.UTF-8.src ${CLDRDIR}/posix/xx_Comm_C.UTF-8.src | cp ${ETCDIR}/common.UTF-8.src ${UNIDIR}/posix/xx_Comm_C.UTF-8.src | ||||
.for t in ${TYPES} | .for t in ${TYPES} | ||||
. if ${KNOWN:M${t}} | . if ${KNOWN:M${t}} | ||||
test -d ${t} || mkdir ${t} | test -d ${t} || mkdir ${t} | ||||
make build-${t} | make build-${t} | ||||
. endif | . endif | ||||
.endfor | .endfor | ||||
@echo "" | @echo "" | ||||
@find . -name *failed | @find . -name *failed | ||||
.for t in ${TYPES} | .for t in ${TYPES} | ||||
install: install-${t} | install: install-${t} | ||||
install-${t}: | install-${t}: | ||||
. if ${KNOWN:M${t}} | . if ${KNOWN:M${t}} | ||||
rm -rf ${.CURDIR}/${t}.draft | rm -rf ${.CURDIR}/${t}.draft | ||||
rm -rf ${.CURDIR}/../../../share/${t} | rm -f ${.CURDIR}/../../../share/${t}/Makefile | ||||
mv ${.CURDIR}/${t} ${.CURDIR}/../../../share/${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 ${.CURDIR}/../../../share/${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}: | gen-${t}: | ||||
mkdir -p ${t} ${t}.draft | mkdir -p ${t} ${t}.draft | ||||
perl -I tools tools/cldr2def.pl \ | perl -I tools tools/cldr2def.pl \ | ||||
--cldr=$$(realpath ${CLDRDIR}) \ | --unidir=$$(realpath ${UNIDIR}) \ | ||||
--unidata=$$(realpath ${UNIDATADIR}) \ | |||||
--etc=$$(realpath ${ETCDIR}) \ | --etc=$$(realpath ${ETCDIR}) \ | ||||
--type=${t} ${LC} | --type=${t} | ||||
build-${t}: gen-${t} | build-${t}: gen-${t} | ||||
env ${PASSON} tools/finalize ${t} | env ${PASSON} tools/finalize ${t} | ||||
.endfor | .endfor | ||||
gen-ctypedef: transfer-rollup | gen-ctypedef: transfer-rollup | ||||
static-colldef: gen-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 ${CLDRDIR}/posix/${area}.${enc}.src > colldef.draft/${area}.${enc}.src | awk -f tools/extract-colldef.awk ${UNIDIR}/posix/${area}.${enc}.src > \ | ||||
colldef.draft/${area}.${enc}.src | |||||
.endfor | .endfor | ||||
transfer-rollup: | transfer-rollup: | ||||
cp ${ETCDIR}/common.UTF-8.src ${CLDRDIR}/posix/xx_Comm_C.UTF-8.src | cp ${ETCDIR}/common.UTF-8.src ${UNIDIR}/posix/xx_Comm_C.UTF-8.src | ||||
rollup: | rollup: | ||||
perl -I tools tools/utf8-rollup.pl \ | perl -I tools tools/utf8-rollup.pl \ | ||||
--cldr=$$(realpath ${CLDRDIR}) \ | --unidir=$$(realpath ${UNIDIR}) \ | ||||
--etc=$$(realpath ${ETCDIR}) | --etc=$$(realpath ${ETCDIR}) | ||||
clean: | clean: | ||||
.for t in ${TYPES} | .for t in ${TYPES} | ||||
rm -rf ${t} ${t}.draft | rm -rf ${t} ${t}.draft | ||||
.endfor | .endfor | ||||
BASE_LOCALES_OF_INTEREST?= \ | BASE_LOCALES_OF_INTEREST?= \ | ||||
Show All 33 Lines | ENCODINGS= Big5 \ | ||||
KOI8-R \ | KOI8-R \ | ||||
KOI8-U \ | KOI8-U \ | ||||
SJIS \ | SJIS \ | ||||
US-ASCII \ | US-ASCII \ | ||||
UTF-8 \ | UTF-8 \ | ||||
POSIX: | POSIX: | ||||
.if exists (${CLDRDIR}/tools/java/cldr.jar) | .if exists (${UNIDIR}/tools/java/cldr.jar) | ||||
mkdir -p ${CLDRDIR}/posix | mkdir -p ${UNIDIR}/posix | ||||
. for area in ${BASE_LOCALES_OF_INTEREST} | . for area in ${BASE_LOCALES_OF_INTEREST} | ||||
. if !exists(${CLDRDIR}/posix/${area}.UTF-8.src) | . if !exists(${UNIDIR}/posix/${area}.UTF-8.src) | ||||
java -DCLDR_DIR=${CLDRDIR:Q} -jar ${CLDRDIR}/tools/java/cldr.jar \ | java -DCLDR_DIR=${UNIDIR:Q} -jar ${UNIDIR}/tools/java/cldr.jar \ | ||||
org.unicode.cldr.posix.GeneratePOSIX \ | org.unicode.cldr.posix.GeneratePOSIX \ | ||||
-d ${CLDRDIR}/posix -m ${area} -c UTF-8 | -d ${UNIDIR}/posix -m ${area} -c UTF-8 | ||||
. endif | . endif | ||||
. endfor | . endfor | ||||
. for area encoding in ${COLLATION_SPECIAL} | . for area encoding in ${COLLATION_SPECIAL} | ||||
. if !exists(${CLDRDIR}/posix/${area}.${encoding}.src) | . if !exists(${UNIDIR}/posix/${area}.${encoding}.src) | ||||
java -DCLDR_DIR=${CLDRDIR:Q} -jar ${CLDRDIR}/tools/java/cldr.jar \ | java -DCLDR_DIR=${UNIDIR:Q} -jar ${UNIDIR}/tools/java/cldr.jar \ | ||||
org.unicode.cldr.posix.GeneratePOSIX \ | org.unicode.cldr.posix.GeneratePOSIX \ | ||||
-d ${CLDRDIR}/posix -m ${area} -c ${encoding} | -d ${UNIDIR}/posix -m ${area} -c ${encoding} | ||||
. endif | . endif | ||||
. endfor | . endfor | ||||
. for enc in ${ENCODINGS} | . for enc in ${ENCODINGS} | ||||
. if !exists(${CLDRDIR}/posix/${enc}.cm) | . if !exists(${UNIDIR}/posix/${enc}.cm) | ||||
java -DCLDR_DIR=${CLDRDIR:Q} -jar ${CLDRDIR}/tools/java/cldr.jar \ | java -DCLDR_DIR=${UNIDIR:Q} -jar ${UNIDIR}/tools/java/cldr.jar \ | ||||
org.unicode.cldr.posix.GenerateCharmap \ | org.unicode.cldr.posix.GenerateCharmap \ | ||||
-d ${CLDRDIR}/posix -c ${enc} | -d ${UNIDIR}/posix -c ${enc} | ||||
. endif | . endif | ||||
. endfor | . endfor | ||||
.else | .else | ||||
@echo "Please install CLDR toolset for the desired release" | @echo "Please install CLDR toolset for the desired release" | ||||
@echo "It should go at ${CLDRDIR}/tools" | @echo "It should go at ${UNIDIR}/tools" | ||||
.endif | .endif | ||||
clean-POSIX: | clean-POSIX: | ||||
rm -f ${CLDRDIR}/posix/* | rm -f ${UNIDIR}/posix/* |