| 1 | # Copyright 2007-2009 Gentoo Foundation |
1 | # Copyright 2007-2009 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.24 2009/02/15 00:11:50 hwoarang Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/qt4-build.eclass,v 1.31 2009/03/28 02:29:24 gengor 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>, |
| 9 | # Caleb Tennis <caleb@gentoo.org> |
9 | # Caleb Tennis <caleb@gentoo.org> |
| 10 | # @BLURB: Eclass for Qt4 split ebuilds. |
10 | # @BLURB: Eclass for Qt4 split ebuilds. |
| 11 | # @DESCRIPTION: |
11 | # @DESCRIPTION: |
| 12 | # This eclass contains various functions that are used when building Qt4 |
12 | # This eclass contains various functions that are used when building Qt4 |
| 13 | |
13 | |
| … | |
… | |
| 27 | esac |
27 | esac |
| 28 | MY_P=qt-x11-${SRCTYPE}-${MY_PV} |
28 | MY_P=qt-x11-${SRCTYPE}-${MY_PV} |
| 29 | S=${WORKDIR}/${MY_P} |
29 | S=${WORKDIR}/${MY_P} |
| 30 | |
30 | |
| 31 | HOMEPAGE="http://www.qtsoftware.com/" |
31 | HOMEPAGE="http://www.qtsoftware.com/" |
| 32 | SRC_URI="ftp://ftp.trolltech.com/qt/source/${MY_P}.tar.bz2" |
32 | SRC_URI="http://download.qtsoftware.com/qt/source/${MY_P}.tar.bz2" |
| 33 | |
33 | |
| 34 | case "${PV}" in |
34 | case "${PV}" in |
| 35 | 4.4.?) SRC_URI="${SRC_URI} mirror://gentoo/${MY_P}-headers.tar.bz2" ;; |
35 | 4.4.?) SRC_URI="${SRC_URI} mirror://gentoo/${MY_P}-headers.tar.bz2" ;; |
| 36 | *) ;; |
36 | *) ;; |
| 37 | esac |
37 | esac |
|
|
38 | |
|
|
39 | if version_is_at_least 4.5 ${PV} ; then |
|
|
40 | LICENSE="|| ( LGPL-2.1 GPL-3 )" |
|
|
41 | fi |
| 38 | |
42 | |
| 39 | qt4-build_pkg_setup() { |
43 | qt4-build_pkg_setup() { |
| 40 | # EAPI=2 ebuilds set use-deps, others need this: |
44 | # EAPI=2 ebuilds set use-deps, others need this: |
| 41 | if [[ $EAPI != 2 ]]; then |
45 | if [[ $EAPI != 2 ]]; then |
| 42 | # Make sure debug setting corresponds with qt-core (bug 258512) |
46 | # Make sure debug setting corresponds with qt-core (bug 258512) |
| … | |
… | |
| 70 | LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}" |
74 | LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}" |
| 71 | |
75 | |
| 72 | if ! version_is_at_least 4.1 $(gcc-version) ; then |
76 | if ! version_is_at_least 4.1 $(gcc-version) ; then |
| 73 | ewarn "Using a GCC version lower than 4.1 is not supported!" |
77 | ewarn "Using a GCC version lower than 4.1 is not supported!" |
| 74 | echo |
78 | echo |
| 75 | ebeep 5 |
79 | ebeep 3 |
| 76 | fi |
80 | fi |
| 77 | |
81 | |
| 78 | if use custom-cxxflags; then |
82 | if use custom-cxxflags; then |
| 79 | echo |
83 | echo |
| 80 | ewarn "You have set USE=custom-cxxflags, which means Qt will be built with the" |
84 | ewarn "You have set USE=custom-cxxflags, which means Qt will be built with the" |
| … | |
… | |
| 86 | fi |
90 | fi |
| 87 | |
91 | |
| 88 | } |
92 | } |
| 89 | |
93 | |
| 90 | qt4-build_src_unpack() { |
94 | qt4-build_src_unpack() { |
| 91 | local target targets |
95 | local target targets licenses |
|
|
96 | if version_is_at_least 4.5 ${PV} ; then |
|
|
97 | licenses="LICENSE.GPL3 LICENSE.LGPL" |
|
|
98 | else |
|
|
99 | licenses="LICENSE.GPL2 LICENSE.GPL3" |
|
|
100 | fi |
| 92 | for target in configure LICENSE.{GPL2,GPL3} projects.pro \ |
101 | for target in configure ${licenses} projects.pro \ |
| 93 | src/{qbase,qt_targets,qt_install}.pri bin config.tests mkspecs qmake \ |
102 | src/{qbase,qt_targets,qt_install}.pri bin config.tests mkspecs qmake \ |
| 94 | ${QT4_EXTRACT_DIRECTORIES}; do |
103 | ${QT4_EXTRACT_DIRECTORIES}; do |
| 95 | targets="${targets} ${MY_P}/${target}" |
104 | targets="${targets} ${MY_P}/${target}" |
| 96 | done |
105 | done |
| 97 | |
106 | |
| … | |
… | |
| 124 | # Don't let the user go too overboard with flags. |
133 | # Don't let the user go too overboard with flags. |
| 125 | strip-flags |
134 | strip-flags |
| 126 | replace-flags -O3 -O2 |
135 | replace-flags -O3 -O2 |
| 127 | fi |
136 | fi |
| 128 | |
137 | |
| 129 | # Bug 253127 |
138 | # Bug 178652 |
|
|
139 | if [[ "$(gcc-major-version)" == "3" ]] && use amd64; then |
|
|
140 | ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS" |
|
|
141 | append-flags -fno-gcse |
|
|
142 | fi |
|
|
143 | |
| 130 | # Unsupported old gcc versions - hardened needs this :( |
144 | # Unsupported old gcc versions - hardened needs this :( |
| 131 | if [[ $(gcc-major-version) -lt "4" ]] ; then |
145 | if [[ $(gcc-major-version) -lt "4" ]] ; then |
| 132 | ewarn "Appending -fno-stack-protector to CXXFLAGS" |
146 | ewarn "Appending -fno-stack-protector to CXXFLAGS" |
| 133 | append-cxxflags -fno-stack-protector |
147 | append-cxxflags -fno-stack-protector |
| 134 | fi |
148 | # Bug 253127 |
| 135 | |
149 | sed -e "/^QMAKE_CFLAGS\t/ s:$: -fno-stack-protector-all:" \ |
| 136 | # Bug 178652 |
150 | -i "${S}"/mkspecs/common/g++.conf || die "sed ${S}/mkspecs/common/g++.conf failed" |
| 137 | if [[ "$(gcc-major-version)" == "3" ]] && use amd64; then |
|
|
| 138 | ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS" |
|
|
| 139 | append-flags -fno-gcse |
|
|
| 140 | fi |
151 | fi |
| 141 | |
152 | |
| 142 | # Bug 172219 |
153 | # Bug 172219 |
| 143 | sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \ |
154 | sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \ |
| 144 | -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \ |
155 | -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \ |
| … | |
… | |
| 198 | else |
209 | else |
| 199 | myconf="${myconf} -release -no-separate-debug-info" |
210 | myconf="${myconf} -release -no-separate-debug-info" |
| 200 | fi |
211 | fi |
| 201 | |
212 | |
| 202 | # ARCH is set on Gentoo. Qt now falls back to generic on an unsupported |
213 | # ARCH is set on Gentoo. Qt now falls back to generic on an unsupported |
| 203 | # ${ARCH}. Therefore we convert it to supported values. |
214 | # $(tc-arch). Therefore we convert it to supported values. |
| 204 | case "${ARCH}" in |
215 | case "$(tc-arch)" in |
| 205 | amd64) myconf="${myconf} -arch x86_64" ;; |
216 | amd64) myconf="${myconf} -arch x86_64" ;; |
| 206 | ppc|ppc64) myconf="${myconf} -arch powerpc" ;; |
217 | ppc|ppc64) myconf="${myconf} -arch powerpc" ;; |
| 207 | x86|x86-*) myconf="${myconf} -arch i386" ;; |
218 | x86|x86-*) myconf="${myconf} -arch i386" ;; |
| 208 | alpha|arm|ia64|mips|s390|sparc) myconf="${myconf} -arch ${ARCH}" ;; |
219 | alpha|arm|ia64|mips|s390|sparc) myconf="${myconf} -arch $(tc-arch)" ;; |
| 209 | hppa|sh) myconf="${myconf} -arch generic" ;; |
220 | hppa|sh) myconf="${myconf} -arch generic" ;; |
| 210 | *) die "${ARCH} is unsupported by this eclass. Please file a bug." ;; |
221 | *) die "$(tc-arch) is unsupported by this eclass. Please file a bug." ;; |
| 211 | esac |
222 | esac |
| 212 | |
223 | |
| 213 | myconf="${myconf} -stl -verbose -largefile -confirm-license -no-rpath |
224 | myconf="${myconf} -stl -verbose -largefile -confirm-license -no-rpath |
| 214 | -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} |
225 | -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} |
| 215 | -datadir ${QTDATADIR} -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} |
226 | -datadir ${QTDATADIR} -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} |
| 216 | -plugindir ${QTPLUGINDIR} -sysconfdir ${QTSYSCONFDIR} |
227 | -plugindir ${QTPLUGINDIR} -sysconfdir ${QTSYSCONFDIR} |
| 217 | -translationdir ${QTTRANSDIR} -examplesdir ${QTEXAMPLESDIR} |
228 | -translationdir ${QTTRANSDIR} -examplesdir ${QTEXAMPLESDIR} |
| 218 | -demosdir ${QTDEMOSDIR} -silent -fast |
229 | -demosdir ${QTDEMOSDIR} -silent -fast |
| 219 | $([[ ${PN} == qt-xmlpatterns ]] || echo -no-exceptions) |
230 | $([[ ${PN} == qt-xmlpatterns ]] || echo -no-exceptions) |
| 220 | $(use x86-fbsd || echo -reduce-relocations) |
|
|
| 221 | -nomake examples -nomake demos" |
231 | -reduce-relocations -nomake examples -nomake demos" |
| 222 | |
232 | |
| 223 | echo "${myconf}" |
233 | echo "${myconf}" |
| 224 | } |
234 | } |
| 225 | |
235 | |
| 226 | build_directories() { |
236 | build_directories() { |