/[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.44
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.44 2009/08/11 14:44:16 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>,
55 ;; 55 ;;
56esac 56esac
57MY_P=qt-x11-${SRCTYPE}-${MY_PV} 57MY_P=qt-x11-${SRCTYPE}-${MY_PV}
58S=${WORKDIR}/${MY_P} 58S=${WORKDIR}/${MY_P}
59 59
60HOMEPAGE="http://www.qtsoftware.com/" 60HOMEPAGE="http://qt.nokia.com/"
61SRC_URI="http://get.qtsoftware.com/qt/source/${MY_P}.tar.bz2" 61SRC_URI="http://download.qt.nokia.com/qt/source/${MY_P}.tar.bz2"
62 62
63case "${PV}" in 63case "${PV}" in
64 4.4.?) SRC_URI="${SRC_URI} mirror://gentoo/${MY_P}-headers.tar.bz2" ;; 64 4.4.?) SRC_URI="${SRC_URI} mirror://gentoo/${MY_P}-headers.tar.bz2" ;;
65 *) ;; 65 *) ;;
66esac 66esac
82 fi 82 fi
83 83
84 # Check USE requirements 84 # Check USE requirements
85 qt4-build_check_use 85 qt4-build_check_use
86 fi 86 fi
87
88 PATH="${S}/bin:${PATH}"
89 LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}"
90
91 if ! version_is_at_least 4.1 $(gcc-version) ; then
92 ewarn "Using a GCC version lower than 4.1 is not supported!"
93 echo
94 ebeep 3
95 fi
96}
97
98# @ECLASS-VARIABLE: QT4_TARGET_DIRECTORIES
99# @DESCRIPTION:
100# Arguments for build_target_directories. Takes the directories, in which the
101# code should be compiled. This is a space-separated list
102
103# @ECLASS-VARIABLE: QT4_EXTRACT_DIRECTORIES
104# @DESCRIPTION:
105# Space separated list including the directories that will be extracted from Qt
106# tarball
107
108# @FUNCTION: qt4-build_src_unpack
109# @DESCRIPTION:
110# Unpacks the sources
111qt4-build_src_unpack() {
112 setqtenv
113 local target targets licenses
114 if version_is_at_least 4.5 ${PV} ; then
115 licenses="LICENSE.GPL3 LICENSE.LGPL"
116 else
117 licenses="LICENSE.GPL2 LICENSE.GPL3"
118 fi
119 for target in configure ${licenses} projects.pro \
120 src/{qbase,qt_targets,qt_install}.pri bin config.tests mkspecs qmake \
121 ${QT4_EXTRACT_DIRECTORIES}; do
122 targets="${targets} ${MY_P}/${target}"
123 done
124
125 echo tar xjpf "${DISTDIR}"/${MY_P}.tar.bz2 ${targets}
126 tar xjpf "${DISTDIR}"/${MY_P}.tar.bz2 ${targets}
127
128 case "${PV}" in
129 4.4.?)
130 echo tar xjpf "${DISTDIR}"/${MY_P}-headers.tar.bz2
131 tar xjpf "${DISTDIR}"/${MY_P}-headers.tar.bz2
132 ;;
133 esac
134
135 # Be backwards compatible for now
136 if [[ $EAPI != 2 ]]; then
137 qt4-build_src_prepare
138 fi
139}
140
141# @ECLASS-VARIABLE: PATCHES
142# @DESCRIPTION:
143# In case you have patches to apply, specify them in PATCHES variable. Make sure
144# to specify the full path. This variable is necessary for src_prepare phase.
145# example:
146# PATCHES="${FILESDIR}"/mypatch.patch
147# ${FILESDIR}"/mypatch2.patch"
148#
149
150# @FUNCTION: qt4-build_src_prepare
151# @DESCRIPTION:
152# Prepare the sources before the configure phase. Strip CFLAGS if necessary, and fix
153# source files in order to respect CFLAGS/CXXFLAGS/LDFLAGS specified on /etc/make.conf.
154qt4-build_src_prepare() {
155 setqtenv
156 cd "${S}"
157
158 if [[ ${PN} != qt-core ]]; then
159 skip_qmake_build_patch
160 skip_project_generation_patch
161 symlink_binaries_to_buildtree
162 fi
163
164 # Bug 178652
165 if [[ "$(gcc-major-version)" == "3" ]] && use amd64; then
166 ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS"
167 append-flags -fno-gcse
168 fi
169
170 # Unsupported old gcc versions - hardened needs this :(
171 if [[ $(gcc-major-version) -lt "4" ]] ; then
172 ewarn "Appending -fno-stack-protector to CXXFLAGS"
173 append-cxxflags -fno-stack-protector
174 # Bug 253127
175 sed -e "/^QMAKE_CFLAGS\t/ s:$: -fno-stack-protector-all:" \
176 -i "${S}"/mkspecs/common/g++.conf || die "sed ${S}/mkspecs/common/g++.conf failed"
177 fi
178
179 # Bug 172219
180 sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \
181 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \
182 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
183 -e "s:X11R6/::" \
184 -i "${S}"/mkspecs/$(qt_mkspecs_dir)/qmake.conf || die "sed ${S}/mkspecs/$(qt_mkspecs_dir)/qmake.conf failed"
185
186 sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \
187 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \
188 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
189 -i "${S}"/mkspecs/common/g++.conf || die "sed ${S}/mkspecs/common/g++.conf failed"
190
191 base_src_prepare
192}
193
194# @FUNCTION: qt4-build_src_configure
195# @DESCRIPTION:
196# Default configure phase
197qt4-build_src_configure() {
198 setqtenv
199 myconf="$(standard_configure_options) ${myconf}"
200
201 echo ./configure ${myconf}
202 ./configure ${myconf} || die "./configure failed"
203 myconf=""
204}
205
206# @FUNCTION: qt4-build_src_compile
207# @DESCRIPTION: Actual compile phase
208qt4-build_src_compile() {
209 setqtenv
210 # Be backwards compatible for now
211 if [[ $EAPI != 2 ]]; then
212 qt4-build_src_configure
213 fi
214
215 build_directories "${QT4_TARGET_DIRECTORIES}"
216}
217
218# @FUNCTION: qt4-build_src_install
219# @DESCRIPTION:
220# Perform the actual installation including some library fixes.
221qt4-build_src_install() {
222 setqtenv
223 install_directories "${QT4_TARGET_DIRECTORIES}"
224 install_qconfigs
225 fix_library_files
226}
227
228# @FUNCTION: setqtenv
229setqtenv() {
87 # Set up installation directories 230 # Set up installation directories
88 QTBASEDIR=/usr/$(get_libdir)/qt4 231 QTBASEDIR=/usr/$(get_libdir)/qt4
89 QTPREFIXDIR=/usr 232 QTPREFIXDIR=/usr
90 QTBINDIR=/usr/bin 233 QTBINDIR=/usr/bin
91 QTLIBDIR=/usr/$(get_libdir)/qt4 234 QTLIBDIR=/usr/$(get_libdir)/qt4
235 QMAKE_LIBDIR_QT=${QTLIBDIR}
92 QTPCDIR=/usr/$(get_libdir)/pkgconfig 236 QTPCDIR=/usr/$(get_libdir)/pkgconfig
93 QTDATADIR=/usr/share/qt4 237 QTDATADIR=/usr/share/qt4
94 QTDOCDIR=/usr/share/doc/qt-${PV} 238 QTDOCDIR=/usr/share/doc/qt-${PV}
95 QTHEADERDIR=/usr/include/qt4 239 QTHEADERDIR=/usr/include/qt4
96 QTPLUGINDIR=${QTLIBDIR}/plugins 240 QTPLUGINDIR=${QTLIBDIR}/plugins
97 QTSYSCONFDIR=/etc/qt4 241 QTSYSCONFDIR=/etc/qt4
98 QTTRANSDIR=${QTDATADIR}/translations 242 QTTRANSDIR=${QTDATADIR}/translations
99 QTEXAMPLESDIR=${QTDATADIR}/examples 243 QTEXAMPLESDIR=${QTDATADIR}/examples
100 QTDEMOSDIR=${QTDATADIR}/demos 244 QTDEMOSDIR=${QTDATADIR}/demos
101 245 QT_INSTALL_PREFIX=/usr/$(get_libdir)/qt4
102 PLATFORM=$(qt_mkspecs_dir) 246 PLATFORM=$(qt_mkspecs_dir)
103 247
104 PATH="${S}/bin:${PATH}" 248 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} 249}
238 250
239# @FUNCTION: standard_configure_options 251# @FUNCTION: standard_configure_options
240# @DESCRIPTION: 252# @DESCRIPTION:
241# Sets up some standard configure options, like libdir (if necessary), whether 253# Sets up some standard configure options, like libdir (if necessary), whether
299# Compiles the code in $QT4_TARGET_DIRECTORIES 311# Compiles the code in $QT4_TARGET_DIRECTORIES
300build_directories() { 312build_directories() {
301 local dirs="$@" 313 local dirs="$@"
302 for x in ${dirs}; do 314 for x in ${dirs}; do
303 cd "${S}"/${x} 315 cd "${S}"/${x}
316 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" 317 "${S}"/bin/qmake "LIBS+=-L${QTLIBDIR}" "CONFIG+=nostrip" || die "qmake failed"
305 emake || die "emake failed" 318 emake || die "emake failed"
306 done 319 done
307} 320}
308 321
434 ewarn "Packages that typically need to be recompiled are kdelibs from KDE4, any" 447 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," 448 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" 449 ewarn "make sure all your Qt4 packages are up-to-date and built with the same"
437 ewarn "configuration." 450 ewarn "configuration."
438 ewarn 451 ewarn
439 ewarn "For more information, see http://doc.trolltech.com/4.4/plugins-howto.html" 452 ewarn "For more information, see http://doc.trolltech.com/${PV%.*}/plugins-howto.html"
440 echo 453 echo
441} 454}
442 455
443# @FUNCTION: skip_qmake_build_patch 456# @FUNCTION: skip_qmake_build_patch
444# @DESCRIPTION: 457# @DESCRIPTION:
615 elif [[ ${CXX/icpc/} != ${CXX} ]]; then 628 elif [[ ${CXX/icpc/} != ${CXX} ]]; then
616 spec="${spec}-icc" 629 spec="${spec}-icc"
617 else 630 else
618 die "Unknown compiler ${CXX}." 631 die "Unknown compiler ${CXX}."
619 fi 632 fi
633 if [[ -n "${LIBDIR/lib}" ]]; then
634 spec="${spec}-${LIBDIR/lib}"
635 fi
620 636
621 echo "${spec}" 637 echo "${spec}"
622} 638}
623 639
624case ${EAPI:-0} in 640case ${EAPI:-0} in

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

  ViewVC Help
Powered by ViewVC 1.1.20