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.4 2004/06/23 22:04:47 mr_bones_ Exp $ |
4 |
|
5 |
# Author: foser <foser@gentoo.org> |
6 |
|
7 |
# Font Eclass |
8 |
# |
9 |
# Eclass to make font installation more uniform |
10 |
|
11 |
ECLASS="font" |
12 |
INHERITED="$INHERITED $ECLASS" |
13 |
|
14 |
# |
15 |
# Variable declarations |
16 |
# |
17 |
|
18 |
FONT_SUFFIX="" # Space delimited list of font suffixes to install |
19 |
|
20 |
FONT_S="${S}" # Dir containing the fonts |
21 |
|
22 |
DOCS="" # Docs to install |
23 |
|
24 |
IUSE="${IUSE} X" |
25 |
|
26 |
DEPEND="${DEPEND} \ |
27 |
X? ( virtual/x11 ) \ |
28 |
media-libs/fontconfig" |
29 |
|
30 |
# |
31 |
# Public functions |
32 |
# |
33 |
|
34 |
font_xfont_config() { |
35 |
|
36 |
# create Xfont files |
37 |
if use X ; |
38 |
then |
39 |
einfo "Creating fonts.scale & fonts.dir..." |
40 |
mkfontscale ${D}/usr/share/fonts/${PN} |
41 |
mkfontdir \ |
42 |
-e /usr/share/fonts/encodings \ |
43 |
-e /usr/share/fonts/encodings/large \ |
44 |
-e /usr/X11R6/lib/X11/fonts/encodings \ |
45 |
${D}/usr/share/fonts/${PN} |
46 |
if [ -e ${FONT_S}/fonts.alias ] ; |
47 |
then |
48 |
doins ${FONT_S}/fonts.alias |
49 |
fi |
50 |
fi |
51 |
|
52 |
} |
53 |
|
54 |
font_xft_config() { |
55 |
|
56 |
# create fontconfig cache |
57 |
einfo "Creating fontconfig cache..." |
58 |
HOME="/root" /usr/bin/fc-cache -f ${D}/usr/share/fonts/${PN} |
59 |
|
60 |
} |
61 |
|
62 |
# |
63 |
# Public inheritable functions |
64 |
# |
65 |
|
66 |
font_src_install() { |
67 |
|
68 |
local suffix |
69 |
|
70 |
cd ${FONT_S} |
71 |
|
72 |
insinto /usr/share/fonts/${PN} |
73 |
|
74 |
for suffix in ${FONT_SUFFIX}; do |
75 |
doins *.${suffix} |
76 |
done |
77 |
|
78 |
rm -f fonts.{dir,scale} encodings.dir |
79 |
|
80 |
font_xfont_config |
81 |
font_xft_config |
82 |
|
83 |
cd ${S} |
84 |
# try to install some common docs |
85 |
DOCS="${DOCS} COPYRIGHT README NEWS" |
86 |
dodoc ${DOCS} |
87 |
} |
88 |
|
89 |
EXPORT_FUNCTIONS src_install |