# Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/eclass/x-modular.eclass,v 1.13 2005/09/12 21:44:16 spyderous Exp $ # # Author: Donnie Berkholz # # This eclass is designed to reduce code duplication in the modularized X11 # ebuilds. # # If the ebuild installs fonts, set FONT="yes" at the top and set FONT_DIRS to # the subdirectories within /usr/share/fonts to which it installs fonts. EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_preinst pkg_postinst inherit eutils # Directory prefix to use for everything XDIR="/usr" IUSE="" HOMEPAGE="http://xorg.freedesktop.org/" SRC_URI="http://xorg.freedesktop.org/X11R7.0-RC0/everything/${P}.tar.bz2" LICENSE="X11" SLOT="0" # Set up shared dependencies if [ -n "${SNAPSHOT}" ]; then # FIXME: What's the minimal libtool version supporting arbitrary versioning? DEPEND="${DEPEND} >=sys-devel/autoconf-2.57 >=sys-devel/automake-1.7 >=sys-devel/libtool-1.5 >=sys-devel/m4-1.4" fi # If we're a font package, but not the font.alias one if [[ "${PN/#font}" != "${PN}" ]] && [[ "${PN}" != "font-alias" ]]; then # Activate font code in the rest of the eclass FONT="yes" RDEPEND="${RDEPEND} media-fonts/encodings" PDEPEND="${PDEPEND} media-fonts/font-alias" fi # If we're a driver package if [[ "${PN/#xf86-video}" != "${PN}" ]] || [[ "${PN/#xf86-input}" != "${PN}" ]]; then # Don't build static driver modules DRIVER_OPTIONS="--disable-static" fi DEPEND="${DEPEND} >=dev-util/pkgconfig-0.18 x11-misc/util-macros" RDEPEND="${RDEPEND} ! 2 August 2004 if [ "${x/encodings}" = "${x}" -a \ -n "$(find ${x} -iname '*.tt[cf]' -print)" ]; then if [ -x ${ROOT}/usr/bin/ttmkfdir ]; then LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \ ${ROOT}/usr/bin/ttmkfdir -x 2 \ -e ${ROOT}/usr/share/fonts/encodings/encodings.dir \ -o ${x}/fonts.scale -d ${x} # ttmkfdir fails on some stuff, so try mkfontscale if it does local ttmkfdir_return=$? else # We didn't use ttmkfdir at all local ttmkfdir_return=2 fi if [ ${ttmkfdir_return} -ne 0 ]; then LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \ ${ROOT}/usr/bin/mkfontscale \ -a /usr/share/fonts/encodings/encodings.dir \ -- ${x} fi # Next type1 and opentype (pfa,pfb,otf,otc) elif [ "${x/encodings}" = "${x}" -a \ -n "$(find ${x} -iname '*.[po][ft][abcf]' -print)" ]; then LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \ ${ROOT}/usr/bin/mkfontscale \ -a ${ROOT}/usr/share/fonts/encodings/encodings.dir \ -- ${x} fi done eend 0 } create_fonts_dir() { ebegin "Generating fonts.dir files" for FONT_DIR in ${FONT_DIRS}; do x=${ROOT}/usr/share/fonts/${FONT_DIR} [ -z "$(ls ${x}/)" ] && continue [ "$(ls ${x}/)" = "fonts.cache-1" ] && continue if [ "${x/encodings}" = "${x}" ]; then LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${ROOT}/usr/$(get_libdir)" \ ${ROOT}/usr/bin/mkfontdir \ -e ${ROOT}/usr/share/fonts/encodings \ -e ${ROOT}/usr/share/fonts/encodings/large \ -- ${x} fi done eend 0 } fix_font_permissions() { ebegin "Fixing permissions" for FONT_DIR in ${FONT_DIRS}; do find ${ROOT}/usr/share/fonts/${FONT_DIR} -type f -name 'font.*' \ -exec chmod 0644 {} \; done eend 0 } create_font_cache() { # danarmak found out that fc-cache should be run AFTER all the above # stuff, as otherwise the cache is invalid, and has to be run again # as root anyway if [ -x ${ROOT}/usr/bin/fc-cache ]; then ebegin "Creating FC font cache" HOME="/root" ${ROOT}/usr/bin/fc-cache eend 0 fi }