| 1 | # Copyright 1999-2004 Gentoo Technologies, Inc. |
1 | # Copyright 1999-2004 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/font.eclass,v 1.2 2004/05/31 14:59:26 foser Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/font.eclass,v 1.16 2005/08/16 06:38:04 spyderous Exp $ |
| 4 | |
4 | |
| 5 | # Author: foser <foser@gentoo.org> |
5 | # Author: foser <foser@gentoo.org> |
| 6 | |
6 | |
| 7 | # Font Eclass |
7 | # Font Eclass |
| 8 | # |
8 | # |
| 9 | # Eclass to make font installation more uniform |
9 | # Eclass to make font installation more uniform |
| 10 | |
10 | |
| 11 | ECLASS="font" |
11 | inherit eutils |
| 12 | INHERITED="$INHERITED $ECLASS" |
12 | |
| 13 | |
13 | |
| 14 | # |
14 | # |
| 15 | # Variable declarations |
15 | # Variable declarations |
| 16 | # |
16 | # |
| 17 | |
17 | |
| … | |
… | |
| 19 | |
19 | |
| 20 | FONT_S="${S}" # Dir containing the fonts |
20 | FONT_S="${S}" # Dir containing the fonts |
| 21 | |
21 | |
| 22 | DOCS="" # Docs to install |
22 | DOCS="" # Docs to install |
| 23 | |
23 | |
| 24 | IUSE="${IUSE} X" |
24 | IUSE="X" |
| 25 | |
25 | |
| 26 | DEPEND="${DEPEND} \ |
|
|
| 27 | X? ( virtual/x11 ) \ |
26 | DEPEND="X? ( virtual/x11 ) |
| 28 | media-libs/fontconfig" |
27 | media-libs/fontconfig" |
| 29 | |
28 | |
| 30 | # |
29 | # |
| 31 | # Public functions |
30 | # Public functions |
| 32 | # |
31 | # |
| 33 | |
32 | |
| 34 | font_xfont_config() { |
33 | font_xfont_config() { |
| 35 | |
34 | |
| 36 | # create Xfont files |
35 | # create Xfont files |
| 37 | if [ -n "`use X`" ] ; |
36 | if use X ; then |
| 38 | then |
|
|
| 39 | einfo "Creating fonts.scale & fonts.dir..." |
37 | einfo "Creating fonts.scale & fonts.dir ..." |
| 40 | mkfontscale ${D}/usr/share/fonts/${PN} |
38 | mkfontscale "${D}/usr/share/fonts/${PN}" |
| 41 | mkfontdir \ |
39 | mkfontdir \ |
| 42 | -e /usr/share/fonts/encodings \ |
40 | -e /usr/share/fonts/encodings \ |
| 43 | -e /usr/share/fonts/encodings/large \ |
41 | -e /usr/share/fonts/encodings/large \ |
| 44 | -e /usr/X11R6/lib/X11/fonts/encodings \ |
|
|
| 45 | ${D}/usr/share/fonts/${PN} |
42 | "${D}/usr/share/fonts/${PN}" |
|
|
43 | if [ -e "${FONT_S}/fonts.alias" ] ; then |
| 46 | doins ${FONT_S}/fonts.alias |
44 | doins "${FONT_S}/fonts.alias" |
|
|
45 | fi |
| 47 | fi |
46 | fi |
| 48 | |
47 | |
| 49 | } |
48 | } |
| 50 | |
49 | |
| 51 | font_xft_config() { |
50 | font_xft_config() { |
| 52 | |
51 | |
| 53 | # create fontconfig cache |
52 | # create fontconfig cache |
| 54 | einfo "Creating fontconfig cache..." |
53 | einfo "Creating fontconfig cache ..." |
|
|
54 | # Mac OS X has fc-cache at /usr/X11R6/bin |
| 55 | HOME="/root" /usr/bin/fc-cache -f ${D}/usr/share/fonts/${PN} |
55 | HOME="/root" fc-cache -f "${D}/usr/share/fonts/${PN}" |
| 56 | |
56 | |
| 57 | } |
57 | } |
| 58 | |
58 | |
| 59 | # |
59 | # |
| 60 | # Public inheritable functions |
60 | # Public inheritable functions |
| 61 | # |
61 | # |
| 62 | |
62 | |
| 63 | font_src_install() { |
63 | font_src_install() { |
| 64 | |
64 | |
| 65 | local suffix doc |
65 | local suffix |
| 66 | |
66 | |
| 67 | cd ${FONT_S} |
67 | cd "${FONT_S}" |
| 68 | |
68 | |
| 69 | insinto /usr/share/fonts/${PN} |
69 | insinto "/usr/share/fonts/${PN}" |
| 70 | |
70 | |
| 71 | for suffix in ${FONT_SUFFIX}; do |
71 | for suffix in ${FONT_SUFFIX}; do |
| 72 | doins *.${suffix} |
72 | doins *.${suffix} |
| 73 | done |
73 | done |
| 74 | |
74 | |
| 75 | rm -f fonts.{dir,scale} encodings.dir |
75 | rm -f fonts.{dir,scale} encodings.dir |
| 76 | |
76 | |
| 77 | font_xfont_config |
77 | font_xfont_config |
| 78 | font_xft_config |
78 | font_xft_config |
| 79 | |
79 | |
| 80 | cd ${S} |
80 | cd "${S}" |
| 81 | # try to install some common docs |
81 | # try to install some common docs |
| 82 | DOCS="${DOCS} COPYRIGHT README NEWS" |
82 | DOCS="${DOCS} COPYRIGHT README NEWS" |
| 83 | for doc in ${DOCS}; do |
83 | dodoc ${DOCS} |
| 84 | dodoc ${doc} |
|
|
| 85 | done |
|
|
| 86 | |
84 | |
| 87 | } |
85 | } |
| 88 | |
86 | |
|
|
87 | font_pkg_setup() { |
|
|
88 | |
|
|
89 | # make sure we get no colissions |
|
|
90 | # setup is not the nicest place, but preinst doesn't cut it |
|
|
91 | rm "/usr/share/fonts/${PN}/fonts.cache-1" |
|
|
92 | |
|
|
93 | } |
|
|
94 | |
| 89 | EXPORT_FUNCTIONS src_install |
95 | EXPORT_FUNCTIONS src_install pkg_setup |