/[gentoo-x86]/eclass/x-modular.eclass
Gentoo

Diff of /eclass/x-modular.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.109 Revision 1.122
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.109 2009/05/14 12:40:55 remi Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/x-modular.eclass,v 1.122 2011/10/04 21:23:46 chithanh Exp $
4#
5# @DEPRECATED
6# This eclass has been superseded by xorg-2
7# Please modify your ebuilds to use that instead
4# 8#
5# @ECLASS: x-modular.eclass 9# @ECLASS: x-modular.eclass
6# @MAINTAINER: 10# @MAINTAINER:
7# Donnie Berkholz <dberkholz@gentoo.org>, x11@gentoo.org 11# Donnie Berkholz <dberkholz@gentoo.org>, x11@gentoo.org
8# @BLURB: Reduces code duplication in the modularized X11 ebuilds. 12# @BLURB: Reduces code duplication in the modularized X11 ebuilds.
65XDIR="/usr" 69XDIR="/usr"
66 70
67IUSE="" 71IUSE=""
68HOMEPAGE="http://xorg.freedesktop.org/" 72HOMEPAGE="http://xorg.freedesktop.org/"
69 73
70if [[ -z ${SNAPSHOT} ]]; then
71# @ECLASS-VARIABLE: SNAPSHOT 74# @ECLASS-VARIABLE: SNAPSHOT
72# @DESCRIPTION: 75# @DESCRIPTION:
73# If set to 'yes' and configure.ac exists, eautoreconf will run. Set 76# If set to 'yes' and configure.ac exists, eautoreconf will run. Set
74# before inheriting this eclass. 77# before inheriting this eclass.
75 SNAPSHOT="no" 78: ${SNAPSHOT:=no}
76fi
77 79
78# Set up SRC_URI for individual modular releases 80# Set up SRC_URI for individual modular releases
79BASE_INDIVIDUAL_URI="http://xorg.freedesktop.org/releases/individual" 81BASE_INDIVIDUAL_URI="http://xorg.freedesktop.org/releases/individual"
80# @ECLASS-VARIABLE: MODULE 82# @ECLASS-VARIABLE: MODULE
81# @DESCRIPTION: 83# @DESCRIPTION:
82# The subdirectory to download source from. Possible settings are app, 84# The subdirectory to download source from. Possible settings are app,
83# doc, data, util, driver, font, lib, proto, xserver. Set above the 85# doc, data, util, driver, font, lib, proto, xserver. Set above the
84# inherit to override the default autoconfigured module. 86# inherit to override the default autoconfigured module.
85if [[ -z ${MODULE} ]]; then 87if [[ -z ${MODULE} ]]; then
86 MODULE=""
87 case ${CATEGORY} in 88 case ${CATEGORY} in
88 app-doc) MODULE="doc" ;; 89 app-doc) MODULE="doc" ;;
89 media-fonts) MODULE="font" ;; 90 media-fonts) MODULE="font" ;;
90 x11-apps|x11-wm) MODULE="app" ;; 91 x11-apps|x11-wm) MODULE="app" ;;
91 x11-misc|x11-themes) MODULE="util" ;; 92 x11-misc|x11-themes) MODULE="util" ;;
103fi 104fi
104 105
105SLOT="0" 106SLOT="0"
106 107
107# Set the license for the package. This can be overridden by setting 108# Set the license for the package. This can be overridden by setting
108# LICENSE after the inherit. 109# LICENSE after the inherit. Nearly all FreeDesktop-hosted X packages
109LICENSE=${PN} 110# are under the MIT license. (This is what Red Hat does in their rpms)
111LICENSE="MIT"
110 112
111# Set up shared dependencies 113# Set up shared dependencies
112if [[ -n "${SNAPSHOT}" ]]; then 114if [[ -n "${SNAPSHOT}" ]]; then
113# FIXME: What's the minimal libtool version supporting arbitrary versioning? 115# FIXME: What's the minimal libtool version supporting arbitrary versioning?
114 DEPEND="${DEPEND} 116 DEPEND="${DEPEND}
127 media-fonts/font-alias" 129 media-fonts/font-alias"
128 130
129 # Starting with 7.0RC3, we can specify the font directory 131 # Starting with 7.0RC3, we can specify the font directory
130 # But oddly, we can't do the same for encodings or font-alias 132 # But oddly, we can't do the same for encodings or font-alias
131 133
132 # Wrap in `if` so ebuilds can set it too
133 if [[ -z ${FONT_DIR} ]]; then
134# @ECLASS-VARIABLE: FONT_DIR 134# @ECLASS-VARIABLE: FONT_DIR
135# @DESCRIPTION: 135# @DESCRIPTION:
136# If you're creating a font package and the suffix of PN is not equal to 136# If you're creating a font package and the suffix of PN is not equal to
137# the subdirectory of /usr/share/fonts/ it should install into, set 137# the subdirectory of /usr/share/fonts/ it should install into, set
138# FONT_DIR to that directory or directories. Set before inheriting this 138# FONT_DIR to that directory or directories. Set before inheriting this
139# eclass. 139# eclass.
140 FONT_DIR=${PN##*-} 140 : ${FONT_DIR:=${PN##*-}}
141
142 fi
143 141
144 # Fix case of font directories 142 # Fix case of font directories
145 FONT_DIR=${FONT_DIR/ttf/TTF} 143 FONT_DIR=${FONT_DIR/ttf/TTF}
146 FONT_DIR=${FONT_DIR/otf/OTF} 144 FONT_DIR=${FONT_DIR/otf/OTF}
147 FONT_DIR=${FONT_DIR/type1/Type1} 145 FONT_DIR=${FONT_DIR/type1/Type1}
148 FONT_DIR=${FONT_DIR/speedo/Speedo} 146 FONT_DIR=${FONT_DIR/speedo/Speedo}
149 147
150 # Set up configure option 148 # Set up configure options, wrapped so ebuilds can override if need be
149 if [[ -z ${FONT_OPTIONS} ]]; then
151 FONT_OPTIONS="--with-fontdir=\"/usr/share/fonts/${FONT_DIR}\"" 150 FONT_OPTIONS="--with-fontdir=\"/usr/share/fonts/${FONT_DIR}\""
151 fi
152 152
153 if [[ -n "${FONT}" ]]; then 153 if [[ -n "${FONT}" ]]; then
154 if [[ ${PN##*-} = misc ]] || [[ ${PN##*-} = 75dpi ]] || [[ ${PN##*-} = 100dpi ]] || [[ ${PN##*-} = cyrillic ]]; then 154 if [[ ${PN##*-} = misc ]] || [[ ${PN##*-} = 75dpi ]] || [[ ${PN##*-} = 100dpi ]] || [[ ${PN##*-} = cyrillic ]]; then
155 IUSE="${IUSE} nls" 155 IUSE="${IUSE} nls"
156 fi 156 fi
180DEPEND="${DEPEND} 180DEPEND="${DEPEND}
181 >=dev-util/pkgconfig-0.18" 181 >=dev-util/pkgconfig-0.18"
182 182
183if [[ "${PN/util-macros}" = "${PN}" ]]; then 183if [[ "${PN/util-macros}" = "${PN}" ]]; then
184 DEPEND="${DEPEND} 184 DEPEND="${DEPEND}
185 >=x11-misc/util-macros-0.99.2 185 >=x11-misc/util-macros-1.3.0"
186 >=sys-devel/binutils-2.16.1-r3"
187fi 186fi
188 187
189RDEPEND="${RDEPEND} 188RDEPEND="${RDEPEND}
190 !<=x11-base/xorg-x11-6.9" 189 !<=x11-base/xorg-x11-6.9"
191# Provides virtual/x11 for temporary use until packages are ported 190# Provides virtual/x11 for temporary use until packages are ported
344# If a font package, perform any necessary configuration steps 343# If a font package, perform any necessary configuration steps
345x-modular_font_configure() { 344x-modular_font_configure() {
346 if [[ -n "${FONT}" ]]; then 345 if [[ -n "${FONT}" ]]; then
347 # Might be worth adding an option to configure your desired font 346 # Might be worth adding an option to configure your desired font
348 # and exclude all others. Also, should this USE be nls or minimal? 347 # and exclude all others. Also, should this USE be nls or minimal?
349 if ! use nls; then 348 if has nls ${IUSE//+} && ! use nls; then
350 FONT_OPTIONS="${FONT_OPTIONS} 349 FONT_OPTIONS="${FONT_OPTIONS}
351 --disable-iso8859-2 350 --disable-iso8859-2
352 --disable-iso8859-3 351 --disable-iso8859-3
353 --disable-iso8859-4 352 --disable-iso8859-4
354 --disable-iso8859-5 353 --disable-iso8859-5
390 x-modular_font_configure 389 x-modular_font_configure
391 x-modular_debug_setup 390 x-modular_debug_setup
392 391
393# @VARIABLE: CONFIGURE_OPTIONS 392# @VARIABLE: CONFIGURE_OPTIONS
394# @DESCRIPTION: 393# @DESCRIPTION:
395# Any options to pass to configure 394# Any extra options to pass to configure
396[[ -n ${CONFIGURE_OPTIONS} ]]
397 395
398 # If prefix isn't set here, .pc files cause problems 396 # If prefix isn't set here, .pc files cause problems
399 if [[ -x ${ECONF_SOURCE:-.}/configure ]]; then 397 if [[ -x ${ECONF_SOURCE:-.}/configure ]]; then
400 econf --prefix=${XDIR} \ 398 econf --prefix=${XDIR} \
401 --datadir=${XDIR}/share \ 399 --datadir=${XDIR}/share \
435 DESTDIR="${D}" \ 433 DESTDIR="${D}" \
436 install \ 434 install \
437 || die 435 || die
438 else 436 else
439 make \ 437 make \
438 docdir=/usr/share/doc/${PF} \
440 DESTDIR="${D}" \ 439 DESTDIR="${D}" \
441 install \ 440 install \
442 || die 441 || die
443 fi 442 fi
444# Shouldn't be necessary in XDIR=/usr 443# Shouldn't be necessary in XDIR=/usr
455 if [[ -e ${S}/ChangeLog ]]; then 454 if [[ -e ${S}/ChangeLog ]]; then
456 dodoc "${S}"/ChangeLog 455 dodoc "${S}"/ChangeLog
457 fi 456 fi
458# @VARIABLE: DOCS 457# @VARIABLE: DOCS
459# @DESCRIPTION: 458# @DESCRIPTION:
460# Any documentation to install 459# Any documentation to install via dodoc
461 [[ -n ${DOCS} ]] && dodoc ${DOCS} 460 [[ -n ${DOCS} ]] && dodoc ${DOCS}
462 461
463 # Don't install libtool archives for server modules 462 # Don't install libtool archives for server modules
464 if [[ -e ${D}/usr/$(get_libdir)/xorg/modules ]]; then 463 if [[ -e ${D}/usr/$(get_libdir)/xorg/modules ]]; then
465 find "${D}"/usr/$(get_libdir)/xorg/modules -name '*.la' \ 464 find "${D}"/usr/$(get_libdir)/xorg/modules -name '*.la' \
500# @DESCRIPTION: 499# @DESCRIPTION:
501# Run X-specific post-removal tasks on the live filesystem. The only 500# Run X-specific post-removal tasks on the live filesystem. The only
502# task right now is some cleanup for font packages. 501# task right now is some cleanup for font packages.
503x-modular_pkg_postrm() { 502x-modular_pkg_postrm() {
504 if [[ -n "${FONT}" ]]; then 503 if [[ -n "${FONT}" ]]; then
505 cleanup_fonts
506 font_pkg_postrm 504 font_pkg_postrm
507 fi 505 fi
508}
509
510# @FUNCTION: cleanup_fonts
511# @USAGE:
512# @DESCRIPTION:
513# Get rid of font directories that only contain generated files
514cleanup_fonts() {
515 local ALLOWED_FILES="encodings.dir fonts.cache-1 fonts.dir fonts.scale"
516 for DIR in ${FONT_DIR}; do
517 unset KEEP_FONTDIR
518 REAL_DIR=${ROOT}usr/share/fonts/${DIR}
519
520 ebegin "Checking ${REAL_DIR} for useless files"
521 pushd ${REAL_DIR} &> /dev/null
522 for FILE in *; do
523 unset MATCH
524 for ALLOWED_FILE in ${ALLOWED_FILES}; do
525 if [[ ${FILE} = ${ALLOWED_FILE} ]]; then
526 # If it's allowed, then move on to the next file
527 MATCH="yes"
528 break
529 fi
530 done
531 # If we found a match in allowed files, move on to the next file
532 if [[ -n ${MATCH} ]]; then
533 continue
534 fi
535 # If we get this far, there wasn't a match in the allowed files
536 KEEP_FONTDIR="yes"
537 # We don't need to check more files if we're already keeping it
538 break
539 done
540 popd &> /dev/null
541 # If there are no files worth keeping, then get rid of the dir
542 if [[ -z "${KEEP_FONTDIR}" ]]; then
543 rm -rf ${REAL_DIR}
544 fi
545 eend 0
546 done
547} 506}
548 507
549# @FUNCTION: setup_fonts 508# @FUNCTION: setup_fonts
550# @USAGE: 509# @USAGE:
551# @DESCRIPTION: 510# @DESCRIPTION:
557 die "${msg}" 516 die "${msg}"
558 fi 517 fi
559 518
560 create_fonts_scale 519 create_fonts_scale
561 create_fonts_dir 520 create_fonts_dir
562 fix_font_permissions
563 create_font_cache 521 create_font_cache
564} 522}
565 523
566# @FUNCTION: remove_font_metadata 524# @FUNCTION: remove_font_metadata
567# @USAGE: 525# @USAGE:
581} 539}
582 540
583# @FUNCTION: install_driver_hwdata 541# @FUNCTION: install_driver_hwdata
584# @USAGE: 542# @USAGE:
585# @DESCRIPTION: 543# @DESCRIPTION:
586# Installs device-to-driver mappings for system-config-display and 544# Installs device-to-driver mappings for system-config-display and
587# anything else that uses hwdata. 545# anything else that uses hwdata.
588install_driver_hwdata() { 546install_driver_hwdata() {
589 insinto /usr/share/hwdata/videoaliases 547 insinto /usr/share/hwdata/videoaliases
590 for i in "${FILESDIR}"/*.xinf; do 548 for i in "${FILESDIR}"/*.xinf; do
591 # We need this for the case when none exist, 549 # We need this for the case when none exist,
650 fi 608 fi
651 done 609 done
652 eend 0 610 eend 0
653} 611}
654 612
655# @FUNCTION: fix_font_permissions
656# @USAGE:
657# @DESCRIPTION:
658# Font files should have 644 permissions. Ensure this is the case.
659fix_font_permissions() {
660 ebegin "Fixing permissions"
661 for DIR in ${FONT_DIR}; do
662 find "${ROOT}"/usr/share/fonts/${DIR} -type f -name 'font.*' \
663 -exec chmod 0644 {} \;
664 done
665 eend 0
666}
667
668# @FUNCTION: create_font_cache 613# @FUNCTION: create_font_cache
669# @USAGE: 614# @USAGE:
670# @DESCRIPTION: 615# @DESCRIPTION:
671# Create fonts.cache-1 files, used by the new client-side fonts 616# Create fonts.cache-1 files, used by the new client-side fonts
672# subsystem. 617# subsystem.

Legend:
Removed from v.1.109  
changed lines
  Added in v.1.122

  ViewVC Help
Powered by ViewVC 1.1.20