/[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.100 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.100 2008/05/28 01:48:10 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"
48# @ECLASS-VARIABLE: MODULE 83# @ECLASS-VARIABLE: MODULE
49# @DESCRIPTION: 84# @DESCRIPTION:
50# The subdirectory to download source from. Possible settings are app, 85# The subdirectory to download source from. Possible settings are app,
51# doc, data, util, driver, font, lib, proto, xserver. Set above the 86# doc, data, util, driver, font, lib, proto, xserver. Set above the
52# inherit to override the default autoconfigured module. 87# inherit to override the default autoconfigured module.
53[[ -z ${MODULE} ]] && MODULE="" 88if [[ -z ${MODULE} ]]; then
54case ${CATEGORY} in 89 case ${CATEGORY} in
55 app-doc) MODULE="doc" ;; 90 app-doc) MODULE="doc" ;;
56 media-fonts) MODULE="font" ;; 91 media-fonts) MODULE="font" ;;
57 x11-apps|x11-wm) MODULE="app" ;; 92 x11-apps|x11-wm) MODULE="app" ;;
58 x11-misc|x11-themes) MODULE="util" ;; 93 x11-misc|x11-themes) MODULE="util" ;;
59 x11-drivers) MODULE="driver" ;; 94 x11-drivers) MODULE="driver" ;;
60 x11-base) MODULE="xserver" ;; 95 x11-base) MODULE="xserver" ;;
61 x11-proto) MODULE="proto" ;; 96 x11-proto) MODULE="proto" ;;
62 x11-libs) MODULE="lib" ;; 97 x11-libs) MODULE="lib" ;;
63esac 98 esac
99fi
64 100
65if [[ -n ${GIT_ECLASS} ]]; then 101if [[ -n ${GIT_ECLASS} ]]; then
66 EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/${MODULE}/${PN}" 102 EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/${MODULE}/${PN}"
67else 103else
68 SRC_URI="${SRC_URI} ${BASE_INDIVIDUAL_URI}/${MODULE}/${P}.tar.bz2" 104 SRC_URI="${SRC_URI} ${BASE_INDIVIDUAL_URI}/${MODULE}/${P}.tar.bz2"
69fi 105fi
70 106
71SLOT="0" 107SLOT="0"
72 108
73# 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
74# LICENSE after the inherit. 110# LICENSE after the inherit. Nearly all FreeDesktop-hosted X packages
75LICENSE=${PN} 111# are under the MIT license. (This is what Red Hat does in their rpms)
112LICENSE="MIT"
76 113
77# Set up shared dependencies 114# Set up shared dependencies
78if [[ -n "${SNAPSHOT}" ]]; then 115if [[ -n "${SNAPSHOT}" ]]; then
79# FIXME: What's the minimal libtool version supporting arbitrary versioning? 116# FIXME: What's the minimal libtool version supporting arbitrary versioning?
80 DEPEND="${DEPEND} 117 DEPEND="${DEPEND}
82 >=sys-devel/m4-1.4" 119 >=sys-devel/m4-1.4"
83 WANT_AUTOCONF="latest" 120 WANT_AUTOCONF="latest"
84 WANT_AUTOMAKE="latest" 121 WANT_AUTOMAKE="latest"
85fi 122fi
86 123
87# If we're a font package, but not the font.alias one 124if [[ -n "${FONT}" ]]; then
88FONT_ECLASS=""
89if [[ "${PN/#font-}" != "${PN}" ]] \
90 && [[ "${CATEGORY}" = "media-fonts" ]] \
91 && [[ "${PN}" != "font-alias" ]] \
92 && [[ "${PN}" != "font-util" ]]; then
93 # Activate font code in the rest of the eclass
94 FONT="yes"
95
96 # Whether to inherit the font eclass
97 FONT_ECLASS="font"
98
99 RDEPEND="${RDEPEND} 125 RDEPEND="${RDEPEND}
100 media-fonts/encodings 126 media-fonts/encodings
101 x11-apps/mkfontscale 127 x11-apps/mkfontscale
102 x11-apps/mkfontdir" 128 x11-apps/mkfontdir"
103 PDEPEND="${PDEPEND} 129 PDEPEND="${PDEPEND}
104 media-fonts/font-alias" 130 media-fonts/font-alias"
105 131
106 # Starting with 7.0RC3, we can specify the font directory 132 # Starting with 7.0RC3, we can specify the font directory
107 # 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
108 134
109 # Wrap in `if` so ebuilds can set it too
110 if [[ -z ${FONT_DIR} ]]; then
111# @ECLASS-VARIABLE: FONT_DIR 135# @ECLASS-VARIABLE: FONT_DIR
112# @DESCRIPTION: 136# @DESCRIPTION:
113# 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
114# the subdirectory of /usr/share/fonts/ it should install into, set 138# the subdirectory of /usr/share/fonts/ it should install into, set
115# FONT_DIR to that directory or directories. Set before inheriting this 139# FONT_DIR to that directory or directories. Set before inheriting this
116# eclass. 140# eclass.
117 FONT_DIR=${PN##*-} 141 : ${FONT_DIR:=${PN##*-}}
118
119 fi
120 142
121 # Fix case of font directories 143 # Fix case of font directories
122 FONT_DIR=${FONT_DIR/ttf/TTF} 144 FONT_DIR=${FONT_DIR/ttf/TTF}
123 FONT_DIR=${FONT_DIR/otf/OTF} 145 FONT_DIR=${FONT_DIR/otf/OTF}
124 FONT_DIR=${FONT_DIR/type1/Type1} 146 FONT_DIR=${FONT_DIR/type1/Type1}
125 FONT_DIR=${FONT_DIR/speedo/Speedo} 147 FONT_DIR=${FONT_DIR/speedo/Speedo}
126 148
127 # Set up configure option 149 # Set up configure options, wrapped so ebuilds can override if need be
150 if [[ -z ${FONT_OPTIONS} ]]; then
128 FONT_OPTIONS="--with-fontdir=\"/usr/share/fonts/${FONT_DIR}\"" 151 FONT_OPTIONS="--with-fontdir=\"/usr/share/fonts/${FONT_DIR}\""
152 fi
129 153
130 if [[ -n "${FONT}" ]]; then 154 if [[ -n "${FONT}" ]]; then
131 if [[ ${PN##*-} = misc ]] || [[ ${PN##*-} = 75dpi ]] || [[ ${PN##*-} = 100dpi ]] || [[ ${PN##*-} = cyrillic ]]; then 155 if [[ ${PN##*-} = misc ]] || [[ ${PN##*-} = 75dpi ]] || [[ ${PN##*-} = 100dpi ]] || [[ ${PN##*-} = cyrillic ]]; then
132 IUSE="${IUSE} nls" 156 IUSE="${IUSE} nls"
133 fi 157 fi
157DEPEND="${DEPEND} 181DEPEND="${DEPEND}
158 >=dev-util/pkgconfig-0.18" 182 >=dev-util/pkgconfig-0.18"
159 183
160if [[ "${PN/util-macros}" = "${PN}" ]]; then 184if [[ "${PN/util-macros}" = "${PN}" ]]; then
161 DEPEND="${DEPEND} 185 DEPEND="${DEPEND}
162 >=x11-misc/util-macros-0.99.2 186 >=x11-misc/util-macros-1.3.0"
163 >=sys-devel/binutils-2.16.1-r3"
164fi 187fi
165 188
166RDEPEND="${RDEPEND} 189RDEPEND="${RDEPEND}
167 !<=x11-base/xorg-x11-6.9" 190 !<=x11-base/xorg-x11-6.9"
168# Provides virtual/x11 for temporary use until packages are ported 191# Provides virtual/x11 for temporary use until packages are ported
169# x11-base/x11-env" 192# x11-base/x11-env"
170
171inherit eutils libtool multilib toolchain-funcs flag-o-matic autotools \
172 ${FONT_ECLASS} ${GIT_ECLASS}
173 193
174# @FUNCTION: x-modular_specs_check 194# @FUNCTION: x-modular_specs_check
175# @USAGE: 195# @USAGE:
176# @DESCRIPTION: 196# @DESCRIPTION:
177# Make any necessary changes related to gcc specs (generally hardened) 197# Make any necessary changes related to gcc specs (generally hardened)
188# @DESCRIPTION: 208# @DESCRIPTION:
189# 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
190x-modular_dri_check() { 210x-modular_dri_check() {
191 # (#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
192 # 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)
193 if [[ -n "${DRIVER}" ]]; then 215 if [[ -n "${DRIVER}" ]]; then
194 if has dri ${IUSE} && use dri; then 216 if has dri ${IUSE} && use dri; then
195 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
196 if ! built_with_use x11-base/xorg-server dri; then 223 if ! built_with_use x11-base/xorg-server dri; then
197 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
198 fi 226 fi
199 fi 227 fi
200 fi 228 fi
201} 229}
202 230
225 if [[ -n ${GIT_ECLASS} ]]; then 253 if [[ -n ${GIT_ECLASS} ]]; then
226 git_src_unpack 254 git_src_unpack
227 else 255 else
228 unpack ${A} 256 unpack ${A}
229 fi 257 fi
230 cd ${S} 258 cd "${S}"
231 259
232 if [[ -n ${FONT_OPTIONS} ]]; then 260 if [[ -n ${FONT_OPTIONS} ]]; then
233 einfo "Detected font directory: ${FONT_DIR}" 261 einfo "Detected font directory: ${FONT_DIR}"
234 fi 262 fi
235} 263}
285 # Joshua Baergen - October 23, 2005 313 # Joshua Baergen - October 23, 2005
286 # Fix shared lib issues on MIPS, FBSD, etc etc 314 # Fix shared lib issues on MIPS, FBSD, etc etc
287 elibtoolize 315 elibtoolize
288} 316}
289 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
290# @FUNCTION: x-modular_src_unpack 329# @FUNCTION: x-modular_src_unpack
291# @USAGE: 330# @USAGE:
292# @DESCRIPTION: 331# @DESCRIPTION:
293# Unpack a package, performing all X-related tasks. 332# Unpack a package, performing all X-related tasks.
294x-modular_src_unpack() { 333x-modular_src_unpack() {
295 x-modular_specs_check 334 x-modular_specs_check
296 x-modular_server_supports_drivers_check 335 x-modular_server_supports_drivers_check
297 x-modular_dri_check 336 x-modular_dri_check
298 x-modular_unpack_source 337 x-modular_unpack_source
299 x-modular_patch_source 338 has src_prepare ${EXPORTED_FUNCTIONS} || x-modular_src_prepare
300 x-modular_reconf_source
301} 339}
302 340
303# @FUNCTION: x-modular_font_configure 341# @FUNCTION: x-modular_font_configure
304# @USAGE: 342# @USAGE:
305# @DESCRIPTION: 343# @DESCRIPTION:
306# If a font package, perform any necessary configuration steps 344# If a font package, perform any necessary configuration steps
307x-modular_font_configure() { 345x-modular_font_configure() {
308 if [[ -n "${FONT}" ]]; then 346 if [[ -n "${FONT}" ]]; then
309 # Might be worth adding an option to configure your desired font 347 # Might be worth adding an option to configure your desired font
310 # 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?
311 if ! use nls; then 349 if has nls ${IUSE//+} && ! use nls; then
312 FONT_OPTIONS="${FONT_OPTIONS} 350 FONT_OPTIONS="${FONT_OPTIONS}
313 --disable-iso8859-2 351 --disable-iso8859-2
314 --disable-iso8859-3 352 --disable-iso8859-3
315 --disable-iso8859-4 353 --disable-iso8859-4
316 --disable-iso8859-5 354 --disable-iso8859-5
352 x-modular_font_configure 390 x-modular_font_configure
353 x-modular_debug_setup 391 x-modular_debug_setup
354 392
355# @VARIABLE: CONFIGURE_OPTIONS 393# @VARIABLE: CONFIGURE_OPTIONS
356# @DESCRIPTION: 394# @DESCRIPTION:
357# Any options to pass to configure 395# Any extra options to pass to configure
358[[ -n ${CONFIGURE_OPTIONS} ]]
359 396
360 # If prefix isn't set here, .pc files cause problems 397 # If prefix isn't set here, .pc files cause problems
361 if [[ -x ${ECONF_SOURCE:-.}/configure ]]; then 398 if [[ -x ${ECONF_SOURCE:-.}/configure ]]; then
362 econf --prefix=${XDIR} \ 399 econf --prefix=${XDIR} \
363 --datadir=${XDIR}/share \ 400 --datadir=${XDIR}/share \
373# Run make. 410# Run make.
374x-modular_src_make() { 411x-modular_src_make() {
375 emake || die "emake failed" 412 emake || die "emake failed"
376} 413}
377 414
378# @FUNCTION: x-modular_src_configure 415# @FUNCTION: x-modular_src_compile
379# @USAGE: 416# @USAGE:
380# @DESCRIPTION: 417# @DESCRIPTION:
381# Compile a package, performing all X-related tasks. 418# Compile a package, performing all X-related tasks.
382x-modular_src_compile() { 419x-modular_src_compile() {
383 x-modular_src_configure 420 has src_configure ${EXPORTED_FUNCTIONS} || x-modular_src_configure
384 x-modular_src_make 421 x-modular_src_make
385} 422}
386 423
387# @FUNCTION: x-modular_src_install 424# @FUNCTION: x-modular_src_install
388# @USAGE: 425# @USAGE:
389# @DESCRIPTION: 426# @DESCRIPTION:
390# Install a built package to ${D}, performing any necessary steps. 427# Install a built package to ${D}, performing any necessary steps.
391# Creates a ChangeLog from git if using live ebuilds. 428# Creates a ChangeLog from git if using live ebuilds.
392x-modular_src_install() { 429x-modular_src_install() {
393 # Install everything to ${XDIR} 430 # Install everything to ${XDIR}
431 if [[ ${CATEGORY} = x11-proto ]]; then
394 make \ 432 make \
433 ${PN/proto/}docdir=/usr/share/doc/${PF} \
395 DESTDIR="${D}" \ 434 DESTDIR="${D}" \
396 install 435 install \
436 || die
437 else
438 make \
439 docdir=/usr/share/doc/${PF} \
440 DESTDIR="${D}" \
441 install \
442 || die
443 fi
397# Shouldn't be necessary in XDIR=/usr 444# Shouldn't be necessary in XDIR=/usr
398# einstall forces datadir, so we need to re-force it 445# einstall forces datadir, so we need to re-force it
399# datadir=${XDIR}/share \ 446# datadir=${XDIR}/share \
400# mandir=${XDIR}/share/man \ 447# mandir=${XDIR}/share/man \
401 448
404 git log ${GIT_TREE} > "${S}"/ChangeLog 451 git log ${GIT_TREE} > "${S}"/ChangeLog
405 popd 452 popd
406 fi 453 fi
407 454
408 if [[ -e ${S}/ChangeLog ]]; then 455 if [[ -e ${S}/ChangeLog ]]; then
409 dodoc ${S}/ChangeLog 456 dodoc "${S}"/ChangeLog
410 fi 457 fi
411# @VARIABLE: DOCS 458# @VARIABLE: DOCS
412# @DESCRIPTION: 459# @DESCRIPTION:
413# Any documentation to install 460# Any documentation to install via dodoc
414 [[ -n ${DOCS} ]] && dodoc ${DOCS} 461 [[ -n ${DOCS} ]] && dodoc ${DOCS}
415
416 # Make sure docs get compressed
417 prepalldocs
418 462
419 # Don't install libtool archives for server modules 463 # Don't install libtool archives for server modules
420 if [[ -e ${D}/usr/$(get_libdir)/xorg/modules ]]; then 464 if [[ -e ${D}/usr/$(get_libdir)/xorg/modules ]]; then
421 find ${D}/usr/$(get_libdir)/xorg/modules -name '*.la' \ 465 find "${D}"/usr/$(get_libdir)/xorg/modules -name '*.la' \
422 | xargs rm -f 466 | xargs rm -f
423 fi 467 fi
424 468
425 if [[ -n "${FONT}" ]]; then 469 if [[ -n "${FONT}" ]]; then
426 remove_font_metadata 470 remove_font_metadata
456# @DESCRIPTION: 500# @DESCRIPTION:
457# 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
458# task right now is some cleanup for font packages. 502# task right now is some cleanup for font packages.
459x-modular_pkg_postrm() { 503x-modular_pkg_postrm() {
460 if [[ -n "${FONT}" ]]; then 504 if [[ -n "${FONT}" ]]; then
461 cleanup_fonts
462 font_pkg_postrm 505 font_pkg_postrm
463 fi 506 fi
464}
465
466# @FUNCTION: cleanup_fonts
467# @USAGE:
468# @DESCRIPTION:
469# Get rid of font directories that only contain generated files
470cleanup_fonts() {
471 local ALLOWED_FILES="encodings.dir fonts.cache-1 fonts.dir fonts.scale"
472 for DIR in ${FONT_DIR}; do
473 unset KEEP_FONTDIR
474 REAL_DIR=${ROOT}usr/share/fonts/${DIR}
475
476 ebegin "Checking ${REAL_DIR} for useless files"
477 pushd ${REAL_DIR} &> /dev/null
478 for FILE in *; do
479 unset MATCH
480 for ALLOWED_FILE in ${ALLOWED_FILES}; do
481 if [[ ${FILE} = ${ALLOWED_FILE} ]]; then
482 # If it's allowed, then move on to the next file
483 MATCH="yes"
484 break
485 fi
486 done
487 # If we found a match in allowed files, move on to the next file
488 if [[ -n ${MATCH} ]]; then
489 continue
490 fi
491 # If we get this far, there wasn't a match in the allowed files
492 KEEP_FONTDIR="yes"
493 # We don't need to check more files if we're already keeping it
494 break
495 done
496 popd &> /dev/null
497 # If there are no files worth keeping, then get rid of the dir
498 if [[ -z "${KEEP_FONTDIR}" ]]; then
499 rm -rf ${REAL_DIR}
500 fi
501 eend 0
502 done
503} 507}
504 508
505# @FUNCTION: setup_fonts 509# @FUNCTION: setup_fonts
506# @USAGE: 510# @USAGE:
507# @DESCRIPTION: 511# @DESCRIPTION:
513 die "${msg}" 517 die "${msg}"
514 fi 518 fi
515 519
516 create_fonts_scale 520 create_fonts_scale
517 create_fonts_dir 521 create_fonts_dir
518 fix_font_permissions
519 create_font_cache 522 create_font_cache
520} 523}
521 524
522# @FUNCTION: remove_font_metadata 525# @FUNCTION: remove_font_metadata
523# @USAGE: 526# @USAGE:
529 for DIR in ${FONT_DIR}; do 532 for DIR in ${FONT_DIR}; do
530 if [[ "${DIR}" != "Speedo" ]] && \ 533 if [[ "${DIR}" != "Speedo" ]] && \
531 [[ "${DIR}" != "CID" ]] ; then 534 [[ "${DIR}" != "CID" ]] ; then
532 # Delete font metadata files 535 # Delete font metadata files
533 # fonts.scale, fonts.dir, fonts.cache-1 536 # fonts.scale, fonts.dir, fonts.cache-1
534 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}
535 fi 538 fi
536 done 539 done
537} 540}
538 541
539# @FUNCTION: install_driver_hwdata 542# @FUNCTION: install_driver_hwdata
540# @USAGE: 543# @USAGE:
541# @DESCRIPTION: 544# @DESCRIPTION:
542# Installs device-to-driver mappings for system-config-display and 545# Installs device-to-driver mappings for system-config-display and
543# anything else that uses hwdata. 546# anything else that uses hwdata.
544install_driver_hwdata() { 547install_driver_hwdata() {
545 insinto /usr/share/hwdata/videoaliases 548 insinto /usr/share/hwdata/videoaliases
546 for i in "${FILESDIR}"/*.xinf; do 549 for i in "${FILESDIR}"/*.xinf; do
547 # We need this for the case when none exist, 550 # We need this for the case when none exist,
578 # NOTE: There is no way to regenerate Speedo/CID fonts.scale 581 # NOTE: There is no way to regenerate Speedo/CID fonts.scale
579 # <dberkholz@gentoo.org> 2 August 2004 582 # <dberkholz@gentoo.org> 2 August 2004
580 if [[ "${x/encodings}" = "${x}" ]] \ 583 if [[ "${x/encodings}" = "${x}" ]] \
581 && [[ -n "$(find ${x} -iname '*.[pot][ft][abcf]' -print)" ]]; then 584 && [[ -n "$(find ${x} -iname '*.[pot][ft][abcf]' -print)" ]]; then
582 mkfontscale \ 585 mkfontscale \
583 -a ${ROOT}/usr/share/fonts/encodings/encodings.dir \ 586 -a "${ROOT}"/usr/share/fonts/encodings/encodings.dir \
584 -- ${x} 587 -- ${x}
585 fi 588 fi
586 done 589 done
587 eend 0 590 eend 0
588} 591}
598 [[ -z "$(ls ${x}/)" ]] && continue 601 [[ -z "$(ls ${x}/)" ]] && continue
599 [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue 602 [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue
600 603
601 if [[ "${x/encodings}" = "${x}" ]]; then 604 if [[ "${x/encodings}" = "${x}" ]]; then
602 mkfontdir \ 605 mkfontdir \
603 -e ${ROOT}/usr/share/fonts/encodings \ 606 -e "${ROOT}"/usr/share/fonts/encodings \
604 -e ${ROOT}/usr/share/fonts/encodings/large \ 607 -e "${ROOT}"/usr/share/fonts/encodings/large \
605 -- ${x} 608 -- ${x}
606 fi 609 fi
607 done 610 done
608 eend 0 611 eend 0
609} 612}
610 613
611# @FUNCTION: fix_font_permissions
612# @USAGE:
613# @DESCRIPTION:
614# Font files should have 644 permissions. Ensure this is the case.
615fix_font_permissions() {
616 ebegin "Fixing permissions"
617 for DIR in ${FONT_DIR}; do
618 find ${ROOT}/usr/share/fonts/${DIR} -type f -name 'font.*' \
619 -exec chmod 0644 {} \;
620 done
621 eend 0
622}
623
624# @FUNCTION: create_font_cache 614# @FUNCTION: create_font_cache
625# @USAGE: 615# @USAGE:
626# @DESCRIPTION: 616# @DESCRIPTION:
627# 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
628# subsystem. 618# subsystem.
629create_font_cache() { 619create_font_cache() {
630 font_pkg_postinst 620 font_pkg_postinst
631} 621}
632
633EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_preinst pkg_postinst pkg_postrm

Legend:
Removed from v.1.100  
changed lines
  Added in v.1.123

  ViewVC Help
Powered by ViewVC 1.1.20