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

Contents of /eclass/font.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.38 - (hide annotations) (download)
Sat Jun 21 06:12:45 2008 UTC (6 years, 5 months ago) by pva
Branch: MAIN
Changes since 1.37: +56 -16 lines
Make eclass-manpages ready, bug #210933, thanks mren.

1 dirtyepic 1.26 # Copyright 1999-2007 Gentoo Foundation
2 foser 1.1 # Distributed under the terms of the GNU General Public License v2
3 pva 1.38 # $Header: /var/cvsroot/gentoo-x86/eclass/font.eclass,v 1.37 2008/05/19 00:42:13 dirtyepic Exp $
4 foser 1.1
5 pva 1.38 # @ECLASS: font.eclass
6     # @MAINTAINER:
7     # fonts@gentoo.org
8     #
9 foser 1.1 # Author: foser <foser@gentoo.org>
10 pva 1.38 # @BLURB: Eclass to make font installation uniform
11 foser 1.1
12 kugelfang 1.7 inherit eutils
13    
14 foser 1.1 #
15     # Variable declarations
16     #
17    
18 pva 1.38 # @ECLASS-VARIABLE: FONT_SUFFIX
19     # @DESCRIPTION:
20     # Space delimited list of font suffixes to install
21     FONT_SUFFIX=""
22    
23     # @ECLASS-VARIABLE: FONT_S
24     # @DESCRIPTION:
25     # Dir containing the fonts
26     FONT_S=${S}
27    
28     # @ECLASS-VARIABLE: FONT_PN
29     # @DESCRIPTION:
30     # Last part of $FONTDIR
31     FONT_PN=${PN}
32    
33     # @ECLASS-VARIABLE: FONTDIR
34     # @DESCRIPTION:
35     # This is where the fonts are installed
36     FONTDIR=/usr/share/fonts/${FONT_PN}
37    
38     # @ECLASS-VARIABLE: FONT_CONF
39     # @DESCRIPTION:
40     # Array, which element(s) is(are) path(s) of fontconfig-2.4 file(s) to install
41     FONT_CONF=( "" )
42    
43     # @ECLASS-VARIABLE: DOCS
44     # @DESCRIPTION:
45     # Docs to install
46     DOCS=""
47 foser 1.1
48 swegener 1.15 IUSE="X"
49 foser 1.1
50 genstef 1.22 DEPEND="X? ( x11-apps/mkfontdir )
51 robbat2 1.18 media-libs/fontconfig"
52 foser 1.1
53 swegener 1.15 #
54 foser 1.2 # Public functions
55 foser 1.1 #
56    
57 pva 1.38 # @FUNCTION: font_xfont_config
58     # @DESCRIPTION:
59     # Creates the Xfont files.
60 foser 1.2 font_xfont_config() {
61 foser 1.1 # create Xfont files
62 foser 1.11 if use X ; then
63 vapier 1.10 einfo "Creating fonts.scale & fonts.dir ..."
64 robbat2 1.18 mkfontscale "${D}${FONTDIR}"
65 foser 1.1 mkfontdir \
66     -e /usr/share/fonts/encodings \
67     -e /usr/share/fonts/encodings/large \
68 robbat2 1.18 "${D}${FONTDIR}"
69 foser 1.11 if [ -e "${FONT_S}/fonts.alias" ] ; then
70 usata 1.8 doins "${FONT_S}/fonts.alias"
71 usata 1.3 fi
72 foser 1.1 fi
73 foser 1.2 }
74    
75 pva 1.38 # @FUNCTION: font_xft_config
76     # @DESCRIPTION:
77     # Creates the fontconfig cache if necessary.
78 foser 1.2 font_xft_config() {
79 foser 1.19 if ! has_version '>=media-libs/fontconfig-2.4'; then
80     # create fontconfig cache
81     einfo "Creating fontconfig cache ..."
82     # Mac OS X has fc-cache at /usr/X11R6/bin
83     HOME="/root" fc-cache -f "${D}${FONTDIR}"
84     fi
85 foser 1.2 }
86    
87 pva 1.38 # @FUNCTION: font_fontconfig
88     # @DESCRIPTION:
89     # Installs the fontconfig config files of FONT_CONF.
90 dirtyepic 1.24 font_fontconfig() {
91     local conffile
92 pva 1.36 if [[ -n ${FONT_CONF[@]} ]]; then
93 dirtyepic 1.25 if has_version '>=media-libs/fontconfig-2.4'; then
94     insinto /etc/fonts/conf.avail/
95 pva 1.36 for conffile in "${FONT_CONF[@]}"; do
96 dirtyepic 1.25 [[ -e ${conffile} ]] && doins ${conffile}
97     done
98     fi
99 dirtyepic 1.24 fi
100     }
101    
102 foser 1.2 #
103     # Public inheritable functions
104     #
105    
106 pva 1.38 # @FUNCTION: font_src_install
107     # @DESCRIPTION:
108     # The font src_install function, which is exported.
109 foser 1.2 font_src_install() {
110 dirtyepic 1.23 local suffix commondoc
111 foser 1.2
112 usata 1.8 cd "${FONT_S}"
113 foser 1.2
114 robbat2 1.18 insinto "${FONTDIR}"
115 swegener 1.15
116 foser 1.2 for suffix in ${FONT_SUFFIX}; do
117 dirtyepic 1.28 doins *.${suffix}
118 foser 1.2 done
119    
120     rm -f fonts.{dir,scale} encodings.dir
121    
122     font_xfont_config
123     font_xft_config
124 dirtyepic 1.24 font_fontconfig
125 foser 1.2
126 usata 1.8 cd "${S}"
127 dberkholz 1.20 dodoc ${DOCS} 2> /dev/null
128 foser 1.11
129 dirtyepic 1.23 # install common docs
130 dirtyepic 1.37 for commondoc in COPYRIGHT README{,.txt} NEWS AUTHORS BUGS ChangeLog FONTLOG.txt; do
131 dirtyepic 1.24 [[ -s ${commondoc} ]] && dodoc ${commondoc}
132 dirtyepic 1.23 done
133 foser 1.1 }
134    
135 pva 1.38 # @FUNCTION: font_pkg_setup
136     # @DESCRIPTION:
137     # The font pkg_setup function, which is exported.
138 foser 1.12 font_pkg_setup() {
139 dirtyepic 1.24 # make sure we get no collisions
140 foser 1.12 # setup is not the nicest place, but preinst doesn't cut it
141 dberkholz 1.20 [[ -e "${FONTDIR}/fonts.cache-1" ]] && rm -f "${FONTDIR}/fonts.cache-1"
142 foser 1.19 }
143    
144 pva 1.38 # @FUNCTION: font_pkg_postinst
145     # @DESCRIPTION:
146     # The font pkg_postinst function, which is exported.
147 foser 1.19 font_pkg_postinst() {
148 dirtyepic 1.31 # unreadable font files = fontconfig segfaults
149 dirtyepic 1.32 find "${ROOT}"usr/share/fonts/ -type f '!' -perm 0644 -print0 \
150 dirtyepic 1.33 | xargs -0 chmod -v 0644 2>/dev/null
151 dirtyepic 1.30
152 foser 1.19 if has_version '>=media-libs/fontconfig-2.4'; then
153     if [ ${ROOT} == "/" ]; then
154     ebegin "Updating global fontcache"
155 dirtyepic 1.26 fc-cache -fs
156 foser 1.19 eend $?
157     fi
158     fi
159     }
160    
161 pva 1.38 # @FUNCTION: font_pkg_postrm
162     # @DESCRIPTION:
163     # The font pkg_postrm function, which is exported.
164 foser 1.19 font_pkg_postrm() {
165 dirtyepic 1.31 # unreadable font files = fontconfig segfaults
166 dirtyepic 1.32 find "${ROOT}"usr/share/fonts/ -type f '!' -perm 0644 -print0 \
167 dirtyepic 1.33 | xargs -0 chmod -v 0644 2>/dev/null
168 dirtyepic 1.30
169 foser 1.19 if has_version '>=media-libs/fontconfig-2.4'; then
170     if [ ${ROOT} == "/" ]; then
171     ebegin "Updating global fontcache"
172 dirtyepic 1.26 fc-cache -fs
173 foser 1.19 eend $?
174     fi
175     fi
176 foser 1.12 }
177    
178 foser 1.19 EXPORT_FUNCTIONS src_install pkg_setup pkg_postinst pkg_postrm

  ViewVC Help
Powered by ViewVC 1.1.20