/[gentoo-x86]/eclass/qt5-build.eclass
Gentoo

Contents of /eclass/qt5-build.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Wed Apr 23 11:53:32 2014 UTC (7 months ago) by zlogene
Branch: MAIN
Changes since 1.1: +1 -1 lines
FILE REMOVED
Drop qt5-build eclass

1 # Copyright 1999-2014 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/qt5-build.eclass,v 1.1 2014/04/23 08:01:30 patrick Exp $
4
5 # @ECLASS: qt5-build.eclass
6 # @MAINTAINER:
7 # Qt herd <qt@gentoo.org>
8 # @AUTHOR:
9 # Davide Pesavento <pesa@gentoo.org>
10 # @BLURB: Eclass for Qt5 split ebuilds.
11 # @DESCRIPTION:
12 # This eclass contains various functions that are used when building Qt5.
13 # Requires EAPI 5.
14
15 case ${EAPI} in
16 5) : ;;
17 *) die "qt5-build.eclass: unsupported EAPI=${EAPI:-0}" ;;
18 esac
19
20 # @ECLASS-VARIABLE: VIRTUALX_REQUIRED
21 # @DESCRIPTION:
22 # For proper description see virtualx.eclass manpage.
23 # Here we redefine default value to be manual, if your package needs virtualx
24 # for tests you should proceed with setting VIRTUALX_REQUIRED=test.
25 : ${VIRTUALX_REQUIRED:=manual}
26
27 inherit eutils flag-o-matic multilib toolchain-funcs versionator virtualx
28
29 HOMEPAGE="http://qt-project.org/ http://qt.digia.com/"
30 LICENSE="|| ( LGPL-2.1 GPL-3 )"
31 SLOT="5"
32
33 # @ECLASS-VARIABLE: QT5_MODULE
34 # @DESCRIPTION:
35 # The upstream name of the module this package belongs to. Used for
36 # SRC_URI and EGIT_REPO_URI. Must be defined before inheriting the eclass.
37 : ${QT5_MODULE:=${PN}}
38
39 case ${PV} in
40 5.9999)
41 # git dev branch
42 QT5_BUILD_TYPE="live"
43 EGIT_BRANCH="dev"
44 ;;
45 5.?.9999)
46 # git stable branch
47 QT5_BUILD_TYPE="live"
48 EGIT_BRANCH="stable"
49 ;;
50 *_alpha*|*_beta*|*_rc*)
51 # pre-releases
52 QT5_BUILD_TYPE="release"
53 MY_P="${QT5_MODULE}-opensource-src-${PV/_/-}"
54 SRC_URI="http://download.qt-project.org/development_releases/qt/${PV%.*}/${PV/_/-}/submodules/${MY_P}.tar.xz"
55 S=${WORKDIR}/${MY_P}
56 ;;
57 *)
58 # official stable releases
59 QT5_BUILD_TYPE="release"
60 MY_P="${QT5_MODULE}-opensource-src-${PV}"
61 SRC_URI="http://download.qt-project.org/official_releases/qt/${PV%.*}/${PV}/submodules/${MY_P}.tar.xz"
62 S=${WORKDIR}/${MY_P}
63 ;;
64 esac
65
66 EGIT_REPO_URI=(
67 "git://gitorious.org/qt/${QT5_MODULE}.git"
68 "https://git.gitorious.org/qt/${QT5_MODULE}.git"
69 )
70 [[ ${QT5_BUILD_TYPE} == "live" ]] && inherit git-r3
71
72 IUSE="debug test"
73
74 DEPEND="
75 >=dev-lang/perl-5.14
76 virtual/pkgconfig
77 "
78 if [[ ${PN} != "qttest" ]]; then
79 if [[ ${QT5_MODULE} == "qtbase" ]]; then
80 DEPEND+=" test? ( ~dev-qt/qttest-${PV}[debug=] )"
81 else
82 DEPEND+=" test? ( >=dev-qt/qttest-${PV}:5[debug=] )"
83 fi
84 fi
85
86 EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_install src_test pkg_postinst pkg_postrm
87
88 # @ECLASS-VARIABLE: PATCHES
89 # @DEFAULT_UNSET
90 # @DESCRIPTION:
91 # Array variable containing all the patches to be applied. This variable
92 # is expected to be defined in the global scope of ebuilds. Make sure to
93 # specify the full path. This variable is used in src_prepare phase.
94 #
95 # Example:
96 # @CODE
97 # PATCHES=(
98 # "${FILESDIR}/mypatch.patch"
99 # "${FILESDIR}/mypatch2.patch"
100 # )
101 # @CODE
102
103 # @ECLASS-VARIABLE: QT5_TARGET_SUBDIRS
104 # @DEFAULT_UNSET
105 # @DESCRIPTION:
106 # Array variable containing the source directories that should be built.
107 # All paths must be relative to ${S}.
108
109 # @ECLASS-VARIABLE: QT5_BUILD_DIR
110 # @DESCRIPTION:
111 # Build directory for out-of-source builds.
112 : ${QT5_BUILD_DIR:=${S}_build}
113
114 # @ECLASS-VARIABLE: QT5_VERBOSE_BUILD
115 # @DESCRIPTION:
116 # Set to false to reduce build output during compilation.
117 : ${QT5_VERBOSE_BUILD:=true}
118
119 # @ECLASS-VARIABLE: QCONFIG_ADD
120 # @DEFAULT_UNSET
121 # @DESCRIPTION:
122 # Array of options that must be added to QT_CONFIG in qconfig.pri
123
124 # @ECLASS-VARIABLE: QCONFIG_REMOVE
125 # @DEFAULT_UNSET
126 # @DESCRIPTION:
127 # Array of options that must be removed from QT_CONFIG in qconfig.pri
128
129 # @ECLASS-VARIABLE: QCONFIG_DEFINE
130 # @DEFAULT_UNSET
131 # @DESCRIPTION:
132 # Array of macros that must be defined in QtCore/qconfig.h
133
134 # @FUNCTION: qt5-build_pkg_setup
135 # @DESCRIPTION:
136 # Warns and/or dies if the user is trying to downgrade Qt.
137 qt5-build_pkg_setup() {
138 # Warn users of possible breakage when downgrading to a previous release.
139 # Downgrading revisions within the same release is safe.
140 if has_version ">${CATEGORY}/${P}-r9999:5"; then
141 ewarn
142 ewarn "Downgrading Qt is completely unsupported and can break your system!"
143 ewarn
144 fi
145 }
146
147 # @FUNCTION: qt5-build_src_unpack
148 # @DESCRIPTION:
149 # Unpacks the sources.
150 qt5-build_src_unpack() {
151 if ! version_is_at_least 4.4 $(gcc-version); then
152 ewarn
153 ewarn "Using a GCC version lower than 4.4 is not supported."
154 ewarn
155 fi
156
157 if [[ ${PN} == "qtwebkit" ]]; then
158 eshopts_push -s extglob
159 if is-flagq '-g?(gdb)?([1-9])'; then
160 ewarn
161 ewarn "You have enabled debug info (probably have -g or -ggdb in your CFLAGS/CXXFLAGS)."
162 ewarn "You may experience really long compilation times and/or increased memory usage."
163 ewarn "If compilation fails, please try removing -g/-ggdb before reporting a bug."
164 ewarn "For more info check out https://bugs.gentoo.org/307861"
165 ewarn
166 fi
167 eshopts_pop
168 fi
169
170 case ${QT5_BUILD_TYPE} in
171 live)
172 git-r3_src_unpack
173 ;;
174 release)
175 default
176 ;;
177 esac
178 }
179
180 # @FUNCTION: qt5-build_src_prepare
181 # @DESCRIPTION:
182 # Prepares the sources before the configure phase.
183 qt5-build_src_prepare() {
184 qt5_prepare_env
185
186 if [[ ${QT5_MODULE} == "qtbase" ]]; then
187 # Avoid unnecessary qmake recompilations
188 sed -i -re "s|^if true;.*(\[ '\!').*(\"\\\$outpath/bin/qmake\".*)|if \1 -e \2 then|" \
189 configure || die "sed failed (skip qmake bootstrap)"
190
191 # Respect CC, CXX, *FLAGS, MAKEOPTS and EXTRA_EMAKE when bootstrapping qmake
192 sed -i -e "/outpath\/qmake\".*\"\$MAKE\")/ s:): \
193 ${MAKEOPTS} ${EXTRA_EMAKE} 'CC=$(tc-getCC)' 'CXX=$(tc-getCXX)' \
194 'QMAKE_CFLAGS=${CFLAGS}' 'QMAKE_CXXFLAGS=${CXXFLAGS}' 'QMAKE_LFLAGS=${LDFLAGS}'&:" \
195 -e '/"$CFG_RELEASE_QMAKE"/,/^\s\+fi$/ d' \
196 configure || die "sed failed (respect env for qmake build)"
197 sed -i -e '/^CPPFLAGS\s*=/ s/-g //' \
198 qmake/Makefile.unix || die "sed failed (CPPFLAGS for qmake build)"
199
200 # Reset QMAKE_*FLAGS_{RELEASE,DEBUG} variables,
201 # or they will override user's flags (bug 427782)
202 sed -i -e '/^SYSTEM_VARIABLES=/ i \
203 QMakeVar set QMAKE_CFLAGS_RELEASE\
204 QMakeVar set QMAKE_CFLAGS_DEBUG\
205 QMakeVar set QMAKE_CXXFLAGS_RELEASE\
206 QMakeVar set QMAKE_CXXFLAGS_DEBUG\
207 QMakeVar set QMAKE_LFLAGS_RELEASE\
208 QMakeVar set QMAKE_LFLAGS_DEBUG\n' \
209 configure || die "sed failed (QMAKE_*FLAGS_{RELEASE,DEBUG})"
210
211 # Respect CXX in configure
212 sed -i -e "/^QMAKE_CONF_COMPILER=/ s:=.*:=\"$(tc-getCXX)\":" \
213 configure || die "sed failed (QMAKE_CONF_COMPILER)"
214
215 # Respect toolchain and flags in config.tests
216 find config.tests/unix -name '*.test' -type f -print0 | xargs -0 \
217 sed -ri -e '/CXXFLAGS=/ s/"(\$CXXFLAGS) (\$PARAM)"/"\2 \1"/' \
218 -e '/LFLAGS=/ s/"(\$LFLAGS) (\$PARAM)"/"\2 \1"/' \
219 -e '/bin\/qmake/ s/-nocache //' \
220 || die "sed failed (config.tests)"
221 fi
222
223 if [[ ${PN} != "qtcore" ]]; then
224 qt5_symlink_tools_to_buildtree
225 fi
226
227 # Apply patches
228 [[ -n ${PATCHES[@]} ]] && epatch "${PATCHES[@]}"
229 epatch_user
230 }
231
232 # @FUNCTION: qt5-build_src_configure
233 # @DESCRIPTION:
234 # Runs qmake, possibly preceded by ./configure.
235 qt5-build_src_configure() {
236 # toolchain setup
237 tc-export CC CXX RANLIB STRIP
238 # qmake-generated Makefiles use LD/LINK for linking
239 export LD="$(tc-getCXX)"
240
241 mkdir -p "${QT5_BUILD_DIR}" || die
242 pushd "${QT5_BUILD_DIR}" > /dev/null || die
243
244 if [[ ${QT5_MODULE} == "qtbase" ]]; then
245 qt5_base_configure
246 fi
247
248 qt5_foreach_target_subdir qt5_qmake
249
250 popd > /dev/null || die
251 }
252
253 # @FUNCTION: qt5-build_src_compile
254 # @DESCRIPTION:
255 # Compiles the code in target directories.
256 qt5-build_src_compile() {
257 qt5_foreach_target_subdir emake
258 }
259
260 # @FUNCTION: qt5-build_src_test
261 # @DESCRIPTION:
262 # Runs tests in target directories.
263 # TODO: find a way to avoid circular deps with USE=test.
264 qt5-build_src_test() {
265 echo ">>> Test phase [QtTest]: ${CATEGORY}/${PF}"
266
267 # create a custom testrunner script that correctly sets
268 # {,DY}LD_LIBRARY_PATH before executing the given test
269 local testrunner=${QT5_BUILD_DIR}/gentoo-testrunner
270 cat <<-EOF > "${testrunner}"
271 #!/bin/sh
272 export LD_LIBRARY_PATH="${QT5_BUILD_DIR}/lib:${QT5_LIBDIR}"
273 export DYLD_LIBRARY_PATH="${QT5_BUILD_DIR}/lib:${QT5_LIBDIR}"
274 "\$@"
275 EOF
276 chmod +x "${testrunner}"
277
278 qt5_foreach_target_subdir qt5_qmake
279 qt5_foreach_target_subdir emake
280
281 _test_runner() {
282 qt5_foreach_target_subdir emake TESTRUNNER="'${testrunner}'" check
283 }
284
285 if [[ ${VIRTUALX_REQUIRED} == test ]]; then
286 VIRTUALX_COMMAND="_test_runner" virtualmake
287 else
288 _test_runner
289 fi
290 }
291
292 # @FUNCTION: qt5-build_src_install
293 # @DESCRIPTION:
294 # Performs the actual installation of target directories.
295 qt5-build_src_install() {
296 qt5_foreach_target_subdir emake INSTALL_ROOT="${D}" install
297
298 if [[ ${PN} == "qtcore" ]]; then
299 pushd "${QT5_BUILD_DIR}" > /dev/null || die
300 einfo "Running emake INSTALL_ROOT=${D} install_{mkspecs,qmake,syncqt}"
301 emake INSTALL_ROOT="${D}" install_{mkspecs,qmake,syncqt}
302 popd > /dev/null || die
303
304 # create an empty Gentoo/gentoo-qconfig.h
305 dodir "${QT5_HEADERDIR#${EPREFIX}}"/Gentoo
306 : > "${D}${QT5_HEADERDIR}"/Gentoo/gentoo-qconfig.h
307
308 # include gentoo-qconfig.h at the beginning of QtCore/qconfig.h
309 sed -i -e '2a#include <Gentoo/gentoo-qconfig.h>\n' \
310 "${D}${QT5_HEADERDIR}"/QtCore/qconfig.h \
311 || die "sed failed (qconfig.h)"
312 fi
313
314 qt5_install_module_qconfigs
315
316 # remove .la files since we are building only shared libraries
317 prune_libtool_files
318 }
319
320 # @FUNCTION: qt5-build_pkg_postinst
321 # @DESCRIPTION:
322 # Regenerate configuration, plus throw a message about possible
323 # breakages and proposed solutions.
324 qt5-build_pkg_postinst() {
325 qt5_regenerate_global_qconfigs
326 }
327
328 # @FUNCTION: qt5-build_pkg_postrm
329 # @DESCRIPTION:
330 # Regenerate configuration when the package is completely removed.
331 qt5-build_pkg_postrm() {
332 if [[ -z ${REPLACED_BY_VERSION} && ${PN} != "qtcore" ]]; then
333 qt5_regenerate_global_qconfigs
334 fi
335 }
336
337 # @FUNCTION: qt_use
338 # @USAGE: <flag> [feature] [enableval]
339 # @DESCRIPTION:
340 # This will echo "-${enableval}-${feature}" if <flag> is enabled, or
341 # "-no-${feature}" if it's disabled. If [feature] is not specified,
342 # <flag> will be used for that. If [enableval] is not specified, the
343 # "-${enableval}" prefix is omitted.
344 qt_use() {
345 use "$1" && echo "${3:+-$3}-${2:-$1}" || echo "-no-${2:-$1}"
346 }
347
348 # @FUNCTION: qt_use_disable_mod
349 # @USAGE: <flag> <module> <files...>
350 # @DESCRIPTION:
351 # <flag> is the name of a flag in IUSE.
352 # <module> is the (lowercase) name of a Qt5 module.
353 # <files...> is a list of one or more qmake project files.
354 #
355 # This function patches <files> to treat <module> as not installed
356 # when <flag> is disabled, otherwise it does nothing.
357 # This can be useful to avoid an automagic dependency when the module
358 # is present on the system but the corresponding USE flag is disabled.
359 qt_use_disable_mod() {
360 [[ $# -ge 3 ]] || die "${FUNCNAME}() requires at least 3 arguments"
361
362 local flag=$1
363 local module=$2
364 shift 2
365
366 use "${flag}" && return
367
368 echo "$@" | xargs sed -i -e "s/qtHaveModule(${module})/false/g" || die
369 }
370
371
372 ###### Internal functions ######
373
374 # @FUNCTION: qt5_prepare_env
375 # @INTERNAL
376 # @DESCRIPTION:
377 # Prepares the environment for building Qt.
378 qt5_prepare_env() {
379 # setup installation directories
380 QT5_PREFIX=${EPREFIX}/usr
381 QT5_HEADERDIR=${QT5_PREFIX}/include/qt5
382 QT5_LIBDIR=${QT5_PREFIX}/$(get_libdir)
383 QT5_ARCHDATADIR=${QT5_PREFIX}/$(get_libdir)/qt5
384 QT5_BINDIR=${QT5_ARCHDATADIR}/bin
385 QT5_PLUGINDIR=${QT5_ARCHDATADIR}/plugins
386 QT5_LIBEXECDIR=${QT5_ARCHDATADIR}/libexec
387 QT5_IMPORTDIR=${QT5_ARCHDATADIR}/imports
388 QT5_QMLDIR=${QT5_ARCHDATADIR}/qml
389 QT5_DATADIR=${QT5_PREFIX}/share/qt5
390 QT5_DOCDIR=${QT5_PREFIX}/share/doc/qt-${PV}
391 QT5_TRANSLATIONDIR=${QT5_DATADIR}/translations
392 QT5_EXAMPLESDIR=${QT5_DATADIR}/examples
393 QT5_TESTSDIR=${QT5_DATADIR}/tests
394 QT5_SYSCONFDIR=${EPREFIX}/etc/qt5
395
396 if [[ ${QT5_MODULE} == "qtbase" ]]; then
397 # see mkspecs/features/qt_config.prf
398 # note: this could be the cause of bug 451456, so do it
399 # only when really needed, i.e. for qtbase modules
400 export QMAKEMODULES="${QT5_BUILD_DIR}/mkspecs/modules:${S}/mkspecs/modules:${QT5_ARCHDATADIR}/mkspecs/modules"
401 fi
402 }
403
404 # @FUNCTION: qt5_symlink_tools_to_buildtree
405 # @INTERNAL
406 # @DESCRIPTION:
407 # Symlinks qtcore tools to buildtree, so they can be used when building other modules.
408 qt5_symlink_tools_to_buildtree() {
409 mkdir -p "${QT5_BUILD_DIR}"/bin || die
410
411 local bin
412 for bin in "${QT5_BINDIR}"/{qmake,moc,rcc,uic,qdoc,qdbuscpp2xml,qdbusxml2cpp}; do
413 if [[ -e ${bin} ]]; then
414 ln -s "${bin}" "${QT5_BUILD_DIR}"/bin/ || die "failed to symlink ${bin}"
415 fi
416 done
417 }
418
419 # @FUNCTION: qt5_base_configure
420 # @INTERNAL
421 # @DESCRIPTION:
422 # Runs ./configure for modules belonging to qtbase.
423 qt5_base_configure() {
424 # configure arguments
425 local conf=(
426 # installation paths
427 -prefix "${QT5_PREFIX}"
428 -bindir "${QT5_BINDIR}"
429 -headerdir "${QT5_HEADERDIR}"
430 -libdir "${QT5_LIBDIR}"
431 -archdatadir "${QT5_ARCHDATADIR}"
432 -plugindir "${QT5_PLUGINDIR}"
433 -libexecdir "${QT5_LIBEXECDIR}"
434 -importdir "${QT5_IMPORTDIR}"
435 -qmldir "${QT5_QMLDIR}"
436 -datadir "${QT5_DATADIR}"
437 -docdir "${QT5_DOCDIR}"
438 -translationdir "${QT5_TRANSLATIONDIR}"
439 -sysconfdir "${QT5_SYSCONFDIR}"
440 -examplesdir "${QT5_EXAMPLESDIR}"
441 -testsdir "${QT5_TESTSDIR}"
442
443 # debug/release
444 $(use debug && echo -debug || echo -release)
445 -no-separate-debug-info
446
447 # licensing stuff
448 -opensource -confirm-license
449
450 # build shared libraries
451 -shared
452
453 # disabling accessibility support is not recommended by upstream,
454 # as it will break QStyle and may break other internal parts of Qt
455 -accessibility
456
457 # use pkg-config to detect include and library paths
458 -pkg-config
459
460 # prefer system libraries
461 -system-zlib
462 -system-pcre
463 -system-xcb
464 -system-xkbcommon
465
466 # exclude examples and tests from default build
467 -nomake examples
468 -nomake tests
469
470 # disable rpath on non-prefix (bugs 380415 and 417169)
471 $(use prefix || echo -no-rpath)
472
473 # verbosity of the configure and build phases
474 -verbose $(${QT5_VERBOSE_BUILD} || echo -silent)
475
476 # don't strip
477 -no-strip
478
479 # precompiled headers aren't really useful for us
480 # and cause problems on hardened, so turn them off
481 -no-pch
482
483 # reduce relocations in libraries through extra linker optimizations
484 # requires GNU ld >= 2.18
485 -reduce-relocations
486
487 # disable all SQL drivers by default, override in qtsql
488 -no-sql-db2 -no-sql-ibase -no-sql-mysql -no-sql-oci -no-sql-odbc
489 -no-sql-psql -no-sql-sqlite -no-sql-sqlite2 -no-sql-tds
490
491 # disable all platform plugins by default, override in qtgui
492 -no-xcb -no-xrender -no-eglfs -no-directfb -no-linuxfb -no-kms
493
494 # disable gtkstyle because it adds qt4 include paths to the compiler
495 # command line if x11-libs/cairo is built with USE=qt4 (bug 433826)
496 -no-gtkstyle
497
498 # do not build with -Werror
499 -no-warnings-are-errors
500
501 # module-specific options
502 "${myconf[@]}"
503 )
504
505 einfo "Configuring with: ${conf[@]}"
506 "${S}"/configure "${conf[@]}" || die "configure failed"
507 }
508
509 # @FUNCTION: qt5_qmake
510 # @INTERNAL
511 # @DESCRIPTION:
512 # Helper function that runs qmake in the current target subdir.
513 # Intended to be called by qt5_foreach_target_subdir().
514 qt5_qmake() {
515 local projectdir=${PWD/#${QT5_BUILD_DIR}/${S}}
516
517 "${QT5_BUILD_DIR}"/bin/qmake "${projectdir}" \
518 || die "qmake failed (${projectdir})"
519 }
520
521 # @FUNCTION: qt5_foreach_target_subdir
522 # @INTERNAL
523 # @DESCRIPTION:
524 # Executes the arguments inside each directory listed in QT5_TARGET_SUBDIRS.
525 qt5_foreach_target_subdir() {
526 [[ -z ${QT5_TARGET_SUBDIRS[@]} ]] && QT5_TARGET_SUBDIRS=("")
527
528 local subdir
529 for subdir in "${QT5_TARGET_SUBDIRS[@]}"; do
530 if [[ ${EBUILD_PHASE} == "test" ]]; then
531 subdir=tests/auto${subdir#src}
532 [[ -d ${S}/${subdir} ]] || continue
533 fi
534
535 mkdir -p "${QT5_BUILD_DIR}/${subdir}" || die
536 pushd "${QT5_BUILD_DIR}/${subdir}" > /dev/null || die
537
538 einfo "Running $* ${subdir:+in ${subdir}}"
539 "$@"
540
541 popd > /dev/null || die
542 done
543 }
544
545 # @FUNCTION: qt5_install_module_qconfigs
546 # @INTERNAL
547 # @DESCRIPTION:
548 # Creates and installs gentoo-specific ${PN}-qconfig.{h,pri} files.
549 qt5_install_module_qconfigs() {
550 local x
551
552 # qconfig.h
553 : > "${T}"/${PN}-qconfig.h
554 for x in "${QCONFIG_DEFINE[@]}"; do
555 echo "#define ${x}" >> "${T}"/${PN}-qconfig.h
556 done
557 [[ -s ${T}/${PN}-qconfig.h ]] && (
558 insinto "${QT5_HEADERDIR#${EPREFIX}}"/Gentoo
559 doins "${T}"/${PN}-qconfig.h
560 )
561
562 # qconfig.pri
563 : > "${T}"/${PN}-qconfig.pri
564 [[ -n ${QCONFIG_ADD[@]} ]] && echo "QCONFIG_ADD=${QCONFIG_ADD[@]}" \
565 >> "${T}"/${PN}-qconfig.pri
566 [[ -n ${QCONFIG_REMOVE[@]} ]] && echo "QCONFIG_REMOVE=${QCONFIG_REMOVE[@]}" \
567 >> "${T}"/${PN}-qconfig.pri
568 [[ -s ${T}/${PN}-qconfig.pri ]] && (
569 insinto "${QT5_ARCHDATADIR#${EPREFIX}}"/mkspecs/gentoo
570 doins "${T}"/${PN}-qconfig.pri
571 )
572 }
573
574 # @FUNCTION: qt5_regenerate_global_qconfigs
575 # @INTERNAL
576 # @DESCRIPTION:
577 # Generates gentoo-specific qconfig.{h,pri}.
578 # Don't die here because dying in pkg_post{inst,rm} just makes things worse.
579 qt5_regenerate_global_qconfigs() {
580 einfo "Regenerating gentoo-qconfig.h"
581
582 find "${ROOT%/}${QT5_HEADERDIR}"/Gentoo \
583 -name '*-qconfig.h' -a \! -name 'gentoo-qconfig.h' -type f \
584 -execdir cat '{}' + > "${T}"/gentoo-qconfig.h
585
586 [[ -s ${T}/gentoo-qconfig.h ]] || ewarn "Generated gentoo-qconfig.h is empty"
587 mv -f "${T}"/gentoo-qconfig.h "${ROOT%/}${QT5_HEADERDIR}"/Gentoo/gentoo-qconfig.h \
588 || eerror "Failed to install new gentoo-qconfig.h"
589
590 einfo "Updating QT_CONFIG in qconfig.pri"
591
592 local qconfig_pri=${ROOT%/}${QT5_ARCHDATADIR}/mkspecs/qconfig.pri
593 if [[ -f ${qconfig_pri} ]]; then
594 local x qconfig_add= qconfig_remove=
595 local qt_config=$(sed -n 's/^QT_CONFIG\s*+=\s*//p' "${qconfig_pri}")
596 local new_qt_config=
597
598 # generate list of QT_CONFIG entries from the existing list,
599 # appending QCONFIG_ADD and excluding QCONFIG_REMOVE
600 eshopts_push -s nullglob
601 for x in "${ROOT%/}${QT5_ARCHDATADIR}"/mkspecs/gentoo/*-qconfig.pri; do
602 qconfig_add+=" $(sed -n 's/^QCONFIG_ADD=\s*//p' "${x}")"
603 qconfig_remove+=" $(sed -n 's/^QCONFIG_REMOVE=\s*//p' "${x}")"
604 done
605 eshopts_pop
606 for x in ${qt_config} ${qconfig_add}; do
607 if ! has "${x}" ${new_qt_config} ${qconfig_remove}; then
608 new_qt_config+=" ${x}"
609 fi
610 done
611
612 # now replace the existing QT_CONFIG with the generated list
613 sed -i -e "s/^QT_CONFIG\s*+=.*/QT_CONFIG +=${new_qt_config}/" \
614 "${qconfig_pri}" || eerror "Failed to sed QT_CONFIG in ${qconfig_pri}"
615 else
616 ewarn "${qconfig_pri} does not exist or is not a regular file"
617 fi
618 }

  ViewVC Help
Powered by ViewVC 1.1.20