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

Diff of /eclass/font.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.18

  ViewVC Help
Powered by ViewVC 1.1.20