1 | # Copyright 1999-2010 Gentoo Foundation |
1 | # Copyright 1999-2010 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/xorg-2.eclass,v 1.2 2010/03/17 14:29:20 scarabeus Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/xorg-2.eclass,v 1.6 2010/07/14 08:34:27 scarabeus Exp $ |
4 | # |
4 | # |
5 | # @ECLASS: xorg-2.eclass |
5 | # @ECLASS: xorg-2.eclass |
6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
7 | # x11@gentoo.org |
7 | # x11@gentoo.org |
8 | # @BLURB: Reduces code duplication in the modularized X11 ebuilds. |
8 | # @BLURB: Reduces code duplication in the modularized X11 ebuilds. |
… | |
… | |
98 | DEPEND+=" |
98 | DEPEND+=" |
99 | >=sys-devel/libtool-2.2.6a |
99 | >=sys-devel/libtool-2.2.6a |
100 | sys-devel/m4" |
100 | sys-devel/m4" |
101 | # This MUST BE STABLE |
101 | # This MUST BE STABLE |
102 | if [[ ${PN} != util-macros ]] ; then |
102 | if [[ ${PN} != util-macros ]] ; then |
103 | DEPEND+=" >=x11-misc/util-macros-1.5.0" |
103 | DEPEND+=" >=x11-misc/util-macros-1.8.0" |
104 | # Required even by xorg-server |
104 | # Required even by xorg-server |
105 | [[ ${PN} == "font-util" ]] || DEPEND+=" >=media-fonts/font-util-1.1.1-r1" |
105 | [[ ${PN} == "font-util" ]] || DEPEND+=" >=media-fonts/font-util-1.1.1-r1" |
106 | fi |
106 | fi |
107 | WANT_AUTOCONF="latest" |
107 | WANT_AUTOCONF="latest" |
108 | WANT_AUTOMAKE="latest" |
108 | WANT_AUTOMAKE="latest" |
… | |
… | |
196 | # See epatch() in eutils.eclass for more documentation |
196 | # See epatch() in eutils.eclass for more documentation |
197 | EPATCH_SUFFIX=${EPATCH_SUFFIX:=patch} |
197 | EPATCH_SUFFIX=${EPATCH_SUFFIX:=patch} |
198 | |
198 | |
199 | [[ -d "${EPATCH_SOURCE}" ]] && epatch |
199 | [[ -d "${EPATCH_SOURCE}" ]] && epatch |
200 | base_src_prepare |
200 | base_src_prepare |
201 | epatch_user |
|
|
202 | } |
201 | } |
203 | |
202 | |
204 | # @FUNCTION: xorg-2_reconf_source |
203 | # @FUNCTION: xorg-2_reconf_source |
205 | # @USAGE: |
204 | # @USAGE: |
206 | # @DESCRIPTION: |
205 | # @DESCRIPTION: |
207 | # Run eautoreconf if necessary, and run elibtoolize. |
206 | # Run eautoreconf if necessary, and run elibtoolize. |
208 | xorg-2_reconf_source() { |
207 | xorg-2_reconf_source() { |
209 | case ${CHOST} in |
208 | case ${CHOST} in |
210 | *-interix* | *-aix* | *-winnt*) |
209 | *-interix* | *-aix* | *-winnt*) |
211 | # some hosts need full eautoreconf |
210 | # some hosts need full eautoreconf |
212 | [[ -e "./configure.ac" ]] && eautoreconf || ewarn "Unable to autoreconf the configure script. Things may fail." |
211 | [[ -e "./configure.ac" || -e "./configure.in" ]] && eautoreconf || ewarn "Unable to autoreconf the configure script. Things may fail." |
213 | ;; |
212 | ;; |
214 | *) |
213 | *) |
215 | # elibtoolize required for BSD |
214 | # elibtoolize required for BSD |
216 | [[ ${XORG_EAUTORECONF} != no && -e "./configure.ac" ]] && eautoreconf || elibtoolize |
215 | [[ ${XORG_EAUTORECONF} != no && -e "./configure.ac" ]] && eautoreconf || elibtoolize |
217 | ;; |
216 | ;; |
… | |
… | |
356 | # @DESCRIPTION: |
355 | # @DESCRIPTION: |
357 | # Run X-specific post-removal tasks on the live filesystem. The only |
356 | # Run X-specific post-removal tasks on the live filesystem. The only |
358 | # task right now is some cleanup for font packages. |
357 | # task right now is some cleanup for font packages. |
359 | xorg-2_pkg_postrm() { |
358 | xorg-2_pkg_postrm() { |
360 | if [[ -n ${FONT} ]]; then |
359 | if [[ -n ${FONT} ]]; then |
361 | cleanup_fonts |
|
|
362 | font_pkg_postrm |
360 | font_pkg_postrm |
363 | fi |
361 | fi |
364 | } |
|
|
365 | |
|
|
366 | # @FUNCTION: cleanup_fonts |
|
|
367 | # @USAGE: |
|
|
368 | # @DESCRIPTION: |
|
|
369 | # Get rid of font directories that only contain generated files |
|
|
370 | cleanup_fonts() { |
|
|
371 | local allowed_files="encodings.dir fonts.alias fonts.cache-1 fonts.dir fonts.scale" |
|
|
372 | local real_dir=${EROOT}usr/share/fonts/${FONT_DIR} |
|
|
373 | local fle allowed_file |
|
|
374 | |
|
|
375 | unset KEEP_FONTDIR |
|
|
376 | |
|
|
377 | einfo "Checking ${real_dir} for useless files" |
|
|
378 | pushd ${real_dir} &> /dev/null |
|
|
379 | for fle in *; do |
|
|
380 | unset MATCH |
|
|
381 | for allowed_file in ${allowed_files}; do |
|
|
382 | if [[ ${fle} = ${allowed_file} ]]; then |
|
|
383 | # If it's allowed, then move on to the next file |
|
|
384 | MATCH="yes" |
|
|
385 | break |
|
|
386 | fi |
|
|
387 | done |
|
|
388 | # If we found a match in allowed files, move on to the next file |
|
|
389 | [[ -n ${MATCH} ]] && continue |
|
|
390 | # If we get this far, there wasn't a match in the allowed files |
|
|
391 | KEEP_FONTDIR="yes" |
|
|
392 | # We don't need to check more files if we're already keeping it |
|
|
393 | break |
|
|
394 | done |
|
|
395 | popd &> /dev/null |
|
|
396 | # If there are no files worth keeping, then get rid of the dir |
|
|
397 | [[ -z "${KEEP_FONTDIR}" ]] && rm -rf ${real_dir} |
|
|
398 | } |
362 | } |
399 | |
363 | |
400 | # @FUNCTION: setup_fonts |
364 | # @FUNCTION: setup_fonts |
401 | # @USAGE: |
365 | # @USAGE: |
402 | # @DESCRIPTION: |
366 | # @DESCRIPTION: |