/[gentoo-x86]/eclass/xorg-2.eclass
Gentoo

Diff of /eclass/xorg-2.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.44 Revision 1.60
1# Copyright 1999-2010 Gentoo Foundation 1# Copyright 1999-2013 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/xorg-2.eclass,v 1.44 2011/05/14 16:27:50 scarabeus Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/xorg-2.eclass,v 1.60 2013/01/31 14:12:12 chithanh Exp $
4# 4
5# @ECLASS: xorg-2.eclass 5# @ECLASS: xorg-2.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# x11@gentoo.org 7# x11@gentoo.org
8# @AUTHOR:
9# Author: Tomáš Chvátal <scarabeus@gentoo.org>
10# Author: Donnie Berkholz <dberkholz@gentoo.org>
8# @BLURB: Reduces code duplication in the modularized X11 ebuilds. 11# @BLURB: Reduces code duplication in the modularized X11 ebuilds.
9# @DESCRIPTION: 12# @DESCRIPTION:
10# This eclass makes trivial X ebuilds possible for apps, fonts, drivers, 13# This eclass makes trivial X ebuilds possible for apps, fonts, drivers,
11# and more. Many things that would normally be done in various functions 14# and more. Many things that would normally be done in various functions
12# can be accessed by setting variables instead, such as patching, 15# can be accessed by setting variables instead, such as patching,
15# All you need to do in a basic ebuild is inherit this eclass and set 18# 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 19# 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 20# with the other X packages, you don't need to set SRC_URI. Pretty much
18# everything else should be automatic. 21# everything else should be automatic.
19 22
20# Author: Tomáš Chvátal <scarabeus@gentoo.org>
21# Author: Donnie Berkholz <dberkholz@gentoo.org>
22
23GIT_ECLASS="" 23GIT_ECLASS=""
24if [[ ${PV} == *9999* ]]; then 24if [[ ${PV} == *9999* ]]; then
25 GIT_ECLASS="git-2" 25 GIT_ECLASS="git-2"
26 XORG_EAUTORECONF="yes" 26 XORG_EAUTORECONF="yes"
27fi 27fi
35 # Activate font code in the rest of the eclass 35 # Activate font code in the rest of the eclass
36 FONT="yes" 36 FONT="yes"
37 FONT_ECLASS="font" 37 FONT_ECLASS="font"
38fi 38fi
39 39
40# we need to inherit autotools first to get the deps
40inherit autotools-utils eutils libtool multilib toolchain-funcs flag-o-matic autotools \ 41inherit autotools autotools-utils eutils libtool multilib toolchain-funcs \
41 ${FONT_ECLASS} ${GIT_ECLASS} 42 flag-o-matic ${FONT_ECLASS} ${GIT_ECLASS}
42 43
43EXPORTED_FUNCTIONS="src_unpack src_compile src_install pkg_postinst pkg_postrm" 44EXPORTED_FUNCTIONS="src_unpack src_compile src_install pkg_postinst pkg_postrm"
44case "${EAPI:-0}" in 45case "${EAPI:-0}" in
45 3|4) EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare src_configure" ;; 46 3|4|5) EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare src_configure" ;;
46 *) die "EAPI=${EAPI} is not supported" ;; 47 *) die "EAPI=${EAPI} is not supported" ;;
47esac 48esac
48 49
49# exports must be ALWAYS after inherit 50# exports must be ALWAYS after inherit
50EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS} 51EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS}
88# For git checkout the git repository might differ from package name. 89# For git checkout the git repository might differ from package name.
89# This variable can be used for proper directory specification 90# This variable can be used for proper directory specification
90: ${XORG_PACKAGE_NAME:=${PN}} 91: ${XORG_PACKAGE_NAME:=${PN}}
91 92
92if [[ -n ${GIT_ECLASS} ]]; then 93if [[ -n ${GIT_ECLASS} ]]; then
93 : ${EGIT_REPO_URI:="git://anongit.freedesktop.org/git/xorg/${XORG_MODULE}${XORG_PACKAGE_NAME}"} 94 : ${EGIT_REPO_URI:="git://anongit.freedesktop.org/xorg/${XORG_MODULE}${XORG_PACKAGE_NAME} http://anongit.freedesktop.org/git/xorg/${XORG_MODULE}${XORG_PACKAGE_NAME}"}
94elif [[ -n ${XORG_BASE_INDIVIDUAL_URI} ]]; then 95elif [[ -n ${XORG_BASE_INDIVIDUAL_URI} ]]; then
95 SRC_URI="${XORG_BASE_INDIVIDUAL_URI}/${XORG_MODULE}${P}.tar.bz2" 96 SRC_URI="${XORG_BASE_INDIVIDUAL_URI}/${XORG_MODULE}${P}.tar.bz2"
96fi 97fi
97 98
98: ${SLOT:=0} 99: ${SLOT:=0}
107XORG_EAUTORECONF_ARCHES="x86-interix ppc-aix x86-winnt" 108XORG_EAUTORECONF_ARCHES="x86-interix ppc-aix x86-winnt"
108EAUTORECONF_DEPEND+=" 109EAUTORECONF_DEPEND+="
109 >=sys-devel/libtool-2.2.6a 110 >=sys-devel/libtool-2.2.6a
110 sys-devel/m4" 111 sys-devel/m4"
111if [[ ${PN} != util-macros ]] ; then 112if [[ ${PN} != util-macros ]] ; then
112 EAUTORECONF_DEPEND+=" >=x11-misc/util-macros-1.13.0" 113 EAUTORECONF_DEPEND+=" >=x11-misc/util-macros-1.17"
113 # Required even by xorg-server 114 # Required even by xorg-server
114 [[ ${PN} == "font-util" ]] || EAUTORECONF_DEPEND+=" >=media-fonts/font-util-1.2.0" 115 [[ ${PN} == "font-util" ]] || EAUTORECONF_DEPEND+=" >=media-fonts/font-util-1.2.0"
115fi 116fi
116WANT_AUTOCONF="latest" 117WANT_AUTOCONF="latest"
117WANT_AUTOMAKE="latest" 118WANT_AUTOMAKE="latest"
173 && ${PN} != xorg-cf-files \ 174 && ${PN} != xorg-cf-files \
174 && ${PN/xcursor} = ${PN} ]]; then 175 && ${PN/xcursor} = ${PN} ]]; then
175 IUSE+=" static-libs" 176 IUSE+=" static-libs"
176fi 177fi
177 178
178DEPEND+=" >=dev-util/pkgconfig-0.23" 179DEPEND+=" virtual/pkgconfig"
179 180
180# @ECLASS-VARIABLE: XORG_DRI 181# @ECLASS-VARIABLE: XORG_DRI
181# @DESCRIPTION: 182# @DESCRIPTION:
182# Possible values are "always" or the value of the useflag DRI capabilities 183# Possible values are "always" or the value of the useflag DRI capabilities
183# are required for. Default value is "no" 184# are required for. Default value is "no"
267 IUSE+=" ${XORG_DOC}" 268 IUSE+=" ${XORG_DOC}"
268 ;; 269 ;;
269esac 270esac
270unset DOC_DEPEND 271unset DOC_DEPEND
271 272
273# @ECLASS-VARIABLE: XORG_MODULE_REBUILD
274# @DESCRIPTION:
275# Describes whether a package contains modules that need to be rebuilt on
276# xorg-server upgrade. This has an effect only since EAPI=5.
277# Possible values are "yes" or "no". Default value is "yes" for packages which
278# are recognized as DRIVER by this eclass and "no" for all other packages.
279if [[ "${DRIVER}" == yes ]]; then
280 : ${XORG_MODULE_REBUILD:="yes"}
281else
282 : ${XORG_MODULE_REBUILD:="no"}
283fi
284
285if [[ ${XORG_MODULE_REBUILD} == yes ]]; then
286 case ${EAPI} in
287 3|4)
288 ;;
289 *)
290 RDEPEND+=" x11-base/xorg-server:="
291 ;;
292 esac
293fi
294
272DEPEND+=" ${COMMON_DEPEND}" 295DEPEND+=" ${COMMON_DEPEND}"
273RDEPEND+=" ${COMMON_DEPEND}" 296RDEPEND+=" ${COMMON_DEPEND}"
274unset COMMON_DEPEND 297unset COMMON_DEPEND
275 298
276debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: DEPEND=${DEPEND}" 299debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: DEPEND=${DEPEND}"
311 # Patch directory is ${WORKDIR}/patch 334 # Patch directory is ${WORKDIR}/patch
312 # See epatch() in eutils.eclass for more documentation 335 # See epatch() in eutils.eclass for more documentation
313 EPATCH_SUFFIX=${EPATCH_SUFFIX:=patch} 336 EPATCH_SUFFIX=${EPATCH_SUFFIX:=patch}
314 337
315 [[ -d "${EPATCH_SOURCE}" ]] && epatch 338 [[ -d "${EPATCH_SOURCE}" ]] && epatch
316 autotools-utils_src_prepare "$@"
317} 339}
318 340
319# @FUNCTION: xorg-2_reconf_source 341# @FUNCTION: xorg-2_reconf_source
320# @DESCRIPTION: 342# @DESCRIPTION:
321# Run eautoreconf if necessary, and run elibtoolize. 343# Run eautoreconf if necessary, and run elibtoolize.
323 debug-print-function ${FUNCNAME} "$@" 345 debug-print-function ${FUNCNAME} "$@"
324 346
325 case ${CHOST} in 347 case ${CHOST} in
326 *-interix* | *-aix* | *-winnt*) 348 *-interix* | *-aix* | *-winnt*)
327 # some hosts need full eautoreconf 349 # some hosts need full eautoreconf
328 [[ -e "./configure.ac" || -e "./configure.in" ]] && eautoreconf || ewarn "Unable to autoreconf the configure script. Things may fail." 350 [[ -e "./configure.ac" || -e "./configure.in" ]] \
351 && AUTOTOOLS_AUTORECONF=1
329 ;; 352 ;;
330 *) 353 *)
331 # elibtoolize required for BSD 354 # elibtoolize required for BSD
332 [[ ${XORG_EAUTORECONF} != no && ( -e "./configure.ac" || -e "./configure.in" ) ]] && eautoreconf || elibtoolize 355 [[ ${XORG_EAUTORECONF} != no && ( -e "./configure.ac" || -e "./configure.in" ) ]] \
356 && AUTOTOOLS_AUTORECONF=1
333 ;; 357 ;;
334 esac 358 esac
335} 359}
336 360
337# @FUNCTION: xorg-2_src_prepare 361# @FUNCTION: xorg-2_src_prepare
340xorg-2_src_prepare() { 364xorg-2_src_prepare() {
341 debug-print-function ${FUNCNAME} "$@" 365 debug-print-function ${FUNCNAME} "$@"
342 366
343 xorg-2_patch_source 367 xorg-2_patch_source
344 xorg-2_reconf_source 368 xorg-2_reconf_source
369 autotools-utils_src_prepare "$@"
345} 370}
346 371
347# @FUNCTION: xorg-2_font_configure 372# @FUNCTION: xorg-2_font_configure
348# @DESCRIPTION: 373# @DESCRIPTION:
349# If a font package, perform any necessary configuration steps 374# If a font package, perform any necessary configuration steps
408 # @DESCRIPTION: 433 # @DESCRIPTION:
409 # Array of an additional options to pass to configure. 434 # Array of an additional options to pass to configure.
410 # @DEFAULT_UNSET 435 # @DEFAULT_UNSET
411 if [[ $(declare -p XORG_CONFIGURE_OPTIONS 2>&-) != "declare -a"* ]]; then 436 if [[ $(declare -p XORG_CONFIGURE_OPTIONS 2>&-) != "declare -a"* ]]; then
412 # fallback to CONFIGURE_OPTIONS, deprecated. 437 # fallback to CONFIGURE_OPTIONS, deprecated.
413 [[ -n "${CONFIGURE_OPTIONS}" ]] && \ 438 if [[ -n "${CONFIGURE_OPTIONS}" ]]; then
414 ewarn "QA: CONFIGURE_OPTIONS are deprecated. Please migrate to XORG_CONFIGURE_OPTIONS to preserve namespace." 439 eqawarn "CONFIGURE_OPTIONS are deprecated. Please migrate to XORG_CONFIGURE_OPTIONS"
440 eqawarn "to preserve namespace."
441 fi
442
415 local xorgconfadd=(${CONFIGURE_OPTIONS}) 443 local xorgconfadd=(${CONFIGURE_OPTIONS} ${XORG_CONFIGURE_OPTIONS})
416 else 444 else
417 local xorgconfadd=("${XORG_CONFIGURE_OPTIONS[@]}") 445 local xorgconfadd=("${XORG_CONFIGURE_OPTIONS[@]}")
418 fi 446 fi
419 447
420 [[ -n "${FONT}" ]] && xorg-2_font_configure 448 [[ -n "${FONT}" ]] && xorg-2_font_configure
449
450 # Check if package supports disabling of dep tracking
451 # Fixes warnings like:
452 # WARNING: unrecognized options: --disable-dependency-tracking
453 if grep -q -s "disable-depencency-tracking" ${ECONF_SOURCE:-.}/configure; then
454 local dep_track="--disable-dependency-tracking"
455 fi
456
421 local myeconfargs=( 457 local myeconfargs=(
422 --disable-dependency-tracking 458 ${dep_track}
423 ${FONT_OPTIONS} 459 ${FONT_OPTIONS}
424 "${xorgconfadd[@]}" 460 "${xorgconfadd[@]}"
425 ) 461 )
426 462
427 autotools-utils_src_configure "$@" 463 autotools-utils_src_configure "$@"
460 496
461 if [[ -e "${S}"/ChangeLog ]]; then 497 if [[ -e "${S}"/ChangeLog ]]; then
462 dodoc "${S}"/ChangeLog || die "dodoc failed" 498 dodoc "${S}"/ChangeLog || die "dodoc failed"
463 fi 499 fi
464 500
465 # Don't install libtool archives (even with static-libs) 501 # Don't install libtool archives (even for modules)
466 remove_libtool_files all 502 prune_libtool_files --all
467 503
468 [[ -n ${FONT} ]] && remove_font_metadata 504 [[ -n ${FONT} ]] && remove_font_metadata
469} 505}
470 506
471# @FUNCTION: xorg-2_pkg_postinst 507# @FUNCTION: xorg-2_pkg_postinst
473# Run X-specific post-installation tasks on the live filesystem. The 509# Run X-specific post-installation tasks on the live filesystem. The
474# only task right now is some setup for font packages. 510# only task right now is some setup for font packages.
475xorg-2_pkg_postinst() { 511xorg-2_pkg_postinst() {
476 debug-print-function ${FUNCNAME} "$@" 512 debug-print-function ${FUNCNAME} "$@"
477 513
478 [[ -n ${FONT} ]] && setup_fonts "$@" 514 if [[ -n ${FONT} ]]; then
515 create_fonts_scale
516 create_fonts_dir
517 font_pkg_postinst "$@"
518 fi
479} 519}
480 520
481# @FUNCTION: xorg-2_pkg_postrm 521# @FUNCTION: xorg-2_pkg_postrm
482# @DESCRIPTION: 522# @DESCRIPTION:
483# Run X-specific post-removal tasks on the live filesystem. The only 523# Run X-specific post-removal tasks on the live filesystem. The only
484# task right now is some cleanup for font packages. 524# task right now is some cleanup for font packages.
485xorg-2_pkg_postrm() { 525xorg-2_pkg_postrm() {
486 debug-print-function ${FUNCNAME} "$@" 526 debug-print-function ${FUNCNAME} "$@"
487 527
488 [[ -n ${FONT} ]] && font_pkg_postrm "$@" 528 if [[ -n ${FONT} ]]; then
489} 529 # if we're doing an upgrade, postinst will do
490 530 if [[ ${EAPI} -lt 4 || -z ${REPLACED_BY_VERSION} ]]; then
491# @FUNCTION: setup_fonts
492# @DESCRIPTION:
493# Generates needed files for fonts and fixes font permissions
494setup_fonts() {
495 debug-print-function ${FUNCNAME} "$@"
496
497 create_fonts_scale 531 create_fonts_scale
498 create_fonts_dir 532 create_fonts_dir
499 font_pkg_postinst 533 font_pkg_postrm "$@"
534 fi
535 fi
500} 536}
501 537
502# @FUNCTION: remove_font_metadata 538# @FUNCTION: remove_font_metadata
503# @DESCRIPTION: 539# @DESCRIPTION:
504# Don't let the package install generated font files that may overlap 540# Don't let the package install generated font files that may overlap
517# Create fonts.scale file, used by the old server-side fonts subsystem. 553# Create fonts.scale file, used by the old server-side fonts subsystem.
518create_fonts_scale() { 554create_fonts_scale() {
519 debug-print-function ${FUNCNAME} "$@" 555 debug-print-function ${FUNCNAME} "$@"
520 556
521 if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then 557 if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then
522 ebegin "Generating font.scale" 558 ebegin "Generating fonts.scale"
523 mkfontscale \ 559 mkfontscale \
524 -a "${EROOT}/usr/share/fonts/encodings/encodings.dir" \ 560 -a "${EROOT}/usr/share/fonts/encodings/encodings.dir" \
525 -- "${EROOT}/usr/share/fonts/${FONT_DIR}" 561 -- "${EROOT}/usr/share/fonts/${FONT_DIR}"
526 eend $? 562 eend $?
527 fi 563 fi

Legend:
Removed from v.1.44  
changed lines
  Added in v.1.60

  ViewVC Help
Powered by ViewVC 1.1.20