/[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.5 Revision 1.18
1# Copyright 2005 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.5 2007/12/22 17:32:55 caleb 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"
15
16case "${PV}" in
17 4.4.0_beta*)
18 SRCTYPE="${SRCTYPE:-opensource-src}"
19 MY_PV="${PV/_beta/-beta}"
20 ;;
21 4.4.0_rc*)
22 SRCTYPE="${SRCTYPE:-opensource-src}"
23 MY_PV="${PV/_rc/-rc}"
24 ;;
25 *)
26 SRCTYPE="${SRCTYPE:-opensource-src}"
27 MY_PV="${PV}"
28 ;;
29esac
30MY_P=qt-x11-${SRCTYPE}-${MY_PV}
31S=${WORKDIR}/${MY_P}
32
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
16 42
17qt4-build_pkg_setup() { 43qt4-build_pkg_setup() {
44 # Check USE requirements
45 qt4-build_check_use
46
18 # Set up installation directories 47 # Set up installation directories
19
20 QTBASEDIR=/usr/$(get_libdir)/qt4 48 QTBASEDIR=/usr/$(get_libdir)/qt4
21 QTPREFIXDIR=/usr 49 QTPREFIXDIR=/usr
22 QTBINDIR=/usr/bin 50 QTBINDIR=/usr/bin
23 QTLIBDIR=/usr/$(get_libdir)/qt4 51 QTLIBDIR=/usr/$(get_libdir)/qt4
24 QTPCDIR=/usr/$(get_libdir)/pkgconfig 52 QTPCDIR=/usr/$(get_libdir)/pkgconfig
25 QTDATADIR=/usr/share/qt4 53 QTDATADIR=/usr/share/qt4
26 QTDOCDIR=/usr/share/doc/${PF} 54 QTDOCDIR=/usr/share/doc/qt-${PV}
27 QTHEADERDIR=/usr/include/qt4 55 QTHEADERDIR=/usr/include/qt4
28 QTPLUGINDIR=${QTLIBDIR}/plugins 56 QTPLUGINDIR=${QTLIBDIR}/plugins
29 QTSYSCONFDIR=/etc/qt4 57 QTSYSCONFDIR=/etc/qt4
30 QTTRANSDIR=${QTDATADIR}/translations 58 QTTRANSDIR=${QTDATADIR}/translations
31 QTEXAMPLESDIR=${QTDATADIR}/examples 59 QTEXAMPLESDIR=${QTDATADIR}/examples
35 63
36 PATH="${S}/bin:${PATH}" 64 PATH="${S}/bin:${PATH}"
37 LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}" 65 LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}"
38} 66}
39 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
40qt4-build_src_unpack() { 87qt4-build_src_unpack() {
41 unpack ${A} 88 qt4_unpack
89 if [[ ${PN} != qt-core ]]; then
42 cd "${S}" 90 cd "${S}"
91 skip_qmake_build_patch
92 skip_project_generation_patch
93 symlink_binaries_to_buildtree
94 fi
43 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"
100 fi
101
102 sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \
103 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \
104 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
105 -e "s:X11R6/::" \
106 -i "${S}"/mkspecs/$(qt_mkspecs_dir)/qmake.conf || die "sed ${S}/mkspecs/$(qt_mkspecs_dir)/qmake.conf failed"
107
108 sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \
109 -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \
110 -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
111 -i "${S}"/mkspecs/common/g++.conf || die "sed ${S}/mkspecs/common/g++.conf failed"
112}
113
114qt4-build_src_compile() {
44 # 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
45 # out the line below and give 'er a whirl. 116 # out the line below and give 'er a whirl.
46 strip-flags 117 strip-flags
47 replace-flags -O3 -O2 118 replace-flags -O3 -O2
48 119
49 if [[ $( gcc-fullversion ) == "3.4.6" && gcc-specs-ssp ]] ; then 120 if [[ $(gcc-major-version) -lt "4" ]] ; then
50 ewarn "Appending -fno-stack-protector to CFLAGS/CXXFLAGS" 121 ewarn "Appending -fno-stack-protector to CXXFLAGS"
51 append-flags -fno-stack-protector 122 append-cxxflags -fno-stack-protector
52 fi 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
131 myconf="$(standard_configure_options) ${myconf}"
132
133 echo ./configure ${myconf}
134 ./configure ${myconf} || die "./configure failed"
135
136 build_target_directories
53} 137}
54 138
55qt4-build_src_install() { 139qt4-build_src_install() {
56 install_directories "${QT4_TARGET_DIRECTORIES}" 140 install_directories "${QT4_TARGET_DIRECTORIES}"
141 install_qconfigs
57 fix_library_files 142 fix_library_files
58} 143}
59 144
60standard_configure_options() { 145standard_configure_options() {
61 local myconf="" 146 local myconf=""
62 147
63 [ $(get_libdir) != "lib" ] && myconf="${myconf} -L/usr/$(get_libdir)" 148 [[ $(get_libdir) != "lib" ]] && myconf="${myconf} -L/usr/$(get_libdir)"
64 149
65 # Disable visibility explicitly if gcc version isn't 4 150 # Disable visibility explicitly if gcc version isn't 4
66 if [[ "$(gcc-major-version)" != "4" ]]; then 151 if [[ "$(gcc-major-version)" -lt "4" ]]; then
67 myconf="${myconf} -no-reduce-exports" 152 myconf="${myconf} -no-reduce-exports"
68 fi 153 fi
69 154
70 use debug && myconf="${myconf} -debug -no-separate-debug-info" || myconf="${myconf} -release -no-separate-debug-info" 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
71 161
162 if use debug; then
163 myconf="${myconf} -debug -no-separate-debug-info"
164 else
165 myconf="${myconf} -release -no-separate-debug-info"
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
178
72 myconf="${myconf} -stl -verbose -largefile -confirm-license -no-rpath\ 179 myconf="${myconf} -stl -verbose -largefile -confirm-license -no-rpath
73 -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR} -datadir ${QTDATADIR} \ 180 -prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR}
74 -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR} -plugindir ${QTPLUGINDIR} \ 181 -datadir ${QTDATADIR} -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR}
75 -sysconfdir ${QTSYSCONFDIR} -translationdir ${QTTRANSDIR} \ 182 -plugindir ${QTPLUGINDIR} -sysconfdir ${QTSYSCONFDIR}
76 -examplesdir ${QTEXAMPLESDIR} -demosdir ${QTDEMOSDIR}" 183 -translationdir ${QTTRANSDIR} -examplesdir ${QTEXAMPLESDIR}
77 184 -demosdir ${QTDEMOSDIR} -silent -fast -reduce-relocations
78 myconf="${myconf} -silent -fast -reduce-relocations -nomake examples -nomake demos" 185 -nomake examples -nomake demos"
79 186
80 echo "${myconf}" 187 echo "${myconf}"
81} 188}
82 189
83build_target_directories() { 190build_target_directories() {
86 193
87build_directories() { 194build_directories() {
88 local dirs="$@" 195 local dirs="$@"
89 for x in ${dirs}; do 196 for x in ${dirs}; do
90 cd "${S}"/${x} 197 cd "${S}"/${x}
91 "${S}"/bin/qmake "LIBS+=-L${QTLIBDIR}" "CONFIG+=nostrip" && emake || die 198 "${S}"/bin/qmake "LIBS+=-L${QTLIBDIR}" "CONFIG+=nostrip" || die "qmake failed"
199 emake || die "emake failed"
92 done 200 done
93} 201}
94 202
95install_directories() { 203install_directories() {
96 local dirs="$@" 204 local dirs="$@"
97 for x in ${dirs}; do 205 for x in ${dirs}; do
98 cd "${S}"/${x} 206 pushd "${S}"/${x} >/dev/null || die "Can't pushd ${S}/${x}"
99 emake INSTALL_ROOT="${D}" install || die 207 emake INSTALL_ROOT="${D}" install || die "emake install failed"
208 popd >/dev/null || die "Can't popd from ${S}/${x}"
209 done
210}
211
212# @ECLASS-VARIABLE: QCONFIG_ADD
213# @DESCRIPTION:
214# List options that need to be added to QT_CONFIG in qconfig.pri
215QCONFIG_ADD="${QCONFIG_ADD:-}"
216
217# @ECLASS-VARIABLE: QCONFIG_REMOVE
218# @DESCRIPTION:
219# List options that need to be removed from QT_CONFIG in qconfig.pri
220QCONFIG_REMOVE="${QCONFIG_REMOVE:-}"
221
222# @ECLASS-VARIABLE: QCONFIG_DEFINE
223# @DESCRIPTION:
224# List variables that should be defined at the top of QtCore/qconfig.h
225QCONFIG_DEFINE="${QCONFIG_DEFINE:-}"
226
227install_qconfigs() {
228 local x
229 if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} ]]; then
230 for x in QCONFIG_ADD QCONFIG_REMOVE; do
231 [[ -n ${!x} ]] && echo ${x}=${!x} >> "${T}"/${PN}-qconfig.pri
100 done 232 done
101} 233 insinto ${QTDATADIR}/mkspecs/gentoo
234 doins "${T}"/${PN}-qconfig.pri || die "installing ${PN}-qconfig.pri failed"
235 fi
102 236
237 if [[ -n ${QCONFIG_DEFINE} ]]; then
238 for x in ${QCONFIG_DEFINE}; do
239 echo "#define ${x}" >> "${T}"/gentoo-${PN}-qconfig.h
240 done
241 insinto ${QTHEADERDIR}/Gentoo
242 doins "${T}"/gentoo-${PN}-qconfig.h || die "installing ${PN}-qconfig.h failed"
243 fi
244}
245
246# Stubs for functions used by the Qt 4.4.0_technical_preview_1.
103qconfig_add_option() { 247qconfig_add_option() { : ; }
104 local option=$1
105 qconfig_remove_option $1
106 sed -i -e "s:QT_CONFIG +=:QT_CONFIG += ${option}:g" /usr/share/qt4/mkspecs/qconfig.pri
107}
108
109qconfig_remove_option() { 248qconfig_remove_option() { : ; }
110 local option=$1 249
111 sed -i -e "s: ${option}::g" /usr/share/qt4/mkspecs/qconfig.pri 250generate_qconfigs() {
251 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
253 for x in "${ROOT}${QTDATADIR}"/mkspecs/gentoo/*-qconfig.pri; do
254 [[ -f ${x} ]] || continue
255 qconfig_add="${qconfig_add} $(sed -n 's/^QCONFIG_ADD=//p' "${x}")"
256 qconfig_remove="${qconfig_remove} $(sed -n 's/^QCONFIG_REMOVE=//p' "${x}")"
257 done
258
259 # these error checks do not use die because dying in pkg_post{inst,rm}
260 # just makes things worse.
261 if [[ -e "${ROOT}${QTDATADIR}"/mkspecs/gentoo/qconfig.pri ]]; then
262 # start with the qconfig.pri that qt-core installed
263 if ! cp "${ROOT}${QTDATADIR}"/mkspecs/gentoo/qconfig.pri \
264 "${ROOT}${QTDATADIR}"/mkspecs/qconfig.pri; then
265 eerror "cp qconfig failed."
266 return 1
267 fi
268
269 # generate list of QT_CONFIG entries from the existing list
270 # including qconfig_add and excluding qconfig_remove
271 for x in $(sed -n 's/^QT_CONFIG +=//p' \
272 "${ROOT}${QTDATADIR}"/mkspecs/qconfig.pri) ${qconfig_add}; do
273 hasq ${x} ${qconfig_remove} || qconfig_new="${qconfig_new} ${x}"
274 done
275
276 # replace the existing QT_CONFIG list with qconfig_new
277 if ! sed -i -e "s/QT_CONFIG +=.*/QT_CONFIG += ${qconfig_new}/" \
278 "${ROOT}${QTDATADIR}"/mkspecs/qconfig.pri; then
279 eerror "Sed for QT_CONFIG failed"
280 return 1
281 fi
282
283 # create Gentoo/qconfig.h
284 if [[ ! -e ${ROOT}${QTHEADERDIR}/Gentoo ]]; then
285 if ! mkdir -p "${ROOT}${QTHEADERDIR}"/Gentoo; then
286 eerror "mkdir ${QTHEADERDIR}/Gentoo failed"
287 return 1
288 fi
289 fi
290 : > "${ROOT}${QTHEADERDIR}"/Gentoo/gentoo-qconfig.h
291 for x in "${ROOT}${QTHEADERDIR}"/Gentoo/gentoo-*-qconfig.h; do
292 [[ -f ${x} ]] || continue
293 cat "${x}" >> "${ROOT}${QTHEADERDIR}"/Gentoo/gentoo-qconfig.h
294 done
295 else
296 rm -f "${ROOT}${QTDATADIR}"/mkspecs/qconfig.pri
297 rm -f "${ROOT}${QTHEADERDIR}"/Gentoo/gentoo-qconfig.h
298 rmdir "${ROOT}${QTDATADIR}"/mkspecs \
299 "${ROOT}${QTDATADIR}" \
300 "${ROOT}${QTHEADERDIR}"/Gentoo \
301 "${ROOT}${QTHEADERDIR}" 2>/dev/null
302 fi
303 fi
304}
305
306qt4-build_pkg_postrm() {
307 generate_qconfigs
308}
309
310qt4-build_pkg_postinst() {
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
112} 326}
113 327
114skip_qmake_build_patch() { 328skip_qmake_build_patch() {
115 # Don't need to build qmake, as it's already installed from qmake-core 329 # Don't need to build qmake, as it's already installed from qt-core
116 sed -i -e "s:if true:if false:g" "${S}"/configure 330 sed -i -e "s:if true:if false:g" "${S}"/configure || die "Sed failed"
117} 331}
118 332
119skip_project_generation_patch() { 333skip_project_generation_patch() {
120 # Exit the script early by throwing in an exit before all of the .pro files are scanned 334 # Exit the script early by throwing in an exit before all of the .pro files are scanned
121 sed -i -e "s:echo \"Finding:exit 0\n\necho \"Finding:g" "${S}"/configure 335 sed -e "s:echo \"Finding:exit 0\n\necho \"Finding:g" \
336 -i "${S}"/configure || die "Sed failed"
122} 337}
123 338
124install_binaries_to_buildtree() 339symlink_binaries_to_buildtree() {
125{ 340 for bin in qmake moc uic rcc; do
126 cp ${QTBINDIR}/qmake ${S}/bin 341 ln -s ${QTBINDIR}/${bin} "${S}"/bin/ || die "Symlinking ${bin} to ${S}/bin failed."
127 cp ${QTBINDIR}/moc ${S}/bin 342 done
128 cp ${QTBINDIR}/uic ${S}/bin
129 cp ${QTBINDIR}/rcc ${S}/bin
130} 343}
131 344
132fix_library_files() { 345fix_library_files() {
133 sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/*.la 346 for libfile in "${D}"/${QTLIBDIR}/{*.la,*.prl,pkgconfig/*.pc}; do
134 sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/*.prl 347 if [[ -e ${libfile} ]]; then
135 sed -i -e "s:${S}/lib:${QTLIBDIR}:g" "${D}"/${QTLIBDIR}/pkgconfig/*.pc 348 sed -i -e "s:${S}/lib:${QTLIBDIR}:g" ${libfile} || die "Sed on ${libfile} failed."
349 fi
350 done
136 351
137 # pkgconfig files refer to WORKDIR/bin as the moc and uic locations. Fix: 352 # pkgconfig files refer to WORKDIR/bin as the moc and uic locations. Fix:
138 sed -i -e "s:${S}/bin:${QTBINDIR}:g" "${D}"/${QTLIBDIR}/pkgconfig/*.pc 353 for libfile in "${D}"/${QTLIBDIR}/pkgconfig/*.pc; do
354 if [[ -e ${libfile} ]]; then
355 sed -i -e "s:${S}/bin:${QTBINDIR}:g" ${libfile} || die "Sed failed"
139 356
140 # Move .pc files into the pkgconfig directory 357 # Move .pc files into the pkgconfig directory
358
141 dodir ${QTPCDIR} 359 dodir ${QTPCDIR}
142 mv "${D}"/${QTLIBDIR}/pkgconfig/*.pc "${D}"/${QTPCDIR} 360 mv ${libfile} "${D}"/${QTPCDIR}/ \
361 || die "Moving ${libfile} to ${D}/${QTPCDIR}/ failed."
362 fi
363 done
364
365 # Don't install an empty directory
366 rmdir "${D}"/${QTLIBDIR}/pkgconfig
143} 367}
144 368
145qt_use() { 369qt_use() {
146 local flag="$1" 370 local flag="${1}"
147 local feature="$1" 371 local feature="${1}"
148 local enableval= 372 local enableval=
149 373
150 [[ -n $2 ]] && feature=$2 374 [[ -n ${2} ]] && feature=${2}
151 [[ -n $3 ]] && enableval="-$3" 375 [[ -n ${3} ]] && enableval="-${3}"
152 376
153 useq $flag && echo "${enableval}-${feature}" || echo "-no-${feature}" 377 if use ${flag}; then
378 echo "${enableval}-${feature}"
379 else
380 echo "-no-${feature}"
381 fi
382}
383
384# @ECLASS-VARIABLE: QT4_BUILT_WITH_USE_CHECK
385# @DESCRIPTION:
386# The contents of $QT4_BUILT_WITH_USE_CHECK gets fed to built_with_use
387# (eutils.eclass), line per line.
388#
389# Example:
390# @CODE
391# pkg_setup() {
392# use qt3support && QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK}
393# ~x11-libs/qt-gui-${PV} qt3support"
394# qt4-build_check_use
395# }
396# @CODE
397
398# Run built_with_use on each flag and print appropriate error messages if any
399# flags are missing
400_qt_built_with_use() {
401 local missing opt pkg flag flags
402
403 if [[ ${1} = "--missing" ]]; then
404 missing="${1} ${2}" && shift 2
405 fi
406 if [[ ${1:0:1} = "-" ]]; then
407 opt=${1} && shift
408 fi
409
410 pkg=${1} && shift
411
412 for flag in "${@}"; do
413 flags="${flags} ${flag}"
414 if ! built_with_use ${missing} ${opt} ${pkg} ${flag}; then
415 flags="${flags}*"
416 else
417 [[ ${opt} = "-o" ]] && return 0
418 fi
419 done
420 if [[ "${flags# }" = "${@}" ]]; then
154 return 0 421 return 0
422 fi
423 if [[ ${opt} = "-o" ]]; then
424 eerror "This package requires '${pkg}' to be built with any of the following USE flags: '$*'."
425 else
426 eerror "This package requires '${pkg}' to be built with the following USE flags: '${flags# }'."
427 fi
428 return 1
429}
430
431# @FUNCTION: qt4-build_check_use
432# @DESCRIPTION:
433# Check if the listed packages in $QT4_BUILT_WITH_USE_CHECK are built with the
434# USE flags listed.
435#
436# If any of the required USE flags are missing, an eerror will be printed for
437# each package with missing USE flags.
438qt4-build_check_use() {
439 local line missing
440 while read line; do
441 [[ -z ${line} ]] && continue
442 if ! _qt_built_with_use ${line}; then
443 missing=true
444 fi
445 done <<< "${QT4_BUILT_WITH_USE_CHECK}"
446 if [[ -n ${missing} ]]; then
447 echo
448 eerror "Flags marked with an * are missing."
449 die "Missing USE flags found"
450 fi
155} 451}
156 452
157qt_mkspecs_dir() { 453qt_mkspecs_dir() {
158 # Allows us to define which mkspecs dir we want to use. 454 # Allows us to define which mkspecs dir we want to use.
159 local spec 455 local spec
163 spec="freebsd" ;; 459 spec="freebsd" ;;
164 *-openbsd*) 460 *-openbsd*)
165 spec="openbsd" ;; 461 spec="openbsd" ;;
166 *-netbsd*) 462 *-netbsd*)
167 spec="netbsd" ;; 463 spec="netbsd" ;;
168 *-darwin*) 464 *-darwin*)
169 spec="darwin" ;; 465 spec="darwin" ;;
170 *-linux-*|*-linux) 466 *-linux-*|*-linux)
171 spec="linux" ;; 467 spec="linux" ;;
172 *) 468 *)
173 die "Unknown CHOST, no platform choosed." 469 die "Unknown CHOST, no platform choosen."
174 esac 470 esac
175 471
176 CXX=$(tc-getCXX) 472 CXX=$(tc-getCXX)
177 if [[ ${CXX/g++/} != ${CXX} ]]; then 473 if [[ ${CXX/g++/} != ${CXX} ]]; then
178 spec="${spec}-g++" 474 spec="${spec}-g++"
183 fi 479 fi
184 480
185 echo "${spec}" 481 echo "${spec}"
186} 482}
187 483
188EXPORT_FUNCTIONS pkg_setup src_unpack src_install 484EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postrm pkg_postinst

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

  ViewVC Help
Powered by ViewVC 1.1.20