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