/[gentoo-x86]/eclass/qt4-build.eclass
Gentoo

Diff of /eclass/qt4-build.eclass

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

Revision 1.119 Revision 1.121
1# Copyright 1999-2012 Gentoo Foundation 1# Copyright 1999-2012 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/qt4-build.eclass,v 1.119 2012/02/28 18:19:29 pesa Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/qt4-build.eclass,v 1.121 2012/03/01 15:06:00 pesa Exp $
4 4
5# @ECLASS: qt4-build.eclass 5# @ECLASS: qt4-build.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Qt herd <qt@gentoo.org> 7# Qt herd <qt@gentoo.org>
8# @BLURB: Eclass for Qt4 split ebuilds. 8# @BLURB: Eclass for Qt4 split ebuilds.
196 skip_qmake_build 196 skip_qmake_build
197 skip_project_generation 197 skip_project_generation
198 symlink_binaries_to_buildtree 198 symlink_binaries_to_buildtree
199 fi 199 fi
200 200
201 if [[ ${CHOST} == *86*-apple-darwin* ]] ; then 201 if [[ ${CHOST} == *86*-apple-darwin* ]]; then
202 # qmake bus errors with -O2 but -O3 works 202 # qmake bus errors with -O2 but -O3 works
203 replace-flags -O2 -O3 203 replace-flags -O2 -O3
204 fi 204 fi
205 205
206 # Bug 178652 206 # Bug 178652
217 ewarn "disabled." 217 ewarn "disabled."
218 append-flags -std=c++0x 218 append-flags -std=c++0x
219 fi 219 fi
220 220
221 # Unsupported old gcc versions - hardened needs this :( 221 # Unsupported old gcc versions - hardened needs this :(
222 if [[ $(gcc-major-version) -lt 4 ]] ; then 222 if [[ $(gcc-major-version) -lt 4 ]]; then
223 ewarn "Appending -fno-stack-protector to CXXFLAGS" 223 ewarn "Appending -fno-stack-protector to CXXFLAGS"
224 append-cxxflags -fno-stack-protector 224 append-cxxflags -fno-stack-protector
225 # Bug 253127 225 # Bug 253127
226 sed -e "/^QMAKE_CFLAGS\t/ s:$: -fno-stack-protector-all:" \ 226 sed -e "/^QMAKE_CFLAGS\t/ s:$: -fno-stack-protector-all:" \
227 -i mkspecs/common/g++.conf || die 227 -i mkspecs/common/g++.conf || die
282 -e "s:-Xarch_ppc64::g" \ 282 -e "s:-Xarch_ppc64::g" \
283 -i configure mkspecs/common/mac-g++.conf \ 283 -i configure mkspecs/common/mac-g++.conf \
284 || die "sed -arch/-Xarch failed" 284 || die "sed -arch/-Xarch failed"
285 285
286 # On Snow Leopard don't fall back to 10.5 deployment target. 286 # On Snow Leopard don't fall back to 10.5 deployment target.
287 if [[ ${CHOST} == *-apple-darwin10 ]] ; then 287 if [[ ${CHOST} == *-apple-darwin10 ]]; then
288 sed -e "s:QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET.*:QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET 10.6:g" \ 288 sed -e "s:QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET.*:QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET 10.6:g" \
289 -e "s:-mmacosx-version-min=10.[0-9]:-mmacosx-version-min=10.6:g" \ 289 -e "s:-mmacosx-version-min=10.[0-9]:-mmacosx-version-min=10.6:g" \
290 -i configure mkspecs/common/mac-g++.conf \ 290 -i configure mkspecs/common/mac-g++.conf \
291 || die "sed deployment target failed" 291 || die "sed deployment target failed"
292 fi 292 fi
293 fi 293 fi
294 294
295 # this one is needed for all systems with a separate -liconv, apart from 295 # this one is needed for all systems with a separate -liconv, apart from
296 # Darwin, for which the sources already cater for -liconv 296 # Darwin, for which the sources already cater for -liconv
297 if use !elibc_glibc && [[ ${CHOST} != *-darwin* ]] ; then 297 if use !elibc_glibc && [[ ${CHOST} != *-darwin* ]]; then
298 sed -e 's|mac:\(LIBS += -liconv\)|\1|g' \ 298 sed -e 's|mac:\(LIBS += -liconv\)|\1|g' \
299 -i config.tests/unix/iconv/iconv.pro \ 299 -i config.tests/unix/iconv/iconv.pro \
300 || die "sed iconv.pro failed" 300 || die "sed iconv.pro failed"
301 fi 301 fi
302 302
315# @FUNCTION: qt4-build_src_configure 315# @FUNCTION: qt4-build_src_configure
316# @DESCRIPTION: 316# @DESCRIPTION:
317# Default configure phase 317# Default configure phase
318qt4-build_src_configure() { 318qt4-build_src_configure() {
319 setqtenv 319 setqtenv
320 myconf="$(standard_configure_options) ${myconf}" 320
321 local conf="
322 -prefix ${QTPREFIXDIR}
323 -bindir ${QTBINDIR}
324 -libdir ${QTLIBDIR}
325 -docdir ${QTDOCDIR}
326 -headerdir ${QTHEADERDIR}
327 -plugindir ${QTPLUGINDIR}
328 $(version_is_at_least 4.7 && echo -importdir ${QTIMPORTDIR})
329 -datadir ${QTDATADIR}
330 -translationdir ${QTTRANSDIR}
331 -sysconfdir ${QTSYSCONFDIR}
332 -examplesdir ${QTEXAMPLESDIR}
333 -demosdir ${QTDEMOSDIR}
334 -opensource -confirm-license
335 -shared -fast -largefile -stl -verbose
336 -nomake examples -nomake demos"
337
338 # ARCH is set on Gentoo. Qt now falls back to generic on an unsupported
339 # $(tc-arch). Therefore we convert it to supported values.
340 case "$(tc-arch)" in
341 amd64|x64-*) conf+=" -arch x86_64" ;;
342 ppc-macos) conf+=" -arch ppc" ;;
343 ppc|ppc64|ppc-*) conf+=" -arch powerpc" ;;
344 sparc|sparc-*|sparc64-*) conf+=" -arch sparc" ;;
345 x86-macos) conf+=" -arch x86" ;;
346 x86|x86-*) conf+=" -arch i386" ;;
347 alpha|arm|ia64|mips|s390) conf+=" -arch $(tc-arch)" ;;
348 hppa|sh) conf+=" -arch generic" ;;
349 *) die "$(tc-arch) is unsupported by this eclass. Please file a bug." ;;
350 esac
351
352 conf+=" -platform $(qt_mkspecs_dir)"
353
354 [[ $(get_libdir) != lib ]] && conf+=" -L${EPREFIX}/usr/$(get_libdir)"
355
356 # debug/release
357 if use debug; then
358 conf+=" -debug"
359 else
360 conf+=" -release"
361 fi
362 conf+=" -no-separate-debug-info"
363
364 # exceptions USE flag
365 conf+=" $(in_iuse exceptions && qt_use exceptions || echo -exceptions)"
366
367 # disable RPATH on Qt >= 4.8 (bug 380415)
368 version_is_at_least 4.8 && conf+=" -no-rpath"
369
370 # precompiled headers don't work on hardened, where the flag is masked
371 conf+=" $(qt_use pch)"
372
373 # -reduce-relocations
374 # This flag seems to introduce major breakage to applications,
375 # mostly to be seen as a core dump with the message "QPixmap: Must
376 # construct a QApplication before a QPaintDevice" on Solaris.
377 # -- Daniel Vergien
378 [[ ${CHOST} != *-solaris* ]] && conf+=" -reduce-relocations"
321 379
322 # this one is needed for all systems with a separate -liconv, apart from 380 # this one is needed for all systems with a separate -liconv, apart from
323 # Darwin, for which the sources already cater for -liconv 381 # Darwin, for which the sources already cater for -liconv
324 use !elibc_glibc && [[ ${CHOST} != *-darwin* ]] && \ 382 if use !elibc_glibc && [[ ${CHOST} != *-darwin* ]]; then
325 myconf+=" -liconv" 383 conf+=" -liconv"
384 fi
326 385
327 if use_if_iuse glib; then 386 if use_if_iuse glib; then
328 # use -I, -L and -l from configure
329 local glibflags="$(pkg-config --cflags --libs glib-2.0 gthread-2.0)" 387 local glibflags="$(pkg-config --cflags --libs glib-2.0 gthread-2.0)"
330 # avoid the -pthread argument 388 # avoid the -pthread argument
331 myconf+=" ${glibflags//-pthread}" 389 conf+=" ${glibflags//-pthread}"
332 unset glibflags 390 unset glibflags
333 fi 391 fi
334 392
335 if use_if_iuse qpa; then 393 if use_if_iuse qpa; then
336 ewarn 394 ewarn
337 ewarn "The qpa useflag enables the Qt Platform Abstraction, formely" 395 ewarn "The qpa useflag enables the Qt Platform Abstraction, formely"
338 ewarn "known as Qt Lighthouse. If you are not sure what that is, then" 396 ewarn "known as Qt Lighthouse. If you are not sure what that is, then"
339 ewarn "disable it before reporting any bugs related to this useflag." 397 ewarn "disable it before reporting any bugs related to this useflag."
340 ewarn 398 ewarn
341 myconf+=" -qpa" 399 conf+=" -qpa"
342 fi 400 fi
343 401
344 if use aqua ; then 402 if use aqua; then
345 # On (snow) leopard use the new (frameworked) cocoa code. 403 # On (snow) leopard use the new (frameworked) cocoa code.
346 if [[ ${CHOST##*-darwin} -ge 9 ]] ; then 404 if [[ ${CHOST##*-darwin} -ge 9 ]]; then
347 myconf+=" -cocoa -framework" 405 conf+=" -cocoa -framework"
406 # We need the source's headers, not the installed ones.
407 conf+=" -I${S}/include"
408 # Add hint for the framework location.
409 conf+=" -F${QTLIBDIR}"
348 410
349 # We are crazy and build cocoa + qt3support :-) 411 # We are crazy and build cocoa + qt3support :-)
350 if use qt3support; then 412 if use qt3support; then
351 sed -e "/case \"\$PLATFORM,\$CFG_MAC_COCOA\" in/,/;;/ s|CFG_QT3SUPPORT=\"no\"|CFG_QT3SUPPORT=\"yes\"|" \ 413 sed -e "/case \"\$PLATFORM,\$CFG_MAC_COCOA\" in/,/;;/ s|CFG_QT3SUPPORT=\"no\"|CFG_QT3SUPPORT=\"yes\"|" \
352 -i configure || die 414 -i configure || die
353 fi 415 fi
354 416 else
355 # We need the source's headers, not the installed ones. 417 conf+=" -no-framework"
356 myconf+=" -I${S}/include"
357
358 # Add hint for the framework location.
359 myconf+=" -F${QTLIBDIR}"
360 fi 418 fi
361 else 419 else
362 # freetype2 include dir is non-standard, thus include it on configure 420 # freetype2 include dir is non-standard, thus pass it to configure
363 # use -I from configure
364 myconf+=" $(pkg-config --cflags freetype2)" 421 conf+=" $(pkg-config --cflags-only-I freetype2)"
365 fi 422 fi
366 423
424 conf+=" ${myconf}"
425 myconf=
426
367 echo ./configure ${myconf} 427 echo ./configure ${conf}
368 ./configure ${myconf} || die "./configure failed" 428 ./configure ${conf} || die "./configure failed"
369 myconf=""
370 429
371 prepare_directories ${QT4_TARGET_DIRECTORIES} 430 prepare_directories ${QT4_TARGET_DIRECTORIES}
372} 431}
373 432
374# @FUNCTION: qt4-build_src_compile 433# @FUNCTION: qt4-build_src_compile
395# @FUNCTION: fix_includes 454# @FUNCTION: fix_includes
396# @DESCRIPTION: 455# @DESCRIPTION:
397# For MacOS X we need to add some symlinks when frameworks are 456# For MacOS X we need to add some symlinks when frameworks are
398# being used, to avoid complications with some more or less stupid packages. 457# being used, to avoid complications with some more or less stupid packages.
399fix_includes() { 458fix_includes() {
400 if use aqua && [[ ${CHOST##*-darwin} -ge 9 ]] ; then 459 if use aqua && [[ ${CHOST##*-darwin} -ge 9 ]]; then
401 # Some packages tend to include <Qt/...> 460 # Some packages tend to include <Qt/...>
402 dodir "${QTHEADERDIR#${EPREFIX}}"/Qt 461 dodir "${QTHEADERDIR#${EPREFIX}}"/Qt
403 462
404 # Fake normal headers when frameworks are installed... eases life later on 463 # Fake normal headers when frameworks are installed... eases life later on
405 local dest f h 464 local dest f h
455 QT_INSTALL_PREFIX=${EPREFIX}/usr/$(get_libdir)/qt4 514 QT_INSTALL_PREFIX=${EPREFIX}/usr/$(get_libdir)/qt4
456 515
457 PLATFORM=$(qt_mkspecs_dir) 516 PLATFORM=$(qt_mkspecs_dir)
458 517
459 unset QMAKESPEC 518 unset QMAKESPEC
460}
461
462# @FUNCTION: standard_configure_options
463# @INTERNAL
464# @DESCRIPTION:
465# Sets up some standard configure options, like libdir (if necessary), whether
466# debug info is wanted or not.
467standard_configure_options() {
468 local myconf="-prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR}
469 -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} -plugindir ${QTPLUGINDIR}
470 $(version_is_at_least 4.7 && echo -importdir ${QTIMPORTDIR})
471 -datadir ${QTDATADIR} -translationdir ${QTTRANSDIR} -sysconfdir ${QTSYSCONFDIR}
472 -examplesdir ${QTEXAMPLESDIR} -demosdir ${QTDEMOSDIR}
473 -opensource -confirm-license -shared -fast -largefile -stl -verbose
474 -platform $(qt_mkspecs_dir) -nomake examples -nomake demos"
475
476 [[ $(get_libdir) != lib ]] && myconf+=" -L${EPREFIX}/usr/$(get_libdir)"
477
478 # debug/release
479 if use debug; then
480 myconf+=" -debug"
481 else
482 myconf+=" -release"
483 fi
484 myconf+=" -no-separate-debug-info"
485
486 # exceptions USE flag
487 local exceptions="-exceptions"
488 in_iuse exceptions && exceptions="$(qt_use exceptions)"
489 myconf+=" ${exceptions}"
490
491 # disable RPATH on Qt >= 4.8 (bug 380415)
492 version_is_at_least 4.8 && myconf+=" -no-rpath"
493
494 # precompiled headers don't work on hardened, where the flag is masked
495 myconf+=" $(qt_use pch)"
496
497 # -reduce-relocations
498 # This flag seems to introduce major breakage to applications,
499 # mostly to be seen as a core dump with the message "QPixmap: Must
500 # construct a QApplication before a QPaintDevice" on Solaris.
501 # -- Daniel Vergien
502 [[ ${CHOST} != *-solaris* ]] && myconf+=" -reduce-relocations"
503
504 use aqua && myconf+=" -no-framework"
505
506 # ARCH is set on Gentoo. Qt now falls back to generic on an unsupported
507 # $(tc-arch). Therefore we convert it to supported values.
508 case "$(tc-arch)" in
509 amd64|x64-*) myconf+=" -arch x86_64" ;;
510 ppc-macos) myconf+=" -arch ppc" ;;
511 ppc|ppc64|ppc-*) myconf+=" -arch powerpc" ;;
512 sparc|sparc-*|sparc64-*) myconf+=" -arch sparc" ;;
513 x86-macos) myconf+=" -arch x86" ;;
514 x86|x86-*) myconf+=" -arch i386" ;;
515 alpha|arm|ia64|mips|s390) myconf+=" -arch $(tc-arch)" ;;
516 hppa|sh) myconf+=" -arch generic" ;;
517 *) die "$(tc-arch) is unsupported by this eclass. Please file a bug." ;;
518 esac
519
520 echo "${myconf}"
521} 519}
522 520
523# @FUNCTION: prepare_directories 521# @FUNCTION: prepare_directories
524# @USAGE: < directories > 522# @USAGE: < directories >
525# @INTERNAL 523# @INTERNAL

Legend:
Removed from v.1.119  
changed lines
  Added in v.1.121

  ViewVC Help
Powered by ViewVC 1.1.20