| 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.95 2008/04/13 04:44:16 dberkholz Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/x-modular.eclass,v 1.104 2009/02/14 18:37:34 maekke 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. |
| … | |
… | |
| 24 | # recently tested. You may need to uncomment the setting of datadir and |
24 | # recently tested. You may need to uncomment the setting of datadir and |
| 25 | # mandir in x-modular_src_install() or add it back in if it's no longer |
25 | # mandir in x-modular_src_install() or add it back in if it's no longer |
| 26 | # there. You may also want to change the SLOT. |
26 | # there. You may also want to change the SLOT. |
| 27 | XDIR="/usr" |
27 | XDIR="/usr" |
| 28 | |
28 | |
| 29 | if [[ -z "${XDPVER}" ]]; then |
|
|
| 30 | # @ECLASS-VARIABLE: XDPVER |
|
|
| 31 | # @DESCRIPTION: |
|
|
| 32 | # Set up default patchset version(s) if necessary for driver patches. If |
|
|
| 33 | # you want to change the auto-application of the driver patchset or |
|
|
| 34 | # prevent it from applying, edit XDPVER in the ebuild. Set it to -1 to |
|
|
| 35 | # prevent patch application or positive integers for that patch version. |
|
|
| 36 | # Set before inheriting this eclass. |
|
|
| 37 | XDPVER="1" |
|
|
| 38 | fi |
|
|
| 39 | |
|
|
| 40 | IUSE="" |
29 | IUSE="" |
| 41 | HOMEPAGE="http://xorg.freedesktop.org/" |
30 | HOMEPAGE="http://xorg.freedesktop.org/" |
| 42 | |
31 | |
| 43 | if [[ -z ${SNAPSHOT} ]]; then |
32 | if [[ -z ${SNAPSHOT} ]]; then |
| 44 | # @ECLASS-VARIABLE: SNAPSHOT |
33 | # @ECLASS-VARIABLE: SNAPSHOT |
| … | |
… | |
| 54 | SRC_URI="" |
43 | SRC_URI="" |
| 55 | fi |
44 | fi |
| 56 | |
45 | |
| 57 | # Set up SRC_URI for individual modular releases |
46 | # Set up SRC_URI for individual modular releases |
| 58 | BASE_INDIVIDUAL_URI="http://xorg.freedesktop.org/releases/individual" |
47 | BASE_INDIVIDUAL_URI="http://xorg.freedesktop.org/releases/individual" |
| 59 | if [[ ${CATEGORY} = x11-apps ]] || [[ ${CATEGORY} = x11-wm ]]; then |
48 | # @ECLASS-VARIABLE: MODULE |
|
|
49 | # @DESCRIPTION: |
|
|
50 | # The subdirectory to download source from. Possible settings are app, |
|
|
51 | # doc, data, util, driver, font, lib, proto, xserver. Set above the |
|
|
52 | # inherit to override the default autoconfigured module. |
|
|
53 | if [[ -z ${MODULE} ]]; then |
| 60 | MODULE="app" |
54 | MODULE="" |
| 61 | elif [[ ${CATEGORY} = app-doc ]]; then |
55 | case ${CATEGORY} in |
| 62 | MODULE="doc" |
56 | app-doc) MODULE="doc" ;; |
| 63 | # x11-misc contains data and util, x11-themes contains data |
57 | media-fonts) MODULE="font" ;; |
| 64 | elif [[ ${CATEGORY} = x11-misc ]] || [[ ${CATEGORY} = x11-themes ]]; then |
58 | x11-apps|x11-wm) MODULE="app" ;; |
| 65 | if [[ ${PN} == xbitmaps || ${PN} == xcursor-themes || ${PN} == xkbdata ]]; then |
59 | x11-misc|x11-themes) MODULE="util" ;; |
| 66 | MODULE="data" |
60 | x11-drivers) MODULE="driver" ;; |
| 67 | else |
61 | x11-base) MODULE="xserver" ;; |
| 68 | MODULE="util" |
62 | x11-proto) MODULE="proto" ;; |
| 69 | fi |
63 | x11-libs) MODULE="lib" ;; |
| 70 | elif [[ ${CATEGORY} = x11-drivers ]]; then |
64 | esac |
| 71 | MODULE="driver" |
|
|
| 72 | elif [[ ${CATEGORY} = media-fonts ]]; then |
|
|
| 73 | MODULE="font" |
|
|
| 74 | elif [[ ${CATEGORY} = x11-libs ]]; then |
|
|
| 75 | MODULE="lib" |
|
|
| 76 | elif [[ ${CATEGORY} = x11-proto ]]; then |
|
|
| 77 | MODULE="proto" |
|
|
| 78 | elif [[ ${CATEGORY} = x11-base ]]; then |
|
|
| 79 | MODULE="xserver" |
|
|
| 80 | fi |
65 | fi |
| 81 | |
66 | |
| 82 | if [[ -n ${GIT_ECLASS} ]]; then |
67 | if [[ -n ${GIT_ECLASS} ]]; then |
| 83 | EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/${MODULE}/${PN}" |
68 | EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/${MODULE}/${PN}" |
| 84 | else |
69 | else |
| … | |
… | |
| 143 | |
128 | |
| 144 | # Set up configure option |
129 | # Set up configure option |
| 145 | FONT_OPTIONS="--with-fontdir=\"/usr/share/fonts/${FONT_DIR}\"" |
130 | FONT_OPTIONS="--with-fontdir=\"/usr/share/fonts/${FONT_DIR}\"" |
| 146 | |
131 | |
| 147 | if [[ -n "${FONT}" ]]; then |
132 | if [[ -n "${FONT}" ]]; then |
| 148 | if [[ ${PN##*-} = misc ]] || [[ ${PN##*-} = 75dpi ]] || [[ ${PN##*-} = 100dpi ]]; then |
133 | if [[ ${PN##*-} = misc ]] || [[ ${PN##*-} = 75dpi ]] || [[ ${PN##*-} = 100dpi ]] || [[ ${PN##*-} = cyrillic ]]; then |
| 149 | IUSE="${IUSE} nls" |
134 | IUSE="${IUSE} nls" |
| 150 | fi |
135 | fi |
| 151 | fi |
136 | fi |
| 152 | fi |
137 | fi |
| 153 | |
138 | |
| 154 | # If we're a driver package |
139 | # If we're a driver package |
| 155 | if [[ "${PN/#xf86-video}" != "${PN}" ]] || [[ "${PN/#xf86-input}" != "${PN}" ]]; then |
140 | if [[ "${PN/#xf86-video}" != "${PN}" ]] || [[ "${PN/#xf86-input}" != "${PN}" ]]; then |
| 156 | # Enable driver code in the rest of the eclass |
141 | # Enable driver code in the rest of the eclass |
| 157 | DRIVER="yes" |
142 | DRIVER="yes" |
| 158 | |
|
|
| 159 | if [[ ${XDPVER} != -1 ]]; then |
|
|
| 160 | # Add driver patchset to SRC_URI |
|
|
| 161 | SRC_URI="${SRC_URI} |
|
|
| 162 | mirror://gentoo/x11-driver-patches-${XDPVER}.tar.bz2" |
|
|
| 163 | fi |
|
|
| 164 | fi |
143 | fi |
| 165 | |
144 | |
| 166 | # Debugging -- ignore packages that can't be built with debugging |
145 | # Debugging -- ignore packages that can't be built with debugging |
| 167 | if [[ -z "${FONT}" ]] \ |
146 | if [[ -z "${FONT}" ]] \ |
| 168 | && [[ "${CATEGORY/app-doc}" = "${CATEGORY}" ]] \ |
147 | && [[ "${CATEGORY/app-doc}" = "${CATEGORY}" ]] \ |
| … | |
… | |
| 214 | # (#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 |
| 215 | # support for it |
194 | # support for it |
| 216 | if [[ -n "${DRIVER}" ]]; then |
195 | if [[ -n "${DRIVER}" ]]; then |
| 217 | if has dri ${IUSE} && use dri; then |
196 | if has dri ${IUSE} && use dri; then |
| 218 | einfo "Checking for direct rendering capabilities ..." |
197 | einfo "Checking for direct rendering capabilities ..." |
| 219 | if ! built_with_use x11-base/xorg-server dri; then |
198 | if ! built_with_use --missing true x11-base/xorg-server dri; then |
| 220 | die "You must build x11-base/xorg-server with USE=dri." |
199 | die "You must build x11-base/xorg-server with USE=dri." |
| 221 | fi |
200 | fi |
| 222 | fi |
201 | fi |
| 223 | fi |
202 | fi |
| 224 | } |
203 | } |
| … | |
… | |
| 248 | if [[ -n ${GIT_ECLASS} ]]; then |
227 | if [[ -n ${GIT_ECLASS} ]]; then |
| 249 | git_src_unpack |
228 | git_src_unpack |
| 250 | else |
229 | else |
| 251 | unpack ${A} |
230 | unpack ${A} |
| 252 | fi |
231 | fi |
| 253 | cd ${S} |
232 | cd "${S}" |
| 254 | |
233 | |
| 255 | if [[ -n ${FONT_OPTIONS} ]]; then |
234 | if [[ -n ${FONT_OPTIONS} ]]; then |
| 256 | einfo "Detected font directory: ${FONT_DIR}" |
235 | einfo "Detected font directory: ${FONT_DIR}" |
| 257 | fi |
236 | fi |
| 258 | } |
237 | } |
| … | |
… | |
| 265 | # Use standardized names and locations with bulk patching |
244 | # Use standardized names and locations with bulk patching |
| 266 | # Patch directory is ${WORKDIR}/patch |
245 | # Patch directory is ${WORKDIR}/patch |
| 267 | # See epatch() in eutils.eclass for more documentation |
246 | # See epatch() in eutils.eclass for more documentation |
| 268 | if [[ -z "${EPATCH_SUFFIX}" ]] ; then |
247 | if [[ -z "${EPATCH_SUFFIX}" ]] ; then |
| 269 | EPATCH_SUFFIX="patch" |
248 | EPATCH_SUFFIX="patch" |
| 270 | fi |
|
|
| 271 | |
|
|
| 272 | # If this is a driver package we need to fix man page install location. |
|
|
| 273 | # Running autoreconf will use the patched util-macros to make the |
|
|
| 274 | # change for us, so we only need to patch if it is not going to run. |
|
|
| 275 | if [[ -n "${DRIVER}" ]] && [[ "${SNAPSHOT}" != "yes" ]]\ |
|
|
| 276 | && [[ ${XDPVER} != -1 ]]; then |
|
|
| 277 | PATCHES="${PATCHES} ${DISTDIR}/x11-driver-patches-${XDPVER}.tar.bz2" |
|
|
| 278 | fi |
249 | fi |
| 279 | |
250 | |
| 280 | # @VARIABLE: PATCHES |
251 | # @VARIABLE: PATCHES |
| 281 | # @DESCRIPTION: |
252 | # @DESCRIPTION: |
| 282 | # If you have any patches to apply, set PATCHES to their locations and epatch |
253 | # If you have any patches to apply, set PATCHES to their locations and epatch |
| … | |
… | |
| 384 | x-modular_debug_setup |
355 | x-modular_debug_setup |
| 385 | |
356 | |
| 386 | # @VARIABLE: CONFIGURE_OPTIONS |
357 | # @VARIABLE: CONFIGURE_OPTIONS |
| 387 | # @DESCRIPTION: |
358 | # @DESCRIPTION: |
| 388 | # Any options to pass to configure |
359 | # Any options to pass to configure |
| 389 | [[ -n ${CONFIGURE_OPTIONTS} ]] |
360 | [[ -n ${CONFIGURE_OPTIONS} ]] |
| 390 | |
361 | |
| 391 | # If prefix isn't set here, .pc files cause problems |
362 | # If prefix isn't set here, .pc files cause problems |
| 392 | if [[ -x ${ECONF_SOURCE:-.}/configure ]]; then |
363 | if [[ -x ${ECONF_SOURCE:-.}/configure ]]; then |
| 393 | econf --prefix=${XDIR} \ |
364 | econf --prefix=${XDIR} \ |
| 394 | --datadir=${XDIR}/share \ |
365 | --datadir=${XDIR}/share \ |
| … | |
… | |
| 422 | # Creates a ChangeLog from git if using live ebuilds. |
393 | # Creates a ChangeLog from git if using live ebuilds. |
| 423 | x-modular_src_install() { |
394 | x-modular_src_install() { |
| 424 | # Install everything to ${XDIR} |
395 | # Install everything to ${XDIR} |
| 425 | make \ |
396 | make \ |
| 426 | DESTDIR="${D}" \ |
397 | DESTDIR="${D}" \ |
| 427 | install |
398 | install \ |
|
|
399 | || die |
| 428 | # Shouldn't be necessary in XDIR=/usr |
400 | # Shouldn't be necessary in XDIR=/usr |
| 429 | # einstall forces datadir, so we need to re-force it |
401 | # einstall forces datadir, so we need to re-force it |
| 430 | # datadir=${XDIR}/share \ |
402 | # datadir=${XDIR}/share \ |
| 431 | # mandir=${XDIR}/share/man \ |
403 | # mandir=${XDIR}/share/man \ |
| 432 | |
404 | |
| … | |
… | |
| 435 | git log ${GIT_TREE} > "${S}"/ChangeLog |
407 | git log ${GIT_TREE} > "${S}"/ChangeLog |
| 436 | popd |
408 | popd |
| 437 | fi |
409 | fi |
| 438 | |
410 | |
| 439 | if [[ -e ${S}/ChangeLog ]]; then |
411 | if [[ -e ${S}/ChangeLog ]]; then |
| 440 | dodoc ${S}/ChangeLog |
412 | dodoc "${S}"/ChangeLog |
| 441 | fi |
413 | fi |
| 442 | # @VARIABLE: DOCS |
414 | # @VARIABLE: DOCS |
| 443 | # @DESCRIPTION: |
415 | # @DESCRIPTION: |
| 444 | # Any documentation to install |
416 | # Any documentation to install |
| 445 | [[ -n ${DOCS} ]] && dodoc ${DOCS} |
417 | [[ -n ${DOCS} ]] && dodoc ${DOCS} |
| … | |
… | |
| 447 | # Make sure docs get compressed |
419 | # Make sure docs get compressed |
| 448 | prepalldocs |
420 | prepalldocs |
| 449 | |
421 | |
| 450 | # Don't install libtool archives for server modules |
422 | # Don't install libtool archives for server modules |
| 451 | if [[ -e ${D}/usr/$(get_libdir)/xorg/modules ]]; then |
423 | if [[ -e ${D}/usr/$(get_libdir)/xorg/modules ]]; then |
| 452 | find ${D}/usr/$(get_libdir)/xorg/modules -name '*.la' \ |
424 | find "${D}"/usr/$(get_libdir)/xorg/modules -name '*.la' \ |
| 453 | | xargs rm -f |
425 | | xargs rm -f |
| 454 | fi |
426 | fi |
| 455 | |
427 | |
| 456 | if [[ -n "${FONT}" ]]; then |
428 | if [[ -n "${FONT}" ]]; then |
| 457 | remove_font_metadata |
429 | remove_font_metadata |
| … | |
… | |
| 560 | for DIR in ${FONT_DIR}; do |
532 | for DIR in ${FONT_DIR}; do |
| 561 | if [[ "${DIR}" != "Speedo" ]] && \ |
533 | if [[ "${DIR}" != "Speedo" ]] && \ |
| 562 | [[ "${DIR}" != "CID" ]] ; then |
534 | [[ "${DIR}" != "CID" ]] ; then |
| 563 | # Delete font metadata files |
535 | # Delete font metadata files |
| 564 | # fonts.scale, fonts.dir, fonts.cache-1 |
536 | # fonts.scale, fonts.dir, fonts.cache-1 |
| 565 | rm -f ${D}/usr/share/fonts/${DIR}/fonts.{scale,dir,cache-1} |
537 | rm -f "${D}"/usr/share/fonts/${DIR}/fonts.{scale,dir,cache-1} |
| 566 | fi |
538 | fi |
| 567 | done |
539 | done |
| 568 | } |
540 | } |
| 569 | |
541 | |
| 570 | # @FUNCTION: install_driver_hwdata |
542 | # @FUNCTION: install_driver_hwdata |
| … | |
… | |
| 609 | # NOTE: There is no way to regenerate Speedo/CID fonts.scale |
581 | # NOTE: There is no way to regenerate Speedo/CID fonts.scale |
| 610 | # <dberkholz@gentoo.org> 2 August 2004 |
582 | # <dberkholz@gentoo.org> 2 August 2004 |
| 611 | if [[ "${x/encodings}" = "${x}" ]] \ |
583 | if [[ "${x/encodings}" = "${x}" ]] \ |
| 612 | && [[ -n "$(find ${x} -iname '*.[pot][ft][abcf]' -print)" ]]; then |
584 | && [[ -n "$(find ${x} -iname '*.[pot][ft][abcf]' -print)" ]]; then |
| 613 | mkfontscale \ |
585 | mkfontscale \ |
| 614 | -a ${ROOT}/usr/share/fonts/encodings/encodings.dir \ |
586 | -a "${ROOT}"/usr/share/fonts/encodings/encodings.dir \ |
| 615 | -- ${x} |
587 | -- ${x} |
| 616 | fi |
588 | fi |
| 617 | done |
589 | done |
| 618 | eend 0 |
590 | eend 0 |
| 619 | } |
591 | } |
| … | |
… | |
| 629 | [[ -z "$(ls ${x}/)" ]] && continue |
601 | [[ -z "$(ls ${x}/)" ]] && continue |
| 630 | [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue |
602 | [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue |
| 631 | |
603 | |
| 632 | if [[ "${x/encodings}" = "${x}" ]]; then |
604 | if [[ "${x/encodings}" = "${x}" ]]; then |
| 633 | mkfontdir \ |
605 | mkfontdir \ |
| 634 | -e ${ROOT}/usr/share/fonts/encodings \ |
606 | -e "${ROOT}"/usr/share/fonts/encodings \ |
| 635 | -e ${ROOT}/usr/share/fonts/encodings/large \ |
607 | -e "${ROOT}"/usr/share/fonts/encodings/large \ |
| 636 | -- ${x} |
608 | -- ${x} |
| 637 | fi |
609 | fi |
| 638 | done |
610 | done |
| 639 | eend 0 |
611 | eend 0 |
| 640 | } |
612 | } |
| … | |
… | |
| 644 | # @DESCRIPTION: |
616 | # @DESCRIPTION: |
| 645 | # Font files should have 644 permissions. Ensure this is the case. |
617 | # Font files should have 644 permissions. Ensure this is the case. |
| 646 | fix_font_permissions() { |
618 | fix_font_permissions() { |
| 647 | ebegin "Fixing permissions" |
619 | ebegin "Fixing permissions" |
| 648 | for DIR in ${FONT_DIR}; do |
620 | for DIR in ${FONT_DIR}; do |
| 649 | find ${ROOT}/usr/share/fonts/${DIR} -type f -name 'font.*' \ |
621 | find "${ROOT}"/usr/share/fonts/${DIR} -type f -name 'font.*' \ |
| 650 | -exec chmod 0644 {} \; |
622 | -exec chmod 0644 {} \; |
| 651 | done |
623 | done |
| 652 | eend 0 |
624 | eend 0 |
| 653 | } |
625 | } |
| 654 | |
626 | |