/[gentoo-x86]/eclass/x-modular.eclass
Gentoo

Diff of /eclass/x-modular.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.107 Revision 1.112
1# Copyright 1999-2005 Gentoo Foundation 1# Copyright 1999-2005 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/x-modular.eclass,v 1.107 2009/03/03 16:28:32 remi Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/x-modular.eclass,v 1.112 2009/08/27 15:16:09 scarabeus Exp $
4# 4#
5# @ECLASS: x-modular.eclass 5# @ECLASS: x-modular.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Donnie Berkholz <dberkholz@gentoo.org>, x11@gentoo.org 7# Donnie Berkholz <dberkholz@gentoo.org>, x11@gentoo.org
8# @BLURB: Reduces code duplication in the modularized X11 ebuilds. 8# @BLURB: Reduces code duplication in the modularized X11 ebuilds.
15# All you need to do in a basic ebuild is inherit this eclass and set 15# 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 16# 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 17# with the other X packages, you don't need to set SRC_URI. Pretty much
18# everything else should be automatic. 18# everything else should be automatic.
19 19
20if [[ ${PV} = 9999* ]]; then
21 GIT_ECLASS="git"
22 SNAPSHOT="yes"
23 SRC_URI=""
24fi
25
26# If we're a font package, but not the font.alias one
27FONT_ECLASS=""
28if [[ "${PN/#font-}" != "${PN}" ]] \
29 && [[ "${CATEGORY}" = "media-fonts" ]] \
30 && [[ "${PN}" != "font-alias" ]] \
31 && [[ "${PN}" != "font-util" ]]; then
32 # Activate font code in the rest of the eclass
33 FONT="yes"
34
35 # Whether to inherit the font eclass
36 FONT_ECLASS="font"
37fi
38
39inherit eutils libtool multilib toolchain-funcs flag-o-matic autotools \
40 ${FONT_ECLASS} ${GIT_ECLASS}
41
42EXPORTED_FUNCTIONS="src_unpack src_compile src_install pkg_preinst pkg_postinst pkg_postrm"
43
44case "${EAPI:-0}" in
45 0|1)
46 ;;
47 2)
48 EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare src_configure"
49 ;;
50 *)
51 die "Unknown EAPI ${EAPI}"
52 ;;
53esac
54
55# exports must be ALWAYS after inherit
56EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS}
57
20# @ECLASS-VARIABLE: XDIR 58# @ECLASS-VARIABLE: XDIR
21# @DESCRIPTION: 59# @DESCRIPTION:
22# Directory prefix to use for everything. If you want to install to a 60# Directory prefix to use for everything. If you want to install to a
23# non-default prefix (e.g., /opt/xorg), change XDIR. This has not been 61# non-default prefix (e.g., /opt/xorg), change XDIR. This has not been
24# recently tested. You may need to uncomment the setting of datadir and 62# recently tested. You may need to uncomment the setting of datadir and
33# @ECLASS-VARIABLE: SNAPSHOT 71# @ECLASS-VARIABLE: SNAPSHOT
34# @DESCRIPTION: 72# @DESCRIPTION:
35# If set to 'yes' and configure.ac exists, eautoreconf will run. Set 73# If set to 'yes' and configure.ac exists, eautoreconf will run. Set
36# before inheriting this eclass. 74# before inheriting this eclass.
37 SNAPSHOT="no" 75 SNAPSHOT="no"
38fi
39
40if [[ ${PV} = 9999* ]]; then
41 GIT_ECLASS="git"
42 SNAPSHOT="yes"
43 SRC_URI=""
44fi 76fi
45 77
46# Set up SRC_URI for individual modular releases 78# Set up SRC_URI for individual modular releases
47BASE_INDIVIDUAL_URI="http://xorg.freedesktop.org/releases/individual" 79BASE_INDIVIDUAL_URI="http://xorg.freedesktop.org/releases/individual"
48# @ECLASS-VARIABLE: MODULE 80# @ECLASS-VARIABLE: MODULE
84 >=sys-devel/m4-1.4" 116 >=sys-devel/m4-1.4"
85 WANT_AUTOCONF="latest" 117 WANT_AUTOCONF="latest"
86 WANT_AUTOMAKE="latest" 118 WANT_AUTOMAKE="latest"
87fi 119fi
88 120
89# If we're a font package, but not the font.alias one 121if [[ -n "${FONT}" ]]; then
90FONT_ECLASS=""
91if [[ "${PN/#font-}" != "${PN}" ]] \
92 && [[ "${CATEGORY}" = "media-fonts" ]] \
93 && [[ "${PN}" != "font-alias" ]] \
94 && [[ "${PN}" != "font-util" ]]; then
95 # Activate font code in the rest of the eclass
96 FONT="yes"
97
98 # Whether to inherit the font eclass
99 FONT_ECLASS="font"
100
101 RDEPEND="${RDEPEND} 122 RDEPEND="${RDEPEND}
102 media-fonts/encodings 123 media-fonts/encodings
103 x11-apps/mkfontscale 124 x11-apps/mkfontscale
104 x11-apps/mkfontdir" 125 x11-apps/mkfontdir"
105 PDEPEND="${PDEPEND} 126 PDEPEND="${PDEPEND}
124 FONT_DIR=${FONT_DIR/ttf/TTF} 145 FONT_DIR=${FONT_DIR/ttf/TTF}
125 FONT_DIR=${FONT_DIR/otf/OTF} 146 FONT_DIR=${FONT_DIR/otf/OTF}
126 FONT_DIR=${FONT_DIR/type1/Type1} 147 FONT_DIR=${FONT_DIR/type1/Type1}
127 FONT_DIR=${FONT_DIR/speedo/Speedo} 148 FONT_DIR=${FONT_DIR/speedo/Speedo}
128 149
129 # Set up configure option 150 # Set up configure options, wrapped so ebuilds can override if need be
151 if [[ -z ${FONT_OPTIONS} ]]; then
130 FONT_OPTIONS="--with-fontdir=\"/usr/share/fonts/${FONT_DIR}\"" 152 FONT_OPTIONS="--with-fontdir=\"/usr/share/fonts/${FONT_DIR}\""
153 fi
131 154
132 if [[ -n "${FONT}" ]]; then 155 if [[ -n "${FONT}" ]]; then
133 if [[ ${PN##*-} = misc ]] || [[ ${PN##*-} = 75dpi ]] || [[ ${PN##*-} = 100dpi ]] || [[ ${PN##*-} = cyrillic ]]; then 156 if [[ ${PN##*-} = misc ]] || [[ ${PN##*-} = 75dpi ]] || [[ ${PN##*-} = 100dpi ]] || [[ ${PN##*-} = cyrillic ]]; then
134 IUSE="${IUSE} nls" 157 IUSE="${IUSE} nls"
135 fi 158 fi
167 190
168RDEPEND="${RDEPEND} 191RDEPEND="${RDEPEND}
169 !<=x11-base/xorg-x11-6.9" 192 !<=x11-base/xorg-x11-6.9"
170# Provides virtual/x11 for temporary use until packages are ported 193# Provides virtual/x11 for temporary use until packages are ported
171# x11-base/x11-env" 194# x11-base/x11-env"
172
173inherit eutils libtool multilib toolchain-funcs flag-o-matic autotools \
174 ${FONT_ECLASS} ${GIT_ECLASS}
175 195
176# @FUNCTION: x-modular_specs_check 196# @FUNCTION: x-modular_specs_check
177# @USAGE: 197# @USAGE:
178# @DESCRIPTION: 198# @DESCRIPTION:
179# Make any necessary changes related to gcc specs (generally hardened) 199# Make any necessary changes related to gcc specs (generally hardened)
295 # Joshua Baergen - October 23, 2005 315 # Joshua Baergen - October 23, 2005
296 # Fix shared lib issues on MIPS, FBSD, etc etc 316 # Fix shared lib issues on MIPS, FBSD, etc etc
297 elibtoolize 317 elibtoolize
298} 318}
299 319
320# @FUNCTION: x-modular_src_prepare
321# @USAGE:
322# @DESCRIPTION:
323# Prepare a package after unpacking, performing all X-related tasks.
324x-modular_src_prepare() {
325 [[ -n ${GIT_ECLASS} ]] && has src_prepare ${EXPORTED_FUNCTIONS} \
326 && git_src_prepare
327 x-modular_patch_source
328 x-modular_reconf_source
329}
330
300# @FUNCTION: x-modular_src_unpack 331# @FUNCTION: x-modular_src_unpack
301# @USAGE: 332# @USAGE:
302# @DESCRIPTION: 333# @DESCRIPTION:
303# Unpack a package, performing all X-related tasks. 334# Unpack a package, performing all X-related tasks.
304x-modular_src_unpack() { 335x-modular_src_unpack() {
305 x-modular_specs_check 336 x-modular_specs_check
306 x-modular_server_supports_drivers_check 337 x-modular_server_supports_drivers_check
307 x-modular_dri_check 338 x-modular_dri_check
308 x-modular_unpack_source 339 x-modular_unpack_source
309 x-modular_patch_source 340 has src_prepare ${EXPORTED_FUNCTIONS} || x-modular_src_prepare
310 x-modular_reconf_source
311} 341}
312 342
313# @FUNCTION: x-modular_font_configure 343# @FUNCTION: x-modular_font_configure
314# @USAGE: 344# @USAGE:
315# @DESCRIPTION: 345# @DESCRIPTION:
316# If a font package, perform any necessary configuration steps 346# If a font package, perform any necessary configuration steps
317x-modular_font_configure() { 347x-modular_font_configure() {
318 if [[ -n "${FONT}" ]]; then 348 if [[ -n "${FONT}" ]]; then
319 # Might be worth adding an option to configure your desired font 349 # Might be worth adding an option to configure your desired font
320 # and exclude all others. Also, should this USE be nls or minimal? 350 # and exclude all others. Also, should this USE be nls or minimal?
321 if ! use nls; then 351 if has nls ${IUSE//+} && ! use nls; then
322 FONT_OPTIONS="${FONT_OPTIONS} 352 FONT_OPTIONS="${FONT_OPTIONS}
323 --disable-iso8859-2 353 --disable-iso8859-2
324 --disable-iso8859-3 354 --disable-iso8859-3
325 --disable-iso8859-4 355 --disable-iso8859-4
326 --disable-iso8859-5 356 --disable-iso8859-5
383# Run make. 413# Run make.
384x-modular_src_make() { 414x-modular_src_make() {
385 emake || die "emake failed" 415 emake || die "emake failed"
386} 416}
387 417
388# @FUNCTION: x-modular_src_configure 418# @FUNCTION: x-modular_src_compile
389# @USAGE: 419# @USAGE:
390# @DESCRIPTION: 420# @DESCRIPTION:
391# Compile a package, performing all X-related tasks. 421# Compile a package, performing all X-related tasks.
392x-modular_src_compile() { 422x-modular_src_compile() {
393 x-modular_src_configure 423 has src_configure ${EXPORTED_FUNCTIONS} || x-modular_src_configure
394 x-modular_src_make 424 x-modular_src_make
395} 425}
396 426
397# @FUNCTION: x-modular_src_install 427# @FUNCTION: x-modular_src_install
398# @USAGE: 428# @USAGE:
406 ${PN/proto/}docdir=/usr/share/doc/${PF} \ 436 ${PN/proto/}docdir=/usr/share/doc/${PF} \
407 DESTDIR="${D}" \ 437 DESTDIR="${D}" \
408 install \ 438 install \
409 || die 439 || die
410 else 440 else
441 # FIXME: Drop after X fonts stop running fc-cache during install, bug #278221
442 [[ -n ${FONT} ]] && addpredict /var/cache/fontconfig
411 make \ 443 make \
412 DESTDIR="${D}" \ 444 DESTDIR="${D}" \
413 install \ 445 install \
414 || die 446 || die
415 fi 447 fi
529 die "${msg}" 561 die "${msg}"
530 fi 562 fi
531 563
532 create_fonts_scale 564 create_fonts_scale
533 create_fonts_dir 565 create_fonts_dir
534 fix_font_permissions
535 create_font_cache 566 create_font_cache
536} 567}
537 568
538# @FUNCTION: remove_font_metadata 569# @FUNCTION: remove_font_metadata
539# @USAGE: 570# @USAGE:
622 fi 653 fi
623 done 654 done
624 eend 0 655 eend 0
625} 656}
626 657
627# @FUNCTION: fix_font_permissions
628# @USAGE:
629# @DESCRIPTION:
630# Font files should have 644 permissions. Ensure this is the case.
631fix_font_permissions() {
632 ebegin "Fixing permissions"
633 for DIR in ${FONT_DIR}; do
634 find "${ROOT}"/usr/share/fonts/${DIR} -type f -name 'font.*' \
635 -exec chmod 0644 {} \;
636 done
637 eend 0
638}
639
640# @FUNCTION: create_font_cache 658# @FUNCTION: create_font_cache
641# @USAGE: 659# @USAGE:
642# @DESCRIPTION: 660# @DESCRIPTION:
643# Create fonts.cache-1 files, used by the new client-side fonts 661# Create fonts.cache-1 files, used by the new client-side fonts
644# subsystem. 662# subsystem.
645create_font_cache() { 663create_font_cache() {
646 font_pkg_postinst 664 font_pkg_postinst
647} 665}
648
649EXPORT_FUNCTIONS src_unpack src_compile src_install pkg_preinst pkg_postinst pkg_postrm

Legend:
Removed from v.1.107  
changed lines
  Added in v.1.112

  ViewVC Help
Powered by ViewVC 1.1.20