/[gentoo-x86]/eclass/x-modular.eclass
Gentoo

Diff of /eclass/x-modular.eclass

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

Revision 1.99 Revision 1.122
1# Copyright 1999-2005 Gentoo Foundation 1# Copyright 1999-2005 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/x-modular.eclass,v 1.99 2008/05/27 18:42:33 dberkholz Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/x-modular.eclass,v 1.122 2011/10/04 21:23:46 chithanh Exp $
4#
5# @DEPRECATED
6# This eclass has been superseded by xorg-2
7# Please modify your ebuilds to use that instead
4# 8#
5# @ECLASS: x-modular.eclass 9# @ECLASS: x-modular.eclass
6# @MAINTAINER: 10# @MAINTAINER:
7# Donnie Berkholz <dberkholz@gentoo.org>, x11@gentoo.org 11# Donnie Berkholz <dberkholz@gentoo.org>, x11@gentoo.org
8# @BLURB: Reduces code duplication in the modularized X11 ebuilds. 12# @BLURB: Reduces code duplication in the modularized X11 ebuilds.
15# All you need to do in a basic ebuild is inherit this eclass and set 19# All you need to do in a basic ebuild is inherit this eclass and set
16# DESCRIPTION, KEYWORDS and RDEPEND/DEPEND. If your package is hosted 20# DESCRIPTION, KEYWORDS and RDEPEND/DEPEND. If your package is hosted
17# with the other X packages, you don't need to set SRC_URI. Pretty much 21# with the other X packages, you don't need to set SRC_URI. Pretty much
18# everything else should be automatic. 22# everything else should be automatic.
19 23
24if [[ ${PV} = 9999* ]]; then
25 GIT_ECLASS="git"
26 SNAPSHOT="yes"
27 SRC_URI=""
28fi
29
30# If we're a font package, but not the font.alias one
31FONT_ECLASS=""
32if [[ "${PN/#font-}" != "${PN}" ]] \
33 && [[ "${CATEGORY}" = "media-fonts" ]] \
34 && [[ "${PN}" != "font-alias" ]] \
35 && [[ "${PN}" != "font-util" ]]; then
36 # Activate font code in the rest of the eclass
37 FONT="yes"
38
39 # Whether to inherit the font eclass
40 FONT_ECLASS="font"
41fi
42
43inherit eutils libtool multilib toolchain-funcs flag-o-matic autotools \
44 ${FONT_ECLASS} ${GIT_ECLASS}
45
46EXPORTED_FUNCTIONS="src_unpack src_compile src_install pkg_preinst pkg_postinst pkg_postrm"
47
48case "${EAPI:-0}" in
49 0|1)
50 ;;
51 2)
52 EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare src_configure"
53 ;;
54 *)
55 die "Unknown EAPI ${EAPI}"
56 ;;
57esac
58
59# exports must be ALWAYS after inherit
60EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS}
61
20# @ECLASS-VARIABLE: XDIR 62# @ECLASS-VARIABLE: XDIR
21# @DESCRIPTION: 63# @DESCRIPTION:
22# Directory prefix to use for everything. If you want to install to a 64# Directory prefix to use for everything. If you want to install to a
23# non-default prefix (e.g., /opt/xorg), change XDIR. This has not been 65# non-default prefix (e.g., /opt/xorg), change XDIR. This has not been
24# recently tested. You may need to uncomment the setting of datadir and 66# recently tested. You may need to uncomment the setting of datadir and
27XDIR="/usr" 69XDIR="/usr"
28 70
29IUSE="" 71IUSE=""
30HOMEPAGE="http://xorg.freedesktop.org/" 72HOMEPAGE="http://xorg.freedesktop.org/"
31 73
32if [[ -z ${SNAPSHOT} ]]; then
33# @ECLASS-VARIABLE: SNAPSHOT 74# @ECLASS-VARIABLE: SNAPSHOT
34# @DESCRIPTION: 75# @DESCRIPTION:
35# If set to 'yes' and configure.ac exists, eautoreconf will run. Set 76# If set to 'yes' and configure.ac exists, eautoreconf will run. Set
36# before inheriting this eclass. 77# before inheriting this eclass.
37 SNAPSHOT="no" 78: ${SNAPSHOT:=no}
38fi
39
40if [[ ${PV} = 9999* ]]; then
41 GIT_ECLASS="git"
42 SNAPSHOT="yes"
43 SRC_URI=""
44fi
45 79
46# Set up SRC_URI for individual modular releases 80# Set up SRC_URI for individual modular releases
47BASE_INDIVIDUAL_URI="http://xorg.freedesktop.org/releases/individual" 81BASE_INDIVIDUAL_URI="http://xorg.freedesktop.org/releases/individual"
48if [[ -z ${MODULE} ]]; then
49# @ECLASS-VARIABLE: MODULE 82# @ECLASS-VARIABLE: MODULE
50# @DESCRIPTION: 83# @DESCRIPTION:
51# The subdirectory to download source from. Possible settings are app, 84# The subdirectory to download source from. Possible settings are app,
52# doc, data, util, driver, font, lib, proto, xserver. Set above the 85# doc, data, util, driver, font, lib, proto, xserver. Set above the
53# inherit to override the default autoconfigured module. 86# inherit to override the default autoconfigured module.
54 MODULE="" 87if [[ -z ${MODULE} ]]; then
55 if [[ ${CATEGORY} = x11-apps ]] || [[ ${CATEGORY} = x11-wm ]]; then 88 case ${CATEGORY} in
56 MODULE="app" 89 app-doc) MODULE="doc" ;;
57 elif [[ ${CATEGORY} = app-doc ]]; then 90 media-fonts) MODULE="font" ;;
58 MODULE="doc" 91 x11-apps|x11-wm) MODULE="app" ;;
59 # x11-misc contains data and util, x11-themes contains data 92 x11-misc|x11-themes) MODULE="util" ;;
60 elif [[ ${CATEGORY} = x11-misc ]] || [[ ${CATEGORY} = x11-themes ]]; then 93 x11-drivers) MODULE="driver" ;;
61 if [[ ${PN} == xbitmaps || ${PN} == xcursor-themes || ${PN} == xkbdata ]]; then 94 x11-base) MODULE="xserver" ;;
62 MODULE="data" 95 x11-proto) MODULE="proto" ;;
63 else 96 x11-libs) MODULE="lib" ;;
64 MODULE="util" 97 esac
65 fi
66 elif [[ ${CATEGORY} = x11-drivers ]]; then
67 MODULE="driver"
68 elif [[ ${CATEGORY} = media-fonts ]]; then
69 MODULE="font"
70 elif [[ ${CATEGORY} = x11-libs ]]; then
71 MODULE="lib"
72 elif [[ ${CATEGORY} = x11-proto ]]; then
73 MODULE="proto"
74 elif [[ ${CATEGORY} = x11-base ]]; then
75 MODULE="xserver"
76 fi
77fi 98fi
78 99
79if [[ -n ${GIT_ECLASS} ]]; then 100if [[ -n ${GIT_ECLASS} ]]; then
80 EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/${MODULE}/${PN}" 101 EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/${MODULE}/${PN}"
81else 102else
83fi 104fi
84 105
85SLOT="0" 106SLOT="0"
86 107
87# Set the license for the package. This can be overridden by setting 108# Set the license for the package. This can be overridden by setting
88# LICENSE after the inherit. 109# LICENSE after the inherit. Nearly all FreeDesktop-hosted X packages
89LICENSE=${PN} 110# are under the MIT license. (This is what Red Hat does in their rpms)
111LICENSE="MIT"
90 112
91# Set up shared dependencies 113# Set up shared dependencies
92if [[ -n "${SNAPSHOT}" ]]; then 114if [[ -n "${SNAPSHOT}" ]]; then
93# FIXME: What's the minimal libtool version supporting arbitrary versioning? 115# FIXME: What's the minimal libtool version supporting arbitrary versioning?
94 DEPEND="${DEPEND} 116 DEPEND="${DEPEND}
96 >=sys-devel/m4-1.4" 118 >=sys-devel/m4-1.4"
97 WANT_AUTOCONF="latest" 119 WANT_AUTOCONF="latest"
98 WANT_AUTOMAKE="latest" 120 WANT_AUTOMAKE="latest"
99fi 121fi
100 122
101# If we're a font package, but not the font.alias one 123if [[ -n "${FONT}" ]]; then
102FONT_ECLASS=""
103if [[ "${PN/#font-}" != "${PN}" ]] \
104 && [[ "${CATEGORY}" = "media-fonts" ]] \
105 && [[ "${PN}" != "font-alias" ]] \
106 && [[ "${PN}" != "font-util" ]]; then
107 # Activate font code in the rest of the eclass
108 FONT="yes"
109
110 # Whether to inherit the font eclass
111 FONT_ECLASS="font"
112
113 RDEPEND="${RDEPEND} 124 RDEPEND="${RDEPEND}
114 media-fonts/encodings 125 media-fonts/encodings
115 x11-apps/mkfontscale 126 x11-apps/mkfontscale
116 x11-apps/mkfontdir" 127 x11-apps/mkfontdir"
117 PDEPEND="${PDEPEND} 128 PDEPEND="${PDEPEND}
118 media-fonts/font-alias" 129 media-fonts/font-alias"
119 130
120 # Starting with 7.0RC3, we can specify the font directory 131 # Starting with 7.0RC3, we can specify the font directory
121 # But oddly, we can't do the same for encodings or font-alias 132 # But oddly, we can't do the same for encodings or font-alias
122 133
123 # Wrap in `if` so ebuilds can set it too
124 if [[ -z ${FONT_DIR} ]]; then
125# @ECLASS-VARIABLE: FONT_DIR 134# @ECLASS-VARIABLE: FONT_DIR
126# @DESCRIPTION: 135# @DESCRIPTION:
127# If you're creating a font package and the suffix of PN is not equal to 136# If you're creating a font package and the suffix of PN is not equal to
128# the subdirectory of /usr/share/fonts/ it should install into, set 137# the subdirectory of /usr/share/fonts/ it should install into, set
129# FONT_DIR to that directory or directories. Set before inheriting this 138# FONT_DIR to that directory or directories. Set before inheriting this
130# eclass. 139# eclass.
131 FONT_DIR=${PN##*-} 140 : ${FONT_DIR:=${PN##*-}}
132
133 fi
134 141
135 # Fix case of font directories 142 # Fix case of font directories
136 FONT_DIR=${FONT_DIR/ttf/TTF} 143 FONT_DIR=${FONT_DIR/ttf/TTF}
137 FONT_DIR=${FONT_DIR/otf/OTF} 144 FONT_DIR=${FONT_DIR/otf/OTF}
138 FONT_DIR=${FONT_DIR/type1/Type1} 145 FONT_DIR=${FONT_DIR/type1/Type1}
139 FONT_DIR=${FONT_DIR/speedo/Speedo} 146 FONT_DIR=${FONT_DIR/speedo/Speedo}
140 147
141 # Set up configure option 148 # Set up configure options, wrapped so ebuilds can override if need be
149 if [[ -z ${FONT_OPTIONS} ]]; then
142 FONT_OPTIONS="--with-fontdir=\"/usr/share/fonts/${FONT_DIR}\"" 150 FONT_OPTIONS="--with-fontdir=\"/usr/share/fonts/${FONT_DIR}\""
151 fi
143 152
144 if [[ -n "${FONT}" ]]; then 153 if [[ -n "${FONT}" ]]; then
145 if [[ ${PN##*-} = misc ]] || [[ ${PN##*-} = 75dpi ]] || [[ ${PN##*-} = 100dpi ]] || [[ ${PN##*-} = cyrillic ]]; then 154 if [[ ${PN##*-} = misc ]] || [[ ${PN##*-} = 75dpi ]] || [[ ${PN##*-} = 100dpi ]] || [[ ${PN##*-} = cyrillic ]]; then
146 IUSE="${IUSE} nls" 155 IUSE="${IUSE} nls"
147 fi 156 fi
171DEPEND="${DEPEND} 180DEPEND="${DEPEND}
172 >=dev-util/pkgconfig-0.18" 181 >=dev-util/pkgconfig-0.18"
173 182
174if [[ "${PN/util-macros}" = "${PN}" ]]; then 183if [[ "${PN/util-macros}" = "${PN}" ]]; then
175 DEPEND="${DEPEND} 184 DEPEND="${DEPEND}
176 >=x11-misc/util-macros-0.99.2 185 >=x11-misc/util-macros-1.3.0"
177 >=sys-devel/binutils-2.16.1-r3"
178fi 186fi
179 187
180RDEPEND="${RDEPEND} 188RDEPEND="${RDEPEND}
181 !<=x11-base/xorg-x11-6.9" 189 !<=x11-base/xorg-x11-6.9"
182# Provides virtual/x11 for temporary use until packages are ported 190# Provides virtual/x11 for temporary use until packages are ported
183# x11-base/x11-env" 191# x11-base/x11-env"
184
185inherit eutils libtool multilib toolchain-funcs flag-o-matic autotools \
186 ${FONT_ECLASS} ${GIT_ECLASS}
187 192
188# @FUNCTION: x-modular_specs_check 193# @FUNCTION: x-modular_specs_check
189# @USAGE: 194# @USAGE:
190# @DESCRIPTION: 195# @DESCRIPTION:
191# Make any necessary changes related to gcc specs (generally hardened) 196# Make any necessary changes related to gcc specs (generally hardened)
202# @DESCRIPTION: 207# @DESCRIPTION:
203# Ensures the server supports DRI if building a driver with DRI support 208# Ensures the server supports DRI if building a driver with DRI support
204x-modular_dri_check() { 209x-modular_dri_check() {
205 # (#120057) Enabling DRI in drivers requires that the server was built with 210 # (#120057) Enabling DRI in drivers requires that the server was built with
206 # support for it 211 # support for it
212 # Starting with xorg-server 1.5.3, DRI support is always enabled unless
213 # USE=minimal is set (see bug #252084)
207 if [[ -n "${DRIVER}" ]]; then 214 if [[ -n "${DRIVER}" ]]; then
208 if has dri ${IUSE} && use dri; then 215 if has dri ${IUSE} && use dri; then
209 einfo "Checking for direct rendering capabilities ..." 216 einfo "Checking for direct rendering capabilities ..."
217 if has_version '>=x11-base/xorg-server-1.5.3'; then
218 if built_with_use x11-base/xorg-server minimal; then
219 die "You must build x11-base/xorg-server with USE=-minimal."
220 fi
221 else
210 if ! built_with_use x11-base/xorg-server dri; then 222 if ! built_with_use x11-base/xorg-server dri; then
211 die "You must build x11-base/xorg-server with USE=dri." 223 die "You must build x11-base/xorg-server with USE=dri."
224 fi
212 fi 225 fi
213 fi 226 fi
214 fi 227 fi
215} 228}
216 229
239 if [[ -n ${GIT_ECLASS} ]]; then 252 if [[ -n ${GIT_ECLASS} ]]; then
240 git_src_unpack 253 git_src_unpack
241 else 254 else
242 unpack ${A} 255 unpack ${A}
243 fi 256 fi
244 cd ${S} 257 cd "${S}"
245 258
246 if [[ -n ${FONT_OPTIONS} ]]; then 259 if [[ -n ${FONT_OPTIONS} ]]; then
247 einfo "Detected font directory: ${FONT_DIR}" 260 einfo "Detected font directory: ${FONT_DIR}"
248 fi 261 fi
249} 262}
299 # Joshua Baergen - October 23, 2005 312 # Joshua Baergen - October 23, 2005
300 # Fix shared lib issues on MIPS, FBSD, etc etc 313 # Fix shared lib issues on MIPS, FBSD, etc etc
301 elibtoolize 314 elibtoolize
302} 315}
303 316
317# @FUNCTION: x-modular_src_prepare
318# @USAGE:
319# @DESCRIPTION:
320# Prepare a package after unpacking, performing all X-related tasks.
321x-modular_src_prepare() {
322 [[ -n ${GIT_ECLASS} ]] && has src_prepare ${EXPORTED_FUNCTIONS} \
323 && git_src_prepare
324 x-modular_patch_source
325 x-modular_reconf_source
326}
327
304# @FUNCTION: x-modular_src_unpack 328# @FUNCTION: x-modular_src_unpack
305# @USAGE: 329# @USAGE:
306# @DESCRIPTION: 330# @DESCRIPTION:
307# Unpack a package, performing all X-related tasks. 331# Unpack a package, performing all X-related tasks.
308x-modular_src_unpack() { 332x-modular_src_unpack() {
309 x-modular_specs_check 333 x-modular_specs_check
310 x-modular_server_supports_drivers_check 334 x-modular_server_supports_drivers_check
311 x-modular_dri_check 335 x-modular_dri_check
312 x-modular_unpack_source 336 x-modular_unpack_source
313 x-modular_patch_source 337 has src_prepare ${EXPORTED_FUNCTIONS} || x-modular_src_prepare
314 x-modular_reconf_source
315} 338}
316 339
317# @FUNCTION: x-modular_font_configure 340# @FUNCTION: x-modular_font_configure
318# @USAGE: 341# @USAGE:
319# @DESCRIPTION: 342# @DESCRIPTION:
320# If a font package, perform any necessary configuration steps 343# If a font package, perform any necessary configuration steps
321x-modular_font_configure() { 344x-modular_font_configure() {
322 if [[ -n "${FONT}" ]]; then 345 if [[ -n "${FONT}" ]]; then
323 # Might be worth adding an option to configure your desired font 346 # Might be worth adding an option to configure your desired font
324 # and exclude all others. Also, should this USE be nls or minimal? 347 # and exclude all others. Also, should this USE be nls or minimal?
325 if ! use nls; then 348 if has nls ${IUSE//+} && ! use nls; then
326 FONT_OPTIONS="${FONT_OPTIONS} 349 FONT_OPTIONS="${FONT_OPTIONS}
327 --disable-iso8859-2 350 --disable-iso8859-2
328 --disable-iso8859-3 351 --disable-iso8859-3
329 --disable-iso8859-4 352 --disable-iso8859-4
330 --disable-iso8859-5 353 --disable-iso8859-5
366 x-modular_font_configure 389 x-modular_font_configure
367 x-modular_debug_setup 390 x-modular_debug_setup
368 391
369# @VARIABLE: CONFIGURE_OPTIONS 392# @VARIABLE: CONFIGURE_OPTIONS
370# @DESCRIPTION: 393# @DESCRIPTION:
371# Any options to pass to configure 394# Any extra options to pass to configure
372[[ -n ${CONFIGURE_OPTIONS} ]]
373 395
374 # If prefix isn't set here, .pc files cause problems 396 # If prefix isn't set here, .pc files cause problems
375 if [[ -x ${ECONF_SOURCE:-.}/configure ]]; then 397 if [[ -x ${ECONF_SOURCE:-.}/configure ]]; then
376 econf --prefix=${XDIR} \ 398 econf --prefix=${XDIR} \
377 --datadir=${XDIR}/share \ 399 --datadir=${XDIR}/share \
387# Run make. 409# Run make.
388x-modular_src_make() { 410x-modular_src_make() {
389 emake || die "emake failed" 411 emake || die "emake failed"
390} 412}
391 413
392# @FUNCTION: x-modular_src_configure 414# @FUNCTION: x-modular_src_compile
393# @USAGE: 415# @USAGE:
394# @DESCRIPTION: 416# @DESCRIPTION:
395# Compile a package, performing all X-related tasks. 417# Compile a package, performing all X-related tasks.
396x-modular_src_compile() { 418x-modular_src_compile() {
397 x-modular_src_configure 419 has src_configure ${EXPORTED_FUNCTIONS} || x-modular_src_configure
398 x-modular_src_make 420 x-modular_src_make
399} 421}
400 422
401# @FUNCTION: x-modular_src_install 423# @FUNCTION: x-modular_src_install
402# @USAGE: 424# @USAGE:
403# @DESCRIPTION: 425# @DESCRIPTION:
404# Install a built package to ${D}, performing any necessary steps. 426# Install a built package to ${D}, performing any necessary steps.
405# Creates a ChangeLog from git if using live ebuilds. 427# Creates a ChangeLog from git if using live ebuilds.
406x-modular_src_install() { 428x-modular_src_install() {
407 # Install everything to ${XDIR} 429 # Install everything to ${XDIR}
430 if [[ ${CATEGORY} = x11-proto ]]; then
408 make \ 431 make \
432 ${PN/proto/}docdir=/usr/share/doc/${PF} \
409 DESTDIR="${D}" \ 433 DESTDIR="${D}" \
410 install 434 install \
435 || die
436 else
437 make \
438 docdir=/usr/share/doc/${PF} \
439 DESTDIR="${D}" \
440 install \
441 || die
442 fi
411# Shouldn't be necessary in XDIR=/usr 443# Shouldn't be necessary in XDIR=/usr
412# einstall forces datadir, so we need to re-force it 444# einstall forces datadir, so we need to re-force it
413# datadir=${XDIR}/share \ 445# datadir=${XDIR}/share \
414# mandir=${XDIR}/share/man \ 446# mandir=${XDIR}/share/man \
415 447
418 git log ${GIT_TREE} > "${S}"/ChangeLog 450 git log ${GIT_TREE} > "${S}"/ChangeLog
419 popd 451 popd
420 fi 452 fi
421 453
422 if [[ -e ${S}/ChangeLog ]]; then 454 if [[ -e ${S}/ChangeLog ]]; then
423 dodoc ${S}/ChangeLog 455 dodoc "${S}"/ChangeLog
424 fi 456 fi
425# @VARIABLE: DOCS 457# @VARIABLE: DOCS
426# @DESCRIPTION: 458# @DESCRIPTION:
427# Any documentation to install 459# Any documentation to install via dodoc
428 [[ -n ${DOCS} ]] && dodoc ${DOCS} 460 [[ -n ${DOCS} ]] && dodoc ${DOCS}
429
430 # Make sure docs get compressed
431 prepalldocs
432 461
433 # Don't install libtool archives for server modules 462 # Don't install libtool archives for server modules
434 if [[ -e ${D}/usr/$(get_libdir)/xorg/modules ]]; then 463 if [[ -e ${D}/usr/$(get_libdir)/xorg/modules ]]; then
435 find ${D}/usr/$(get_libdir)/xorg/modules -name '*.la' \ 464 find "${D}"/usr/$(get_libdir)/xorg/modules -name '*.la' \
436 | xargs rm -f 465 | xargs rm -f
437 fi 466 fi
438 467
439 if [[ -n "${FONT}" ]]; then 468 if [[ -n "${FONT}" ]]; then
440 remove_font_metadata 469 remove_font_metadata
470# @DESCRIPTION: 499# @DESCRIPTION:
471# Run X-specific post-removal tasks on the live filesystem. The only 500# Run X-specific post-removal tasks on the live filesystem. The only
472# task right now is some cleanup for font packages. 501# task right now is some cleanup for font packages.
473x-modular_pkg_postrm() { 502x-modular_pkg_postrm() {
474 if [[ -n "${FONT}" ]]; then 503 if [[ -n "${FONT}" ]]; then
475 cleanup_fonts
476 font_pkg_postrm 504 font_pkg_postrm
477 fi 505 fi
478}
479
480# @FUNCTION: cleanup_fonts
481# @USAGE:
482# @DESCRIPTION:
483# Get rid of font directories that only contain generated files
484cleanup_fonts() {
485 local ALLOWED_FILES="encodings.dir fonts.cache-1 fonts.dir fonts.scale"
486 for DIR in ${FONT_DIR}; do
487 unset KEEP_FONTDIR
488 REAL_DIR=${ROOT}usr/share/fonts/${DIR}
489
490 ebegin "Checking ${REAL_DIR} for useless files"
491 pushd ${REAL_DIR} &> /dev/null
492 for FILE in *; do
493 unset MATCH
494 for ALLOWED_FILE in ${ALLOWED_FILES}; do
495 if [[ ${FILE} = ${ALLOWED_FILE} ]]; then
496 # If it's allowed, then move on to the next file
497 MATCH="yes"
498 break
499 fi
500 done
501 # If we found a match in allowed files, move on to the next file
502 if [[ -n ${MATCH} ]]; then
503 continue
504 fi
505 # If we get this far, there wasn't a match in the allowed files
506 KEEP_FONTDIR="yes"
507 # We don't need to check more files if we're already keeping it
508 break
509 done
510 popd &> /dev/null
511 # If there are no files worth keeping, then get rid of the dir
512 if [[ -z "${KEEP_FONTDIR}" ]]; then
513 rm -rf ${REAL_DIR}
514 fi
515 eend 0
516 done
517} 506}
518 507
519# @FUNCTION: setup_fonts 508# @FUNCTION: setup_fonts
520# @USAGE: 509# @USAGE:
521# @DESCRIPTION: 510# @DESCRIPTION:
527 die "${msg}" 516 die "${msg}"
528 fi 517 fi
529 518
530 create_fonts_scale 519 create_fonts_scale
531 create_fonts_dir 520 create_fonts_dir
532 fix_font_permissions
533 create_font_cache 521 create_font_cache
534} 522}
535 523
536# @FUNCTION: remove_font_metadata 524# @FUNCTION: remove_font_metadata
537# @USAGE: 525# @USAGE:
543 for DIR in ${FONT_DIR}; do 531 for DIR in ${FONT_DIR}; do
544 if [[ "${DIR}" != "Speedo" ]] && \ 532 if [[ "${DIR}" != "Speedo" ]] && \
545 [[ "${DIR}" != "CID" ]] ; then 533 [[ "${DIR}" != "CID" ]] ; then
546 # Delete font metadata files 534 # Delete font metadata files
547 # fonts.scale, fonts.dir, fonts.cache-1 535 # fonts.scale, fonts.dir, fonts.cache-1
548 rm -f ${D}/usr/share/fonts/${DIR}/fonts.{scale,dir,cache-1} 536 rm -f "${D}"/usr/share/fonts/${DIR}/fonts.{scale,dir,cache-1}
549 fi 537 fi
550 done 538 done
551} 539}
552 540
553# @FUNCTION: install_driver_hwdata 541# @FUNCTION: install_driver_hwdata
554# @USAGE: 542# @USAGE:
555# @DESCRIPTION: 543# @DESCRIPTION:
556# Installs device-to-driver mappings for system-config-display and 544# Installs device-to-driver mappings for system-config-display and
557# anything else that uses hwdata. 545# anything else that uses hwdata.
558install_driver_hwdata() { 546install_driver_hwdata() {
559 insinto /usr/share/hwdata/videoaliases 547 insinto /usr/share/hwdata/videoaliases
560 for i in "${FILESDIR}"/*.xinf; do 548 for i in "${FILESDIR}"/*.xinf; do
561 # We need this for the case when none exist, 549 # We need this for the case when none exist,
592 # NOTE: There is no way to regenerate Speedo/CID fonts.scale 580 # NOTE: There is no way to regenerate Speedo/CID fonts.scale
593 # <dberkholz@gentoo.org> 2 August 2004 581 # <dberkholz@gentoo.org> 2 August 2004
594 if [[ "${x/encodings}" = "${x}" ]] \ 582 if [[ "${x/encodings}" = "${x}" ]] \
595 && [[ -n "$(find ${x} -iname '*.[pot][ft][abcf]' -print)" ]]; then 583 && [[ -n "$(find ${x} -iname '*.[pot][ft][abcf]' -print)" ]]; then
596 mkfontscale \ 584 mkfontscale \
597 -a ${ROOT}/usr/share/fonts/encodings/encodings.dir \ 585 -a "${ROOT}"/usr/share/fonts/encodings/encodings.dir \
598 -- ${x} 586 -- ${x}
599 fi 587 fi
600 done 588 done
601 eend 0 589 eend 0
602} 590}
612 [[ -z "$(ls ${x}/)" ]] && continue 600 [[ -z "$(ls ${x}/)" ]] && continue
613 [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue 601 [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue
614 602
615 if [[ "${x/encodings}" = "${x}" ]]; then 603 if [[ "${x/encodings}" = "${x}" ]]; then
616 mkfontdir \ 604 mkfontdir \
617 -e ${ROOT}/usr/share/fonts/encodings \ 605 -e "${ROOT}"/usr/share/fonts/encodings \
618 -e ${ROOT}/usr/share/fonts/encodings/large \ 606 -e "${ROOT}"/usr/share/fonts/encodings/large \
619 -- ${x} 607 -- ${x}
620 fi 608 fi
621 done 609 done
622 eend 0 610 eend 0
623} 611}
624 612
625# @FUNCTION: fix_font_permissions
626# @USAGE:
627# @DESCRIPTION:
628# Font files should have 644 permissions. Ensure this is the case.
629fix_font_permissions() {
630 ebegin "Fixing permissions"
631 for DIR in ${FONT_DIR}; do
632 find ${ROOT}/usr/share/fonts/${DIR} -type f -name 'font.*' \
633 -exec chmod 0644 {} \;
634 done
635 eend 0
636}
637
638# @FUNCTION: create_font_cache 613# @FUNCTION: create_font_cache
639# @USAGE: 614# @USAGE:
640# @DESCRIPTION: 615# @DESCRIPTION:
641# Create fonts.cache-1 files, used by the new client-side fonts 616# Create fonts.cache-1 files, used by the new client-side fonts
642# subsystem. 617# subsystem.
643create_font_cache() { 618create_font_cache() {
644 font_pkg_postinst 619 font_pkg_postinst
645} 620}
646
647EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_preinst pkg_postinst pkg_postrm

Legend:
Removed from v.1.99  
changed lines
  Added in v.1.122

  ViewVC Help
Powered by ViewVC 1.1.20