| 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.8 2010/08/06 20:46:08 scarabeus Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/xorg-2.eclass,v 1.13 2010/09/27 09:40:25 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. |
| … | |
… | |
| 42 | ${FONT_ECLASS} ${GIT_ECLASS} |
42 | ${FONT_ECLASS} ${GIT_ECLASS} |
| 43 | |
43 | |
| 44 | EXPORTED_FUNCTIONS="src_unpack src_compile src_install pkg_postinst pkg_postrm" |
44 | EXPORTED_FUNCTIONS="src_unpack src_compile src_install pkg_postinst pkg_postrm" |
| 45 | case "${EAPI:-0}" in |
45 | case "${EAPI:-0}" in |
| 46 | 3) EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare src_configure" ;; |
46 | 3) EXPORTED_FUNCTIONS="${EXPORTED_FUNCTIONS} src_prepare src_configure" ;; |
| 47 | *) DEPEND="EAPI-UNSUPPORTED" ;; |
47 | *) die "EAPI-UNSUPPORTED" ;; |
| 48 | esac |
48 | esac |
| 49 | |
49 | |
| 50 | # exports must be ALWAYS after inherit |
50 | # exports must be ALWAYS after inherit |
| 51 | EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS} |
51 | EXPORT_FUNCTIONS ${EXPORTED_FUNCTIONS} |
| 52 | |
52 | |
| … | |
… | |
| 163 | # Check deps on xorg-server |
163 | # Check deps on xorg-server |
| 164 | has dri ${IUSE//+} && DEPEND+=" dri? ( >=x11-base/xorg-server-1.6.3.901-r2[-minimal] )" |
164 | has dri ${IUSE//+} && DEPEND+=" dri? ( >=x11-base/xorg-server-1.6.3.901-r2[-minimal] )" |
| 165 | [[ -n "${DRIVER}" ]] && DEPEND+=" x11-base/xorg-server[xorg]" |
165 | [[ -n "${DRIVER}" ]] && DEPEND+=" x11-base/xorg-server[xorg]" |
| 166 | |
166 | |
| 167 | # @FUNCTION: xorg-2_pkg_setup |
167 | # @FUNCTION: xorg-2_pkg_setup |
| 168 | # @USAGE: |
|
|
| 169 | # @DESCRIPTION: |
168 | # @DESCRIPTION: |
| 170 | # Setup prefix compat |
169 | # Setup prefix compat |
| 171 | xorg-2_pkg_setup() { |
170 | xorg-2_pkg_setup() { |
| 172 | [[ ${FONT} == yes ]] && font_pkg_setup |
171 | [[ ${FONT} == yes ]] && font_pkg_setup |
| 173 | } |
172 | } |
| 174 | |
173 | |
| 175 | # @FUNCTION: xorg-2_src_unpack |
174 | # @FUNCTION: xorg-2_src_unpack |
| 176 | # @USAGE: |
|
|
| 177 | # @DESCRIPTION: |
175 | # @DESCRIPTION: |
| 178 | # Simply unpack source code. |
176 | # Simply unpack source code. |
| 179 | xorg-2_src_unpack() { |
177 | xorg-2_src_unpack() { |
| 180 | if [[ -n ${GIT_ECLASS} ]]; then |
178 | if [[ -n ${GIT_ECLASS} ]]; then |
| 181 | git_src_unpack |
179 | git_src_unpack |
| … | |
… | |
| 185 | |
183 | |
| 186 | [[ -n ${FONT_OPTIONS} ]] && einfo "Detected font directory: ${FONT_DIR}" |
184 | [[ -n ${FONT_OPTIONS} ]] && einfo "Detected font directory: ${FONT_DIR}" |
| 187 | } |
185 | } |
| 188 | |
186 | |
| 189 | # @FUNCTION: xorg-2_patch_source |
187 | # @FUNCTION: xorg-2_patch_source |
| 190 | # @USAGE: |
|
|
| 191 | # @DESCRIPTION: |
188 | # @DESCRIPTION: |
| 192 | # Apply all patches |
189 | # Apply all patches |
| 193 | xorg-2_patch_source() { |
190 | xorg-2_patch_source() { |
| 194 | # Use standardized names and locations with bulk patching |
191 | # Use standardized names and locations with bulk patching |
| 195 | # Patch directory is ${WORKDIR}/patch |
192 | # Patch directory is ${WORKDIR}/patch |
| … | |
… | |
| 199 | [[ -d "${EPATCH_SOURCE}" ]] && epatch |
196 | [[ -d "${EPATCH_SOURCE}" ]] && epatch |
| 200 | base_src_prepare |
197 | base_src_prepare |
| 201 | } |
198 | } |
| 202 | |
199 | |
| 203 | # @FUNCTION: xorg-2_reconf_source |
200 | # @FUNCTION: xorg-2_reconf_source |
| 204 | # @USAGE: |
|
|
| 205 | # @DESCRIPTION: |
201 | # @DESCRIPTION: |
| 206 | # Run eautoreconf if necessary, and run elibtoolize. |
202 | # Run eautoreconf if necessary, and run elibtoolize. |
| 207 | xorg-2_reconf_source() { |
203 | xorg-2_reconf_source() { |
| 208 | case ${CHOST} in |
204 | case ${CHOST} in |
| 209 | *-interix* | *-aix* | *-winnt*) |
205 | *-interix* | *-aix* | *-winnt*) |
| … | |
… | |
| 216 | ;; |
212 | ;; |
| 217 | esac |
213 | esac |
| 218 | } |
214 | } |
| 219 | |
215 | |
| 220 | # @FUNCTION: xorg-2_src_prepare |
216 | # @FUNCTION: xorg-2_src_prepare |
| 221 | # @USAGE: |
|
|
| 222 | # @DESCRIPTION: |
217 | # @DESCRIPTION: |
| 223 | # Prepare a package after unpacking, performing all X-related tasks. |
218 | # Prepare a package after unpacking, performing all X-related tasks. |
| 224 | xorg-2_src_prepare() { |
219 | xorg-2_src_prepare() { |
| 225 | [[ -n ${GIT_ECLASS} ]] && git_src_prepare |
220 | [[ -n ${GIT_ECLASS} ]] && git_src_prepare |
| 226 | xorg-2_patch_source |
221 | xorg-2_patch_source |
| 227 | xorg-2_reconf_source |
222 | xorg-2_reconf_source |
| 228 | } |
223 | } |
| 229 | |
224 | |
| 230 | # @FUNCTION: xorg-2_font_configure |
225 | # @FUNCTION: xorg-2_font_configure |
| 231 | # @USAGE: |
|
|
| 232 | # @DESCRIPTION: |
226 | # @DESCRIPTION: |
| 233 | # If a font package, perform any necessary configuration steps |
227 | # If a font package, perform any necessary configuration steps |
| 234 | xorg-2_font_configure() { |
228 | xorg-2_font_configure() { |
| 235 | if has nls ${IUSE//+} && ! use nls; then |
229 | if has nls ${IUSE//+} && ! use nls; then |
| 236 | FONT_OPTIONS+=" |
230 | FONT_OPTIONS+=" |
| … | |
… | |
| 252 | --disable-jisx0201 |
246 | --disable-jisx0201 |
| 253 | --disable-koi8-r" |
247 | --disable-koi8-r" |
| 254 | fi |
248 | fi |
| 255 | } |
249 | } |
| 256 | |
250 | |
| 257 | # @FUNCTION: x-modular_flags_setup |
251 | # @FUNCTION: xorg-2_flags_setup |
| 258 | # @USAGE: |
|
|
| 259 | # @DESCRIPTION: |
252 | # @DESCRIPTION: |
| 260 | # Set up CFLAGS for a debug build |
253 | # Set up CFLAGS for a debug build |
| 261 | xorg-2_flags_setup() { |
254 | xorg-2_flags_setup() { |
| 262 | # Win32 require special define |
255 | # Win32 require special define |
| 263 | [[ ${CHOST} == *-winnt* ]] && append-cppflags -DWIN32 -D__STDC__ |
256 | [[ ${CHOST} == *-winnt* ]] && append-cppflags -DWIN32 -D__STDC__ |
| 264 | # hardened ldflags |
257 | # hardened ldflags |
| 265 | [[ ${PN} = xorg-server || -n ${DRIVER} ]] && append-ldflags -Wl,-z,lazy |
258 | [[ ${PN} = xorg-server || -n ${DRIVER} ]] && append-ldflags -Wl,-z,lazy |
| 266 | } |
259 | } |
| 267 | |
260 | |
| 268 | # @FUNCTION: xorg-2_src_configure |
261 | # @FUNCTION: xorg-2_src_configure |
| 269 | # @USAGE: |
|
|
| 270 | # @DESCRIPTION: |
262 | # @DESCRIPTION: |
| 271 | # Perform any necessary pre-configuration steps, then run configure |
263 | # Perform any necessary pre-configuration steps, then run configure |
| 272 | xorg-2_src_configure() { |
264 | xorg-2_src_configure() { |
| 273 | local myopts="" |
265 | local myopts="" |
| 274 | |
266 | |
| 275 | xorg-2_flags_setup |
267 | xorg-2_flags_setup |
| 276 | [[ -n "${FONT}" ]] && xorg-2_font_configure |
268 | [[ -n "${FONT}" ]] && xorg-2_font_configure |
| 277 | |
269 | |
| 278 | # @VARIABLE: CONFIGURE_OPTIONS |
270 | # @VARIABLE: CONFIGURE_OPTIONS |
| 279 | # @DESCRIPTION: |
271 | # @DESCRIPTION: |
| 280 | # Any options to pass to configure |
272 | # Any options to pass to configure |
|
|
273 | # @DEFAULT_UNSET |
| 281 | CONFIGURE_OPTIONS=${CONFIGURE_OPTIONS:=""} |
274 | CONFIGURE_OPTIONS=${CONFIGURE_OPTIONS:=""} |
| 282 | if [[ -x ${ECONF_SOURCE:-.}/configure ]]; then |
275 | if [[ -x ${ECONF_SOURCE:-.}/configure ]]; then |
| 283 | if has static-libs ${IUSE//+}; then |
276 | if has static-libs ${IUSE//+}; then |
| 284 | myopts+=" $(use_enable static-libs static)" |
277 | myopts+=" $(use_enable static-libs static)" |
| 285 | fi |
278 | fi |
| … | |
… | |
| 289 | ${myopts} |
282 | ${myopts} |
| 290 | fi |
283 | fi |
| 291 | } |
284 | } |
| 292 | |
285 | |
| 293 | # @FUNCTION: xorg-2_src_compile |
286 | # @FUNCTION: xorg-2_src_compile |
| 294 | # @USAGE: |
|
|
| 295 | # @DESCRIPTION: |
287 | # @DESCRIPTION: |
| 296 | # Compile a package, performing all X-related tasks. |
288 | # Compile a package, performing all X-related tasks. |
| 297 | xorg-2_src_compile() { |
289 | xorg-2_src_compile() { |
| 298 | base_src_compile |
290 | base_src_compile |
| 299 | } |
291 | } |
| 300 | |
292 | |
| 301 | # @FUNCTION: xorg-2_src_install |
293 | # @FUNCTION: xorg-2_src_install |
| 302 | # @USAGE: |
|
|
| 303 | # @DESCRIPTION: |
294 | # @DESCRIPTION: |
| 304 | # Install a built package to ${D}, performing any necessary steps. |
295 | # Install a built package to ${D}, performing any necessary steps. |
| 305 | # Creates a ChangeLog from git if using live ebuilds. |
296 | # Creates a ChangeLog from git if using live ebuilds. |
| 306 | xorg-2_src_install() { |
297 | xorg-2_src_install() { |
| 307 | if [[ ${CATEGORY} == x11-proto ]]; then |
298 | if [[ ${CATEGORY} == x11-proto ]]; then |
| 308 | emake \ |
299 | emake \ |
| 309 | ${PN/proto/}docdir=${EPREFIX}/usr/share/doc/${PF} \ |
300 | ${PN/proto/}docdir=${EPREFIX}/usr/share/doc/${PF} \ |
|
|
301 | docdir=${EPREFIX}/usr/share/doc/${PF} \ |
| 310 | DESTDIR="${D}" \ |
302 | DESTDIR="${D}" \ |
| 311 | install || die "emake install failed" |
303 | install || die "emake install failed" |
| 312 | else |
304 | else |
| 313 | emake \ |
305 | emake \ |
| 314 | docdir=${EPREFIX}/usr/share/doc/${PF} \ |
306 | docdir=${EPREFIX}/usr/share/doc/${PF} \ |
| … | |
… | |
| 316 | install || die "emake install failed" |
308 | install || die "emake install failed" |
| 317 | fi |
309 | fi |
| 318 | |
310 | |
| 319 | if [[ -n ${GIT_ECLASS} ]]; then |
311 | if [[ -n ${GIT_ECLASS} ]]; then |
| 320 | pushd "${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}" > /dev/null |
312 | pushd "${EGIT_STORE_DIR}/${EGIT_CLONE_DIR}" > /dev/null |
| 321 | git log ${GIT_TREE} > "${S}"/ChangeLog |
313 | git log ${EGIT_COMMIT} > "${S}"/ChangeLog |
| 322 | popd > /dev/null |
314 | popd > /dev/null |
| 323 | fi |
315 | fi |
| 324 | |
316 | |
| 325 | if [[ -e "${S}"/ChangeLog ]]; then |
317 | if [[ -e "${S}"/ChangeLog ]]; then |
| 326 | dodoc "${S}"/ChangeLog |
318 | dodoc "${S}"/ChangeLog |
| 327 | fi |
319 | fi |
| 328 | # @VARIABLE: DOCS |
320 | # @VARIABLE: DOCS |
| 329 | # @DESCRIPTION: |
321 | # @DESCRIPTION: |
| 330 | # Any documentation to install |
322 | # Any documentation to install |
|
|
323 | # @DEFAULT_UNSET |
| 331 | if [[ -n ${DOCS} ]]; then |
324 | if [[ -n ${DOCS} ]]; then |
| 332 | dodoc ${DOCS} || die "dodoc failed" |
325 | dodoc ${DOCS} || die "dodoc failed" |
| 333 | fi |
326 | fi |
| 334 | |
327 | |
| 335 | # Don't install libtool archives for server modules |
328 | # Don't install libtool archives for server modules |
| … | |
… | |
| 340 | |
333 | |
| 341 | [[ -n ${FONT} ]] && remove_font_metadata |
334 | [[ -n ${FONT} ]] && remove_font_metadata |
| 342 | } |
335 | } |
| 343 | |
336 | |
| 344 | # @FUNCTION: xorg-2_pkg_postinst |
337 | # @FUNCTION: xorg-2_pkg_postinst |
| 345 | # @USAGE: |
|
|
| 346 | # @DESCRIPTION: |
338 | # @DESCRIPTION: |
| 347 | # Run X-specific post-installation tasks on the live filesystem. The |
339 | # Run X-specific post-installation tasks on the live filesystem. The |
| 348 | # only task right now is some setup for font packages. |
340 | # only task right now is some setup for font packages. |
| 349 | xorg-2_pkg_postinst() { |
341 | xorg-2_pkg_postinst() { |
| 350 | [[ -n ${FONT} ]] && setup_fonts |
342 | [[ -n ${FONT} ]] && setup_fonts |
| 351 | } |
343 | } |
| 352 | |
344 | |
| 353 | # @FUNCTION: xorg-2_pkg_postrm |
345 | # @FUNCTION: xorg-2_pkg_postrm |
| 354 | # @USAGE: |
|
|
| 355 | # @DESCRIPTION: |
346 | # @DESCRIPTION: |
| 356 | # Run X-specific post-removal tasks on the live filesystem. The only |
347 | # Run X-specific post-removal tasks on the live filesystem. The only |
| 357 | # task right now is some cleanup for font packages. |
348 | # task right now is some cleanup for font packages. |
| 358 | xorg-2_pkg_postrm() { |
349 | xorg-2_pkg_postrm() { |
| 359 | if [[ -n ${FONT} ]]; then |
350 | if [[ -n ${FONT} ]]; then |
| 360 | font_pkg_postrm |
351 | font_pkg_postrm |
| 361 | fi |
352 | fi |
| 362 | } |
353 | } |
| 363 | |
354 | |
| 364 | # @FUNCTION: setup_fonts |
355 | # @FUNCTION: setup_fonts |
| 365 | # @USAGE: |
|
|
| 366 | # @DESCRIPTION: |
356 | # @DESCRIPTION: |
| 367 | # Generates needed files for fonts and fixes font permissions |
357 | # Generates needed files for fonts and fixes font permissions |
| 368 | setup_fonts() { |
358 | setup_fonts() { |
| 369 | create_fonts_scale |
359 | create_fonts_scale |
| 370 | create_fonts_dir |
360 | create_fonts_dir |
| 371 | font_pkg_postinst |
361 | font_pkg_postinst |
| 372 | } |
362 | } |
| 373 | |
363 | |
| 374 | # @FUNCTION: remove_font_metadata |
364 | # @FUNCTION: remove_font_metadata |
| 375 | # @USAGE: |
|
|
| 376 | # @DESCRIPTION: |
365 | # @DESCRIPTION: |
| 377 | # Don't let the package install generated font files that may overlap |
366 | # Don't let the package install generated font files that may overlap |
| 378 | # with other packages. Instead, they're generated in pkg_postinst(). |
367 | # with other packages. Instead, they're generated in pkg_postinst(). |
| 379 | remove_font_metadata() { |
368 | remove_font_metadata() { |
| 380 | if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then |
369 | if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then |
| … | |
… | |
| 382 | rm -rf "${ED}"/usr/share/fonts/${FONT_DIR}/fonts.{scale,dir,cache-1} |
371 | rm -rf "${ED}"/usr/share/fonts/${FONT_DIR}/fonts.{scale,dir,cache-1} |
| 383 | fi |
372 | fi |
| 384 | } |
373 | } |
| 385 | |
374 | |
| 386 | # @FUNCTION: create_fonts_scale |
375 | # @FUNCTION: create_fonts_scale |
| 387 | # @USAGE: |
|
|
| 388 | # @DESCRIPTION: |
376 | # @DESCRIPTION: |
| 389 | # Create fonts.scale file, used by the old server-side fonts subsystem. |
377 | # Create fonts.scale file, used by the old server-side fonts subsystem. |
| 390 | create_fonts_scale() { |
378 | create_fonts_scale() { |
| 391 | if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then |
379 | if [[ ${FONT_DIR} != Speedo && ${FONT_DIR} != CID ]]; then |
| 392 | ebegin "Generating font.scale" |
380 | ebegin "Generating font.scale" |
| … | |
… | |
| 396 | eend $? |
384 | eend $? |
| 397 | fi |
385 | fi |
| 398 | } |
386 | } |
| 399 | |
387 | |
| 400 | # @FUNCTION: create_fonts_dir |
388 | # @FUNCTION: create_fonts_dir |
| 401 | # @USAGE: |
|
|
| 402 | # @DESCRIPTION: |
389 | # @DESCRIPTION: |
| 403 | # Create fonts.dir file, used by the old server-side fonts subsystem. |
390 | # Create fonts.dir file, used by the old server-side fonts subsystem. |
| 404 | create_fonts_dir() { |
391 | create_fonts_dir() { |
| 405 | ebegin "Generating fonts.dir" |
392 | ebegin "Generating fonts.dir" |
| 406 | mkfontdir \ |
393 | mkfontdir \ |