/[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.10 Revision 1.24
1# Copyright 2007-2008 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.10 2008/03/11 16:39:43 ingmar Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/qt4-build.eclass,v 1.24 2009/02/15 00:11:50 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>
8# Markos Chandras <hwoarang@gentoo.org>
7# Caleb Tennis <caleb@gentoo.org> 9# Caleb Tennis <caleb@gentoo.org>
8# @BLURB: Eclass for Qt4 split ebuilds. 10# @BLURB: Eclass for Qt4 split ebuilds.
9# @DESCRIPTION: 11# @DESCRIPTION:
10# This eclass contains various functions that are used when building Qt4 12# This eclass contains various functions that are used when building Qt4
11 13
12inherit eutils multilib toolchain-funcs flag-o-matic 14inherit eutils multilib toolchain-funcs flag-o-matic versionator
13 15
14IUSE="${IUSE} debug" 16IUSE="${IUSE} custom-cxxflags debug pch"
15 17
16case "${PV}" in 18case "${PV}" in
17 4.4.0_beta*) 19 4.?.?_rc*)
18 SRCTYPE="${SRCTYPE:-opensource-src}" 20 SRCTYPE="${SRCTYPE:-opensource-src}"
19 MY_PV="${PV/_beta/-beta}" 21 MY_PV="${PV/_rc/-rc}"
20 ;; 22 ;;
21 *) 23 *)
22 SRCTYPE="${SRCTYPE:-opensource-src}" 24 SRCTYPE="${SRCTYPE:-opensource-src}"
23 MY_PV="${PV}" 25 MY_PV="${PV}"
24 ;; 26 ;;
25esac 27esac
26S=${WORKDIR}/qt-x11-${SRCTYPE}-${MY_PV} 28MY_P=qt-x11-${SRCTYPE}-${MY_PV}
29S=${WORKDIR}/${MY_P}
27 30
31HOMEPAGE="http://www.qtsoftware.com/"
28SRC_URI="ftp://ftp.trolltech.com/qt/source/qt-x11-${SRCTYPE}-${MY_PV}.tar.bz2" 32SRC_URI="ftp://ftp.trolltech.com/qt/source/${MY_P}.tar.bz2"
33
34case "${PV}" in
35 4.4.?) SRC_URI="${SRC_URI} mirror://gentoo/${MY_P}-headers.tar.bz2" ;;
36 *) ;;
37esac
29 38
30qt4-build_pkg_setup() { 39qt4-build_pkg_setup() {
40 # EAPI=2 ebuilds set use-deps, others need this:
41 if [[ $EAPI != 2 ]]; then
42 # Make sure debug setting corresponds with qt-core (bug 258512)
43 if [[ $PN != "qt-core" ]]; then
44 use debug && QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK}
45 ~x11-libs/qt-core-${PV} debug"
46 fi
47
31 # Check USE requirements 48 # Check USE requirements
32 qt4-build_check_use 49 qt4-build_check_use
50 fi
33 51
34 # Set up installation directories 52 # Set up installation directories
35 QTBASEDIR=/usr/$(get_libdir)/qt4 53 QTBASEDIR=/usr/$(get_libdir)/qt4
36 QTPREFIXDIR=/usr 54 QTPREFIXDIR=/usr
37 QTBINDIR=/usr/bin 55 QTBINDIR=/usr/bin
48 66
49 PLATFORM=$(qt_mkspecs_dir) 67 PLATFORM=$(qt_mkspecs_dir)
50 68
51 PATH="${S}/bin:${PATH}" 69 PATH="${S}/bin:${PATH}"
52 LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}" 70 LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}"
71
72 if ! version_is_at_least 4.1 $(gcc-version) ; then
73 ewarn "Using a GCC version lower than 4.1 is not supported!"
74 echo
75 ebeep 5
76 fi
77
78 if use custom-cxxflags; then
79 echo
80 ewarn "You have set USE=custom-cxxflags, which means Qt will be built with the"
81 ewarn "CXXFLAGS you have set in /etc/make.conf. This is not supported, and we"
82 ewarn "recommend to unset this useflag. But you are free to experiment with it."
83 ewarn "Just do not start crying if it breaks your system, or eats your kitten"
84 ewarn "for breakfast. ;-) "
85 echo
86 fi
87
53} 88}
54 89
55qt4-build_src_unpack() { 90qt4-build_src_unpack() {
56 # TODO: partial unpacks, cfr split KDE ebuilds. 91 local target targets
57 unpack ${A} 92 for target in configure LICENSE.{GPL2,GPL3} projects.pro \
93 src/{qbase,qt_targets,qt_install}.pri bin config.tests mkspecs qmake \
94 ${QT4_EXTRACT_DIRECTORIES}; do
95 targets="${targets} ${MY_P}/${target}"
96 done
97
98 echo tar xjpf "${DISTDIR}"/${MY_P}.tar.bz2 ${targets}
99 tar xjpf "${DISTDIR}"/${MY_P}.tar.bz2 ${targets}
100
101 case "${PV}" in
102 4.4.?)
103 echo tar xjpf "${DISTDIR}"/${MY_P}-headers.tar.bz2
104 tar xjpf "${DISTDIR}"/${MY_P}-headers.tar.bz2
105 ;;
106 esac
107
108 # Be backwards compatible for now
109 if [[ $EAPI != 2 ]]; then
110 qt4-build_src_prepare
111 fi
112}
113
114qt4-build_src_prepare() {
58 cd "${S}" 115 cd "${S}"
59 116
60 if [[ ${PN} != qt-core ]]; then 117 if [[ ${PN} != qt-core ]]; then
61 skip_qmake_build_patch 118 skip_qmake_build_patch
62 skip_project_generation_patch 119 skip_project_generation_patch
63 symlink_binaries_to_buildtree 120 symlink_binaries_to_buildtree
64 fi 121 fi
65 122
123 if ! use custom-cxxflags;then
124 # Don't let the user go too overboard with flags.
125 strip-flags
126 replace-flags -O3 -O2
127 fi
128
129 # Bug 253127
130 # Unsupported old gcc versions - hardened needs this :(
131 if [[ $(gcc-major-version) -lt "4" ]] ; then
132 ewarn "Appending -fno-stack-protector to CXXFLAGS"
133 append-cxxflags -fno-stack-protector
134 fi
135
136 # Bug 178652
137 if [[ "$(gcc-major-version)" == "3" ]] && use amd64; then
138 ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS"
139 append-flags -fno-gcse
140 fi
141
142 # Bug 172219
66 sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \ 143 sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \
67 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \ 144 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \
68 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \ 145 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
69 -e "s:X11R6/::" \ 146 -e "s:X11R6/::" \
70 -i "${S}"/mkspecs/$(qt_mkspecs_dir)/qmake.conf || die "sed ${S}/mkspecs/$(qt_mkspecs_dir)/qmake.conf failed" 147 -i "${S}"/mkspecs/$(qt_mkspecs_dir)/qmake.conf || die "sed ${S}/mkspecs/$(qt_mkspecs_dir)/qmake.conf failed"
71 148
72 sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \ 149 sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \
73 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \ 150 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \
74 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \ 151 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
75 -i "${S}"/mkspecs/common/g++.conf || die "sed ${S}/mkspecs/common/g++.conf failed" 152 -i "${S}"/mkspecs/common/g++.conf || die "sed ${S}/mkspecs/common/g++.conf failed"
76}
77 153
154}
155
78qt4-build_src_compile() { 156qt4-build_src_configure() {
79 # Don't let the user go too overboard with flags. If you really want to, uncomment
80 # out the line below and give 'er a whirl.
81 strip-flags
82 replace-flags -O3 -O2
83
84 if [[ $(gcc-fullversion) == "3.4.6" && gcc-specs-ssp ]] ; then
85 ewarn "Appending -fno-stack-protector to CFLAGS/CXXFLAGS"
86 append-flags -fno-stack-protector
87 fi
88
89 # Bug 178652
90 if [[ "$(gcc-major-version)" == "3" ]] && use amd64; then
91 ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS"
92 append-flags -fno-gcse
93 fi
94 157
95 myconf="$(standard_configure_options) ${myconf}" 158 myconf="$(standard_configure_options) ${myconf}"
96 159
97 echo ./configure ${myconf} 160 echo ./configure ${myconf}
98 ./configure ${myconf} || die "./configure failed" 161 ./configure ${myconf} || die "./configure failed"
162}
99 163
100 build_target_directories 164qt4-build_src_compile() {
165 # Be backwards compatible for now
166 if [[ $EAPI != 2 ]]; then
167 qt4-build_src_configure
168 fi
169
170 build_directories "${QT4_TARGET_DIRECTORIES}"
101} 171}
102 172
103qt4-build_src_install() { 173qt4-build_src_install() {
104 install_directories "${QT4_TARGET_DIRECTORIES}" 174 install_directories "${QT4_TARGET_DIRECTORIES}"
105 install_qconfigs 175 install_qconfigs
114 # Disable visibility explicitly if gcc version isn't 4 184 # Disable visibility explicitly if gcc version isn't 4
115 if [[ "$(gcc-major-version)" -lt "4" ]]; then 185 if [[ "$(gcc-major-version)" -lt "4" ]]; then
116 myconf="${myconf} -no-reduce-exports" 186 myconf="${myconf} -no-reduce-exports"
117 fi 187 fi
118 188
189 # precompiled headers doesn't work on hardened, where the flag is masked.
190 if use pch; then
191 myconf="${myconf} -pch"
192 else
193 myconf="${myconf} -no-pch"
194 fi
195
119 if use debug; then 196 if use debug; then
120 myconf="${myconf} -debug -no-separate-debug-info" 197 myconf="${myconf} -debug -no-separate-debug-info"
121 else 198 else
122 myconf="${myconf} -release -no-separate-debug-info" 199 myconf="${myconf} -release -no-separate-debug-info"
123 fi 200 fi
201
202 # ARCH is set on Gentoo. Qt now falls back to generic on an unsupported
203 # ${ARCH}. Therefore we convert it to supported values.
204 case "${ARCH}" in
205 amd64) myconf="${myconf} -arch x86_64" ;;
206 ppc|ppc64) myconf="${myconf} -arch powerpc" ;;
207 x86|x86-*) myconf="${myconf} -arch i386" ;;
208 alpha|arm|ia64|mips|s390|sparc) myconf="${myconf} -arch ${ARCH}" ;;
209 hppa|sh) myconf="${myconf} -arch generic" ;;
210 *) die "${ARCH} is unsupported by this eclass. Please file a bug." ;;
211 esac
124 212
125 myconf="${myconf} -stl -verbose -largefile -confirm-license -no-rpath 213 myconf="${myconf} -stl -verbose -largefile -confirm-license -no-rpath
126 -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} 214 -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR}
127 -datadir ${QTDATADIR} -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} 215 -datadir ${QTDATADIR} -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR}
128 -plugindir ${QTPLUGINDIR} -sysconfdir ${QTSYSCONFDIR} 216 -plugindir ${QTPLUGINDIR} -sysconfdir ${QTSYSCONFDIR}
129 -translationdir ${QTTRANSDIR} -examplesdir ${QTEXAMPLESDIR} 217 -translationdir ${QTTRANSDIR} -examplesdir ${QTEXAMPLESDIR}
130 -demosdir ${QTDEMOSDIR} -silent -fast -reduce-relocations 218 -demosdir ${QTDEMOSDIR} -silent -fast
219 $([[ ${PN} == qt-xmlpatterns ]] || echo -no-exceptions)
220 $(use x86-fbsd || echo -reduce-relocations)
131 -nomake examples -nomake demos" 221 -nomake examples -nomake demos"
132 222
133 echo "${myconf}" 223 echo "${myconf}"
134}
135
136build_target_directories() {
137 build_directories "${QT4_TARGET_DIRECTORIES}"
138} 224}
139 225
140build_directories() { 226build_directories() {
141 local dirs="$@" 227 local dirs="$@"
142 for x in ${dirs}; do 228 for x in ${dirs}; do
186 done 272 done
187 insinto ${QTHEADERDIR}/Gentoo 273 insinto ${QTHEADERDIR}/Gentoo
188 doins "${T}"/gentoo-${PN}-qconfig.h || die "installing ${PN}-qconfig.h failed" 274 doins "${T}"/gentoo-${PN}-qconfig.h || die "installing ${PN}-qconfig.h failed"
189 fi 275 fi
190} 276}
191
192# Stubs for functions used by the Qt 4.4.0_technical_preview_1.
193qconfig_add_option() { : ; }
194qconfig_remove_option() { : ; }
195 277
196generate_qconfigs() { 278generate_qconfigs() {
197 if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} || -n ${QCONFIG_DEFINE} || ${CATEGORY}/${PN} == x11-libs/qt-core ]]; then 279 if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} || -n ${QCONFIG_DEFINE} || ${CATEGORY}/${PN} == x11-libs/qt-core ]]; then
198 local x qconfig_add qconfig_remove qconfig_new 280 local x qconfig_add qconfig_remove qconfig_new
199 for x in "${ROOT}${QTDATADIR}"/mkspecs/gentoo/*-qconfig.pri; do 281 for x in "${ROOT}${QTDATADIR}"/mkspecs/gentoo/*-qconfig.pri; do
253 generate_qconfigs 335 generate_qconfigs
254} 336}
255 337
256qt4-build_pkg_postinst() { 338qt4-build_pkg_postinst() {
257 generate_qconfigs 339 generate_qconfigs
340 echo
341 ewarn "After a rebuild or upgrade of Qt, it can happen that Qt plugins (such as Qt"
342 ewarn "and KDE styles and widgets) can no longer be loaded. In this situation you"
343 ewarn "should recompile the packages providing these plugins. Also, make sure you"
344 ewarn "compile the Qt packages, and the packages that depend on it, with the same"
345 ewarn "GCC version and the same USE flag settings (especially the debug flag)."
346 ewarn
347 ewarn "Packages that typically need to be recompiled are kdelibs from KDE4, any"
348 ewarn "additional KDE4/Qt4 styles, qscintilla and PyQt4. Before filing a bug report,"
349 ewarn "make sure all your Qt4 packages are up-to-date and built with the same"
350 ewarn "configuration."
351 ewarn
352 ewarn "For more information, see http://doc.trolltech.com/4.4/plugins-howto.html"
353 echo
258} 354}
259 355
260skip_qmake_build_patch() { 356skip_qmake_build_patch() {
261 # Don't need to build qmake, as it's already installed from qt-core 357 # Don't need to build qmake, as it's already installed from qt-core
262 sed -i -e "s:if true:if false:g" "${S}"/configure || die "Sed failed" 358 sed -i -e "s:if true:if false:g" "${S}"/configure || die "Sed failed"
411 fi 507 fi
412 508
413 echo "${spec}" 509 echo "${spec}"
414} 510}
415 511
512case ${EAPI:-0} in
416EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postrm pkg_postinst 513 0|1) EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postrm pkg_postinst ;;
514 2) EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_install pkg_postrm pkg_postinst ;;
515esac

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.24

  ViewVC Help
Powered by ViewVC 1.1.20