/[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.17 Revision 1.22
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.17 2009/01/12 23:47:16 yngwin Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/qt4-build.eclass,v 1.22 2009/02/14 22:48:26 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 pch" 16IUSE="${IUSE} custom-cxxflags debug pch"
15 17
16case "${PV}" in 18case "${PV}" in
17 4.4.0_beta*)
18 SRCTYPE="${SRCTYPE:-opensource-src}"
19 MY_PV="${PV/_beta/-beta}"
20 ;;
21 4.4.0_rc*) 19 4.?.?_rc*)
22 SRCTYPE="${SRCTYPE:-opensource-src}" 20 SRCTYPE="${SRCTYPE:-opensource-src}"
23 MY_PV="${PV/_rc/-rc}" 21 MY_PV="${PV/_rc/-rc}"
24 ;; 22 ;;
25 *) 23 *)
26 SRCTYPE="${SRCTYPE:-opensource-src}" 24 SRCTYPE="${SRCTYPE:-opensource-src}"
28 ;; 26 ;;
29esac 27esac
30MY_P=qt-x11-${SRCTYPE}-${MY_PV} 28MY_P=qt-x11-${SRCTYPE}-${MY_PV}
31S=${WORKDIR}/${MY_P} 29S=${WORKDIR}/${MY_P}
32 30
31HOMEPAGE="http://www.qtsoftware.com/"
33SRC_URI="ftp://ftp.trolltech.com/qt/source/${MY_P}.tar.bz2" 32SRC_URI="ftp://ftp.trolltech.com/qt/source/${MY_P}.tar.bz2"
34 33
35case "${PV}" in 34case "${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" 35 4.4.?) SRC_URI="${SRC_URI} mirror://gentoo/${MY_P}-headers.tar.bz2" ;;
38 ;; 36 *) ;;
39 *)
40 ;;
41esac 37esac
42 38
43qt4-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
44 # Check USE requirements 48 # Check USE requirements
45 qt4-build_check_use 49 qt4-build_check_use
50 fi
46 51
47 # Set up installation directories 52 # Set up installation directories
48 QTBASEDIR=/usr/$(get_libdir)/qt4 53 QTBASEDIR=/usr/$(get_libdir)/qt4
49 QTPREFIXDIR=/usr 54 QTPREFIXDIR=/usr
50 QTBINDIR=/usr/bin 55 QTBINDIR=/usr/bin
61 66
62 PLATFORM=$(qt_mkspecs_dir) 67 PLATFORM=$(qt_mkspecs_dir)
63 68
64 PATH="${S}/bin:${PATH}" 69 PATH="${S}/bin:${PATH}"
65 LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}" 70 LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}"
66}
67 71
68qt4_unpack() { 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
88}
89
90qt4-build_src_unpack() {
69 local target targets 91 local target targets
70 for target in configure LICENSE.{GPL2,GPL3} projects.pro \ 92 for target in configure LICENSE.{GPL2,GPL3} projects.pro \
71 src/{qbase,qt_targets,qt_install}.pri bin config.tests mkspecs qmake \ 93 src/{qbase,qt_targets,qt_install}.pri bin config.tests mkspecs qmake \
72 ${QT4_EXTRACT_DIRECTORIES}; do 94 ${QT4_EXTRACT_DIRECTORIES}; do
73 targets="${targets} ${MY_P}/${target}" 95 targets="${targets} ${MY_P}/${target}"
75 97
76 echo tar xjpf "${DISTDIR}"/${MY_P}.tar.bz2 ${targets} 98 echo tar xjpf "${DISTDIR}"/${MY_P}.tar.bz2 ${targets}
77 tar xjpf "${DISTDIR}"/${MY_P}.tar.bz2 ${targets} 99 tar xjpf "${DISTDIR}"/${MY_P}.tar.bz2 ${targets}
78 100
79 case "${PV}" in 101 case "${PV}" in
80 4.4.2|4.4.1|4.4.0|4.4.0_rc*) 102 4.4.?)
81 echo tar xjpf "${DISTDIR}"/${MY_P}-headers.tar.bz2 103 echo tar xjpf "${DISTDIR}"/${MY_P}-headers.tar.bz2
82 tar xjpf "${DISTDIR}"/${MY_P}-headers.tar.bz2 104 tar xjpf "${DISTDIR}"/${MY_P}-headers.tar.bz2
83 ;; 105 ;;
84 esac 106 esac
85}
86 107
108 # Be backwards compatible for now
109 if [[ $EAPI != 2 ]]; then
110 qt4-build_src_prepare
111 fi
112}
113
87qt4-build_src_unpack() { 114qt4-build_src_prepare() {
88 qt4_unpack 115 cd "${S}"
116
89 if [[ ${PN} != qt-core ]]; then 117 if [[ ${PN} != qt-core ]]; then
90 cd "${S}"
91 skip_qmake_build_patch 118 skip_qmake_build_patch
92 skip_project_generation_patch 119 skip_project_generation_patch
93 symlink_binaries_to_buildtree 120 symlink_binaries_to_buildtree
94 fi 121 fi
122
123 # Bug 172219
124 if ! use custom-cxxflags;then
125 # Don't let the user go too overboard with flags.
126 strip-flags
127 replace-flags -O3 -O2
128 fi
95 129
130 # Bug 253127
131 # Unsupported old gcc versions - hardened needs this :(
132 if [[ $(gcc-major-version) -lt "4" ]] ; then
133 ewarn "Appending -fno-stack-protector to CXXFLAGS"
134 append-cxxflags -fno-stack-protector
135 fi
136
137 # Bug 178652
138 if [[ "$(gcc-major-version)" == "3" ]] && use amd64; then
139 ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS"
140 append-flags -fno-gcse
141 fi
142
143
96 sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \ 144 sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \
97 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \ 145 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \
98 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \ 146 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
99 -e "s:X11R6/::" \ 147 -e "s:X11R6/::" \
100 -i "${S}"/mkspecs/$(qt_mkspecs_dir)/qmake.conf || die "sed ${S}/mkspecs/$(qt_mkspecs_dir)/qmake.conf failed" 148 -i "${S}"/mkspecs/$(qt_mkspecs_dir)/qmake.conf || die "sed ${S}/mkspecs/$(qt_mkspecs_dir)/qmake.conf failed"
101 149
102 sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \ 150 sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \
103 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \ 151 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \
104 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \ 152 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
105 -i "${S}"/mkspecs/common/g++.conf || die "sed ${S}/mkspecs/common/g++.conf failed" 153 -i "${S}"/mkspecs/common/g++.conf || die "sed ${S}/mkspecs/common/g++.conf failed"
106}
107 154
155}
156
108qt4-build_src_compile() { 157qt4-build_src_configure() {
109 # Don't let the user go too overboard with flags. If you really want to, uncomment
110 # out the line below and give 'er a whirl.
111 strip-flags
112 replace-flags -O3 -O2
113
114 if [[ $(gcc-fullversion) == "3.4.6" && gcc-specs-ssp ]] ; then
115 ewarn "Appending -fno-stack-protector to CFLAGS/CXXFLAGS"
116 append-flags -fno-stack-protector
117 fi
118
119 # Bug 178652
120 if [[ "$(gcc-major-version)" == "3" ]] && use amd64; then
121 ewarn "Appending -fno-gcse to CFLAGS/CXXFLAGS"
122 append-flags -fno-gcse
123 fi
124 158
125 myconf="$(standard_configure_options) ${myconf}" 159 myconf="$(standard_configure_options) ${myconf}"
126 160
127 echo ./configure ${myconf} 161 echo ./configure ${myconf}
128 ./configure ${myconf} || die "./configure failed" 162 ./configure ${myconf} || die "./configure failed"
163}
129 164
130 build_target_directories 165qt4-build_src_compile() {
166 # Be backwards compatible for now
167 if [[ $EAPI != 2 ]]; then
168 qt4-build_src_configure
169 fi
170
171 build_directories "${QT4_TARGET_DIRECTORIES}"
131} 172}
132 173
133qt4-build_src_install() { 174qt4-build_src_install() {
134 install_directories "${QT4_TARGET_DIRECTORIES}" 175 install_directories "${QT4_TARGET_DIRECTORIES}"
135 install_qconfigs 176 install_qconfigs
157 myconf="${myconf} -debug -no-separate-debug-info" 198 myconf="${myconf} -debug -no-separate-debug-info"
158 else 199 else
159 myconf="${myconf} -release -no-separate-debug-info" 200 myconf="${myconf} -release -no-separate-debug-info"
160 fi 201 fi
161 202
162 # ARCH is set on Gentoo. QT now falls back to generic on an unsupported 203 # ARCH is set on Gentoo. Qt now falls back to generic on an unsupported
163 # ${ARCH}. Therefore we convert it to supported values. 204 # ${ARCH}. Therefore we convert it to supported values.
164 case "${ARCH}" in 205 case "${ARCH}" in
165 amd64) myconf="${myconf} -arch x86_64" ;; 206 amd64) myconf="${myconf} -arch x86_64" ;;
166 ppc|ppc64) myconf="${myconf} -arch powerpc" ;; 207 ppc|ppc64) myconf="${myconf} -arch powerpc" ;;
167 x86|x86-*) myconf="${myconf} -arch i386" ;; 208 x86|x86-*) myconf="${myconf} -arch i386" ;;
173 myconf="${myconf} -stl -verbose -largefile -confirm-license -no-rpath 214 myconf="${myconf} -stl -verbose -largefile -confirm-license -no-rpath
174 -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} 215 -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR}
175 -datadir ${QTDATADIR} -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} 216 -datadir ${QTDATADIR} -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR}
176 -plugindir ${QTPLUGINDIR} -sysconfdir ${QTSYSCONFDIR} 217 -plugindir ${QTPLUGINDIR} -sysconfdir ${QTSYSCONFDIR}
177 -translationdir ${QTTRANSDIR} -examplesdir ${QTEXAMPLESDIR} 218 -translationdir ${QTTRANSDIR} -examplesdir ${QTEXAMPLESDIR}
178 -demosdir ${QTDEMOSDIR} -silent -fast -reduce-relocations 219 -demosdir ${QTDEMOSDIR} -silent -fast
220 $([[ ${PN} == qt-xmlpatterns ]] || echo -no-exceptions)
221 $(use x86-fbsd || echo -reduce-relocations)
179 -nomake examples -nomake demos" 222 -nomake examples -nomake demos"
180 223
181 echo "${myconf}" 224 echo "${myconf}"
182}
183
184build_target_directories() {
185 build_directories "${QT4_TARGET_DIRECTORIES}"
186} 225}
187 226
188build_directories() { 227build_directories() {
189 local dirs="$@" 228 local dirs="$@"
190 for x in ${dirs}; do 229 for x in ${dirs}; do
234 done 273 done
235 insinto ${QTHEADERDIR}/Gentoo 274 insinto ${QTHEADERDIR}/Gentoo
236 doins "${T}"/gentoo-${PN}-qconfig.h || die "installing ${PN}-qconfig.h failed" 275 doins "${T}"/gentoo-${PN}-qconfig.h || die "installing ${PN}-qconfig.h failed"
237 fi 276 fi
238} 277}
239
240# Stubs for functions used by the Qt 4.4.0_technical_preview_1.
241qconfig_add_option() { : ; }
242qconfig_remove_option() { : ; }
243 278
244generate_qconfigs() { 279generate_qconfigs() {
245 if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} || -n ${QCONFIG_DEFINE} || ${CATEGORY}/${PN} == x11-libs/qt-core ]]; then 280 if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} || -n ${QCONFIG_DEFINE} || ${CATEGORY}/${PN} == x11-libs/qt-core ]]; then
246 local x qconfig_add qconfig_remove qconfig_new 281 local x qconfig_add qconfig_remove qconfig_new
247 for x in "${ROOT}${QTDATADIR}"/mkspecs/gentoo/*-qconfig.pri; do 282 for x in "${ROOT}${QTDATADIR}"/mkspecs/gentoo/*-qconfig.pri; do
473 fi 508 fi
474 509
475 echo "${spec}" 510 echo "${spec}"
476} 511}
477 512
513case ${EAPI:-0} in
478EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postrm pkg_postinst 514 0|1) EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postrm pkg_postinst ;;
515 2) EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_install pkg_postrm pkg_postinst ;;
516esac

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.22

  ViewVC Help
Powered by ViewVC 1.1.20