| 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.14 2005/07/06 20:23:20 agriffis 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 | |
| … | |
… | |
| 22 | DOCS="" # Docs to install |
22 | DOCS="" # Docs to install |
| 23 | |
23 | |
| 24 | IUSE="${IUSE} X" |
24 | IUSE="${IUSE} X" |
| 25 | |
25 | |
| 26 | DEPEND="${DEPEND} \ |
26 | DEPEND="${DEPEND} \ |
| 27 | X? ( virtual/x11 ) \ |
27 | X? ( virtual/x11 ) \ |
| 28 | media-libs/fontconfig" |
28 | media-libs/fontconfig" |
| 29 | |
29 | |
| 30 | # |
30 | # |
| 31 | # Public functions |
31 | # Public functions |
| 32 | # |
32 | # |
| 33 | |
33 | |
| 34 | font_xfont_config() { |
34 | font_xfont_config() { |
| 35 | |
35 | |
| 36 | # create Xfont files |
36 | # create Xfont files |
| 37 | if [ -n "`use X`" ] ; |
37 | if use X ; then |
| 38 | then |
|
|
| 39 | einfo "Creating fonts.scale & fonts.dir..." |
38 | einfo "Creating fonts.scale & fonts.dir ..." |
| 40 | mkfontscale ${D}/usr/share/fonts/${PN} |
39 | mkfontscale "${D}/usr/share/fonts/${PN}" |
| 41 | mkfontdir \ |
40 | mkfontdir \ |
| 42 | -e /usr/share/fonts/encodings \ |
41 | -e /usr/share/fonts/encodings \ |
| 43 | -e /usr/share/fonts/encodings/large \ |
42 | -e /usr/share/fonts/encodings/large \ |
| 44 | -e /usr/X11R6/lib/X11/fonts/encodings \ |
43 | -e /usr/X11R6/$(get_libdir)/X11/fonts/encodings \ |
| 45 | ${D}/usr/share/fonts/${PN} |
44 | "${D}/usr/share/fonts/${PN}" |
|
|
45 | if [ -e "${FONT_S}/fonts.alias" ] ; then |
| 46 | doins ${FONT_S}/fonts.alias |
46 | doins "${FONT_S}/fonts.alias" |
|
|
47 | fi |
| 47 | fi |
48 | fi |
| 48 | |
49 | |
| 49 | } |
50 | } |
| 50 | |
51 | |
| 51 | font_xft_config() { |
52 | font_xft_config() { |
| 52 | |
53 | |
| 53 | # create fontconfig cache |
54 | # create fontconfig cache |
| 54 | einfo "Creating fontconfig cache..." |
55 | einfo "Creating fontconfig cache ..." |
|
|
56 | # Mac OS X has fc-cache at /usr/X11R6/bin |
| 55 | HOME="/root" /usr/bin/fc-cache -f ${D}/usr/share/fonts/${PN} |
57 | HOME="/root" fc-cache -f "${D}/usr/share/fonts/${PN}" |
| 56 | |
58 | |
| 57 | } |
59 | } |
| 58 | |
60 | |
| 59 | # |
61 | # |
| 60 | # Public inheritable functions |
62 | # Public inheritable functions |
| 61 | # |
63 | # |
| 62 | |
64 | |
| 63 | font_src_install() { |
65 | font_src_install() { |
| 64 | |
66 | |
| 65 | local suffix doc |
67 | local suffix |
| 66 | |
68 | |
| 67 | cd ${FONT_S} |
69 | cd "${FONT_S}" |
| 68 | |
70 | |
| 69 | insinto /usr/share/fonts/${PN} |
71 | insinto "/usr/share/fonts/${PN}" |
| 70 | |
72 | |
| 71 | for suffix in ${FONT_SUFFIX}; do |
73 | for suffix in ${FONT_SUFFIX}; do |
| 72 | doins *.${suffix} |
74 | doins *.${suffix} |
| 73 | done |
75 | done |
| 74 | |
76 | |
| 75 | rm -f fonts.{dir,scale} encodings.dir |
77 | rm -f fonts.{dir,scale} encodings.dir |
| 76 | |
78 | |
| 77 | font_xfont_config |
79 | font_xfont_config |
| 78 | font_xft_config |
80 | font_xft_config |
| 79 | |
81 | |
| 80 | cd ${S} |
82 | cd "${S}" |
| 81 | # try to install some common docs |
83 | # try to install some common docs |
| 82 | DOCS="${DOCS} COPYRIGHT README NEWS" |
84 | DOCS="${DOCS} COPYRIGHT README NEWS" |
| 83 | for doc in ${DOCS}; do |
85 | dodoc ${DOCS} |
| 84 | dodoc ${doc} |
|
|
| 85 | done |
|
|
| 86 | |
86 | |
| 87 | } |
87 | } |
| 88 | |
88 | |
|
|
89 | font_pkg_setup() { |
|
|
90 | |
|
|
91 | # make sure we get no colissions |
|
|
92 | # setup is not the nicest place, but preinst doesn't cut it |
|
|
93 | rm "/usr/share/fonts/${PN}/fonts.cache-1" |
|
|
94 | |
|
|
95 | } |
|
|
96 | |
| 89 | EXPORT_FUNCTIONS src_install |
97 | EXPORT_FUNCTIONS src_install pkg_setup |