| 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.26 2009/03/05 09:25:01 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>, |
| … | |
… | |
| 50 | fi |
50 | fi |
| 51 | |
51 | |
| 52 | # Check USE requirements |
52 | # Check USE requirements |
| 53 | qt4-build_check_use |
53 | qt4-build_check_use |
| 54 | fi |
54 | fi |
| 55 | |
|
|
| 56 | # Set up installation directories |
55 | # Set up installation directories |
| 57 | QTBASEDIR=/usr/$(get_libdir)/qt4 |
56 | QTBASEDIR=/usr/$(get_libdir)/qt4 |
| 58 | QTPREFIXDIR=/usr |
57 | QTPREFIXDIR=/usr |
| 59 | QTBINDIR=/usr/bin |
58 | QTBINDIR=/usr/bin |
| 60 | QTLIBDIR=/usr/$(get_libdir)/qt4 |
59 | QTLIBDIR=/usr/$(get_libdir)/qt4 |
| … | |
… | |
| 74 | LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}" |
73 | LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}" |
| 75 | |
74 | |
| 76 | if ! version_is_at_least 4.1 $(gcc-version) ; then |
75 | if ! version_is_at_least 4.1 $(gcc-version) ; then |
| 77 | 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!" |
| 78 | echo |
77 | echo |
| 79 | ebeep 5 |
78 | ebeep 3 |
| 80 | fi |
79 | fi |
| 81 | |
80 | |
| 82 | if use custom-cxxflags; then |
81 | if use custom-cxxflags; then |
| 83 | echo |
82 | echo |
| 84 | 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" |
| … | |
… | |
| 133 | # Don't let the user go too overboard with flags. |
132 | # Don't let the user go too overboard with flags. |
| 134 | strip-flags |
133 | strip-flags |
| 135 | replace-flags -O3 -O2 |
134 | replace-flags -O3 -O2 |
| 136 | fi |
135 | fi |
| 137 | |
136 | |
| 138 | # 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 | |
| 139 | # Unsupported old gcc versions - hardened needs this :( |
143 | # Unsupported old gcc versions - hardened needs this :( |
| 140 | if [[ $(gcc-major-version) -lt "4" ]] ; then |
144 | if [[ $(gcc-major-version) -lt "4" ]] ; then |
| 141 | ewarn "Appending -fno-stack-protector to CXXFLAGS" |
145 | ewarn "Appending -fno-stack-protector to CXXFLAGS" |
| 142 | append-cxxflags -fno-stack-protector |
146 | append-cxxflags -fno-stack-protector |
| 143 | fi |
147 | # Bug 253127 |
| 144 | |
148 | sed -e "/^QMAKE_CFLAGS\t/ s:$: -fno-stack-protector-all:" \ |
| 145 | # Bug 178652 |
149 | -i "${S}"/mkspecs/common/g++.conf || die "sed ${S}/mkspecs/common/g++.conf failed" |
| 146 | if [[ "$(gcc-major-version)" == "3" ]] && use amd64; then |
|
|
| 147 | ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS" |
|
|
| 148 | append-flags -fno-gcse |
|
|
| 149 | fi |
150 | fi |
| 150 | |
151 | |
| 151 | # Bug 172219 |
152 | # Bug 172219 |
| 152 | sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \ |
153 | sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \ |
| 153 | -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \ |
154 | -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \ |
| … | |
… | |
| 207 | else |
208 | else |
| 208 | myconf="${myconf} -release -no-separate-debug-info" |
209 | myconf="${myconf} -release -no-separate-debug-info" |
| 209 | fi |
210 | fi |
| 210 | |
211 | |
| 211 | # 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 |
| 212 | # ${ARCH}. Therefore we convert it to supported values. |
213 | # $(tc-arch). Therefore we convert it to supported values. |
| 213 | case "${ARCH}" in |
214 | case "$(tc-arch)" in |
| 214 | amd64) myconf="${myconf} -arch x86_64" ;; |
215 | amd64) myconf="${myconf} -arch x86_64" ;; |
| 215 | ppc|ppc64) myconf="${myconf} -arch powerpc" ;; |
216 | ppc|ppc64) myconf="${myconf} -arch powerpc" ;; |
| 216 | x86|x86-*) myconf="${myconf} -arch i386" ;; |
217 | x86|x86-*) myconf="${myconf} -arch i386" ;; |
| 217 | alpha|arm|ia64|mips|s390|sparc) myconf="${myconf} -arch ${ARCH}" ;; |
218 | alpha|arm|ia64|mips|s390|sparc) myconf="${myconf} -arch $(tc-arch)" ;; |
| 218 | hppa|sh) myconf="${myconf} -arch generic" ;; |
219 | hppa|sh) myconf="${myconf} -arch generic" ;; |
| 219 | *) 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";; |
| 220 | esac |
226 | esac |
| 221 | |
227 | |
| 222 | myconf="${myconf} -stl -verbose -largefile -confirm-license -no-rpath |
228 | myconf="${myconf} -stl -verbose -largefile -confirm-license -no-rpath |
| 223 | -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} |
229 | -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} |
| 224 | -datadir ${QTDATADIR} -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} |
230 | -datadir ${QTDATADIR} -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} |
| 225 | -plugindir ${QTPLUGINDIR} -sysconfdir ${QTSYSCONFDIR} |
231 | -plugindir ${QTPLUGINDIR} -sysconfdir ${QTSYSCONFDIR} |
| 226 | -translationdir ${QTTRANSDIR} -examplesdir ${QTEXAMPLESDIR} |
232 | -translationdir ${QTTRANSDIR} -examplesdir ${QTEXAMPLESDIR} |
| 227 | -demosdir ${QTDEMOSDIR} -silent -fast |
233 | -demosdir ${QTDEMOSDIR} -silent -fast |
| 228 | $([[ ${PN} == qt-xmlpatterns ]] || echo -no-exceptions) |
234 | $([[ ${PN} == qt-xmlpatterns ]] || echo -no-exceptions) |
| 229 | $(use x86-fbsd || echo -reduce-relocations) |
|
|
| 230 | -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 |
| 231 | |
243 | |
| 232 | echo "${myconf}" |
244 | echo "${myconf}" |
| 233 | } |
245 | } |
| 234 | |
246 | |
| 235 | build_directories() { |
247 | build_directories() { |