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

Diff of /eclass/font.eclass

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

Revision 1.37 Revision 1.38
1# Copyright 1999-2007 Gentoo Foundation 1# Copyright 1999-2007 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.37 2008/05/19 00:42:13 dirtyepic Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/font.eclass,v 1.38 2008/06/21 06:12:45 pva Exp $
4 4
5# @ECLASS: font.eclass
6# @MAINTAINER:
7# fonts@gentoo.org
8#
5# Author: foser <foser@gentoo.org> 9# Author: foser <foser@gentoo.org>
6
7# Font Eclass
8#
9# Eclass to make font installation uniform 10# @BLURB: Eclass to make font installation uniform
10 11
11inherit eutils 12inherit eutils
12 13
13# 14#
14# Variable declarations 15# Variable declarations
15# 16#
16 17
18# @ECLASS-VARIABLE: FONT_SUFFIX
19# @DESCRIPTION:
17FONT_SUFFIX="" # Space delimited list of font suffixes to install 20# Space delimited list of font suffixes to install
21FONT_SUFFIX=""
18 22
23# @ECLASS-VARIABLE: FONT_S
24# @DESCRIPTION:
19FONT_S=${S} # Dir containing the fonts 25# Dir containing the fonts
26FONT_S=${S}
20 27
28# @ECLASS-VARIABLE: FONT_PN
29# @DESCRIPTION:
21FONT_PN=${PN} # Last part of $FONTDIR 30# Last part of $FONTDIR
31FONT_PN=${PN}
22 32
23FONTDIR=/usr/share/fonts/${FONT_PN} # This is where the fonts are installed 33# @ECLASS-VARIABLE: FONTDIR
34# @DESCRIPTION:
35# This is where the fonts are installed
36FONTDIR=/usr/share/fonts/${FONT_PN}
24 37
38# @ECLASS-VARIABLE: FONT_CONF
39# @DESCRIPTION:
25FONT_CONF=( "" ) # Array, which element(s) is(are) path(s) of fontconfig-2.4 file(s) to install 40# Array, which element(s) is(are) path(s) of fontconfig-2.4 file(s) to install
41FONT_CONF=( "" )
26 42
43# @ECLASS-VARIABLE: DOCS
44# @DESCRIPTION:
27DOCS="" # Docs to install 45# Docs to install
46DOCS=""
28 47
29IUSE="X" 48IUSE="X"
30 49
31DEPEND="X? ( x11-apps/mkfontdir ) 50DEPEND="X? ( x11-apps/mkfontdir )
32 media-libs/fontconfig" 51 media-libs/fontconfig"
33 52
34# 53#
35# Public functions 54# Public functions
36# 55#
37 56
57# @FUNCTION: font_xfont_config
58# @DESCRIPTION:
59# Creates the Xfont files.
38font_xfont_config() { 60font_xfont_config() {
39 # create Xfont files 61 # create Xfont files
40 if use X ; then 62 if use X ; then
41 einfo "Creating fonts.scale & fonts.dir ..." 63 einfo "Creating fonts.scale & fonts.dir ..."
42 mkfontscale "${D}${FONTDIR}" 64 mkfontscale "${D}${FONTDIR}"
48 doins "${FONT_S}/fonts.alias" 70 doins "${FONT_S}/fonts.alias"
49 fi 71 fi
50 fi 72 fi
51} 73}
52 74
75# @FUNCTION: font_xft_config
76# @DESCRIPTION:
77# Creates the fontconfig cache if necessary.
53font_xft_config() { 78font_xft_config() {
54 if ! has_version '>=media-libs/fontconfig-2.4'; then 79 if ! has_version '>=media-libs/fontconfig-2.4'; then
55 # create fontconfig cache 80 # create fontconfig cache
56 einfo "Creating fontconfig cache ..." 81 einfo "Creating fontconfig cache ..."
57 # Mac OS X has fc-cache at /usr/X11R6/bin 82 # Mac OS X has fc-cache at /usr/X11R6/bin
58 HOME="/root" fc-cache -f "${D}${FONTDIR}" 83 HOME="/root" fc-cache -f "${D}${FONTDIR}"
59 fi 84 fi
60} 85}
61 86
87# @FUNCTION: font_fontconfig
88# @DESCRIPTION:
89# Installs the fontconfig config files of FONT_CONF.
62font_fontconfig() { 90font_fontconfig() {
63 local conffile 91 local conffile
64 if [[ -n ${FONT_CONF[@]} ]]; then 92 if [[ -n ${FONT_CONF[@]} ]]; then
65 if has_version '>=media-libs/fontconfig-2.4'; then 93 if has_version '>=media-libs/fontconfig-2.4'; then
66 insinto /etc/fonts/conf.avail/ 94 insinto /etc/fonts/conf.avail/
73 101
74# 102#
75# Public inheritable functions 103# Public inheritable functions
76# 104#
77 105
106# @FUNCTION: font_src_install
107# @DESCRIPTION:
108# The font src_install function, which is exported.
78font_src_install() { 109font_src_install() {
79 local suffix commondoc 110 local suffix commondoc
80 111
81 cd "${FONT_S}" 112 cd "${FONT_S}"
82 113
99 for commondoc in COPYRIGHT README{,.txt} NEWS AUTHORS BUGS ChangeLog FONTLOG.txt; do 130 for commondoc in COPYRIGHT README{,.txt} NEWS AUTHORS BUGS ChangeLog FONTLOG.txt; do
100 [[ -s ${commondoc} ]] && dodoc ${commondoc} 131 [[ -s ${commondoc} ]] && dodoc ${commondoc}
101 done 132 done
102} 133}
103 134
135# @FUNCTION: font_pkg_setup
136# @DESCRIPTION:
137# The font pkg_setup function, which is exported.
104font_pkg_setup() { 138font_pkg_setup() {
105 # make sure we get no collisions 139 # make sure we get no collisions
106 # setup is not the nicest place, but preinst doesn't cut it 140 # setup is not the nicest place, but preinst doesn't cut it
107 [[ -e "${FONTDIR}/fonts.cache-1" ]] && rm -f "${FONTDIR}/fonts.cache-1" 141 [[ -e "${FONTDIR}/fonts.cache-1" ]] && rm -f "${FONTDIR}/fonts.cache-1"
108} 142}
109 143
144# @FUNCTION: font_pkg_postinst
145# @DESCRIPTION:
146# The font pkg_postinst function, which is exported.
110font_pkg_postinst() { 147font_pkg_postinst() {
111 # unreadable font files = fontconfig segfaults 148 # unreadable font files = fontconfig segfaults
112 find "${ROOT}"usr/share/fonts/ -type f '!' -perm 0644 -print0 \ 149 find "${ROOT}"usr/share/fonts/ -type f '!' -perm 0644 -print0 \
113 | xargs -0 chmod -v 0644 2>/dev/null 150 | xargs -0 chmod -v 0644 2>/dev/null
114 151
119 eend $? 156 eend $?
120 fi 157 fi
121 fi 158 fi
122} 159}
123 160
161# @FUNCTION: font_pkg_postrm
162# @DESCRIPTION:
163# The font pkg_postrm function, which is exported.
124font_pkg_postrm() { 164font_pkg_postrm() {
125 # unreadable font files = fontconfig segfaults 165 # unreadable font files = fontconfig segfaults
126 find "${ROOT}"usr/share/fonts/ -type f '!' -perm 0644 -print0 \ 166 find "${ROOT}"usr/share/fonts/ -type f '!' -perm 0644 -print0 \
127 | xargs -0 chmod -v 0644 2>/dev/null 167 | xargs -0 chmod -v 0644 2>/dev/null
128 168

Legend:
Removed from v.1.37  
changed lines
  Added in v.1.38

  ViewVC Help
Powered by ViewVC 1.1.20