/[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.77 Revision 1.79
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.77 2006/10/30 05:44:33 dberkholz Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/x-modular.eclass,v 1.79 2006/10/30 06:13:48 dberkholz Exp $
4# 4#
5# Author: Donnie Berkholz <spyderous@gentoo.org> 5# Author: Donnie Berkholz <spyderous@gentoo.org>
6# 6#
7# This eclass is designed to reduce code duplication in the modularized X11 7# This eclass is designed to reduce code duplication in the modularized X11
8# ebuilds. 8# ebuilds.
23# 23#
24# IMPORTANT: Both SNAPSHOT and FONT_DIR must be set _before_ the inherit. 24# IMPORTANT: Both SNAPSHOT and FONT_DIR must be set _before_ the inherit.
25# 25#
26# Pretty much everything else should be automatic. 26# Pretty much everything else should be automatic.
27 27
28EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_preinst pkg_postinst pkg_postrm
29
30inherit eutils libtool multilib toolchain-funcs flag-o-matic autotools 28inherit eutils libtool multilib toolchain-funcs flag-o-matic autotools font
31 29
32# Directory prefix to use for everything 30# Directory prefix to use for everything
33XDIR="/usr" 31XDIR="/usr"
34 32
35# Set up default patchset version(s) if necessary 33# Set up default patchset version(s) if necessary
377} 375}
378 376
379x-modular_pkg_postrm() { 377x-modular_pkg_postrm() {
380 if [[ -n "${FONT}" ]]; then 378 if [[ -n "${FONT}" ]]; then
381 cleanup_fonts 379 cleanup_fonts
380 font_pkg_postrm
382 fi 381 fi
383} 382}
384 383
385cleanup_fonts() { 384cleanup_fonts() {
386 local ALLOWED_FILES="encodings.dir fonts.cache-1 fonts.dir fonts.scale" 385 local ALLOWED_FILES="encodings.dir fonts.cache-1 fonts.dir fonts.scale"
468 [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue 467 [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue
469 468
470 # Only generate .scale files if truetype, opentype or type1 469 # Only generate .scale files if truetype, opentype or type1
471 # fonts are present ... 470 # fonts are present ...
472 471
473 # First truetype (ttf,ttc)
474 # NOTE: ttmkfdir does NOT work on type1 fonts (#53753)
475 # Also, there is no way to regenerate Speedo/CID fonts.scale 472 # NOTE: There is no way to regenerate Speedo/CID fonts.scale
476 # <spyderous@gentoo.org> 2 August 2004 473 # <spyderous@gentoo.org> 2 August 2004
477 if [[ "${x/encodings}" = "${x}" ]] \ 474 if [[ "${x/encodings}" = "${x}" ]] \
478 && [[ -n "$(find ${x} -iname '*.tt[cf]' -print)" ]]; then
479 if [[ -x ${ROOT}/usr/bin/ttmkfdir ]]; then
480 LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \
481 ${ROOT}/usr/bin/ttmkfdir -x 2 \
482 -e ${ROOT}/usr/share/fonts/encodings/encodings.dir \
483 -o ${x}/fonts.scale -d ${x}
484 # ttmkfdir fails on some stuff, so try mkfontscale if it does
485 local ttmkfdir_return=$?
486 else
487 # We didn't use ttmkfdir at all
488 local ttmkfdir_return=2
489 fi
490 if [[ ${ttmkfdir_return} -ne 0 ]]; then
491 LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \
492 ${ROOT}/usr/bin/mkfontscale \
493 -a /usr/share/fonts/encodings/encodings.dir \
494 -- ${x}
495 fi
496 # Next type1 and opentype (pfa,pfb,otf,otc)
497 elif [[ "${x/encodings}" = "${x}" ]] \
498 && [[ -n "$(find ${x} -iname '*.[po][ft][abcf]' -print)" ]]; then 475 && [[ -n "$(find ${x} -iname '*.[pot][ft][abcf]' -print)" ]]; then
499 LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \ 476 mkfontscale \
500 ${ROOT}/usr/bin/mkfontscale \
501 -a ${ROOT}/usr/share/fonts/encodings/encodings.dir \ 477 -a ${ROOT}/usr/share/fonts/encodings/encodings.dir \
502 -- ${x} 478 -- ${x}
503 fi 479 fi
504 done 480 done
505 eend 0 481 eend 0
511 x=${ROOT}/usr/share/fonts/${DIR} 487 x=${ROOT}/usr/share/fonts/${DIR}
512 [[ -z "$(ls ${x}/)" ]] && continue 488 [[ -z "$(ls ${x}/)" ]] && continue
513 [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue 489 [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue
514 490
515 if [[ "${x/encodings}" = "${x}" ]]; then 491 if [[ "${x/encodings}" = "${x}" ]]; then
516 LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \ 492 mkfontdir \
517 ${ROOT}/usr/bin/mkfontdir \
518 -e ${ROOT}/usr/share/fonts/encodings \ 493 -e ${ROOT}/usr/share/fonts/encodings \
519 -e ${ROOT}/usr/share/fonts/encodings/large \ 494 -e ${ROOT}/usr/share/fonts/encodings/large \
520 -- ${x} 495 -- ${x}
521 fi 496 fi
522 done 497 done
531 done 506 done
532 eend 0 507 eend 0
533} 508}
534 509
535create_font_cache() { 510create_font_cache() {
536 # danarmak found out that fc-cache should be run AFTER all the above 511 font_pkg_postinst
537 # stuff, as otherwise the cache is invalid, and has to be run again
538 # as root anyway
539 if [[ -x ${ROOT}/usr/bin/fc-cache ]]; then
540 ebegin "Creating FC font cache"
541 HOME="/root" ${ROOT}/usr/bin/fc-cache
542 eend 0
543 fi
544} 512}
513
514EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_preinst pkg_postinst pkg_postrm

Legend:
Removed from v.1.77  
changed lines
  Added in v.1.79

  ViewVC Help
Powered by ViewVC 1.1.20