| 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.120 2012/02/28 18:53:45 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 | |
| … | |
… | |
| 319 | setqtenv |
319 | setqtenv |
| 320 | myconf="$(standard_configure_options) ${myconf}" |
320 | myconf="$(standard_configure_options) ${myconf}" |
| 321 | |
321 | |
| 322 | # this one is needed for all systems with a separate -liconv, apart from |
322 | # this one is needed for all systems with a separate -liconv, apart from |
| 323 | # Darwin, for which the sources already cater for -liconv |
323 | # Darwin, for which the sources already cater for -liconv |
| 324 | use !elibc_glibc && [[ ${CHOST} != *-darwin* ]] && \ |
324 | if use !elibc_glibc && [[ ${CHOST} != *-darwin* ]]; then |
| 325 | myconf+=" -liconv" |
325 | myconf+=" -liconv" |
|
|
326 | fi |
| 326 | |
327 | |
| 327 | if use_if_iuse glib; then |
328 | 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)" |
329 | local glibflags="$(pkg-config --cflags --libs glib-2.0 gthread-2.0)" |
| 330 | # avoid the -pthread argument |
330 | # avoid the -pthread argument |
| 331 | myconf+=" ${glibflags//-pthread}" |
331 | myconf+=" ${glibflags//-pthread}" |
| 332 | unset glibflags |
332 | unset glibflags |
| 333 | fi |
333 | fi |
| … | |
… | |
| 339 | ewarn "disable it before reporting any bugs related to this useflag." |
339 | ewarn "disable it before reporting any bugs related to this useflag." |
| 340 | ewarn |
340 | ewarn |
| 341 | myconf+=" -qpa" |
341 | myconf+=" -qpa" |
| 342 | fi |
342 | fi |
| 343 | |
343 | |
| 344 | if use aqua ; then |
344 | if use aqua; then |
| 345 | # On (snow) leopard use the new (frameworked) cocoa code. |
345 | # On (snow) leopard use the new (frameworked) cocoa code. |
| 346 | if [[ ${CHOST##*-darwin} -ge 9 ]] ; then |
346 | if [[ ${CHOST##*-darwin} -ge 9 ]]; then |
| 347 | myconf+=" -cocoa -framework" |
347 | myconf+=" -cocoa -framework" |
|
|
348 | # We need the source's headers, not the installed ones. |
|
|
349 | myconf+=" -I${S}/include" |
|
|
350 | # Add hint for the framework location. |
|
|
351 | myconf+=" -F${QTLIBDIR}" |
| 348 | |
352 | |
| 349 | # We are crazy and build cocoa + qt3support :-) |
353 | # We are crazy and build cocoa + qt3support :-) |
| 350 | if use qt3support; then |
354 | if use qt3support; then |
| 351 | sed -e "/case \"\$PLATFORM,\$CFG_MAC_COCOA\" in/,/;;/ s|CFG_QT3SUPPORT=\"no\"|CFG_QT3SUPPORT=\"yes\"|" \ |
355 | sed -e "/case \"\$PLATFORM,\$CFG_MAC_COCOA\" in/,/;;/ s|CFG_QT3SUPPORT=\"no\"|CFG_QT3SUPPORT=\"yes\"|" \ |
| 352 | -i configure || die |
356 | -i configure || die |
| 353 | fi |
357 | fi |
| 354 | |
358 | else |
| 355 | # We need the source's headers, not the installed ones. |
359 | myconf+=" -no-framework" |
| 356 | myconf+=" -I${S}/include" |
|
|
| 357 | |
|
|
| 358 | # Add hint for the framework location. |
|
|
| 359 | myconf+=" -F${QTLIBDIR}" |
|
|
| 360 | fi |
360 | fi |
| 361 | else |
361 | else |
| 362 | # freetype2 include dir is non-standard, thus include it on configure |
362 | # freetype2 include dir is non-standard, thus include it on configure |
| 363 | # use -I from configure |
363 | # use -I from configure |
| 364 | myconf+=" $(pkg-config --cflags freetype2)" |
364 | myconf+=" $(pkg-config --cflags freetype2)" |
| … | |
… | |
| 395 | # @FUNCTION: fix_includes |
395 | # @FUNCTION: fix_includes |
| 396 | # @DESCRIPTION: |
396 | # @DESCRIPTION: |
| 397 | # For MacOS X we need to add some symlinks when frameworks are |
397 | # 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. |
398 | # being used, to avoid complications with some more or less stupid packages. |
| 399 | fix_includes() { |
399 | fix_includes() { |
| 400 | if use aqua && [[ ${CHOST##*-darwin} -ge 9 ]] ; then |
400 | if use aqua && [[ ${CHOST##*-darwin} -ge 9 ]]; then |
| 401 | # Some packages tend to include <Qt/...> |
401 | # Some packages tend to include <Qt/...> |
| 402 | dodir "${QTHEADERDIR#${EPREFIX}}"/Qt |
402 | dodir "${QTHEADERDIR#${EPREFIX}}"/Qt |
| 403 | |
403 | |
| 404 | # Fake normal headers when frameworks are installed... eases life later on |
404 | # Fake normal headers when frameworks are installed... eases life later on |
| 405 | local dest f h |
405 | local dest f h |
| … | |
… | |
| 463 | # @INTERNAL |
463 | # @INTERNAL |
| 464 | # @DESCRIPTION: |
464 | # @DESCRIPTION: |
| 465 | # Sets up some standard configure options, like libdir (if necessary), whether |
465 | # Sets up some standard configure options, like libdir (if necessary), whether |
| 466 | # debug info is wanted or not. |
466 | # debug info is wanted or not. |
| 467 | standard_configure_options() { |
467 | standard_configure_options() { |
|
|
468 | local myconf=" |
| 468 | local myconf="-prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} |
469 | -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} |
| 469 | -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} -plugindir ${QTPLUGINDIR} |
470 | -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} -plugindir ${QTPLUGINDIR} |
| 470 | $(version_is_at_least 4.7 && echo -importdir ${QTIMPORTDIR}) |
471 | $(version_is_at_least 4.7 && echo -importdir ${QTIMPORTDIR}) |
| 471 | -datadir ${QTDATADIR} -translationdir ${QTTRANSDIR} -sysconfdir ${QTSYSCONFDIR} |
472 | -datadir ${QTDATADIR} -translationdir ${QTTRANSDIR} -sysconfdir ${QTSYSCONFDIR} |
| 472 | -examplesdir ${QTEXAMPLESDIR} -demosdir ${QTDEMOSDIR} |
473 | -examplesdir ${QTEXAMPLESDIR} -demosdir ${QTDEMOSDIR} |
| 473 | -opensource -confirm-license -shared -fast -largefile -stl -verbose |
474 | -opensource -confirm-license -shared -fast -largefile -stl -verbose |
| … | |
… | |
| 482 | myconf+=" -release" |
483 | myconf+=" -release" |
| 483 | fi |
484 | fi |
| 484 | myconf+=" -no-separate-debug-info" |
485 | myconf+=" -no-separate-debug-info" |
| 485 | |
486 | |
| 486 | # exceptions USE flag |
487 | # exceptions USE flag |
| 487 | local exceptions="-exceptions" |
488 | myconf+=" $(in_iuse exceptions && qt_use exceptions || echo -exceptions)" |
| 488 | in_iuse exceptions && exceptions="$(qt_use exceptions)" |
|
|
| 489 | myconf+=" ${exceptions}" |
|
|
| 490 | |
489 | |
| 491 | # disable RPATH on Qt >= 4.8 (bug 380415) |
490 | # disable RPATH on Qt >= 4.8 (bug 380415) |
| 492 | version_is_at_least 4.8 && myconf+=" -no-rpath" |
491 | version_is_at_least 4.8 && myconf+=" -no-rpath" |
| 493 | |
492 | |
| 494 | # precompiled headers don't work on hardened, where the flag is masked |
493 | # precompiled headers don't work on hardened, where the flag is masked |
| … | |
… | |
| 498 | # This flag seems to introduce major breakage to applications, |
497 | # This flag seems to introduce major breakage to applications, |
| 499 | # mostly to be seen as a core dump with the message "QPixmap: Must |
498 | # mostly to be seen as a core dump with the message "QPixmap: Must |
| 500 | # construct a QApplication before a QPaintDevice" on Solaris. |
499 | # construct a QApplication before a QPaintDevice" on Solaris. |
| 501 | # -- Daniel Vergien |
500 | # -- Daniel Vergien |
| 502 | [[ ${CHOST} != *-solaris* ]] && myconf+=" -reduce-relocations" |
501 | [[ ${CHOST} != *-solaris* ]] && myconf+=" -reduce-relocations" |
| 503 | |
|
|
| 504 | use aqua && myconf+=" -no-framework" |
|
|
| 505 | |
502 | |
| 506 | # ARCH is set on Gentoo. Qt now falls back to generic on an unsupported |
503 | # ARCH is set on Gentoo. Qt now falls back to generic on an unsupported |
| 507 | # $(tc-arch). Therefore we convert it to supported values. |
504 | # $(tc-arch). Therefore we convert it to supported values. |
| 508 | case "$(tc-arch)" in |
505 | case "$(tc-arch)" in |
| 509 | amd64|x64-*) myconf+=" -arch x86_64" ;; |
506 | amd64|x64-*) myconf+=" -arch x86_64" ;; |