Gentoo Archives: gentoo-commits

From: "Donnie Berkholz (dberkholz)" <dberkholz@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in eclass: x-modular.eclass
Date: Fri, 22 Feb 2008 05:09:35
Message-Id: E1JSQA7-0007UY-Lr@stork.gentoo.org
1 dberkholz 08/02/22 05:09:31
2
3 Modified: x-modular.eclass
4 Log:
5 Move to new documentation style used by app-portage/eclass-manpages.
6
7 Revision Changes Path
8 1.91 eclass/x-modular.eclass
9
10 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/x-modular.eclass?rev=1.91&view=markup
11 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/x-modular.eclass?rev=1.91&content-type=text/plain
12 diff : http://sources.gentoo.org/viewcvs.py/gentoo-x86/eclass/x-modular.eclass?r1=1.90&r2=1.91
13
14 Index: x-modular.eclass
15 ===================================================================
16 RCS file: /var/cvsroot/gentoo-x86/eclass/x-modular.eclass,v
17 retrieving revision 1.90
18 retrieving revision 1.91
19 diff -u -r1.90 -r1.91
20 --- x-modular.eclass 21 Feb 2008 22:50:51 -0000 1.90
21 +++ x-modular.eclass 22 Feb 2008 05:09:31 -0000 1.91
22 @@ -1,51 +1,51 @@
23 # Copyright 1999-2005 Gentoo Foundation
24 # Distributed under the terms of the GNU General Public License v2
25 -# $Header: /var/cvsroot/gentoo-x86/eclass/x-modular.eclass,v 1.90 2008/02/21 22:50:51 cardoe Exp $
26 +# $Header: /var/cvsroot/gentoo-x86/eclass/x-modular.eclass,v 1.91 2008/02/22 05:09:31 dberkholz Exp $
27 #
28 -# Author: Donnie Berkholz <dberkholz@g.o>
29 +# @ECLASS: x-modular.eclass
30 +# @MAINTAINER:
31 +# Donnie Berkholz <dberkholz@g.o>, x11@g.o
32 +# @BLURB: Reduces code duplication in the modularized X11 ebuilds.
33 +# @DESCRIPTION:
34 +# This eclass makes trivial X ebuilds possible for apps, fonts, drivers,
35 +# and more. Many things that would normally be done in various functions
36 +# can be accessed by setting variables instead, such as patching,
37 +# running eautoreconf, passing options to configure and installing docs.
38 #
39 -# This eclass is designed to reduce code duplication in the modularized X11
40 -# ebuilds.
41 -#
42 -# Using this eclass:
43 -#
44 -# Inherit it. If you need to run autoreconf for any reason (e.g., your patches
45 -# apply to the autotools files rather than configure), set SNAPSHOT="yes". Set
46 -# CONFIGURE_OPTIONS to everything you want to pass to the configure script.
47 -#
48 -# If you have any patches to apply, set PATCHES to their locations and epatch
49 -# will apply them. It also handles epatch-style bulk patches, if you know how to
50 -# use them and set the correct variables. If you don't, read eutils.eclass.
51 -#
52 -# If you're creating a font package and the suffix of PN is not equal to the
53 -# subdirectory of /usr/share/fonts/ it should install into, set FONT_DIR to that
54 -# directory or directories.
55 -#
56 -# If you want to change the auto-application of the driver patchset or prevent
57 -# it from applying, edit XDPVER in the ebuild. Set it to -1 to prevent patch
58 -# application or positive integers for that patch version.
59 -#
60 -# IMPORTANT: SNAPSHOT, FONT_DIR and XDPVER must be set _before_ the inherit.
61 -#
62 -# If you want to install to a non-default prefix (e.g., /opt/xorg), change
63 -# XDIR. This has not been recently tested. You may need to uncomment the
64 -# setting of datadir and mandir in x-modular_src_install() or add it back in if
65 -# it's no longer there. You may also want to change the SLOT.
66 -#
67 -# Pretty much everything else should be automatic.
68 -
69 -# Directory prefix to use for everything
70 +# All you need to do in a basic ebuild is inherit this eclass and set
71 +# DESCRIPTION, KEYWORDS and RDEPEND/DEPEND. If your package is hosted
72 +# with the other X packages, you don't need to set SRC_URI. Pretty much
73 +# everything else should be automatic.
74 +
75 +# @ECLASS-VARIABLE: XDIR
76 +# @DESCRIPTION:
77 +# Directory prefix to use for everything. If you want to install to a
78 +# non-default prefix (e.g., /opt/xorg), change XDIR. This has not been
79 +# recently tested. You may need to uncomment the setting of datadir and
80 +# mandir in x-modular_src_install() or add it back in if it's no longer
81 +# there. You may also want to change the SLOT.
82 XDIR="/usr"
83
84 -# Set up default patchset version(s) if necessary
85 -# x11-driver-patches
86 if [[ -z "${XDPVER}" ]]; then
87 +# @ECLASS-VARIABLE: XDPVER
88 +# @DESCRIPTION:
89 +# Set up default patchset version(s) if necessary for driver patches. If
90 +# you want to change the auto-application of the driver patchset or
91 +# prevent it from applying, edit XDPVER in the ebuild. Set it to -1 to
92 +# prevent patch application or positive integers for that patch version.
93 +# Set before inheriting this eclass.
94 XDPVER="1"
95 fi
96
97 IUSE=""
98 HOMEPAGE="http://xorg.freedesktop.org/"
99
100 +# @ECLASS-VARIABLE: SNAPSHOT
101 +# @DESCRIPTION:
102 +# If set to 'yes' and configure.ac exists, eautoreconf will run. Set
103 +# before inheriting this eclass.
104 +SNAPSHOT="no"
105 +
106 if [[ ${PV} = 9999* ]]; then
107 GIT_ECLASS="git"
108 SNAPSHOT="yes"
109 @@ -123,6 +123,12 @@
110
111 # Wrap in `if` so ebuilds can set it too
112 if [[ -z ${FONT_DIR} ]]; then
113 +# @ECLASS-VARIABLE: FONT_DIR
114 +# @DESCRIPTION:
115 +# If you're creating a font package and the suffix of PN is not equal to
116 +# the subdirectory of /usr/share/fonts/ it should install into, set
117 +# FONT_DIR to that directory or directories. Set before inheriting this
118 +# eclass.
119 FONT_DIR=${PN##*-}
120
121 fi
122 @@ -186,6 +192,10 @@
123 inherit eutils libtool multilib toolchain-funcs flag-o-matic autotools \
124 ${FONT_ECLASS} ${GIT_ECLASS}
125
126 +# @FUNCTION: x-modular_specs_check
127 +# @USAGE:
128 +# @DESCRIPTION:
129 +# Make any necessary changes related to gcc specs (generally hardened)
130 x-modular_specs_check() {
131 if [[ ${PN:0:11} = "xorg-server" ]] || [[ -n "${DRIVER}" ]]; then
132 append-ldflags -Wl,-z,lazy
133 @@ -194,6 +204,10 @@
134 fi
135 }
136
137 +# @FUNCTION: x-modular_dri_check
138 +# @USAGE:
139 +# @DESCRIPTION:
140 +# Ensures the server supports DRI if building a driver with DRI support
141 x-modular_dri_check() {
142 # (#120057) Enabling DRI in drivers requires that the server was built with
143 # support for it
144 @@ -207,6 +221,10 @@
145 fi
146 }
147
148 +# @FUNCTION: x-modular_server_supports_drivers_check
149 +# @USAGE:
150 +# @DESCRIPTION:
151 +# Ensures the server SDK is installed if a driver is being built
152 x-modular_server_supports_drivers_check() {
153 # (#135873) Only certain servers will actually use or be capable of
154 # building external drivers, including binary drivers.
155 @@ -220,6 +238,10 @@
156 fi
157 }
158
159 +# @FUNCTION: x-modular_unpack_source
160 +# @USAGE:
161 +# @DESCRIPTION:
162 +# Simply unpack source code. Nothing else.
163 x-modular_unpack_source() {
164 if [[ -n ${GIT_ECLASS} ]]; then
165 git_src_unpack
166 @@ -233,6 +255,10 @@
167 fi
168 }
169
170 +# @FUNCTION: x-modular_patch_source
171 +# @USAGE:
172 +# @DESCRIPTION:
173 +# Apply all patches
174 x-modular_patch_source() {
175 # Use standardized names and locations with bulk patching
176 # Patch directory is ${WORKDIR}/patch
177 @@ -249,7 +275,11 @@
178 PATCHES="${PATCHES} ${DISTDIR}/x11-driver-patches-${XDPVER}.tar.bz2"
179 fi
180
181 - # For specific list of patches
182 +# @VARIABLE: PATCHES
183 +# @DESCRIPTION:
184 +# If you have any patches to apply, set PATCHES to their locations and epatch
185 +# will apply them. It also handles epatch-style bulk patches, if you know how to
186 +# use them and set the correct variables. If you don't, read eutils.eclass.
187 if [[ -n "${PATCHES}" ]] ; then
188 for PATCH in ${PATCHES}
189 do
190 @@ -264,8 +294,11 @@
191 fi
192 }
193
194 +# @FUNCTION: x-modular_reconf_source
195 +# @USAGE:
196 +# @DESCRIPTION:
197 +# Run eautoreconf if necessary, and run elibtoolize.
198 x-modular_reconf_source() {
199 - # Run autoreconf for CVS snapshots only
200 if [[ "${SNAPSHOT}" = "yes" ]]
201 then
202 # If possible, generate configure if it doesn't exist
203 @@ -280,6 +313,10 @@
204 elibtoolize
205 }
206
207 +# @FUNCTION: x-modular_src_unpack
208 +# @USAGE:
209 +# @DESCRIPTION:
210 +# Unpack a package, performing all X-related tasks.
211 x-modular_src_unpack() {
212 x-modular_specs_check
213 x-modular_server_supports_drivers_check
214 @@ -289,6 +326,10 @@
215 x-modular_reconf_source
216 }
217
218 +# @FUNCTION: x-modular_font_configure
219 +# @USAGE:
220 +# @DESCRIPTION:
221 +# If a font package, perform any necessary configuration steps
222 x-modular_font_configure() {
223 if [[ -n "${FONT}" ]]; then
224 # Might be worth adding an option to configure your desired font
225 @@ -316,6 +357,10 @@
226 fi
227 }
228
229 +# @FUNCTION: x-modular_debug_setup
230 +# @USAGE:
231 +# @DESCRIPTION:
232 +# Set up CFLAGS for a debug build
233 x-modular_debug_setup() {
234 if [[ -n "${DEBUGGABLE}" ]]; then
235 if use debug; then
236 @@ -325,10 +370,19 @@
237 fi
238 }
239
240 +# @FUNCTION: x-modular_src_configure
241 +# @USAGE:
242 +# @DESCRIPTION:
243 +# Perform any necessary pre-configuration steps, then run configure
244 x-modular_src_configure() {
245 x-modular_font_configure
246 x-modular_debug_setup
247
248 +# @VARIABLE: CONFIGURE_OPTIONS
249 +# @DESCRIPTION:
250 +# Any options to pass to configure
251 +[[ -n ${CONFIGURE_OPTIONTS} ]]
252 +
253 # If prefix isn't set here, .pc files cause problems
254 if [[ -x ${ECONF_SOURCE:-.}/configure ]]; then
255 econf --prefix=${XDIR} \
256 @@ -339,15 +393,28 @@
257 fi
258 }
259
260 +# @FUNCTION: x-modular_src_make
261 +# @USAGE:
262 +# @DESCRIPTION:
263 +# Run make.
264 x-modular_src_make() {
265 emake || die "emake failed"
266 }
267
268 +# @FUNCTION: x-modular_src_configure
269 +# @USAGE:
270 +# @DESCRIPTION:
271 +# Compile a package, performing all X-related tasks.
272 x-modular_src_compile() {
273 x-modular_src_configure
274 x-modular_src_make
275 }
276
277 +# @FUNCTION: x-modular_src_install
278 +# @USAGE:
279 +# @DESCRIPTION:
280 +# Install a built package to ${D}, performing any necessary steps.
281 +# Creates a ChangeLog from git if using live ebuilds.
282 x-modular_src_install() {
283 # Install everything to ${XDIR}
284 make \
285 @@ -367,6 +434,9 @@
286 if [[ -e ${S}/ChangeLog ]]; then
287 dodoc ${S}/ChangeLog
288 fi
289 +# @VARIABLE: DOCS
290 +# @DESCRIPTION:
291 +# Any documentation to install
292 [[ -n $DOCS ]] && dodoc $DOCS
293
294 # Make sure docs get compressed
295 @@ -378,8 +448,6 @@
296 | xargs rm -f
297 fi
298
299 - # Don't install overlapping fonts.* files
300 - # Generate them instead when possible
301 if [[ -n "${FONT}" ]]; then
302 remove_font_metadata
303 fi
304 @@ -389,17 +457,31 @@
305 fi
306 }
307
308 +# @FUNCTION: x-modular_pkg_preinst
309 +# @USAGE:
310 +# @DESCRIPTION:
311 +# This function doesn't do anything right now, but it may in the future.
312 x-modular_pkg_preinst() {
313 # We no longer do anything here, but we can't remove it from the API
314 :
315 }
316
317 +# @FUNCTION: x-modular_pkg_postinst
318 +# @USAGE:
319 +# @DESCRIPTION:
320 +# Run X-specific post-installation tasks on the live filesystem. The
321 +# only task right now is some setup for font packages.
322 x-modular_pkg_postinst() {
323 if [[ -n "${FONT}" ]]; then
324 setup_fonts
325 fi
326 }
327
328 +# @FUNCTION: x-modular_pkg_postrm
329 +# @USAGE:
330 +# @DESCRIPTION:
331 +# Run X-specific post-removal tasks on the live filesystem. The only
332 +# task right now is some cleanup for font packages.
333 x-modular_pkg_postrm() {
334 if [[ -n "${FONT}" ]]; then
335 cleanup_fonts
336 @@ -407,6 +489,10 @@
337 fi
338 }
339
340 +# @FUNCTION: cleanup_fonts
341 +# @USAGE:
342 +# @DESCRIPTION:
343 +# Get rid of font directories that only contain generated files
344 cleanup_fonts() {
345 local ALLOWED_FILES="encodings.dir fonts.cache-1 fonts.dir fonts.scale"
346 for DIR in ${FONT_DIR}; do
347 @@ -442,6 +528,10 @@
348 done
349 }
350
351 +# @FUNCTION: setup_fonts
352 +# @USAGE:
353 +# @DESCRIPTION:
354 +# Generates needed files for fonts and fixes font permissions
355 setup_fonts() {
356 if [[ ! -n "${FONT_DIR}" ]]; then
357 msg="FONT_DIR is empty. The ebuild should set it to at least one subdir of /usr/share/fonts."
358 @@ -455,6 +545,11 @@
359 create_font_cache
360 }
361
362 +# @FUNCTION: remove_font_metadata
363 +# @USAGE:
364 +# @DESCRIPTION:
365 +# Don't let the package install generated font files that may overlap
366 +# with other packages. Instead, they're generated in pkg_postinst().
367 remove_font_metadata() {
368 local DIR
369 for DIR in ${FONT_DIR}; do
370 @@ -467,8 +562,11 @@
371 done
372 }
373
374 -# Installs device-to-driver mappings for system-config-display
375 -# and anything else that uses hwdata
376 +# @FUNCTION: install_driver_hwdata
377 +# @USAGE:
378 +# @DESCRIPTION:
379 +# Installs device-to-driver mappings for system-config-display and
380 +# anything else that uses hwdata.
381 install_driver_hwdata() {
382 insinto /usr/share/hwdata/videoaliases
383 for i in "${FILESDIR}"/*.xinf; do
384 @@ -480,10 +578,18 @@
385 done
386 }
387
388 +# @FUNCTION: discover_font_dirs
389 +# @USAGE:
390 +# @DESCRIPTION:
391 +# Deprecated. Sets up the now-unused FONT_DIRS variable.
392 discover_font_dirs() {
393 FONT_DIRS="${FONT_DIR}"
394 }
395
396 +# @FUNCTION: create_fonts_scale
397 +# @USAGE:
398 +# @DESCRIPTION:
399 +# Create fonts.scale file, used by the old server-side fonts subsystem.
400 create_fonts_scale() {
401 ebegin "Creating fonts.scale files"
402 local x
403 @@ -507,6 +613,10 @@
404 eend 0
405 }
406
407 +# @FUNCTION: create_fonts_dir
408 +# @USAGE:
409 +# @DESCRIPTION:
410 +# Create fonts.dir file, used by the old server-side fonts subsystem.
411 create_fonts_dir() {
412 ebegin "Generating fonts.dir files"
413 for DIR in ${FONT_DIR}; do
414 @@ -524,6 +634,10 @@
415 eend 0
416 }
417
418 +# @FUNCTION: fix_font_permissions
419 +# @USAGE:
420 +# @DESCRIPTION:
421 +# Font files should have 644 permissions. Ensure this is the case.
422 fix_font_permissions() {
423 ebegin "Fixing permissions"
424 for DIR in ${FONT_DIR}; do
425 @@ -533,6 +647,11 @@
426 eend 0
427 }
428
429 +# @FUNCTION: create_font_cache
430 +# @USAGE:
431 +# @DESCRIPTION:
432 +# Create fonts.cache-1 files, used by the new client-side fonts
433 +# subsystem.
434 create_font_cache() {
435 font_pkg_postinst
436 }
437
438
439
440 --
441 gentoo-commits@l.g.o mailing list