/[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.20 Revision 1.21
1# Copyright 1999-2010 Gentoo Foundation 1# Copyright 1999-2010 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.20 2010/11/09 18:25:00 scarabeus Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/xorg-2.eclass,v 1.21 2011/01/06 11:01:59 scarabeus 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# @BLURB: Reduces code duplication in the modularized X11 ebuilds. 8# @BLURB: Reduces code duplication in the modularized X11 ebuilds.
41inherit eutils base libtool multilib toolchain-funcs flag-o-matic autotools \ 41inherit eutils base libtool multilib toolchain-funcs flag-o-matic autotools \
42 ${FONT_ECLASS} ${GIT_ECLASS} 42 ${FONT_ECLASS} ${GIT_ECLASS}
43 43
44EXPORTED_FUNCTIONS="src_unpack src_compile src_install pkg_postinst pkg_postrm" 44EXPORTED_FUNCTIONS="src_unpack src_compile src_install pkg_postinst pkg_postrm"
45case "${EAPI:-0}" in 45case "${EAPI:-0}" in
46 3) EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare src_configure" ;; 46 3|4) EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare src_configure" ;;
47 *) die "EAPI-UNSUPPORTED" ;; 47 *) die "EAPI-UNSUPPORTED" ;;
48esac 48esac
49 49
50# exports must be ALWAYS after inherit 50# exports must be ALWAYS after inherit
51EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS} 51EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS}
65# @DESCRIPTION: 65# @DESCRIPTION:
66# The subdirectory to download source from. Possible settings are app, 66# The subdirectory to download source from. Possible settings are app,
67# doc, data, util, driver, font, lib, proto, xserver. Set above the 67# doc, data, util, driver, font, lib, proto, xserver. Set above the
68# inherit to override the default autoconfigured module. 68# inherit to override the default autoconfigured module.
69if [[ -z ${MODULE} ]]; then 69if [[ -z ${MODULE} ]]; then
70 MODULE=""
71 case ${CATEGORY} in 70 case ${CATEGORY} in
72 app-doc) MODULE="doc" ;; 71 app-doc) MODULE="doc" ;;
73 media-fonts) MODULE="font" ;; 72 media-fonts) MODULE="font" ;;
74 x11-apps|x11-wm) MODULE="app" ;; 73 x11-apps|x11-wm) MODULE="app" ;;
75 x11-misc|x11-themes) MODULE="util" ;; 74 x11-misc|x11-themes) MODULE="util" ;;
76 x11-drivers) MODULE="driver" ;; 75 x11-drivers) MODULE="driver" ;;
77 x11-base) MODULE="xserver" ;; 76 x11-base) MODULE="xserver" ;;
78 x11-proto) MODULE="proto" ;; 77 x11-proto) MODULE="proto" ;;
79 x11-libs) MODULE="lib" ;; 78 x11-libs) MODULE="lib" ;;
79 *) MODULE="" ;;
80 esac 80 esac
81fi 81fi
82 82
83# @ECLASS-VARIABLE: PACKAGE_NAME 83# @ECLASS-VARIABLE: PACKAGE_NAME
84# @DESCRIPTION: 84# @DESCRIPTION:
85# For git checkout git repository migth differ from package name 85# For git checkout the git repository migth differ from package name.
86# so it can be overriden via this variable. 86# This variable can be used for proper directory specification
87: ${PACKAGE_NAME:=${PN}} 87: ${PACKAGE_NAME:=${PN}}
88 88
89if [[ -n ${GIT_ECLASS} ]]; then 89if [[ -n ${GIT_ECLASS} ]]; then
90 EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/${MODULE}/${PACKAGE_NAME}" 90 EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/${MODULE}/${PACKAGE_NAME}"
91else 91else
180 180
181# @FUNCTION: xorg-2_pkg_setup 181# @FUNCTION: xorg-2_pkg_setup
182# @DESCRIPTION: 182# @DESCRIPTION:
183# Setup prefix compat 183# Setup prefix compat
184xorg-2_pkg_setup() { 184xorg-2_pkg_setup() {
185 debug-print-function ${FUNCNAME} "$@"
186
185 [[ ${FONT} == yes ]] && font_pkg_setup 187 [[ ${FONT} == yes ]] && font_pkg_setup "$@"
186} 188}
187 189
188# @FUNCTION: xorg-2_src_unpack 190# @FUNCTION: xorg-2_src_unpack
189# @DESCRIPTION: 191# @DESCRIPTION:
190# Simply unpack source code. 192# Simply unpack source code.
191xorg-2_src_unpack() { 193xorg-2_src_unpack() {
194 debug-print-function ${FUNCNAME} "$@"
195
192 if [[ -n ${GIT_ECLASS} ]]; then 196 if [[ -n ${GIT_ECLASS} ]]; then
193 git_src_unpack 197 git_src_unpack
194 else 198 else
195 unpack ${A} 199 unpack ${A}
196 fi 200 fi
200 204
201# @FUNCTION: xorg-2_patch_source 205# @FUNCTION: xorg-2_patch_source
202# @DESCRIPTION: 206# @DESCRIPTION:
203# Apply all patches 207# Apply all patches
204xorg-2_patch_source() { 208xorg-2_patch_source() {
209 debug-print-function ${FUNCNAME} "$@"
210
205 # Use standardized names and locations with bulk patching 211 # Use standardized names and locations with bulk patching
206 # Patch directory is ${WORKDIR}/patch 212 # Patch directory is ${WORKDIR}/patch
207 # See epatch() in eutils.eclass for more documentation 213 # See epatch() in eutils.eclass for more documentation
208 EPATCH_SUFFIX=${EPATCH_SUFFIX:=patch} 214 EPATCH_SUFFIX=${EPATCH_SUFFIX:=patch}
209 215
210 [[ -d "${EPATCH_SOURCE}" ]] && epatch 216 [[ -d "${EPATCH_SOURCE}" ]] && epatch
211 base_src_prepare 217 base_src_prepare "$@"
212} 218}
213 219
214# @FUNCTION: xorg-2_reconf_source 220# @FUNCTION: xorg-2_reconf_source
215# @DESCRIPTION: 221# @DESCRIPTION:
216# Run eautoreconf if necessary, and run elibtoolize. 222# Run eautoreconf if necessary, and run elibtoolize.
217xorg-2_reconf_source() { 223xorg-2_reconf_source() {
224 debug-print-function ${FUNCNAME} "$@"
225
218 case ${CHOST} in 226 case ${CHOST} in
219 *-interix* | *-aix* | *-winnt*) 227 *-interix* | *-aix* | *-winnt*)
220 # some hosts need full eautoreconf 228 # some hosts need full eautoreconf
221 [[ -e "./configure.ac" || -e "./configure.in" ]] && eautoreconf || ewarn "Unable to autoreconf the configure script. Things may fail." 229 [[ -e "./configure.ac" || -e "./configure.in" ]] && eautoreconf || ewarn "Unable to autoreconf the configure script. Things may fail."
222 ;; 230 ;;
229 237
230# @FUNCTION: xorg-2_src_prepare 238# @FUNCTION: xorg-2_src_prepare
231# @DESCRIPTION: 239# @DESCRIPTION:
232# Prepare a package after unpacking, performing all X-related tasks. 240# Prepare a package after unpacking, performing all X-related tasks.
233xorg-2_src_prepare() { 241xorg-2_src_prepare() {
242 debug-print-function ${FUNCNAME} "$@"
243
234 [[ -n ${GIT_ECLASS} ]] && git_src_prepare 244 [[ -n ${GIT_ECLASS} ]] && git_src_prepare
235 xorg-2_patch_source 245 xorg-2_patch_source
236 xorg-2_reconf_source 246 xorg-2_reconf_source
237} 247}
238 248
239# @FUNCTION: xorg-2_font_configure 249# @FUNCTION: xorg-2_font_configure
240# @DESCRIPTION: 250# @DESCRIPTION:
241# If a font package, perform any necessary configuration steps 251# If a font package, perform any necessary configuration steps
242xorg-2_font_configure() { 252xorg-2_font_configure() {
253 debug-print-function ${FUNCNAME} "$@"
254
243 if has nls ${IUSE//+} && ! use nls; then 255 if has nls ${IUSE//+} && ! use nls; then
244 FONT_OPTIONS+=" 256 FONT_OPTIONS+="
245 --disable-iso8859-2 257 --disable-iso8859-2
246 --disable-iso8859-3 258 --disable-iso8859-3
247 --disable-iso8859-4 259 --disable-iso8859-4
264 276
265# @FUNCTION: xorg-2_flags_setup 277# @FUNCTION: xorg-2_flags_setup
266# @DESCRIPTION: 278# @DESCRIPTION:
267# Set up CFLAGS for a debug build 279# Set up CFLAGS for a debug build
268xorg-2_flags_setup() { 280xorg-2_flags_setup() {
281 debug-print-function ${FUNCNAME} "$@"
282
269 # Win32 require special define 283 # Win32 require special define
270 [[ ${CHOST} == *-winnt* ]] && append-cppflags -DWIN32 -D__STDC__ 284 [[ ${CHOST} == *-winnt* ]] && append-cppflags -DWIN32 -D__STDC__
271 # hardened ldflags 285 # hardened ldflags
272 [[ ${PN} = xorg-server || -n ${DRIVER} ]] && append-ldflags -Wl,-z,lazy 286 [[ ${PN} = xorg-server || -n ${DRIVER} ]] && append-ldflags -Wl,-z,lazy
273 287
281 295
282# @FUNCTION: xorg-2_src_configure 296# @FUNCTION: xorg-2_src_configure
283# @DESCRIPTION: 297# @DESCRIPTION:
284# Perform any necessary pre-configuration steps, then run configure 298# Perform any necessary pre-configuration steps, then run configure
285xorg-2_src_configure() { 299xorg-2_src_configure() {
300 debug-print-function ${FUNCNAME} "$@"
286 local myopts="" 301 local myopts=""
287 302
288 xorg-2_flags_setup 303 xorg-2_flags_setup
289 [[ -n "${FONT}" ]] && xorg-2_font_configure 304 [[ -n "${FONT}" ]] && xorg-2_font_configure
290 305
306 321
307# @FUNCTION: xorg-2_src_compile 322# @FUNCTION: xorg-2_src_compile
308# @DESCRIPTION: 323# @DESCRIPTION:
309# Compile a package, performing all X-related tasks. 324# Compile a package, performing all X-related tasks.
310xorg-2_src_compile() { 325xorg-2_src_compile() {
326 debug-print-function ${FUNCNAME} "$@"
327
311 base_src_compile 328 base_src_compile "$@"
312} 329}
313 330
314# @FUNCTION: xorg-2_src_install 331# @FUNCTION: xorg-2_src_install
315# @DESCRIPTION: 332# @DESCRIPTION:
316# Install a built package to ${D}, performing any necessary steps. 333# Install a built package to ${D}, performing any necessary steps.
317# Creates a ChangeLog from git if using live ebuilds. 334# Creates a ChangeLog from git if using live ebuilds.
318xorg-2_src_install() { 335xorg-2_src_install() {
336 debug-print-function ${FUNCNAME} "$@"
337
319 if [[ ${CATEGORY} == x11-proto ]]; then 338 if [[ ${CATEGORY} == x11-proto ]]; then
320 emake \ 339 emake \
321 ${PN/proto/}docdir=${EPREFIX}/usr/share/doc/${PF} \ 340 ${PN/proto/}docdir=${EPREFIX}/usr/share/doc/${PF} \
322 docdir=${EPREFIX}/usr/share/doc/${PF} \ 341 docdir=${EPREFIX}/usr/share/doc/${PF} \
323 DESTDIR="${D}" \ 342 DESTDIR="${D}" \
334 git log ${EGIT_COMMIT} > "${S}"/ChangeLog 353 git log ${EGIT_COMMIT} > "${S}"/ChangeLog
335 popd > /dev/null 354 popd > /dev/null
336 fi 355 fi
337 356
338 if [[ -e "${S}"/ChangeLog ]]; then 357 if [[ -e "${S}"/ChangeLog ]]; then
339 dodoc "${S}"/ChangeLog 358 dodoc "${S}"/ChangeLog || die "dodoc failed"
340 fi 359 fi
341 # @VARIABLE: DOCS 360 # @VARIABLE: DOCS
342 # @DESCRIPTION: 361 # @DESCRIPTION:
343 # Any documentation to install 362 # Any documentation to install
344 # @DEFAULT_UNSET 363 # @DEFAULT_UNSET
358# @FUNCTION: xorg-2_pkg_postinst 377# @FUNCTION: xorg-2_pkg_postinst
359# @DESCRIPTION: 378# @DESCRIPTION:
360# Run X-specific post-installation tasks on the live filesystem. The 379# Run X-specific post-installation tasks on the live filesystem. The
361# only task right now is some setup for font packages. 380# only task right now is some setup for font packages.
362xorg-2_pkg_postinst() { 381xorg-2_pkg_postinst() {
382 debug-print-function ${FUNCNAME} "$@"
383
363 [[ -n ${FONT} ]] && setup_fonts 384 [[ -n ${FONT} ]] && setup_fonts "$@"
364} 385}
365 386
366# @FUNCTION: xorg-2_pkg_postrm 387# @FUNCTION: xorg-2_pkg_postrm
367# @DESCRIPTION: 388# @DESCRIPTION:
368# Run X-specific post-removal tasks on the live filesystem. The only 389# Run X-specific post-removal tasks on the live filesystem. The only
369# task right now is some cleanup for font packages. 390# task right now is some cleanup for font packages.
370xorg-2_pkg_postrm() { 391xorg-2_pkg_postrm() {
371 if [[ -n ${FONT} ]]; then 392 debug-print-function ${FUNCNAME} "$@"
372 font_pkg_postrm 393
373 fi 394 [[ -n ${FONT} ]] && font_pkg_postrm "$@"
374} 395}
375 396
376# @FUNCTION: setup_fonts 397# @FUNCTION: setup_fonts
377# @DESCRIPTION: 398# @DESCRIPTION:
378# Generates needed files for fonts and fixes font permissions 399# Generates needed files for fonts and fixes font permissions
379setup_fonts() { 400setup_fonts() {
401 debug-print-function ${FUNCNAME} "$@"
402
380 create_fonts_scale 403 create_fonts_scale
381 create_fonts_dir 404 create_fonts_dir
382 font_pkg_postinst 405 font_pkg_postinst
383} 406}
384 407
385# @FUNCTION: remove_font_metadata 408# @FUNCTION: remove_font_metadata
386# @DESCRIPTION: 409# @DESCRIPTION:
387# Don't let the package install generated font files that may overlap 410# Don't let the package install generated font files that may overlap
388# with other packages. Instead, they're generated in pkg_postinst(). 411# with other packages. Instead, they're generated in pkg_postinst().
389remove_font_metadata() { 412remove_font_metadata() {
413 debug-print-function ${FUNCNAME} "$@"
414
390 if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then 415 if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then
391 einfo "Removing font metadata" 416 einfo "Removing font metadata"
392 rm -rf "${ED}"/usr/share/fonts/${FONT_DIR}/fonts.{scale,dir,cache-1} 417 rm -rf "${ED}"/usr/share/fonts/${FONT_DIR}/fonts.{scale,dir,cache-1}
393 fi 418 fi
394} 419}
395 420
396# @FUNCTION: create_fonts_scale 421# @FUNCTION: create_fonts_scale
397# @DESCRIPTION: 422# @DESCRIPTION:
398# Create fonts.scale file, used by the old server-side fonts subsystem. 423# Create fonts.scale file, used by the old server-side fonts subsystem.
399create_fonts_scale() { 424create_fonts_scale() {
425 debug-print-function ${FUNCNAME} "$@"
426
400 if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then 427 if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then
401 ebegin "Generating font.scale" 428 ebegin "Generating font.scale"
402 mkfontscale \ 429 mkfontscale \
403 -a "${EROOT}/usr/share/fonts/encodings/encodings.dir" \ 430 -a "${EROOT}/usr/share/fonts/encodings/encodings.dir" \
404 -- "${EROOT}/usr/share/fonts/${FONT_DIR}" 431 -- "${EROOT}/usr/share/fonts/${FONT_DIR}"
408 435
409# @FUNCTION: create_fonts_dir 436# @FUNCTION: create_fonts_dir
410# @DESCRIPTION: 437# @DESCRIPTION:
411# Create fonts.dir file, used by the old server-side fonts subsystem. 438# Create fonts.dir file, used by the old server-side fonts subsystem.
412create_fonts_dir() { 439create_fonts_dir() {
440 debug-print-function ${FUNCNAME} "$@"
441
413 ebegin "Generating fonts.dir" 442 ebegin "Generating fonts.dir"
414 mkfontdir \ 443 mkfontdir \
415 -e "${EROOT}"/usr/share/fonts/encodings \ 444 -e "${EROOT}"/usr/share/fonts/encodings \
416 -e "${EROOT}"/usr/share/fonts/encodings/large \ 445 -e "${EROOT}"/usr/share/fonts/encodings/large \
417 -- "${EROOT}/usr/share/fonts/${FONT_DIR}" 446 -- "${EROOT}/usr/share/fonts/${FONT_DIR}"

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.21

  ViewVC Help
Powered by ViewVC 1.1.20