/[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.7 Revision 1.18
1# Copyright 2007-2008 Gentoo Foundation 1# Copyright 2007-2008 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.7 2008/03/05 23:06:26 ingmar Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/qt4-build.eclass,v 1.18 2009/01/21 08:55:28 gengor Exp $
4 4
5# @ECLASS: qt4-build.eclass 5# @ECLASS: qt4-build.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Caleb Tennis <caleb@gentoo.org> 7# Caleb Tennis <caleb@gentoo.org>
8# @BLURB: 8# @BLURB: Eclass for Qt4 split ebuilds.
9# Eclass for Qt4
10# @DESCRIPTION: 9# @DESCRIPTION:
11# This eclass contains various functions that are used when building Qt4 10# This eclass contains various functions that are used when building Qt4
12 11
13inherit eutils multilib toolchain-funcs flag-o-matic 12inherit eutils multilib toolchain-funcs flag-o-matic
14 13
15IUSE="${IUSE} debug" 14IUSE="${IUSE} debug pch"
16 15
17case "${PV}" in 16case "${PV}" in
18 4.4.0_beta*) 17 4.4.0_beta*)
19 SRCTYPE="${SRCTYPE:-opensource-src}" 18 SRCTYPE="${SRCTYPE:-opensource-src}"
20 MY_PV="${PV/_beta/-beta}" 19 MY_PV="${PV/_beta/-beta}"
20 ;;
21 4.4.0_rc*)
22 SRCTYPE="${SRCTYPE:-opensource-src}"
23 MY_PV="${PV/_rc/-rc}"
21 ;; 24 ;;
22 *) 25 *)
23 SRCTYPE="${SRCTYPE:-opensource-src}" 26 SRCTYPE="${SRCTYPE:-opensource-src}"
24 MY_PV="${PV}" 27 MY_PV="${PV}"
25 ;; 28 ;;
26esac 29esac
27S=${WORKDIR}/qt-x11-${SRCTYPE}-${MY_PV} 30MY_P=qt-x11-${SRCTYPE}-${MY_PV}
31S=${WORKDIR}/${MY_P}
28 32
29SRC_URI="ftp://ftp.trolltech.com/qt/source/qt-x11-${SRCTYPE}-${MY_PV}.tar.bz2" 33SRC_URI="ftp://ftp.trolltech.com/qt/source/${MY_P}.tar.bz2"
34
35case "${PV}" in
36 4.4.2|4.4.1|4.4.0|4.4.0_rc*)
37 SRC_URI="${SRC_URI} mirror://gentoo/${MY_P}-headers.tar.bz2"
38 ;;
39 *)
40 ;;
41esac
30 42
31qt4-build_pkg_setup() { 43qt4-build_pkg_setup() {
32 # Check USE requirements 44 # Check USE requirements
33 qt4-build_check_use 45 qt4-build_check_use
34 46
51 63
52 PATH="${S}/bin:${PATH}" 64 PATH="${S}/bin:${PATH}"
53 LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}" 65 LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}"
54} 66}
55 67
68qt4_unpack() {
69 local target targets
70 for target in configure LICENSE.{GPL2,GPL3} projects.pro \
71 src/{qbase,qt_targets,qt_install}.pri bin config.tests mkspecs qmake \
72 ${QT4_EXTRACT_DIRECTORIES}; do
73 targets="${targets} ${MY_P}/${target}"
74 done
75
76 echo tar xjpf "${DISTDIR}"/${MY_P}.tar.bz2 ${targets}
77 tar xjpf "${DISTDIR}"/${MY_P}.tar.bz2 ${targets}
78
79 case "${PV}" in
80 4.4.2|4.4.1|4.4.0|4.4.0_rc*)
81 echo tar xjpf "${DISTDIR}"/${MY_P}-headers.tar.bz2
82 tar xjpf "${DISTDIR}"/${MY_P}-headers.tar.bz2
83 ;;
84 esac
85}
86
56qt4-build_src_unpack() { 87qt4-build_src_unpack() {
57 # TODO: partial unpacks, cfr split KDE ebuilds. 88 qt4_unpack
58 unpack ${A}
59 cd "${S}"
60
61 if [[ ${PN} != qt-core ]]; then 89 if [[ ${PN} != qt-core ]]; then
90 cd "${S}"
62 skip_qmake_build_patch 91 skip_qmake_build_patch
63 skip_project_generation_patch 92 skip_project_generation_patch
64 symlink_binaries_to_buildtree 93 symlink_binaries_to_buildtree
94 fi
95
96 # Bug 253127
97 if [[ $(gcc-major-version) -lt "4" ]] ; then
98 sed -e "/^QMAKE_CFLAGS\t/ s:$: -fno-stack-protector-all:" \
99 -i "${S}"/mkspecs/common/g++.conf || die "sed ${S}/mkspecs/common/g++.conf failed"
65 fi 100 fi
66 101
67 sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \ 102 sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \
68 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \ 103 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \
69 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \ 104 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
80 # Don't let the user go too overboard with flags. If you really want to, uncomment 115 # Don't let the user go too overboard with flags. If you really want to, uncomment
81 # out the line below and give 'er a whirl. 116 # out the line below and give 'er a whirl.
82 strip-flags 117 strip-flags
83 replace-flags -O3 -O2 118 replace-flags -O3 -O2
84 119
85 if [[ $(gcc-fullversion) == "3.4.6" && gcc-specs-ssp ]] ; then 120 if [[ $(gcc-major-version) -lt "4" ]] ; then
86 ewarn "Appending -fno-stack-protector to CFLAGS/CXXFLAGS" 121 ewarn "Appending -fno-stack-protector to CXXFLAGS"
87 append-flags -fno-stack-protector 122 append-cxxflags -fno-stack-protector
123 fi
124
125 # Bug 178652
126 if [[ "$(gcc-major-version)" == "3" ]] && use amd64; then
127 ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS"
128 append-flags -fno-gcse
88 fi 129 fi
89 130
90 myconf="$(standard_configure_options) ${myconf}" 131 myconf="$(standard_configure_options) ${myconf}"
91 132
92 echo ./configure ${myconf} 133 echo ./configure ${myconf}
109 # Disable visibility explicitly if gcc version isn't 4 150 # Disable visibility explicitly if gcc version isn't 4
110 if [[ "$(gcc-major-version)" -lt "4" ]]; then 151 if [[ "$(gcc-major-version)" -lt "4" ]]; then
111 myconf="${myconf} -no-reduce-exports" 152 myconf="${myconf} -no-reduce-exports"
112 fi 153 fi
113 154
155 # precompiled headers doesn't work on hardened, where the flag is masked.
156 if use pch; then
157 myconf="${myconf} -pch"
158 else
159 myconf="${myconf} -no-pch"
160 fi
161
114 if use debug; then 162 if use debug; then
115 myconf="${myconf} -debug -no-separate-debug-info" 163 myconf="${myconf} -debug -no-separate-debug-info"
116 else 164 else
117 myconf="${myconf} -release -no-separate-debug-info" 165 myconf="${myconf} -release -no-separate-debug-info"
118 fi 166 fi
167
168 # ARCH is set on Gentoo. QT now falls back to generic on an unsupported
169 # ${ARCH}. Therefore we convert it to supported values.
170 case "${ARCH}" in
171 amd64) myconf="${myconf} -arch x86_64" ;;
172 ppc|ppc64) myconf="${myconf} -arch powerpc" ;;
173 x86|x86-*) myconf="${myconf} -arch i386" ;;
174 alpha|arm|ia64|mips|s390|sparc) myconf="${myconf} -arch ${ARCH}" ;;
175 hppa|sh) myconf="${myconf} -arch generic" ;;
176 *) die "${ARCH} is unsupported by this eclass. Please file a bug." ;;
177 esac
119 178
120 myconf="${myconf} -stl -verbose -largefile -confirm-license -no-rpath 179 myconf="${myconf} -stl -verbose -largefile -confirm-license -no-rpath
121 -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} 180 -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR}
122 -datadir ${QTDATADIR} -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} 181 -datadir ${QTDATADIR} -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR}
123 -plugindir ${QTPLUGINDIR} -sysconfdir ${QTSYSCONFDIR} 182 -plugindir ${QTPLUGINDIR} -sysconfdir ${QTSYSCONFDIR}
164# @DESCRIPTION: 223# @DESCRIPTION:
165# List variables that should be defined at the top of QtCore/qconfig.h 224# List variables that should be defined at the top of QtCore/qconfig.h
166QCONFIG_DEFINE="${QCONFIG_DEFINE:-}" 225QCONFIG_DEFINE="${QCONFIG_DEFINE:-}"
167 226
168install_qconfigs() { 227install_qconfigs() {
169 if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} || -n ${QCONFIG_DEFINE} ]]; then
170 local x 228 local x
229 if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} ]]; then
171 for x in QCONFIG_ADD QCONFIG_REMOVE; do 230 for x in QCONFIG_ADD QCONFIG_REMOVE; do
172 [[ -n ${!x} ]] && echo ${x}=${!x} >> "${T}"/${PN}-qconfig.pri 231 [[ -n ${!x} ]] && echo ${x}=${!x} >> "${T}"/${PN}-qconfig.pri
173 done 232 done
174 insinto ${QTDATADIR}/mkspecs/gentoo 233 insinto ${QTDATADIR}/mkspecs/gentoo
175 doins "${T}"/${PN}-qconfig.pri || die "installing ${PN}-qconfig.pri failed" 234 doins "${T}"/${PN}-qconfig.pri || die "installing ${PN}-qconfig.pri failed"
235 fi
176 236
237 if [[ -n ${QCONFIG_DEFINE} ]]; then
177 for x in ${QCONFIG_DEFINE}; do 238 for x in ${QCONFIG_DEFINE}; do
178 echo "#define ${x}" >> "${T}"/gentoo-${PN}-qconfig.h 239 echo "#define ${x}" >> "${T}"/gentoo-${PN}-qconfig.h
179 done 240 done
180 insinto ${QTHEADERDIR}/Gentoo 241 insinto ${QTHEADERDIR}/Gentoo
181 doins "${T}"/gentoo-${PN}-qconfig.h || die "installing ${PN}-qconfig.h failed" 242 doins "${T}"/gentoo-${PN}-qconfig.h || die "installing ${PN}-qconfig.h failed"
246 generate_qconfigs 307 generate_qconfigs
247} 308}
248 309
249qt4-build_pkg_postinst() { 310qt4-build_pkg_postinst() {
250 generate_qconfigs 311 generate_qconfigs
312 echo
313 ewarn "After a rebuild or upgrade of Qt, it can happen that Qt plugins (such as Qt"
314 ewarn "and KDE styles and widgets) can no longer be loaded. In this situation you"
315 ewarn "should recompile the packages providing these plugins. Also, make sure you"
316 ewarn "compile the Qt packages, and the packages that depend on it, with the same"
317 ewarn "GCC version and the same USE flag settings (especially the debug flag)."
318 ewarn
319 ewarn "Packages that typically need to be recompiled are kdelibs from KDE4, any"
320 ewarn "additional KDE4/Qt4 styles, qscintilla and PyQt4. Before filing a bug report,"
321 ewarn "make sure all your Qt4 packages are up-to-date and built with the same"
322 ewarn "configuration."
323 ewarn
324 ewarn "For more information, see http://doc.trolltech.com/4.4/plugins-howto.html"
325 echo
251} 326}
252 327
253skip_qmake_build_patch() { 328skip_qmake_build_patch() {
254 # Don't need to build qmake, as it's already installed from qt-core 329 # Don't need to build qmake, as it's already installed from qt-core
255 sed -i -e "s:if true:if false:g" "${S}"/configure || die "Sed failed" 330 sed -i -e "s:if true:if false:g" "${S}"/configure || die "Sed failed"

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.18

  ViewVC Help
Powered by ViewVC 1.1.20