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

Contents of /eclass/font.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.25 - (show annotations) (download)
Sun Jul 29 22:20:39 2007 UTC (7 years ago) by dirtyepic
Branch: MAIN
Changes since 1.24: +8 -8 lines
Allow FONT_CONF to work outside of FILESDIR.

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.24 2007/07/15 22:24:15 dirtyepic 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 FONT_CONF="" # Space delimited list of fontconfig-2.4 file(s) to install
26
27 DOCS="" # Docs to install
28
29 IUSE="X"
30
31 DEPEND="X? ( x11-apps/mkfontdir )
32 media-libs/fontconfig"
33
34 #
35 # Public functions
36 #
37
38 font_xfont_config() {
39
40 # create Xfont files
41 if use X ; then
42 einfo "Creating fonts.scale & fonts.dir ..."
43 mkfontscale "${D}${FONTDIR}"
44 mkfontdir \
45 -e /usr/share/fonts/encodings \
46 -e /usr/share/fonts/encodings/large \
47 "${D}${FONTDIR}"
48 if [ -e "${FONT_S}/fonts.alias" ] ; then
49 doins "${FONT_S}/fonts.alias"
50 fi
51 fi
52
53 }
54
55 font_xft_config() {
56
57 if ! has_version '>=media-libs/fontconfig-2.4'; then
58 # create fontconfig cache
59 einfo "Creating fontconfig cache ..."
60 # Mac OS X has fc-cache at /usr/X11R6/bin
61 HOME="/root" fc-cache -f "${D}${FONTDIR}"
62 fi
63 }
64
65 font_fontconfig() {
66 local conffile
67 if [[ -n ${FONT_CONF} ]]; then
68 if has_version '>=media-libs/fontconfig-2.4'; then
69 insinto /etc/fonts/conf.avail/
70 for conffile in "${FONT_CONF}"; do
71 [[ -e ${conffile} ]] && doins ${conffile}
72 done
73 fi
74 fi
75 }
76
77 #
78 # Public inheritable functions
79 #
80
81 font_src_install() {
82
83 local suffix commondoc
84
85 cd "${FONT_S}"
86
87 insinto "${FONTDIR}"
88
89 for suffix in ${FONT_SUFFIX}; do
90 doins *.${suffix}
91 done
92
93 rm -f fonts.{dir,scale} encodings.dir
94
95 font_xfont_config
96 font_xft_config
97 font_fontconfig
98
99 cd "${S}"
100 dodoc ${DOCS} 2> /dev/null
101
102 # install common docs
103 for commondoc in COPYRIGHT README NEWS AUTHORS BUGS ChangeLog; do
104 [[ -s ${commondoc} ]] && dodoc ${commondoc}
105 done
106 }
107
108 font_pkg_setup() {
109
110 # make sure we get no collisions
111 # setup is not the nicest place, but preinst doesn't cut it
112 [[ -e "${FONTDIR}/fonts.cache-1" ]] && rm -f "${FONTDIR}/fonts.cache-1"
113
114 }
115
116 font_pkg_postinst() {
117
118 if has_version '>=media-libs/fontconfig-2.4'; then
119 if [ ${ROOT} == "/" ]; then
120 ebegin "Updating global fontcache"
121 fc-cache -s
122 eend $?
123 fi
124 fi
125
126 }
127
128 font_pkg_postrm() {
129
130 if has_version '>=media-libs/fontconfig-2.4'; then
131 if [ ${ROOT} == "/" ]; then
132 ebegin "Updating global fontcache"
133 fc-cache -s
134 eend $?
135 fi
136 fi
137
138 }
139
140 EXPORT_FUNCTIONS src_install pkg_setup pkg_postinst pkg_postrm

  ViewVC Help
Powered by ViewVC 1.1.20