| 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.100 2008/05/28 01:48:10 dberkholz Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/x-modular.eclass,v 1.107 2009/03/03 16:28:32 remi Exp $ |
| 4 | # |
4 | # |
| 5 | # @ECLASS: x-modular.eclass |
5 | # @ECLASS: x-modular.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # Donnie Berkholz <dberkholz@gentoo.org>, x11@gentoo.org |
7 | # Donnie Berkholz <dberkholz@gentoo.org>, x11@gentoo.org |
| 8 | # @BLURB: Reduces code duplication in the modularized X11 ebuilds. |
8 | # @BLURB: Reduces code duplication in the modularized X11 ebuilds. |
| … | |
… | |
| 48 | # @ECLASS-VARIABLE: MODULE |
48 | # @ECLASS-VARIABLE: MODULE |
| 49 | # @DESCRIPTION: |
49 | # @DESCRIPTION: |
| 50 | # The subdirectory to download source from. Possible settings are app, |
50 | # The subdirectory to download source from. Possible settings are app, |
| 51 | # doc, data, util, driver, font, lib, proto, xserver. Set above the |
51 | # doc, data, util, driver, font, lib, proto, xserver. Set above the |
| 52 | # inherit to override the default autoconfigured module. |
52 | # inherit to override the default autoconfigured module. |
| 53 | [[ -z ${MODULE} ]] && MODULE="" |
53 | if [[ -z ${MODULE} ]]; then |
|
|
54 | MODULE="" |
| 54 | case ${CATEGORY} in |
55 | case ${CATEGORY} in |
| 55 | app-doc) MODULE="doc" ;; |
56 | app-doc) MODULE="doc" ;; |
| 56 | media-fonts) MODULE="font" ;; |
57 | media-fonts) MODULE="font" ;; |
| 57 | x11-apps|x11-wm) MODULE="app" ;; |
58 | x11-apps|x11-wm) MODULE="app" ;; |
| 58 | x11-misc|x11-themes) MODULE="util" ;; |
59 | x11-misc|x11-themes) MODULE="util" ;; |
| 59 | x11-drivers) MODULE="driver" ;; |
60 | x11-drivers) MODULE="driver" ;; |
| 60 | x11-base) MODULE="xserver" ;; |
61 | x11-base) MODULE="xserver" ;; |
| 61 | x11-proto) MODULE="proto" ;; |
62 | x11-proto) MODULE="proto" ;; |
| 62 | x11-libs) MODULE="lib" ;; |
63 | x11-libs) MODULE="lib" ;; |
| 63 | esac |
64 | esac |
|
|
65 | fi |
| 64 | |
66 | |
| 65 | if [[ -n ${GIT_ECLASS} ]]; then |
67 | if [[ -n ${GIT_ECLASS} ]]; then |
| 66 | EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/${MODULE}/${PN}" |
68 | EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/${MODULE}/${PN}" |
| 67 | else |
69 | else |
| 68 | SRC_URI="${SRC_URI} ${BASE_INDIVIDUAL_URI}/${MODULE}/${P}.tar.bz2" |
70 | SRC_URI="${SRC_URI} ${BASE_INDIVIDUAL_URI}/${MODULE}/${P}.tar.bz2" |
| … | |
… | |
| 188 | # @DESCRIPTION: |
190 | # @DESCRIPTION: |
| 189 | # Ensures the server supports DRI if building a driver with DRI support |
191 | # Ensures the server supports DRI if building a driver with DRI support |
| 190 | x-modular_dri_check() { |
192 | x-modular_dri_check() { |
| 191 | # (#120057) Enabling DRI in drivers requires that the server was built with |
193 | # (#120057) Enabling DRI in drivers requires that the server was built with |
| 192 | # support for it |
194 | # support for it |
|
|
195 | # Starting with xorg-server 1.5.3, DRI support is always enabled unless |
|
|
196 | # USE=minimal is set (see bug #252084) |
| 193 | if [[ -n "${DRIVER}" ]]; then |
197 | if [[ -n "${DRIVER}" ]]; then |
| 194 | if has dri ${IUSE} && use dri; then |
198 | if has dri ${IUSE} && use dri; then |
| 195 | einfo "Checking for direct rendering capabilities ..." |
199 | einfo "Checking for direct rendering capabilities ..." |
|
|
200 | if has_version '>=x11-base/xorg-server-1.5.3'; then |
|
|
201 | if built_with_use x11-base/xorg-server minimal; then |
|
|
202 | die "You must build x11-base/xorg-server with USE=-minimal." |
|
|
203 | fi |
|
|
204 | else |
| 196 | if ! built_with_use x11-base/xorg-server dri; then |
205 | if ! built_with_use x11-base/xorg-server dri; then |
| 197 | die "You must build x11-base/xorg-server with USE=dri." |
206 | die "You must build x11-base/xorg-server with USE=dri." |
|
|
207 | fi |
| 198 | fi |
208 | fi |
| 199 | fi |
209 | fi |
| 200 | fi |
210 | fi |
| 201 | } |
211 | } |
| 202 | |
212 | |
| … | |
… | |
| 225 | if [[ -n ${GIT_ECLASS} ]]; then |
235 | if [[ -n ${GIT_ECLASS} ]]; then |
| 226 | git_src_unpack |
236 | git_src_unpack |
| 227 | else |
237 | else |
| 228 | unpack ${A} |
238 | unpack ${A} |
| 229 | fi |
239 | fi |
| 230 | cd ${S} |
240 | cd "${S}" |
| 231 | |
241 | |
| 232 | if [[ -n ${FONT_OPTIONS} ]]; then |
242 | if [[ -n ${FONT_OPTIONS} ]]; then |
| 233 | einfo "Detected font directory: ${FONT_DIR}" |
243 | einfo "Detected font directory: ${FONT_DIR}" |
| 234 | fi |
244 | fi |
| 235 | } |
245 | } |
| … | |
… | |
| 389 | # @DESCRIPTION: |
399 | # @DESCRIPTION: |
| 390 | # Install a built package to ${D}, performing any necessary steps. |
400 | # Install a built package to ${D}, performing any necessary steps. |
| 391 | # Creates a ChangeLog from git if using live ebuilds. |
401 | # Creates a ChangeLog from git if using live ebuilds. |
| 392 | x-modular_src_install() { |
402 | x-modular_src_install() { |
| 393 | # Install everything to ${XDIR} |
403 | # Install everything to ${XDIR} |
|
|
404 | if [[ ${CATEGORY} = x11-proto ]]; then |
| 394 | make \ |
405 | make \ |
|
|
406 | ${PN/proto/}docdir=/usr/share/doc/${PF} \ |
| 395 | DESTDIR="${D}" \ |
407 | DESTDIR="${D}" \ |
| 396 | install |
408 | install \ |
|
|
409 | || die |
|
|
410 | else |
|
|
411 | make \ |
|
|
412 | DESTDIR="${D}" \ |
|
|
413 | install \ |
|
|
414 | || die |
|
|
415 | fi |
| 397 | # Shouldn't be necessary in XDIR=/usr |
416 | # Shouldn't be necessary in XDIR=/usr |
| 398 | # einstall forces datadir, so we need to re-force it |
417 | # einstall forces datadir, so we need to re-force it |
| 399 | # datadir=${XDIR}/share \ |
418 | # datadir=${XDIR}/share \ |
| 400 | # mandir=${XDIR}/share/man \ |
419 | # mandir=${XDIR}/share/man \ |
| 401 | |
420 | |
| … | |
… | |
| 404 | git log ${GIT_TREE} > "${S}"/ChangeLog |
423 | git log ${GIT_TREE} > "${S}"/ChangeLog |
| 405 | popd |
424 | popd |
| 406 | fi |
425 | fi |
| 407 | |
426 | |
| 408 | if [[ -e ${S}/ChangeLog ]]; then |
427 | if [[ -e ${S}/ChangeLog ]]; then |
| 409 | dodoc ${S}/ChangeLog |
428 | dodoc "${S}"/ChangeLog |
| 410 | fi |
429 | fi |
| 411 | # @VARIABLE: DOCS |
430 | # @VARIABLE: DOCS |
| 412 | # @DESCRIPTION: |
431 | # @DESCRIPTION: |
| 413 | # Any documentation to install |
432 | # Any documentation to install |
| 414 | [[ -n ${DOCS} ]] && dodoc ${DOCS} |
433 | [[ -n ${DOCS} ]] && dodoc ${DOCS} |
| 415 | |
434 | |
| 416 | # Make sure docs get compressed |
|
|
| 417 | prepalldocs |
|
|
| 418 | |
|
|
| 419 | # Don't install libtool archives for server modules |
435 | # Don't install libtool archives for server modules |
| 420 | if [[ -e ${D}/usr/$(get_libdir)/xorg/modules ]]; then |
436 | if [[ -e ${D}/usr/$(get_libdir)/xorg/modules ]]; then |
| 421 | find ${D}/usr/$(get_libdir)/xorg/modules -name '*.la' \ |
437 | find "${D}"/usr/$(get_libdir)/xorg/modules -name '*.la' \ |
| 422 | | xargs rm -f |
438 | | xargs rm -f |
| 423 | fi |
439 | fi |
| 424 | |
440 | |
| 425 | if [[ -n "${FONT}" ]]; then |
441 | if [[ -n "${FONT}" ]]; then |
| 426 | remove_font_metadata |
442 | remove_font_metadata |
| … | |
… | |
| 529 | for DIR in ${FONT_DIR}; do |
545 | for DIR in ${FONT_DIR}; do |
| 530 | if [[ "${DIR}" != "Speedo" ]] && \ |
546 | if [[ "${DIR}" != "Speedo" ]] && \ |
| 531 | [[ "${DIR}" != "CID" ]] ; then |
547 | [[ "${DIR}" != "CID" ]] ; then |
| 532 | # Delete font metadata files |
548 | # Delete font metadata files |
| 533 | # fonts.scale, fonts.dir, fonts.cache-1 |
549 | # fonts.scale, fonts.dir, fonts.cache-1 |
| 534 | rm -f ${D}/usr/share/fonts/${DIR}/fonts.{scale,dir,cache-1} |
550 | rm -f "${D}"/usr/share/fonts/${DIR}/fonts.{scale,dir,cache-1} |
| 535 | fi |
551 | fi |
| 536 | done |
552 | done |
| 537 | } |
553 | } |
| 538 | |
554 | |
| 539 | # @FUNCTION: install_driver_hwdata |
555 | # @FUNCTION: install_driver_hwdata |
| … | |
… | |
| 578 | # NOTE: There is no way to regenerate Speedo/CID fonts.scale |
594 | # NOTE: There is no way to regenerate Speedo/CID fonts.scale |
| 579 | # <dberkholz@gentoo.org> 2 August 2004 |
595 | # <dberkholz@gentoo.org> 2 August 2004 |
| 580 | if [[ "${x/encodings}" = "${x}" ]] \ |
596 | if [[ "${x/encodings}" = "${x}" ]] \ |
| 581 | && [[ -n "$(find ${x} -iname '*.[pot][ft][abcf]' -print)" ]]; then |
597 | && [[ -n "$(find ${x} -iname '*.[pot][ft][abcf]' -print)" ]]; then |
| 582 | mkfontscale \ |
598 | mkfontscale \ |
| 583 | -a ${ROOT}/usr/share/fonts/encodings/encodings.dir \ |
599 | -a "${ROOT}"/usr/share/fonts/encodings/encodings.dir \ |
| 584 | -- ${x} |
600 | -- ${x} |
| 585 | fi |
601 | fi |
| 586 | done |
602 | done |
| 587 | eend 0 |
603 | eend 0 |
| 588 | } |
604 | } |
| … | |
… | |
| 598 | [[ -z "$(ls ${x}/)" ]] && continue |
614 | [[ -z "$(ls ${x}/)" ]] && continue |
| 599 | [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue |
615 | [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue |
| 600 | |
616 | |
| 601 | if [[ "${x/encodings}" = "${x}" ]]; then |
617 | if [[ "${x/encodings}" = "${x}" ]]; then |
| 602 | mkfontdir \ |
618 | mkfontdir \ |
| 603 | -e ${ROOT}/usr/share/fonts/encodings \ |
619 | -e "${ROOT}"/usr/share/fonts/encodings \ |
| 604 | -e ${ROOT}/usr/share/fonts/encodings/large \ |
620 | -e "${ROOT}"/usr/share/fonts/encodings/large \ |
| 605 | -- ${x} |
621 | -- ${x} |
| 606 | fi |
622 | fi |
| 607 | done |
623 | done |
| 608 | eend 0 |
624 | eend 0 |
| 609 | } |
625 | } |
| … | |
… | |
| 613 | # @DESCRIPTION: |
629 | # @DESCRIPTION: |
| 614 | # Font files should have 644 permissions. Ensure this is the case. |
630 | # Font files should have 644 permissions. Ensure this is the case. |
| 615 | fix_font_permissions() { |
631 | fix_font_permissions() { |
| 616 | ebegin "Fixing permissions" |
632 | ebegin "Fixing permissions" |
| 617 | for DIR in ${FONT_DIR}; do |
633 | for DIR in ${FONT_DIR}; do |
| 618 | find ${ROOT}/usr/share/fonts/${DIR} -type f -name 'font.*' \ |
634 | find "${ROOT}"/usr/share/fonts/${DIR} -type f -name 'font.*' \ |
| 619 | -exec chmod 0644 {} \; |
635 | -exec chmod 0644 {} \; |
| 620 | done |
636 | done |
| 621 | eend 0 |
637 | eend 0 |
| 622 | } |
638 | } |
| 623 | |
639 | |