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.74 2006/08/28 16:07:30 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. |
… | |
… | |
166 | >=x11-misc/util-macros-0.99.2 |
166 | >=x11-misc/util-macros-0.99.2 |
167 | >=sys-devel/binutils-2.16.1-r3" |
167 | >=sys-devel/binutils-2.16.1-r3" |
168 | fi |
168 | fi |
169 | |
169 | |
170 | RDEPEND="${RDEPEND} |
170 | RDEPEND="${RDEPEND} |
171 | >=sys-apps/man-1.6b-r2 |
171 | || ( >=sys-apps/man-1.6b-r2 >=sys-apps/man-db-2.4.3-r1 ) |
172 | !<=x11-base/xorg-x11-6.9" |
172 | !<=x11-base/xorg-x11-6.9" |
173 | # Provides virtual/x11 for temporary use until packages are ported |
173 | # Provides virtual/x11 for temporary use until packages are ported |
174 | # x11-base/x11-env" |
174 | # x11-base/x11-env" |
175 | |
175 | |
176 | x-modular_specs_check() { |
176 | x-modular_specs_check() { |
… | |
… | |
357 | # Don't install overlapping fonts.* files |
357 | # Don't install overlapping fonts.* files |
358 | # Generate them instead when possible |
358 | # Generate them instead when possible |
359 | if [[ -n "${FONT}" ]]; then |
359 | if [[ -n "${FONT}" ]]; then |
360 | remove_font_metadata |
360 | remove_font_metadata |
361 | fi |
361 | fi |
|
|
362 | |
|
|
363 | if [[ -n "${DRIVER}" ]]; then |
|
|
364 | install_driver_hwdata |
|
|
365 | fi |
362 | } |
366 | } |
363 | |
367 | |
364 | x-modular_pkg_preinst() { |
368 | x-modular_pkg_preinst() { |
365 | if [[ -n "${FONT}" ]]; then |
369 | # We no longer do anything here, but we can't remove it from the API |
366 | discover_font_dirs |
370 | : |
367 | fi |
|
|
368 | } |
371 | } |
369 | |
372 | |
370 | x-modular_pkg_postinst() { |
373 | x-modular_pkg_postinst() { |
371 | if [[ -n "${FONT}" ]]; then |
374 | if [[ -n "${FONT}" ]]; then |
372 | setup_fonts |
375 | setup_fonts |
… | |
… | |
413 | eend 0 |
416 | eend 0 |
414 | done |
417 | done |
415 | } |
418 | } |
416 | |
419 | |
417 | setup_fonts() { |
420 | setup_fonts() { |
418 | if [[ ! -n "${FONT_DIRS}" ]]; then |
421 | if [[ ! -n "${FONT_DIR}" ]]; then |
419 | 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." |
420 | eerror "${msg}" |
423 | eerror "${msg}" |
421 | die "${msg}" |
424 | die "${msg}" |
422 | fi |
425 | fi |
423 | |
426 | |
424 | create_fonts_scale |
427 | create_fonts_scale |
… | |
… | |
437 | rm -f ${D}/usr/share/fonts/${DIR}/fonts.{scale,dir,cache-1} |
440 | rm -f ${D}/usr/share/fonts/${DIR}/fonts.{scale,dir,cache-1} |
438 | fi |
441 | fi |
439 | done |
442 | done |
440 | } |
443 | } |
441 | |
444 | |
|
|
445 | # Installs device-to-driver mappings for system-config-display |
|
|
446 | # and anything else that uses hwdata |
|
|
447 | install_driver_hwdata() { |
|
|
448 | insinto /usr/share/hwdata/videoaliases |
|
|
449 | for i in "${FILESDIR}"/*.xinf; do |
|
|
450 | # We need this for the case when none exist, |
|
|
451 | # so *.xinf doesn't expand |
|
|
452 | if [[ -e $i ]]; then |
|
|
453 | doins $i |
|
|
454 | fi |
|
|
455 | done |
|
|
456 | } |
|
|
457 | |
442 | discover_font_dirs() { |
458 | discover_font_dirs() { |
443 | pushd ${IMAGE}/usr/share/fonts |
459 | FONT_DIRS="${FONT_DIR}" |
444 | FONT_DIRS="$(find . -maxdepth 1 -mindepth 1 -type d)" |
|
|
445 | FONT_DIRS="$(echo ${FONT_DIRS} | sed -e 's:./::g')" |
|
|
446 | popd |
|
|
447 | } |
460 | } |
448 | |
461 | |
449 | create_fonts_scale() { |
462 | create_fonts_scale() { |
450 | ebegin "Creating fonts.scale files" |
463 | ebegin "Creating fonts.scale files" |
451 | local x |
464 | local x |
452 | for FONT_DIR in ${FONT_DIRS}; do |
465 | for DIR in ${FONT_DIR}; do |
453 | x=${ROOT}/usr/share/fonts/${FONT_DIR} |
466 | x=${ROOT}/usr/share/fonts/${DIR} |
454 | [[ -z "$(ls ${x}/)" ]] && continue |
467 | [[ -z "$(ls ${x}/)" ]] && continue |
455 | [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue |
468 | [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue |
456 | |
469 | |
457 | # Only generate .scale files if truetype, opentype or type1 |
470 | # Only generate .scale files if truetype, opentype or type1 |
458 | # fonts are present ... |
471 | # fonts are present ... |
… | |
… | |
492 | eend 0 |
505 | eend 0 |
493 | } |
506 | } |
494 | |
507 | |
495 | create_fonts_dir() { |
508 | create_fonts_dir() { |
496 | ebegin "Generating fonts.dir files" |
509 | ebegin "Generating fonts.dir files" |
497 | for FONT_DIR in ${FONT_DIRS}; do |
510 | for DIR in ${FONT_DIR}; do |
498 | x=${ROOT}/usr/share/fonts/${FONT_DIR} |
511 | x=${ROOT}/usr/share/fonts/${DIR} |
499 | [[ -z "$(ls ${x}/)" ]] && continue |
512 | [[ -z "$(ls ${x}/)" ]] && continue |
500 | [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue |
513 | [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue |
501 | |
514 | |
502 | if [[ "${x/encodings}" = "${x}" ]]; then |
515 | if [[ "${x/encodings}" = "${x}" ]]; then |
503 | LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \ |
516 | LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \ |
… | |
… | |
510 | eend 0 |
523 | eend 0 |
511 | } |
524 | } |
512 | |
525 | |
513 | fix_font_permissions() { |
526 | fix_font_permissions() { |
514 | ebegin "Fixing permissions" |
527 | ebegin "Fixing permissions" |
515 | for FONT_DIR in ${FONT_DIRS}; do |
528 | for DIR in ${FONT_DIR}; do |
516 | find ${ROOT}/usr/share/fonts/${FONT_DIR} -type f -name 'font.*' \ |
529 | find ${ROOT}/usr/share/fonts/${DIR} -type f -name 'font.*' \ |
517 | -exec chmod 0644 {} \; |
530 | -exec chmod 0644 {} \; |
518 | done |
531 | done |
519 | eend 0 |
532 | eend 0 |
520 | } |
533 | } |
521 | |
534 | |