/[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.42
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.42 2009/07/13 19:55:30 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>,
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}
204
205# @FUNCTION: qt4-build_src_compile
206# @DESCRIPTION: Actual compile phase
207qt4-build_src_compile() {
208 setqtenv
209 # Be backwards compatible for now
210 if [[ $EAPI != 2 ]]; then
211 qt4-build_src_configure
212 fi
213
214 build_directories "${QT4_TARGET_DIRECTORIES}"
215}
216
217# @FUNCTION: qt4-build_src_install
218# @DESCRIPTION:
219# Perform the actual installation including some library fixes.
220qt4-build_src_install() {
221 setqtenv
222 install_directories "${QT4_TARGET_DIRECTORIES}"
223 install_qconfigs
224 fix_library_files
225}
226
227# @FUNCTION: setqtenv
228setqtenv() {
87 # Set up installation directories 229 # Set up installation directories
88 QTBASEDIR=/usr/$(get_libdir)/qt4 230 QTBASEDIR=/usr/$(get_libdir)/qt4
89 QTPREFIXDIR=/usr 231 QTPREFIXDIR=/usr
90 QTBINDIR=/usr/bin 232 QTBINDIR=/usr/bin
91 QTLIBDIR=/usr/$(get_libdir)/qt4 233 QTLIBDIR=/usr/$(get_libdir)/qt4
234 QMAKE_LIBDIR_QT=${QTLIBDIR}
92 QTPCDIR=/usr/$(get_libdir)/pkgconfig 235 QTPCDIR=/usr/$(get_libdir)/pkgconfig
93 QTDATADIR=/usr/share/qt4 236 QTDATADIR=/usr/share/qt4
94 QTDOCDIR=/usr/share/doc/qt-${PV} 237 QTDOCDIR=/usr/share/doc/qt-${PV}
95 QTHEADERDIR=/usr/include/qt4 238 QTHEADERDIR=/usr/include/qt4
96 QTPLUGINDIR=${QTLIBDIR}/plugins 239 QTPLUGINDIR=${QTLIBDIR}/plugins
97 QTSYSCONFDIR=/etc/qt4 240 QTSYSCONFDIR=/etc/qt4
98 QTTRANSDIR=${QTDATADIR}/translations 241 QTTRANSDIR=${QTDATADIR}/translations
99 QTEXAMPLESDIR=${QTDATADIR}/examples 242 QTEXAMPLESDIR=${QTDATADIR}/examples
100 QTDEMOSDIR=${QTDATADIR}/demos 243 QTDEMOSDIR=${QTDATADIR}/demos
101 244 QT_INSTALL_PREFIX=/usr/$(get_libdir)/qt4
102 PLATFORM=$(qt_mkspecs_dir) 245 PLATFORM=$(qt_mkspecs_dir)
103 246
104 PATH="${S}/bin:${PATH}" 247 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} 248}
238 249
239# @FUNCTION: standard_configure_options 250# @FUNCTION: standard_configure_options
240# @DESCRIPTION: 251# @DESCRIPTION:
241# Sets up some standard configure options, like libdir (if necessary), whether 252# Sets up some standard configure options, like libdir (if necessary), whether
299# Compiles the code in $QT4_TARGET_DIRECTORIES 310# Compiles the code in $QT4_TARGET_DIRECTORIES
300build_directories() { 311build_directories() {
301 local dirs="$@" 312 local dirs="$@"
302 for x in ${dirs}; do 313 for x in ${dirs}; do
303 cd "${S}"/${x} 314 cd "${S}"/${x}
315 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" 316 "${S}"/bin/qmake "LIBS+=-L${QTLIBDIR}" "CONFIG+=nostrip" || die "qmake failed"
305 emake || die "emake failed" 317 emake || die "emake failed"
306 done 318 done
307} 319}
308 320
434 ewarn "Packages that typically need to be recompiled are kdelibs from KDE4, any" 446 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," 447 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" 448 ewarn "make sure all your Qt4 packages are up-to-date and built with the same"
437 ewarn "configuration." 449 ewarn "configuration."
438 ewarn 450 ewarn
439 ewarn "For more information, see http://doc.trolltech.com/4.4/plugins-howto.html" 451 ewarn "For more information, see http://doc.trolltech.com/${PV%.*}/plugins-howto.html"
440 echo 452 echo
441} 453}
442 454
443# @FUNCTION: skip_qmake_build_patch 455# @FUNCTION: skip_qmake_build_patch
444# @DESCRIPTION: 456# @DESCRIPTION:
615 elif [[ ${CXX/icpc/} != ${CXX} ]]; then 627 elif [[ ${CXX/icpc/} != ${CXX} ]]; then
616 spec="${spec}-icc" 628 spec="${spec}-icc"
617 else 629 else
618 die "Unknown compiler ${CXX}." 630 die "Unknown compiler ${CXX}."
619 fi 631 fi
632 if [[ -n "${LIBDIR/lib}" ]]; then
633 spec="${spec}-${LIBDIR/lib}"
634 fi
620 635
621 echo "${spec}" 636 echo "${spec}"
622} 637}
623 638
624case ${EAPI:-0} in 639case ${EAPI:-0} in

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

  ViewVC Help
Powered by ViewVC 1.1.20