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

Contents of /eclass/font.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.23 - (hide annotations) (download)
Sun Jun 24 06:15:21 2007 UTC (7 years, 6 months ago) by dirtyepic
Branch: MAIN
Changes since 1.22: +6 -4 lines
Check for existence of common docs before attempting to install them. (Johannes Weiner, Bug #148804)

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.23 # $Header: /var/cvsroot/gentoo-x86/eclass/font.eclass,v 1.22 2007/03/26 20:04:34 genstef 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     FONTDIR="/usr/share/fonts/${FONT_PN}" # this is where the fonts are installed
24    
25 foser 1.1 DOCS="" # Docs to install
26    
27 swegener 1.15 IUSE="X"
28 foser 1.1
29 genstef 1.22 DEPEND="X? ( x11-apps/mkfontdir )
30 robbat2 1.18 media-libs/fontconfig"
31 foser 1.1
32 swegener 1.15 #
33 foser 1.2 # Public functions
34 foser 1.1 #
35    
36 foser 1.2 font_xfont_config() {
37 foser 1.1
38     # create Xfont files
39 foser 1.11 if use X ; then
40 vapier 1.10 einfo "Creating fonts.scale & fonts.dir ..."
41 robbat2 1.18 mkfontscale "${D}${FONTDIR}"
42 foser 1.1 mkfontdir \
43     -e /usr/share/fonts/encodings \
44     -e /usr/share/fonts/encodings/large \
45 robbat2 1.18 "${D}${FONTDIR}"
46 foser 1.11 if [ -e "${FONT_S}/fonts.alias" ] ; then
47 usata 1.8 doins "${FONT_S}/fonts.alias"
48 usata 1.3 fi
49 foser 1.1 fi
50    
51 foser 1.2 }
52    
53     font_xft_config() {
54    
55 foser 1.19 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 foser 1.2 }
62    
63     #
64     # Public inheritable functions
65     #
66    
67     font_src_install() {
68    
69 dirtyepic 1.23 local suffix commondoc
70 foser 1.2
71 usata 1.8 cd "${FONT_S}"
72 foser 1.2
73 robbat2 1.18 insinto "${FONTDIR}"
74 swegener 1.15
75 foser 1.2 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 usata 1.8 cd "${S}"
85 dberkholz 1.20 dodoc ${DOCS} 2> /dev/null
86 foser 1.11
87 dirtyepic 1.23 # install common docs
88     for commondoc in COPYRIGHT README NEWS AUTHORS BUGS ChangeLog; do
89     [ -s ${commondoc} ] && dodoc ${commondoc}
90     done
91 foser 1.1 }
92    
93 foser 1.12 font_pkg_setup() {
94 foser 1.19
95 foser 1.12 # make sure we get no colissions
96     # setup is not the nicest place, but preinst doesn't cut it
97 dberkholz 1.20 [[ -e "${FONTDIR}/fonts.cache-1" ]] && rm -f "${FONTDIR}/fonts.cache-1"
98 foser 1.19
99     }
100    
101     font_pkg_postinst() {
102    
103     if has_version '>=media-libs/fontconfig-2.4'; then
104     if [ ${ROOT} == "/" ]; then
105     ebegin "Updating global fontcache"
106     fc-cache -s
107     eend $?
108     fi
109     fi
110    
111     }
112    
113     font_pkg_postrm() {
114    
115     if has_version '>=media-libs/fontconfig-2.4'; then
116     if [ ${ROOT} == "/" ]; then
117     ebegin "Updating global fontcache"
118     fc-cache -s
119     eend $?
120     fi
121     fi
122    
123 foser 1.12 }
124    
125 foser 1.19 EXPORT_FUNCTIONS src_install pkg_setup pkg_postinst pkg_postrm

  ViewVC Help
Powered by ViewVC 1.1.20