| 1 | # Copyright 1999-2010 Gentoo Foundation |
1 | # Copyright 1999-2011 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.32 2011/03/16 16:12:32 scarabeus Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/xorg-2.eclass,v 1.51 2011/11/01 13:51:05 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 | |
|
|
| 23 | GIT_ECLASS="" |
23 | GIT_ECLASS="" |
| 24 | if [[ ${PV} == *9999* ]]; then |
24 | if [[ ${PV} == *9999* ]]; then |
| 25 | GIT_ECLASS="git" |
25 | GIT_ECLASS="git-2" |
| 26 | XORG_EAUTORECONF="yes" |
26 | XORG_EAUTORECONF="yes" |
| 27 | fi |
27 | fi |
| 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 |
| 30 | FONT_ECLASS="" |
30 | FONT_ECLASS="" |
| … | |
… | |
| 41 | ${FONT_ECLASS} ${GIT_ECLASS} |
41 | ${FONT_ECLASS} ${GIT_ECLASS} |
| 42 | |
42 | |
| 43 | EXPORTED_FUNCTIONS="src_unpack src_compile src_install pkg_postinst pkg_postrm" |
43 | EXPORTED_FUNCTIONS="src_unpack src_compile src_install pkg_postinst pkg_postrm" |
| 44 | case "${EAPI:-0}" in |
44 | case "${EAPI:-0}" in |
| 45 | 3|4) EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare src_configure" ;; |
45 | 3|4) EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare src_configure" ;; |
| 46 | *) die "EAPI-UNSUPPORTED" ;; |
46 | *) die "EAPI=${EAPI} is not supported" ;; |
| 47 | esac |
47 | esac |
| 48 | |
48 | |
| 49 | # exports must be ALWAYS after inherit |
49 | # exports must be ALWAYS after inherit |
| 50 | EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS} |
50 | EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS} |
| 51 | |
51 | |
| … | |
… | |
| 81 | x11-libs) XORG_MODULE=lib/ ;; |
81 | x11-libs) XORG_MODULE=lib/ ;; |
| 82 | *) XORG_MODULE= ;; |
82 | *) XORG_MODULE= ;; |
| 83 | esac |
83 | esac |
| 84 | fi |
84 | fi |
| 85 | |
85 | |
| 86 | # backcompat, remove when everything in main tree fixed |
|
|
| 87 | [[ -n ${MODULE} ]] && XORG_MODULE=${MODULE} && ewarn "Your ebuild is using MODULE variable, please migrate to XORG_MODULE to preserve namespace." |
|
|
| 88 | |
|
|
| 89 | # @ECLASS-VARIABLE: XORG_PACKAGE_NAME |
86 | # @ECLASS-VARIABLE: XORG_PACKAGE_NAME |
| 90 | # @DESCRIPTION: |
87 | # @DESCRIPTION: |
| 91 | # For git checkout the git repository might differ from package name. |
88 | # For git checkout the git repository might differ from package name. |
| 92 | # This variable can be used for proper directory specification |
89 | # This variable can be used for proper directory specification |
| 93 | : ${XORG_PACKAGE_NAME:=${PN}} |
90 | : ${XORG_PACKAGE_NAME:=${PN}} |
| 94 | |
91 | |
| 95 | if [[ -n ${GIT_ECLASS} ]]; then |
92 | if [[ -n ${GIT_ECLASS} ]]; then |
| 96 | EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/${XORG_MODULE}${PACKAGE_NAME}" |
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}"} |
| 97 | elif [[ -n ${XORG_BASE_INDIVIDUAL_URI} ]]; then |
94 | elif [[ -n ${XORG_BASE_INDIVIDUAL_URI} ]]; then |
| 98 | SRC_URI="${XORG_BASE_INDIVIDUAL_URI}/${XORG_MODULE}${P}.tar.bz2" |
95 | SRC_URI="${XORG_BASE_INDIVIDUAL_URI}/${XORG_MODULE}${P}.tar.bz2" |
| 99 | fi |
96 | fi |
| 100 | |
97 | |
| 101 | : ${SLOT:=0} |
98 | : ${SLOT:=0} |
| … | |
… | |
| 110 | XORG_EAUTORECONF_ARCHES="x86-interix ppc-aix x86-winnt" |
107 | XORG_EAUTORECONF_ARCHES="x86-interix ppc-aix x86-winnt" |
| 111 | EAUTORECONF_DEPEND+=" |
108 | EAUTORECONF_DEPEND+=" |
| 112 | >=sys-devel/libtool-2.2.6a |
109 | >=sys-devel/libtool-2.2.6a |
| 113 | sys-devel/m4" |
110 | sys-devel/m4" |
| 114 | if [[ ${PN} != util-macros ]] ; then |
111 | if [[ ${PN} != util-macros ]] ; then |
| 115 | EAUTORECONF_DEPEND+=" >=x11-misc/util-macros-1.12.0" |
112 | EAUTORECONF_DEPEND+=" >=x11-misc/util-macros-1.15.0" |
| 116 | # Required even by xorg-server |
113 | # Required even by xorg-server |
| 117 | [[ ${PN} == "font-util" ]] || EAUTORECONF_DEPEND+=" >=media-fonts/font-util-1.1.1-r1" |
114 | [[ ${PN} == "font-util" ]] || EAUTORECONF_DEPEND+=" >=media-fonts/font-util-1.2.0" |
| 118 | fi |
115 | fi |
| 119 | WANT_AUTOCONF="latest" |
116 | WANT_AUTOCONF="latest" |
| 120 | WANT_AUTOMAKE="latest" |
117 | WANT_AUTOMAKE="latest" |
| 121 | for arch in ${XORG_EAUTORECONF_ARCHES}; do |
118 | for arch in ${XORG_EAUTORECONF_ARCHES}; do |
| 122 | EAUTORECONF_DEPENDS+=" ${arch}? ( ${EAUTORECONF_DEPEND} )" |
119 | EAUTORECONF_DEPENDS+=" ${arch}? ( ${EAUTORECONF_DEPEND} )" |
| … | |
… | |
| 129 | if [[ ${FONT} == yes ]]; then |
126 | if [[ ${FONT} == yes ]]; then |
| 130 | RDEPEND+=" media-fonts/encodings |
127 | RDEPEND+=" media-fonts/encodings |
| 131 | x11-apps/mkfontscale |
128 | x11-apps/mkfontscale |
| 132 | x11-apps/mkfontdir" |
129 | x11-apps/mkfontdir" |
| 133 | PDEPEND+=" media-fonts/font-alias" |
130 | PDEPEND+=" media-fonts/font-alias" |
| 134 | DEPEND+=" >=media-fonts/font-util-1.1.1-r1" |
131 | DEPEND+=" >=media-fonts/font-util-1.2.0" |
| 135 | |
132 | |
| 136 | # @ECLASS-VARIABLE: FONT_DIR |
133 | # @ECLASS-VARIABLE: FONT_DIR |
| 137 | # @DESCRIPTION: |
134 | # @DESCRIPTION: |
| 138 | # If you're creating a font package and the suffix of PN is not equal to |
135 | # If you're creating a font package and the suffix of PN is not equal to |
| 139 | # the subdirectory of /usr/share/fonts/ it should install into, set |
136 | # the subdirectory of /usr/share/fonts/ it should install into, set |
| … | |
… | |
| 205 | DEPEND+=" ${DRI_DEPEND}" |
202 | DEPEND+=" ${DRI_DEPEND}" |
| 206 | ;; |
203 | ;; |
| 207 | *) |
204 | *) |
| 208 | COMMON_DEPEND+=" ${XORG_DRI}? ( ${DRI_COMMON_DEPEND} )" |
205 | COMMON_DEPEND+=" ${XORG_DRI}? ( ${DRI_COMMON_DEPEND} )" |
| 209 | DEPEND+=" ${XORG_DRI}? ( ${DRI_DEPEND} )" |
206 | DEPEND+=" ${XORG_DRI}? ( ${DRI_DEPEND} )" |
| 210 | IUSE="${XORG_DRI}" |
207 | IUSE+=" ${XORG_DRI}" |
| 211 | ;; |
208 | ;; |
| 212 | esac |
209 | esac |
| 213 | unset DRI_DEPEND |
210 | unset DRI_DEPEND |
| 214 | unset DRI_COMMONDEPEND |
211 | unset DRI_COMMONDEPEND |
| 215 | |
212 | |
| 216 | if [[ -n "${DRIVER}" ]]; then |
213 | if [[ -n "${DRIVER}" ]]; then |
| 217 | COMMON_DEPEND+=" |
214 | COMMON_DEPEND+=" |
| 218 | x11-base/xorg-server[xorg] |
215 | x11-base/xorg-server[xorg] |
|
|
216 | " |
|
|
217 | fi |
|
|
218 | if [[ -n "${DRIVER}" && ${PN} == xf86-input-* ]]; then |
|
|
219 | DEPEND+=" |
|
|
220 | x11-proto/inputproto |
|
|
221 | x11-proto/kbproto |
|
|
222 | x11-proto/xproto |
| 219 | " |
223 | " |
| 220 | fi |
224 | fi |
| 221 | if [[ -n "${DRIVER}" && ${PN} == xf86-video-* ]]; then |
225 | if [[ -n "${DRIVER}" && ${PN} == xf86-video-* ]]; then |
| 222 | COMMON_DEPEND+=" |
226 | COMMON_DEPEND+=" |
| 223 | x11-libs/libpciaccess |
227 | x11-libs/libpciaccess |
| … | |
… | |
| 245 | DOC_DEPEND=" |
249 | DOC_DEPEND=" |
| 246 | doc? ( |
250 | doc? ( |
| 247 | app-text/asciidoc |
251 | app-text/asciidoc |
| 248 | app-text/xmlto |
252 | app-text/xmlto |
| 249 | app-doc/doxygen |
253 | app-doc/doxygen |
| 250 | app-text/docbook-xml-dtd:4.1 |
254 | app-text/docbook-xml-dtd:4.1.2 |
| 251 | app-text/docbook-xml-dtd:4.2 |
255 | app-text/docbook-xml-dtd:4.2 |
| 252 | app-text/docbook-xml-dtd:4.3 |
256 | app-text/docbook-xml-dtd:4.3 |
| 253 | ) |
257 | ) |
| 254 | " |
258 | " |
| 255 | case ${XORG_DOC} in |
259 | case ${XORG_DOC} in |
| … | |
… | |
| 258 | always) |
262 | always) |
| 259 | DEPEND+=" ${DOC_DEPEND}" |
263 | DEPEND+=" ${DOC_DEPEND}" |
| 260 | ;; |
264 | ;; |
| 261 | *) |
265 | *) |
| 262 | DEPEND+=" ${XORG_DOC}? ( ${DOC_DEPEND} )" |
266 | DEPEND+=" ${XORG_DOC}? ( ${DOC_DEPEND} )" |
| 263 | IUSE="${XORG_DOC}" |
267 | IUSE+=" ${XORG_DOC}" |
| 264 | ;; |
268 | ;; |
| 265 | esac |
269 | esac |
| 266 | unset DOC_DEPEND |
270 | unset DOC_DEPEND |
| 267 | |
271 | |
| 268 | DEPEND+=" ${COMMON_DEPEND}" |
272 | DEPEND+=" ${COMMON_DEPEND}" |
| … | |
… | |
| 287 | # Simply unpack source code. |
291 | # Simply unpack source code. |
| 288 | xorg-2_src_unpack() { |
292 | xorg-2_src_unpack() { |
| 289 | debug-print-function ${FUNCNAME} "$@" |
293 | debug-print-function ${FUNCNAME} "$@" |
| 290 | |
294 | |
| 291 | if [[ -n ${GIT_ECLASS} ]]; then |
295 | if [[ -n ${GIT_ECLASS} ]]; then |
| 292 | git_src_unpack |
296 | git-2_src_unpack |
| 293 | else |
297 | else |
| 294 | unpack ${A} |
298 | unpack ${A} |
| 295 | fi |
299 | fi |
| 296 | |
300 | |
| 297 | [[ -n ${FONT_OPTIONS} ]] && einfo "Detected font directory: ${FONT_DIR}" |
301 | [[ -n ${FONT_OPTIONS} ]] && einfo "Detected font directory: ${FONT_DIR}" |
| … | |
… | |
| 334 | # @DESCRIPTION: |
338 | # @DESCRIPTION: |
| 335 | # Prepare a package after unpacking, performing all X-related tasks. |
339 | # Prepare a package after unpacking, performing all X-related tasks. |
| 336 | xorg-2_src_prepare() { |
340 | xorg-2_src_prepare() { |
| 337 | debug-print-function ${FUNCNAME} "$@" |
341 | debug-print-function ${FUNCNAME} "$@" |
| 338 | |
342 | |
| 339 | [[ -n ${GIT_ECLASS} ]] && git_src_prepare |
|
|
| 340 | xorg-2_patch_source |
343 | xorg-2_patch_source |
| 341 | xorg-2_reconf_source |
344 | xorg-2_reconf_source |
| 342 | } |
345 | } |
| 343 | |
346 | |
| 344 | # @FUNCTION: xorg-2_font_configure |
347 | # @FUNCTION: xorg-2_font_configure |
| … | |
… | |
| 399 | xorg-2_src_configure() { |
402 | xorg-2_src_configure() { |
| 400 | debug-print-function ${FUNCNAME} "$@" |
403 | debug-print-function ${FUNCNAME} "$@" |
| 401 | |
404 | |
| 402 | xorg-2_flags_setup |
405 | xorg-2_flags_setup |
| 403 | |
406 | |
| 404 | # @VARIABLE: CONFIGURE_OPTIONS |
407 | # @VARIABLE: XORG_CONFIGURE_OPTIONS |
| 405 | # @DESCRIPTION: |
408 | # @DESCRIPTION: |
| 406 | # Any options to pass to configure |
409 | # Array of an additional options to pass to configure. |
| 407 | # @DEFAULT_UNSET |
410 | # @DEFAULT_UNSET |
| 408 | CONFIGURE_OPTIONS=${CONFIGURE_OPTIONS:=""} |
411 | if [[ $(declare -p XORG_CONFIGURE_OPTIONS 2>&-) != "declare -a"* ]]; then |
|
|
412 | # fallback to CONFIGURE_OPTIONS, deprecated. |
|
|
413 | if [[ -n "${CONFIGURE_OPTIONS}" ]]; then |
|
|
414 | eqawarn "CONFIGURE_OPTIONS are deprecated. Please migrate to XORG_CONFIGURE_OPTIONS" |
|
|
415 | eqawarn "to preserve namespace." |
|
|
416 | fi |
|
|
417 | |
|
|
418 | local xorgconfadd=(${CONFIGURE_OPTIONS}) |
|
|
419 | else |
|
|
420 | local xorgconfadd=("${XORG_CONFIGURE_OPTIONS[@]}") |
|
|
421 | fi |
| 409 | |
422 | |
| 410 | [[ -n "${FONT}" ]] && xorg-2_font_configure |
423 | [[ -n "${FONT}" ]] && xorg-2_font_configure |
| 411 | local myeconfargs=( |
424 | local myeconfargs=( |
| 412 | --disable-dependency-tracking |
425 | --disable-dependency-tracking |
| 413 | ${CONFIGURE_OPTIONS} |
|
|
| 414 | ${FONT_OPTIONS} |
426 | ${FONT_OPTIONS} |
|
|
427 | "${xorgconfadd[@]}" |
| 415 | ) |
428 | ) |
| 416 | |
429 | |
| 417 | autotools-utils_src_configure "$@" |
430 | autotools-utils_src_configure "$@" |
| 418 | } |
431 | } |
| 419 | |
432 | |
| … | |
… | |
| 463 | # Run X-specific post-installation tasks on the live filesystem. The |
476 | # Run X-specific post-installation tasks on the live filesystem. The |
| 464 | # only task right now is some setup for font packages. |
477 | # only task right now is some setup for font packages. |
| 465 | xorg-2_pkg_postinst() { |
478 | xorg-2_pkg_postinst() { |
| 466 | debug-print-function ${FUNCNAME} "$@" |
479 | debug-print-function ${FUNCNAME} "$@" |
| 467 | |
480 | |
| 468 | [[ -n ${FONT} ]] && setup_fonts "$@" |
481 | if [[ -n ${FONT} ]]; then |
|
|
482 | create_fonts_scale |
|
|
483 | create_fonts_dir |
|
|
484 | font_pkg_postinst "$@" |
|
|
485 | fi |
| 469 | } |
486 | } |
| 470 | |
487 | |
| 471 | # @FUNCTION: xorg-2_pkg_postrm |
488 | # @FUNCTION: xorg-2_pkg_postrm |
| 472 | # @DESCRIPTION: |
489 | # @DESCRIPTION: |
| 473 | # Run X-specific post-removal tasks on the live filesystem. The only |
490 | # Run X-specific post-removal tasks on the live filesystem. The only |
| 474 | # task right now is some cleanup for font packages. |
491 | # task right now is some cleanup for font packages. |
| 475 | xorg-2_pkg_postrm() { |
492 | xorg-2_pkg_postrm() { |
| 476 | debug-print-function ${FUNCNAME} "$@" |
493 | debug-print-function ${FUNCNAME} "$@" |
| 477 | |
494 | |
| 478 | [[ -n ${FONT} ]] && font_pkg_postrm "$@" |
495 | if [[ -n ${FONT} ]]; then |
| 479 | } |
496 | # if we're doing an upgrade, postinst will do |
| 480 | |
497 | if [[ ${EAPI} -lt 4 || -z ${REPLACED_BY_VERSION} ]]; then |
| 481 | # @FUNCTION: setup_fonts |
|
|
| 482 | # @DESCRIPTION: |
|
|
| 483 | # Generates needed files for fonts and fixes font permissions |
|
|
| 484 | setup_fonts() { |
|
|
| 485 | debug-print-function ${FUNCNAME} "$@" |
|
|
| 486 | |
|
|
| 487 | create_fonts_scale |
498 | create_fonts_scale |
| 488 | create_fonts_dir |
499 | create_fonts_dir |
| 489 | font_pkg_postinst |
500 | font_pkg_postrm "$@" |
|
|
501 | fi |
|
|
502 | fi |
| 490 | } |
503 | } |
| 491 | |
504 | |
| 492 | # @FUNCTION: remove_font_metadata |
505 | # @FUNCTION: remove_font_metadata |
| 493 | # @DESCRIPTION: |
506 | # @DESCRIPTION: |
| 494 | # Don't let the package install generated font files that may overlap |
507 | # Don't let the package install generated font files that may overlap |
| … | |
… | |
| 507 | # Create fonts.scale file, used by the old server-side fonts subsystem. |
520 | # Create fonts.scale file, used by the old server-side fonts subsystem. |
| 508 | create_fonts_scale() { |
521 | create_fonts_scale() { |
| 509 | debug-print-function ${FUNCNAME} "$@" |
522 | debug-print-function ${FUNCNAME} "$@" |
| 510 | |
523 | |
| 511 | if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then |
524 | if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then |
| 512 | ebegin "Generating font.scale" |
525 | ebegin "Generating fonts.scale" |
| 513 | mkfontscale \ |
526 | mkfontscale \ |
| 514 | -a "${EROOT}/usr/share/fonts/encodings/encodings.dir" \ |
527 | -a "${EROOT}/usr/share/fonts/encodings/encodings.dir" \ |
| 515 | -- "${EROOT}/usr/share/fonts/${FONT_DIR}" |
528 | -- "${EROOT}/usr/share/fonts/${FONT_DIR}" |
| 516 | eend $? |
529 | eend $? |
| 517 | fi |
530 | fi |