/[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.139 Revision 1.146
1# Copyright 1999-2012 Gentoo Foundation 1# Copyright 1999-2013 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.139 2012/11/12 09:28:53 pesa Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/qt4-build.eclass,v 1.146 2013/04/28 16:15:33 zmedico 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.
34 EGIT_REPO_URI="git://gitorious.org/qt/qt.git 34 EGIT_REPO_URI="git://gitorious.org/qt/qt.git
35 https://git.gitorious.org/qt/qt.git" 35 https://git.gitorious.org/qt/qt.git"
36 EGIT_BRANCH=${PV%.9999} 36 EGIT_BRANCH=${PV%.9999}
37 ;; 37 ;;
38 release) 38 release)
39 if version_is_at_least 4.8.1; then
40 SRC_URI="http://releases.qt-project.org/qt4/source/${MY_P}.tar.gz" 39 SRC_URI="http://releases.qt-project.org/qt4/source/${MY_P}.tar.gz"
41 else
42 SRC_URI="http://get.qt.nokia.com/qt/source/${MY_P}.tar.gz"
43 fi
44 ;; 40 ;;
45esac 41esac
46 42
47IUSE="aqua debug pch" 43IUSE="aqua debug pch"
44[[ ${CATEGORY}/${PN} != dev-qt/qtwebkit ]] && IUSE+=" c++0x"
48[[ ${CATEGORY}/${PN} != x11-libs/qt-xmlpatterns ]] && IUSE+=" +exceptions" 45[[ ${CATEGORY}/${PN} != dev-qt/qtxmlpatterns ]] && IUSE+=" +exceptions"
49if version_is_at_least 4.8; then
50 [[ ${CATEGORY}/${PN} != x11-libs/qt-webkit ]] && IUSE+=" c++0x"
51 version_is_at_least 4.8.3 || IUSE+=" qpa"
52fi
53 46
54DEPEND="virtual/pkgconfig" 47DEPEND="virtual/pkgconfig"
55if [[ ${QT4_BUILD_TYPE} == live ]]; then 48if [[ ${QT4_BUILD_TYPE} == live ]]; then
56 DEPEND+=" dev-lang/perl" 49 DEPEND+=" dev-lang/perl"
57fi 50fi
58
59RDEPEND="
60 !<x11-libs/qt-assistant-${PV}:4
61 !>x11-libs/qt-assistant-${PV}-r9999:4
62 !<x11-libs/qt-bearer-${PV}:4
63 !>x11-libs/qt-bearer-${PV}-r9999:4
64 !<x11-libs/qt-core-${PV}:4
65 !>x11-libs/qt-core-${PV}-r9999:4
66 !<x11-libs/qt-dbus-${PV}:4
67 !>x11-libs/qt-dbus-${PV}-r9999:4
68 !<x11-libs/qt-declarative-${PV}:4
69 !>x11-libs/qt-declarative-${PV}-r9999:4
70 !<x11-libs/qt-demo-${PV}:4
71 !>x11-libs/qt-demo-${PV}-r9999:4
72 !<x11-libs/qt-gui-${PV}:4
73 !>x11-libs/qt-gui-${PV}-r9999:4
74 !<x11-libs/qt-multimedia-${PV}:4
75 !>x11-libs/qt-multimedia-${PV}-r9999:4
76 !<x11-libs/qt-opengl-${PV}:4
77 !>x11-libs/qt-opengl-${PV}-r9999:4
78 !<x11-libs/qt-openvg-${PV}:4
79 !>x11-libs/qt-openvg-${PV}-r9999:4
80 !<x11-libs/qt-phonon-${PV}:4
81 !>x11-libs/qt-phonon-${PV}-r9999:4
82 !<x11-libs/qt-qt3support-${PV}:4
83 !>x11-libs/qt-qt3support-${PV}-r9999:4
84 !<x11-libs/qt-script-${PV}:4
85 !>x11-libs/qt-script-${PV}-r9999:4
86 !<x11-libs/qt-sql-${PV}:4
87 !>x11-libs/qt-sql-${PV}-r9999:4
88 !<x11-libs/qt-svg-${PV}:4
89 !>x11-libs/qt-svg-${PV}-r9999:4
90 !<x11-libs/qt-test-${PV}:4
91 !>x11-libs/qt-test-${PV}-r9999:4
92 !<x11-libs/qt-webkit-${PV}:4
93 !>x11-libs/qt-webkit-${PV}-r9999:4
94 !<x11-libs/qt-xmlpatterns-${PV}:4
95 !>x11-libs/qt-xmlpatterns-${PV}-r9999:4
96"
97 51
98S=${WORKDIR}/${MY_P} 52S=${WORKDIR}/${MY_P}
99 53
100# @FUNCTION: qt4-build_pkg_setup 54# @FUNCTION: qt4-build_pkg_setup
101# @DESCRIPTION: 55# @DESCRIPTION:
147 101
148 if ! version_is_at_least 4.1 $(gcc-version); then 102 if ! version_is_at_least 4.1 $(gcc-version); then
149 ewarn "Using a GCC version lower than 4.1 is not supported." 103 ewarn "Using a GCC version lower than 4.1 is not supported."
150 fi 104 fi
151 105
152 if [[ ${PN} == qt-webkit ]]; then 106 if [[ ${CATEGORY}/${PN} == dev-qt/qtwebkit ]]; then
153 eshopts_push -s extglob 107 eshopts_push -s extglob
154 if is-flagq '-g?(gdb)?([1-9])'; then 108 if is-flagq '-g?(gdb)?([1-9])'; then
155 echo 109 echo
156 ewarn "You have enabled debug info (probably have -g or -ggdb in your CFLAGS/CXXFLAGS)." 110 ewarn "You have enabled debug info (probably have -g or -ggdb in your CFLAGS/CXXFLAGS)."
157 ewarn "You may experience really long compilation times and/or increased memory usage." 111 ewarn "You may experience really long compilation times and/or increased memory usage."
196# @CODE 150# @CODE
197 151
198# @FUNCTION: qt4-build_src_prepare 152# @FUNCTION: qt4-build_src_prepare
199# @DESCRIPTION: 153# @DESCRIPTION:
200# Prepare the sources before the configure phase. Strip CFLAGS if necessary, and fix 154# Prepare the sources before the configure phase. Strip CFLAGS if necessary, and fix
201# the build system in order to respect CFLAGS/CXXFLAGS/LDFLAGS specified in /etc/make.conf. 155# the build system in order to respect CFLAGS/CXXFLAGS/LDFLAGS specified in make.conf.
202qt4-build_src_prepare() { 156qt4-build_src_prepare() {
203 setqtenv 157 setqtenv
204 158
205 if [[ ${QT4_BUILD_TYPE} == live ]]; then 159 if [[ ${QT4_BUILD_TYPE} == live ]]; then
206 QTDIR="." ./bin/syncqt || die "syncqt failed" 160 QTDIR="." ./bin/syncqt || die "syncqt failed"
207 fi 161 fi
208 162
209 # avoid X11 dependency in non-gui packages 163 # avoid X11 dependency in non-gui packages
210 local nolibx11_pkgs="qt-core qt-dbus qt-script qt-sql qt-test qt-xmlpatterns" 164 local nolibx11_pkgs="qtcore qtdbus qtscript qtsql qttest qtxmlpatterns"
211 has ${PN} ${nolibx11_pkgs} && qt_nolibx11 165 has ${PN} ${nolibx11_pkgs} && qt_nolibx11
212 166
213 if use aqua; then 167 if use aqua; then
214 # provide a proper macx-g++-64 168 # provide a proper macx-g++-64
215 use x64-macos && ln -s macx-g++ mkspecs/$(qt_mkspecs_dir) 169 use x64-macos && ln -s macx-g++ mkspecs/$(qt_mkspecs_dir)
217 sed -e '/^CONFIG/s:app_bundle::' \ 171 sed -e '/^CONFIG/s:app_bundle::' \
218 -e '/^CONFIG/s:plugin_no_soname:plugin_with_soname absolute_library_soname:' \ 172 -e '/^CONFIG/s:plugin_no_soname:plugin_with_soname absolute_library_soname:' \
219 -i mkspecs/$(qt_mkspecs_dir)/qmake.conf || die 173 -i mkspecs/$(qt_mkspecs_dir)/qmake.conf || die
220 fi 174 fi
221 175
222 if [[ ${PN} != qt-core ]]; then 176 if [[ ${CATEGORY}/${PN} != dev-qt/qtcore ]]; then
223 skip_qmake_build 177 skip_qmake_build
224 skip_project_generation 178 skip_project_generation
225 symlink_binaries_to_buildtree 179 symlink_binaries_to_buildtree
226 fi 180 fi
227 181
272 -i configure \ 226 -i configure \
273 || die "sed SYSTEM_VARIABLES failed" 227 || die "sed SYSTEM_VARIABLES failed"
274 228
275 # Respect CC, CXX, LINK and *FLAGS in config.tests 229 # Respect CC, CXX, LINK and *FLAGS in config.tests
276 find config.tests/unix -name '*.test' -type f -print0 | xargs -0 \ 230 find config.tests/unix -name '*.test' -type f -print0 | xargs -0 \
277 sed -i -e "/bin\/qmake/ s: \"QT_BUILD_TREE=: \ 231 sed -i -e "/bin\/qmake/ s: \"\$SRCDIR/: \
278 'QMAKE_CC=$(tc-getCC)' 'QMAKE_CXX=$(tc-getCXX)' 'QMAKE_LINK=$(tc-getCXX)' \ 232 'QMAKE_CC=$(tc-getCC)' 'QMAKE_CXX=$(tc-getCXX)' 'QMAKE_LINK=$(tc-getCXX)' \
279 'QMAKE_CFLAGS+=${CFLAGS}' 'QMAKE_CXXFLAGS+=${CXXFLAGS}' 'QMAKE_LFLAGS+=${LDFLAGS}'&:" \ 233 'QMAKE_CFLAGS+=${CFLAGS}' 'QMAKE_CXXFLAGS+=${CXXFLAGS}' 'QMAKE_LFLAGS+=${LDFLAGS}'&:" \
280 || die "sed config.tests failed" 234 || die "sed config.tests failed"
281
282 if ! version_is_at_least 4.8; then
283 # Strip predefined CFLAGS from mkspecs (bugs 312689 and 352778)
284 sed -i -e '/^QMAKE_CFLAGS_RELEASE/s:+=.*:+=:' mkspecs/common/g++.conf || die
285 fi
286 235
287 # Bug 172219 236 # Bug 172219
288 sed -e 's:/X11R6/:/:' -i mkspecs/$(qt_mkspecs_dir)/qmake.conf || die 237 sed -e 's:/X11R6/:/:' -i mkspecs/$(qt_mkspecs_dir)/qmake.conf || die
289 238
290 if [[ ${CHOST} == *-darwin* ]]; then 239 if [[ ${CHOST} == *-darwin* ]]; then
409 conf+=" -no-separate-debug-info" 358 conf+=" -no-separate-debug-info"
410 359
411 # exceptions USE flag 360 # exceptions USE flag
412 conf+=" $(in_iuse exceptions && qt_use exceptions || echo -exceptions)" 361 conf+=" $(in_iuse exceptions && qt_use exceptions || echo -exceptions)"
413 362
414 # disable rpath on Qt >= 4.8 (bug 380415) 363 # disable rpath (bug 380415), except on prefix (bug 417169)
415 # but leave it enabled on prefix (bug 417169) 364 use prefix || conf+=" -no-rpath"
416 version_is_at_least 4.8 && use !prefix && conf+=" -no-rpath"
417 365
418 # precompiled headers don't work on hardened, where the flag is masked 366 # precompiled headers don't work on hardened, where the flag is masked
419 conf+=" $(qt_use pch)" 367 conf+=" $(qt_use pch)"
420 368
421 # -reduce-relocations 369 # -reduce-relocations
434 if use_if_iuse glib; then 382 if use_if_iuse glib; then
435 local glibflags="$(pkg-config --cflags --libs glib-2.0 gthread-2.0)" 383 local glibflags="$(pkg-config --cflags --libs glib-2.0 gthread-2.0)"
436 # avoid the -pthread argument 384 # avoid the -pthread argument
437 conf+=" ${glibflags//-pthread}" 385 conf+=" ${glibflags//-pthread}"
438 unset glibflags 386 unset glibflags
439 fi
440
441 if use_if_iuse qpa; then
442 echo
443 ewarn "The qpa useflag enables the Qt Platform Abstraction, formely"
444 ewarn "known as Qt Lighthouse. If you are not sure what that is, then"
445 ewarn "disable it before reporting any bugs related to this useflag."
446 echo
447 conf+=" -qpa"
448 fi 387 fi
449 388
450 if use aqua; then 389 if use aqua; then
451 # On (snow) leopard use the new (frameworked) cocoa code. 390 # On (snow) leopard use the new (frameworked) cocoa code.
452 if [[ ${CHOST##*-darwin} -ge 9 ]]; then 391 if [[ ${CHOST##*-darwin} -ge 9 ]]; then
490# @FUNCTION: qt4-build_src_test 429# @FUNCTION: qt4-build_src_test
491# @DESCRIPTION: 430# @DESCRIPTION:
492# Runs tests only in target directories. 431# Runs tests only in target directories.
493qt4-build_src_test() { 432qt4-build_src_test() {
494 # QtMultimedia does not have any test suite (bug #332299) 433 # QtMultimedia does not have any test suite (bug #332299)
495 [[ ${PN} == qt-multimedia ]] && return 434 [[ ${CATEGORY}/${PN} == dev-qt/qtmultimedia ]] && return
496 435
497 for dir in ${QT4_TARGET_DIRECTORIES}; do 436 for dir in ${QT4_TARGET_DIRECTORIES}; do
498 emake -j1 check -C ${dir} 437 emake -j1 check -C ${dir}
499 done 438 done
500} 439}
586# @USAGE: < directories > 525# @USAGE: < directories >
587# @INTERNAL 526# @INTERNAL
588# @DESCRIPTION: 527# @DESCRIPTION:
589# Generates Makefiles for the given list of directories. 528# Generates Makefiles for the given list of directories.
590prepare_directories() { 529prepare_directories() {
591 # avoid running over the maximum argument number, bug #299810
592 {
593 echo "${S}"/mkspecs/common/*.conf
594 find "${S}" -name '*.pr[io]'
595 } | xargs sed -i \
596 -e "s:\$\$\[QT_INSTALL_LIBS\]:${QTLIBDIR}:g" \
597 -e "s:\$\$\[QT_INSTALL_PLUGINS\]:${QTPLUGINDIR}:g" \
598 || die
599
600 for x in "$@"; do 530 for x in "$@"; do
601 pushd "${S}"/${x} >/dev/null || die 531 pushd "${S}"/${x} >/dev/null || die
602 einfo "Running qmake in: ${x}" 532 einfo "Running qmake in: ${x}"
603 "${S}"/bin/qmake \ 533 "${S}"/bin/qmake \
604 "LIBS+=-L${QTLIBDIR}" \ 534 "LIBS+=-L${QTLIBDIR}" \
682# @FUNCTION: generate_qconfigs 612# @FUNCTION: generate_qconfigs
683# @INTERNAL 613# @INTERNAL
684# @DESCRIPTION: 614# @DESCRIPTION:
685# Generates gentoo-specific qconfig.{h,pri}. 615# Generates gentoo-specific qconfig.{h,pri}.
686generate_qconfigs() { 616generate_qconfigs() {
687 if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} || -n ${QCONFIG_DEFINE} || ${PN} == qt-core ]]; then 617 if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} || -n ${QCONFIG_DEFINE} || ${CATEGORY}/${PN} == dev-qt/qtcore ]]; then
688 local x qconfig_add qconfig_remove qconfig_new 618 local x qconfig_add qconfig_remove qconfig_new
689 for x in "${ROOT}${QTDATADIR}"/mkspecs/gentoo/*-qconfig.pri; do 619 for x in "${ROOT}${QTDATADIR}"/mkspecs/gentoo/*-qconfig.pri; do
690 [[ -f ${x} ]] || continue 620 [[ -f ${x} ]] || continue
691 qconfig_add+=" $(sed -n 's/^QCONFIG_ADD=//p' "${x}")" 621 qconfig_add+=" $(sed -n 's/^QCONFIG_ADD=//p' "${x}")"
692 qconfig_remove+=" $(sed -n 's/^QCONFIG_REMOVE=//p' "${x}")" 622 qconfig_remove+=" $(sed -n 's/^QCONFIG_REMOVE=//p' "${x}")"
693 done 623 done
694 624
695 # these error checks do not use die because dying in pkg_post{inst,rm} 625 # these error checks do not use die because dying in pkg_post{inst,rm}
696 # just makes things worse. 626 # just makes things worse.
697 if [[ -e "${ROOT}${QTDATADIR}"/mkspecs/gentoo/qconfig.pri ]]; then 627 if [[ -e "${ROOT}${QTDATADIR}"/mkspecs/gentoo/qconfig.pri ]]; then
698 # start with the qconfig.pri that qt-core installed 628 # start with the qconfig.pri that qtcore installed
699 if ! cp "${ROOT}${QTDATADIR}"/mkspecs/gentoo/qconfig.pri \ 629 if ! cp "${ROOT}${QTDATADIR}"/mkspecs/gentoo/qconfig.pri \
700 "${ROOT}${QTDATADIR}"/mkspecs/qconfig.pri; then 630 "${ROOT}${QTDATADIR}"/mkspecs/qconfig.pri; then
701 eerror "cp qconfig failed." 631 eerror "cp qconfig failed."
702 return 1 632 return 1
703 fi 633 fi
755} 685}
756 686
757# @FUNCTION: skip_qmake_build 687# @FUNCTION: skip_qmake_build
758# @INTERNAL 688# @INTERNAL
759# @DESCRIPTION: 689# @DESCRIPTION:
760# Patches configure to skip qmake compilation, as it's already installed by qt-core. 690# Patches configure to skip qmake compilation, as it's already installed by qtcore.
761skip_qmake_build() { 691skip_qmake_build() {
762 sed -i -e "s:if true:if false:g" "${S}"/configure || die 692 sed -i -e "s:if true:if false:g" "${S}"/configure || die
763} 693}
764 694
765# @FUNCTION: skip_project_generation 695# @FUNCTION: skip_project_generation

Legend:
Removed from v.1.139  
changed lines
  Added in v.1.146

  ViewVC Help
Powered by ViewVC 1.1.20