/[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.34 Revision 1.53
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.34 2011/03/16 20:57:43 mgorny Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/xorg-2.eclass,v 1.53 2012/05/02 18:31:45 jdhore 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" 25 GIT_ECLASS="git-2"
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# 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) EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare src_configure" ;;
46 *) die "EAPI-UNSUPPORTED" ;; 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}
51 52
81 x11-libs) XORG_MODULE=lib/ ;; 82 x11-libs) XORG_MODULE=lib/ ;;
82 *) XORG_MODULE= ;; 83 *) XORG_MODULE= ;;
83 esac 84 esac
84fi 85fi
85 86
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 87# @ECLASS-VARIABLE: XORG_PACKAGE_NAME
90# @DESCRIPTION: 88# @DESCRIPTION:
91# For git checkout the git repository might differ from package name. 89# For git checkout the git repository might differ from package name.
92# This variable can be used for proper directory specification 90# This variable can be used for proper directory specification
93: ${XORG_PACKAGE_NAME:=${PN}} 91: ${XORG_PACKAGE_NAME:=${PN}}
94 92
95if [[ -n ${GIT_ECLASS} ]]; then 93if [[ -n ${GIT_ECLASS} ]]; then
96 EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/${XORG_MODULE}${XORG_PACKAGE_NAME}" 94 : ${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}"}
97elif [[ -n ${XORG_BASE_INDIVIDUAL_URI} ]]; then 95elif [[ -n ${XORG_BASE_INDIVIDUAL_URI} ]]; then
98 SRC_URI="${XORG_BASE_INDIVIDUAL_URI}/${XORG_MODULE}${P}.tar.bz2" 96 SRC_URI="${XORG_BASE_INDIVIDUAL_URI}/${XORG_MODULE}${P}.tar.bz2"
99fi 97fi
100 98
101: ${SLOT:=0} 99: ${SLOT:=0}
110XORG_EAUTORECONF_ARCHES="x86-interix ppc-aix x86-winnt" 108XORG_EAUTORECONF_ARCHES="x86-interix ppc-aix x86-winnt"
111EAUTORECONF_DEPEND+=" 109EAUTORECONF_DEPEND+="
112 >=sys-devel/libtool-2.2.6a 110 >=sys-devel/libtool-2.2.6a
113 sys-devel/m4" 111 sys-devel/m4"
114if [[ ${PN} != util-macros ]] ; then 112if [[ ${PN} != util-macros ]] ; then
115 EAUTORECONF_DEPEND+=" >=x11-misc/util-macros-1.12.0" 113 EAUTORECONF_DEPEND+=" >=x11-misc/util-macros-1.15.0"
116 # Required even by xorg-server 114 # Required even by xorg-server
117 [[ ${PN} == "font-util" ]] || EAUTORECONF_DEPEND+=" >=media-fonts/font-util-1.1.1-r1" 115 [[ ${PN} == "font-util" ]] || EAUTORECONF_DEPEND+=" >=media-fonts/font-util-1.2.0"
118fi 116fi
119WANT_AUTOCONF="latest" 117WANT_AUTOCONF="latest"
120WANT_AUTOMAKE="latest" 118WANT_AUTOMAKE="latest"
121for arch in ${XORG_EAUTORECONF_ARCHES}; do 119for arch in ${XORG_EAUTORECONF_ARCHES}; do
122 EAUTORECONF_DEPENDS+=" ${arch}? ( ${EAUTORECONF_DEPEND} )" 120 EAUTORECONF_DEPENDS+=" ${arch}? ( ${EAUTORECONF_DEPEND} )"
129if [[ ${FONT} == yes ]]; then 127if [[ ${FONT} == yes ]]; then
130 RDEPEND+=" media-fonts/encodings 128 RDEPEND+=" media-fonts/encodings
131 x11-apps/mkfontscale 129 x11-apps/mkfontscale
132 x11-apps/mkfontdir" 130 x11-apps/mkfontdir"
133 PDEPEND+=" media-fonts/font-alias" 131 PDEPEND+=" media-fonts/font-alias"
134 DEPEND+=" >=media-fonts/font-util-1.1.1-r1" 132 DEPEND+=" >=media-fonts/font-util-1.2.0"
135 133
136 # @ECLASS-VARIABLE: FONT_DIR 134 # @ECLASS-VARIABLE: FONT_DIR
137 # @DESCRIPTION: 135 # @DESCRIPTION:
138 # If you're creating a font package and the suffix of PN is not equal to 136 # 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 137 # the subdirectory of /usr/share/fonts/ it should install into, set
176 && ${PN} != xorg-cf-files \ 174 && ${PN} != xorg-cf-files \
177 && ${PN/xcursor} = ${PN} ]]; then 175 && ${PN/xcursor} = ${PN} ]]; then
178 IUSE+=" static-libs" 176 IUSE+=" static-libs"
179fi 177fi
180 178
181DEPEND+=" >=dev-util/pkgconfig-0.23" 179DEPEND+=" virtual/pkgconfig"
182 180
183# @ECLASS-VARIABLE: XORG_DRI 181# @ECLASS-VARIABLE: XORG_DRI
184# @DESCRIPTION: 182# @DESCRIPTION:
185# 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
186# are required for. Default value is "no" 184# are required for. Default value is "no"
205 DEPEND+=" ${DRI_DEPEND}" 203 DEPEND+=" ${DRI_DEPEND}"
206 ;; 204 ;;
207 *) 205 *)
208 COMMON_DEPEND+=" ${XORG_DRI}? ( ${DRI_COMMON_DEPEND} )" 206 COMMON_DEPEND+=" ${XORG_DRI}? ( ${DRI_COMMON_DEPEND} )"
209 DEPEND+=" ${XORG_DRI}? ( ${DRI_DEPEND} )" 207 DEPEND+=" ${XORG_DRI}? ( ${DRI_DEPEND} )"
210 IUSE="${XORG_DRI}" 208 IUSE+=" ${XORG_DRI}"
211 ;; 209 ;;
212esac 210esac
213unset DRI_DEPEND 211unset DRI_DEPEND
214unset DRI_COMMONDEPEND 212unset DRI_COMMONDEPEND
215 213
216if [[ -n "${DRIVER}" ]]; then 214if [[ -n "${DRIVER}" ]]; then
217 COMMON_DEPEND+=" 215 COMMON_DEPEND+="
218 x11-base/xorg-server[xorg] 216 x11-base/xorg-server[xorg]
217 "
218fi
219if [[ -n "${DRIVER}" && ${PN} == xf86-input-* ]]; then
220 DEPEND+="
221 x11-proto/inputproto
222 x11-proto/kbproto
223 x11-proto/xproto
219 " 224 "
220fi 225fi
221if [[ -n "${DRIVER}" && ${PN} == xf86-video-* ]]; then 226if [[ -n "${DRIVER}" && ${PN} == xf86-video-* ]]; then
222 COMMON_DEPEND+=" 227 COMMON_DEPEND+="
223 x11-libs/libpciaccess 228 x11-libs/libpciaccess
258 always) 263 always)
259 DEPEND+=" ${DOC_DEPEND}" 264 DEPEND+=" ${DOC_DEPEND}"
260 ;; 265 ;;
261 *) 266 *)
262 DEPEND+=" ${XORG_DOC}? ( ${DOC_DEPEND} )" 267 DEPEND+=" ${XORG_DOC}? ( ${DOC_DEPEND} )"
263 IUSE="${XORG_DOC}" 268 IUSE+=" ${XORG_DOC}"
264 ;; 269 ;;
265esac 270esac
266unset DOC_DEPEND 271unset DOC_DEPEND
267 272
268DEPEND+=" ${COMMON_DEPEND}" 273DEPEND+=" ${COMMON_DEPEND}"
287# Simply unpack source code. 292# Simply unpack source code.
288xorg-2_src_unpack() { 293xorg-2_src_unpack() {
289 debug-print-function ${FUNCNAME} "$@" 294 debug-print-function ${FUNCNAME} "$@"
290 295
291 if [[ -n ${GIT_ECLASS} ]]; then 296 if [[ -n ${GIT_ECLASS} ]]; then
292 git_src_unpack 297 git-2_src_unpack
293 else 298 else
294 unpack ${A} 299 unpack ${A}
295 fi 300 fi
296 301
297 [[ -n ${FONT_OPTIONS} ]] && einfo "Detected font directory: ${FONT_DIR}" 302 [[ -n ${FONT_OPTIONS} ]] && einfo "Detected font directory: ${FONT_DIR}"
307 # Patch directory is ${WORKDIR}/patch 312 # Patch directory is ${WORKDIR}/patch
308 # See epatch() in eutils.eclass for more documentation 313 # See epatch() in eutils.eclass for more documentation
309 EPATCH_SUFFIX=${EPATCH_SUFFIX:=patch} 314 EPATCH_SUFFIX=${EPATCH_SUFFIX:=patch}
310 315
311 [[ -d "${EPATCH_SOURCE}" ]] && epatch 316 [[ -d "${EPATCH_SOURCE}" ]] && epatch
312 autotools-utils_src_prepare "$@"
313} 317}
314 318
315# @FUNCTION: xorg-2_reconf_source 319# @FUNCTION: xorg-2_reconf_source
316# @DESCRIPTION: 320# @DESCRIPTION:
317# Run eautoreconf if necessary, and run elibtoolize. 321# Run eautoreconf if necessary, and run elibtoolize.
319 debug-print-function ${FUNCNAME} "$@" 323 debug-print-function ${FUNCNAME} "$@"
320 324
321 case ${CHOST} in 325 case ${CHOST} in
322 *-interix* | *-aix* | *-winnt*) 326 *-interix* | *-aix* | *-winnt*)
323 # some hosts need full eautoreconf 327 # some hosts need full eautoreconf
324 [[ -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
325 ;; 330 ;;
326 *) 331 *)
327 # elibtoolize required for BSD 332 # elibtoolize required for BSD
328 [[ ${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
329 ;; 335 ;;
330 esac 336 esac
331} 337}
332 338
333# @FUNCTION: xorg-2_src_prepare 339# @FUNCTION: xorg-2_src_prepare
334# @DESCRIPTION: 340# @DESCRIPTION:
335# Prepare a package after unpacking, performing all X-related tasks. 341# Prepare a package after unpacking, performing all X-related tasks.
336xorg-2_src_prepare() { 342xorg-2_src_prepare() {
337 debug-print-function ${FUNCNAME} "$@" 343 debug-print-function ${FUNCNAME} "$@"
338 344
339 [[ -n ${GIT_ECLASS} ]] && git_src_prepare
340 xorg-2_patch_source 345 xorg-2_patch_source
341 xorg-2_reconf_source 346 xorg-2_reconf_source
347 autotools-utils_src_prepare "$@"
342} 348}
343 349
344# @FUNCTION: xorg-2_font_configure 350# @FUNCTION: xorg-2_font_configure
345# @DESCRIPTION: 351# @DESCRIPTION:
346# If a font package, perform any necessary configuration steps 352# If a font package, perform any necessary configuration steps
399xorg-2_src_configure() { 405xorg-2_src_configure() {
400 debug-print-function ${FUNCNAME} "$@" 406 debug-print-function ${FUNCNAME} "$@"
401 407
402 xorg-2_flags_setup 408 xorg-2_flags_setup
403 409
404 # @VARIABLE: CONFIGURE_OPTIONS 410 # @VARIABLE: XORG_CONFIGURE_OPTIONS
405 # @DESCRIPTION: 411 # @DESCRIPTION:
406 # Any options to pass to configure 412 # Array of an additional options to pass to configure.
407 # @DEFAULT_UNSET 413 # @DEFAULT_UNSET
408 CONFIGURE_OPTIONS=${CONFIGURE_OPTIONS:=""} 414 if [[ $(declare -p XORG_CONFIGURE_OPTIONS 2>&-) != "declare -a"* ]]; then
415 # fallback to CONFIGURE_OPTIONS, deprecated.
416 if [[ -n "${CONFIGURE_OPTIONS}" ]]; then
417 eqawarn "CONFIGURE_OPTIONS are deprecated. Please migrate to XORG_CONFIGURE_OPTIONS"
418 eqawarn "to preserve namespace."
419 fi
420
421 local xorgconfadd=(${CONFIGURE_OPTIONS})
422 else
423 local xorgconfadd=("${XORG_CONFIGURE_OPTIONS[@]}")
424 fi
409 425
410 [[ -n "${FONT}" ]] && xorg-2_font_configure 426 [[ -n "${FONT}" ]] && xorg-2_font_configure
411 local myeconfargs=( 427 local myeconfargs=(
412 --disable-dependency-tracking 428 --disable-dependency-tracking
413 ${CONFIGURE_OPTIONS}
414 ${FONT_OPTIONS} 429 ${FONT_OPTIONS}
430 "${xorgconfadd[@]}"
415 ) 431 )
416 432
417 autotools-utils_src_configure "$@" 433 autotools-utils_src_configure "$@"
418} 434}
419 435
463# Run X-specific post-installation tasks on the live filesystem. The 479# Run X-specific post-installation tasks on the live filesystem. The
464# only task right now is some setup for font packages. 480# only task right now is some setup for font packages.
465xorg-2_pkg_postinst() { 481xorg-2_pkg_postinst() {
466 debug-print-function ${FUNCNAME} "$@" 482 debug-print-function ${FUNCNAME} "$@"
467 483
468 [[ -n ${FONT} ]] && setup_fonts "$@" 484 if [[ -n ${FONT} ]]; then
485 create_fonts_scale
486 create_fonts_dir
487 font_pkg_postinst "$@"
488 fi
469} 489}
470 490
471# @FUNCTION: xorg-2_pkg_postrm 491# @FUNCTION: xorg-2_pkg_postrm
472# @DESCRIPTION: 492# @DESCRIPTION:
473# 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
474# task right now is some cleanup for font packages. 494# task right now is some cleanup for font packages.
475xorg-2_pkg_postrm() { 495xorg-2_pkg_postrm() {
476 debug-print-function ${FUNCNAME} "$@" 496 debug-print-function ${FUNCNAME} "$@"
477 497
478 [[ -n ${FONT} ]] && font_pkg_postrm "$@" 498 if [[ -n ${FONT} ]]; then
479} 499 # if we're doing an upgrade, postinst will do
480 500 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
484setup_fonts() {
485 debug-print-function ${FUNCNAME} "$@"
486
487 create_fonts_scale 501 create_fonts_scale
488 create_fonts_dir 502 create_fonts_dir
489 font_pkg_postinst 503 font_pkg_postrm "$@"
504 fi
505 fi
490} 506}
491 507
492# @FUNCTION: remove_font_metadata 508# @FUNCTION: remove_font_metadata
493# @DESCRIPTION: 509# @DESCRIPTION:
494# 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
507# 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.
508create_fonts_scale() { 524create_fonts_scale() {
509 debug-print-function ${FUNCNAME} "$@" 525 debug-print-function ${FUNCNAME} "$@"
510 526
511 if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then 527 if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then
512 ebegin "Generating font.scale" 528 ebegin "Generating fonts.scale"
513 mkfontscale \ 529 mkfontscale \
514 -a "${EROOT}/usr/share/fonts/encodings/encodings.dir" \ 530 -a "${EROOT}/usr/share/fonts/encodings/encodings.dir" \
515 -- "${EROOT}/usr/share/fonts/${FONT_DIR}" 531 -- "${EROOT}/usr/share/fonts/${FONT_DIR}"
516 eend $? 532 eend $?
517 fi 533 fi

Legend:
Removed from v.1.34  
changed lines
  Added in v.1.53

  ViewVC Help
Powered by ViewVC 1.1.20