/[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.100 Revision 1.109
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.109 2009/05/14 12:40:55 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.
15# All you need to do in a basic ebuild is inherit this eclass and set 15# All you need to do in a basic ebuild is inherit this eclass and set
16# DESCRIPTION, KEYWORDS and RDEPEND/DEPEND. If your package is hosted 16# DESCRIPTION, KEYWORDS and RDEPEND/DEPEND. If your package is hosted
17# with the other X packages, you don't need to set SRC_URI. Pretty much 17# with the other X packages, you don't need to set SRC_URI. Pretty much
18# everything else should be automatic. 18# everything else should be automatic.
19 19
20if [[ ${PV} = 9999* ]]; then
21 GIT_ECLASS="git"
22 SNAPSHOT="yes"
23 SRC_URI=""
24fi
25
26# If we're a font package, but not the font.alias one
27FONT_ECLASS=""
28if [[ "${PN/#font-}" != "${PN}" ]] \
29 && [[ "${CATEGORY}" = "media-fonts" ]] \
30 && [[ "${PN}" != "font-alias" ]] \
31 && [[ "${PN}" != "font-util" ]]; then
32 # Activate font code in the rest of the eclass
33 FONT="yes"
34
35 # Whether to inherit the font eclass
36 FONT_ECLASS="font"
37fi
38
39inherit eutils libtool multilib toolchain-funcs flag-o-matic autotools \
40 ${FONT_ECLASS} ${GIT_ECLASS}
41
42EXPORTED_FUNCTIONS="src_unpack src_compile src_install pkg_preinst pkg_postinst pkg_postrm"
43
44case "${EAPI:-0}" in
45 0|1)
46 ;;
47 2)
48 EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare src_configure"
49 ;;
50 *)
51 die "Unknown EAPI ${EAPI}"
52 ;;
53esac
54
55# exports must be ALWAYS after inherit
56EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS}
57
20# @ECLASS-VARIABLE: XDIR 58# @ECLASS-VARIABLE: XDIR
21# @DESCRIPTION: 59# @DESCRIPTION:
22# Directory prefix to use for everything. If you want to install to a 60# Directory prefix to use for everything. If you want to install to a
23# non-default prefix (e.g., /opt/xorg), change XDIR. This has not been 61# non-default prefix (e.g., /opt/xorg), change XDIR. This has not been
24# recently tested. You may need to uncomment the setting of datadir and 62# recently tested. You may need to uncomment the setting of datadir and
35# If set to 'yes' and configure.ac exists, eautoreconf will run. Set 73# If set to 'yes' and configure.ac exists, eautoreconf will run. Set
36# before inheriting this eclass. 74# before inheriting this eclass.
37 SNAPSHOT="no" 75 SNAPSHOT="no"
38fi 76fi
39 77
40if [[ ${PV} = 9999* ]]; then
41 GIT_ECLASS="git"
42 SNAPSHOT="yes"
43 SRC_URI=""
44fi
45
46# Set up SRC_URI for individual modular releases 78# Set up SRC_URI for individual modular releases
47BASE_INDIVIDUAL_URI="http://xorg.freedesktop.org/releases/individual" 79BASE_INDIVIDUAL_URI="http://xorg.freedesktop.org/releases/individual"
48# @ECLASS-VARIABLE: MODULE 80# @ECLASS-VARIABLE: MODULE
49# @DESCRIPTION: 81# @DESCRIPTION:
50# The subdirectory to download source from. Possible settings are app, 82# The subdirectory to download source from. Possible settings are app,
51# doc, data, util, driver, font, lib, proto, xserver. Set above the 83# doc, data, util, driver, font, lib, proto, xserver. Set above the
52# inherit to override the default autoconfigured module. 84# inherit to override the default autoconfigured module.
53[[ -z ${MODULE} ]] && MODULE="" 85if [[ -z ${MODULE} ]]; then
86 MODULE=""
54case ${CATEGORY} in 87 case ${CATEGORY} in
55 app-doc) MODULE="doc" ;; 88 app-doc) MODULE="doc" ;;
56 media-fonts) MODULE="font" ;; 89 media-fonts) MODULE="font" ;;
57 x11-apps|x11-wm) MODULE="app" ;; 90 x11-apps|x11-wm) MODULE="app" ;;
58 x11-misc|x11-themes) MODULE="util" ;; 91 x11-misc|x11-themes) MODULE="util" ;;
59 x11-drivers) MODULE="driver" ;; 92 x11-drivers) MODULE="driver" ;;
60 x11-base) MODULE="xserver" ;; 93 x11-base) MODULE="xserver" ;;
61 x11-proto) MODULE="proto" ;; 94 x11-proto) MODULE="proto" ;;
62 x11-libs) MODULE="lib" ;; 95 x11-libs) MODULE="lib" ;;
63esac 96 esac
97fi
64 98
65if [[ -n ${GIT_ECLASS} ]]; then 99if [[ -n ${GIT_ECLASS} ]]; then
66 EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/${MODULE}/${PN}" 100 EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/${MODULE}/${PN}"
67else 101else
68 SRC_URI="${SRC_URI} ${BASE_INDIVIDUAL_URI}/${MODULE}/${P}.tar.bz2" 102 SRC_URI="${SRC_URI} ${BASE_INDIVIDUAL_URI}/${MODULE}/${P}.tar.bz2"
82 >=sys-devel/m4-1.4" 116 >=sys-devel/m4-1.4"
83 WANT_AUTOCONF="latest" 117 WANT_AUTOCONF="latest"
84 WANT_AUTOMAKE="latest" 118 WANT_AUTOMAKE="latest"
85fi 119fi
86 120
87# If we're a font package, but not the font.alias one 121if [[ -n "${FONT}" ]]; then
88FONT_ECLASS=""
89if [[ "${PN/#font-}" != "${PN}" ]] \
90 && [[ "${CATEGORY}" = "media-fonts" ]] \
91 && [[ "${PN}" != "font-alias" ]] \
92 && [[ "${PN}" != "font-util" ]]; then
93 # Activate font code in the rest of the eclass
94 FONT="yes"
95
96 # Whether to inherit the font eclass
97 FONT_ECLASS="font"
98
99 RDEPEND="${RDEPEND} 122 RDEPEND="${RDEPEND}
100 media-fonts/encodings 123 media-fonts/encodings
101 x11-apps/mkfontscale 124 x11-apps/mkfontscale
102 x11-apps/mkfontdir" 125 x11-apps/mkfontdir"
103 PDEPEND="${PDEPEND} 126 PDEPEND="${PDEPEND}
166RDEPEND="${RDEPEND} 189RDEPEND="${RDEPEND}
167 !<=x11-base/xorg-x11-6.9" 190 !<=x11-base/xorg-x11-6.9"
168# Provides virtual/x11 for temporary use until packages are ported 191# Provides virtual/x11 for temporary use until packages are ported
169# x11-base/x11-env" 192# x11-base/x11-env"
170 193
171inherit eutils libtool multilib toolchain-funcs flag-o-matic autotools \
172 ${FONT_ECLASS} ${GIT_ECLASS}
173
174# @FUNCTION: x-modular_specs_check 194# @FUNCTION: x-modular_specs_check
175# @USAGE: 195# @USAGE:
176# @DESCRIPTION: 196# @DESCRIPTION:
177# Make any necessary changes related to gcc specs (generally hardened) 197# Make any necessary changes related to gcc specs (generally hardened)
178x-modular_specs_check() { 198x-modular_specs_check() {
188# @DESCRIPTION: 208# @DESCRIPTION:
189# Ensures the server supports DRI if building a driver with DRI support 209# Ensures the server supports DRI if building a driver with DRI support
190x-modular_dri_check() { 210x-modular_dri_check() {
191 # (#120057) Enabling DRI in drivers requires that the server was built with 211 # (#120057) Enabling DRI in drivers requires that the server was built with
192 # support for it 212 # support for it
213 # Starting with xorg-server 1.5.3, DRI support is always enabled unless
214 # USE=minimal is set (see bug #252084)
193 if [[ -n "${DRIVER}" ]]; then 215 if [[ -n "${DRIVER}" ]]; then
194 if has dri ${IUSE} && use dri; then 216 if has dri ${IUSE} && use dri; then
195 einfo "Checking for direct rendering capabilities ..." 217 einfo "Checking for direct rendering capabilities ..."
218 if has_version '>=x11-base/xorg-server-1.5.3'; then
219 if built_with_use x11-base/xorg-server minimal; then
220 die "You must build x11-base/xorg-server with USE=-minimal."
221 fi
222 else
196 if ! built_with_use x11-base/xorg-server dri; then 223 if ! built_with_use x11-base/xorg-server dri; then
197 die "You must build x11-base/xorg-server with USE=dri." 224 die "You must build x11-base/xorg-server with USE=dri."
225 fi
198 fi 226 fi
199 fi 227 fi
200 fi 228 fi
201} 229}
202 230
225 if [[ -n ${GIT_ECLASS} ]]; then 253 if [[ -n ${GIT_ECLASS} ]]; then
226 git_src_unpack 254 git_src_unpack
227 else 255 else
228 unpack ${A} 256 unpack ${A}
229 fi 257 fi
230 cd ${S} 258 cd "${S}"
231 259
232 if [[ -n ${FONT_OPTIONS} ]]; then 260 if [[ -n ${FONT_OPTIONS} ]]; then
233 einfo "Detected font directory: ${FONT_DIR}" 261 einfo "Detected font directory: ${FONT_DIR}"
234 fi 262 fi
235} 263}
285 # Joshua Baergen - October 23, 2005 313 # Joshua Baergen - October 23, 2005
286 # Fix shared lib issues on MIPS, FBSD, etc etc 314 # Fix shared lib issues on MIPS, FBSD, etc etc
287 elibtoolize 315 elibtoolize
288} 316}
289 317
318# @FUNCTION: x-modular_src_prepare
319# @USAGE:
320# @DESCRIPTION:
321# Prepare a package after unpacking, performing all X-related tasks.
322x-modular_src_prepare() {
323 [[ -n ${GIT_ECLASS} ]] && has src_prepare ${EXPORTED_FUNCTIONS} \
324 && git_src_prepare
325 x-modular_patch_source
326 x-modular_reconf_source
327}
328
290# @FUNCTION: x-modular_src_unpack 329# @FUNCTION: x-modular_src_unpack
291# @USAGE: 330# @USAGE:
292# @DESCRIPTION: 331# @DESCRIPTION:
293# Unpack a package, performing all X-related tasks. 332# Unpack a package, performing all X-related tasks.
294x-modular_src_unpack() { 333x-modular_src_unpack() {
295 x-modular_specs_check 334 x-modular_specs_check
296 x-modular_server_supports_drivers_check 335 x-modular_server_supports_drivers_check
297 x-modular_dri_check 336 x-modular_dri_check
298 x-modular_unpack_source 337 x-modular_unpack_source
299 x-modular_patch_source 338 has src_prepare ${EXPORTED_FUNCTIONS} || x-modular_src_prepare
300 x-modular_reconf_source
301} 339}
302 340
303# @FUNCTION: x-modular_font_configure 341# @FUNCTION: x-modular_font_configure
304# @USAGE: 342# @USAGE:
305# @DESCRIPTION: 343# @DESCRIPTION:
373# Run make. 411# Run make.
374x-modular_src_make() { 412x-modular_src_make() {
375 emake || die "emake failed" 413 emake || die "emake failed"
376} 414}
377 415
378# @FUNCTION: x-modular_src_configure 416# @FUNCTION: x-modular_src_compile
379# @USAGE: 417# @USAGE:
380# @DESCRIPTION: 418# @DESCRIPTION:
381# Compile a package, performing all X-related tasks. 419# Compile a package, performing all X-related tasks.
382x-modular_src_compile() { 420x-modular_src_compile() {
383 x-modular_src_configure 421 has src_configure ${EXPORTED_FUNCTIONS} || x-modular_src_configure
384 x-modular_src_make 422 x-modular_src_make
385} 423}
386 424
387# @FUNCTION: x-modular_src_install 425# @FUNCTION: x-modular_src_install
388# @USAGE: 426# @USAGE:
389# @DESCRIPTION: 427# @DESCRIPTION:
390# Install a built package to ${D}, performing any necessary steps. 428# Install a built package to ${D}, performing any necessary steps.
391# Creates a ChangeLog from git if using live ebuilds. 429# Creates a ChangeLog from git if using live ebuilds.
392x-modular_src_install() { 430x-modular_src_install() {
393 # Install everything to ${XDIR} 431 # Install everything to ${XDIR}
432 if [[ ${CATEGORY} = x11-proto ]]; then
394 make \ 433 make \
434 ${PN/proto/}docdir=/usr/share/doc/${PF} \
395 DESTDIR="${D}" \ 435 DESTDIR="${D}" \
396 install 436 install \
437 || die
438 else
439 make \
440 DESTDIR="${D}" \
441 install \
442 || die
443 fi
397# Shouldn't be necessary in XDIR=/usr 444# Shouldn't be necessary in XDIR=/usr
398# einstall forces datadir, so we need to re-force it 445# einstall forces datadir, so we need to re-force it
399# datadir=${XDIR}/share \ 446# datadir=${XDIR}/share \
400# mandir=${XDIR}/share/man \ 447# mandir=${XDIR}/share/man \
401 448
404 git log ${GIT_TREE} > "${S}"/ChangeLog 451 git log ${GIT_TREE} > "${S}"/ChangeLog
405 popd 452 popd
406 fi 453 fi
407 454
408 if [[ -e ${S}/ChangeLog ]]; then 455 if [[ -e ${S}/ChangeLog ]]; then
409 dodoc ${S}/ChangeLog 456 dodoc "${S}"/ChangeLog
410 fi 457 fi
411# @VARIABLE: DOCS 458# @VARIABLE: DOCS
412# @DESCRIPTION: 459# @DESCRIPTION:
413# Any documentation to install 460# Any documentation to install
414 [[ -n ${DOCS} ]] && dodoc ${DOCS} 461 [[ -n ${DOCS} ]] && dodoc ${DOCS}
415 462
416 # Make sure docs get compressed
417 prepalldocs
418
419 # Don't install libtool archives for server modules 463 # Don't install libtool archives for server modules
420 if [[ -e ${D}/usr/$(get_libdir)/xorg/modules ]]; then 464 if [[ -e ${D}/usr/$(get_libdir)/xorg/modules ]]; then
421 find ${D}/usr/$(get_libdir)/xorg/modules -name '*.la' \ 465 find "${D}"/usr/$(get_libdir)/xorg/modules -name '*.la' \
422 | xargs rm -f 466 | xargs rm -f
423 fi 467 fi
424 468
425 if [[ -n "${FONT}" ]]; then 469 if [[ -n "${FONT}" ]]; then
426 remove_font_metadata 470 remove_font_metadata
529 for DIR in ${FONT_DIR}; do 573 for DIR in ${FONT_DIR}; do
530 if [[ "${DIR}" != "Speedo" ]] && \ 574 if [[ "${DIR}" != "Speedo" ]] && \
531 [[ "${DIR}" != "CID" ]] ; then 575 [[ "${DIR}" != "CID" ]] ; then
532 # Delete font metadata files 576 # Delete font metadata files
533 # fonts.scale, fonts.dir, fonts.cache-1 577 # fonts.scale, fonts.dir, fonts.cache-1
534 rm -f ${D}/usr/share/fonts/${DIR}/fonts.{scale,dir,cache-1} 578 rm -f "${D}"/usr/share/fonts/${DIR}/fonts.{scale,dir,cache-1}
535 fi 579 fi
536 done 580 done
537} 581}
538 582
539# @FUNCTION: install_driver_hwdata 583# @FUNCTION: install_driver_hwdata
578 # NOTE: There is no way to regenerate Speedo/CID fonts.scale 622 # NOTE: There is no way to regenerate Speedo/CID fonts.scale
579 # <dberkholz@gentoo.org> 2 August 2004 623 # <dberkholz@gentoo.org> 2 August 2004
580 if [[ "${x/encodings}" = "${x}" ]] \ 624 if [[ "${x/encodings}" = "${x}" ]] \
581 && [[ -n "$(find ${x} -iname '*.[pot][ft][abcf]' -print)" ]]; then 625 && [[ -n "$(find ${x} -iname '*.[pot][ft][abcf]' -print)" ]]; then
582 mkfontscale \ 626 mkfontscale \
583 -a ${ROOT}/usr/share/fonts/encodings/encodings.dir \ 627 -a "${ROOT}"/usr/share/fonts/encodings/encodings.dir \
584 -- ${x} 628 -- ${x}
585 fi 629 fi
586 done 630 done
587 eend 0 631 eend 0
588} 632}
598 [[ -z "$(ls ${x}/)" ]] && continue 642 [[ -z "$(ls ${x}/)" ]] && continue
599 [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue 643 [[ "$(ls ${x}/)" = "fonts.cache-1" ]] && continue
600 644
601 if [[ "${x/encodings}" = "${x}" ]]; then 645 if [[ "${x/encodings}" = "${x}" ]]; then
602 mkfontdir \ 646 mkfontdir \
603 -e ${ROOT}/usr/share/fonts/encodings \ 647 -e "${ROOT}"/usr/share/fonts/encodings \
604 -e ${ROOT}/usr/share/fonts/encodings/large \ 648 -e "${ROOT}"/usr/share/fonts/encodings/large \
605 -- ${x} 649 -- ${x}
606 fi 650 fi
607 done 651 done
608 eend 0 652 eend 0
609} 653}
613# @DESCRIPTION: 657# @DESCRIPTION:
614# Font files should have 644 permissions. Ensure this is the case. 658# Font files should have 644 permissions. Ensure this is the case.
615fix_font_permissions() { 659fix_font_permissions() {
616 ebegin "Fixing permissions" 660 ebegin "Fixing permissions"
617 for DIR in ${FONT_DIR}; do 661 for DIR in ${FONT_DIR}; do
618 find ${ROOT}/usr/share/fonts/${DIR} -type f -name 'font.*' \ 662 find "${ROOT}"/usr/share/fonts/${DIR} -type f -name 'font.*' \
619 -exec chmod 0644 {} \; 663 -exec chmod 0644 {} \;
620 done 664 done
621 eend 0 665 eend 0
622} 666}
623 667
627# Create fonts.cache-1 files, used by the new client-side fonts 671# Create fonts.cache-1 files, used by the new client-side fonts
628# subsystem. 672# subsystem.
629create_font_cache() { 673create_font_cache() {
630 font_pkg_postinst 674 font_pkg_postinst
631} 675}
632
633EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_preinst pkg_postinst pkg_postrm

Legend:
Removed from v.1.100  
changed lines
  Added in v.1.109

  ViewVC Help
Powered by ViewVC 1.1.20