Gentoo Archives: gentoo-commits

From: Tomas Chvatal <scarabeus@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/x11:master commit in: eclass/
Date: Tue, 01 Mar 2011 18:57:34
Message-Id: 9c91c3de17649fae9e77fbc74dd5924860eda5a1.scarabeus@gentoo
1 commit: 9c91c3de17649fae9e77fbc74dd5924860eda5a1
2 Author: Tomas Chvatal <scarabeus <AT> gentoo <DOT> org>
3 AuthorDate: Tue Mar 1 18:57:18 2011 +0000
4 Commit: Tomas Chvatal <scarabeus <AT> gentoo <DOT> org>
5 CommitDate: Tue Mar 1 18:57:18 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/x11.git;a=commit;h=9c91c3de
7
8 [eclass] xorg-2 eclass moved to main tree.
9
10 ---
11 eclass/xorg-2.eclass | 482 --------------------------------------------------
12 1 files changed, 0 insertions(+), 482 deletions(-)
13
14 diff --git a/eclass/xorg-2.eclass b/eclass/xorg-2.eclass
15 deleted file mode 100644
16 index 103979b..0000000
17 --- a/eclass/xorg-2.eclass
18 +++ /dev/null
19 @@ -1,482 +0,0 @@
20 -# Copyright 1999-2010 Gentoo Foundation
21 -# Distributed under the terms of the GNU General Public License v2
22 -# $Header: /var/cvsroot/gentoo-x86/eclass/xorg-2.eclass,v 1.22 2011/01/15 17:55:21 scarabeus Exp $
23 -#
24 -# @ECLASS: xorg-2.eclass
25 -# @MAINTAINER:
26 -# x11@g.o
27 -# @BLURB: Reduces code duplication in the modularized X11 ebuilds.
28 -# @DESCRIPTION:
29 -# This eclass makes trivial X ebuilds possible for apps, fonts, drivers,
30 -# and more. Many things that would normally be done in various functions
31 -# can be accessed by setting variables instead, such as patching,
32 -# running eautoreconf, passing options to configure and installing docs.
33 -#
34 -# All you need to do in a basic ebuild is inherit this eclass and set
35 -# DESCRIPTION, KEYWORDS and RDEPEND/DEPEND. If your package is hosted
36 -# with the other X packages, you don't need to set SRC_URI. Pretty much
37 -# everything else should be automatic.
38 -
39 -# Author: Tomáš Chvátal <scarabeus@g.o>
40 -# Author: Donnie Berkholz <dberkholz@g.o>
41 -
42 -GIT_ECLASS=""
43 -if [[ ${PV} == *9999* ]]; then
44 - GIT_ECLASS="git"
45 - XORG_EAUTORECONF="yes"
46 - SRC_URI=""
47 -fi
48 -
49 -# If we're a font package, but not the font.alias one
50 -FONT_ECLASS=""
51 -if [[ ${PN} == font* \
52 - && ${CATEGORY} = media-fonts \
53 - && ${PN} != font-alias \
54 - && ${PN} != font-util ]]; then
55 - # Activate font code in the rest of the eclass
56 - FONT="yes"
57 - FONT_ECLASS="font"
58 -fi
59 -
60 -inherit autotools-utils eutils libtool multilib toolchain-funcs flag-o-matic autotools \
61 - ${FONT_ECLASS} ${GIT_ECLASS}
62 -
63 -EXPORTED_FUNCTIONS="src_unpack src_compile src_install pkg_postinst pkg_postrm"
64 -case "${EAPI:-0}" in
65 - 3|4) EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare src_configure" ;;
66 - *) die "EAPI-UNSUPPORTED" ;;
67 -esac
68 -
69 -# exports must be ALWAYS after inherit
70 -EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS}
71 -
72 -IUSE=""
73 -HOMEPAGE="http://xorg.freedesktop.org/"
74 -
75 -# @ECLASS-VARIABLE: XORG_EAUTORECONF
76 -# @DESCRIPTION:
77 -# If set to 'yes' and configure.ac exists, eautoreconf will run. Set
78 -# before inheriting this eclass.
79 -: ${XORG_EAUTORECONF:="no"}
80 -
81 -# Set up SRC_URI for individual modular releases
82 -BASE_INDIVIDUAL_URI="http://xorg.freedesktop.org/releases/individual"
83 -# @ECLASS-VARIABLE: MODULE
84 -# @DESCRIPTION:
85 -# The subdirectory to download source from. Possible settings are app,
86 -# doc, data, util, driver, font, lib, proto, xserver. Set above the
87 -# inherit to override the default autoconfigured module.
88 -if [[ -z ${MODULE} ]]; then
89 - case ${CATEGORY} in
90 - app-doc) MODULE=doc/ ;;
91 - media-fonts) MODULE=font/ ;;
92 - x11-apps|x11-wm) MODULE=app/ ;;
93 - x11-misc|x11-themes) MODULE=util/ ;;
94 - x11-base) MODULE=xserver/ ;;
95 - x11-drivers) MODULE=driver/ ;;
96 - x11-proto) MODULE=proto/ ;;
97 - x11-libs) MODULE=lib/ ;;
98 - *) MODULE= ;;
99 - esac
100 -fi
101 -
102 -# @ECLASS-VARIABLE: PACKAGE_NAME
103 -# @DESCRIPTION:
104 -# For git checkout the git repository might differ from package name.
105 -# This variable can be used for proper directory specification
106 -: ${PACKAGE_NAME:=${PN}}
107 -
108 -if [[ -n ${GIT_ECLASS} ]]; then
109 - EGIT_REPO_URI="git://anongit.freedesktop.org/git/xorg/${MODULE}${PACKAGE_NAME}"
110 -else
111 - SRC_URI+=" ${BASE_INDIVIDUAL_URI}/${MODULE}${P}.tar.bz2"
112 -fi
113 -
114 -: ${SLOT:=0}
115 -
116 -# Set the license for the package. This can be overridden by setting
117 -# LICENSE after the inherit. Nearly all FreeDesktop-hosted X packages
118 -# are under the MIT license. (This is what Red Hat does in their rpms)
119 -: ${LICENSE:=MIT}
120 -
121 -# Set up autotools shared dependencies
122 -# Remember that all versions here MUST be stable
123 -XORG_EAUTORECONF_ARCHES="x86-interix ppc-aix x86-winnt"
124 -EAUTORECONF_DEPEND+="
125 - >=sys-devel/libtool-2.2.6a
126 - sys-devel/m4"
127 -if [[ ${PN} != util-macros ]] ; then
128 - EAUTORECONF_DEPEND+=" >=x11-misc/util-macros-1.11.0"
129 - # Required even by xorg-server
130 - [[ ${PN} == "font-util" ]] || EAUTORECONF_DEPEND+=" >=media-fonts/font-util-1.1.1-r1"
131 -fi
132 -WANT_AUTOCONF="latest"
133 -WANT_AUTOMAKE="latest"
134 -for arch in ${XORG_EAUTORECONF_ARCHES}; do
135 - EAUTORECONF_DEPENDS+=" ${arch}? ( ${EAUTORECONF_DEPEND} )"
136 -done
137 -DEPEND+=" ${EAUTORECONF_DEPENDS}"
138 -[[ ${XORG_EAUTORECONF} != no ]] && DEPEND+=" ${EAUTORECONF_DEPEND}"
139 -unset EAUTORECONF_DEPENDS
140 -unset EAUTORECONF_DEPEND
141 -
142 -if [[ ${FONT} == yes ]]; then
143 - RDEPEND+=" media-fonts/encodings
144 - x11-apps/mkfontscale
145 - x11-apps/mkfontdir"
146 - PDEPEND+=" media-fonts/font-alias"
147 - DEPEND+=" >=media-fonts/font-util-1.1.1-r1"
148 -
149 - # @ECLASS-VARIABLE: FONT_DIR
150 - # @DESCRIPTION:
151 - # If you're creating a font package and the suffix of PN is not equal to
152 - # the subdirectory of /usr/share/fonts/ it should install into, set
153 - # FONT_DIR to that directory or directories. Set before inheriting this
154 - # eclass.
155 - [[ -z ${FONT_DIR} ]] && FONT_DIR=${PN##*-}
156 -
157 - # Fix case of font directories
158 - FONT_DIR=${FONT_DIR/ttf/TTF}
159 - FONT_DIR=${FONT_DIR/otf/OTF}
160 - FONT_DIR=${FONT_DIR/type1/Type1}
161 - FONT_DIR=${FONT_DIR/speedo/Speedo}
162 -
163 - # Set up configure options, wrapped so ebuilds can override if need be
164 - [[ -z ${FONT_OPTIONS} ]] && FONT_OPTIONS="--with-fontdir=\"${EPREFIX}/usr/share/fonts/${FONT_DIR}\""
165 -
166 - [[ ${PN##*-} = misc || ${PN##*-} = 75dpi || ${PN##*-} = 100dpi || ${PN##*-} = cyrillic ]] && IUSE+=" nls"
167 -fi
168 -
169 -# If we're a driver package, then enable DRIVER case
170 -[[ ${PN} == xf86-video-* || ${PN} == xf86-input-* ]] && DRIVER="yes"
171 -
172 -# @ECLASS-VARIABLE: XORG_STATIC
173 -# @DESCRIPTION:
174 -# Enables static-libs useflag. Set to no, if your package gets:
175 -#
176 -# QA: configure: WARNING: unrecognized options: --disable-static
177 -: ${XORG_STATIC:="yes"}
178 -
179 -# Add static-libs useflag where usefull.
180 -if [[ ${XORG_STATIC} == yes \
181 - && ${FONT} != yes \
182 - && ${CATEGORY} != app-doc \
183 - && ${CATEGORY} != x11-apps \
184 - && ${CATEGORY} != x11-proto \
185 - && ${CATEGORY} != x11-drivers \
186 - && ${CATEGORY} != media-fonts \
187 - && ${PN} != util-macros \
188 - && ${PN} != xbitmaps \
189 - && ${PN} != xorg-cf-files \
190 - && ${PN/xcursor} = ${PN} ]]; then
191 - IUSE+=" static-libs"
192 -fi
193 -
194 -DEPEND+=" >=dev-util/pkgconfig-0.23"
195 -
196 -# Check deps on drivers
197 -if has dri ${IUSE//+}; then
198 - COMMON_DEPEND+=" dri? (
199 - x11-base/xorg-server[-minimal]
200 - x11-libs/libdrm
201 - )"
202 - DEPEND+=" dri? (
203 - x11-proto/xf86driproto
204 - x11-proto/glproto
205 - x11-proto/dri2proto
206 - )"
207 -fi
208 -if [[ -n "${DRIVER}" ]]; then
209 - COMMON_DEPEND+="
210 - x11-base/xorg-server[xorg]
211 - x11-libs/libpciaccess
212 - "
213 - # we also needs some protos and libs in all cases
214 - DEPEND+="
215 - x11-proto/fontsproto
216 - x11-proto/randrproto
217 - x11-proto/renderproto
218 - x11-proto/videoproto
219 - x11-proto/xextproto
220 - x11-proto/xineramaproto
221 - x11-proto/xproto
222 - "
223 -fi
224 -
225 -# Add deps on documentation
226 -# Most docbooks use dtd version 4.2 and 4.3 add more when found
227 -if has doc ${IUSE//+}; then
228 - DEPEND+="
229 - doc? (
230 - app-text/xmlto
231 - app-doc/doxygen
232 - app-text/docbook-xml-dtd:4.2
233 - app-text/docbook-xml-dtd:4.3
234 - )
235 - "
236 -fi
237 -
238 -DEPEND+=" ${COMMON_DEPEND}"
239 -RDEPEND+=" ${COMMON_DEPEND}"
240 -unset COMMON_DEPEND
241 -
242 -debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: DEPEND=${DEPEND}"
243 -debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: RDEPEND=${RDEPEND}"
244 -
245 -# @FUNCTION: xorg-2_pkg_setup
246 -# @DESCRIPTION:
247 -# Setup prefix compat
248 -xorg-2_pkg_setup() {
249 - debug-print-function ${FUNCNAME} "$@"
250 -
251 - [[ ${FONT} == yes ]] && font_pkg_setup "$@"
252 -}
253 -
254 -# @FUNCTION: xorg-2_src_unpack
255 -# @DESCRIPTION:
256 -# Simply unpack source code.
257 -xorg-2_src_unpack() {
258 - debug-print-function ${FUNCNAME} "$@"
259 -
260 - if [[ -n ${GIT_ECLASS} ]]; then
261 - git_src_unpack
262 - else
263 - unpack ${A}
264 - fi
265 -
266 - [[ -n ${FONT_OPTIONS} ]] && einfo "Detected font directory: ${FONT_DIR}"
267 -}
268 -
269 -# @FUNCTION: xorg-2_patch_source
270 -# @DESCRIPTION:
271 -# Apply all patches
272 -xorg-2_patch_source() {
273 - debug-print-function ${FUNCNAME} "$@"
274 -
275 - # Use standardized names and locations with bulk patching
276 - # Patch directory is ${WORKDIR}/patch
277 - # See epatch() in eutils.eclass for more documentation
278 - EPATCH_SUFFIX=${EPATCH_SUFFIX:=patch}
279 -
280 - [[ -d "${EPATCH_SOURCE}" ]] && epatch
281 - autotools-utils_src_prepare "$@"
282 -}
283 -
284 -# @FUNCTION: xorg-2_reconf_source
285 -# @DESCRIPTION:
286 -# Run eautoreconf if necessary, and run elibtoolize.
287 -xorg-2_reconf_source() {
288 - debug-print-function ${FUNCNAME} "$@"
289 -
290 - case ${CHOST} in
291 - *-interix* | *-aix* | *-winnt*)
292 - # some hosts need full eautoreconf
293 - [[ -e "./configure.ac" || -e "./configure.in" ]] && eautoreconf || ewarn "Unable to autoreconf the configure script. Things may fail."
294 - ;;
295 - *)
296 - # elibtoolize required for BSD
297 - [[ ${XORG_EAUTORECONF} != no && ( -e "./configure.ac" || -e "./configure.in" ) ]] && eautoreconf || elibtoolize
298 - ;;
299 - esac
300 -}
301 -
302 -# @FUNCTION: xorg-2_src_prepare
303 -# @DESCRIPTION:
304 -# Prepare a package after unpacking, performing all X-related tasks.
305 -xorg-2_src_prepare() {
306 - debug-print-function ${FUNCNAME} "$@"
307 -
308 - [[ -n ${GIT_ECLASS} ]] && git_src_prepare
309 - xorg-2_patch_source
310 - xorg-2_reconf_source
311 -}
312 -
313 -# @FUNCTION: xorg-2_font_configure
314 -# @DESCRIPTION:
315 -# If a font package, perform any necessary configuration steps
316 -xorg-2_font_configure() {
317 - debug-print-function ${FUNCNAME} "$@"
318 -
319 - if has nls ${IUSE//+} && ! use nls; then
320 - if grep -q -s "disable-all-encodings" ${ECONF_SOURCE:-.}/configure; then
321 - FONT_OPTIONS+="
322 - --disable-all-encodings"
323 - else
324 - FONT_OPTIONS+="
325 - --disable-iso8859-2
326 - --disable-iso8859-3
327 - --disable-iso8859-4
328 - --disable-iso8859-5
329 - --disable-iso8859-6
330 - --disable-iso8859-7
331 - --disable-iso8859-8
332 - --disable-iso8859-9
333 - --disable-iso8859-10
334 - --disable-iso8859-11
335 - --disable-iso8859-12
336 - --disable-iso8859-13
337 - --disable-iso8859-14
338 - --disable-iso8859-15
339 - --disable-iso8859-16
340 - --disable-jisx0201
341 - --disable-koi8-r"
342 - fi
343 - fi
344 -}
345 -
346 -# @FUNCTION: xorg-2_flags_setup
347 -# @DESCRIPTION:
348 -# Set up CFLAGS for a debug build
349 -xorg-2_flags_setup() {
350 - debug-print-function ${FUNCNAME} "$@"
351 -
352 - # Win32 require special define
353 - [[ ${CHOST} == *-winnt* ]] && append-cppflags -DWIN32 -D__STDC__
354 - # hardened ldflags
355 - [[ ${PN} = xorg-server || -n ${DRIVER} ]] && append-ldflags -Wl,-z,lazy
356 -
357 - # Quite few libraries fail on runtime without these:
358 - if has static-libs ${IUSE//+}; then
359 - filter-flags -Wl,-Bdirect
360 - filter-ldflags -Bdirect
361 - filter-ldflags -Wl,-Bdirect
362 - fi
363 -}
364 -
365 -# @FUNCTION: xorg-2_src_configure
366 -# @DESCRIPTION:
367 -# Perform any necessary pre-configuration steps, then run configure
368 -xorg-2_src_configure() {
369 - debug-print-function ${FUNCNAME} "$@"
370 -
371 - xorg-2_flags_setup
372 -
373 - # @VARIABLE: CONFIGURE_OPTIONS
374 - # @DESCRIPTION:
375 - # Any options to pass to configure
376 - # @DEFAULT_UNSET
377 - CONFIGURE_OPTIONS=${CONFIGURE_OPTIONS:=""}
378 -
379 - [[ -n "${FONT}" ]] && xorg-2_font_configure
380 - local myeconfargs=(
381 - --disable-dependency-tracking
382 - ${CONFIGURE_OPTIONS}
383 - ${FONT_OPTIONS}
384 - )
385 -
386 - autotools-utils_src_configure "$@"
387 -}
388 -
389 -# @FUNCTION: xorg-2_src_compile
390 -# @DESCRIPTION:
391 -# Compile a package, performing all X-related tasks.
392 -xorg-2_src_compile() {
393 - debug-print-function ${FUNCNAME} "$@"
394 -
395 - autotools-utils_src_compile "$@"
396 -}
397 -
398 -# @FUNCTION: xorg-2_src_install
399 -# @DESCRIPTION:
400 -# Install a built package to ${D}, performing any necessary steps.
401 -# Creates a ChangeLog from git if using live ebuilds.
402 -xorg-2_src_install() {
403 - debug-print-function ${FUNCNAME} "$@"
404 -
405 - if [[ ${CATEGORY} == x11-proto ]]; then
406 - autotools-utils_src_install \
407 - ${PN/proto/}docdir="${EPREFIX}/usr/share/doc/${PF}" \
408 - docdir="${EPREFIX}/usr/share/doc/${PF}"
409 - else
410 - autotools-utils_src_install \
411 - docdir="${EPREFIX}/usr/share/doc/${PF}"
412 - fi
413 -
414 - if [[ -n ${GIT_ECLASS} ]]; then
415 - pushd "${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}" > /dev/null
416 - git log ${EGIT_COMMIT} > "${S}"/ChangeLog
417 - popd > /dev/null
418 - fi
419 -
420 - if [[ -e "${S}"/ChangeLog ]]; then
421 - dodoc "${S}"/ChangeLog || die "dodoc failed"
422 - fi
423 -
424 - # Don't install libtool archives (even with static-libs)
425 - remove_libtool_files all
426 -
427 - [[ -n ${FONT} ]] && remove_font_metadata
428 -}
429 -
430 -# @FUNCTION: xorg-2_pkg_postinst
431 -# @DESCRIPTION:
432 -# Run X-specific post-installation tasks on the live filesystem. The
433 -# only task right now is some setup for font packages.
434 -xorg-2_pkg_postinst() {
435 - debug-print-function ${FUNCNAME} "$@"
436 -
437 - [[ -n ${FONT} ]] && setup_fonts "$@"
438 -}
439 -
440 -# @FUNCTION: xorg-2_pkg_postrm
441 -# @DESCRIPTION:
442 -# Run X-specific post-removal tasks on the live filesystem. The only
443 -# task right now is some cleanup for font packages.
444 -xorg-2_pkg_postrm() {
445 - debug-print-function ${FUNCNAME} "$@"
446 -
447 - [[ -n ${FONT} ]] && font_pkg_postrm "$@"
448 -}
449 -
450 -# @FUNCTION: setup_fonts
451 -# @DESCRIPTION:
452 -# Generates needed files for fonts and fixes font permissions
453 -setup_fonts() {
454 - debug-print-function ${FUNCNAME} "$@"
455 -
456 - create_fonts_scale
457 - create_fonts_dir
458 - font_pkg_postinst
459 -}
460 -
461 -# @FUNCTION: remove_font_metadata
462 -# @DESCRIPTION:
463 -# Don't let the package install generated font files that may overlap
464 -# with other packages. Instead, they're generated in pkg_postinst().
465 -remove_font_metadata() {
466 - debug-print-function ${FUNCNAME} "$@"
467 -
468 - if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then
469 - einfo "Removing font metadata"
470 - rm -rf "${ED}"/usr/share/fonts/${FONT_DIR}/fonts.{scale,dir,cache-1}
471 - fi
472 -}
473 -
474 -# @FUNCTION: create_fonts_scale
475 -# @DESCRIPTION:
476 -# Create fonts.scale file, used by the old server-side fonts subsystem.
477 -create_fonts_scale() {
478 - debug-print-function ${FUNCNAME} "$@"
479 -
480 - if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then
481 - ebegin "Generating font.scale"
482 - mkfontscale \
483 - -a "${EROOT}/usr/share/fonts/encodings/encodings.dir" \
484 - -- "${EROOT}/usr/share/fonts/${FONT_DIR}"
485 - eend $?
486 - fi
487 -}
488 -
489 -# @FUNCTION: create_fonts_dir
490 -# @DESCRIPTION:
491 -# Create fonts.dir file, used by the old server-side fonts subsystem.
492 -create_fonts_dir() {
493 - debug-print-function ${FUNCNAME} "$@"
494 -
495 - ebegin "Generating fonts.dir"
496 - mkfontdir \
497 - -e "${EROOT}"/usr/share/fonts/encodings \
498 - -e "${EROOT}"/usr/share/fonts/encodings/large \
499 - -- "${EROOT}/usr/share/fonts/${FONT_DIR}"
500 - eend $?
501 -}