/[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.19 Revision 1.22
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.19 2010/11/05 12:11:55 scarabeus Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/xorg-2.eclass,v 1.22 2011/01/15 17:55:21 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
84# @DESCRIPTION:
85# For git checkout the git repository migth differ from package name.
86# This variable can be used for proper directory specification
87: ${PACKAGE_NAME:=${PN}}
88
83if [[ -n ${GIT_ECLASS} ]]; then 89if [[ -n ${GIT_ECLASS} ]]; then
84 EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/${MODULE}/${PN}" 90 EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/${MODULE}/${PACKAGE_NAME}"
85else 91else
86 SRC_URI+=" ${BASE_INDIVIDUAL_URI}/${MODULE}/${P}.tar.bz2" 92 SRC_URI+=" ${BASE_INDIVIDUAL_URI}/${MODULE}/${P}.tar.bz2"
87fi 93fi
88 94
89: ${SLOT:=0} 95: ${SLOT:=0}
174 180
175# @FUNCTION: xorg-2_pkg_setup 181# @FUNCTION: xorg-2_pkg_setup
176# @DESCRIPTION: 182# @DESCRIPTION:
177# Setup prefix compat 183# Setup prefix compat
178xorg-2_pkg_setup() { 184xorg-2_pkg_setup() {
185 debug-print-function ${FUNCNAME} "$@"
186
179 [[ ${FONT} == yes ]] && font_pkg_setup 187 [[ ${FONT} == yes ]] && font_pkg_setup "$@"
180} 188}
181 189
182# @FUNCTION: xorg-2_src_unpack 190# @FUNCTION: xorg-2_src_unpack
183# @DESCRIPTION: 191# @DESCRIPTION:
184# Simply unpack source code. 192# Simply unpack source code.
185xorg-2_src_unpack() { 193xorg-2_src_unpack() {
194 debug-print-function ${FUNCNAME} "$@"
195
186 if [[ -n ${GIT_ECLASS} ]]; then 196 if [[ -n ${GIT_ECLASS} ]]; then
187 git_src_unpack 197 git_src_unpack
188 else 198 else
189 unpack ${A} 199 unpack ${A}
190 fi 200 fi
194 204
195# @FUNCTION: xorg-2_patch_source 205# @FUNCTION: xorg-2_patch_source
196# @DESCRIPTION: 206# @DESCRIPTION:
197# Apply all patches 207# Apply all patches
198xorg-2_patch_source() { 208xorg-2_patch_source() {
209 debug-print-function ${FUNCNAME} "$@"
210
199 # Use standardized names and locations with bulk patching 211 # Use standardized names and locations with bulk patching
200 # Patch directory is ${WORKDIR}/patch 212 # Patch directory is ${WORKDIR}/patch
201 # See epatch() in eutils.eclass for more documentation 213 # See epatch() in eutils.eclass for more documentation
202 EPATCH_SUFFIX=${EPATCH_SUFFIX:=patch} 214 EPATCH_SUFFIX=${EPATCH_SUFFIX:=patch}
203 215
204 [[ -d "${EPATCH_SOURCE}" ]] && epatch 216 [[ -d "${EPATCH_SOURCE}" ]] && epatch
205 base_src_prepare 217 base_src_prepare "$@"
206} 218}
207 219
208# @FUNCTION: xorg-2_reconf_source 220# @FUNCTION: xorg-2_reconf_source
209# @DESCRIPTION: 221# @DESCRIPTION:
210# Run eautoreconf if necessary, and run elibtoolize. 222# Run eautoreconf if necessary, and run elibtoolize.
211xorg-2_reconf_source() { 223xorg-2_reconf_source() {
224 debug-print-function ${FUNCNAME} "$@"
225
212 case ${CHOST} in 226 case ${CHOST} in
213 *-interix* | *-aix* | *-winnt*) 227 *-interix* | *-aix* | *-winnt*)
214 # some hosts need full eautoreconf 228 # some hosts need full eautoreconf
215 [[ -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."
216 ;; 230 ;;
223 237
224# @FUNCTION: xorg-2_src_prepare 238# @FUNCTION: xorg-2_src_prepare
225# @DESCRIPTION: 239# @DESCRIPTION:
226# Prepare a package after unpacking, performing all X-related tasks. 240# Prepare a package after unpacking, performing all X-related tasks.
227xorg-2_src_prepare() { 241xorg-2_src_prepare() {
242 debug-print-function ${FUNCNAME} "$@"
243
228 [[ -n ${GIT_ECLASS} ]] && git_src_prepare 244 [[ -n ${GIT_ECLASS} ]] && git_src_prepare
229 xorg-2_patch_source 245 xorg-2_patch_source
230 xorg-2_reconf_source 246 xorg-2_reconf_source
231} 247}
232 248
233# @FUNCTION: xorg-2_font_configure 249# @FUNCTION: xorg-2_font_configure
234# @DESCRIPTION: 250# @DESCRIPTION:
235# If a font package, perform any necessary configuration steps 251# If a font package, perform any necessary configuration steps
236xorg-2_font_configure() { 252xorg-2_font_configure() {
253 debug-print-function ${FUNCNAME} "$@"
254
237 if has nls ${IUSE//+} && ! use nls; then 255 if has nls ${IUSE//+} && ! use nls; then
238 FONT_OPTIONS+=" 256 FONT_OPTIONS+="
239 --disable-iso8859-2 257 --disable-iso8859-2
240 --disable-iso8859-3 258 --disable-iso8859-3
241 --disable-iso8859-4 259 --disable-iso8859-4
258 276
259# @FUNCTION: xorg-2_flags_setup 277# @FUNCTION: xorg-2_flags_setup
260# @DESCRIPTION: 278# @DESCRIPTION:
261# Set up CFLAGS for a debug build 279# Set up CFLAGS for a debug build
262xorg-2_flags_setup() { 280xorg-2_flags_setup() {
281 debug-print-function ${FUNCNAME} "$@"
282
263 # Win32 require special define 283 # Win32 require special define
264 [[ ${CHOST} == *-winnt* ]] && append-cppflags -DWIN32 -D__STDC__ 284 [[ ${CHOST} == *-winnt* ]] && append-cppflags -DWIN32 -D__STDC__
265 # hardened ldflags 285 # hardened ldflags
266 [[ ${PN} = xorg-server || -n ${DRIVER} ]] && append-ldflags -Wl,-z,lazy 286 [[ ${PN} = xorg-server || -n ${DRIVER} ]] && append-ldflags -Wl,-z,lazy
267 287
275 295
276# @FUNCTION: xorg-2_src_configure 296# @FUNCTION: xorg-2_src_configure
277# @DESCRIPTION: 297# @DESCRIPTION:
278# Perform any necessary pre-configuration steps, then run configure 298# Perform any necessary pre-configuration steps, then run configure
279xorg-2_src_configure() { 299xorg-2_src_configure() {
300 debug-print-function ${FUNCNAME} "$@"
280 local myopts="" 301 local myopts=""
281 302
282 xorg-2_flags_setup 303 xorg-2_flags_setup
283 [[ -n "${FONT}" ]] && xorg-2_font_configure 304 [[ -n "${FONT}" ]] && xorg-2_font_configure
284 305
290 if [[ -x ${ECONF_SOURCE:-.}/configure ]]; then 311 if [[ -x ${ECONF_SOURCE:-.}/configure ]]; then
291 if has static-libs ${IUSE//+}; then 312 if has static-libs ${IUSE//+}; then
292 myopts+=" $(use_enable static-libs static)" 313 myopts+=" $(use_enable static-libs static)"
293 fi 314 fi
294 econf \ 315 econf \
316 --disable-dependency-tracking \
295 ${FONT_OPTIONS} \ 317 ${FONT_OPTIONS} \
296 ${CONFIGURE_OPTIONS} \ 318 ${CONFIGURE_OPTIONS} \
297 ${myopts} 319 ${myopts}
298 fi 320 fi
299} 321}
300 322
301# @FUNCTION: xorg-2_src_compile 323# @FUNCTION: xorg-2_src_compile
302# @DESCRIPTION: 324# @DESCRIPTION:
303# Compile a package, performing all X-related tasks. 325# Compile a package, performing all X-related tasks.
304xorg-2_src_compile() { 326xorg-2_src_compile() {
327 debug-print-function ${FUNCNAME} "$@"
328
305 base_src_compile 329 base_src_compile "$@"
306} 330}
307 331
308# @FUNCTION: xorg-2_src_install 332# @FUNCTION: xorg-2_src_install
309# @DESCRIPTION: 333# @DESCRIPTION:
310# Install a built package to ${D}, performing any necessary steps. 334# Install a built package to ${D}, performing any necessary steps.
311# Creates a ChangeLog from git if using live ebuilds. 335# Creates a ChangeLog from git if using live ebuilds.
312xorg-2_src_install() { 336xorg-2_src_install() {
337 debug-print-function ${FUNCNAME} "$@"
338
313 if [[ ${CATEGORY} == x11-proto ]]; then 339 if [[ ${CATEGORY} == x11-proto ]]; then
314 emake \ 340 emake \
315 ${PN/proto/}docdir=${EPREFIX}/usr/share/doc/${PF} \ 341 ${PN/proto/}docdir=${EPREFIX}/usr/share/doc/${PF} \
316 docdir=${EPREFIX}/usr/share/doc/${PF} \ 342 docdir=${EPREFIX}/usr/share/doc/${PF} \
317 DESTDIR="${D}" \ 343 DESTDIR="${D}" \
328 git log ${EGIT_COMMIT} > "${S}"/ChangeLog 354 git log ${EGIT_COMMIT} > "${S}"/ChangeLog
329 popd > /dev/null 355 popd > /dev/null
330 fi 356 fi
331 357
332 if [[ -e "${S}"/ChangeLog ]]; then 358 if [[ -e "${S}"/ChangeLog ]]; then
333 dodoc "${S}"/ChangeLog 359 dodoc "${S}"/ChangeLog || die "dodoc failed"
334 fi 360 fi
335 # @VARIABLE: DOCS 361 # @VARIABLE: DOCS
336 # @DESCRIPTION: 362 # @DESCRIPTION:
337 # Any documentation to install 363 # Any documentation to install
338 # @DEFAULT_UNSET 364 # @DEFAULT_UNSET
352# @FUNCTION: xorg-2_pkg_postinst 378# @FUNCTION: xorg-2_pkg_postinst
353# @DESCRIPTION: 379# @DESCRIPTION:
354# Run X-specific post-installation tasks on the live filesystem. The 380# Run X-specific post-installation tasks on the live filesystem. The
355# only task right now is some setup for font packages. 381# only task right now is some setup for font packages.
356xorg-2_pkg_postinst() { 382xorg-2_pkg_postinst() {
383 debug-print-function ${FUNCNAME} "$@"
384
357 [[ -n ${FONT} ]] && setup_fonts 385 [[ -n ${FONT} ]] && setup_fonts "$@"
358} 386}
359 387
360# @FUNCTION: xorg-2_pkg_postrm 388# @FUNCTION: xorg-2_pkg_postrm
361# @DESCRIPTION: 389# @DESCRIPTION:
362# Run X-specific post-removal tasks on the live filesystem. The only 390# Run X-specific post-removal tasks on the live filesystem. The only
363# task right now is some cleanup for font packages. 391# task right now is some cleanup for font packages.
364xorg-2_pkg_postrm() { 392xorg-2_pkg_postrm() {
365 if [[ -n ${FONT} ]]; then 393 debug-print-function ${FUNCNAME} "$@"
366 font_pkg_postrm 394
367 fi 395 [[ -n ${FONT} ]] && font_pkg_postrm "$@"
368} 396}
369 397
370# @FUNCTION: setup_fonts 398# @FUNCTION: setup_fonts
371# @DESCRIPTION: 399# @DESCRIPTION:
372# Generates needed files for fonts and fixes font permissions 400# Generates needed files for fonts and fixes font permissions
373setup_fonts() { 401setup_fonts() {
402 debug-print-function ${FUNCNAME} "$@"
403
374 create_fonts_scale 404 create_fonts_scale
375 create_fonts_dir 405 create_fonts_dir
376 font_pkg_postinst 406 font_pkg_postinst
377} 407}
378 408
379# @FUNCTION: remove_font_metadata 409# @FUNCTION: remove_font_metadata
380# @DESCRIPTION: 410# @DESCRIPTION:
381# Don't let the package install generated font files that may overlap 411# Don't let the package install generated font files that may overlap
382# with other packages. Instead, they're generated in pkg_postinst(). 412# with other packages. Instead, they're generated in pkg_postinst().
383remove_font_metadata() { 413remove_font_metadata() {
414 debug-print-function ${FUNCNAME} "$@"
415
384 if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then 416 if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then
385 einfo "Removing font metadata" 417 einfo "Removing font metadata"
386 rm -rf "${ED}"/usr/share/fonts/${FONT_DIR}/fonts.{scale,dir,cache-1} 418 rm -rf "${ED}"/usr/share/fonts/${FONT_DIR}/fonts.{scale,dir,cache-1}
387 fi 419 fi
388} 420}
389 421
390# @FUNCTION: create_fonts_scale 422# @FUNCTION: create_fonts_scale
391# @DESCRIPTION: 423# @DESCRIPTION:
392# Create fonts.scale file, used by the old server-side fonts subsystem. 424# Create fonts.scale file, used by the old server-side fonts subsystem.
393create_fonts_scale() { 425create_fonts_scale() {
426 debug-print-function ${FUNCNAME} "$@"
427
394 if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then 428 if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then
395 ebegin "Generating font.scale" 429 ebegin "Generating font.scale"
396 mkfontscale \ 430 mkfontscale \
397 -a "${EROOT}/usr/share/fonts/encodings/encodings.dir" \ 431 -a "${EROOT}/usr/share/fonts/encodings/encodings.dir" \
398 -- "${EROOT}/usr/share/fonts/${FONT_DIR}" 432 -- "${EROOT}/usr/share/fonts/${FONT_DIR}"
402 436
403# @FUNCTION: create_fonts_dir 437# @FUNCTION: create_fonts_dir
404# @DESCRIPTION: 438# @DESCRIPTION:
405# Create fonts.dir file, used by the old server-side fonts subsystem. 439# Create fonts.dir file, used by the old server-side fonts subsystem.
406create_fonts_dir() { 440create_fonts_dir() {
441 debug-print-function ${FUNCNAME} "$@"
442
407 ebegin "Generating fonts.dir" 443 ebegin "Generating fonts.dir"
408 mkfontdir \ 444 mkfontdir \
409 -e "${EROOT}"/usr/share/fonts/encodings \ 445 -e "${EROOT}"/usr/share/fonts/encodings \
410 -e "${EROOT}"/usr/share/fonts/encodings/large \ 446 -e "${EROOT}"/usr/share/fonts/encodings/large \
411 -- "${EROOT}/usr/share/fonts/${FONT_DIR}" 447 -- "${EROOT}/usr/share/fonts/${FONT_DIR}"

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.22

  ViewVC Help
Powered by ViewVC 1.1.20