/[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.146 Revision 1.155
1# Copyright 1999-2013 Gentoo Foundation 1# Copyright 1999-2014 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.146 2013/04/28 16:15:33 zmedico Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/qt4-build.eclass,v 1.155 2014/08/29 23:56:18 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.
9# @DESCRIPTION: 9# @DESCRIPTION:
10# This eclass contains various functions that are used when building Qt4. 10# This eclass contains various functions that are used when building Qt4.
11 11
12case ${EAPI} in 12case ${EAPI} in
13 3|4|5) : ;; 13 4|5) : ;;
14 *) die "qt4-build.eclass: unsupported EAPI=${EAPI:-0}" ;; 14 *) die "qt4-build.eclass: unsupported EAPI=${EAPI:-0}" ;;
15esac 15esac
16 16
17inherit eutils flag-o-matic multilib toolchain-funcs versionator 17inherit eutils flag-o-matic multilib toolchain-funcs versionator
18 18
19if [[ ${PV} == *9999* ]]; then 19if [[ ${PV} == *9999* ]]; then
20 QT4_BUILD_TYPE="live" 20 QT4_BUILD_TYPE="live"
21 inherit git-2 21 inherit git-r3
22else 22else
23 QT4_BUILD_TYPE="release" 23 QT4_BUILD_TYPE="release"
24fi 24fi
25 25
26HOMEPAGE="http://qt-project.org/ http://qt.digia.com/" 26HOMEPAGE="http://qt-project.org/ http://qt.digia.com/"
27LICENSE="|| ( LGPL-2.1 GPL-3 )" 27LICENSE="|| ( LGPL-2.1 GPL-3 )"
28 28
29MY_PV=${PV/_/-}
30MY_P=qt-everywhere-opensource-src-${MY_PV}
31
32case ${QT4_BUILD_TYPE} in 29case ${QT4_BUILD_TYPE} in
33 live) 30 live)
31 EGIT_REPO_URI=(
34 EGIT_REPO_URI="git://gitorious.org/qt/qt.git 32 "git://gitorious.org/qt/qt.git"
35 https://git.gitorious.org/qt/qt.git" 33 "https://git.gitorious.org/qt/qt.git"
34 )
36 EGIT_BRANCH=${PV%.9999} 35 EGIT_BRANCH=${PV%.9999}
37 ;; 36 ;;
38 release) 37 release)
39 SRC_URI="http://releases.qt-project.org/qt4/source/${MY_P}.tar.gz" 38 MY_P=qt-everywhere-opensource-src-${PV/_/-}
39 SRC_URI="http://download.qt-project.org/official_releases/qt/${PV%.*}/${PV}/${MY_P}.tar.gz"
40 S=${WORKDIR}/${MY_P}
40 ;; 41 ;;
41esac 42esac
42 43
43IUSE="aqua debug pch" 44IUSE="aqua debug pch"
45if ! version_is_at_least 4.8.5; then
44[[ ${CATEGORY}/${PN} != dev-qt/qtwebkit ]] && IUSE+=" c++0x" 46 [[ ${CATEGORY}/${PN} != dev-qt/qtwebkit ]] && IUSE+=" c++0x"
47fi
45[[ ${CATEGORY}/${PN} != dev-qt/qtxmlpatterns ]] && IUSE+=" +exceptions" 48[[ ${CATEGORY}/${PN} != dev-qt/qtxmlpatterns ]] && IUSE+=" +exceptions"
46 49
47DEPEND="virtual/pkgconfig" 50DEPEND="virtual/pkgconfig"
48if [[ ${QT4_BUILD_TYPE} == live ]]; then 51if [[ ${QT4_BUILD_TYPE} == live ]]; then
49 DEPEND+=" dev-lang/perl" 52 DEPEND+=" dev-lang/perl"
50fi 53fi
51 54
52S=${WORKDIR}/${MY_P}
53
54# @FUNCTION: qt4-build_pkg_setup 55# @FUNCTION: qt4-build_pkg_setup
55# @DESCRIPTION: 56# @DESCRIPTION:
56# Sets up PATH and LD_LIBRARY_PATH. 57# Sets up PATH and LD_LIBRARY_PATH.
57qt4-build_pkg_setup() { 58qt4-build_pkg_setup() {
58 # Protect users by not allowing downgrades between releases. 59 # Warn users of possible breakage when downgrading to a previous release.
59 # Downgrading revisions within the same release should be allowed. 60 # Downgrading revisions within the same release is safe.
60 if has_version ">${CATEGORY}/${P}-r9999:4"; then 61 if has_version ">${CATEGORY}/${P}-r9999:4"; then
61 if [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]]; then 62 ewarn
62 eerror " *** Sanity check to keep you from breaking your system ***"
63 eerror "Downgrading Qt is completely unsupported and will break your system!"
64 die "aborting to save your system"
65 else
66 ewarn "Downgrading Qt is completely unsupported and will break your system!" 63 ewarn "Downgrading Qt is completely unsupported and can break your system!"
67 fi 64 ewarn
68 fi 65 fi
69 66
70 PATH="${S}/bin${PATH:+:}${PATH}" 67 PATH="${S}/bin${PATH:+:}${PATH}"
71 if [[ ${CHOST} != *-darwin* ]]; then 68 if [[ ${CHOST} != *-darwin* ]]; then
72 LD_LIBRARY_PATH="${S}/lib${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}" 69 LD_LIBRARY_PATH="${S}/lib${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}"
97# @DESCRIPTION: 94# @DESCRIPTION:
98# Unpacks the sources. 95# Unpacks the sources.
99qt4-build_src_unpack() { 96qt4-build_src_unpack() {
100 setqtenv 97 setqtenv
101 98
102 if ! version_is_at_least 4.1 $(gcc-version); then 99 if ! version_is_at_least 4.4 $(gcc-version); then
100 ewarn
103 ewarn "Using a GCC version lower than 4.1 is not supported." 101 ewarn "Using a GCC version lower than 4.4 is not supported."
102 ewarn
104 fi 103 fi
105 104
106 if [[ ${CATEGORY}/${PN} == dev-qt/qtwebkit ]]; then 105 if [[ ${CATEGORY}/${PN} == dev-qt/qtwebkit ]]; then
107 eshopts_push -s extglob 106 eshopts_push -s extglob
108 if is-flagq '-g?(gdb)?([1-9])'; then 107 if is-flagq '-g?(gdb)?([1-9])'; then
109 echo 108 ewarn
110 ewarn "You have enabled debug info (probably have -g or -ggdb in your CFLAGS/CXXFLAGS)." 109 ewarn "You have enabled debug info (probably have -g or -ggdb in your CFLAGS/CXXFLAGS)."
111 ewarn "You may experience really long compilation times and/or increased memory usage." 110 ewarn "You may experience really long compilation times and/or increased memory usage."
112 ewarn "If compilation fails, please try removing -g/-ggdb before reporting a bug." 111 ewarn "If compilation fails, please try removing -g/-ggdb before reporting a bug."
113 ewarn "For more info check out https://bugs.gentoo.org/307861" 112 ewarn "For more info check out https://bugs.gentoo.org/307861"
114 echo 113 ewarn
115 fi 114 fi
116 eshopts_pop 115 eshopts_pop
117 fi 116 fi
118 117
119 case ${QT4_BUILD_TYPE} in 118 case ${QT4_BUILD_TYPE} in
120 live) 119 live)
121 git-2_src_unpack 120 git-r3_src_unpack
122 ;; 121 ;;
123 release) 122 release)
124 local tarball="${MY_P}.tar.gz" target= targets= 123 local tarball="${MY_P}.tar.gz" target= targets=
125 for target in configure LICENSE.GPL3 LICENSE.LGPL projects.pro \ 124 for target in configure LICENSE.GPL3 LICENSE.LGPL projects.pro \
126 src/{qbase,qt_targets,qt_install}.pri bin config.tests \ 125 src/{qbase,qt_targets,qt_install}.pri bin config.tests \
159 if [[ ${QT4_BUILD_TYPE} == live ]]; then 158 if [[ ${QT4_BUILD_TYPE} == live ]]; then
160 QTDIR="." ./bin/syncqt || die "syncqt failed" 159 QTDIR="." ./bin/syncqt || die "syncqt failed"
161 fi 160 fi
162 161
163 # avoid X11 dependency in non-gui packages 162 # avoid X11 dependency in non-gui packages
164 local nolibx11_pkgs="qtcore qtdbus qtscript qtsql qttest qtxmlpatterns" 163 local nolibx11_pkgs="qtbearer qtcore qtdbus qtscript qtsql qttest qtxmlpatterns"
165 has ${PN} ${nolibx11_pkgs} && qt_nolibx11 164 has ${PN} ${nolibx11_pkgs} && qt_nolibx11
166 165
167 if use aqua; then 166 if use aqua; then
168 # provide a proper macx-g++-64 167 # provide a proper macx-g++-64
169 use x64-macos && ln -s macx-g++ mkspecs/$(qt_mkspecs_dir) 168 use x64-macos && ln -s macx-g++ mkspecs/$(qt_mkspecs_dir)
177 skip_qmake_build 176 skip_qmake_build
178 skip_project_generation 177 skip_project_generation
179 symlink_binaries_to_buildtree 178 symlink_binaries_to_buildtree
180 fi 179 fi
181 180
182 if [[ ${CHOST} == *86*-apple-darwin* ]]; then
183 # qmake bus errors with -O2 or -O3 but -O1 works
184 # Bug 373061
185 replace-flags -O[23] -O1
186 fi
187
188 # Bug 178652
189 if [[ $(gcc-major-version) == 3 ]] && use amd64; then
190 ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS"
191 append-flags -fno-gcse
192 fi
193
194 if use_if_iuse c++0x; then 181 if use_if_iuse c++0x; then
195 append-cxxflags -std=c++0x 182 append-cxxflags -std=c++0x
196 fi 183 fi
197 184
198 # Unsupported old gcc versions - hardened needs this :(
199 if [[ $(gcc-major-version) -lt 4 ]]; then
200 ewarn "Appending -fno-stack-protector to CXXFLAGS"
201 append-cxxflags -fno-stack-protector
202 # Bug 253127
203 sed -e "/^QMAKE_CFLAGS\t/ s:$: -fno-stack-protector-all:" \
204 -i mkspecs/common/g++.conf || die
205 fi
206
207 # Bug 261632 185 # Bug 261632
208 if use ppc64; then 186 if use ppc64; then
209 ewarn "Appending -mminimal-toc to CFLAGS/CXXFLAGS"
210 append-flags -mminimal-toc 187 append-flags -mminimal-toc
188 fi
189
190 # Bug 373061
191 # qmake bus errors with -O2 or -O3 but -O1 works
192 if [[ ${CHOST} == *86*-apple-darwin* ]]; then
193 replace-flags -O[23] -O1
194 fi
195
196 # Bug 417105
197 # graphite on gcc 4.7 causes miscompilations
198 if [[ $(gcc-version) == "4.7" ]]; then
199 filter-flags -fgraphite-identity
211 fi 200 fi
212 201
213 # Respect CC, CXX, {C,CXX,LD}FLAGS in .qmake.cache 202 # Respect CC, CXX, {C,CXX,LD}FLAGS in .qmake.cache
214 sed -e "/^SYSTEM_VARIABLES=/i \ 203 sed -e "/^SYSTEM_VARIABLES=/i \
215 CC='$(tc-getCC)'\n\ 204 CC='$(tc-getCC)'\n\
550 AR="$(tc-getAR) cqs" \ 539 AR="$(tc-getAR) cqs" \
551 CC="$(tc-getCC)" \ 540 CC="$(tc-getCC)" \
552 CXX="$(tc-getCXX)" \ 541 CXX="$(tc-getCXX)" \
553 LINK="$(tc-getCXX)" \ 542 LINK="$(tc-getCXX)" \
554 RANLIB=":" \ 543 RANLIB=":" \
555 STRIP=":" \ 544 STRIP=":"
556 || die "emake failed"
557 popd >/dev/null || die 545 popd >/dev/null || die
558 done 546 done
559} 547}
560 548
561# @FUNCTION: install_directories 549# @FUNCTION: install_directories
564# @DESCRIPTION: 552# @DESCRIPTION:
565# Runs emake install in the given directories, which are separated by spaces. 553# Runs emake install in the given directories, which are separated by spaces.
566install_directories() { 554install_directories() {
567 for x in "$@"; do 555 for x in "$@"; do
568 pushd "${S}"/${x} >/dev/null || die 556 pushd "${S}"/${x} >/dev/null || die
569 emake INSTALL_ROOT="${D}" install || die "emake install failed" 557 emake INSTALL_ROOT="${D}" install
570 popd >/dev/null || die 558 popd >/dev/null || die
571 done 559 done
572} 560}
573 561
574# @ECLASS-VARIABLE: QCONFIG_ADD 562# @ECLASS-VARIABLE: QCONFIG_ADD
595 if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} ]]; then 583 if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} ]]; then
596 for x in QCONFIG_ADD QCONFIG_REMOVE; do 584 for x in QCONFIG_ADD QCONFIG_REMOVE; do
597 [[ -n ${!x} ]] && echo ${x}=${!x} >> "${T}"/${PN}-qconfig.pri 585 [[ -n ${!x} ]] && echo ${x}=${!x} >> "${T}"/${PN}-qconfig.pri
598 done 586 done
599 insinto ${QTDATADIR#${EPREFIX}}/mkspecs/gentoo 587 insinto ${QTDATADIR#${EPREFIX}}/mkspecs/gentoo
600 doins "${T}"/${PN}-qconfig.pri || die "installing ${PN}-qconfig.pri failed" 588 doins "${T}"/${PN}-qconfig.pri
601 fi 589 fi
602 590
603 if [[ -n ${QCONFIG_DEFINE} ]]; then 591 if [[ -n ${QCONFIG_DEFINE} ]]; then
604 for x in ${QCONFIG_DEFINE}; do 592 for x in ${QCONFIG_DEFINE}; do
605 echo "#define ${x}" >> "${T}"/gentoo-${PN}-qconfig.h 593 echo "#define ${x}" >> "${T}"/gentoo-${PN}-qconfig.h
606 done 594 done
607 insinto ${QTHEADERDIR#${EPREFIX}}/Gentoo 595 insinto ${QTHEADERDIR#${EPREFIX}}/Gentoo
608 doins "${T}"/gentoo-${PN}-qconfig.h || die "installing ${PN}-qconfig.h failed" 596 doins "${T}"/gentoo-${PN}-qconfig.h
609 fi 597 fi
610} 598}
611 599
612# @FUNCTION: generate_qconfigs 600# @FUNCTION: generate_qconfigs
613# @INTERNAL 601# @INTERNAL
803} 791}
804 792
805# @FUNCTION: qt_nolibx11 793# @FUNCTION: qt_nolibx11
806# @INTERNAL 794# @INTERNAL
807# @DESCRIPTION: 795# @DESCRIPTION:
808# Ignore X11 tests for packages that don't need X libraries installed. 796# Skip X11 tests for packages that don't need X libraries installed.
809qt_nolibx11() { 797qt_nolibx11() {
810 sed -i "/unixtests\/compile.test.*config.tests\/x11\/xlib/,/fi$/d" "${S}"/configure || 798 sed -i -e '/^if.*PLATFORM_X11.*CFG_GUI/,/^fi$/d' "${S}"/configure || die
811 die "x11 check sed failed"
812} 799}
813 800
814EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_install src_test pkg_postrm pkg_postinst 801EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_install src_test pkg_postrm pkg_postinst

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

  ViewVC Help
Powered by ViewVC 1.1.20