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

Contents of /eclass/font.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.24 - (hide annotations) (download)
Sun Jul 15 22:24:15 2007 UTC (7 years, 3 months ago) by dirtyepic
Branch: MAIN
Changes since 1.23: +19 -4 lines
Implement support for FONT_CONF, a space-delimited list of fontconfig files to install into /etc/font/conf.avail/.

1 vapier 1.5 # Copyright 1999-2004 Gentoo Foundation
2 foser 1.1 # Distributed under the terms of the GNU General Public License v2
3 dirtyepic 1.24 # $Header: /var/cvsroot/gentoo-x86/eclass/font.eclass,v 1.23 2007/06/24 06:15:21 dirtyepic Exp $
4 foser 1.1
5     # Author: foser <foser@gentoo.org>
6    
7     # Font Eclass
8     #
9 foser 1.19 # Eclass to make font installation uniform
10 foser 1.1
11 kugelfang 1.7 inherit eutils
12    
13 foser 1.1 #
14     # Variable declarations
15     #
16    
17     FONT_SUFFIX="" # Space delimited list of font suffixes to install
18    
19 foser 1.2 FONT_S="${S}" # Dir containing the fonts
20    
21 robbat2 1.18 FONT_PN="${PN}" # Last part of $FONTDIR
22    
23 dirtyepic 1.24 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 robbat2 1.18
27 foser 1.1 DOCS="" # Docs to install
28    
29 swegener 1.15 IUSE="X"
30 foser 1.1
31 genstef 1.22 DEPEND="X? ( x11-apps/mkfontdir )
32 robbat2 1.18 media-libs/fontconfig"
33 foser 1.1
34 swegener 1.15 #
35 foser 1.2 # Public functions
36 foser 1.1 #
37    
38 foser 1.2 font_xfont_config() {
39 foser 1.1
40     # create Xfont files
41 foser 1.11 if use X ; then
42 vapier 1.10 einfo "Creating fonts.scale & fonts.dir ..."
43 robbat2 1.18 mkfontscale "${D}${FONTDIR}"
44 foser 1.1 mkfontdir \
45     -e /usr/share/fonts/encodings \
46     -e /usr/share/fonts/encodings/large \
47 robbat2 1.18 "${D}${FONTDIR}"
48 foser 1.11 if [ -e "${FONT_S}/fonts.alias" ] ; then
49 usata 1.8 doins "${FONT_S}/fonts.alias"
50 usata 1.3 fi
51 foser 1.1 fi
52    
53 foser 1.2 }
54    
55     font_xft_config() {
56    
57 foser 1.19 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 foser 1.2 }
64    
65 dirtyepic 1.24 font_fontconfig() {
66    
67     local conffile
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 "${FILESDIR}/${conffile}" ]] && doins "${FILESDIR}/${conffile}"
72     done
73     fi
74    
75     }
76    
77 foser 1.2 #
78     # Public inheritable functions
79     #
80    
81     font_src_install() {
82    
83 dirtyepic 1.23 local suffix commondoc
84 foser 1.2
85 usata 1.8 cd "${FONT_S}"
86 foser 1.2
87 robbat2 1.18 insinto "${FONTDIR}"
88 swegener 1.15
89 foser 1.2 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 dirtyepic 1.24 font_fontconfig
98 foser 1.2
99 usata 1.8 cd "${S}"
100 dberkholz 1.20 dodoc ${DOCS} 2> /dev/null
101 foser 1.11
102 dirtyepic 1.23 # install common docs
103     for commondoc in COPYRIGHT README NEWS AUTHORS BUGS ChangeLog; do
104 dirtyepic 1.24 [[ -s ${commondoc} ]] && dodoc ${commondoc}
105 dirtyepic 1.23 done
106 foser 1.1 }
107    
108 foser 1.12 font_pkg_setup() {
109 foser 1.19
110 dirtyepic 1.24 # make sure we get no collisions
111 foser 1.12 # setup is not the nicest place, but preinst doesn't cut it
112 dberkholz 1.20 [[ -e "${FONTDIR}/fonts.cache-1" ]] && rm -f "${FONTDIR}/fonts.cache-1"
113 foser 1.19
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 foser 1.12 }
139    
140 foser 1.19 EXPORT_FUNCTIONS src_install pkg_setup pkg_postinst pkg_postrm

  ViewVC Help
Powered by ViewVC 1.1.20