| 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.25 2009/03/04 20:37:08 yngwin 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>, |
| … | |
… | |
| 74 | LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}" |
74 | LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}" |
| 75 | |
75 | |
| 76 | if ! version_is_at_least 4.1 $(gcc-version) ; then |
76 | if ! version_is_at_least 4.1 $(gcc-version) ; then |
| 77 | 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!" |
| 78 | echo |
78 | echo |
| 79 | ebeep 5 |
79 | ebeep 3 |
| 80 | fi |
80 | fi |
| 81 | |
81 | |
| 82 | if use custom-cxxflags; then |
82 | if use custom-cxxflags; then |
| 83 | echo |
83 | echo |
| 84 | 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" |
| … | |
… | |
| 90 | fi |
90 | fi |
| 91 | |
91 | |
| 92 | } |
92 | } |
| 93 | |
93 | |
| 94 | qt4-build_src_unpack() { |
94 | qt4-build_src_unpack() { |
| 95 | 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 |
| 96 | for target in configure LICENSE.{GPL2,GPL3} projects.pro \ |
101 | for target in configure ${licenses} projects.pro \ |
| 97 | 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 \ |
| 98 | ${QT4_EXTRACT_DIRECTORIES}; do |
103 | ${QT4_EXTRACT_DIRECTORIES}; do |
| 99 | targets="${targets} ${MY_P}/${target}" |
104 | targets="${targets} ${MY_P}/${target}" |
| 100 | done |
105 | done |
| 101 | |
106 | |
| … | |
… | |
| 128 | # Don't let the user go too overboard with flags. |
133 | # Don't let the user go too overboard with flags. |
| 129 | strip-flags |
134 | strip-flags |
| 130 | replace-flags -O3 -O2 |
135 | replace-flags -O3 -O2 |
| 131 | fi |
136 | fi |
| 132 | |
137 | |
| 133 | # 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 | |
| 134 | # Unsupported old gcc versions - hardened needs this :( |
144 | # Unsupported old gcc versions - hardened needs this :( |
| 135 | if [[ $(gcc-major-version) -lt "4" ]] ; then |
145 | if [[ $(gcc-major-version) -lt "4" ]] ; then |
| 136 | ewarn "Appending -fno-stack-protector to CXXFLAGS" |
146 | ewarn "Appending -fno-stack-protector to CXXFLAGS" |
| 137 | append-cxxflags -fno-stack-protector |
147 | append-cxxflags -fno-stack-protector |
| 138 | fi |
148 | # Bug 253127 |
| 139 | |
149 | sed -e "/^QMAKE_CFLAGS\t/ s:$: -fno-stack-protector-all:" \ |
| 140 | # Bug 178652 |
150 | -i "${S}"/mkspecs/common/g++.conf || die "sed ${S}/mkspecs/common/g++.conf failed" |
| 141 | if [[ "$(gcc-major-version)" == "3" ]] && use amd64; then |
|
|
| 142 | ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS" |
|
|
| 143 | append-flags -fno-gcse |
|
|
| 144 | fi |
151 | fi |
| 145 | |
152 | |
| 146 | # Bug 172219 |
153 | # Bug 172219 |
| 147 | sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \ |
154 | sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \ |
| 148 | -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \ |
155 | -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \ |
| … | |
… | |
| 202 | else |
209 | else |
| 203 | myconf="${myconf} -release -no-separate-debug-info" |
210 | myconf="${myconf} -release -no-separate-debug-info" |
| 204 | fi |
211 | fi |
| 205 | |
212 | |
| 206 | # 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 |
| 207 | # ${ARCH}. Therefore we convert it to supported values. |
214 | # $(tc-arch). Therefore we convert it to supported values. |
| 208 | case "${ARCH}" in |
215 | case "$(tc-arch)" in |
| 209 | amd64) myconf="${myconf} -arch x86_64" ;; |
216 | amd64) myconf="${myconf} -arch x86_64" ;; |
| 210 | ppc|ppc64) myconf="${myconf} -arch powerpc" ;; |
217 | ppc|ppc64) myconf="${myconf} -arch powerpc" ;; |
| 211 | x86|x86-*) myconf="${myconf} -arch i386" ;; |
218 | x86|x86-*) myconf="${myconf} -arch i386" ;; |
| 212 | alpha|arm|ia64|mips|s390|sparc) myconf="${myconf} -arch ${ARCH}" ;; |
219 | alpha|arm|ia64|mips|s390|sparc) myconf="${myconf} -arch $(tc-arch)" ;; |
| 213 | hppa|sh) myconf="${myconf} -arch generic" ;; |
220 | hppa|sh) myconf="${myconf} -arch generic" ;; |
| 214 | *) die "${ARCH} is unsupported by this eclass. Please file a bug." ;; |
221 | *) die "$(tc-arch) is unsupported by this eclass. Please file a bug." ;; |
| 215 | esac |
222 | esac |
| 216 | |
223 | |
| 217 | myconf="${myconf} -stl -verbose -largefile -confirm-license -no-rpath |
224 | myconf="${myconf} -stl -verbose -largefile -confirm-license -no-rpath |
| 218 | -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} |
225 | -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} |
| 219 | -datadir ${QTDATADIR} -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} |
226 | -datadir ${QTDATADIR} -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} |
| 220 | -plugindir ${QTPLUGINDIR} -sysconfdir ${QTSYSCONFDIR} |
227 | -plugindir ${QTPLUGINDIR} -sysconfdir ${QTSYSCONFDIR} |
| 221 | -translationdir ${QTTRANSDIR} -examplesdir ${QTEXAMPLESDIR} |
228 | -translationdir ${QTTRANSDIR} -examplesdir ${QTEXAMPLESDIR} |
| 222 | -demosdir ${QTDEMOSDIR} -silent -fast |
229 | -demosdir ${QTDEMOSDIR} -silent -fast |
| 223 | $([[ ${PN} == qt-xmlpatterns ]] || echo -no-exceptions) |
230 | $([[ ${PN} == qt-xmlpatterns ]] || echo -no-exceptions) |
| 224 | $(use x86-fbsd || echo -reduce-relocations) |
|
|
| 225 | -nomake examples -nomake demos" |
231 | -reduce-relocations -nomake examples -nomake demos" |
| 226 | |
232 | |
| 227 | echo "${myconf}" |
233 | echo "${myconf}" |
| 228 | } |
234 | } |
| 229 | |
235 | |
| 230 | build_directories() { |
236 | build_directories() { |