Files
src/share/mk/bsd.nls.mk
T
Lexi Winter 0242d4c3ae libc: Move NLS catalogues to the locales packages
We don't want to put these in clibs (where libc is) since they are not
critical to system operation.  Move them to locales, since anyone who
is interested in translated versions of strerror() is going to have
that installed anyway.

While here, add some more documentation to bsd.nls.mk, particularly
the NLSPACKAGE option.

MFC after:	3 seconds
Reviewed by:	manu, kib
Sponsored by:	https://www.patreon.com/bsdivy
Differential Revision:	https://reviews.freebsd.org/D52898
2025-10-05 06:12:54 +01:00

91 lines
2.1 KiB
Makefile

#
# Handle building and installing Native Language Support (NLS) catalogs.
# This is implemented using a <bsd.files.mk> files group called "NLS",
# so any per-group options that bsd.files.mk supports can be used here
# with the prefix "NLS".
#
# +++ variables +++
#
# GENCAT A program for converting .msg files into compiled NLS
# .cat files. [gencat]
#
# NLS Source or intermediate .msg files. [set in Makefile]
#
# NLSDIR Base path for National Language Support files
# installation. [${SHAREDIR}/nls]
#
# NLSGRP National Language Support files group. [${SHAREGRP}]
#
# NLSMODE National Language Support files mode. [${NOBINMODE}]
#
# NLSOWN National Language Support files owner. [${SHAREOWN}]
#
# NLSPACKAGE Package to install the NLS files in.
# [${PACKAGE}, or "utilities" if not set]
.if !target(__<bsd.init.mk>__)
.error bsd.nls.mk cannot be included directly.
.endif
GENCAT?= gencat
.SUFFIXES: .cat .msg
.msg.cat:
${GENCAT} ${.TARGET} ${.IMPSRC}
.if defined(NLS) && !empty(NLS) && ${MK_NLS} != "no"
#
# .msg file pre-build rules
#
NLSSRCDIR?= ${.CURDIR}
.for file in ${NLS}
.if defined(NLSSRCFILES)
NLSSRCFILES_${file}?= ${NLSSRCFILES}
.endif
.if defined(NLSSRCFILES_${file})
NLSSRCDIR_${file}?= ${NLSSRCDIR}
${file}.msg: ${NLSSRCFILES_${file}:S/^/${NLSSRCDIR_${file}}\//}
@rm -f ${.TARGET}
cat ${.ALLSRC} > ${.TARGET}
CLEANFILES+= ${file}.msg
.endif
.endfor
#
# .cat file build rules
#
NLS:= ${NLS:=.cat}
CLEANFILES+= ${NLS}
FILESGROUPS?= FILES
FILESGROUPS+= NLS
NLSDIR?= ${SHAREDIR}/nls
#
# installation rules
#
.if ${MK_STAGING_PROG} == "yes"
.if !defined(_SKIP_BUILD)
STAGE_TARGETS+= stage_symlinks
.endif
STAGE_SYMLINKS.NLS= ${NLSSYMLINKS}
STAGE_SYMLINKS_DIR.NLS= ${STAGE_OBJTOP}
.else
SYMLINKS+= ${NLSSYMLINKS}
.endif
.for file in ${NLS}
NLSDIR_${file:T}= ${NLSDIR}/${file:T:R}
NLSNAME_${file:T}= ${NLSNAME}.cat
.if defined(NLSLINKS_${file:R}) && !empty(NLSLINKS_${file:R})
.if !empty(NLSLINKS_${file:R}:M${file:R})
.error NLSLINKS_${file:R} contains itself: ${file:R}
.endif
.endif
.for dst in ${NLSLINKS_${file:R}}
NLSSYMLINKS+= ../${file:R}/${NLSNAME}.cat ${NLSDIR}/${dst}/${NLSNAME}.cat
.endfor
.endfor
.endif # defined(NLS) && !empty(NLS) && ${MK_NLS} != "no"