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

Contents of /eclass/qt4-build.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.44 - (hide annotations) (download)
Tue Aug 11 14:44:16 2009 UTC (5 years ago) by hwoarang
Branch: MAIN
Changes since 1.43: +3 -3 lines
Update Homepage and SRC_URI links

1 yngwin 1.20 # Copyright 2007-2009 Gentoo Foundation
2 caleb 1.1 # Distributed under the terms of the GNU General Public License v2
3 hwoarang 1.44 # $Header: /var/cvsroot/gentoo-x86/eclass/qt4-build.eclass,v 1.43 2009/07/31 22:18:31 tommy Exp $
4 caleb 1.1
5     # @ECLASS: qt4-build.eclass
6     # @MAINTAINER:
7 yngwin 1.25 # Ben de Groot <yngwin@gentoo.org>,
8     # Markos Chandras <hwoarang@gentoo.org>,
9 caleb 1.1 # Caleb Tennis <caleb@gentoo.org>
10 ingmar 1.8 # @BLURB: Eclass for Qt4 split ebuilds.
11 caleb 1.1 # @DESCRIPTION:
12     # This eclass contains various functions that are used when building Qt4
13    
14 hwoarang 1.37 inherit base eutils multilib toolchain-funcs flag-o-matic versionator
15 caleb 1.1
16 yngwin 1.40 IUSE="${IUSE} debug pch"
17 hwoarang 1.36 RDEPEND="
18     !<x11-libs/qt-assistant-${PV}
19     !>x11-libs/qt-assistant-${PV}-r9999
20     !<x11-libs/qt-core-${PV}
21     !>x11-libs/qt-core-${PV}-r9999
22     !<x11-libs/qt-dbus-${PV}
23     !>x11-libs/qt-dbus-${PV}-r9999
24     !<x11-libs/qt-demo-${PV}
25     !>x11-libs/qt-demo-${PV}-r9999
26     !<x11-libs/qt-gui-${PV}
27     !>x11-libs/qt-gui-${PV}-r9999
28     !<x11-libs/qt-opengl-${PV}
29     !>x11-libs/qt-opengl-${PV}-r9999
30     !<x11-libs/qt-phonon-${PV}
31     !>x11-libs/qt-phonon-${PV}-r9999
32     !<x11-libs/qt-qt3support-${PV}
33     !>x11-libs/qt-qt3support-${PV}-r9999
34     !<x11-libs/qt-script-${PV}
35     !>x11-libs/qt-script-${PV}-r9999
36     !<x11-libs/qt-sql-${PV}
37     !>x11-libs/qt-sql-${PV}-r9999
38     !<x11-libs/qt-svg-${PV}
39     !>x11-libs/qt-svg-${PV}-r9999
40     !<x11-libs/qt-test-${PV}
41     !>x11-libs/qt-test-${PV}-r9999
42     !<x11-libs/qt-webkit-${PV}
43     !>x11-libs/qt-webkit-${PV}-r9999
44     !<x11-libs/qt-xmlpatterns-${PV}
45     !>x11-libs/qt-xmlpatterns-${PV}-r9999
46     "
47 ingmar 1.7 case "${PV}" in
48 yngwin 1.20 4.?.?_rc*)
49 ingmar 1.11 SRCTYPE="${SRCTYPE:-opensource-src}"
50     MY_PV="${PV/_rc/-rc}"
51     ;;
52 ingmar 1.7 *)
53     SRCTYPE="${SRCTYPE:-opensource-src}"
54     MY_PV="${PV}"
55     ;;
56     esac
57 ingmar 1.11 MY_P=qt-x11-${SRCTYPE}-${MY_PV}
58     S=${WORKDIR}/${MY_P}
59 ingmar 1.7
60 hwoarang 1.44 HOMEPAGE="http://qt.nokia.com/"
61     SRC_URI="http://download.qt.nokia.com/qt/source/${MY_P}.tar.bz2"
62 ingmar 1.11
63     case "${PV}" in
64 yngwin 1.20 4.4.?) SRC_URI="${SRC_URI} mirror://gentoo/${MY_P}-headers.tar.bz2" ;;
65     *) ;;
66 ingmar 1.11 esac
67 ingmar 1.7
68 yngwin 1.25 if version_is_at_least 4.5 ${PV} ; then
69     LICENSE="|| ( LGPL-2.1 GPL-3 )"
70     fi
71    
72 hwoarang 1.34 # @FUNCTION: qt4-build_pkg_setup
73     # @DESCRIPTION:
74     # Sets up installation directories, PLATFORM, PATH, and LD_LIBRARY_PATH
75 caleb 1.1 qt4-build_pkg_setup() {
76 yngwin 1.20 # EAPI=2 ebuilds set use-deps, others need this:
77     if [[ $EAPI != 2 ]]; then
78     # Make sure debug setting corresponds with qt-core (bug 258512)
79     if [[ $PN != "qt-core" ]]; then
80     use debug && QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK}
81     ~x11-libs/qt-core-${PV} debug"
82     fi
83    
84     # Check USE requirements
85     qt4-build_check_use
86     fi
87 caleb 1.1
88     PATH="${S}/bin:${PATH}"
89     LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}"
90 yngwin 1.20
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 gengor 1.31 ebeep 3
95 yngwin 1.20 fi
96 caleb 1.1 }
97    
98 hwoarang 1.34 # @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
111 yngwin 1.20 qt4-build_src_unpack() {
112 hwoarang 1.42 setqtenv
113 hwoarang 1.26 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 ingmar 1.11 src/{qbase,qt_targets,qt_install}.pri bin config.tests mkspecs qmake \
121 ingmar 1.13 ${QT4_EXTRACT_DIRECTORIES}; do
122 ingmar 1.11 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 yngwin 1.20 4.4.?)
130 ingmar 1.11 echo tar xjpf "${DISTDIR}"/${MY_P}-headers.tar.bz2
131     tar xjpf "${DISTDIR}"/${MY_P}-headers.tar.bz2
132     ;;
133     esac
134 yngwin 1.20
135     # Be backwards compatible for now
136     if [[ $EAPI != 2 ]]; then
137     qt4-build_src_prepare
138     fi
139 ingmar 1.11 }
140    
141 hwoarang 1.37 # @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 hwoarang 1.34
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.
154 yngwin 1.20 qt4-build_src_prepare() {
155 hwoarang 1.42 setqtenv
156 yngwin 1.20 cd "${S}"
157    
158 ingmar 1.7 if [[ ${PN} != qt-core ]]; then
159     skip_qmake_build_patch
160     skip_project_generation_patch
161     symlink_binaries_to_buildtree
162     fi
163 hwoarang 1.24
164 hwoarang 1.21 # 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 gengor 1.18 fi
169    
170 gengor 1.30 # Unsupported old gcc versions - hardened needs this :(
171 gengor 1.29 if [[ $(gcc-major-version) -lt "4" ]] ; then
172 gengor 1.30 ewarn "Appending -fno-stack-protector to CXXFLAGS"
173     append-cxxflags -fno-stack-protector
174     # Bug 253127
175 gengor 1.29 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 hwoarang 1.24 # Bug 172219
180 ingmar 1.7 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 yngwin 1.39
191 hwoarang 1.37 base_src_prepare
192 ingmar 1.7 }
193    
194 hwoarang 1.34 # @FUNCTION: qt4-build_src_configure
195     # @DESCRIPTION:
196     # Default configure phase
197 yngwin 1.20 qt4-build_src_configure() {
198 hwoarang 1.42 setqtenv
199 ingmar 1.7 myconf="$(standard_configure_options) ${myconf}"
200    
201     echo ./configure ${myconf}
202     ./configure ${myconf} || die "./configure failed"
203 tommy 1.43 myconf=""
204 yngwin 1.20 }
205 ingmar 1.7
206 hwoarang 1.34 # @FUNCTION: qt4-build_src_compile
207     # @DESCRIPTION: Actual compile phase
208 yngwin 1.20 qt4-build_src_compile() {
209 hwoarang 1.42 setqtenv
210 yngwin 1.20 # 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 caleb 1.1 }
217    
218 hwoarang 1.34 # @FUNCTION: qt4-build_src_install
219     # @DESCRIPTION:
220     # Perform the actual installation including some library fixes.
221 caleb 1.4 qt4-build_src_install() {
222 hwoarang 1.42 setqtenv
223 caleb 1.4 install_directories "${QT4_TARGET_DIRECTORIES}"
224 ingmar 1.7 install_qconfigs
225 caleb 1.4 fix_library_files
226     }
227    
228 hwoarang 1.42 # @FUNCTION: setqtenv
229     setqtenv() {
230     # Set up installation directories
231     QTBASEDIR=/usr/$(get_libdir)/qt4
232     QTPREFIXDIR=/usr
233     QTBINDIR=/usr/bin
234     QTLIBDIR=/usr/$(get_libdir)/qt4
235     QMAKE_LIBDIR_QT=${QTLIBDIR}
236     QTPCDIR=/usr/$(get_libdir)/pkgconfig
237     QTDATADIR=/usr/share/qt4
238     QTDOCDIR=/usr/share/doc/qt-${PV}
239     QTHEADERDIR=/usr/include/qt4
240     QTPLUGINDIR=${QTLIBDIR}/plugins
241     QTSYSCONFDIR=/etc/qt4
242     QTTRANSDIR=${QTDATADIR}/translations
243     QTEXAMPLESDIR=${QTDATADIR}/examples
244     QTDEMOSDIR=${QTDATADIR}/demos
245     QT_INSTALL_PREFIX=/usr/$(get_libdir)/qt4
246     PLATFORM=$(qt_mkspecs_dir)
247    
248     unset QMAKESPEC
249     }
250    
251 hwoarang 1.34 # @FUNCTION: standard_configure_options
252     # @DESCRIPTION:
253     # Sets up some standard configure options, like libdir (if necessary), whether
254     # debug info is wanted or not.
255 caleb 1.1 standard_configure_options() {
256     local myconf=""
257    
258 ingmar 1.7 [[ $(get_libdir) != "lib" ]] && myconf="${myconf} -L/usr/$(get_libdir)"
259 caleb 1.1
260     # Disable visibility explicitly if gcc version isn't 4
261 ingmar 1.7 if [[ "$(gcc-major-version)" -lt "4" ]]; then
262 caleb 1.1 myconf="${myconf} -no-reduce-exports"
263     fi
264    
265 ingmar 1.12 # precompiled headers doesn't work on hardened, where the flag is masked.
266     if use pch; then
267     myconf="${myconf} -pch"
268     else
269     myconf="${myconf} -no-pch"
270     fi
271    
272 ingmar 1.7 if use debug; then
273     myconf="${myconf} -debug -no-separate-debug-info"
274     else
275     myconf="${myconf} -release -no-separate-debug-info"
276     fi
277 caleb 1.1
278 yngwin 1.20 # ARCH is set on Gentoo. Qt now falls back to generic on an unsupported
279 flameeyes 1.27 # $(tc-arch). Therefore we convert it to supported values.
280     case "$(tc-arch)" in
281 ingmar 1.11 amd64) myconf="${myconf} -arch x86_64" ;;
282     ppc|ppc64) myconf="${myconf} -arch powerpc" ;;
283 ingmar 1.14 x86|x86-*) myconf="${myconf} -arch i386" ;;
284 flameeyes 1.27 alpha|arm|ia64|mips|s390|sparc) myconf="${myconf} -arch $(tc-arch)" ;;
285 ingmar 1.11 hppa|sh) myconf="${myconf} -arch generic" ;;
286 flameeyes 1.27 *) die "$(tc-arch) is unsupported by this eclass. Please file a bug." ;;
287 ingmar 1.11 esac
288    
289 hwoarang 1.38 myconf="${myconf} -platform $(qt_mkspecs_dir) -stl -verbose -largefile -confirm-license -no-rpath
290 ingmar 1.7 -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR}
291     -datadir ${QTDATADIR} -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR}
292     -plugindir ${QTPLUGINDIR} -sysconfdir ${QTSYSCONFDIR}
293     -translationdir ${QTTRANSDIR} -examplesdir ${QTEXAMPLESDIR}
294 yngwin 1.20 -demosdir ${QTDEMOSDIR} -silent -fast
295     $([[ ${PN} == qt-xmlpatterns ]] || echo -no-exceptions)
296 aballier 1.28 -reduce-relocations -nomake examples -nomake demos"
297 yngwin 1.39
298 hwoarang 1.32 # Make eclass 4.5.{1,2} ready
299     case "${MY_PV}" in
300     4.5.1 | 4.5.2)
301     myconf="${myconf} -opensource"
302     ;;
303     esac
304 caleb 1.1
305     echo "${myconf}"
306     }
307    
308 hwoarang 1.34 # @FUNCTION: build_directories
309     # @USAGE: < directories >
310     # @DESCRIPTION:
311     # Compiles the code in $QT4_TARGET_DIRECTORIES
312 caleb 1.1 build_directories() {
313     local dirs="$@"
314     for x in ${dirs}; do
315     cd "${S}"/${x}
316 hwoarang 1.42 sed -i -e "s:\$\$\[QT_INSTALL_LIBS\]:/usr/$(get_libdir)/qt4:g" $(find "${S}" -name '*.pr[io]') "${S}"/mkspecs/common/linux.conf || die
317 ingmar 1.7 "${S}"/bin/qmake "LIBS+=-L${QTLIBDIR}" "CONFIG+=nostrip" || die "qmake failed"
318     emake || die "emake failed"
319 caleb 1.1 done
320     }
321    
322 hwoarang 1.34 # @FUNCTION: install_directories
323     # @USAGE: < directories >
324     # @DESCRIPTION:
325     # run emake install in the given directories, which are separated by spaces
326 caleb 1.1 install_directories() {
327     local dirs="$@"
328     for x in ${dirs}; do
329 ingmar 1.7 pushd "${S}"/${x} >/dev/null || die "Can't pushd ${S}/${x}"
330     emake INSTALL_ROOT="${D}" install || die "emake install failed"
331     popd >/dev/null || die "Can't popd from ${S}/${x}"
332 caleb 1.1 done
333     }
334    
335 ingmar 1.7 # @ECLASS-VARIABLE: QCONFIG_ADD
336     # @DESCRIPTION:
337     # List options that need to be added to QT_CONFIG in qconfig.pri
338     QCONFIG_ADD="${QCONFIG_ADD:-}"
339    
340     # @ECLASS-VARIABLE: QCONFIG_REMOVE
341     # @DESCRIPTION:
342     # List options that need to be removed from QT_CONFIG in qconfig.pri
343     QCONFIG_REMOVE="${QCONFIG_REMOVE:-}"
344    
345     # @ECLASS-VARIABLE: QCONFIG_DEFINE
346     # @DESCRIPTION:
347     # List variables that should be defined at the top of QtCore/qconfig.h
348     QCONFIG_DEFINE="${QCONFIG_DEFINE:-}"
349    
350 hwoarang 1.34 # @FUNCTION: install_qconfigs
351     # @DESCRIPTION: Install gentoo-specific mkspecs configurations
352 ingmar 1.7 install_qconfigs() {
353 zlin 1.9 local x
354     if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} ]]; then
355 ingmar 1.7 for x in QCONFIG_ADD QCONFIG_REMOVE; do
356     [[ -n ${!x} ]] && echo ${x}=${!x} >> "${T}"/${PN}-qconfig.pri
357     done
358     insinto ${QTDATADIR}/mkspecs/gentoo
359     doins "${T}"/${PN}-qconfig.pri || die "installing ${PN}-qconfig.pri failed"
360 zlin 1.9 fi
361 ingmar 1.7
362 zlin 1.9 if [[ -n ${QCONFIG_DEFINE} ]]; then
363 ingmar 1.7 for x in ${QCONFIG_DEFINE}; do
364     echo "#define ${x}" >> "${T}"/gentoo-${PN}-qconfig.h
365     done
366     insinto ${QTHEADERDIR}/Gentoo
367     doins "${T}"/gentoo-${PN}-qconfig.h || die "installing ${PN}-qconfig.h failed"
368     fi
369     }
370    
371 hwoarang 1.34 # @FUNCTION: generate_qconfigs
372     # @DESCRIPTION: Generates gentoo-specific configurations
373 ingmar 1.7 generate_qconfigs() {
374     if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} || -n ${QCONFIG_DEFINE} || ${CATEGORY}/${PN} == x11-libs/qt-core ]]; then
375     local x qconfig_add qconfig_remove qconfig_new
376     for x in "${ROOT}${QTDATADIR}"/mkspecs/gentoo/*-qconfig.pri; do
377     [[ -f ${x} ]] || continue
378     qconfig_add="${qconfig_add} $(sed -n 's/^QCONFIG_ADD=//p' "${x}")"
379     qconfig_remove="${qconfig_remove} $(sed -n 's/^QCONFIG_REMOVE=//p' "${x}")"
380     done
381    
382     # these error checks do not use die because dying in pkg_post{inst,rm}
383     # just makes things worse.
384     if [[ -e "${ROOT}${QTDATADIR}"/mkspecs/gentoo/qconfig.pri ]]; then
385     # start with the qconfig.pri that qt-core installed
386     if ! cp "${ROOT}${QTDATADIR}"/mkspecs/gentoo/qconfig.pri \
387     "${ROOT}${QTDATADIR}"/mkspecs/qconfig.pri; then
388     eerror "cp qconfig failed."
389     return 1
390     fi
391    
392     # generate list of QT_CONFIG entries from the existing list
393     # including qconfig_add and excluding qconfig_remove
394     for x in $(sed -n 's/^QT_CONFIG +=//p' \
395     "${ROOT}${QTDATADIR}"/mkspecs/qconfig.pri) ${qconfig_add}; do
396     hasq ${x} ${qconfig_remove} || qconfig_new="${qconfig_new} ${x}"
397     done
398    
399     # replace the existing QT_CONFIG list with qconfig_new
400     if ! sed -i -e "s/QT_CONFIG +=.*/QT_CONFIG += ${qconfig_new}/" \
401     "${ROOT}${QTDATADIR}"/mkspecs/qconfig.pri; then
402     eerror "Sed for QT_CONFIG failed"
403     return 1
404     fi
405    
406     # create Gentoo/qconfig.h
407     if [[ ! -e ${ROOT}${QTHEADERDIR}/Gentoo ]]; then
408     if ! mkdir -p "${ROOT}${QTHEADERDIR}"/Gentoo; then
409     eerror "mkdir ${QTHEADERDIR}/Gentoo failed"
410     return 1
411     fi
412     fi
413     : > "${ROOT}${QTHEADERDIR}"/Gentoo/gentoo-qconfig.h
414     for x in "${ROOT}${QTHEADERDIR}"/Gentoo/gentoo-*-qconfig.h; do
415     [[ -f ${x} ]] || continue
416     cat "${x}" >> "${ROOT}${QTHEADERDIR}"/Gentoo/gentoo-qconfig.h
417     done
418     else
419     rm -f "${ROOT}${QTDATADIR}"/mkspecs/qconfig.pri
420     rm -f "${ROOT}${QTHEADERDIR}"/Gentoo/gentoo-qconfig.h
421     rmdir "${ROOT}${QTDATADIR}"/mkspecs \
422     "${ROOT}${QTDATADIR}" \
423     "${ROOT}${QTHEADERDIR}"/Gentoo \
424     "${ROOT}${QTHEADERDIR}" 2>/dev/null
425     fi
426     fi
427     }
428    
429 hwoarang 1.34 # @FUNCTION: qt4-build_pkg_postrm
430     # @DESCRIPTION: Generate configurations when the package is completely removed
431 ingmar 1.7 qt4-build_pkg_postrm() {
432     generate_qconfigs
433 caleb 1.1 }
434    
435 hwoarang 1.34 # @FUNCTION: qt4-build_pkg_postinst
436     # @DESCRIPTION: Generate configuration, plus throws a message about possible
437     # breakages and proposed solutions.
438 ingmar 1.7 qt4-build_pkg_postinst() {
439     generate_qconfigs
440 yngwin 1.17 echo
441     ewarn "After a rebuild or upgrade of Qt, it can happen that Qt plugins (such as Qt"
442     ewarn "and KDE styles and widgets) can no longer be loaded. In this situation you"
443     ewarn "should recompile the packages providing these plugins. Also, make sure you"
444     ewarn "compile the Qt packages, and the packages that depend on it, with the same"
445     ewarn "GCC version and the same USE flag settings (especially the debug flag)."
446     ewarn
447     ewarn "Packages that typically need to be recompiled are kdelibs from KDE4, any"
448     ewarn "additional KDE4/Qt4 styles, qscintilla and PyQt4. Before filing a bug report,"
449     ewarn "make sure all your Qt4 packages are up-to-date and built with the same"
450     ewarn "configuration."
451     ewarn
452 hwoarang 1.41 ewarn "For more information, see http://doc.trolltech.com/${PV%.*}/plugins-howto.html"
453 yngwin 1.17 echo
454 caleb 1.1 }
455    
456 hwoarang 1.34 # @FUNCTION: skip_qmake_build_patch
457     # @DESCRIPTION:
458     # Don't need to build qmake, as it's already installed from qt-core
459 caleb 1.1 skip_qmake_build_patch() {
460 ingmar 1.7 # Don't need to build qmake, as it's already installed from qt-core
461     sed -i -e "s:if true:if false:g" "${S}"/configure || die "Sed failed"
462 caleb 1.1 }
463    
464 hwoarang 1.34 # @FUNCTION: skip_project_generation_patch
465     # @DESCRIPTION:
466     # Exit the script early by throwing in an exit before all of the .pro files are scanned
467 caleb 1.1 skip_project_generation_patch() {
468     # Exit the script early by throwing in an exit before all of the .pro files are scanned
469 ingmar 1.7 sed -e "s:echo \"Finding:exit 0\n\necho \"Finding:g" \
470     -i "${S}"/configure || die "Sed failed"
471 caleb 1.1 }
472    
473 hwoarang 1.34 # @FUNCTION: symlink_binaries_to_buildtree
474     # @DESCRIPTION:
475     # Symlink generated binaries to buildtree so they can be used during compilation
476     # time
477 ingmar 1.7 symlink_binaries_to_buildtree() {
478     for bin in qmake moc uic rcc; do
479     ln -s ${QTBINDIR}/${bin} "${S}"/bin/ || die "Symlinking ${bin} to ${S}/bin failed."
480     done
481 caleb 1.1 }
482    
483 hwoarang 1.34 # @FUNCTION: fix_library_files
484     # @DESCRIPTION:
485     # Fixes the pathes in *.la, *.prl, *.pc, as they are wrong due to sandbox and
486     # moves the *.pc-files into the pkgconfig directory
487 caleb 1.1 fix_library_files() {
488 ingmar 1.7 for libfile in "${D}"/${QTLIBDIR}/{*.la,*.prl,pkgconfig/*.pc}; do
489     if [[ -e ${libfile} ]]; then
490     sed -i -e "s:${S}/lib:${QTLIBDIR}:g" ${libfile} || die "Sed on ${libfile} failed."
491     fi
492     done
493 caleb 1.1
494     # pkgconfig files refer to WORKDIR/bin as the moc and uic locations. Fix:
495 ingmar 1.7 for libfile in "${D}"/${QTLIBDIR}/pkgconfig/*.pc; do
496     if [[ -e ${libfile} ]]; then
497     sed -i -e "s:${S}/bin:${QTBINDIR}:g" ${libfile} || die "Sed failed"
498 caleb 1.1
499     # Move .pc files into the pkgconfig directory
500 ingmar 1.7 dodir ${QTPCDIR}
501     mv ${libfile} "${D}"/${QTPCDIR}/ \
502     || die "Moving ${libfile} to ${D}/${QTPCDIR}/ failed."
503     fi
504     done
505    
506     # Don't install an empty directory
507     rmdir "${D}"/${QTLIBDIR}/pkgconfig
508 caleb 1.1 }
509    
510 hwoarang 1.34 # @FUNCTION: qt_use
511     # @USAGE: < flag > [ feature ] [ enableval ]
512 yngwin 1.39 # @DESCRIPTION:
513 hwoarang 1.34 # This will echo "${enableval}-${feature}" if <flag> is enabled, or
514     # "-no-${feature} if the flag is disabled. If [feature] is not specified <flag>
515     # will be used for that. If [enableval] is not specified, it omits the
516     # assignment-part
517 caleb 1.1 qt_use() {
518 ingmar 1.7 local flag="${1}"
519     local feature="${1}"
520 caleb 1.5 local enableval=
521 caleb 1.1
522 ingmar 1.7 [[ -n ${2} ]] && feature=${2}
523     [[ -n ${3} ]] && enableval="-${3}"
524    
525     if use ${flag}; then
526     echo "${enableval}-${feature}"
527     else
528     echo "-no-${feature}"
529     fi
530     }
531    
532     # @ECLASS-VARIABLE: QT4_BUILT_WITH_USE_CHECK
533     # @DESCRIPTION:
534     # The contents of $QT4_BUILT_WITH_USE_CHECK gets fed to built_with_use
535     # (eutils.eclass), line per line.
536     #
537     # Example:
538     # @CODE
539     # pkg_setup() {
540     # use qt3support && QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK}
541     # ~x11-libs/qt-gui-${PV} qt3support"
542     # qt4-build_check_use
543     # }
544     # @CODE
545    
546     # Run built_with_use on each flag and print appropriate error messages if any
547     # flags are missing
548 hwoarang 1.34
549 ingmar 1.7 _qt_built_with_use() {
550     local missing opt pkg flag flags
551 caleb 1.1
552 ingmar 1.7 if [[ ${1} = "--missing" ]]; then
553     missing="${1} ${2}" && shift 2
554     fi
555     if [[ ${1:0:1} = "-" ]]; then
556     opt=${1} && shift
557     fi
558    
559     pkg=${1} && shift
560    
561     for flag in "${@}"; do
562     flags="${flags} ${flag}"
563     if ! built_with_use ${missing} ${opt} ${pkg} ${flag}; then
564     flags="${flags}*"
565     else
566     [[ ${opt} = "-o" ]] && return 0
567     fi
568     done
569     if [[ "${flags# }" = "${@}" ]]; then
570     return 0
571     fi
572     if [[ ${opt} = "-o" ]]; then
573     eerror "This package requires '${pkg}' to be built with any of the following USE flags: '$*'."
574     else
575     eerror "This package requires '${pkg}' to be built with the following USE flags: '${flags# }'."
576     fi
577     return 1
578     }
579    
580     # @FUNCTION: qt4-build_check_use
581     # @DESCRIPTION:
582     # Check if the listed packages in $QT4_BUILT_WITH_USE_CHECK are built with the
583     # USE flags listed.
584     #
585     # If any of the required USE flags are missing, an eerror will be printed for
586     # each package with missing USE flags.
587     qt4-build_check_use() {
588     local line missing
589     while read line; do
590     [[ -z ${line} ]] && continue
591     if ! _qt_built_with_use ${line}; then
592     missing=true
593     fi
594     done <<< "${QT4_BUILT_WITH_USE_CHECK}"
595     if [[ -n ${missing} ]]; then
596     echo
597     eerror "Flags marked with an * are missing."
598     die "Missing USE flags found"
599     fi
600 caleb 1.1 }
601    
602 hwoarang 1.34 # @FUNCTION: qt_mkspecs_dir
603     # @RETURN: the specs-directory w/o path
604 yngwin 1.39 # @DESCRIPTION:
605 hwoarang 1.34 # Allows us to define which mkspecs dir we want to use.
606 caleb 1.1 qt_mkspecs_dir() {
607 caleb 1.5 # Allows us to define which mkspecs dir we want to use.
608     local spec
609 caleb 1.1
610 caleb 1.5 case ${CHOST} in
611     *-freebsd*|*-dragonfly*)
612     spec="freebsd" ;;
613     *-openbsd*)
614     spec="openbsd" ;;
615     *-netbsd*)
616     spec="netbsd" ;;
617 ingmar 1.7 *-darwin*)
618 caleb 1.5 spec="darwin" ;;
619     *-linux-*|*-linux)
620     spec="linux" ;;
621     *)
622 ingmar 1.7 die "Unknown CHOST, no platform choosen."
623 caleb 1.5 esac
624    
625     CXX=$(tc-getCXX)
626     if [[ ${CXX/g++/} != ${CXX} ]]; then
627     spec="${spec}-g++"
628     elif [[ ${CXX/icpc/} != ${CXX} ]]; then
629     spec="${spec}-icc"
630     else
631     die "Unknown compiler ${CXX}."
632     fi
633 hwoarang 1.42 if [[ -n "${LIBDIR/lib}" ]]; then
634     spec="${spec}-${LIBDIR/lib}"
635     fi
636 caleb 1.1
637 caleb 1.5 echo "${spec}"
638 caleb 1.1 }
639    
640 yngwin 1.20 case ${EAPI:-0} in
641     0|1) EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postrm pkg_postinst ;;
642     2) EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_install pkg_postrm pkg_postinst ;;
643     esac

  ViewVC Help
Powered by ViewVC 1.1.20