/[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.41 Revision 1.61
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.41 2011/04/20 12:48:38 mgorny Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/xorg-2.eclass,v 1.61 2013/02/24 21:05:08 mgorny 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# @ECLASS-VARIABLE: XORG_MULTILIB
41# @DESCRIPTION:
42# If set to 'yes', the multilib support for package will be enabled. Set
43# before inheriting this eclass.
44: ${XORG_MULTILIB:="no"}
45
46# we need to inherit autotools first to get the deps
40inherit autotools-utils eutils libtool multilib toolchain-funcs flag-o-matic autotools \ 47inherit autotools autotools-utils eutils libtool multilib toolchain-funcs \
41 ${FONT_ECLASS} ${GIT_ECLASS} 48 flag-o-matic ${FONT_ECLASS} ${GIT_ECLASS}
49
50if [[ ${XORG_MULTILIB} == yes ]]; then
51 inherit autotools-multilib
52fi
42 53
43EXPORTED_FUNCTIONS="src_unpack src_compile src_install pkg_postinst pkg_postrm" 54EXPORTED_FUNCTIONS="src_unpack src_compile src_install pkg_postinst pkg_postrm"
44case "${EAPI:-0}" in 55case "${EAPI:-0}" in
45 3|4) EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare src_configure" ;; 56 3|4|5) EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare src_configure" ;;
46 *) die "EAPI=${EAPI} is not supported" ;; 57 *) die "EAPI=${EAPI} is not supported" ;;
47esac 58esac
48 59
49# exports must be ALWAYS after inherit 60# exports must be ALWAYS after inherit
50EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS} 61EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS}
88# For git checkout the git repository might differ from package name. 99# For git checkout the git repository might differ from package name.
89# This variable can be used for proper directory specification 100# This variable can be used for proper directory specification
90: ${XORG_PACKAGE_NAME:=${PN}} 101: ${XORG_PACKAGE_NAME:=${PN}}
91 102
92if [[ -n ${GIT_ECLASS} ]]; then 103if [[ -n ${GIT_ECLASS} ]]; then
93 : ${EGIT_REPO_URI:="git://anongit.freedesktop.org/git/xorg/${XORG_MODULE}${XORG_PACKAGE_NAME}"} 104 : ${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 105elif [[ -n ${XORG_BASE_INDIVIDUAL_URI} ]]; then
95 SRC_URI="${XORG_BASE_INDIVIDUAL_URI}/${XORG_MODULE}${P}.tar.bz2" 106 SRC_URI="${XORG_BASE_INDIVIDUAL_URI}/${XORG_MODULE}${P}.tar.bz2"
96fi 107fi
97 108
98: ${SLOT:=0} 109: ${SLOT:=0}
107XORG_EAUTORECONF_ARCHES="x86-interix ppc-aix x86-winnt" 118XORG_EAUTORECONF_ARCHES="x86-interix ppc-aix x86-winnt"
108EAUTORECONF_DEPEND+=" 119EAUTORECONF_DEPEND+="
109 >=sys-devel/libtool-2.2.6a 120 >=sys-devel/libtool-2.2.6a
110 sys-devel/m4" 121 sys-devel/m4"
111if [[ ${PN} != util-macros ]] ; then 122if [[ ${PN} != util-macros ]] ; then
112 EAUTORECONF_DEPEND+=" >=x11-misc/util-macros-1.13.0" 123 EAUTORECONF_DEPEND+=" >=x11-misc/util-macros-1.17"
113 # Required even by xorg-server 124 # Required even by xorg-server
114 [[ ${PN} == "font-util" ]] || EAUTORECONF_DEPEND+=" >=media-fonts/font-util-1.2.0" 125 [[ ${PN} == "font-util" ]] || EAUTORECONF_DEPEND+=" >=media-fonts/font-util-1.2.0"
115fi 126fi
116WANT_AUTOCONF="latest" 127WANT_AUTOCONF="latest"
117WANT_AUTOMAKE="latest" 128WANT_AUTOMAKE="latest"
173 && ${PN} != xorg-cf-files \ 184 && ${PN} != xorg-cf-files \
174 && ${PN/xcursor} = ${PN} ]]; then 185 && ${PN/xcursor} = ${PN} ]]; then
175 IUSE+=" static-libs" 186 IUSE+=" static-libs"
176fi 187fi
177 188
178DEPEND+=" >=dev-util/pkgconfig-0.23" 189DEPEND+=" virtual/pkgconfig"
179 190
180# @ECLASS-VARIABLE: XORG_DRI 191# @ECLASS-VARIABLE: XORG_DRI
181# @DESCRIPTION: 192# @DESCRIPTION:
182# Possible values are "always" or the value of the useflag DRI capabilities 193# Possible values are "always" or the value of the useflag DRI capabilities
183# are required for. Default value is "no" 194# are required for. Default value is "no"
213if [[ -n "${DRIVER}" ]]; then 224if [[ -n "${DRIVER}" ]]; then
214 COMMON_DEPEND+=" 225 COMMON_DEPEND+="
215 x11-base/xorg-server[xorg] 226 x11-base/xorg-server[xorg]
216 " 227 "
217fi 228fi
229if [[ -n "${DRIVER}" && ${PN} == xf86-input-* ]]; then
230 DEPEND+="
231 x11-proto/inputproto
232 x11-proto/kbproto
233 x11-proto/xproto
234 "
235fi
218if [[ -n "${DRIVER}" && ${PN} == xf86-video-* ]]; then 236if [[ -n "${DRIVER}" && ${PN} == xf86-video-* ]]; then
219 COMMON_DEPEND+=" 237 COMMON_DEPEND+="
220 x11-libs/libpciaccess 238 x11-libs/libpciaccess
221 " 239 "
222 # we also needs some protos and libs in all cases 240 # we also needs some protos and libs in all cases
260 IUSE+=" ${XORG_DOC}" 278 IUSE+=" ${XORG_DOC}"
261 ;; 279 ;;
262esac 280esac
263unset DOC_DEPEND 281unset DOC_DEPEND
264 282
283# @ECLASS-VARIABLE: XORG_MODULE_REBUILD
284# @DESCRIPTION:
285# Describes whether a package contains modules that need to be rebuilt on
286# xorg-server upgrade. This has an effect only since EAPI=5.
287# Possible values are "yes" or "no". Default value is "yes" for packages which
288# are recognized as DRIVER by this eclass and "no" for all other packages.
289if [[ "${DRIVER}" == yes ]]; then
290 : ${XORG_MODULE_REBUILD:="yes"}
291else
292 : ${XORG_MODULE_REBUILD:="no"}
293fi
294
295if [[ ${XORG_MODULE_REBUILD} == yes ]]; then
296 case ${EAPI} in
297 3|4)
298 ;;
299 *)
300 RDEPEND+=" x11-base/xorg-server:="
301 ;;
302 esac
303fi
304
265DEPEND+=" ${COMMON_DEPEND}" 305DEPEND+=" ${COMMON_DEPEND}"
266RDEPEND+=" ${COMMON_DEPEND}" 306RDEPEND+=" ${COMMON_DEPEND}"
267unset COMMON_DEPEND 307unset COMMON_DEPEND
308
309if [[ ${XORG_MULTILIB} == yes ]]; then
310 RDEPEND+=" abi_x86_32? ( !<=app-emulation/emul-linux-x86-xlibs-20121202 )"
311fi
268 312
269debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: DEPEND=${DEPEND}" 313debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: DEPEND=${DEPEND}"
270debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: RDEPEND=${RDEPEND}" 314debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: RDEPEND=${RDEPEND}"
271debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: PDEPEND=${PDEPEND}" 315debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: PDEPEND=${PDEPEND}"
272 316
304 # Patch directory is ${WORKDIR}/patch 348 # Patch directory is ${WORKDIR}/patch
305 # See epatch() in eutils.eclass for more documentation 349 # See epatch() in eutils.eclass for more documentation
306 EPATCH_SUFFIX=${EPATCH_SUFFIX:=patch} 350 EPATCH_SUFFIX=${EPATCH_SUFFIX:=patch}
307 351
308 [[ -d "${EPATCH_SOURCE}" ]] && epatch 352 [[ -d "${EPATCH_SOURCE}" ]] && epatch
309 autotools-utils_src_prepare "$@"
310} 353}
311 354
312# @FUNCTION: xorg-2_reconf_source 355# @FUNCTION: xorg-2_reconf_source
313# @DESCRIPTION: 356# @DESCRIPTION:
314# Run eautoreconf if necessary, and run elibtoolize. 357# Run eautoreconf if necessary, and run elibtoolize.
316 debug-print-function ${FUNCNAME} "$@" 359 debug-print-function ${FUNCNAME} "$@"
317 360
318 case ${CHOST} in 361 case ${CHOST} in
319 *-interix* | *-aix* | *-winnt*) 362 *-interix* | *-aix* | *-winnt*)
320 # some hosts need full eautoreconf 363 # some hosts need full eautoreconf
321 [[ -e "./configure.ac" || -e "./configure.in" ]] && eautoreconf || ewarn "Unable to autoreconf the configure script. Things may fail." 364 [[ -e "./configure.ac" || -e "./configure.in" ]] \
365 && AUTOTOOLS_AUTORECONF=1
322 ;; 366 ;;
323 *) 367 *)
324 # elibtoolize required for BSD 368 # elibtoolize required for BSD
325 [[ ${XORG_EAUTORECONF} != no && ( -e "./configure.ac" || -e "./configure.in" ) ]] && eautoreconf || elibtoolize 369 [[ ${XORG_EAUTORECONF} != no && ( -e "./configure.ac" || -e "./configure.in" ) ]] \
370 && AUTOTOOLS_AUTORECONF=1
326 ;; 371 ;;
327 esac 372 esac
328} 373}
329 374
330# @FUNCTION: xorg-2_src_prepare 375# @FUNCTION: xorg-2_src_prepare
333xorg-2_src_prepare() { 378xorg-2_src_prepare() {
334 debug-print-function ${FUNCNAME} "$@" 379 debug-print-function ${FUNCNAME} "$@"
335 380
336 xorg-2_patch_source 381 xorg-2_patch_source
337 xorg-2_reconf_source 382 xorg-2_reconf_source
383 autotools-utils_src_prepare "$@"
338} 384}
339 385
340# @FUNCTION: xorg-2_font_configure 386# @FUNCTION: xorg-2_font_configure
341# @DESCRIPTION: 387# @DESCRIPTION:
342# If a font package, perform any necessary configuration steps 388# If a font package, perform any necessary configuration steps
401 # @DESCRIPTION: 447 # @DESCRIPTION:
402 # Array of an additional options to pass to configure. 448 # Array of an additional options to pass to configure.
403 # @DEFAULT_UNSET 449 # @DEFAULT_UNSET
404 if [[ $(declare -p XORG_CONFIGURE_OPTIONS 2>&-) != "declare -a"* ]]; then 450 if [[ $(declare -p XORG_CONFIGURE_OPTIONS 2>&-) != "declare -a"* ]]; then
405 # fallback to CONFIGURE_OPTIONS, deprecated. 451 # fallback to CONFIGURE_OPTIONS, deprecated.
406 [[ -n "${CONFIGURE_OPTIONS}" ]] && \ 452 if [[ -n "${CONFIGURE_OPTIONS}" ]]; then
407 ewarn "QA: CONFIGURE_OPTIONS are deprecated. Please migrate to XORG_CONFIGURE_OPTIONS to preserve namespace." 453 eqawarn "CONFIGURE_OPTIONS are deprecated. Please migrate to XORG_CONFIGURE_OPTIONS"
454 eqawarn "to preserve namespace."
455 fi
456
408 local xorgconfadd=(${CONFIGURE_OPTIONS}) 457 local xorgconfadd=(${CONFIGURE_OPTIONS} ${XORG_CONFIGURE_OPTIONS})
409 else 458 else
410 local xorgconfadd=("${XORG_CONFIGURE_OPTIONS[@]}") 459 local xorgconfadd=("${XORG_CONFIGURE_OPTIONS[@]}")
411 fi 460 fi
412 461
413 [[ -n "${FONT}" ]] && xorg-2_font_configure 462 [[ -n "${FONT}" ]] && xorg-2_font_configure
463
464 # Check if package supports disabling of dep tracking
465 # Fixes warnings like:
466 # WARNING: unrecognized options: --disable-dependency-tracking
467 if grep -q -s "disable-depencency-tracking" ${ECONF_SOURCE:-.}/configure; then
468 local dep_track="--disable-dependency-tracking"
469 fi
470
414 local myeconfargs=( 471 local myeconfargs=(
415 --disable-dependency-tracking 472 ${dep_track}
416 ${FONT_OPTIONS} 473 ${FONT_OPTIONS}
417 "${xorgconfadd[@]}" 474 "${xorgconfadd[@]}"
418 ) 475 )
419 476
477 if [[ ${XORG_MULTILIB} == yes ]]; then
478 autotools-multilib_src_configure "$@"
479 else
420 autotools-utils_src_configure "$@" 480 autotools-utils_src_configure "$@"
481 fi
421} 482}
422 483
423# @FUNCTION: xorg-2_src_compile 484# @FUNCTION: xorg-2_src_compile
424# @DESCRIPTION: 485# @DESCRIPTION:
425# Compile a package, performing all X-related tasks. 486# Compile a package, performing all X-related tasks.
426xorg-2_src_compile() { 487xorg-2_src_compile() {
427 debug-print-function ${FUNCNAME} "$@" 488 debug-print-function ${FUNCNAME} "$@"
428 489
490 if [[ ${XORG_MULTILIB} == yes ]]; then
491 autotools-multilib_src_compile "$@"
492 else
429 autotools-utils_src_compile "$@" 493 autotools-utils_src_compile "$@"
494 fi
430} 495}
431 496
432# @FUNCTION: xorg-2_src_install 497# @FUNCTION: xorg-2_src_install
433# @DESCRIPTION: 498# @DESCRIPTION:
434# Install a built package to ${D}, performing any necessary steps. 499# Install a built package to ${D}, performing any necessary steps.
435# Creates a ChangeLog from git if using live ebuilds. 500# Creates a ChangeLog from git if using live ebuilds.
436xorg-2_src_install() { 501xorg-2_src_install() {
437 debug-print-function ${FUNCNAME} "$@" 502 debug-print-function ${FUNCNAME} "$@"
438 503
504 local install_args=( docdir="${EPREFIX}/usr/share/doc/${PF}" )
505
439 if [[ ${CATEGORY} == x11-proto ]]; then 506 if [[ ${CATEGORY} == x11-proto ]]; then
440 autotools-utils_src_install \ 507 install_args+=(
441 ${PN/proto/}docdir="${EPREFIX}/usr/share/doc/${PF}" \ 508 ${PN/proto/}docdir="${EPREFIX}/usr/share/doc/${PF}"
442 docdir="${EPREFIX}/usr/share/doc/${PF}" 509 )
510 fi
511
512 if [[ ${XORG_MULTILIB} == yes ]]; then
513 autotools-multilib_src_install "${install_args[@]}"
443 else 514 else
444 autotools-utils_src_install \ 515 autotools-utils_src_install "${install_args[@]}"
445 docdir="${EPREFIX}/usr/share/doc/${PF}"
446 fi 516 fi
447 517
448 if [[ -n ${GIT_ECLASS} ]]; then 518 if [[ -n ${GIT_ECLASS} ]]; then
449 pushd "${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}" > /dev/null 519 pushd "${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}" > /dev/null
450 git log ${EGIT_COMMIT} > "${S}"/ChangeLog 520 git log ${EGIT_COMMIT} > "${S}"/ChangeLog
453 523
454 if [[ -e "${S}"/ChangeLog ]]; then 524 if [[ -e "${S}"/ChangeLog ]]; then
455 dodoc "${S}"/ChangeLog || die "dodoc failed" 525 dodoc "${S}"/ChangeLog || die "dodoc failed"
456 fi 526 fi
457 527
458 # Don't install libtool archives (even with static-libs) 528 # Don't install libtool archives (even for modules)
459 remove_libtool_files all 529 prune_libtool_files --all
460 530
461 [[ -n ${FONT} ]] && remove_font_metadata 531 [[ -n ${FONT} ]] && remove_font_metadata
462} 532}
463 533
464# @FUNCTION: xorg-2_pkg_postinst 534# @FUNCTION: xorg-2_pkg_postinst
466# Run X-specific post-installation tasks on the live filesystem. The 536# Run X-specific post-installation tasks on the live filesystem. The
467# only task right now is some setup for font packages. 537# only task right now is some setup for font packages.
468xorg-2_pkg_postinst() { 538xorg-2_pkg_postinst() {
469 debug-print-function ${FUNCNAME} "$@" 539 debug-print-function ${FUNCNAME} "$@"
470 540
471 [[ -n ${FONT} ]] && setup_fonts "$@" 541 if [[ -n ${FONT} ]]; then
542 create_fonts_scale
543 create_fonts_dir
544 font_pkg_postinst "$@"
545 fi
472} 546}
473 547
474# @FUNCTION: xorg-2_pkg_postrm 548# @FUNCTION: xorg-2_pkg_postrm
475# @DESCRIPTION: 549# @DESCRIPTION:
476# Run X-specific post-removal tasks on the live filesystem. The only 550# Run X-specific post-removal tasks on the live filesystem. The only
477# task right now is some cleanup for font packages. 551# task right now is some cleanup for font packages.
478xorg-2_pkg_postrm() { 552xorg-2_pkg_postrm() {
479 debug-print-function ${FUNCNAME} "$@" 553 debug-print-function ${FUNCNAME} "$@"
480 554
481 [[ -n ${FONT} ]] && font_pkg_postrm "$@" 555 if [[ -n ${FONT} ]]; then
482} 556 # if we're doing an upgrade, postinst will do
483 557 if [[ ${EAPI} -lt 4 || -z ${REPLACED_BY_VERSION} ]]; then
484# @FUNCTION: setup_fonts
485# @DESCRIPTION:
486# Generates needed files for fonts and fixes font permissions
487setup_fonts() {
488 debug-print-function ${FUNCNAME} "$@"
489
490 create_fonts_scale 558 create_fonts_scale
491 create_fonts_dir 559 create_fonts_dir
492 font_pkg_postinst 560 font_pkg_postrm "$@"
561 fi
562 fi
493} 563}
494 564
495# @FUNCTION: remove_font_metadata 565# @FUNCTION: remove_font_metadata
496# @DESCRIPTION: 566# @DESCRIPTION:
497# Don't let the package install generated font files that may overlap 567# Don't let the package install generated font files that may overlap
510# Create fonts.scale file, used by the old server-side fonts subsystem. 580# Create fonts.scale file, used by the old server-side fonts subsystem.
511create_fonts_scale() { 581create_fonts_scale() {
512 debug-print-function ${FUNCNAME} "$@" 582 debug-print-function ${FUNCNAME} "$@"
513 583
514 if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then 584 if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then
515 ebegin "Generating font.scale" 585 ebegin "Generating fonts.scale"
516 mkfontscale \ 586 mkfontscale \
517 -a "${EROOT}/usr/share/fonts/encodings/encodings.dir" \ 587 -a "${EROOT}/usr/share/fonts/encodings/encodings.dir" \
518 -- "${EROOT}/usr/share/fonts/${FONT_DIR}" 588 -- "${EROOT}/usr/share/fonts/${FONT_DIR}"
519 eend $? 589 eend $?
520 fi 590 fi

Legend:
Removed from v.1.41  
changed lines
  Added in v.1.61

  ViewVC Help
Powered by ViewVC 1.1.20