| 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.20 2009/02/11 21:14:59 yngwin Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/qt4-build.eclass,v 1.29 2009/03/28 00:21:13 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) |
| … | |
… | |
| 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 5 |
| 76 | fi |
80 | fi |
| 77 | } |
|
|
| 78 | |
81 | |
| 79 | qt4-build_src_unpack() { |
|
|
| 80 | local target targets |
|
|
| 81 | for target in configure LICENSE.{GPL2,GPL3} projects.pro \ |
|
|
| 82 | src/{qbase,qt_targets,qt_install}.pri bin config.tests mkspecs qmake \ |
|
|
| 83 | ${QT4_EXTRACT_DIRECTORIES}; do |
|
|
| 84 | targets="${targets} ${MY_P}/${target}" |
|
|
| 85 | done |
|
|
| 86 | |
|
|
| 87 | echo tar xjpf "${DISTDIR}"/${MY_P}.tar.bz2 ${targets} |
|
|
| 88 | tar xjpf "${DISTDIR}"/${MY_P}.tar.bz2 ${targets} |
|
|
| 89 | |
|
|
| 90 | case "${PV}" in |
|
|
| 91 | 4.4.?) |
|
|
| 92 | echo tar xjpf "${DISTDIR}"/${MY_P}-headers.tar.bz2 |
|
|
| 93 | tar xjpf "${DISTDIR}"/${MY_P}-headers.tar.bz2 |
|
|
| 94 | ;; |
|
|
| 95 | esac |
|
|
| 96 | |
|
|
| 97 | # Be backwards compatible for now |
|
|
| 98 | if [[ $EAPI != 2 ]]; then |
|
|
| 99 | qt4-build_src_prepare |
|
|
| 100 | fi |
|
|
| 101 | } |
|
|
| 102 | |
|
|
| 103 | qt4-build_src_prepare() { |
|
|
| 104 | cd "${S}" |
|
|
| 105 | |
|
|
| 106 | if [[ ${PN} != qt-core ]]; then |
|
|
| 107 | skip_qmake_build_patch |
|
|
| 108 | skip_project_generation_patch |
|
|
| 109 | symlink_binaries_to_buildtree |
|
|
| 110 | fi |
|
|
| 111 | |
|
|
| 112 | # Bug 253127 |
|
|
| 113 | if [[ $(gcc-major-version) -lt "4" ]] ; then |
|
|
| 114 | sed -e "/^QMAKE_CFLAGS\t/ s:$: -fno-stack-protector-all:" \ |
|
|
| 115 | -i "${S}"/mkspecs/common/g++.conf || die "sed ${S}/mkspecs/common/g++.conf failed" |
|
|
| 116 | fi |
|
|
| 117 | |
|
|
| 118 | sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \ |
|
|
| 119 | -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \ |
|
|
| 120 | -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \ |
|
|
| 121 | -e "s:X11R6/::" \ |
|
|
| 122 | -i "${S}"/mkspecs/$(qt_mkspecs_dir)/qmake.conf || die "sed ${S}/mkspecs/$(qt_mkspecs_dir)/qmake.conf failed" |
|
|
| 123 | |
|
|
| 124 | sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \ |
|
|
| 125 | -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \ |
|
|
| 126 | -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \ |
|
|
| 127 | -i "${S}"/mkspecs/common/g++.conf || die "sed ${S}/mkspecs/common/g++.conf failed" |
|
|
| 128 | } |
|
|
| 129 | |
|
|
| 130 | qt4-build_src_configure() { |
|
|
| 131 | if use custom-cxxflags; then |
82 | if use custom-cxxflags; then |
| 132 | echo |
83 | echo |
| 133 | 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" |
| 134 | ewarn "CXXFLAGS you have set in /etc/make.conf. This is not supported, and we" |
85 | ewarn "CXXFLAGS you have set in /etc/make.conf. This is not supported, and we" |
| 135 | ewarn "recommend to unset this useflag. But you are free to experiment with it." |
86 | ewarn "recommend to unset this useflag. But you are free to experiment with it." |
| 136 | ewarn "Just do not start crying if it breaks your system, or eats your kitten" |
87 | ewarn "Just do not start crying if it breaks your system, or eats your kitten" |
| 137 | ewarn "for breakfast. ;-) " |
88 | ewarn "for breakfast. ;-) " |
| 138 | echo |
89 | echo |
|
|
90 | fi |
|
|
91 | |
|
|
92 | } |
|
|
93 | |
|
|
94 | qt4-build_src_unpack() { |
|
|
95 | local target targets licenses |
|
|
96 | if version_is_at_least 4.5 ${PV} ; then |
|
|
97 | licenses="LICENSE.GPL3 LICENSE.LGPL" |
| 139 | else |
98 | else |
|
|
99 | licenses="LICENSE.GPL2 LICENSE.GPL3" |
|
|
100 | fi |
|
|
101 | for target in configure ${licenses} projects.pro \ |
|
|
102 | src/{qbase,qt_targets,qt_install}.pri bin config.tests mkspecs qmake \ |
|
|
103 | ${QT4_EXTRACT_DIRECTORIES}; do |
|
|
104 | targets="${targets} ${MY_P}/${target}" |
|
|
105 | done |
|
|
106 | |
|
|
107 | echo tar xjpf "${DISTDIR}"/${MY_P}.tar.bz2 ${targets} |
|
|
108 | tar xjpf "${DISTDIR}"/${MY_P}.tar.bz2 ${targets} |
|
|
109 | |
|
|
110 | case "${PV}" in |
|
|
111 | 4.4.?) |
|
|
112 | echo tar xjpf "${DISTDIR}"/${MY_P}-headers.tar.bz2 |
|
|
113 | tar xjpf "${DISTDIR}"/${MY_P}-headers.tar.bz2 |
|
|
114 | ;; |
|
|
115 | esac |
|
|
116 | |
|
|
117 | # Be backwards compatible for now |
|
|
118 | if [[ $EAPI != 2 ]]; then |
|
|
119 | qt4-build_src_prepare |
|
|
120 | fi |
|
|
121 | } |
|
|
122 | |
|
|
123 | qt4-build_src_prepare() { |
|
|
124 | cd "${S}" |
|
|
125 | |
|
|
126 | if [[ ${PN} != qt-core ]]; then |
|
|
127 | skip_qmake_build_patch |
|
|
128 | skip_project_generation_patch |
|
|
129 | symlink_binaries_to_buildtree |
|
|
130 | fi |
|
|
131 | |
|
|
132 | if ! use custom-cxxflags;then |
| 140 | # Don't let the user go too overboard with flags. |
133 | # Don't let the user go too overboard with flags. |
| 141 | strip-flags |
134 | strip-flags |
| 142 | replace-flags -O3 -O2 |
135 | replace-flags -O3 -O2 |
| 143 | fi |
136 | fi |
| 144 | |
137 | |
| … | |
… | |
| 151 | # Bug 178652 |
144 | # Bug 178652 |
| 152 | if [[ "$(gcc-major-version)" == "3" ]] && use amd64; then |
145 | if [[ "$(gcc-major-version)" == "3" ]] && use amd64; then |
| 153 | ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS" |
146 | ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS" |
| 154 | append-flags -fno-gcse |
147 | append-flags -fno-gcse |
| 155 | fi |
148 | fi |
|
|
149 | |
|
|
150 | # Bug 253127 |
|
|
151 | if [[ $(gcc-major-version) -lt "4" ]] ; then |
|
|
152 | sed -e "/^QMAKE_CFLAGS\t/ s:$: -fno-stack-protector-all:" \ |
|
|
153 | -i "${S}"/mkspecs/common/g++.conf || die "sed ${S}/mkspecs/common/g++.conf failed" |
|
|
154 | fi |
|
|
155 | |
|
|
156 | # Bug 172219 |
|
|
157 | sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \ |
|
|
158 | -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \ |
|
|
159 | -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \ |
|
|
160 | -e "s:X11R6/::" \ |
|
|
161 | -i "${S}"/mkspecs/$(qt_mkspecs_dir)/qmake.conf || die "sed ${S}/mkspecs/$(qt_mkspecs_dir)/qmake.conf failed" |
|
|
162 | |
|
|
163 | sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \ |
|
|
164 | -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \ |
|
|
165 | -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \ |
|
|
166 | -i "${S}"/mkspecs/common/g++.conf || die "sed ${S}/mkspecs/common/g++.conf failed" |
|
|
167 | |
|
|
168 | } |
|
|
169 | |
|
|
170 | qt4-build_src_configure() { |
| 156 | |
171 | |
| 157 | myconf="$(standard_configure_options) ${myconf}" |
172 | myconf="$(standard_configure_options) ${myconf}" |
| 158 | |
173 | |
| 159 | echo ./configure ${myconf} |
174 | echo ./configure ${myconf} |
| 160 | ./configure ${myconf} || die "./configure failed" |
175 | ./configure ${myconf} || die "./configure failed" |
| … | |
… | |
| 197 | else |
212 | else |
| 198 | myconf="${myconf} -release -no-separate-debug-info" |
213 | myconf="${myconf} -release -no-separate-debug-info" |
| 199 | fi |
214 | fi |
| 200 | |
215 | |
| 201 | # ARCH is set on Gentoo. Qt now falls back to generic on an unsupported |
216 | # ARCH is set on Gentoo. Qt now falls back to generic on an unsupported |
| 202 | # ${ARCH}. Therefore we convert it to supported values. |
217 | # $(tc-arch). Therefore we convert it to supported values. |
| 203 | case "${ARCH}" in |
218 | case "$(tc-arch)" in |
| 204 | amd64) myconf="${myconf} -arch x86_64" ;; |
219 | amd64) myconf="${myconf} -arch x86_64" ;; |
| 205 | ppc|ppc64) myconf="${myconf} -arch powerpc" ;; |
220 | ppc|ppc64) myconf="${myconf} -arch powerpc" ;; |
| 206 | x86|x86-*) myconf="${myconf} -arch i386" ;; |
221 | x86|x86-*) myconf="${myconf} -arch i386" ;; |
| 207 | alpha|arm|ia64|mips|s390|sparc) myconf="${myconf} -arch ${ARCH}" ;; |
222 | alpha|arm|ia64|mips|s390|sparc) myconf="${myconf} -arch $(tc-arch)" ;; |
| 208 | hppa|sh) myconf="${myconf} -arch generic" ;; |
223 | hppa|sh) myconf="${myconf} -arch generic" ;; |
| 209 | *) die "${ARCH} is unsupported by this eclass. Please file a bug." ;; |
224 | *) die "$(tc-arch) is unsupported by this eclass. Please file a bug." ;; |
| 210 | esac |
225 | esac |
| 211 | |
226 | |
| 212 | myconf="${myconf} -stl -verbose -largefile -confirm-license -no-rpath |
227 | myconf="${myconf} -stl -verbose -largefile -confirm-license -no-rpath |
| 213 | -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} |
228 | -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} |
| 214 | -datadir ${QTDATADIR} -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} |
229 | -datadir ${QTDATADIR} -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} |
| 215 | -plugindir ${QTPLUGINDIR} -sysconfdir ${QTSYSCONFDIR} |
230 | -plugindir ${QTPLUGINDIR} -sysconfdir ${QTSYSCONFDIR} |
| 216 | -translationdir ${QTTRANSDIR} -examplesdir ${QTEXAMPLESDIR} |
231 | -translationdir ${QTTRANSDIR} -examplesdir ${QTEXAMPLESDIR} |
| 217 | -demosdir ${QTDEMOSDIR} -silent -fast |
232 | -demosdir ${QTDEMOSDIR} -silent -fast |
| 218 | $([[ ${PN} == qt-xmlpatterns ]] || echo -no-exceptions) |
233 | $([[ ${PN} == qt-xmlpatterns ]] || echo -no-exceptions) |
| 219 | $(use x86-fbsd || echo -reduce-relocations) |
|
|
| 220 | -nomake examples -nomake demos" |
234 | -reduce-relocations -nomake examples -nomake demos" |
| 221 | |
235 | |
| 222 | echo "${myconf}" |
236 | echo "${myconf}" |
| 223 | } |
237 | } |
| 224 | |
238 | |
| 225 | build_directories() { |
239 | build_directories() { |