Apply patch from Ryan Hill to font.eclass to support multiple FONT_S directories...
authorBen de Groot <yngwin@gentoo.org>
Sat, 21 Feb 2015 07:20:22 +0000 (07:20 +0000)
committerBen de Groot <yngwin@gentoo.org>
Sat, 21 Feb 2015 07:20:22 +0000 (07:20 +0000)
eclass/ChangeLog
eclass/font.eclass

index da1ec79cd4b8aadf97dcb17dbcdc1a645d88bc0e..baecc707e283ee0cc84cb8613cce4ab59e269b61 100644 (file)
@@ -1,6 +1,10 @@
 # ChangeLog for eclass directory
 # Copyright 1999-2015 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1545 2015/02/20 17:57:22 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1546 2015/02/21 07:20:22 yngwin Exp $
+
+  21 Feb 2015; Ben de Groot <yngwin@gentoo.org> font.eclass:
+  Apply patch from Ryan Hill to font.eclass to support multiple FONT_S
+  directories (bug #338634)
 
   20 Feb 2015; Michał Górny <mgorny@gentoo.org> distutils-r1.eclass,
   python-r1.eclass, python-single-r1.eclass, python-utils-r1.eclass:
index 1dfa75cffb81024abb68766f058a8e9b1906309a..2854451b9998ca6d16f587d8d81bce7ac735fe92 100644 (file)
@@ -1,6 +1,6 @@
-# Copyright 1999-2013 Gentoo Foundation
+# Copyright 1999-2015 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/font.eclass,v 1.57 2013/07/25 13:13:18 pva Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/font.eclass,v 1.58 2015/02/21 07:20:22 yngwin Exp $
 
 # @ECLASS: font.eclass
 # @MAINTAINER:
@@ -19,10 +19,9 @@ EXPORT_FUNCTIONS pkg_setup src_install pkg_postinst pkg_postrm
 FONT_SUFFIX=${FONT_SUFFIX:-}
 
 # @ECLASS-VARIABLE: FONT_S
-# @DEFAULT_UNSET
 # @REQUIRED
 # @DESCRIPTION:
-# Working directory containing the fonts.
+# Space delimited list of directories containing the fonts.
 FONT_S=${FONT_S:-${S}}
 
 # @ECLASS-VARIABLE: FONT_PN
@@ -61,17 +60,19 @@ RDEPEND=""
 # @DESCRIPTION:
 # Generate Xorg font files (mkfontscale/mkfontdir).
 font_xfont_config() {
+       local dir_name
        if has X ${IUSE//+} && use X ; then
-               ebegin "Creating fonts.scale & fonts.dir"
-               rm -f "${ED}${FONTDIR}"/fonts.{dir,scale}
-               mkfontscale "${ED}${FONTDIR}"
+               dir_name="${1:-${FONT_PN}}"
+               ebegin "Creating fonts.scale & fonts.dir in ${dir_name##*/}"
+               rm -f "${ED}${FONTDIR}/${1//${S}/}"/{fonts.{dir,scale},encodings.dir}
+               mkfontscale "${ED}${FONTDIR}/${1//${S}/}"
                mkfontdir \
                        -e ${EPREFIX}/usr/share/fonts/encodings \
                        -e ${EPREFIX}/usr/share/fonts/encodings/large \
-                       "${ED}${FONTDIR}"
+                       "${ED}${FONTDIR}/${1//${S}/}"
                eend $?
-               if [[ -e ${FONT_S}/fonts.alias ]] ; then
-                       doins "${FONT_S}"/fonts.alias
+               if [[ -e fonts.alias ]] ; then
+                       doins fonts.alias
                fi
        fi
 }
@@ -162,23 +163,33 @@ font_pkg_setup() {
 # @DESCRIPTION:
 # The font src_install function.
 font_src_install() {
-       local suffix commondoc
-
-       pushd "${FONT_S}" > /dev/null
-
-       insinto "${FONTDIR}"
-
-       for suffix in ${FONT_SUFFIX}; do
-               doins *.${suffix}
-       done
-
-       rm -f fonts.{dir,scale} encodings.dir
+       local dir suffix commondoc
+
+       set -- ${FONT_S:-${S}}
+       if [[ $# -gt 1 ]]; then
+               # if we have multiple FONT_S elements then we want to recreate the dir
+               # structure
+               for dir in ${FONT_S}; do
+                       pushd "${dir}" > /dev/null
+                       insinto "${FONTDIR}/${dir//${S}/}"
+                       for suffix in ${FONT_SUFFIX}; do
+                               doins *.${suffix}
+                       done
+                       font_xfont_config "${dir}"
+                       popd > /dev/null
+               done
+       else
+               pushd "${FONT_S}" > /dev/null
+               insinto "${FONTDIR}"
+               for suffix in ${FONT_SUFFIX}; do
+                       doins *.${suffix}
+               done
+               font_xfont_config
+               popd > /dev/null
+       fi
 
-       font_xfont_config
        font_fontconfig
 
-       popd > /dev/null
-
        [[ -n ${DOCS} ]] && { dodoc ${DOCS} || die "docs installation failed" ; }
 
        # install common docs