| 1 | # Copyright 1999-2005 Gentoo Foundation |
1 | # Copyright 1999-2011 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.113 2009/09/19 21:19:29 remi Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/x-modular.eclass,v 1.124 2011/12/27 17:55:13 fauli 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, |
| … | |
… | |
| 65 | XDIR="/usr" |
70 | XDIR="/usr" |
| 66 | |
71 | |
| 67 | IUSE="" |
72 | IUSE="" |
| 68 | HOMEPAGE="http://xorg.freedesktop.org/" |
73 | HOMEPAGE="http://xorg.freedesktop.org/" |
| 69 | |
74 | |
| 70 | if [[ -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} |
| 76 | fi |
|
|
| 77 | |
80 | |
| 78 | # Set up SRC_URI for individual modular releases |
81 | # Set up SRC_URI for individual modular releases |
| 79 | BASE_INDIVIDUAL_URI="http://xorg.freedesktop.org/releases/individual" |
82 | BASE_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. |
| 85 | if [[ -z ${MODULE} ]]; then |
88 | if [[ -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" ;; |
| … | |
… | |
| 128 | media-fonts/font-alias" |
130 | media-fonts/font-alias" |
| 129 | |
131 | |
| 130 | # Starting with 7.0RC3, we can specify the font directory |
132 | # Starting with 7.0RC3, we can specify the font directory |
| 131 | # 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 |
| 132 | |
134 | |
| 133 | # Wrap in `if` so ebuilds can set it too |
|
|
| 134 | if [[ -z ${FONT_DIR} ]]; then |
|
|
| 135 | # @ECLASS-VARIABLE: FONT_DIR |
135 | # @ECLASS-VARIABLE: FONT_DIR |
| 136 | # @DESCRIPTION: |
136 | # @DESCRIPTION: |
| 137 | # 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 |
| 138 | # the subdirectory of /usr/share/fonts/ it should install into, set |
138 | # the subdirectory of /usr/share/fonts/ it should install into, set |
| 139 | # FONT_DIR to that directory or directories. Set before inheriting this |
139 | # FONT_DIR to that directory or directories. Set before inheriting this |
| 140 | # eclass. |
140 | # eclass. |
| 141 | FONT_DIR=${PN##*-} |
141 | : ${FONT_DIR:=${PN##*-}} |
| 142 | |
|
|
| 143 | fi |
|
|
| 144 | |
142 | |
| 145 | # Fix case of font directories |
143 | # Fix case of font directories |
| 146 | FONT_DIR=${FONT_DIR/ttf/TTF} |
144 | FONT_DIR=${FONT_DIR/ttf/TTF} |
| 147 | FONT_DIR=${FONT_DIR/otf/OTF} |
145 | FONT_DIR=${FONT_DIR/otf/OTF} |
| 148 | FONT_DIR=${FONT_DIR/type1/Type1} |
146 | FONT_DIR=${FONT_DIR/type1/Type1} |
| … | |
… | |
| 183 | DEPEND="${DEPEND} |
181 | DEPEND="${DEPEND} |
| 184 | >=dev-util/pkgconfig-0.18" |
182 | >=dev-util/pkgconfig-0.18" |
| 185 | |
183 | |
| 186 | if [[ "${PN/util-macros}" = "${PN}" ]]; then |
184 | if [[ "${PN/util-macros}" = "${PN}" ]]; then |
| 187 | DEPEND="${DEPEND} |
185 | DEPEND="${DEPEND} |
| 188 | >=x11-misc/util-macros-0.99.2 |
186 | >=x11-misc/util-macros-1.3.0" |
| 189 | >=sys-devel/binutils-2.16.1-r3" |
|
|
| 190 | fi |
187 | fi |
| 191 | |
188 | |
| 192 | RDEPEND="${RDEPEND} |
189 | RDEPEND="${RDEPEND} |
| 193 | !<=x11-base/xorg-x11-6.9" |
190 | !<=x11-base/xorg-x11-6.9" |
| 194 | # Provides virtual/x11 for temporary use until packages are ported |
191 | # Provides virtual/x11 for temporary use until packages are ported |
| … | |
… | |
| 393 | x-modular_font_configure |
390 | x-modular_font_configure |
| 394 | x-modular_debug_setup |
391 | x-modular_debug_setup |
| 395 | |
392 | |
| 396 | # @VARIABLE: CONFIGURE_OPTIONS |
393 | # @VARIABLE: CONFIGURE_OPTIONS |
| 397 | # @DESCRIPTION: |
394 | # @DESCRIPTION: |
| 398 | # Any options to pass to configure |
395 | # Any extra options to pass to configure |
| 399 | [[ -n ${CONFIGURE_OPTIONS} ]] |
|
|
| 400 | |
396 | |
| 401 | # If prefix isn't set here, .pc files cause problems |
397 | # If prefix isn't set here, .pc files cause problems |
| 402 | if [[ -x ${ECONF_SOURCE:-.}/configure ]]; then |
398 | if [[ -x ${ECONF_SOURCE:-.}/configure ]]; then |
| 403 | econf --prefix=${XDIR} \ |
399 | econf --prefix=${XDIR} \ |
| 404 | --datadir=${XDIR}/share \ |
400 | --datadir=${XDIR}/share \ |
| … | |
… | |
| 437 | ${PN/proto/}docdir=/usr/share/doc/${PF} \ |
433 | ${PN/proto/}docdir=/usr/share/doc/${PF} \ |
| 438 | DESTDIR="${D}" \ |
434 | DESTDIR="${D}" \ |
| 439 | install \ |
435 | install \ |
| 440 | || die |
436 | || die |
| 441 | else |
437 | else |
| 442 | # FIXME: Drop after X fonts stop running fc-cache during install, bug #278221 |
|
|
| 443 | [[ -n ${FONT} ]] && addpredict /var/cache/fontconfig |
|
|
| 444 | make \ |
438 | make \ |
|
|
439 | docdir=/usr/share/doc/${PF} \ |
| 445 | DESTDIR="${D}" \ |
440 | DESTDIR="${D}" \ |
| 446 | install \ |
441 | install \ |
| 447 | || die |
442 | || die |
| 448 | fi |
443 | fi |
| 449 | # Shouldn't be necessary in XDIR=/usr |
444 | # Shouldn't be necessary in XDIR=/usr |
| … | |
… | |
| 460 | if [[ -e ${S}/ChangeLog ]]; then |
455 | if [[ -e ${S}/ChangeLog ]]; then |
| 461 | dodoc "${S}"/ChangeLog |
456 | dodoc "${S}"/ChangeLog |
| 462 | fi |
457 | fi |
| 463 | # @VARIABLE: DOCS |
458 | # @VARIABLE: DOCS |
| 464 | # @DESCRIPTION: |
459 | # @DESCRIPTION: |
| 465 | # Any documentation to install |
460 | # Any documentation to install via dodoc |
| 466 | [[ -n ${DOCS} ]] && dodoc ${DOCS} |
461 | [[ -n ${DOCS} ]] && dodoc ${DOCS} |
| 467 | |
462 | |
| 468 | # Don't install libtool archives for server modules |
463 | # Don't install libtool archives for server modules |
| 469 | if [[ -e ${D}/usr/$(get_libdir)/xorg/modules ]]; then |
464 | if [[ -e ${D}/usr/$(get_libdir)/xorg/modules ]]; then |
| 470 | find "${D}"/usr/$(get_libdir)/xorg/modules -name '*.la' \ |
465 | find "${D}"/usr/$(get_libdir)/xorg/modules -name '*.la' \ |
| … | |
… | |
| 505 | # @DESCRIPTION: |
500 | # @DESCRIPTION: |
| 506 | # 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 |
| 507 | # task right now is some cleanup for font packages. |
502 | # task right now is some cleanup for font packages. |
| 508 | x-modular_pkg_postrm() { |
503 | x-modular_pkg_postrm() { |
| 509 | if [[ -n "${FONT}" ]]; then |
504 | if [[ -n "${FONT}" ]]; then |
| 510 | cleanup_fonts |
|
|
| 511 | font_pkg_postrm |
505 | font_pkg_postrm |
| 512 | fi |
506 | fi |
| 513 | } |
|
|
| 514 | |
|
|
| 515 | # @FUNCTION: cleanup_fonts |
|
|
| 516 | # @USAGE: |
|
|
| 517 | # @DESCRIPTION: |
|
|
| 518 | # Get rid of font directories that only contain generated files |
|
|
| 519 | cleanup_fonts() { |
|
|
| 520 | local ALLOWED_FILES="encodings.dir fonts.cache-1 fonts.dir fonts.scale" |
|
|
| 521 | for DIR in ${FONT_DIR}; do |
|
|
| 522 | unset KEEP_FONTDIR |
|
|
| 523 | REAL_DIR=${ROOT}usr/share/fonts/${DIR} |
|
|
| 524 | |
|
|
| 525 | ebegin "Checking ${REAL_DIR} for useless files" |
|
|
| 526 | pushd ${REAL_DIR} &> /dev/null |
|
|
| 527 | for FILE in *; do |
|
|
| 528 | unset MATCH |
|
|
| 529 | for ALLOWED_FILE in ${ALLOWED_FILES}; do |
|
|
| 530 | if [[ ${FILE} = ${ALLOWED_FILE} ]]; then |
|
|
| 531 | # If it's allowed, then move on to the next file |
|
|
| 532 | MATCH="yes" |
|
|
| 533 | break |
|
|
| 534 | fi |
|
|
| 535 | done |
|
|
| 536 | # If we found a match in allowed files, move on to the next file |
|
|
| 537 | if [[ -n ${MATCH} ]]; then |
|
|
| 538 | continue |
|
|
| 539 | fi |
|
|
| 540 | # If we get this far, there wasn't a match in the allowed files |
|
|
| 541 | KEEP_FONTDIR="yes" |
|
|
| 542 | # We don't need to check more files if we're already keeping it |
|
|
| 543 | break |
|
|
| 544 | done |
|
|
| 545 | popd &> /dev/null |
|
|
| 546 | # If there are no files worth keeping, then get rid of the dir |
|
|
| 547 | if [[ -z "${KEEP_FONTDIR}" ]]; then |
|
|
| 548 | rm -rf ${REAL_DIR} |
|
|
| 549 | fi |
|
|
| 550 | eend 0 |
|
|
| 551 | done |
|
|
| 552 | } |
507 | } |
| 553 | |
508 | |
| 554 | # @FUNCTION: setup_fonts |
509 | # @FUNCTION: setup_fonts |
| 555 | # @USAGE: |
510 | # @USAGE: |
| 556 | # @DESCRIPTION: |
511 | # @DESCRIPTION: |
| … | |
… | |
| 585 | } |
540 | } |
| 586 | |
541 | |
| 587 | # @FUNCTION: install_driver_hwdata |
542 | # @FUNCTION: install_driver_hwdata |
| 588 | # @USAGE: |
543 | # @USAGE: |
| 589 | # @DESCRIPTION: |
544 | # @DESCRIPTION: |
| 590 | # Installs device-to-driver mappings for system-config-display and |
545 | # Installs device-to-driver mappings for system-config-display and |
| 591 | # anything else that uses hwdata. |
546 | # anything else that uses hwdata. |
| 592 | install_driver_hwdata() { |
547 | install_driver_hwdata() { |
| 593 | insinto /usr/share/hwdata/videoaliases |
548 | insinto /usr/share/hwdata/videoaliases |
| 594 | for i in "${FILESDIR}"/*.xinf; do |
549 | for i in "${FILESDIR}"/*.xinf; do |
| 595 | # We need this for the case when none exist, |
550 | # We need this for the case when none exist, |