| 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.22 2009/02/14 22:48:26 hwoarang Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/qt4-build.eclass,v 1.33 2009/05/12 14:21:22 hwoarang 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) |
| … | |
… | |
| 46 | fi |
50 | fi |
| 47 | |
51 | |
| 48 | # Check USE requirements |
52 | # Check USE requirements |
| 49 | qt4-build_check_use |
53 | qt4-build_check_use |
| 50 | fi |
54 | fi |
| 51 | |
|
|
| 52 | # Set up installation directories |
55 | # Set up installation directories |
| 53 | QTBASEDIR=/usr/$(get_libdir)/qt4 |
56 | QTBASEDIR=/usr/$(get_libdir)/qt4 |
| 54 | QTPREFIXDIR=/usr |
57 | QTPREFIXDIR=/usr |
| 55 | QTBINDIR=/usr/bin |
58 | QTBINDIR=/usr/bin |
| 56 | QTLIBDIR=/usr/$(get_libdir)/qt4 |
59 | QTLIBDIR=/usr/$(get_libdir)/qt4 |
| … | |
… | |
| 70 | LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}" |
73 | LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}" |
| 71 | |
74 | |
| 72 | if ! version_is_at_least 4.1 $(gcc-version) ; then |
75 | if ! version_is_at_least 4.1 $(gcc-version) ; then |
| 73 | ewarn "Using a GCC version lower than 4.1 is not supported!" |
76 | ewarn "Using a GCC version lower than 4.1 is not supported!" |
| 74 | echo |
77 | echo |
| 75 | ebeep 5 |
78 | ebeep 3 |
| 76 | fi |
79 | fi |
| 77 | |
80 | |
| 78 | if use custom-cxxflags; then |
81 | if use custom-cxxflags; then |
| 79 | echo |
82 | echo |
| 80 | ewarn "You have set USE=custom-cxxflags, which means Qt will be built with the" |
83 | ewarn "You have set USE=custom-cxxflags, which means Qt will be built with the" |
| … | |
… | |
| 86 | fi |
89 | fi |
| 87 | |
90 | |
| 88 | } |
91 | } |
| 89 | |
92 | |
| 90 | qt4-build_src_unpack() { |
93 | qt4-build_src_unpack() { |
| 91 | local target targets |
94 | local target targets licenses |
|
|
95 | if version_is_at_least 4.5 ${PV} ; then |
|
|
96 | licenses="LICENSE.GPL3 LICENSE.LGPL" |
|
|
97 | else |
|
|
98 | licenses="LICENSE.GPL2 LICENSE.GPL3" |
|
|
99 | fi |
| 92 | for target in configure LICENSE.{GPL2,GPL3} projects.pro \ |
100 | for target in configure ${licenses} projects.pro \ |
| 93 | src/{qbase,qt_targets,qt_install}.pri bin config.tests mkspecs qmake \ |
101 | src/{qbase,qt_targets,qt_install}.pri bin config.tests mkspecs qmake \ |
| 94 | ${QT4_EXTRACT_DIRECTORIES}; do |
102 | ${QT4_EXTRACT_DIRECTORIES}; do |
| 95 | targets="${targets} ${MY_P}/${target}" |
103 | targets="${targets} ${MY_P}/${target}" |
| 96 | done |
104 | done |
| 97 | |
105 | |
| … | |
… | |
| 117 | if [[ ${PN} != qt-core ]]; then |
125 | if [[ ${PN} != qt-core ]]; then |
| 118 | skip_qmake_build_patch |
126 | skip_qmake_build_patch |
| 119 | skip_project_generation_patch |
127 | skip_project_generation_patch |
| 120 | symlink_binaries_to_buildtree |
128 | symlink_binaries_to_buildtree |
| 121 | fi |
129 | fi |
| 122 | |
130 | |
| 123 | # Bug 172219 |
|
|
| 124 | if ! use custom-cxxflags;then |
131 | if ! use custom-cxxflags;then |
| 125 | # Don't let the user go too overboard with flags. |
132 | # Don't let the user go too overboard with flags. |
| 126 | strip-flags |
133 | strip-flags |
| 127 | replace-flags -O3 -O2 |
134 | replace-flags -O3 -O2 |
| 128 | fi |
135 | fi |
| 129 | |
136 | |
| 130 | # Bug 253127 |
137 | # Bug 178652 |
|
|
138 | if [[ "$(gcc-major-version)" == "3" ]] && use amd64; then |
|
|
139 | ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS" |
|
|
140 | append-flags -fno-gcse |
|
|
141 | fi |
|
|
142 | |
| 131 | # Unsupported old gcc versions - hardened needs this :( |
143 | # Unsupported old gcc versions - hardened needs this :( |
| 132 | if [[ $(gcc-major-version) -lt "4" ]] ; then |
144 | if [[ $(gcc-major-version) -lt "4" ]] ; then |
| 133 | ewarn "Appending -fno-stack-protector to CXXFLAGS" |
145 | ewarn "Appending -fno-stack-protector to CXXFLAGS" |
| 134 | append-cxxflags -fno-stack-protector |
146 | append-cxxflags -fno-stack-protector |
|
|
147 | # Bug 253127 |
|
|
148 | sed -e "/^QMAKE_CFLAGS\t/ s:$: -fno-stack-protector-all:" \ |
|
|
149 | -i "${S}"/mkspecs/common/g++.conf || die "sed ${S}/mkspecs/common/g++.conf failed" |
| 135 | fi |
150 | fi |
| 136 | |
151 | |
| 137 | # Bug 178652 |
152 | # Bug 172219 |
| 138 | if [[ "$(gcc-major-version)" == "3" ]] && use amd64; then |
|
|
| 139 | ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS" |
|
|
| 140 | append-flags -fno-gcse |
|
|
| 141 | fi |
|
|
| 142 | |
|
|
| 143 | |
|
|
| 144 | sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \ |
153 | sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \ |
| 145 | -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \ |
154 | -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \ |
| 146 | -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \ |
155 | -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \ |
| 147 | -e "s:X11R6/::" \ |
156 | -e "s:X11R6/::" \ |
| 148 | -i "${S}"/mkspecs/$(qt_mkspecs_dir)/qmake.conf || die "sed ${S}/mkspecs/$(qt_mkspecs_dir)/qmake.conf failed" |
157 | -i "${S}"/mkspecs/$(qt_mkspecs_dir)/qmake.conf || die "sed ${S}/mkspecs/$(qt_mkspecs_dir)/qmake.conf failed" |
| … | |
… | |
| 199 | else |
208 | else |
| 200 | myconf="${myconf} -release -no-separate-debug-info" |
209 | myconf="${myconf} -release -no-separate-debug-info" |
| 201 | fi |
210 | fi |
| 202 | |
211 | |
| 203 | # ARCH is set on Gentoo. Qt now falls back to generic on an unsupported |
212 | # ARCH is set on Gentoo. Qt now falls back to generic on an unsupported |
| 204 | # ${ARCH}. Therefore we convert it to supported values. |
213 | # $(tc-arch). Therefore we convert it to supported values. |
| 205 | case "${ARCH}" in |
214 | case "$(tc-arch)" in |
| 206 | amd64) myconf="${myconf} -arch x86_64" ;; |
215 | amd64) myconf="${myconf} -arch x86_64" ;; |
| 207 | ppc|ppc64) myconf="${myconf} -arch powerpc" ;; |
216 | ppc|ppc64) myconf="${myconf} -arch powerpc" ;; |
| 208 | x86|x86-*) myconf="${myconf} -arch i386" ;; |
217 | x86|x86-*) myconf="${myconf} -arch i386" ;; |
| 209 | alpha|arm|ia64|mips|s390|sparc) myconf="${myconf} -arch ${ARCH}" ;; |
218 | alpha|arm|ia64|mips|s390|sparc) myconf="${myconf} -arch $(tc-arch)" ;; |
| 210 | hppa|sh) myconf="${myconf} -arch generic" ;; |
219 | hppa|sh) myconf="${myconf} -arch generic" ;; |
| 211 | *) die "${ARCH} is unsupported by this eclass. Please file a bug." ;; |
220 | *) die "$(tc-arch) is unsupported by this eclass. Please file a bug." ;; |
|
|
221 | esac |
|
|
222 | |
|
|
223 | # Bug 261412 Qt configure detects archs by uname |
|
|
224 | case "$(tc-arch)" in |
|
|
225 | ppc) myconf="${myconf} -platform linux-g++-32";; |
| 212 | esac |
226 | esac |
| 213 | |
227 | |
| 214 | myconf="${myconf} -stl -verbose -largefile -confirm-license -no-rpath |
228 | myconf="${myconf} -stl -verbose -largefile -confirm-license -no-rpath |
| 215 | -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} |
229 | -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} |
| 216 | -datadir ${QTDATADIR} -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} |
230 | -datadir ${QTDATADIR} -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} |
| 217 | -plugindir ${QTPLUGINDIR} -sysconfdir ${QTSYSCONFDIR} |
231 | -plugindir ${QTPLUGINDIR} -sysconfdir ${QTSYSCONFDIR} |
| 218 | -translationdir ${QTTRANSDIR} -examplesdir ${QTEXAMPLESDIR} |
232 | -translationdir ${QTTRANSDIR} -examplesdir ${QTEXAMPLESDIR} |
| 219 | -demosdir ${QTDEMOSDIR} -silent -fast |
233 | -demosdir ${QTDEMOSDIR} -silent -fast |
| 220 | $([[ ${PN} == qt-xmlpatterns ]] || echo -no-exceptions) |
234 | $([[ ${PN} == qt-xmlpatterns ]] || echo -no-exceptions) |
| 221 | $(use x86-fbsd || echo -reduce-relocations) |
|
|
| 222 | -nomake examples -nomake demos" |
235 | -reduce-relocations -nomake examples -nomake demos" |
|
|
236 | |
|
|
237 | # Make eclass 4.5.{1,2} ready |
|
|
238 | case "${MY_PV}" in |
|
|
239 | 4.5.1 | 4.5.2) |
|
|
240 | myconf="${myconf} -opensource" |
|
|
241 | ;; |
|
|
242 | esac |
| 223 | |
243 | |
| 224 | echo "${myconf}" |
244 | echo "${myconf}" |
| 225 | } |
245 | } |
| 226 | |
246 | |
| 227 | build_directories() { |
247 | build_directories() { |