/[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.18 Revision 1.32
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.18 2009/01/21 08:55:28 gengor Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/qt4-build.eclass,v 1.32 2009/04/23 11:45:38 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="http://download.qtsoftware.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
39if version_is_at_least 4.5 ${PV} ; then
40 LICENSE="|| ( LGPL-2.1 GPL-3 )"
41fi
42
43qt4-build_pkg_setup() { 43qt4-build_pkg_setup() {
44 # EAPI=2 ebuilds set use-deps, others need this:
45 if [[ $EAPI != 2 ]]; then
46 # Make sure debug setting corresponds with qt-core (bug 258512)
47 if [[ $PN != "qt-core" ]]; then
48 use debug && QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK}
49 ~x11-libs/qt-core-${PV} debug"
50 fi
51
44 # Check USE requirements 52 # Check USE requirements
45 qt4-build_check_use 53 qt4-build_check_use
46 54 fi
47 # Set up installation directories 55 # Set up installation directories
48 QTBASEDIR=/usr/$(get_libdir)/qt4 56 QTBASEDIR=/usr/$(get_libdir)/qt4
49 QTPREFIXDIR=/usr 57 QTPREFIXDIR=/usr
50 QTBINDIR=/usr/bin 58 QTBINDIR=/usr/bin
51 QTLIBDIR=/usr/$(get_libdir)/qt4 59 QTLIBDIR=/usr/$(get_libdir)/qt4
61 69
62 PLATFORM=$(qt_mkspecs_dir) 70 PLATFORM=$(qt_mkspecs_dir)
63 71
64 PATH="${S}/bin:${PATH}" 72 PATH="${S}/bin:${PATH}"
65 LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}" 73 LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}"
66}
67 74
68qt4_unpack() { 75 if ! version_is_at_least 4.1 $(gcc-version) ; then
76 ewarn "Using a GCC version lower than 4.1 is not supported!"
77 echo
78 ebeep 3
79 fi
80
81 if use custom-cxxflags; then
82 echo
83 ewarn "You have set USE=custom-cxxflags, which means Qt will be built with the"
84 ewarn "CXXFLAGS you have set in /etc/make.conf. This is not supported, and we"
85 ewarn "recommend to unset this useflag. But you are free to experiment with it."
86 ewarn "Just do not start crying if it breaks your system, or eats your kitten"
87 ewarn "for breakfast. ;-) "
88 echo
89 fi
90
91}
92
93qt4-build_src_unpack() {
69 local target targets 94 local target targets licenses
95 if version_is_at_least 4.5 ${PV} ; then
96 licenses="LICENSE.GPL3 LICENSE.LGPL"
97 else
98 licenses="LICENSE.GPL2 LICENSE.GPL3"
99 fi
70 for target in configure LICENSE.{GPL2,GPL3} projects.pro \ 100 for target in configure ${licenses} projects.pro \
71 src/{qbase,qt_targets,qt_install}.pri bin config.tests mkspecs qmake \ 101 src/{qbase,qt_targets,qt_install}.pri bin config.tests mkspecs qmake \
72 ${QT4_EXTRACT_DIRECTORIES}; do 102 ${QT4_EXTRACT_DIRECTORIES}; do
73 targets="${targets} ${MY_P}/${target}" 103 targets="${targets} ${MY_P}/${target}"
74 done 104 done
75 105
76 echo tar xjpf "${DISTDIR}"/${MY_P}.tar.bz2 ${targets} 106 echo tar xjpf "${DISTDIR}"/${MY_P}.tar.bz2 ${targets}
77 tar xjpf "${DISTDIR}"/${MY_P}.tar.bz2 ${targets} 107 tar xjpf "${DISTDIR}"/${MY_P}.tar.bz2 ${targets}
78 108
79 case "${PV}" in 109 case "${PV}" in
80 4.4.2|4.4.1|4.4.0|4.4.0_rc*) 110 4.4.?)
81 echo tar xjpf "${DISTDIR}"/${MY_P}-headers.tar.bz2 111 echo tar xjpf "${DISTDIR}"/${MY_P}-headers.tar.bz2
82 tar xjpf "${DISTDIR}"/${MY_P}-headers.tar.bz2 112 tar xjpf "${DISTDIR}"/${MY_P}-headers.tar.bz2
83 ;; 113 ;;
84 esac 114 esac
85}
86 115
116 # Be backwards compatible for now
117 if [[ $EAPI != 2 ]]; then
118 qt4-build_src_prepare
119 fi
120}
121
87qt4-build_src_unpack() { 122qt4-build_src_prepare() {
88 qt4_unpack 123 cd "${S}"
124
89 if [[ ${PN} != qt-core ]]; then 125 if [[ ${PN} != qt-core ]]; then
90 cd "${S}"
91 skip_qmake_build_patch 126 skip_qmake_build_patch
92 skip_project_generation_patch 127 skip_project_generation_patch
93 symlink_binaries_to_buildtree 128 symlink_binaries_to_buildtree
94 fi 129 fi
95 130
96 # Bug 253127 131 if ! use custom-cxxflags;then
132 # Don't let the user go too overboard with flags.
133 strip-flags
134 replace-flags -O3 -O2
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 # Unsupported old gcc versions - hardened needs this :(
97 if [[ $(gcc-major-version) -lt "4" ]] ; then 144 if [[ $(gcc-major-version) -lt "4" ]] ; then
145 ewarn "Appending -fno-stack-protector to CXXFLAGS"
146 append-cxxflags -fno-stack-protector
147 # Bug 253127
98 sed -e "/^QMAKE_CFLAGS\t/ s:$: -fno-stack-protector-all:" \ 148 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" 149 -i "${S}"/mkspecs/common/g++.conf || die "sed ${S}/mkspecs/common/g++.conf failed"
100 fi 150 fi
101 151
152 # Bug 172219
102 sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \ 153 sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \
103 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \ 154 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \
104 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \ 155 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
105 -e "s:X11R6/::" \ 156 -e "s:X11R6/::" \
106 -i "${S}"/mkspecs/$(qt_mkspecs_dir)/qmake.conf || die "sed ${S}/mkspecs/$(qt_mkspecs_dir)/qmake.conf failed" 157 -i "${S}"/mkspecs/$(qt_mkspecs_dir)/qmake.conf || die "sed ${S}/mkspecs/$(qt_mkspecs_dir)/qmake.conf failed"
107 158
108 sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \ 159 sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \
109 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \ 160 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \
110 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \ 161 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
111 -i "${S}"/mkspecs/common/g++.conf || die "sed ${S}/mkspecs/common/g++.conf failed" 162 -i "${S}"/mkspecs/common/g++.conf || die "sed ${S}/mkspecs/common/g++.conf failed"
112}
113 163
164}
165
114qt4-build_src_compile() { 166qt4-build_src_configure() {
115 # Don't let the user go too overboard with flags. If you really want to, uncomment
116 # out the line below and give 'er a whirl.
117 strip-flags
118 replace-flags -O3 -O2
119
120 if [[ $(gcc-major-version) -lt "4" ]] ; then
121 ewarn "Appending -fno-stack-protector to CXXFLAGS"
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
129 fi
130 167
131 myconf="$(standard_configure_options) ${myconf}" 168 myconf="$(standard_configure_options) ${myconf}"
132 169
133 echo ./configure ${myconf} 170 echo ./configure ${myconf}
134 ./configure ${myconf} || die "./configure failed" 171 ./configure ${myconf} || die "./configure failed"
172}
135 173
136 build_target_directories 174qt4-build_src_compile() {
175 # Be backwards compatible for now
176 if [[ $EAPI != 2 ]]; then
177 qt4-build_src_configure
178 fi
179
180 build_directories "${QT4_TARGET_DIRECTORIES}"
137} 181}
138 182
139qt4-build_src_install() { 183qt4-build_src_install() {
140 install_directories "${QT4_TARGET_DIRECTORIES}" 184 install_directories "${QT4_TARGET_DIRECTORIES}"
141 install_qconfigs 185 install_qconfigs
163 myconf="${myconf} -debug -no-separate-debug-info" 207 myconf="${myconf} -debug -no-separate-debug-info"
164 else 208 else
165 myconf="${myconf} -release -no-separate-debug-info" 209 myconf="${myconf} -release -no-separate-debug-info"
166 fi 210 fi
167 211
168 # ARCH is set on Gentoo. QT now falls back to generic on an unsupported 212 # ARCH is set on Gentoo. Qt now falls back to generic on an unsupported
169 # ${ARCH}. Therefore we convert it to supported values. 213 # $(tc-arch). Therefore we convert it to supported values.
170 case "${ARCH}" in 214 case "$(tc-arch)" in
171 amd64) myconf="${myconf} -arch x86_64" ;; 215 amd64) myconf="${myconf} -arch x86_64" ;;
172 ppc|ppc64) myconf="${myconf} -arch powerpc" ;; 216 ppc|ppc64) myconf="${myconf} -arch powerpc" ;;
173 x86|x86-*) myconf="${myconf} -arch i386" ;; 217 x86|x86-*) myconf="${myconf} -arch i386" ;;
174 alpha|arm|ia64|mips|s390|sparc) myconf="${myconf} -arch ${ARCH}" ;; 218 alpha|arm|ia64|mips|s390|sparc) myconf="${myconf} -arch $(tc-arch)" ;;
175 hppa|sh) myconf="${myconf} -arch generic" ;; 219 hppa|sh) myconf="${myconf} -arch generic" ;;
176 *) die "${ARCH} is unsupported by this eclass. Please file a bug." ;; 220 *) die "$(tc-arch) is unsupported by this eclass. Please file a bug." ;;
177 esac 221 esac
178 222
179 myconf="${myconf} -stl -verbose -largefile -confirm-license -no-rpath 223 myconf="${myconf} -stl -verbose -largefile -confirm-license -no-rpath
180 -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} 224 -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR}
181 -datadir ${QTDATADIR} -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} 225 -datadir ${QTDATADIR} -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR}
182 -plugindir ${QTPLUGINDIR} -sysconfdir ${QTSYSCONFDIR} 226 -plugindir ${QTPLUGINDIR} -sysconfdir ${QTSYSCONFDIR}
183 -translationdir ${QTTRANSDIR} -examplesdir ${QTEXAMPLESDIR} 227 -translationdir ${QTTRANSDIR} -examplesdir ${QTEXAMPLESDIR}
184 -demosdir ${QTDEMOSDIR} -silent -fast -reduce-relocations 228 -demosdir ${QTDEMOSDIR} -silent -fast
229 $([[ ${PN} == qt-xmlpatterns ]] || echo -no-exceptions)
185 -nomake examples -nomake demos" 230 -reduce-relocations -nomake examples -nomake demos"
231
232 # Make eclass 4.5.{1,2} ready
233 case "${MY_PV}" in
234 4.5.1 | 4.5.2)
235 myconf="${myconf} -opensource"
236 ;;
237 esac
186 238
187 echo "${myconf}" 239 echo "${myconf}"
188}
189
190build_target_directories() {
191 build_directories "${QT4_TARGET_DIRECTORIES}"
192} 240}
193 241
194build_directories() { 242build_directories() {
195 local dirs="$@" 243 local dirs="$@"
196 for x in ${dirs}; do 244 for x in ${dirs}; do
240 done 288 done
241 insinto ${QTHEADERDIR}/Gentoo 289 insinto ${QTHEADERDIR}/Gentoo
242 doins "${T}"/gentoo-${PN}-qconfig.h || die "installing ${PN}-qconfig.h failed" 290 doins "${T}"/gentoo-${PN}-qconfig.h || die "installing ${PN}-qconfig.h failed"
243 fi 291 fi
244} 292}
245
246# Stubs for functions used by the Qt 4.4.0_technical_preview_1.
247qconfig_add_option() { : ; }
248qconfig_remove_option() { : ; }
249 293
250generate_qconfigs() { 294generate_qconfigs() {
251 if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} || -n ${QCONFIG_DEFINE} || ${CATEGORY}/${PN} == x11-libs/qt-core ]]; then 295 if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} || -n ${QCONFIG_DEFINE} || ${CATEGORY}/${PN} == x11-libs/qt-core ]]; then
252 local x qconfig_add qconfig_remove qconfig_new 296 local x qconfig_add qconfig_remove qconfig_new
253 for x in "${ROOT}${QTDATADIR}"/mkspecs/gentoo/*-qconfig.pri; do 297 for x in "${ROOT}${QTDATADIR}"/mkspecs/gentoo/*-qconfig.pri; do
479 fi 523 fi
480 524
481 echo "${spec}" 525 echo "${spec}"
482} 526}
483 527
528case ${EAPI:-0} in
484EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postrm pkg_postinst 529 0|1) EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postrm pkg_postinst ;;
530 2) EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_install pkg_postrm pkg_postinst ;;
531esac

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

  ViewVC Help
Powered by ViewVC 1.1.20