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

  ViewVC Help
Powered by ViewVC 1.1.20