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

Diff of /eclass/font.eclass

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

Revision 1.51 Revision 1.53
1# Copyright 1999-2010 Gentoo Foundation 1# Copyright 1999-2011 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.51 2010/07/09 03:44:19 dirtyepic Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/font.eclass,v 1.53 2011/08/22 04:46:31 vapier Exp $
4 4
5# @ECLASS: font.eclass 5# @ECLASS: font.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# fonts@gentoo.org 7# fonts@gentoo.org
8# @BLURB: Eclass to make font installation uniform 8# @BLURB: Eclass to make font installation uniform
9 9
10inherit eutils 10inherit eutils
11 11
12EXPORT_FUNCTIONS pkg_setup src_install pkg_postinst pkg_postrm 12EXPORT_FUNCTIONS pkg_setup src_install pkg_postinst pkg_postrm
13 13
14# @ECLASS-VARIABLE: FONT_SUFFIX 14# @ECLASS-VARIABLE: FONT_SUFFIX
15# @DEFAULT_UNSET
16# @REQUIRED
15# @DESCRIPTION: 17# @DESCRIPTION:
16# Space delimited list of font suffixes to install. 18# Space delimited list of font suffixes to install.
17FONT_SUFFIX=${FONT_SUFFIX:=} 19FONT_SUFFIX=${FONT_SUFFIX:-}
18 20
19# @ECLASS-VARIABLE: FONT_S 21# @ECLASS-VARIABLE: FONT_S
22# @DEFAULT_UNSET
23# @REQUIRED
20# @DESCRIPTION: 24# @DESCRIPTION:
21# Working directory containing the fonts. 25# Working directory containing the fonts.
22FONT_S=${FONT_S:=${S}} 26FONT_S=${FONT_S:-${S}}
23 27
24# @ECLASS-VARIABLE: FONT_PN 28# @ECLASS-VARIABLE: FONT_PN
25# @DESCRIPTION: 29# @DESCRIPTION:
26# Font name (ie. last part of FONTDIR). 30# Font name (ie. last part of FONTDIR).
27FONT_PN=${FONT_PN:=${PN}} 31FONT_PN=${FONT_PN:-${PN}}
28 32
29# @ECLASS-VARIABLE: FONTDIR 33# @ECLASS-VARIABLE: FONTDIR
30# @DESCRIPTION: 34# @DESCRIPTION:
31# Full path to installation directory. 35# Full path to installation directory.
32FONTDIR=${FONTDIR:-/usr/share/fonts/${FONT_PN}} 36FONTDIR=${FONTDIR:-/usr/share/fonts/${FONT_PN}}
33 37
34# @ECLASS-VARIABLE: FONT_CONF 38# @ECLASS-VARIABLE: FONT_CONF
39# @DEFAULT_UNSET
35# @DESCRIPTION: 40# @DESCRIPTION:
36# Array containing fontconfig conf files to install. 41# Array containing fontconfig conf files to install.
37FONT_CONF=( "" ) 42FONT_CONF=( "" )
38 43
39# @ECLASS-VARIABLE: DOCS 44# @ECLASS-VARIABLE: DOCS
45# @DEFAULT_UNSET
40# @DESCRIPTION: 46# @DESCRIPTION:
41# Space delimited list of docs to install. 47# Space delimited list of docs to install.
48# We always install these:
49# COPYRIGHT README{,.txt} NEWS AUTHORS BUGS ChangeLog FONTLOG.txt
42DOCS=${DOCS:-} 50DOCS=${DOCS:-}
43 51
44IUSE="X" 52IUSE="X"
45 53
46DEPEND="X? ( 54DEPEND="X? (
103 generated=true 111 generated=true
104 break 112 break
105 fi 113 fi
106 done 114 done
107 # if the file is a generated file then we know this is a font dir (as 115 # if the file is a generated file then we know this is a font dir (as
108 # opposed to something like encodings or util) and a candidate for 116 # opposed to something like encodings or util) and a candidate for
109 # removal. if it's not generated then it's an "otherfile". 117 # removal. if it's not generated then it's an "otherfile".
110 ${generated} && candidate=true || otherfile=true 118 ${generated} && candidate=true || otherfile=true
111 # if the directory is both a candidate for removal and contains at 119 # if the directory is both a candidate for removal and contains at
112 # least one "otherfile" then don't remove it. 120 # least one "otherfile" then don't remove it.
113 [[ ${candidate} == ${otherfile} ]] && break 121 [[ ${candidate} == ${otherfile} ]] && break
114 done 122 done
115 # if we only have generated files, purge the directory. 123 # if in the end we only have generated files, purge the directory.
116 if [[ ${candidate} == true && ${otherfile} == false ]]; then 124 if [[ ${candidate} == true && ${otherfile} == false ]]; then
117 # we don't want to remove fonts.alias files that were installed by 125 # we don't want to remove fonts.alias files that were installed by
118 # media-fonts/font-alias. any other fonts.alias files will have 126 # media-fonts/font-alias. any other fonts.alias files will have
119 # already been unmerged with their packages. 127 # already been unmerged with their packages.
120 for g in ${genfiles}; do 128 for g in ${genfiles}; do
124 # if there's nothing left remove the directory 132 # if there's nothing left remove the directory
125 find "${d}" -maxdepth 0 -type d -empty -exec rmdir '{}' \; 133 find "${d}" -maxdepth 0 -type d -empty -exec rmdir '{}' \;
126 fi 134 fi
127 done 135 done
128 eend 0 136 eend 0
129}
130
131# @FUNCTION: font_src_install
132# @DESCRIPTION:
133# The font src_install function.
134font_src_install() {
135 local suffix commondoc
136
137 pushd "${FONT_S}" > /dev/null
138
139 insinto "${FONTDIR}"
140
141 for suffix in ${FONT_SUFFIX}; do
142 doins *.${suffix}
143 done
144
145 rm -f fonts.{dir,scale} encodings.dir
146
147 font_xfont_config
148 font_fontconfig
149
150 popd > /dev/null
151
152 [[ -n ${DOCS} ]] && { dodoc ${DOCS} || die "docs installation failed" ; }
153
154 # install common docs
155 for commondoc in COPYRIGHT README{,.txt} NEWS AUTHORS BUGS ChangeLog FONTLOG.txt; do
156 [[ -s ${commondoc} ]] && dodoc ${commondoc}
157 done
158} 137}
159 138
160# @FUNCTION: font_pkg_setup 139# @FUNCTION: font_pkg_setup
161# @DESCRIPTION: 140# @DESCRIPTION:
162# The font pkg_setup function. 141# The font pkg_setup function.
177 # make sure we get no collisions 156 # make sure we get no collisions
178 # setup is not the nicest place, but preinst doesn't cut it 157 # setup is not the nicest place, but preinst doesn't cut it
179 [[ -e "${EROOT}/${FONTDIR}/fonts.cache-1" ]] && rm -f "${EROOT}/${FONTDIR}/fonts.cache-1" 158 [[ -e "${EROOT}/${FONTDIR}/fonts.cache-1" ]] && rm -f "${EROOT}/${FONTDIR}/fonts.cache-1"
180} 159}
181 160
161# @FUNCTION: font_src_install
162# @DESCRIPTION:
163# The font src_install function.
164font_src_install() {
165 local suffix commondoc
166
167 pushd "${FONT_S}" > /dev/null
168
169 insinto "${FONTDIR}"
170
171 for suffix in ${FONT_SUFFIX}; do
172 doins *.${suffix}
173 done
174
175 rm -f fonts.{dir,scale} encodings.dir
176
177 font_xfont_config
178 font_fontconfig
179
180 popd > /dev/null
181
182 [[ -n ${DOCS} ]] && { dodoc ${DOCS} || die "docs installation failed" ; }
183
184 # install common docs
185 for commondoc in COPYRIGHT README{,.txt} NEWS AUTHORS BUGS ChangeLog FONTLOG.txt; do
186 [[ -s ${commondoc} ]] && dodoc ${commondoc}
187 done
188}
189
182# @FUNCTION: font_pkg_postinst 190# @FUNCTION: font_pkg_postinst
183# @DESCRIPTION: 191# @DESCRIPTION:
184# The font pkg_postinst function. 192# The font pkg_postinst function.
185font_pkg_postinst() { 193font_pkg_postinst() {
186 # unreadable font files = fontconfig segfaults 194 # unreadable font files = fontconfig segfaults

Legend:
Removed from v.1.51  
changed lines
  Added in v.1.53

  ViewVC Help
Powered by ViewVC 1.1.20