| 1 | # Copyright 1999-2010 Gentoo Foundation |
1 | # Copyright 1999-2012 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.42 2011/05/08 12:20:46 scarabeus Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/xorg-2.eclass,v 1.57 2012/06/11 13:02:21 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 | |
|
|
| 23 | GIT_ECLASS="" |
23 | GIT_ECLASS="" |
| 24 | if [[ ${PV} == *9999* ]]; then |
24 | if [[ ${PV} == *9999* ]]; then |
| 25 | GIT_ECLASS="git-2" |
25 | GIT_ECLASS="git-2" |
| 26 | XORG_EAUTORECONF="yes" |
26 | XORG_EAUTORECONF="yes" |
| 27 | fi |
27 | fi |
| … | |
… | |
| 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" |
| 38 | fi |
38 | fi |
| 39 | |
39 | |
|
|
40 | # we need to inherit autotools first to get the deps |
| 40 | inherit autotools-utils eutils libtool multilib toolchain-funcs flag-o-matic autotools \ |
41 | inherit autotools autotools-utils eutils libtool multilib toolchain-funcs \ |
| 41 | ${FONT_ECLASS} ${GIT_ECLASS} |
42 | flag-o-matic ${FONT_ECLASS} ${GIT_ECLASS} |
| 42 | |
43 | |
| 43 | EXPORTED_FUNCTIONS="src_unpack src_compile src_install pkg_postinst pkg_postrm" |
44 | EXPORTED_FUNCTIONS="src_unpack src_compile src_install pkg_postinst pkg_postrm" |
| 44 | case "${EAPI:-0}" in |
45 | case "${EAPI:-0}" in |
| 45 | 3|4) EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare src_configure" ;; |
46 | 3|4) EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare src_configure" ;; |
| 46 | *) die "EAPI=${EAPI} is not supported" ;; |
47 | *) die "EAPI=${EAPI} is not supported" ;; |
| … | |
… | |
| 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 | |
| 92 | if [[ -n ${GIT_ECLASS} ]]; then |
93 | if [[ -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}"} |
| 94 | elif [[ -n ${XORG_BASE_INDIVIDUAL_URI} ]]; then |
95 | elif [[ -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" |
| 96 | fi |
97 | fi |
| 97 | |
98 | |
| 98 | : ${SLOT:=0} |
99 | : ${SLOT:=0} |
| … | |
… | |
| 107 | XORG_EAUTORECONF_ARCHES="x86-interix ppc-aix x86-winnt" |
108 | XORG_EAUTORECONF_ARCHES="x86-interix ppc-aix x86-winnt" |
| 108 | EAUTORECONF_DEPEND+=" |
109 | EAUTORECONF_DEPEND+=" |
| 109 | >=sys-devel/libtool-2.2.6a |
110 | >=sys-devel/libtool-2.2.6a |
| 110 | sys-devel/m4" |
111 | sys-devel/m4" |
| 111 | if [[ ${PN} != util-macros ]] ; then |
112 | if [[ ${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" |
| 115 | fi |
116 | fi |
| 116 | WANT_AUTOCONF="latest" |
117 | WANT_AUTOCONF="latest" |
| 117 | WANT_AUTOMAKE="latest" |
118 | WANT_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" |
| 176 | fi |
177 | fi |
| 177 | |
178 | |
| 178 | DEPEND+=" >=dev-util/pkgconfig-0.23" |
179 | DEPEND+=" 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" |
| … | |
… | |
| 213 | if [[ -n "${DRIVER}" ]]; then |
214 | if [[ -n "${DRIVER}" ]]; then |
| 214 | COMMON_DEPEND+=" |
215 | COMMON_DEPEND+=" |
| 215 | x11-base/xorg-server[xorg] |
216 | x11-base/xorg-server[xorg] |
| 216 | " |
217 | " |
| 217 | fi |
218 | fi |
| 218 | if [[ -n "${DRIVER}" && ${PN} == xf86-video-* ]]; then |
219 | if [[ -n "${DRIVER}" && ${PN} == xf86-input-* ]]; then |
| 219 | DEPEND+=" |
220 | DEPEND+=" |
| 220 | x11-proto/inputproto |
221 | x11-proto/inputproto |
|
|
222 | x11-proto/kbproto |
|
|
223 | x11-proto/xproto |
| 221 | " |
224 | " |
| 222 | fi |
225 | fi |
| 223 | if [[ -n "${DRIVER}" && ${PN} == xf86-video-* ]]; then |
226 | if [[ -n "${DRIVER}" && ${PN} == xf86-video-* ]]; then |
| 224 | COMMON_DEPEND+=" |
227 | COMMON_DEPEND+=" |
| 225 | x11-libs/libpciaccess |
228 | x11-libs/libpciaccess |
| … | |
… | |
| 309 | # Patch directory is ${WORKDIR}/patch |
312 | # Patch directory is ${WORKDIR}/patch |
| 310 | # See epatch() in eutils.eclass for more documentation |
313 | # See epatch() in eutils.eclass for more documentation |
| 311 | EPATCH_SUFFIX=${EPATCH_SUFFIX:=patch} |
314 | EPATCH_SUFFIX=${EPATCH_SUFFIX:=patch} |
| 312 | |
315 | |
| 313 | [[ -d "${EPATCH_SOURCE}" ]] && epatch |
316 | [[ -d "${EPATCH_SOURCE}" ]] && epatch |
| 314 | autotools-utils_src_prepare "$@" |
|
|
| 315 | } |
317 | } |
| 316 | |
318 | |
| 317 | # @FUNCTION: xorg-2_reconf_source |
319 | # @FUNCTION: xorg-2_reconf_source |
| 318 | # @DESCRIPTION: |
320 | # @DESCRIPTION: |
| 319 | # Run eautoreconf if necessary, and run elibtoolize. |
321 | # Run eautoreconf if necessary, and run elibtoolize. |
| … | |
… | |
| 321 | debug-print-function ${FUNCNAME} "$@" |
323 | debug-print-function ${FUNCNAME} "$@" |
| 322 | |
324 | |
| 323 | case ${CHOST} in |
325 | case ${CHOST} in |
| 324 | *-interix* | *-aix* | *-winnt*) |
326 | *-interix* | *-aix* | *-winnt*) |
| 325 | # some hosts need full eautoreconf |
327 | # some hosts need full eautoreconf |
| 326 | [[ -e "./configure.ac" || -e "./configure.in" ]] && eautoreconf || ewarn "Unable to autoreconf the configure script. Things may fail." |
328 | [[ -e "./configure.ac" || -e "./configure.in" ]] \ |
|
|
329 | && AUTOTOOLS_AUTORECONF=1 |
| 327 | ;; |
330 | ;; |
| 328 | *) |
331 | *) |
| 329 | # elibtoolize required for BSD |
332 | # elibtoolize required for BSD |
| 330 | [[ ${XORG_EAUTORECONF} != no && ( -e "./configure.ac" || -e "./configure.in" ) ]] && eautoreconf || elibtoolize |
333 | [[ ${XORG_EAUTORECONF} != no && ( -e "./configure.ac" || -e "./configure.in" ) ]] \ |
|
|
334 | && AUTOTOOLS_AUTORECONF=1 |
| 331 | ;; |
335 | ;; |
| 332 | esac |
336 | esac |
| 333 | } |
337 | } |
| 334 | |
338 | |
| 335 | # @FUNCTION: xorg-2_src_prepare |
339 | # @FUNCTION: xorg-2_src_prepare |
| … | |
… | |
| 338 | xorg-2_src_prepare() { |
342 | xorg-2_src_prepare() { |
| 339 | debug-print-function ${FUNCNAME} "$@" |
343 | debug-print-function ${FUNCNAME} "$@" |
| 340 | |
344 | |
| 341 | xorg-2_patch_source |
345 | xorg-2_patch_source |
| 342 | xorg-2_reconf_source |
346 | xorg-2_reconf_source |
|
|
347 | autotools-utils_src_prepare "$@" |
| 343 | } |
348 | } |
| 344 | |
349 | |
| 345 | # @FUNCTION: xorg-2_font_configure |
350 | # @FUNCTION: xorg-2_font_configure |
| 346 | # @DESCRIPTION: |
351 | # @DESCRIPTION: |
| 347 | # If a font package, perform any necessary configuration steps |
352 | # If a font package, perform any necessary configuration steps |
| … | |
… | |
| 406 | # @DESCRIPTION: |
411 | # @DESCRIPTION: |
| 407 | # Array of an additional options to pass to configure. |
412 | # Array of an additional options to pass to configure. |
| 408 | # @DEFAULT_UNSET |
413 | # @DEFAULT_UNSET |
| 409 | if [[ $(declare -p XORG_CONFIGURE_OPTIONS 2>&-) != "declare -a"* ]]; then |
414 | if [[ $(declare -p XORG_CONFIGURE_OPTIONS 2>&-) != "declare -a"* ]]; then |
| 410 | # fallback to CONFIGURE_OPTIONS, deprecated. |
415 | # fallback to CONFIGURE_OPTIONS, deprecated. |
| 411 | [[ -n "${CONFIGURE_OPTIONS}" ]] && \ |
416 | if [[ -n "${CONFIGURE_OPTIONS}" ]]; then |
| 412 | ewarn "QA: CONFIGURE_OPTIONS are deprecated. Please migrate to XORG_CONFIGURE_OPTIONS to preserve namespace." |
417 | eqawarn "CONFIGURE_OPTIONS are deprecated. Please migrate to XORG_CONFIGURE_OPTIONS" |
|
|
418 | eqawarn "to preserve namespace." |
|
|
419 | fi |
|
|
420 | |
| 413 | local xorgconfadd=(${CONFIGURE_OPTIONS}) |
421 | local xorgconfadd=(${CONFIGURE_OPTIONS} ${XORG_CONFIGURE_OPTIONS}) |
| 414 | else |
422 | else |
| 415 | local xorgconfadd=("${XORG_CONFIGURE_OPTIONS[@]}") |
423 | local xorgconfadd=("${XORG_CONFIGURE_OPTIONS[@]}") |
| 416 | fi |
424 | fi |
| 417 | |
425 | |
| 418 | [[ -n "${FONT}" ]] && xorg-2_font_configure |
426 | [[ -n "${FONT}" ]] && xorg-2_font_configure |
| … | |
… | |
| 458 | |
466 | |
| 459 | if [[ -e "${S}"/ChangeLog ]]; then |
467 | if [[ -e "${S}"/ChangeLog ]]; then |
| 460 | dodoc "${S}"/ChangeLog || die "dodoc failed" |
468 | dodoc "${S}"/ChangeLog || die "dodoc failed" |
| 461 | fi |
469 | fi |
| 462 | |
470 | |
| 463 | # Don't install libtool archives (even with static-libs) |
471 | # Don't install libtool archives (even for modules) |
| 464 | remove_libtool_files all |
472 | prune_libtool_files --all |
| 465 | |
473 | |
| 466 | [[ -n ${FONT} ]] && remove_font_metadata |
474 | [[ -n ${FONT} ]] && remove_font_metadata |
| 467 | } |
475 | } |
| 468 | |
476 | |
| 469 | # @FUNCTION: xorg-2_pkg_postinst |
477 | # @FUNCTION: xorg-2_pkg_postinst |
| … | |
… | |
| 471 | # Run X-specific post-installation tasks on the live filesystem. The |
479 | # Run X-specific post-installation tasks on the live filesystem. The |
| 472 | # only task right now is some setup for font packages. |
480 | # only task right now is some setup for font packages. |
| 473 | xorg-2_pkg_postinst() { |
481 | xorg-2_pkg_postinst() { |
| 474 | debug-print-function ${FUNCNAME} "$@" |
482 | debug-print-function ${FUNCNAME} "$@" |
| 475 | |
483 | |
| 476 | [[ -n ${FONT} ]] && setup_fonts "$@" |
484 | if [[ -n ${FONT} ]]; then |
|
|
485 | create_fonts_scale |
|
|
486 | create_fonts_dir |
|
|
487 | font_pkg_postinst "$@" |
|
|
488 | fi |
| 477 | } |
489 | } |
| 478 | |
490 | |
| 479 | # @FUNCTION: xorg-2_pkg_postrm |
491 | # @FUNCTION: xorg-2_pkg_postrm |
| 480 | # @DESCRIPTION: |
492 | # @DESCRIPTION: |
| 481 | # Run X-specific post-removal tasks on the live filesystem. The only |
493 | # Run X-specific post-removal tasks on the live filesystem. The only |
| 482 | # task right now is some cleanup for font packages. |
494 | # task right now is some cleanup for font packages. |
| 483 | xorg-2_pkg_postrm() { |
495 | xorg-2_pkg_postrm() { |
| 484 | debug-print-function ${FUNCNAME} "$@" |
496 | debug-print-function ${FUNCNAME} "$@" |
| 485 | |
497 | |
| 486 | [[ -n ${FONT} ]] && font_pkg_postrm "$@" |
498 | if [[ -n ${FONT} ]]; then |
| 487 | } |
499 | # if we're doing an upgrade, postinst will do |
| 488 | |
500 | if [[ ${EAPI} -lt 4 || -z ${REPLACED_BY_VERSION} ]]; then |
| 489 | # @FUNCTION: setup_fonts |
|
|
| 490 | # @DESCRIPTION: |
|
|
| 491 | # Generates needed files for fonts and fixes font permissions |
|
|
| 492 | setup_fonts() { |
|
|
| 493 | debug-print-function ${FUNCNAME} "$@" |
|
|
| 494 | |
|
|
| 495 | create_fonts_scale |
501 | create_fonts_scale |
| 496 | create_fonts_dir |
502 | create_fonts_dir |
| 497 | font_pkg_postinst |
503 | font_pkg_postrm "$@" |
|
|
504 | fi |
|
|
505 | fi |
| 498 | } |
506 | } |
| 499 | |
507 | |
| 500 | # @FUNCTION: remove_font_metadata |
508 | # @FUNCTION: remove_font_metadata |
| 501 | # @DESCRIPTION: |
509 | # @DESCRIPTION: |
| 502 | # Don't let the package install generated font files that may overlap |
510 | # Don't let the package install generated font files that may overlap |
| … | |
… | |
| 515 | # Create fonts.scale file, used by the old server-side fonts subsystem. |
523 | # Create fonts.scale file, used by the old server-side fonts subsystem. |
| 516 | create_fonts_scale() { |
524 | create_fonts_scale() { |
| 517 | debug-print-function ${FUNCNAME} "$@" |
525 | debug-print-function ${FUNCNAME} "$@" |
| 518 | |
526 | |
| 519 | if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then |
527 | if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then |
| 520 | ebegin "Generating font.scale" |
528 | ebegin "Generating fonts.scale" |
| 521 | mkfontscale \ |
529 | mkfontscale \ |
| 522 | -a "${EROOT}/usr/share/fonts/encodings/encodings.dir" \ |
530 | -a "${EROOT}/usr/share/fonts/encodings/encodings.dir" \ |
| 523 | -- "${EROOT}/usr/share/fonts/${FONT_DIR}" |
531 | -- "${EROOT}/usr/share/fonts/${FONT_DIR}" |
| 524 | eend $? |
532 | eend $? |
| 525 | fi |
533 | fi |