diff options
author | jlam <jlam> | 2006-05-21 23:50:15 +0000 |
---|---|---|
committer | jlam <jlam> | 2006-05-21 23:50:15 +0000 |
commit | 8b19f53564f52a091c8ad82e069e63911e93b125 (patch) | |
tree | 0c523987180f677a1b6f7605da0f810de5df2349 /mk/pkginstall/fonts | |
parent | 5e413fe521f350efc9392093bbcae8e1051e5f74 (diff) | |
download | pkgsrc-8b19f53564f52a091c8ad82e069e63911e93b125.tar.gz |
Move mk/install to mk/pkginstall to better reflect the contents (the
pkginstall framework).
Diffstat (limited to 'mk/pkginstall/fonts')
-rw-r--r-- | mk/pkginstall/fonts | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/mk/pkginstall/fonts b/mk/pkginstall/fonts new file mode 100644 index 00000000000..52c68387fa3 --- /dev/null +++ b/mk/pkginstall/fonts @@ -0,0 +1,101 @@ +# $NetBSD: fonts,v 1.1 2006/05/21 23:50:15 jlam Exp $ +# +# Generate a +FONTS script that updates font databases for the package. +# +case "${STAGE},$1" in +UNPACK,|UNPACK,+FONTS) + ${CAT} > ./+FONTS << 'EOF' +#!@SH@ +# +# +FONTS - font database management script +# +# Usage: ./+FONTS [metadatadir] +# +# This scripts rebuilds font databases needed by the package associated +# with <metadatadir>. +# +# Lines starting with "# FONTS: " are data read by this script that name +# the directories in which the font database will be rebuilt. +# +# # FONTS: /usr/pkg/lib/X11/fonts/TTF ttf +# # FONTS: /usr/pkg/lib/X11/fonts/Type1 type1 +# # FONTS: /usr/pkg/lib/X11/fonts/misc x11 +# +# For each FONTS entry, if the path is relative, that it is taken to be +# relative to ${PKG_PREFIX}. +# + +ECHO="@ECHO@" +FIND="@FIND@" +GREP="@GREP@" +MKFONTDIR="@MKFONTDIR@" +PWD_CMD="@PWD_CMD@" +RM="@RM@" +SED="@SED@" +SORT="@SORT@" +TEST="@TEST@" +TRUE="@TRUE@" +TTMKFDIR="@TTMKFDIR@" +TYPE1INST="@TYPE1INST@" + +SELF=$0 +PKG_METADATA_DIR="${1-`${PWD_CMD}`}" +: ${PKGNAME=${PKG_METADATA_DIR##*/}} +: ${PKG_PREFIX=@PREFIX@} + +case "${PKG_UPDATE_FONTS_DB:-@PKG_UPDATE_FONTS_DB@}" in +[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) + _PKG_UPDATE_FONTS_DB=yes + ;; +[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0) + _PKG_UPDATE_FONTS_DB=no + ;; +esac + +${SED} -n "/^\# FONTS: /{s/^\# FONTS: //;p;}" ${SELF} | ${SORT} -u | +{ while read dir font_type; do + case ${_PKG_UPDATE_FONTS_DB} in + no) continue ;; + esac + case $dir in + "") continue ;; + [!/]*) dir="${PKG_PREFIX}/$dir" ;; + esac + ${TEST} -d "$dir" || continue + case "$printed_header" in + yes) ;; + *) printed_header=yes + ${ECHO} "===========================================================================" + ${ECHO} "Updating font databases in the following directories:" + ${ECHO} "" + ;; + esac + ( ${ECHO} " $dir ($font_type)" + cd $dir + case $font_type in + [tT][tT][fF]) update_cmd="${TTMKFDIR}" ;; + [tT][yY][pP][eE]1) update_cmd="${TYPE1INST}; ${RM} type1inst.log" ;; + [xX]11) update_cmd="${MKFONTDIR}" ;; + esac + ${TEST} -f "$update_cmd" || update_cmd="${TRUE}" + $update_cmd >/dev/null + # + # Remove fonts databases if there are no fonts in the directory. + # We filter out the encodings.dir, fonts.{alias,dirs,scale}, and + # Fontmap database files from the directory listing. + # + ${FIND} . -type f | ${GREP} -v "/encodings.dir" | ${GREP} -v "/fonts\." | ${GREP} -v "/Fontmap" >/dev/null || ${RM} -f fonts.* Fontmap* + ) +done +case "$printed_header" in +yes) ${ECHO} "" + ${ECHO} "===========================================================================" + ;; +esac; } + +EOF + ${SED} -n "/^\# FONTS: /p" ${SELF} >> ./+FONTS + ${CHMOD} +x ./+FONTS + ;; +esac + |