/[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.45 Revision 1.64
1# Copyright 1999-2010 Gentoo Foundation 1# Copyright 1999-2014 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.45 2011/05/17 07:59:02 mgorny Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/xorg-2.eclass,v 1.64 2014/03/02 15:41:20 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-r3"
26 XORG_EAUTORECONF="yes" 26 XORG_EAUTORECONF="yes"
27fi 27fi
28 28
29# If we're a font package, but not the font.alias one 29# If we're a font package, but not the font.alias one
30FONT_ECLASS="" 30FONT_ECLASS=""
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} http://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"
267 IUSE+=" ${XORG_DOC}" 278 IUSE+=" ${XORG_DOC}"
268 ;; 279 ;;
269esac 280esac
270unset DOC_DEPEND 281unset DOC_DEPEND
271 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
272DEPEND+=" ${COMMON_DEPEND}" 305DEPEND+=" ${COMMON_DEPEND}"
273RDEPEND+=" ${COMMON_DEPEND}" 306RDEPEND+=" ${COMMON_DEPEND}"
274unset COMMON_DEPEND 307unset COMMON_DEPEND
275 308
309if [[ ${XORG_MULTILIB} == yes ]]; then
310 RDEPEND+=" abi_x86_32? ( !app-emulation/emul-linux-x86-xlibs[-abi_x86_32(-)] )"
311fi
312
276debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: DEPEND=${DEPEND}" 313debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: DEPEND=${DEPEND}"
277debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: RDEPEND=${RDEPEND}" 314debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: RDEPEND=${RDEPEND}"
278debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: PDEPEND=${PDEPEND}" 315debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: PDEPEND=${PDEPEND}"
279 316
280# @FUNCTION: xorg-2_pkg_setup 317# @FUNCTION: xorg-2_pkg_setup
291# Simply unpack source code. 328# Simply unpack source code.
292xorg-2_src_unpack() { 329xorg-2_src_unpack() {
293 debug-print-function ${FUNCNAME} "$@" 330 debug-print-function ${FUNCNAME} "$@"
294 331
295 if [[ -n ${GIT_ECLASS} ]]; then 332 if [[ -n ${GIT_ECLASS} ]]; then
296 git-2_src_unpack 333 git-r3_src_unpack
297 else 334 else
298 unpack ${A} 335 unpack ${A}
299 fi 336 fi
300 337
301 [[ -n ${FONT_OPTIONS} ]] && einfo "Detected font directory: ${FONT_DIR}" 338 [[ -n ${FONT_OPTIONS} ]] && einfo "Detected font directory: ${FONT_DIR}"
311 # Patch directory is ${WORKDIR}/patch 348 # Patch directory is ${WORKDIR}/patch
312 # See epatch() in eutils.eclass for more documentation 349 # See epatch() in eutils.eclass for more documentation
313 EPATCH_SUFFIX=${EPATCH_SUFFIX:=patch} 350 EPATCH_SUFFIX=${EPATCH_SUFFIX:=patch}
314 351
315 [[ -d "${EPATCH_SOURCE}" ]] && epatch 352 [[ -d "${EPATCH_SOURCE}" ]] && epatch
316 autotools-utils_src_prepare "$@"
317} 353}
318 354
319# @FUNCTION: xorg-2_reconf_source 355# @FUNCTION: xorg-2_reconf_source
320# @DESCRIPTION: 356# @DESCRIPTION:
321# Run eautoreconf if necessary, and run elibtoolize. 357# Run eautoreconf if necessary, and run elibtoolize.
323 debug-print-function ${FUNCNAME} "$@" 359 debug-print-function ${FUNCNAME} "$@"
324 360
325 case ${CHOST} in 361 case ${CHOST} in
326 *-interix* | *-aix* | *-winnt*) 362 *-interix* | *-aix* | *-winnt*)
327 # some hosts need full eautoreconf 363 # some hosts need full eautoreconf
328 [[ -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
329 ;; 366 ;;
330 *) 367 *)
331 # elibtoolize required for BSD 368 # elibtoolize required for BSD
332 [[ ${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
333 ;; 371 ;;
334 esac 372 esac
335} 373}
336 374
337# @FUNCTION: xorg-2_src_prepare 375# @FUNCTION: xorg-2_src_prepare
340xorg-2_src_prepare() { 378xorg-2_src_prepare() {
341 debug-print-function ${FUNCNAME} "$@" 379 debug-print-function ${FUNCNAME} "$@"
342 380
343 xorg-2_patch_source 381 xorg-2_patch_source
344 xorg-2_reconf_source 382 xorg-2_reconf_source
383 autotools-utils_src_prepare "$@"
345} 384}
346 385
347# @FUNCTION: xorg-2_font_configure 386# @FUNCTION: xorg-2_font_configure
348# @DESCRIPTION: 387# @DESCRIPTION:
349# If a font package, perform any necessary configuration steps 388# If a font package, perform any necessary configuration steps
408 # @DESCRIPTION: 447 # @DESCRIPTION:
409 # Array of an additional options to pass to configure. 448 # Array of an additional options to pass to configure.
410 # @DEFAULT_UNSET 449 # @DEFAULT_UNSET
411 if [[ $(declare -p XORG_CONFIGURE_OPTIONS 2>&-) != "declare -a"* ]]; then 450 if [[ $(declare -p XORG_CONFIGURE_OPTIONS 2>&-) != "declare -a"* ]]; then
412 # fallback to CONFIGURE_OPTIONS, deprecated. 451 # fallback to CONFIGURE_OPTIONS, deprecated.
413 [[ -n "${CONFIGURE_OPTIONS}" ]] && \ 452 if [[ -n "${CONFIGURE_OPTIONS}" ]]; then
414 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
415 local xorgconfadd=(${CONFIGURE_OPTIONS}) 457 local xorgconfadd=(${CONFIGURE_OPTIONS} ${XORG_CONFIGURE_OPTIONS})
416 else 458 else
417 local xorgconfadd=("${XORG_CONFIGURE_OPTIONS[@]}") 459 local xorgconfadd=("${XORG_CONFIGURE_OPTIONS[@]}")
418 fi 460 fi
419 461
420 [[ -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
421 local myeconfargs=( 471 local myeconfargs=(
422 --disable-dependency-tracking 472 ${dep_track}
423 ${FONT_OPTIONS} 473 ${FONT_OPTIONS}
424 "${xorgconfadd[@]}" 474 "${xorgconfadd[@]}"
425 ) 475 )
426 476
477 if [[ ${XORG_MULTILIB} == yes ]]; then
478 autotools-multilib_src_configure "$@"
479 else
427 autotools-utils_src_configure "$@" 480 autotools-utils_src_configure "$@"
481 fi
428} 482}
429 483
430# @FUNCTION: xorg-2_src_compile 484# @FUNCTION: xorg-2_src_compile
431# @DESCRIPTION: 485# @DESCRIPTION:
432# Compile a package, performing all X-related tasks. 486# Compile a package, performing all X-related tasks.
433xorg-2_src_compile() { 487xorg-2_src_compile() {
434 debug-print-function ${FUNCNAME} "$@" 488 debug-print-function ${FUNCNAME} "$@"
435 489
490 if [[ ${XORG_MULTILIB} == yes ]]; then
491 autotools-multilib_src_compile "$@"
492 else
436 autotools-utils_src_compile "$@" 493 autotools-utils_src_compile "$@"
494 fi
437} 495}
438 496
439# @FUNCTION: xorg-2_src_install 497# @FUNCTION: xorg-2_src_install
440# @DESCRIPTION: 498# @DESCRIPTION:
441# Install a built package to ${D}, performing any necessary steps. 499# Install a built package to ${D}, performing any necessary steps.
442# Creates a ChangeLog from git if using live ebuilds. 500# Creates a ChangeLog from git if using live ebuilds.
443xorg-2_src_install() { 501xorg-2_src_install() {
444 debug-print-function ${FUNCNAME} "$@" 502 debug-print-function ${FUNCNAME} "$@"
445 503
504 local install_args=( docdir="${EPREFIX}/usr/share/doc/${PF}" )
505
446 if [[ ${CATEGORY} == x11-proto ]]; then 506 if [[ ${CATEGORY} == x11-proto ]]; then
447 autotools-utils_src_install \ 507 install_args+=(
448 ${PN/proto/}docdir="${EPREFIX}/usr/share/doc/${PF}" \ 508 ${PN/proto/}docdir="${EPREFIX}/usr/share/doc/${PF}"
449 docdir="${EPREFIX}/usr/share/doc/${PF}" 509 )
510 fi
511
512 if [[ ${XORG_MULTILIB} == yes ]]; then
513 autotools-multilib_src_install "${install_args[@]}"
450 else 514 else
451 autotools-utils_src_install \ 515 autotools-utils_src_install "${install_args[@]}"
452 docdir="${EPREFIX}/usr/share/doc/${PF}"
453 fi 516 fi
454 517
455 if [[ -n ${GIT_ECLASS} ]]; then 518 if [[ -n ${GIT_ECLASS} ]]; then
456 pushd "${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}" > /dev/null 519 pushd "${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}" > /dev/null
457 git log ${EGIT_COMMIT} > "${S}"/ChangeLog 520 git log ${EGIT_COMMIT} > "${S}"/ChangeLog
460 523
461 if [[ -e "${S}"/ChangeLog ]]; then 524 if [[ -e "${S}"/ChangeLog ]]; then
462 dodoc "${S}"/ChangeLog || die "dodoc failed" 525 dodoc "${S}"/ChangeLog || die "dodoc failed"
463 fi 526 fi
464 527
465 # Don't install libtool archives (even with static-libs) 528 # Don't install libtool archives (even for modules)
466 remove_libtool_files all 529 prune_libtool_files --all
467 530
468 [[ -n ${FONT} ]] && remove_font_metadata 531 [[ -n ${FONT} ]] && remove_font_metadata
469} 532}
470 533
471# @FUNCTION: xorg-2_pkg_postinst 534# @FUNCTION: xorg-2_pkg_postinst
473# Run X-specific post-installation tasks on the live filesystem. The 536# Run X-specific post-installation tasks on the live filesystem. The
474# only task right now is some setup for font packages. 537# only task right now is some setup for font packages.
475xorg-2_pkg_postinst() { 538xorg-2_pkg_postinst() {
476 debug-print-function ${FUNCNAME} "$@" 539 debug-print-function ${FUNCNAME} "$@"
477 540
478 [[ -n ${FONT} ]] && setup_fonts "$@" 541 if [[ -n ${FONT} ]]; then
542 create_fonts_scale
543 create_fonts_dir
544 font_pkg_postinst "$@"
545 fi
479} 546}
480 547
481# @FUNCTION: xorg-2_pkg_postrm 548# @FUNCTION: xorg-2_pkg_postrm
482# @DESCRIPTION: 549# @DESCRIPTION:
483# 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
484# task right now is some cleanup for font packages. 551# task right now is some cleanup for font packages.
485xorg-2_pkg_postrm() { 552xorg-2_pkg_postrm() {
486 debug-print-function ${FUNCNAME} "$@" 553 debug-print-function ${FUNCNAME} "$@"
487 554
488 [[ -n ${FONT} ]] && font_pkg_postrm "$@" 555 if [[ -n ${FONT} ]]; then
489} 556 # if we're doing an upgrade, postinst will do
490 557 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 558 create_fonts_scale
498 create_fonts_dir 559 create_fonts_dir
499 font_pkg_postinst 560 font_pkg_postrm "$@"
561 fi
562 fi
500} 563}
501 564
502# @FUNCTION: remove_font_metadata 565# @FUNCTION: remove_font_metadata
503# @DESCRIPTION: 566# @DESCRIPTION:
504# 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
517# 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.
518create_fonts_scale() { 581create_fonts_scale() {
519 debug-print-function ${FUNCNAME} "$@" 582 debug-print-function ${FUNCNAME} "$@"
520 583
521 if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then 584 if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then
522 ebegin "Generating font.scale" 585 ebegin "Generating fonts.scale"
523 mkfontscale \ 586 mkfontscale \
524 -a "${EROOT}/usr/share/fonts/encodings/encodings.dir" \ 587 -a "${EROOT}/usr/share/fonts/encodings/encodings.dir" \
525 -- "${EROOT}/usr/share/fonts/${FONT_DIR}" 588 -- "${EROOT}/usr/share/fonts/${FONT_DIR}"
526 eend $? 589 eend $?
527 fi 590 fi

Legend:
Removed from v.1.45  
changed lines
  Added in v.1.64

  ViewVC Help
Powered by ViewVC 1.1.20