Reimplemented bsd.nls.mk using bsd.files.mk and bsd.links.mk.

Provided the (previously missing) dependency on source files
for intermediate .msg files.

Provided the default for NLSSRCDIR (defaults to .CURDIR).

Slightly changed the API: NLS should now list plain locale
names, without the .msg suffix.

When included from bsd.prog.mk, NLSNAME defaults to PROG.
This commit is contained in:
Ruslan Ermilov 2002-07-02 12:37:09 +00:00
parent 84f94a79a0
commit 8479adc1d3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=99257
5 changed files with 59 additions and 120 deletions

View File

@ -10,7 +10,6 @@ TCSHDIR= ${.CURDIR}/../../contrib/tcsh
.PATH: ${TCSHDIR}
PROG= csh
SUBDIR= nls
DFLAGS= -D_PATH_TCSHELL='"/bin/${PROG}"'
CFLAGS+= -I. -I${.CURDIR} -I${TCSHDIR} ${DFLAGS}
WARNS= 0
@ -46,6 +45,34 @@ CLEANFILES= ${GENHDRS} gethost csh.1
FILESDIR= ${SHAREDIR}/examples/tcsh
FILES= complete.tcsh csh-mode.el
CATALOGS= et:et_EE.ISO8859-15 \
finnish:fi_FI.ISO8859-1 \
french:fr_FR.ISO8859-1 \
german:de_DE.ISO8859-1 \
greek:el_GR.ISO8859-7 \
italian:it_IT.ISO8859-1 \
ja:ja_JP.eucJP \
russian:ru_RU.KOI8-R \
spanish:es_ES.ISO8859-1 \
ukrainian:uk_UA.KOI8-U
NLSLINKS_fi_FI.ISO8859-1= fi_FI.ISO8859-15
NLSLINKS_fr_FR.ISO8859-1= fr_BE.ISO8859-1 fr_BE.ISO8859-15 \
fr_CA.ISO8859-1 fr_CA.ISO8859-15 fr_CH.ISO8859-1 \
fr_CH.ISO8859-15 fr_FR.ISO8859-15
NLSLINKS_de_DE.ISO8859-1= de_AT.ISO8859-1 de_AT.ISO8859-15 de_CH.ISO8859-1 \
de_CH.ISO8859-15 de_DE.ISO8859-15
NLSLINKS_it_IT.ISO8859-1= it_CH.ISO8859-1 it_CH.ISO8859-15 it_IT.ISO8859-15
NLSLINKS_es_ES.ISO8859-1= es_ES.ISO8859-15
NLSNAME= tcsh
.for catalog in ${CATALOGS}
NLS+= ${catalog:C/.*://}
NLSSRCDIR_${catalog:C/.*://}= ${TCSHDIR}/nls/${catalog:C/:.*//}
NLSSRCFILES_${catalog:C/.*://}!= cd ${NLSSRCDIR_${catalog:C/.*://}}; echo set[0-9]*
.endfor
csh.1: tcsh.man
ln -sf ${.ALLSRC} ${.TARGET}

View File

@ -1,34 +0,0 @@
# $FreeBSD$
BASESRC= ${.CURDIR}/../../../contrib/tcsh/nls
CATALOGS= et:et_EE.ISO8859-15 \
finnish:fi_FI.ISO8859-1 \
french:fr_FR.ISO8859-1 \
german:de_DE.ISO8859-1 \
greek:el_GR.ISO8859-7 \
italian:it_IT.ISO8859-1 \
ja:ja_JP.eucJP \
russian:ru_RU.KOI8-R \
spanish:es_ES.ISO8859-1 \
ukrainian:uk_UA.KOI8-U
NLSLINKS_fi_FI.ISO8859-1= fi_FI.ISO8859-15
NLSLINKS_fr_FR.ISO8859-1= fr_BE.ISO8859-1 fr_BE.ISO8859-15 \
fr_CA.ISO8859-1 fr_CA.ISO8859-15 fr_CH.ISO8859-1 fr_CH.ISO8859-15 \
fr_FR.ISO8859-15
NLSLINKS_de_DE.ISO8859-1= de_AT.ISO8859-1 de_AT.ISO8859-15 de_CH.ISO8859-1 \
de_CH.ISO8859-15 de_DE.ISO8859-15
NLSLINKS_it_IT.ISO8859-1= it_CH.ISO8859-1 it_CH.ISO8859-15 it_IT.ISO8859-15
NLSLINKS_es_ES.ISO8859-1= es_ES.ISO8859-15
NLSNAME= tcsh
NLSSRCFILES= set[0-9]*
.for catalog in ${CATALOGS}
NLSSRCDIR_${catalog:C/.*://g}.msg:= ${BASESRC}/${catalog:C/:.*//g}
NLS+=${catalog:C/.*://g}.msg
.endfor
.include <bsd.nls.mk>

View File

@ -1,4 +1,3 @@
# Based on $NetBSD: bsd.nls.mk,v 1.35 2001/11/28 20:19:08 tv Exp $
# $FreeBSD$
#
# This include file <bsd.nls.mk> handles building and installing Native
@ -21,108 +20,57 @@
# NLSOWN National Language Support files owner. [${SHAREOWN}]
#
# NO_NLS Do not make or install NLS files. [not set]
#
# +++ targets +++
#
# install:
# Install compiled NLS files
#
# bsd.obj.mk: cleandir and obj
.include <bsd.init.mk>
.if !target(__<bsd.init.mk>__)
.error bsd.nls.mk cannot be included directly.
.endif
GENCAT?= gencat -new
NLSDIR?= ${SHAREDIR}/nls
NLSGRP?= ${SHAREGRP}
NLSMODE?= ${NOBINMODE}
NLSOWN?= ${SHAREOWN}
NLS?=
NLSLINKS=
.SUFFIXES: .cat .msg
.msg.cat:
${GENCAT} ${.TARGET} ${.IMPSRC}
.if defined(NLS) && !empty(NLS) && !defined(NO_NLS)
#
# .msg file pre-build rules
#
NLSSRCDIR?= ${.CURDIR}
.for file in ${NLS}
.if !defined(NLSSRCDIR_${file}) && defined(NLSSRCDIR)
NLSSRCDIR_${file}=${NLSSRCDIR}
.if defined(NLSSRCFILES)
NLSSRCFILES_${file}?= ${NLSSRCFILES}
.endif
.if !defined(NLSSRCFILES_${file}) && defined(NLSSRCFILES)
NLSSRCFILES_${file}=${NLSSRCFILES}
.endif
.if defined(NLSSRCFILES_${file})
${file}:
NLSSRCDIR_${file}?= ${NLSSRCDIR}
${file}.msg: ${NLSSRCFILES_${file}:S/^/${NLSSRCDIR_${file}}\//}
@rm -f ${.TARGET}
cat ${NLSSRCDIR_${file}}/${NLSSRCFILES_${file}} > ${.TARGET}
CLEANFILES+= ${file}
.endif
.if defined(NLSLINKS_${file:C/.msg//g}) && !empty(NLSLINKS_${file:C/.msg//g})
NLSLINKS+= ${file:C/.msg//g}
cat ${.ALLSRC} > ${.TARGET}
CLEANFILES+= ${file}.msg
.endif
.endfor
#
# .cat file build rules
#
NLSALL= ${NLS:.msg=.cat}
CLEANFILES+= ${NLSALL}
NLS:= ${NLS:=.cat}
CLEANFILES+= ${NLS}
FILESGROUPS?= FILES
FILESGROUPS+= NLS
NLSDIR?= ${SHAREDIR}/nls
#
# installation rules
#
__nlsinstall: .USE
${INSTALL} -o ${NLSOWN} -g ${NLSGRP} -m ${NLSMODE} \
${.ALLSRC} ${.TARGET}
.for F in ${NLSALL}
_F:= ${DESTDIR}${NLSDIR}/${F:T:R}/${NLSNAME}.cat
${_F}: ${F} __nlsinstall # install rule
nlsinstall:: ${_F}
.PRECIOUS: ${_F} # keep if install fails
.endfor
links-nls:
.if defined(NLSLINKS) && !empty(NLSLINKS)
.for src in ${NLSLINKS}
.for dst in ${NLSLINKS_${src}}
ln -fs ../${src}/${NLSNAME}.cat \
${DESTDIR}${NLSDIR}/${dst}/${NLSNAME}.cat
.for file in ${NLS}
NLSNAME_${file:T}= ${file:T:R}/${NLSNAME}.cat
.if defined(NLSLINKS_${file:R}) && !empty(NLSLINKS_${file:R})
NLSLINKS+= ${file:R}
.endif
.for dst in ${NLSLINKS_${file:R}}
SYMLINKS+= ../${file:R}/${NLSNAME}.cat ${NLSDIR}/${dst}/${NLSNAME}.cat
.endfor
.endfor
.endif
#
.if !defined(NO_NLS) && !empty(NLS)
all-nls: ${NLSALL}
.else
all-nls:
.endif
.if !defined(NO_NLS) && !empty(NLS)
realinstall: beforeinstall nlsinstall links-nls
.else
realinstall: beforeinstall
.endif
all: all-nls
install: realinstall afterinstall
.if !target(beforeinstall)
beforeinstall:
.endif
.if !target(afterinstall)
afterinstall:
.endif
.include <bsd.obj.mk>
.endif defined(NLS) && !empty(NLS) && !defined(NO_NLS)

View File

@ -145,6 +145,9 @@ _SCRIPTSINS_${script:T}: ${script}
.endfor
.endif
NLSNAME?= ${PROG}
.include <bsd.nls.mk>
.include <bsd.files.mk>
.include <bsd.incs.mk>
.include <bsd.links.mk>

View File

@ -9,7 +9,7 @@ MLINKS= ee.1 ree.1 ee.1 edit.1
DPADD= ${LIBNCURSES}
LDADD= -lncurses
LANGS= en_US.US-ASCII fr_FR.ISO8859-1 de_DE.ISO8859-1 pl_PL.ISO8859-2 \
NLS= en_US.US-ASCII fr_FR.ISO8859-1 de_DE.ISO8859-1 pl_PL.ISO8859-2 \
uk_UA.KOI8-U ru_RU.KOI8-R
NLSLINKS_en_US.US-ASCII= en_US.ISO8859-1 en_US.ISO8859-15
@ -19,14 +19,9 @@ NLSLINKS_fr_FR.ISO8859-1= fr_BE.ISO8859-1 fr_BE.ISO8859-15 \
NLSLINKS_de_DE.ISO8859-1= de_AT.ISO8859-1 de_AT.ISO8859-15 de_CH.ISO8859-1 \
de_CH.ISO8859-15 de_DE.ISO8859-15
NLSNAME=ee
NLSSRCFILES=ee.msg
.for lang in ${LANGS}
NLSSRCDIR_${lang}.msg=${.CURDIR}/nls/${lang}
NLS+=${lang}.msg
.for lang in ${NLS}
NLSSRCDIR_${lang}= ${.CURDIR}/nls/${lang}
.endfor
.include <bsd.prog.mk>
.include <bsd.nls.mk>