/[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.86 Revision 1.97
1# Copyright 1999-2009 Gentoo Foundation 1# Copyright 1999-2011 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.86 2010/11/13 20:30:26 wired Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/qt4-build.eclass,v 1.97 2011/11/02 18:01:00 jer Exp $
4 4
5# @ECLASS: qt4-build.eclass 5# @ECLASS: qt4-build.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Ben de Groot <yngwin@gentoo.org>, 7# Ben de Groot <yngwin@gentoo.org>,
8# Markos Chandras <hwoarang@gentoo.org>, 8# Markos Chandras <hwoarang@gentoo.org>,
15inherit base eutils multilib toolchain-funcs flag-o-matic versionator 15inherit base eutils multilib toolchain-funcs flag-o-matic versionator
16 16
17MY_PV=${PV/_/-} 17MY_PV=${PV/_/-}
18if version_is_at_least 4.5.99999999; then 18if version_is_at_least 4.5.99999999; then
19 MY_P=qt-everywhere-opensource-src-${MY_PV} 19 MY_P=qt-everywhere-opensource-src-${MY_PV}
20 [[ ${CATEGORY}/${PN} != x11-libs/qt-xmlpatterns ]] && 20 [[ ${CATEGORY}/${PN} != x11-libs/qt-xmlpatterns ]] &&
21 [[ ${CATEGORY}/${PN} != x11-themes/qgtkstyle ]] && 21 [[ ${CATEGORY}/${PN} != x11-themes/qgtkstyle ]] &&
22 IUSE="+exceptions" 22 IUSE="+exceptions"
23else 23else
24 MY_P=qt-x11-opensource-src-${MY_PV} 24 MY_P=qt-x11-opensource-src-${MY_PV}
25fi 25fi
26 26
27if version_is_at_least 4.7.99999999; then
28 IUSE+=" c++0x qpa"
29fi
30
27HOMEPAGE="http://qt.nokia.com/" 31HOMEPAGE="http://qt.nokia.com/"
28SRC_URI="http://get.qt.nokia.com/qt/source/${MY_P}.tar.gz" 32SRC_URI="http://get.qt.nokia.com/qt/source/${MY_P}.tar.gz"
29 33
30LICENSE="|| ( LGPL-2.1 GPL-3 )" 34LICENSE="|| ( LGPL-2.1 GPL-3 )"
31IUSE+=" debug"
32[[ ${CATEGORY}/${PN} != x11-themes/qgtkstyle ]] &&
33 IUSE+=" pch aqua" 35IUSE+=" debug pch aqua"
34 36
35RDEPEND=" 37RDEPEND="
36 !<x11-libs/qt-assistant-${PV} 38 !<x11-libs/qt-assistant-${PV}
37 !>x11-libs/qt-assistant-${PV}-r9999 39 !>x11-libs/qt-assistant-${PV}-r9999
38 !<x11-libs/qt-core-${PV} 40 !<x11-libs/qt-core-${PV}
137# @FUNCTION: qt4-build_src_unpack 139# @FUNCTION: qt4-build_src_unpack
138# @DESCRIPTION: 140# @DESCRIPTION:
139# Unpacks the sources 141# Unpacks the sources
140qt4-build_src_unpack() { 142qt4-build_src_unpack() {
141 setqtenv 143 setqtenv
144 local unpack_p="${MY_P}"
145 case "${PV}" in
146 4.8.0_*)
147 unpack_p="qt-everywhere-opensource-src-${PV/_*}"
148 ;;
149 esac
142 local target targets= 150 local target targets=
143 for target in configure LICENSE.GPL3 LICENSE.LGPL projects.pro \ 151 for target in configure LICENSE.GPL3 LICENSE.LGPL projects.pro \
144 src/{qbase,qt_targets,qt_install}.pri bin config.tests mkspecs qmake \ 152 src/{qbase,qt_targets,qt_install}.pri bin config.tests mkspecs qmake \
145 ${QT4_EXTRACT_DIRECTORIES}; do 153 ${QT4_EXTRACT_DIRECTORIES}; do
146 targets+=" ${MY_P}/${target}" 154 targets+=" ${unpack_p}/${target}"
147 done 155 done
148 156
149 echo tar xzf "${DISTDIR}"/${MY_P}.tar.gz ${targets} 157 echo tar xzf "${DISTDIR}"/${MY_P}.tar.gz ${targets}
150 tar xzf "${DISTDIR}"/${MY_P}.tar.gz ${targets} || die 158 tar xzf "${DISTDIR}"/${MY_P}.tar.gz ${targets} || die
159 case "${PV}" in
160 4.8.0_*)
161 mv ${WORKDIR}/qt-everywhere-opensource-src-${PV/_*} \
162 ${WORKDIR}/qt-everywhere-opensource-src-${MY_PV}
163 ;;
164 esac
151} 165}
152 166
153# @ECLASS-VARIABLE: PATCHES 167# @ECLASS-VARIABLE: PATCHES
154# @DESCRIPTION: 168# @DESCRIPTION:
155# In case you have patches to apply, specify them in PATCHES variable. Make sure 169# In case you have patches to apply, specify them in PATCHES variable. Make sure
164# Prepare the sources before the configure phase. Strip CFLAGS if necessary, and fix 178# Prepare the sources before the configure phase. Strip CFLAGS if necessary, and fix
165# source files in order to respect CFLAGS/CXXFLAGS/LDFLAGS specified on /etc/make.conf. 179# source files in order to respect CFLAGS/CXXFLAGS/LDFLAGS specified on /etc/make.conf.
166qt4-build_src_prepare() { 180qt4-build_src_prepare() {
167 setqtenv 181 setqtenv
168 cd "${S}" 182 cd "${S}"
169 183
170 # fix qt 4.7 regression that skips -fvisibility=hidden 184 # fix qt 4.7 regression that skips -fvisibility=hidden
171 if version_is_at_least "4.7.0_beta1"; then 185 if version_is_at_least "4.7.0_beta1"; then
172 sed -e "s/^gcc|g++)/*gcc|*g++)/" \ 186 sed -e "s/^gcc|g++)/*gcc|*g++)/" \
173 -i config.tests/unix/fvisibility.test || 187 -i config.tests/unix/fvisibility.test ||
174 die "visibility fixing sed failed" 188 die "visibility fixing sed failed"
175 fi 189 fi
176 # fix libx11 dependency on non X packages 190 # fix libx11 dependency on non X packages
177 if version_is_at_least "4.7.0_beta2"; then 191 if version_is_at_least "4.7.0_beta2"; then
178 local NOLIBX11PKG="qt-core qt-dbus qt-script qt-sql qt-test qt-xmlpatterns" 192 local NOLIBX11PKG="qt-core qt-dbus qt-script qt-sql qt-test qt-xmlpatterns"
179 hasq ${PN} ${NOLIBX11PKG} && qt_nolibx11 193 has ${PN} ${NOLIBX11PKG} && qt_nolibx11
180 [[ ${PN} == "qt-assistant" ]] && qt_assistant_cleanup 194 [[ ${PN} == "qt-assistant" ]] && qt_assistant_cleanup
181 fi 195 fi
182 196
183 if use aqua; then 197 if use aqua; then
184 # provide a proper macx-g++-64 198 # provide a proper macx-g++-64
204 if [[ $(gcc-major-version) == 3 ]] && use amd64; then 218 if [[ $(gcc-major-version) == 3 ]] && use amd64; then
205 ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS" 219 ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS"
206 append-flags -fno-gcse 220 append-flags -fno-gcse
207 fi 221 fi
208 222
223 if has c++0x ${IUSE//+} && use c++0x; then
224 ewarn "You are about to build Qt4 using the C++11 standard. Even though"
225 ewarn "this is an official standard, some of the reverse dependencies"
226 ewarn "may fail to compile or link againt the Qt4 libraries. Before"
227 ewarn "reporting a bug, make sure your bug is reproducible with c++0x"
228 ewarn "disabled."
229 append-flags -std=c++0x
230 fi
209 # Unsupported old gcc versions - hardened needs this :( 231 # Unsupported old gcc versions - hardened needs this :(
210 if [[ $(gcc-major-version) -lt 4 ]] ; then 232 if [[ $(gcc-major-version) -lt 4 ]] ; then
211 ewarn "Appending -fno-stack-protector to CXXFLAGS" 233 ewarn "Appending -fno-stack-protector to CXXFLAGS"
212 append-cxxflags -fno-stack-protector 234 append-cxxflags -fno-stack-protector
213 # Bug 253127 235 # Bug 253127
220 ewarn "Appending -mminimal-toc to CFLAGS/CXXFLAGS" 242 ewarn "Appending -mminimal-toc to CFLAGS/CXXFLAGS"
221 append-flags -mminimal-toc 243 append-flags -mminimal-toc
222 fi 244 fi
223 245
224 # Bug 282984 && Bug 295530 246 # Bug 282984 && Bug 295530
225 sed -e "s:\(^SYSTEM_VARIABLES\):CC="$(tc-getCC)"\nCXX="$(tc-getCXX)"\nCFLAGS=\"${CFLAGS}\"\nCXXFLAGS=\"${CXXFLAGS}\"\nLDFLAGS=\"${LDFLAGS}\"\n\1:" \ 247 sed -e "s:\(^SYSTEM_VARIABLES\):CC=\"$(tc-getCC)\"\nCXX=\"$(tc-getCXX)\"\nCFLAGS=\"${CFLAGS}\"\nCXXFLAGS=\"${CXXFLAGS}\"\nLDFLAGS=\"${LDFLAGS}\"\n\1:" \
226 -i configure || die "sed qmake compilers failed" 248 -i configure || die "sed qmake compilers failed"
227 # bug 321335 249 # bug 321335
228 if version_is_at_least 4.6; then 250 if version_is_at_least 4.6; then
229 find ./config.tests/unix -name "*.test" -type f -exec grep -lZ \$MAKE '{}' \; | \ 251 find ./config.tests/unix -name "*.test" -type f -exec grep -lZ \$MAKE '{}' \; | \
230 xargs -0 \ 252 xargs -0 \
231 sed -e "s:\(\$MAKE\):\1 CC="$(tc-getCC)" CXX="$(tc-getCXX)" LD="$(tc-getCXX)" LINK="$(tc-getCXX)":g" \ 253 sed -e "s:\(\$MAKE\):\1 CC=\"$(tc-getCC)\" CXX=\"$(tc-getCXX)\" LD=\"$(tc-getCXX)\" LINK=\"$(tc-getCXX)\":g" \
232 -i || die "sed test compilers failed" 254 -i || die "sed test compilers failed"
233 fi 255 fi
234 256
235 # Bug 172219 257 # Bug 172219
236 sed -e "s:X11R6/::" \ 258 sed -e "s:X11R6/::" \
310 # avoid the -pthread argument 332 # avoid the -pthread argument
311 myconf+=" ${glibflags//-pthread}" 333 myconf+=" ${glibflags//-pthread}"
312 unset glibflags 334 unset glibflags
313 fi 335 fi
314 336
337 if has qpa ${IUSE//+} && use qpa; then
338 ewarn
339 ewarn "The qpa useflag enables the Qt Platform Abstraction, formely"
340 ewarn "known as Qt Lighthouse. If you are not sure what that is, then"
341 ewarn "disable it before reporting any bugs related to this useflag."
342 ewarn
343 myconf+=" -qpa"
344 fi
345
315 if use aqua ; then 346 if use aqua ; then
316 # On (snow) leopard use the new (frameworked) cocoa code. 347 # On (snow) leopard use the new (frameworked) cocoa code.
317 if [[ ${CHOST##*-darwin} -ge 9 ]] ; then 348 if [[ ${CHOST##*-darwin} -ge 9 ]] ; then
318 myconf+=" -cocoa -framework" 349 myconf+=" -cocoa -framework"
319 350
335 myconf+=" $(pkg-config --cflags freetype2)" 366 myconf+=" $(pkg-config --cflags freetype2)"
336 fi 367 fi
337 368
338 # Disable SSE4.x, since auto-detection is currently broken 369 # Disable SSE4.x, since auto-detection is currently broken
339 # Upstream bug http://bugreports.qt.nokia.com/browse/QTBUG-13623 370 # Upstream bug http://bugreports.qt.nokia.com/browse/QTBUG-13623
340 if version_is_at_least 4.7.1; then 371 [[ ${PV} == "4.7.1" ]] && myconf+=" -no-sse4.1 -no-sse4.2"
341 myconf+=" -no-sse4.1 -no-sse4.2"
342 fi
343 372
344 echo ./configure ${myconf} 373 echo ./configure ${myconf}
345 ./configure ${myconf} || die "./configure failed" 374 ./configure ${myconf} || die "./configure failed"
346 myconf="" 375 myconf=""
376
377 prepare_directories ${QT4_TARGET_DIRECTORIES}
347} 378}
348 379
349# @FUNCTION: qt4-build_src_compile 380# @FUNCTION: qt4-build_src_compile
381# @DESCRIPTION:
350# @DESCRIPTION: Actual compile phase 382# Actual compile phase
351qt4-build_src_compile() { 383qt4-build_src_compile() {
352 setqtenv 384 setqtenv
353 385
354 build_directories ${QT4_TARGET_DIRECTORIES} 386 build_directories ${QT4_TARGET_DIRECTORIES}
355} 387}
398 install_directories ${QT4_TARGET_DIRECTORIES} 430 install_directories ${QT4_TARGET_DIRECTORIES}
399 install_qconfigs 431 install_qconfigs
400 fix_library_files 432 fix_library_files
401 fix_includes 433 fix_includes
402 # remove .la files since we are building only shared Qt libraries 434 # remove .la files since we are building only shared Qt libraries
403 find "${D}"${QTLIBDIR} -name "*.la" -print0 | xargs -0 rm 435 find "${D}"${QTLIBDIR} -name "*.la" -print0 | xargs -0 rm
404} 436}
405 437
406# @FUNCTION: setqtenv 438# @FUNCTION: setqtenv
407setqtenv() { 439setqtenv() {
408 # Set up installation directories 440 # Set up installation directories
495 -nomake examples -nomake demos" 527 -nomake examples -nomake demos"
496 528
497 echo "${myconf}" 529 echo "${myconf}"
498} 530}
499 531
500# @FUNCTION: build_directories 532# @FUNCTION: prepare_directories
501# @USAGE: < directories > 533# @USAGE: < directories >
502# @DESCRIPTION: 534# @DESCRIPTION:
503# Compiles the code in $QT4_TARGET_DIRECTORIES 535# Generates makefiles for the directories set in $QT4_TARGET_DIRECTORIES
504build_directories() { 536prepare_directories() {
505 for x in "$@"; do 537 for x in "$@"; do
506 pushd "${S}"/${x} >/dev/null 538 pushd "${S}"/${x} >/dev/null
539 einfo "running qmake in: $x"
507 # avoid running over the maximum argument number, bug #299810 540 # avoid running over the maximum argument number, bug #299810
508 { 541 {
509 echo "${S}"/mkspecs/common/*.conf 542 echo "${S}"/mkspecs/common/*.conf
510 find "${S}" -name '*.pr[io]' 543 find "${S}" -name '*.pr[io]'
511 } | xargs sed -i -e "s:\$\$\[QT_INSTALL_LIBS\]:${EPREFIX}/usr/$(get_libdir)/qt4:g" || die 544 } | xargs sed -i -e "s:\$\$\[QT_INSTALL_LIBS\]:${EPREFIX}/usr/$(get_libdir)/qt4:g" || die
512 "${S}"/bin/qmake "LIBS+=-L${QTLIBDIR}" "CONFIG+=nostrip" || die "qmake failed" 545 "${S}"/bin/qmake "LIBS+=-L${QTLIBDIR}" "CONFIG+=nostrip" || die "qmake failed"
546 popd >/dev/null
547 done
548}
549
550
551# @FUNCTION: build_directories
552# @USAGE: < directories >
553# @DESCRIPTION:
554# Compiles the code in $QT4_TARGET_DIRECTORIES
555build_directories() {
556 for x in "$@"; do
557 pushd "${S}"/${x} >/dev/null
513 emake CC="$(tc-getCC)" \ 558 emake CC="$(tc-getCC)" \
514 CXX="$(tc-getCXX)" \ 559 CXX="$(tc-getCXX)" \
515 LINK="$(tc-getCXX)" || die "emake failed" 560 LINK="$(tc-getCXX)" || die "emake failed"
516 popd >/dev/null 561 popd >/dev/null
517 done 562 done
543# @DESCRIPTION: 588# @DESCRIPTION:
544# List variables that should be defined at the top of QtCore/qconfig.h 589# List variables that should be defined at the top of QtCore/qconfig.h
545: ${QCONFIG_DEFINE:=} 590: ${QCONFIG_DEFINE:=}
546 591
547# @FUNCTION: install_qconfigs 592# @FUNCTION: install_qconfigs
593# @DESCRIPTION:
548# @DESCRIPTION: Install gentoo-specific mkspecs configurations 594# Install gentoo-specific mkspecs configurations
549install_qconfigs() { 595install_qconfigs() {
550 local x 596 local x
551 if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} ]]; then 597 if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} ]]; then
552 for x in QCONFIG_ADD QCONFIG_REMOVE; do 598 for x in QCONFIG_ADD QCONFIG_REMOVE; do
553 [[ -n ${!x} ]] && echo ${x}=${!x} >> "${T}"/${PN}-qconfig.pri 599 [[ -n ${!x} ]] && echo ${x}=${!x} >> "${T}"/${PN}-qconfig.pri
564 doins "${T}"/gentoo-${PN}-qconfig.h || die "installing ${PN}-qconfig.h failed" 610 doins "${T}"/gentoo-${PN}-qconfig.h || die "installing ${PN}-qconfig.h failed"
565 fi 611 fi
566} 612}
567 613
568# @FUNCTION: generate_qconfigs 614# @FUNCTION: generate_qconfigs
615# @DESCRIPTION:
569# @DESCRIPTION: Generates gentoo-specific configurations 616# Generates gentoo-specific configurations
570generate_qconfigs() { 617generate_qconfigs() {
571 if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} || -n ${QCONFIG_DEFINE} || ${CATEGORY}/${PN} == x11-libs/qt-core ]]; then 618 if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} || -n ${QCONFIG_DEFINE} || ${CATEGORY}/${PN} == x11-libs/qt-core ]]; then
572 local x qconfig_add qconfig_remove qconfig_new 619 local x qconfig_add qconfig_remove qconfig_new
573 for x in "${ROOT}${QTDATADIR}"/mkspecs/gentoo/*-qconfig.pri; do 620 for x in "${ROOT}${QTDATADIR}"/mkspecs/gentoo/*-qconfig.pri; do
574 [[ -f ${x} ]] || continue 621 [[ -f ${x} ]] || continue
588 635
589 # generate list of QT_CONFIG entries from the existing list 636 # generate list of QT_CONFIG entries from the existing list
590 # including qconfig_add and excluding qconfig_remove 637 # including qconfig_add and excluding qconfig_remove
591 for x in $(sed -n 's/^QT_CONFIG +=//p' \ 638 for x in $(sed -n 's/^QT_CONFIG +=//p' \
592 "${ROOT}${QTDATADIR}"/mkspecs/qconfig.pri) ${qconfig_add}; do 639 "${ROOT}${QTDATADIR}"/mkspecs/qconfig.pri) ${qconfig_add}; do
593 hasq ${x} ${qconfig_remove} || qconfig_new+=" ${x}" 640 has ${x} ${qconfig_remove} || qconfig_new+=" ${x}"
594 done 641 done
595 642
596 # replace the existing QT_CONFIG list with qconfig_new 643 # replace the existing QT_CONFIG list with qconfig_new
597 if ! sed -i -e "s/QT_CONFIG +=.*/QT_CONFIG += ${qconfig_new}/" \ 644 if ! sed -i -e "s/QT_CONFIG +=.*/QT_CONFIG += ${qconfig_new}/" \
598 "${ROOT}${QTDATADIR}"/mkspecs/qconfig.pri; then 645 "${ROOT}${QTDATADIR}"/mkspecs/qconfig.pri; then
622 fi 669 fi
623 fi 670 fi
624} 671}
625 672
626# @FUNCTION: qt4-build_pkg_postrm 673# @FUNCTION: qt4-build_pkg_postrm
674# @DESCRIPTION:
627# @DESCRIPTION: Generate configurations when the package is completely removed 675# Generate configurations when the package is completely removed
628qt4-build_pkg_postrm() { 676qt4-build_pkg_postrm() {
629 generate_qconfigs 677 generate_qconfigs
630} 678}
631 679
632# @FUNCTION: qt4-build_pkg_postinst 680# @FUNCTION: qt4-build_pkg_postinst
681# @DESCRIPTION:
633# @DESCRIPTION: Generate configuration, plus throws a message about possible 682# Generate configuration, plus throws a message about possible
634# breakages and proposed solutions. 683# breakages and proposed solutions.
635qt4-build_pkg_postinst() { 684qt4-build_pkg_postinst() {
636 generate_qconfigs 685 generate_qconfigs
637} 686}
638 687

Legend:
Removed from v.1.86  
changed lines
  Added in v.1.97

  ViewVC Help
Powered by ViewVC 1.1.20