/[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.92 Revision 1.107
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.92 2008/02/22 05:10:03 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.
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.
27XDIR="/usr" 27XDIR="/usr"
28 28
29if [[ -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"
38fi
39
40IUSE="" 29IUSE=""
41HOMEPAGE="http://xorg.freedesktop.org/" 30HOMEPAGE="http://xorg.freedesktop.org/"
42 31
32if [[ -z ${SNAPSHOT} ]]; then
43# @ECLASS-VARIABLE: SNAPSHOT 33# @ECLASS-VARIABLE: SNAPSHOT
44# @DESCRIPTION: 34# @DESCRIPTION:
45# If set to 'yes' and configure.ac exists, eautoreconf will run. Set 35# If set to 'yes' and configure.ac exists, eautoreconf will run. Set
46# before inheriting this eclass. 36# before inheriting this eclass.
47SNAPSHOT="no" 37 SNAPSHOT="no"
38fi
48 39
49if [[ ${PV} = 9999* ]]; then 40if [[ ${PV} = 9999* ]]; then
50 GIT_ECLASS="git" 41 GIT_ECLASS="git"
51 SNAPSHOT="yes" 42 SNAPSHOT="yes"
52 SRC_URI="" 43 SRC_URI=""
53fi 44fi
54 45
55# Set up SRC_URI for individual modular releases 46# Set up SRC_URI for individual modular releases
56BASE_INDIVIDUAL_URI="http://xorg.freedesktop.org/releases/individual" 47BASE_INDIVIDUAL_URI="http://xorg.freedesktop.org/releases/individual"
57if [[ ${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.
53if [[ -z ${MODULE} ]]; then
58 MODULE="app" 54 MODULE=""
59elif [[ ${CATEGORY} = app-doc ]]; then 55 case ${CATEGORY} in
60 MODULE="doc" 56 app-doc) MODULE="doc" ;;
61# x11-misc contains data and util, x11-themes contains data 57 media-fonts) MODULE="font" ;;
62elif [[ ${CATEGORY} = x11-misc ]] || [[ ${CATEGORY} = x11-themes ]]; then 58 x11-apps|x11-wm) MODULE="app" ;;
63 if [[ ${PN} == xbitmaps || ${PN} == xcursor-themes || ${PN} == xkbdata ]]; then 59 x11-misc|x11-themes) MODULE="util" ;;
64 MODULE="data" 60 x11-drivers) MODULE="driver" ;;
65 else 61 x11-base) MODULE="xserver" ;;
66 MODULE="data" 62 x11-proto) MODULE="proto" ;;
67 fi 63 x11-libs) MODULE="lib" ;;
68elif [[ ${CATEGORY} = x11-drivers ]]; then 64 esac
69 MODULE="driver"
70elif [[ ${CATEGORY} = media-fonts ]]; then
71 MODULE="font"
72elif [[ ${CATEGORY} = x11-libs ]]; then
73 MODULE="lib"
74elif [[ ${CATEGORY} = x11-proto ]]; then
75 MODULE="proto"
76elif [[ ${CATEGORY} = x11-base ]]; then
77 MODULE="xserver"
78fi 65fi
79 66
80if [[ -n ${GIT_ECLASS} ]]; then 67if [[ -n ${GIT_ECLASS} ]]; then
81 EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/${MODULE}/${PN}" 68 EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/${MODULE}/${PN}"
82else 69else
141 128
142 # Set up configure option 129 # Set up configure option
143 FONT_OPTIONS="--with-fontdir=\"/usr/share/fonts/${FONT_DIR}\"" 130 FONT_OPTIONS="--with-fontdir=\"/usr/share/fonts/${FONT_DIR}\""
144 131
145 if [[ -n "${FONT}" ]]; then 132 if [[ -n "${FONT}" ]]; then
146 if [[ ${PN##*-} = misc ]] || [[ ${PN##*-} = 75dpi ]] || [[ ${PN##*-} = 100dpi ]]; then 133 if [[ ${PN##*-} = misc ]] || [[ ${PN##*-} = 75dpi ]] || [[ ${PN##*-} = 100dpi ]] || [[ ${PN##*-} = cyrillic ]]; then
147 IUSE="${IUSE} nls" 134 IUSE="${IUSE} nls"
148 fi 135 fi
149 fi 136 fi
150fi 137fi
151 138
152# If we're a driver package 139# If we're a driver package
153if [[ "${PN/#xf86-video}" != "${PN}" ]] || [[ "${PN/#xf86-input}" != "${PN}" ]]; then 140if [[ "${PN/#xf86-video}" != "${PN}" ]] || [[ "${PN/#xf86-input}" != "${PN}" ]]; then
154 # Enable driver code in the rest of the eclass 141 # Enable driver code in the rest of the eclass
155 DRIVER="yes" 142 DRIVER="yes"
156
157 if [[ ${XDPVER} != -1 ]]; then
158 # Add driver patchset to SRC_URI
159 SRC_URI="${SRC_URI}
160 mirror://gentoo/x11-driver-patches-${XDPVER}.tar.bz2"
161 fi
162fi 143fi
163 144
164# Debugging -- ignore packages that can't be built with debugging 145# Debugging -- ignore packages that can't be built with debugging
165if [[ -z "${FONT}" ]] \ 146if [[ -z "${FONT}" ]] \
166 && [[ "${CATEGORY/app-doc}" = "${CATEGORY}" ]] \ 147 && [[ "${CATEGORY/app-doc}" = "${CATEGORY}" ]] \
209# @DESCRIPTION: 190# @DESCRIPTION:
210# 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
211x-modular_dri_check() { 192x-modular_dri_check() {
212 # (#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
213 # 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)
214 if [[ -n "${DRIVER}" ]]; then 197 if [[ -n "${DRIVER}" ]]; then
215 if has dri ${IUSE} && use dri; then 198 if has dri ${IUSE} && use dri; then
216 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
217 if ! built_with_use x11-base/xorg-server dri; then 205 if ! built_with_use x11-base/xorg-server dri; then
218 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
219 fi 208 fi
220 fi 209 fi
221 fi 210 fi
222} 211}
223 212
246 if [[ -n ${GIT_ECLASS} ]]; then 235 if [[ -n ${GIT_ECLASS} ]]; then
247 git_src_unpack 236 git_src_unpack
248 else 237 else
249 unpack ${A} 238 unpack ${A}
250 fi 239 fi
251 cd ${S} 240 cd "${S}"
252 241
253 if [[ -n ${FONT_OPTIONS} ]]; then 242 if [[ -n ${FONT_OPTIONS} ]]; then
254 einfo "Detected font directory: ${FONT_DIR}" 243 einfo "Detected font directory: ${FONT_DIR}"
255 fi 244 fi
256} 245}
265 # See epatch() in eutils.eclass for more documentation 254 # See epatch() in eutils.eclass for more documentation
266 if [[ -z "${EPATCH_SUFFIX}" ]] ; then 255 if [[ -z "${EPATCH_SUFFIX}" ]] ; then
267 EPATCH_SUFFIX="patch" 256 EPATCH_SUFFIX="patch"
268 fi 257 fi
269 258
270 # If this is a driver package we need to fix man page install location.
271 # Running autoreconf will use the patched util-macros to make the
272 # change for us, so we only need to patch if it is not going to run.
273 if [[ -n "${DRIVER}" ]] && [[ "${SNAPSHOT}" != "yes" ]]\
274 && [[ ${XDPVER} != -1 ]]; then
275 PATCHES="${PATCHES} ${DISTDIR}/x11-driver-patches-${XDPVER}.tar.bz2"
276 fi
277
278# @VARIABLE: PATCHES 259# @VARIABLE: PATCHES
279# @DESCRIPTION: 260# @DESCRIPTION:
280# If you have any patches to apply, set PATCHES to their locations and epatch 261# If you have any patches to apply, set PATCHES to their locations and epatch
281# will apply them. It also handles epatch-style bulk patches, if you know how to 262# will apply them. It also handles epatch-style bulk patches, if you know how to
282# use them and set the correct variables. If you don't, read eutils.eclass. 263# use them and set the correct variables. If you don't, read eutils.eclass.
264 if [[ ${#PATCHES[@]} -gt 1 ]]; then
265 for x in "${PATCHES[@]}"; do
266 epatch "${x}"
267 done
283 if [[ -n "${PATCHES}" ]] ; then 268 elif [[ -n "${PATCHES}" ]]; then
284 for PATCH in ${PATCHES} 269 for x in ${PATCHES}; do
285 do
286 epatch ${PATCH} 270 epatch "${x}"
287 done 271 done
288 # For non-default directory bulk patching 272 # For non-default directory bulk patching
289 elif [[ -n "${PATCH_LOC}" ]] ; then 273 elif [[ -n "${PATCH_LOC}" ]] ; then
290 epatch ${PATCH_LOC} 274 epatch ${PATCH_LOC}
291 # For standard bulk patching 275 # For standard bulk patching
379 x-modular_debug_setup 363 x-modular_debug_setup
380 364
381# @VARIABLE: CONFIGURE_OPTIONS 365# @VARIABLE: CONFIGURE_OPTIONS
382# @DESCRIPTION: 366# @DESCRIPTION:
383# Any options to pass to configure 367# Any options to pass to configure
384[[ -n ${CONFIGURE_OPTIONTS} ]] 368[[ -n ${CONFIGURE_OPTIONS} ]]
385 369
386 # If prefix isn't set here, .pc files cause problems 370 # If prefix isn't set here, .pc files cause problems
387 if [[ -x ${ECONF_SOURCE:-.}/configure ]]; then 371 if [[ -x ${ECONF_SOURCE:-.}/configure ]]; then
388 econf --prefix=${XDIR} \ 372 econf --prefix=${XDIR} \
389 --datadir=${XDIR}/share \ 373 --datadir=${XDIR}/share \
415# @DESCRIPTION: 399# @DESCRIPTION:
416# Install a built package to ${D}, performing any necessary steps. 400# Install a built package to ${D}, performing any necessary steps.
417# Creates a ChangeLog from git if using live ebuilds. 401# Creates a ChangeLog from git if using live ebuilds.
418x-modular_src_install() { 402x-modular_src_install() {
419 # Install everything to ${XDIR} 403 # Install everything to ${XDIR}
404 if [[ ${CATEGORY} = x11-proto ]]; then
420 make \ 405 make \
406 ${PN/proto/}docdir=/usr/share/doc/${PF} \
421 DESTDIR="${D}" \ 407 DESTDIR="${D}" \
422 install 408 install \
409 || die
410 else
411 make \
412 DESTDIR="${D}" \
413 install \
414 || die
415 fi
423# Shouldn't be necessary in XDIR=/usr 416# Shouldn't be necessary in XDIR=/usr
424# einstall forces datadir, so we need to re-force it 417# einstall forces datadir, so we need to re-force it
425# datadir=${XDIR}/share \ 418# datadir=${XDIR}/share \
426# mandir=${XDIR}/share/man \ 419# mandir=${XDIR}/share/man \
427 420
430 git log ${GIT_TREE} > "${S}"/ChangeLog 423 git log ${GIT_TREE} > "${S}"/ChangeLog
431 popd 424 popd
432 fi 425 fi
433 426
434 if [[ -e ${S}/ChangeLog ]]; then 427 if [[ -e ${S}/ChangeLog ]]; then
435 dodoc ${S}/ChangeLog 428 dodoc "${S}"/ChangeLog
436 fi 429 fi
437# @VARIABLE: DOCS 430# @VARIABLE: DOCS
438# @DESCRIPTION: 431# @DESCRIPTION:
439# Any documentation to install 432# Any documentation to install
440 [[ -n ${DOCS} ]] && dodoc ${DOCS} 433 [[ -n ${DOCS} ]] && dodoc ${DOCS}
441 434
442 # Make sure docs get compressed
443 prepalldocs
444
445 # Don't install libtool archives for server modules 435 # Don't install libtool archives for server modules
446 if [[ -e ${D}/usr/$(get_libdir)/xorg/modules ]]; then 436 if [[ -e ${D}/usr/$(get_libdir)/xorg/modules ]]; then
447 find ${D}/usr/$(get_libdir)/xorg/modules -name '*.la' \ 437 find "${D}"/usr/$(get_libdir)/xorg/modules -name '*.la' \
448 | xargs rm -f 438 | xargs rm -f
449 fi 439 fi
450 440
451 if [[ -n "${FONT}" ]]; then 441 if [[ -n "${FONT}" ]]; then
452 remove_font_metadata 442 remove_font_metadata
555 for DIR in ${FONT_DIR}; do 545 for DIR in ${FONT_DIR}; do
556 if [[ "${DIR}" != "Speedo" ]] && \ 546 if [[ "${DIR}" != "Speedo" ]] && \
557 [[ "${DIR}" != "CID" ]] ; then 547 [[ "${DIR}" != "CID" ]] ; then
558 # Delete font metadata files 548 # Delete font metadata files
559 # fonts.scale, fonts.dir, fonts.cache-1 549 # fonts.scale, fonts.dir, fonts.cache-1
560 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}
561 fi 551 fi
562 done 552 done
563} 553}
564 554
565# @FUNCTION: install_driver_hwdata 555# @FUNCTION: install_driver_hwdata
604 # NOTE: There is no way to regenerate Speedo/CID fonts.scale 594 # NOTE: There is no way to regenerate Speedo/CID fonts.scale
605 # <dberkholz@gentoo.org> 2 August 2004 595 # <dberkholz@gentoo.org> 2 August 2004
606 if [[ "${x/encodings}" = "${x}" ]] \ 596 if [[ "${x/encodings}" = "${x}" ]] \
607 && [[ -n "$(find ${x} -iname '*.[pot][ft][abcf]' -print)" ]]; then 597 && [[ -n "$(find ${x} -iname '*.[pot][ft][abcf]' -print)" ]]; then
608 mkfontscale \ 598 mkfontscale \
609 -a ${ROOT}/usr/share/fonts/encodings/encodings.dir \ 599 -a "${ROOT}"/usr/share/fonts/encodings/encodings.dir \
610 -- ${x} 600 -- ${x}
611 fi 601 fi
612 done 602 done
613 eend 0 603 eend 0
614} 604}
624 [[ -z "$(ls ${x}/)" ]] && continue 614 [[ -z "$(ls ${x}/)" ]] && continue
625 [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue 615 [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue
626 616
627 if [[ "${x/encodings}" = "${x}" ]]; then 617 if [[ "${x/encodings}" = "${x}" ]]; then
628 mkfontdir \ 618 mkfontdir \
629 -e ${ROOT}/usr/share/fonts/encodings \ 619 -e "${ROOT}"/usr/share/fonts/encodings \
630 -e ${ROOT}/usr/share/fonts/encodings/large \ 620 -e "${ROOT}"/usr/share/fonts/encodings/large \
631 -- ${x} 621 -- ${x}
632 fi 622 fi
633 done 623 done
634 eend 0 624 eend 0
635} 625}
639# @DESCRIPTION: 629# @DESCRIPTION:
640# Font files should have 644 permissions. Ensure this is the case. 630# Font files should have 644 permissions. Ensure this is the case.
641fix_font_permissions() { 631fix_font_permissions() {
642 ebegin "Fixing permissions" 632 ebegin "Fixing permissions"
643 for DIR in ${FONT_DIR}; do 633 for DIR in ${FONT_DIR}; do
644 find ${ROOT}/usr/share/fonts/${DIR} -type f -name 'font.*' \ 634 find "${ROOT}"/usr/share/fonts/${DIR} -type f -name 'font.*' \
645 -exec chmod 0644 {} \; 635 -exec chmod 0644 {} \;
646 done 636 done
647 eend 0 637 eend 0
648} 638}
649 639

Legend:
Removed from v.1.92  
changed lines
  Added in v.1.107

  ViewVC Help
Powered by ViewVC 1.1.20