/[gentoo-x86]/eclass/font.eclass
Gentoo

Contents of /eclass/font.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.21 - (show annotations) (download)
Mon Oct 30 06:13:48 2006 UTC (7 years, 9 months ago) by dberkholz
Branch: MAIN
Changes since 1.20: +0 -0 lines
Simplify fonts.scale and fonts.dir generation a bit -- stop using ttmkfdir, always use mkfontscale. Also, run from the build system since they are in DEPEND and not RDEPEND.

1 # Copyright 1999-2004 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/font.eclass,v 1.19 2006/09/17 14:33:59 foser Exp $
4
5 # Author: foser <foser@gentoo.org>
6
7 # Font Eclass
8 #
9 # Eclass to make font installation uniform
10
11 inherit eutils
12
13 #
14 # Variable declarations
15 #
16
17 FONT_SUFFIX="" # Space delimited list of font suffixes to install
18
19 FONT_S="${S}" # Dir containing the fonts
20
21 FONT_PN="${PN}" # Last part of $FONTDIR
22
23 FONTDIR="/usr/share/fonts/${FONT_PN}" # this is where the fonts are installed
24
25 DOCS="" # Docs to install
26
27 IUSE="X"
28
29 DEPEND="X? ( || ( x11-apps/mkfontdir virtual/x11 ) )
30 media-libs/fontconfig"
31
32 #
33 # Public functions
34 #
35
36 font_xfont_config() {
37
38 # create Xfont files
39 if use X ; then
40 einfo "Creating fonts.scale & fonts.dir ..."
41 mkfontscale "${D}${FONTDIR}"
42 mkfontdir \
43 -e /usr/share/fonts/encodings \
44 -e /usr/share/fonts/encodings/large \
45 "${D}${FONTDIR}"
46 if [ -e "${FONT_S}/fonts.alias" ] ; then
47 doins "${FONT_S}/fonts.alias"
48 fi
49 fi
50
51 }
52
53 font_xft_config() {
54
55 if ! has_version '>=media-libs/fontconfig-2.4'; then
56 # create fontconfig cache
57 einfo "Creating fontconfig cache ..."
58 # Mac OS X has fc-cache at /usr/X11R6/bin
59 HOME="/root" fc-cache -f "${D}${FONTDIR}"
60 fi
61 }
62
63 #
64 # Public inheritable functions
65 #
66
67 font_src_install() {
68
69 local suffix
70
71 cd "${FONT_S}"
72
73 insinto "${FONTDIR}"
74
75 for suffix in ${FONT_SUFFIX}; do
76 doins *.${suffix}
77 done
78
79 rm -f fonts.{dir,scale} encodings.dir
80
81 font_xfont_config
82 font_xft_config
83
84 cd "${S}"
85 # try to install some common docs
86 DOCS="${DOCS} COPYRIGHT README NEWS"
87 dodoc ${DOCS} 2> /dev/null
88
89 }
90
91 font_pkg_setup() {
92
93 # make sure we get no colissions
94 # setup is not the nicest place, but preinst doesn't cut it
95 [[ -e "${FONTDIR}/fonts.cache-1" ]] && rm -f "${FONTDIR}/fonts.cache-1"
96
97 }
98
99 font_pkg_postinst() {
100
101 if has_version '>=media-libs/fontconfig-2.4'; then
102 if [ ${ROOT} == "/" ]; then
103 ebegin "Updating global fontcache"
104 fc-cache -s
105 eend $?
106 fi
107 fi
108
109 }
110
111 font_pkg_postrm() {
112
113 if has_version '>=media-libs/fontconfig-2.4'; then
114 if [ ${ROOT} == "/" ]; then
115 ebegin "Updating global fontcache"
116 fc-cache -s
117 eend $?
118 fi
119 fi
120
121 }
122
123 EXPORT_FUNCTIONS src_install pkg_setup pkg_postinst pkg_postrm

  ViewVC Help
Powered by ViewVC 1.1.20