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

Legend:
Removed from v.1.110  
changed lines
  Added in v.1.125

  ViewVC Help
Powered by ViewVC 1.1.20