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

Diff of /eclass/font.eclass

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

Revision 1.13 Revision 1.23
1# Copyright 1999-2004 Gentoo Foundation 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.13 2005/07/06 20:20:03 agriffis Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/font.eclass,v 1.23 2007/06/24 06:15:21 dirtyepic 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 uniform
10 10
11inherit eutils 11inherit eutils
12
13INHERITED="$INHERITED $ECLASS"
14 12
15# 13#
16# Variable declarations 14# Variable declarations
17# 15#
18 16
19FONT_SUFFIX="" # Space delimited list of font suffixes to install 17FONT_SUFFIX="" # Space delimited list of font suffixes to install
20 18
21FONT_S="${S}" # Dir containing the fonts 19FONT_S="${S}" # Dir containing the fonts
22 20
21FONT_PN="${PN}" # Last part of $FONTDIR
22
23FONTDIR="/usr/share/fonts/${FONT_PN}" # this is where the fonts are installed
24
23DOCS="" # Docs to install 25DOCS="" # Docs to install
24 26
25IUSE="${IUSE} X" 27IUSE="X"
26 28
27DEPEND="${DEPEND} \ 29DEPEND="X? ( x11-apps/mkfontdir )
28 X? ( virtual/x11 ) \
29 media-libs/fontconfig" 30 media-libs/fontconfig"
30 31
31# 32#
32# Public functions 33# Public functions
33# 34#
34 35
35font_xfont_config() { 36font_xfont_config() {
36 37
37 # create Xfont files 38 # create Xfont files
38 if use X ; then 39 if use X ; then
39 einfo "Creating fonts.scale & fonts.dir ..." 40 einfo "Creating fonts.scale & fonts.dir ..."
40 mkfontscale "${D}/usr/share/fonts/${PN}" 41 mkfontscale "${D}${FONTDIR}"
41 mkfontdir \ 42 mkfontdir \
42 -e /usr/share/fonts/encodings \ 43 -e /usr/share/fonts/encodings \
43 -e /usr/share/fonts/encodings/large \ 44 -e /usr/share/fonts/encodings/large \
44 -e /usr/X11R6/$(get_libdir)/X11/fonts/encodings \ 45 "${D}${FONTDIR}"
45 "${D}/usr/share/fonts/${PN}"
46 if [ -e "${FONT_S}/fonts.alias" ] ; then 46 if [ -e "${FONT_S}/fonts.alias" ] ; then
47 doins "${FONT_S}/fonts.alias" 47 doins "${FONT_S}/fonts.alias"
48 fi 48 fi
49 fi 49 fi
50 50
51} 51}
52 52
53font_xft_config() { 53font_xft_config() {
54 54
55 if ! has_version '>=media-libs/fontconfig-2.4'; then
55 # create fontconfig cache 56 # create fontconfig cache
56 einfo "Creating fontconfig cache ..." 57 einfo "Creating fontconfig cache ..."
57 # Mac OS X has fc-cache at /usr/X11R6/bin 58 # Mac OS X has fc-cache at /usr/X11R6/bin
58 HOME="/root" fc-cache -f "${D}/usr/share/fonts/${PN}" 59 HOME="/root" fc-cache -f "${D}${FONTDIR}"
59 60 fi
60} 61}
61 62
62# 63#
63# Public inheritable functions 64# Public inheritable functions
64# 65#
65 66
66font_src_install() { 67font_src_install() {
67 68
68 local suffix 69 local suffix commondoc
69 70
70 cd "${FONT_S}" 71 cd "${FONT_S}"
71 72
72 insinto "/usr/share/fonts/${PN}" 73 insinto "${FONTDIR}"
73 74
74 for suffix in ${FONT_SUFFIX}; do 75 for suffix in ${FONT_SUFFIX}; do
75 doins *.${suffix} 76 doins *.${suffix}
76 done 77 done
77 78
78 rm -f fonts.{dir,scale} encodings.dir 79 rm -f fonts.{dir,scale} encodings.dir
79 80
80 font_xfont_config 81 font_xfont_config
81 font_xft_config 82 font_xft_config
82 83
83 cd "${S}" 84 cd "${S}"
84 # try to install some common docs 85 dodoc ${DOCS} 2> /dev/null
85 DOCS="${DOCS} COPYRIGHT README NEWS"
86 dodoc ${DOCS}
87 86
87 # install common docs
88 for commondoc in COPYRIGHT README NEWS AUTHORS BUGS ChangeLog; do
89 [ -s ${commondoc} ] && dodoc ${commondoc}
90 done
88} 91}
89 92
90font_pkg_setup() { 93font_pkg_setup() {
91 94
92 # make sure we get no colissions 95 # make sure we get no colissions
93 # setup is not the nicest place, but preinst doesn't cut it 96 # setup is not the nicest place, but preinst doesn't cut it
94 rm "/usr/share/fonts/${PN}/fonts.cache-1" 97 [[ -e "${FONTDIR}/fonts.cache-1" ]] && rm -f "${FONTDIR}/fonts.cache-1"
95 98
96} 99}
97 100
101font_pkg_postinst() {
102
103 if has_version '>=media-libs/fontconfig-2.4'; then
104 if [ ${ROOT} == "/" ]; then
105 ebegin "Updating global fontcache"
106 fc-cache -s
107 eend $?
108 fi
109 fi
110
111}
112
113font_pkg_postrm() {
114
115 if has_version '>=media-libs/fontconfig-2.4'; then
116 if [ ${ROOT} == "/" ]; then
117 ebegin "Updating global fontcache"
118 fc-cache -s
119 eend $?
120 fi
121 fi
122
123}
124
98EXPORT_FUNCTIONS src_install pkg_setup 125EXPORT_FUNCTIONS src_install pkg_setup pkg_postinst pkg_postrm

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.23

  ViewVC Help
Powered by ViewVC 1.1.20