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

Diff of /eclass/font.eclass

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

Revision 1.49 Revision 1.50
1# Copyright 1999-2010 Gentoo Foundation 1# Copyright 1999-2010 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.49 2010/04/20 04:06:59 dirtyepic Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/font.eclass,v 1.50 2010/05/15 05:25:32 dirtyepic Exp $
4 4
5# @ECLASS: font.eclass 5# @ECLASS: font.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# fonts@gentoo.org 7# fonts@gentoo.org
8
9# Author: Tomáš Chvátal <scarabeus@gentoo.org>
10# Author: foser <foser@gentoo.org>
11# @BLURB: Eclass to make font installation uniform 8# @BLURB: Eclass to make font installation uniform
12 9
13inherit eutils 10inherit eutils
14 11
15EXPORT_FUNCTIONS pkg_setup src_install pkg_postinst pkg_postrm 12EXPORT_FUNCTIONS pkg_setup src_install pkg_postinst pkg_postrm
16 13
17# @ECLASS-VARIABLE: FONT_SUFFIX 14# @ECLASS-VARIABLE: FONT_SUFFIX
18# @DESCRIPTION: 15# @DESCRIPTION:
19# Space delimited list of font suffixes to install 16# Space delimited list of font suffixes to install.
20FONT_SUFFIX=${FONT_SUFFIX:=} 17FONT_SUFFIX=${FONT_SUFFIX:=}
21 18
22# @ECLASS-VARIABLE: FONT_S 19# @ECLASS-VARIABLE: FONT_S
23# @DESCRIPTION: 20# @DESCRIPTION:
24# Dir containing the fonts 21# Working directory containing the fonts.
25FONT_S=${FONT_S:=${S}} 22FONT_S=${FONT_S:=${S}}
26 23
27# @ECLASS-VARIABLE: FONT_PN 24# @ECLASS-VARIABLE: FONT_PN
28# @DESCRIPTION: 25# @DESCRIPTION:
29# Last part of $FONTDIR 26# Font name (ie. last part of FONTDIR).
30FONT_PN=${FONT_PN:=${PN}} 27FONT_PN=${FONT_PN:=${PN}}
31 28
32# @ECLASS-VARIABLE: FONTDIR 29# @ECLASS-VARIABLE: FONTDIR
33# @DESCRIPTION: 30# @DESCRIPTION:
34# This is where the fonts are installed 31# Full path to installation directory.
35FONTDIR=${FONTDIR:-/usr/share/fonts/${FONT_PN}} 32FONTDIR=${FONTDIR:-/usr/share/fonts/${FONT_PN}}
36 33
37# @ECLASS-VARIABLE: FONT_CONF 34# @ECLASS-VARIABLE: FONT_CONF
38# @DESCRIPTION: 35# @DESCRIPTION:
39# Array, which element(s) is(are) path(s) of fontconfig-2.4 file(s) to install 36# Array containing fontconfig conf files to install.
40FONT_CONF=( "" ) 37FONT_CONF=( "" )
41 38
42# @ECLASS-VARIABLE: DOCS 39# @ECLASS-VARIABLE: DOCS
43# @DESCRIPTION: 40# @DESCRIPTION:
44# Docs to install 41# Space delimited list of docs to install.
45DOCS=${DOCS:-} 42DOCS=${DOCS:-}
46 43
47IUSE="X" 44IUSE="X"
48 45
49DEPEND="X? ( 46DEPEND="X? (
52 ) 49 )
53 >=media-libs/fontconfig-2.4.0" 50 >=media-libs/fontconfig-2.4.0"
54 51
55# @FUNCTION: font_xfont_config 52# @FUNCTION: font_xfont_config
56# @DESCRIPTION: 53# @DESCRIPTION:
57# Creates the Xfont files. 54# Generate Xorg font files (mkfontscale/mkfontdir).
58font_xfont_config() { 55font_xfont_config() {
59 # create Xfont files
60 if has X ${IUSE//+} && use X ; then 56 if has X ${IUSE//+} && use X ; then
61 ebegin "Creating fonts.scale & fonts.dir" 57 ebegin "Creating fonts.scale & fonts.dir"
62 rm -f "${ED}${FONTDIR}"/fonts.{dir,scale} 58 rm -f "${ED}${FONTDIR}"/fonts.{dir,scale}
63 mkfontscale "${ED}${FONTDIR}" 59 mkfontscale "${ED}${FONTDIR}"
64 mkfontdir \ 60 mkfontdir \
65 -e ${EPREFIX}/usr/share/fonts/encodings \ 61 -e ${EPREFIX}/usr/share/fonts/encodings \
66 -e ${EPREFIX}/usr/share/fonts/encodings/large \ 62 -e ${EPREFIX}/usr/share/fonts/encodings/large \
67 "${ED}${FONTDIR}" 63 "${ED}${FONTDIR}"
68 eend $? 64 eend $?
69 if [ -e "${FONT_S}/fonts.alias" ] ; then 65 if [[ -e ${FONT_S}/fonts.alias ]] ; then
70 doins "${FONT_S}/fonts.alias" 66 doins "${FONT_S}"/fonts.alias
71 fi 67 fi
72 fi 68 fi
73} 69}
74 70
75# @FUNCTION: font_fontconfig 71# @FUNCTION: font_fontconfig
76# @DESCRIPTION: 72# @DESCRIPTION:
77# Installs the fontconfig config files of FONT_CONF. 73# Install fontconfig conf files given in FONT_CONF.
78font_fontconfig() { 74font_fontconfig() {
79 local conffile 75 local conffile
80 if [[ -n ${FONT_CONF[@]} ]]; then 76 if [[ -n ${FONT_CONF[@]} ]]; then
81 insinto /etc/fonts/conf.avail/ 77 insinto /etc/fonts/conf.avail/
82 for conffile in "${FONT_CONF[@]}"; do 78 for conffile in "${FONT_CONF[@]}"; do
85 fi 81 fi
86} 82}
87 83
88# @FUNCTION: font_cleanup_dirs 84# @FUNCTION: font_cleanup_dirs
89# @DESCRIPTION: 85# @DESCRIPTION:
90# Remove any font directories only containing generated files. 86# Remove font directories containing only generated files.
91# Runs in pkg_postrm.
92font_cleanup_dirs() { 87font_cleanup_dirs() {
93 local genfiles="encodings.dir fonts.alias fonts.cache-1 fonts.dir fonts.scale" 88 local genfiles="encodings.dir fonts.alias fonts.cache-1 fonts.dir fonts.scale"
94 local d f g generated candidate otherfile 89 local d f g generated candidate otherfile
95 90
96 ebegin "Purging empty font directories" 91 ebegin "Purging empty font directories"
148} 143}
149 144
150# @FUNCTION: font_pkg_setup 145# @FUNCTION: font_pkg_setup
151# @DESCRIPTION: 146# @DESCRIPTION:
152# The font pkg_setup function. 147# The font pkg_setup function.
153# Collision portection and Prefix compat for eapi < 3. 148# Collision protection and Prefix compat for eapi < 3.
154font_pkg_setup() { 149font_pkg_setup() {
155 # Prefix compat 150 # Prefix compat
156 case ${EAPI:-0} in 151 case ${EAPI:-0} in
157 0|1|2) 152 0|1|2)
158 if ! use prefix; then 153 if ! use prefix; then
170} 165}
171 166
172# @FUNCTION: font_pkg_postinst 167# @FUNCTION: font_pkg_postinst
173# @DESCRIPTION: 168# @DESCRIPTION:
174# The font pkg_postinst function. 169# The font pkg_postinst function.
175# Update global font cache and fix permissions.
176font_pkg_postinst() { 170font_pkg_postinst() {
177 # unreadable font files = fontconfig segfaults 171 # unreadable font files = fontconfig segfaults
178 find "${EROOT}"usr/share/fonts/ -type f '!' -perm 0644 -print0 \ 172 find "${EROOT}"usr/share/fonts/ -type f '!' -perm 0644 -print0 \
179 | xargs -0 chmod -v 0644 2>/dev/null 173 | xargs -0 chmod -v 0644 2>/dev/null
180 174
201} 195}
202 196
203# @FUNCTION: font_pkg_postrm 197# @FUNCTION: font_pkg_postrm
204# @DESCRIPTION: 198# @DESCRIPTION:
205# The font pkg_postrm function. 199# The font pkg_postrm function.
206# Updates global font cache
207font_pkg_postrm() { 200font_pkg_postrm() {
208 font_cleanup_dirs 201 font_cleanup_dirs
209 202
210 # unreadable font files = fontconfig segfaults 203 # unreadable font files = fontconfig segfaults
211 find "${EROOT}"usr/share/fonts/ -type f '!' -perm 0644 -print0 \ 204 find "${EROOT}"usr/share/fonts/ -type f '!' -perm 0644 -print0 \

Legend:
Removed from v.1.49  
changed lines
  Added in v.1.50

  ViewVC Help
Powered by ViewVC 1.1.20