| 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.76 2006/10/11 02:31:47 dberkholz Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/x-modular.eclass,v 1.77 2006/10/30 05:44:33 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. |
| … | |
… | |
| 364 | install_driver_hwdata |
364 | install_driver_hwdata |
| 365 | fi |
365 | fi |
| 366 | } |
366 | } |
| 367 | |
367 | |
| 368 | x-modular_pkg_preinst() { |
368 | x-modular_pkg_preinst() { |
| 369 | if [[ -n "${FONT}" ]]; then |
369 | # We no longer do anything here, but we can't remove it from the API |
| 370 | discover_font_dirs |
370 | : |
| 371 | fi |
|
|
| 372 | } |
371 | } |
| 373 | |
372 | |
| 374 | x-modular_pkg_postinst() { |
373 | x-modular_pkg_postinst() { |
| 375 | if [[ -n "${FONT}" ]]; then |
374 | if [[ -n "${FONT}" ]]; then |
| 376 | setup_fonts |
375 | setup_fonts |
| … | |
… | |
| 417 | eend 0 |
416 | eend 0 |
| 418 | done |
417 | done |
| 419 | } |
418 | } |
| 420 | |
419 | |
| 421 | setup_fonts() { |
420 | setup_fonts() { |
| 422 | if [[ ! -n "${FONT_DIRS}" ]]; then |
421 | if [[ ! -n "${FONT_DIR}" ]]; then |
| 423 | msg="FONT_DIRS is empty. The ebuild should set it to at least one subdir of /usr/share/fonts." |
422 | msg="FONT_DIR is empty. The ebuild should set it to at least one subdir of /usr/share/fonts." |
| 424 | eerror "${msg}" |
423 | eerror "${msg}" |
| 425 | die "${msg}" |
424 | die "${msg}" |
| 426 | fi |
425 | fi |
| 427 | |
426 | |
| 428 | create_fonts_scale |
427 | create_fonts_scale |
| … | |
… | |
| 455 | fi |
454 | fi |
| 456 | done |
455 | done |
| 457 | } |
456 | } |
| 458 | |
457 | |
| 459 | discover_font_dirs() { |
458 | discover_font_dirs() { |
| 460 | pushd ${IMAGE}/usr/share/fonts |
459 | FONT_DIRS="${FONT_DIR}" |
| 461 | FONT_DIRS="$(find . -maxdepth 1 -mindepth 1 -type d)" |
|
|
| 462 | FONT_DIRS="$(echo ${FONT_DIRS} | sed -e 's:./::g')" |
|
|
| 463 | popd |
|
|
| 464 | } |
460 | } |
| 465 | |
461 | |
| 466 | create_fonts_scale() { |
462 | create_fonts_scale() { |
| 467 | ebegin "Creating fonts.scale files" |
463 | ebegin "Creating fonts.scale files" |
| 468 | local x |
464 | local x |
| 469 | for FONT_DIR in ${FONT_DIRS}; do |
465 | for DIR in ${FONT_DIR}; do |
| 470 | x=${ROOT}/usr/share/fonts/${FONT_DIR} |
466 | x=${ROOT}/usr/share/fonts/${DIR} |
| 471 | [[ -z "$(ls ${x}/)" ]] && continue |
467 | [[ -z "$(ls ${x}/)" ]] && continue |
| 472 | [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue |
468 | [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue |
| 473 | |
469 | |
| 474 | # Only generate .scale files if truetype, opentype or type1 |
470 | # Only generate .scale files if truetype, opentype or type1 |
| 475 | # fonts are present ... |
471 | # fonts are present ... |
| … | |
… | |
| 509 | eend 0 |
505 | eend 0 |
| 510 | } |
506 | } |
| 511 | |
507 | |
| 512 | create_fonts_dir() { |
508 | create_fonts_dir() { |
| 513 | ebegin "Generating fonts.dir files" |
509 | ebegin "Generating fonts.dir files" |
| 514 | for FONT_DIR in ${FONT_DIRS}; do |
510 | for DIR in ${FONT_DIR}; do |
| 515 | x=${ROOT}/usr/share/fonts/${FONT_DIR} |
511 | x=${ROOT}/usr/share/fonts/${DIR} |
| 516 | [[ -z "$(ls ${x}/)" ]] && continue |
512 | [[ -z "$(ls ${x}/)" ]] && continue |
| 517 | [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue |
513 | [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue |
| 518 | |
514 | |
| 519 | if [[ "${x/encodings}" = "${x}" ]]; then |
515 | if [[ "${x/encodings}" = "${x}" ]]; then |
| 520 | LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \ |
516 | LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \ |
| … | |
… | |
| 527 | eend 0 |
523 | eend 0 |
| 528 | } |
524 | } |
| 529 | |
525 | |
| 530 | fix_font_permissions() { |
526 | fix_font_permissions() { |
| 531 | ebegin "Fixing permissions" |
527 | ebegin "Fixing permissions" |
| 532 | for FONT_DIR in ${FONT_DIRS}; do |
528 | for DIR in ${FONT_DIR}; do |
| 533 | find ${ROOT}/usr/share/fonts/${FONT_DIR} -type f -name 'font.*' \ |
529 | find ${ROOT}/usr/share/fonts/${DIR} -type f -name 'font.*' \ |
| 534 | -exec chmod 0644 {} \; |
530 | -exec chmod 0644 {} \; |
| 535 | done |
531 | done |
| 536 | eend 0 |
532 | eend 0 |
| 537 | } |
533 | } |
| 538 | |
534 | |