diff options
author | jmmv <jmmv@pkgsrc.org> | 2003-02-16 12:14:31 +0000 |
---|---|---|
committer | jmmv <jmmv@pkgsrc.org> | 2003-02-16 12:14:31 +0000 |
commit | 62f4d1bb453c4f0aacb2c40241abf7b7ea808dcc (patch) | |
tree | 2baada11241b1c1347c695bbb97faee7c44eee2c /mk | |
parent | 159be95476688f0a9af35413c098600129198410 (diff) | |
download | pkgsrc-62f4d1bb453c4f0aacb2c40241abf7b7ea808dcc.tar.gz |
Implement a simple framework to handle font databases. It regenerates the
fonts.dir, fonts.scale and Fontmap files (depending on the font type) in
the right directories at (de)install time. Support included for TrueType,
Type1 and standard X11 fonts.
Reviewed by jlam.
Diffstat (limited to 'mk')
-rw-r--r-- | mk/fonts.mk | 53 | ||||
-rw-r--r-- | mk/install/fonts | 50 |
2 files changed, 103 insertions, 0 deletions
diff --git a/mk/fonts.mk b/mk/fonts.mk new file mode 100644 index 00000000000..a74d6d6411d --- /dev/null +++ b/mk/fonts.mk @@ -0,0 +1,53 @@ +# $NetBSD: fonts.mk,v 1.1 2003/02/16 12:14:31 jmmv Exp $ +# +# This Makefile fragment is intended to be included by packages that install +# fonts (most of them in the fonts category). It takes care of updating the +# fonts.dir files at install/deinstall time. +# +# The following variables need to be defined by packages using fonts.mk: +# +# FONTS_<TYPE>_DIRS - Whitespaced list of directories where the font database +# is updated. If empty, nothing is done for this TYPE. +# +# Supported TYPEs: TTF, TYPE1, X11. +# + +.if !defined(FONTS_MK) +FONTS_MK= # defined + +# TrueType fonts +FONTS_TTF_DIRS?= +# Type1 fonts +FONTS_TYPE1_DIRS?= +# Generic X fonts (PCF, SNF, BDF) +FONTS_X11_DIRS?= + +.if !empty(FONTS_TTF_DIRS) || !empty(FONTS_TYPE1_DIRS) || !empty(FONTS_X11_DIRS) + +USE_PKGINSTALL= YES +INSTALL_EXTRA_TMPL+= ../../mk/install/fonts +DEINSTALL_EXTRA_TMPL+= ../../mk/install/fonts + +.if !empty(FONTS_TTF_DIRS) +FILES_SUBST+= FONTS_TTF="YES" +FILES_SUBST+= FONTS_TTF_DIRS="${FONTS_TTF_DIRS}" +FILES_SUBST+= TTMKFDIR="${LOCALBASE}/bin/ttmkfdir" +DEPENDS+= ttmkfdir>=0:../../fonts/ttmkfdir +.endif + +.if !empty(FONTS_TYPE1_DIRS) +FILES_SUBST+= FONTS_TYPE1="YES" +FILES_SUBST+= FONTS_TYPE1_DIRS="${FONTS_TYPE1_DIRS}" +FILES_SUBST+= TYPE1INST="${LOCALBASE}/bin/type1inst" +DEPENDS+= type1inst>=0.6.1:../../fonts/type1inst +.endif + +.if !empty(FONTS_X11_DIRS) +FILES_SUBST+= FONTS_X11="YES" +FILES_SUBST+= FONTS_X11_DIRS="${FONTS_X11_DIRS}" +FILES_SUBST+= MKFONTDIR="${X11BASE}/bin/mkfontdir" +.endif + +.endif + +.endif # FONTS_MK diff --git a/mk/install/fonts b/mk/install/fonts new file mode 100644 index 00000000000..84a0c43260c --- /dev/null +++ b/mk/install/fonts @@ -0,0 +1,50 @@ +# $NetBSD: fonts,v 1.1 2003/02/16 12:14:32 jmmv Exp $ +# +# Handle font databases; used by fonts.mk. +# + +FONTS_TTF="@FONTS_TTF@" +FONTS_TTF_DIRS="@FONTS_TTF_DIRS@" +FONTS_TYPE1="@FONTS_TYPE1@" +FONTS_TYPE1_DIRS="@FONTS_TYPE1_DIRS@" +FONTS_X11="@FONTS_X11@" +FONTS_X11_DIRS="@FONTS_X11_DIRS@" +TTMKFDIR="@TTMKFDIR@" +TYPE1INST="@TYPE1INST@" +MKFONTDIR="@MKFONTDIR@" + +case ${STAGE} in +POST-INSTALL|POST-DEINSTALL) + ${ECHO} "===> Updating font databases" + if [ "${FONTS_TTF}" = "YES" ]; then + for d in ${FONTS_TTF_DIRS}; do + if [ -z "`cd $d ; ls | grep -v ^fonts | grep -v ^Fontmap`" ]; then + rm -f $d/fonts* $d/Fontmap* + rmdir $d >/dev/null 2>&1 + else + ( cd $d && ${TTMKFDIR} >fonts.dir 2>/dev/null ) + fi + done + fi + if [ "${FONTS_TYPE1}" = "YES" ]; then + for d in ${FONTS_TYPE1_DIRS}; do + if [ -z "`cd $d ; ls | grep -v ^fonts | grep -v ^Fontmap`" ]; then + rm -f $d/fonts* $d/Fontmap* + rmdir $d >/dev/null 2>&1 + else + ( cd $d && ${TYPE1INST} >/dev/null 2>&1 ) + fi + done + fi + if [ "${FONTS_X11}" = "YES" ]; then + for d in ${FONTS_X11_DIRS}; do + if [ -z "`cd $d ; ls | grep -v ^fonts | grep -v ^Fontmap`" ]; then + rm -f $d/fonts* $d/Fontmap* + rmdir $d >/dev/null 2>&1 + else + ( cd $d && ${MKFONTDIR} >/dev/null 2>&1 ) + fi + done + fi + ;; +esac |