/[gentoo-x86]/eclass/qt4-build.eclass
Gentoo

Diff of /eclass/qt4-build.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.40 Revision 1.47
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.40 2009/06/27 18:55:02 yngwin Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/qt4-build.eclass,v 1.47 2009/10/03 19:29:04 ayoy 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# Alex Alexander <wired@gentoo.org>
10# @BLURB: Eclass for Qt4 split ebuilds. 11# @BLURB: Eclass for Qt4 split ebuilds.
11# @DESCRIPTION: 12# @DESCRIPTION:
12# This eclass contains various functions that are used when building Qt4 13# This eclass contains various functions that are used when building Qt4
13 14
14inherit base eutils multilib toolchain-funcs flag-o-matic versionator 15inherit base eutils multilib toolchain-funcs flag-o-matic versionator
55 ;; 56 ;;
56esac 57esac
57MY_P=qt-x11-${SRCTYPE}-${MY_PV} 58MY_P=qt-x11-${SRCTYPE}-${MY_PV}
58S=${WORKDIR}/${MY_P} 59S=${WORKDIR}/${MY_P}
59 60
60HOMEPAGE="http://www.qtsoftware.com/" 61HOMEPAGE="http://qt.nokia.com/"
61SRC_URI="http://get.qtsoftware.com/qt/source/${MY_P}.tar.bz2" 62SRC_URI="http://get.qt.nokia.com/qt/source/${MY_P}.tar.bz2"
63if version_is_at_least 4.5.3 ${PV} ; then
64 SRC_URI="${SRC_URI/bz2/gz}"
65fi
62 66
63case "${PV}" in 67case "${PV}" in
64 4.4.?) SRC_URI="${SRC_URI} mirror://gentoo/${MY_P}-headers.tar.bz2" ;; 68 4.4.?) SRC_URI="${SRC_URI} mirror://gentoo/${MY_P}-headers.tar.bz2" ;;
65 *) ;; 69 *) ;;
66esac 70esac
82 fi 86 fi
83 87
84 # Check USE requirements 88 # Check USE requirements
85 qt4-build_check_use 89 qt4-build_check_use
86 fi 90 fi
91
92 PATH="${S}/bin:${PATH}"
93 LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}"
94
95 if ! version_is_at_least 4.1 $(gcc-version) ; then
96 ewarn "Using a GCC version lower than 4.1 is not supported!"
97 echo
98 ebeep 3
99 fi
100}
101
102# @ECLASS-VARIABLE: QT4_TARGET_DIRECTORIES
103# @DESCRIPTION:
104# Arguments for build_target_directories. Takes the directories, in which the
105# code should be compiled. This is a space-separated list
106
107# @ECLASS-VARIABLE: QT4_EXTRACT_DIRECTORIES
108# @DESCRIPTION:
109# Space separated list including the directories that will be extracted from Qt
110# tarball
111
112# @FUNCTION: qt4-build_src_unpack
113# @DESCRIPTION:
114# Unpacks the sources
115qt4-build_src_unpack() {
116 setqtenv
117 local target targets licenses tar_pkg tar_args
118 if version_is_at_least 4.5 ${PV} ; then
119 licenses="LICENSE.GPL3 LICENSE.LGPL"
120 else
121 licenses="LICENSE.GPL2 LICENSE.GPL3"
122 fi
123 for target in configure ${licenses} projects.pro \
124 src/{qbase,qt_targets,qt_install}.pri bin config.tests mkspecs qmake \
125 ${QT4_EXTRACT_DIRECTORIES}; do
126 targets="${targets} ${MY_P}/${target}"
127 done
128
129 tar_pkg=${MY_P}.tar.bz2
130 tar_args="xjpf"
131 if version_is_at_least 4.5.3 ${PV} ; then
132 tar_pkg=${tar_pkg/bz2/gz}
133 tar_args="xzpf"
134 fi
135
136 echo tar ${tar_args} "${DISTDIR}"/${tar_pkg} ${targets}
137 tar ${tar_args} "${DISTDIR}"/${tar_pkg} ${targets}
138
139 case "${PV}" in
140 4.4.?)
141 echo tar xjpf "${DISTDIR}"/${MY_P}-headers.tar.bz2
142 tar xjpf "${DISTDIR}"/${MY_P}-headers.tar.bz2
143 ;;
144 esac
145
146 # Be backwards compatible for now
147 if [[ $EAPI != 2 ]]; then
148 qt4-build_src_prepare
149 fi
150}
151
152# @ECLASS-VARIABLE: PATCHES
153# @DESCRIPTION:
154# In case you have patches to apply, specify them in PATCHES variable. Make sure
155# to specify the full path. This variable is necessary for src_prepare phase.
156# example:
157# PATCHES="${FILESDIR}"/mypatch.patch
158# ${FILESDIR}"/mypatch2.patch"
159#
160
161# @FUNCTION: qt4-build_src_prepare
162# @DESCRIPTION:
163# Prepare the sources before the configure phase. Strip CFLAGS if necessary, and fix
164# source files in order to respect CFLAGS/CXXFLAGS/LDFLAGS specified on /etc/make.conf.
165qt4-build_src_prepare() {
166 setqtenv
167 cd "${S}"
168
169 if [[ ${PN} != qt-core ]]; then
170 skip_qmake_build_patch
171 skip_project_generation_patch
172 symlink_binaries_to_buildtree
173 fi
174
175 # Bug 178652
176 if [[ "$(gcc-major-version)" == "3" ]] && use amd64; then
177 ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS"
178 append-flags -fno-gcse
179 fi
180
181 # Unsupported old gcc versions - hardened needs this :(
182 if [[ $(gcc-major-version) -lt "4" ]] ; then
183 ewarn "Appending -fno-stack-protector to CXXFLAGS"
184 append-cxxflags -fno-stack-protector
185 # Bug 253127
186 sed -e "/^QMAKE_CFLAGS\t/ s:$: -fno-stack-protector-all:" \
187 -i "${S}"/mkspecs/common/g++.conf || die "sed ${S}/mkspecs/common/g++.conf failed"
188 fi
189
190 # Bug 172219
191 sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \
192 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \
193 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
194 -e "s:X11R6/::" \
195 -i "${S}"/mkspecs/$(qt_mkspecs_dir)/qmake.conf || die "sed ${S}/mkspecs/$(qt_mkspecs_dir)/qmake.conf failed"
196
197 sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \
198 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \
199 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
200 -i "${S}"/mkspecs/common/g++.conf || die "sed ${S}/mkspecs/common/g++.conf failed"
201
202 base_src_prepare
203}
204
205# @FUNCTION: qt4-build_src_configure
206# @DESCRIPTION:
207# Default configure phase
208qt4-build_src_configure() {
209 setqtenv
210 myconf="$(standard_configure_options) ${myconf}"
211
212 echo ./configure ${myconf}
213 ./configure ${myconf} || die "./configure failed"
214 myconf=""
215}
216
217# @FUNCTION: qt4-build_src_compile
218# @DESCRIPTION: Actual compile phase
219qt4-build_src_compile() {
220 setqtenv
221 # Be backwards compatible for now
222 if [[ $EAPI != 2 ]]; then
223 qt4-build_src_configure
224 fi
225
226 build_directories "${QT4_TARGET_DIRECTORIES}"
227}
228
229# @FUNCTION: qt4-build_src_install
230# @DESCRIPTION:
231# Perform the actual installation including some library fixes.
232qt4-build_src_install() {
233 setqtenv
234 install_directories "${QT4_TARGET_DIRECTORIES}"
235 install_qconfigs
236 fix_library_files
237}
238
239# @FUNCTION: setqtenv
240setqtenv() {
87 # Set up installation directories 241 # Set up installation directories
88 QTBASEDIR=/usr/$(get_libdir)/qt4 242 QTBASEDIR=/usr/$(get_libdir)/qt4
89 QTPREFIXDIR=/usr 243 QTPREFIXDIR=/usr
90 QTBINDIR=/usr/bin 244 QTBINDIR=/usr/bin
91 QTLIBDIR=/usr/$(get_libdir)/qt4 245 QTLIBDIR=/usr/$(get_libdir)/qt4
246 QMAKE_LIBDIR_QT=${QTLIBDIR}
92 QTPCDIR=/usr/$(get_libdir)/pkgconfig 247 QTPCDIR=/usr/$(get_libdir)/pkgconfig
93 QTDATADIR=/usr/share/qt4 248 QTDATADIR=/usr/share/qt4
94 QTDOCDIR=/usr/share/doc/qt-${PV} 249 QTDOCDIR=/usr/share/doc/qt-${PV}
95 QTHEADERDIR=/usr/include/qt4 250 QTHEADERDIR=/usr/include/qt4
96 QTPLUGINDIR=${QTLIBDIR}/plugins 251 QTPLUGINDIR=${QTLIBDIR}/plugins
97 QTSYSCONFDIR=/etc/qt4 252 QTSYSCONFDIR=/etc/qt4
98 QTTRANSDIR=${QTDATADIR}/translations 253 QTTRANSDIR=${QTDATADIR}/translations
99 QTEXAMPLESDIR=${QTDATADIR}/examples 254 QTEXAMPLESDIR=${QTDATADIR}/examples
100 QTDEMOSDIR=${QTDATADIR}/demos 255 QTDEMOSDIR=${QTDATADIR}/demos
101 256 QT_INSTALL_PREFIX=/usr/$(get_libdir)/qt4
102 PLATFORM=$(qt_mkspecs_dir) 257 PLATFORM=$(qt_mkspecs_dir)
103 258
104 PATH="${S}/bin:${PATH}" 259 unset QMAKESPEC
105 LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}"
106
107 if ! version_is_at_least 4.1 $(gcc-version) ; then
108 ewarn "Using a GCC version lower than 4.1 is not supported!"
109 echo
110 ebeep 3
111 fi
112}
113
114# @ECLASS-VARIABLE: QT4_TARGET_DIRECTORIES
115# @DESCRIPTION:
116# Arguments for build_target_directories. Takes the directories, in which the
117# code should be compiled. This is a space-separated list
118
119# @ECLASS-VARIABLE: QT4_EXTRACT_DIRECTORIES
120# @DESCRIPTION:
121# Space separated list including the directories that will be extracted from Qt
122# tarball
123
124# @FUNCTION: qt4-build_src_unpack
125# @DESCRIPTION:
126# Unpacks the sources
127qt4-build_src_unpack() {
128 local target targets licenses
129 if version_is_at_least 4.5 ${PV} ; then
130 licenses="LICENSE.GPL3 LICENSE.LGPL"
131 else
132 licenses="LICENSE.GPL2 LICENSE.GPL3"
133 fi
134 for target in configure ${licenses} projects.pro \
135 src/{qbase,qt_targets,qt_install}.pri bin config.tests mkspecs qmake \
136 ${QT4_EXTRACT_DIRECTORIES}; do
137 targets="${targets} ${MY_P}/${target}"
138 done
139
140 echo tar xjpf "${DISTDIR}"/${MY_P}.tar.bz2 ${targets}
141 tar xjpf "${DISTDIR}"/${MY_P}.tar.bz2 ${targets}
142
143 case "${PV}" in
144 4.4.?)
145 echo tar xjpf "${DISTDIR}"/${MY_P}-headers.tar.bz2
146 tar xjpf "${DISTDIR}"/${MY_P}-headers.tar.bz2
147 ;;
148 esac
149
150 # Be backwards compatible for now
151 if [[ $EAPI != 2 ]]; then
152 qt4-build_src_prepare
153 fi
154}
155
156# @ECLASS-VARIABLE: PATCHES
157# @DESCRIPTION:
158# In case you have patches to apply, specify them in PATCHES variable. Make sure
159# to specify the full path. This variable is necessary for src_prepare phase.
160# example:
161# PATCHES="${FILESDIR}"/mypatch.patch
162# ${FILESDIR}"/mypatch2.patch"
163#
164
165# @FUNCTION: qt4-build_src_prepare
166# @DESCRIPTION:
167# Prepare the sources before the configure phase. Strip CFLAGS if necessary, and fix
168# source files in order to respect CFLAGS/CXXFLAGS/LDFLAGS specified on /etc/make.conf.
169qt4-build_src_prepare() {
170 cd "${S}"
171
172 if [[ ${PN} != qt-core ]]; then
173 skip_qmake_build_patch
174 skip_project_generation_patch
175 symlink_binaries_to_buildtree
176 fi
177
178 # Bug 178652
179 if [[ "$(gcc-major-version)" == "3" ]] && use amd64; then
180 ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS"
181 append-flags -fno-gcse
182 fi
183
184 # Unsupported old gcc versions - hardened needs this :(
185 if [[ $(gcc-major-version) -lt "4" ]] ; then
186 ewarn "Appending -fno-stack-protector to CXXFLAGS"
187 append-cxxflags -fno-stack-protector
188 # Bug 253127
189 sed -e "/^QMAKE_CFLAGS\t/ s:$: -fno-stack-protector-all:" \
190 -i "${S}"/mkspecs/common/g++.conf || die "sed ${S}/mkspecs/common/g++.conf failed"
191 fi
192
193 # Bug 172219
194 sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \
195 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \
196 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
197 -e "s:X11R6/::" \
198 -i "${S}"/mkspecs/$(qt_mkspecs_dir)/qmake.conf || die "sed ${S}/mkspecs/$(qt_mkspecs_dir)/qmake.conf failed"
199
200 sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \
201 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \
202 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
203 -i "${S}"/mkspecs/common/g++.conf || die "sed ${S}/mkspecs/common/g++.conf failed"
204
205 base_src_prepare
206}
207
208# @FUNCTION: qt4-build_src_configure
209# @DESCRIPTION:
210# Default configure phase
211qt4-build_src_configure() {
212
213 myconf="$(standard_configure_options) ${myconf}"
214
215 echo ./configure ${myconf}
216 ./configure ${myconf} || die "./configure failed"
217}
218
219# @FUNCTION: qt4-build_src_compile
220# @DESCRIPTION: Actual compile phase
221qt4-build_src_compile() {
222 # Be backwards compatible for now
223 if [[ $EAPI != 2 ]]; then
224 qt4-build_src_configure
225 fi
226
227 build_directories "${QT4_TARGET_DIRECTORIES}"
228}
229
230# @FUNCTION: qt4-build_src_install
231# @DESCRIPTION:
232# Perform the actual installation including some library fixes.
233qt4-build_src_install() {
234 install_directories "${QT4_TARGET_DIRECTORIES}"
235 install_qconfigs
236 fix_library_files
237} 260}
238 261
239# @FUNCTION: standard_configure_options 262# @FUNCTION: standard_configure_options
240# @DESCRIPTION: 263# @DESCRIPTION:
241# Sets up some standard configure options, like libdir (if necessary), whether 264# Sets up some standard configure options, like libdir (if necessary), whether
281 -translationdir ${QTTRANSDIR} -examplesdir ${QTEXAMPLESDIR} 304 -translationdir ${QTTRANSDIR} -examplesdir ${QTEXAMPLESDIR}
282 -demosdir ${QTDEMOSDIR} -silent -fast 305 -demosdir ${QTDEMOSDIR} -silent -fast
283 $([[ ${PN} == qt-xmlpatterns ]] || echo -no-exceptions) 306 $([[ ${PN} == qt-xmlpatterns ]] || echo -no-exceptions)
284 -reduce-relocations -nomake examples -nomake demos" 307 -reduce-relocations -nomake examples -nomake demos"
285 308
286 # Make eclass 4.5.{1,2} ready 309 # Make eclass 4.5.x ready
287 case "${MY_PV}" in 310 case "${MY_PV}" in
288 4.5.1 | 4.5.2) 311 4.5.?)
289 myconf="${myconf} -opensource" 312 myconf="${myconf} -opensource"
290 ;; 313 ;;
291 esac 314 esac
292 315
293 echo "${myconf}" 316 echo "${myconf}"
299# Compiles the code in $QT4_TARGET_DIRECTORIES 322# Compiles the code in $QT4_TARGET_DIRECTORIES
300build_directories() { 323build_directories() {
301 local dirs="$@" 324 local dirs="$@"
302 for x in ${dirs}; do 325 for x in ${dirs}; do
303 cd "${S}"/${x} 326 cd "${S}"/${x}
327 sed -i -e "s:\$\$\[QT_INSTALL_LIBS\]:/usr/$(get_libdir)/qt4:g" $(find "${S}" -name '*.pr[io]') "${S}"/mkspecs/common/linux.conf || die
304 "${S}"/bin/qmake "LIBS+=-L${QTLIBDIR}" "CONFIG+=nostrip" || die "qmake failed" 328 "${S}"/bin/qmake "LIBS+=-L${QTLIBDIR}" "CONFIG+=nostrip" || die "qmake failed"
305 emake || die "emake failed" 329 emake CC="@echo compiling \$< && $(tc-getCC)" \
330 CXX="@echo compiling \$< && $(tc-getCXX)" \
331 LINK="@echo linking \$@ && $(tc-getCXX)" || die "emake failed"
306 done 332 done
307} 333}
308 334
309# @FUNCTION: install_directories 335# @FUNCTION: install_directories
310# @USAGE: < directories > 336# @USAGE: < directories >
434 ewarn "Packages that typically need to be recompiled are kdelibs from KDE4, any" 460 ewarn "Packages that typically need to be recompiled are kdelibs from KDE4, any"
435 ewarn "additional KDE4/Qt4 styles, qscintilla and PyQt4. Before filing a bug report," 461 ewarn "additional KDE4/Qt4 styles, qscintilla and PyQt4. Before filing a bug report,"
436 ewarn "make sure all your Qt4 packages are up-to-date and built with the same" 462 ewarn "make sure all your Qt4 packages are up-to-date and built with the same"
437 ewarn "configuration." 463 ewarn "configuration."
438 ewarn 464 ewarn
439 ewarn "For more information, see http://doc.trolltech.com/4.4/plugins-howto.html" 465 ewarn "For more information, see http://doc.trolltech.com/${PV%.*}/plugins-howto.html"
440 echo 466 echo
441} 467}
442 468
443# @FUNCTION: skip_qmake_build_patch 469# @FUNCTION: skip_qmake_build_patch
444# @DESCRIPTION: 470# @DESCRIPTION:
615 elif [[ ${CXX/icpc/} != ${CXX} ]]; then 641 elif [[ ${CXX/icpc/} != ${CXX} ]]; then
616 spec="${spec}-icc" 642 spec="${spec}-icc"
617 else 643 else
618 die "Unknown compiler ${CXX}." 644 die "Unknown compiler ${CXX}."
619 fi 645 fi
646 if [[ -n "${LIBDIR/lib}" ]]; then
647 spec="${spec}-${LIBDIR/lib}"
648 fi
620 649
621 echo "${spec}" 650 echo "${spec}"
622} 651}
623 652
624case ${EAPI:-0} in 653case ${EAPI:-0} in

Legend:
Removed from v.1.40  
changed lines
  Added in v.1.47

  ViewVC Help
Powered by ViewVC 1.1.20