Gentoo Archives: gentoo-commits

From: Davide Pesavento <pesa@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: eclass/
Date: Mon, 28 Dec 2015 03:29:37
Message-Id: 1451270797.b8aeb9ef3d2b7949a850e41d72b48b031f1fdf39.pesa@gentoo
1 commit: b8aeb9ef3d2b7949a850e41d72b48b031f1fdf39
2 Author: Davide Pesavento <pesa <AT> gentoo <DOT> org>
3 AuthorDate: Mon Dec 28 02:46:37 2015 +0000
4 Commit: Davide Pesavento <pesa <AT> gentoo <DOT> org>
5 CommitDate: Mon Dec 28 02:46:37 2015 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b8aeb9ef
7
8 qt4-build.eclass: remove dead eclass
9
10 https://archives.gentoo.org/gentoo-dev/message/35353553177e12af2b0a054c96f44707
11
12 eclass/qt4-build.eclass | 806 ------------------------------------------------
13 1 file changed, 806 deletions(-)
14
15 diff --git a/eclass/qt4-build.eclass b/eclass/qt4-build.eclass
16 deleted file mode 100644
17 index 54c305c..0000000
18 --- a/eclass/qt4-build.eclass
19 +++ /dev/null
20 @@ -1,806 +0,0 @@
21 -# Copyright 1999-2015 Gentoo Foundation
22 -# Distributed under the terms of the GNU General Public License v2
23 -# $Id$
24 -
25 -# @DEAD
26 -
27 -# @ECLASS: qt4-build.eclass
28 -# @MAINTAINER:
29 -# Qt herd <qt@g.o>
30 -# @BLURB: Eclass for Qt4 split ebuilds.
31 -# @DESCRIPTION:
32 -# This eclass contains various functions that are used when building Qt4.
33 -
34 -case ${EAPI} in
35 - 4|5) : ;;
36 - *) die "qt4-build.eclass: unsupported EAPI=${EAPI:-0}" ;;
37 -esac
38 -
39 -inherit eutils flag-o-matic multilib toolchain-funcs
40 -
41 -HOMEPAGE="https://www.qt.io/"
42 -LICENSE="|| ( LGPL-2.1 GPL-3 )"
43 -SLOT="4"
44 -
45 -case ${PV} in
46 - 4.?.9999)
47 - QT4_BUILD_TYPE="live"
48 - EGIT_REPO_URI=(
49 - "git://code.qt.io/qt/qt.git"
50 - "https://code.qt.io/git/qt/qt.git"
51 - "https://github.com/qtproject/qt.git"
52 - )
53 - EGIT_BRANCH=${PV%.9999}
54 - inherit git-r3
55 - ;;
56 - *)
57 - QT4_BUILD_TYPE="release"
58 - MY_P=qt-everywhere-opensource-src-${PV/_/-}
59 - SRC_URI="http://download.qt.io/archive/qt/${PV%.*}/${PV}/${MY_P}.tar.gz"
60 - S=${WORKDIR}/${MY_P}
61 - ;;
62 -esac
63 -
64 -IUSE="aqua debug pch"
65 -[[ ${PN} != qtxmlpatterns ]] && IUSE+=" +exceptions"
66 -
67 -DEPEND="virtual/pkgconfig"
68 -if [[ ${QT4_BUILD_TYPE} == live ]]; then
69 - DEPEND+=" dev-lang/perl"
70 -fi
71 -
72 -# @FUNCTION: qt4-build_pkg_setup
73 -# @DESCRIPTION:
74 -# Sets up PATH and LD_LIBRARY_PATH.
75 -qt4-build_pkg_setup() {
76 - # Warn users of possible breakage when downgrading to a previous release.
77 - # Downgrading revisions within the same release is safe.
78 - if has_version ">${CATEGORY}/${P}-r9999:4"; then
79 - ewarn
80 - ewarn "Downgrading Qt is completely unsupported and can break your system!"
81 - ewarn
82 - fi
83 -
84 - PATH="${S}/bin${PATH:+:}${PATH}"
85 - if [[ ${CHOST} != *-darwin* ]]; then
86 - LD_LIBRARY_PATH="${S}/lib${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}"
87 - else
88 - DYLD_LIBRARY_PATH="${S}/lib${DYLD_LIBRARY_PATH:+:}${DYLD_LIBRARY_PATH}"
89 - # On MacOS we *need* at least src/gui/kernel/qapplication_mac.mm for
90 - # platform detection. Note: needs to come before any directories to
91 - # avoid extract failure.
92 - [[ ${CHOST} == *-apple-darwin* ]] && \
93 - QT4_EXTRACT_DIRECTORIES="src/gui/kernel/qapplication_mac.mm
94 - ${QT4_EXTRACT_DIRECTORIES}"
95 - fi
96 -}
97 -
98 -# @ECLASS-VARIABLE: PATCHES
99 -# @DEFAULT_UNSET
100 -# @DESCRIPTION:
101 -# Array variable containing all the patches to be applied. This variable
102 -# is expected to be defined in the global scope of ebuilds. Make sure to
103 -# specify the full path. This variable is used in src_prepare phase.
104 -#
105 -# Example:
106 -# @CODE
107 -# PATCHES=(
108 -# "${FILESDIR}/mypatch.patch"
109 -# "${FILESDIR}/patches_folder/"
110 -# )
111 -# @CODE
112 -
113 -# @ECLASS-VARIABLE: QT4_EXTRACT_DIRECTORIES
114 -# @DEFAULT_UNSET
115 -# @DESCRIPTION:
116 -# Space-separated list of directories that will be extracted
117 -# from Qt tarball.
118 -
119 -# @ECLASS-VARIABLE: QT4_TARGET_DIRECTORIES
120 -# @DEFAULT_UNSET
121 -# @DESCRIPTION:
122 -# Space-separated list of directories that will be configured,
123 -# compiled, and installed. All paths must be relative to ${S}.
124 -
125 -# @FUNCTION: qt4-build_src_unpack
126 -# @DESCRIPTION:
127 -# Unpacks the sources.
128 -qt4-build_src_unpack() {
129 - setqtenv
130 -
131 - if [[ $(gcc-major-version) -lt 4 ]] || [[ $(gcc-major-version) -eq 4 && $(gcc-minor-version) -lt 4 ]]; then
132 - ewarn
133 - ewarn "Using a GCC version lower than 4.4 is not supported."
134 - ewarn
135 - fi
136 -
137 - if [[ ${PN} == qtwebkit ]]; then
138 - eshopts_push -s extglob
139 - if is-flagq '-g?(gdb)?([1-9])'; then
140 - ewarn
141 - ewarn "You have enabled debug info (probably have -g or -ggdb in your CFLAGS/CXXFLAGS)."
142 - ewarn "You may experience really long compilation times and/or increased memory usage."
143 - ewarn "If compilation fails, please try removing -g/-ggdb before reporting a bug."
144 - ewarn "For more info check out https://bugs.gentoo.org/307861"
145 - ewarn
146 - fi
147 - eshopts_pop
148 - fi
149 -
150 - case ${QT4_BUILD_TYPE} in
151 - live)
152 - git-r3_src_unpack
153 - ;;
154 - release)
155 - local tarball="${MY_P}.tar.gz" target= targets=
156 - for target in configure LICENSE.GPL3 LICENSE.LGPL projects.pro \
157 - src/{qbase,qt_targets,qt_install}.pri bin config.tests \
158 - mkspecs qmake ${QT4_EXTRACT_DIRECTORIES}
159 - do
160 - targets+="${MY_P}/${target} "
161 - done
162 -
163 - ebegin "Unpacking parts of ${tarball}:" ${targets//${MY_P}\/}
164 - tar -xzf "${DISTDIR}/${tarball}" ${targets}
165 - eend $? || die "failed to unpack"
166 - ;;
167 - esac
168 -}
169 -
170 -# @FUNCTION: qt4-build_src_prepare
171 -# @DESCRIPTION:
172 -# Prepare the sources before the configure phase. Strip CFLAGS if necessary, and fix
173 -# the build system in order to respect CFLAGS/CXXFLAGS/LDFLAGS specified in make.conf.
174 -qt4-build_src_prepare() {
175 - setqtenv
176 -
177 - if [[ ${QT4_BUILD_TYPE} == live ]]; then
178 - QTDIR="." ./bin/syncqt || die "syncqt failed"
179 - fi
180 -
181 - # avoid X11 dependency in non-gui packages
182 - local nolibx11_pkgs="qtbearer qtcore qtdbus qtscript qtsql qttest qtxmlpatterns"
183 - has ${PN} ${nolibx11_pkgs} && qt_nolibx11
184 -
185 - if use aqua; then
186 - # provide a proper macx-g++-64
187 - use x64-macos && ln -s macx-g++ mkspecs/$(qt_mkspecs_dir)
188 -
189 - sed -e '/^CONFIG/s:app_bundle::' \
190 - -e '/^CONFIG/s:plugin_no_soname:plugin_with_soname absolute_library_soname:' \
191 - -i mkspecs/$(qt_mkspecs_dir)/qmake.conf || die
192 - fi
193 -
194 - if [[ ${CATEGORY}/${PN} != dev-qt/qtcore ]]; then
195 - skip_qmake_build
196 - skip_project_generation
197 - symlink_binaries_to_buildtree
198 - else
199 - # Bug 373061
200 - # qmake bus errors with -O2 or -O3 but -O1 works
201 - if [[ ${CHOST} == *86*-apple-darwin* ]]; then
202 - replace-flags -O[23] -O1
203 - fi
204 -
205 - # Bug 503500
206 - # undefined reference with -Os and --as-needed
207 - if use x86; then
208 - replace-flags -Os -O2
209 - fi
210 - fi
211 -
212 - # Bug 261632
213 - if use ppc64; then
214 - append-flags -mminimal-toc
215 - fi
216 -
217 - # Bug 417105
218 - # graphite on gcc 4.7 causes miscompilations
219 - if [[ $(gcc-version) == "4.7" ]]; then
220 - filter-flags -fgraphite-identity
221 - fi
222 -
223 - if use_if_iuse c++0x; then
224 - append-cxxflags -std=c++0x
225 - fi
226 -
227 - # Respect CC, CXX, {C,CXX,LD}FLAGS in .qmake.cache
228 - sed -e "/^SYSTEM_VARIABLES=/i \
229 - CC='$(tc-getCC)'\n\
230 - CXX='$(tc-getCXX)'\n\
231 - CFLAGS='${CFLAGS}'\n\
232 - CXXFLAGS='${CXXFLAGS}'\n\
233 - LDFLAGS='${LDFLAGS}'\n\
234 - QMakeVar set QMAKE_CFLAGS_RELEASE\n\
235 - QMakeVar set QMAKE_CFLAGS_DEBUG\n\
236 - QMakeVar set QMAKE_CXXFLAGS_RELEASE\n\
237 - QMakeVar set QMAKE_CXXFLAGS_DEBUG\n\
238 - QMakeVar set QMAKE_LFLAGS_RELEASE\n\
239 - QMakeVar set QMAKE_LFLAGS_DEBUG\n"\
240 - -i configure \
241 - || die "sed SYSTEM_VARIABLES failed"
242 -
243 - # Respect CC, CXX, LINK and *FLAGS in config.tests
244 - find config.tests/unix -name '*.test' -type f -print0 | xargs -0 \
245 - sed -i -e "/bin\/qmake/ s: \"\$SRCDIR/: \
246 - 'QMAKE_CC=$(tc-getCC)' 'QMAKE_CXX=$(tc-getCXX)' 'QMAKE_LINK=$(tc-getCXX)' \
247 - 'QMAKE_CFLAGS+=${CFLAGS}' 'QMAKE_CXXFLAGS+=${CXXFLAGS}' 'QMAKE_LFLAGS+=${LDFLAGS}'&:" \
248 - || die "sed config.tests failed"
249 -
250 - # Bug 172219
251 - sed -e 's:/X11R6/:/:' -i mkspecs/$(qt_mkspecs_dir)/qmake.conf || die
252 -
253 - if [[ ${CHOST} == *-darwin* ]]; then
254 - # Set FLAGS *and* remove -arch, since our gcc-apple is multilib
255 - # crippled (by design) :/
256 - local mac_gpp_conf=
257 - if [[ -f mkspecs/common/mac-g++.conf ]]; then
258 - # qt < 4.8 has mac-g++.conf
259 - mac_gpp_conf="mkspecs/common/mac-g++.conf"
260 - elif [[ -f mkspecs/common/g++-macx.conf ]]; then
261 - # qt >= 4.8 has g++-macx.conf
262 - mac_gpp_conf="mkspecs/common/g++-macx.conf"
263 - else
264 - die "no known conf file for mac found"
265 - fi
266 - sed \
267 - -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \
268 - -e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \
269 - -e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=-headerpad_max_install_names ${LDFLAGS}:" \
270 - -e "s:-arch\s\w*::g" \
271 - -i ${mac_gpp_conf} \
272 - || die "sed ${mac_gpp_conf} failed"
273 -
274 - # Fix configure's -arch settings that appear in qmake/Makefile and also
275 - # fix arch handling (automagically duplicates our -arch arg and breaks
276 - # pch). Additionally disable Xarch support.
277 - local mac_gcc_confs="${mac_gpp_conf}"
278 - if [[ -f mkspecs/common/gcc-base-macx.conf ]]; then
279 - mac_gcc_confs+=" mkspecs/common/gcc-base-macx.conf"
280 - fi
281 - sed \
282 - -e "s:-arch i386::" \
283 - -e "s:-arch ppc::" \
284 - -e "s:-arch x86_64::" \
285 - -e "s:-arch ppc64::" \
286 - -e "s:-arch \$i::" \
287 - -e "/if \[ ! -z \"\$NATIVE_64_ARCH\" \]; then/,/fi/ d" \
288 - -e "s:CFG_MAC_XARCH=yes:CFG_MAC_XARCH=no:g" \
289 - -e "s:-Xarch_x86_64::g" \
290 - -e "s:-Xarch_ppc64::g" \
291 - -i configure ${mac_gcc_confs} \
292 - || die "sed -arch/-Xarch failed"
293 -
294 - # On Snow Leopard don't fall back to 10.5 deployment target.
295 - if [[ ${CHOST} == *-apple-darwin10 ]]; then
296 - sed -e "s:QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET.*:QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET 10.6:g" \
297 - -e "s:-mmacosx-version-min=10.[0-9]:-mmacosx-version-min=10.6:g" \
298 - -i configure ${mac_gpp_conf} \
299 - || die "sed deployment target failed"
300 - fi
301 - fi
302 -
303 - # this one is needed for all systems with a separate -liconv, apart from
304 - # Darwin, for which the sources already cater for -liconv
305 - if use !elibc_glibc && [[ ${CHOST} != *-darwin* ]]; then
306 - sed -e 's|mac:\(LIBS += -liconv\)|\1|g' \
307 - -i config.tests/unix/iconv/iconv.pro \
308 - || die "sed iconv.pro failed"
309 - fi
310 -
311 - # we need some patches for Solaris
312 - sed -i -e '/^QMAKE_LFLAGS_THREAD/a\QMAKE_LFLAGS_DYNAMIC_LIST = -Wl,--dynamic-list,' \
313 - mkspecs/$(qt_mkspecs_dir)/qmake.conf || die
314 - # use GCC over SunStudio
315 - sed -i -e '/PLATFORM=solaris-cc/s/cc/g++/' configure || die
316 - # do not flirt with non-Prefix stuff, we're quite possessive
317 - sed -i -e '/^QMAKE_\(LIB\|INC\)DIR\(_X11\|_OPENGL\|\)\t/s/=.*$/=/' \
318 - mkspecs/$(qt_mkspecs_dir)/qmake.conf || die
319 -
320 - # apply patches
321 - [[ -n ${PATCHES[@]} ]] && epatch "${PATCHES[@]}"
322 - epatch_user
323 -}
324 -
325 -# @FUNCTION: qt4-build_src_configure
326 -# @DESCRIPTION:
327 -# Default configure phase
328 -qt4-build_src_configure() {
329 - setqtenv
330 -
331 - local conf="
332 - -prefix ${QTPREFIXDIR}
333 - -bindir ${QTBINDIR}
334 - -libdir ${QTLIBDIR}
335 - -docdir ${QTDOCDIR}
336 - -headerdir ${QTHEADERDIR}
337 - -plugindir ${QTPLUGINDIR}
338 - -importdir ${QTIMPORTDIR}
339 - -datadir ${QTDATADIR}
340 - -translationdir ${QTTRANSDIR}
341 - -sysconfdir ${QTSYSCONFDIR}
342 - -examplesdir ${QTEXAMPLESDIR}
343 - -demosdir ${QTDEMOSDIR}
344 - -opensource -confirm-license
345 - -shared -fast -largefile -stl -verbose
346 - -nomake examples -nomake demos"
347 -
348 - # ARCH is set on Gentoo. Qt now falls back to generic on an unsupported
349 - # $(tc-arch). Therefore we convert it to supported values.
350 - case "$(tc-arch)" in
351 - amd64|x64-*) conf+=" -arch x86_64" ;;
352 - ppc-macos) conf+=" -arch ppc" ;;
353 - ppc|ppc64|ppc-*) conf+=" -arch powerpc" ;;
354 - sparc|sparc-*|sparc64-*) conf+=" -arch sparc" ;;
355 - x86-macos) conf+=" -arch x86" ;;
356 - x86|x86-*) conf+=" -arch i386" ;;
357 - alpha|arm|ia64|mips|s390) conf+=" -arch $(tc-arch)" ;;
358 - arm64|hppa|sh) conf+=" -arch generic" ;;
359 - *) die "$(tc-arch) is unsupported by this eclass. Please file a bug." ;;
360 - esac
361 -
362 - conf+=" -platform $(qt_mkspecs_dir)"
363 -
364 - [[ $(get_libdir) != lib ]] && conf+=" -L${EPREFIX}/usr/$(get_libdir)"
365 -
366 - # debug/release
367 - if use debug; then
368 - conf+=" -debug"
369 - else
370 - conf+=" -release"
371 - fi
372 - conf+=" -no-separate-debug-info"
373 -
374 - # exceptions USE flag
375 - conf+=" $(in_iuse exceptions && qt_use exceptions || echo -exceptions)"
376 -
377 - # disable rpath (bug 380415), except on prefix (bug 417169)
378 - use prefix || conf+=" -no-rpath"
379 -
380 - # precompiled headers don't work on hardened, where the flag is masked
381 - conf+=" $(qt_use pch)"
382 -
383 - # -reduce-relocations
384 - # This flag seems to introduce major breakage to applications,
385 - # mostly to be seen as a core dump with the message "QPixmap: Must
386 - # construct a QApplication before a QPaintDevice" on Solaris.
387 - # -- Daniel Vergien
388 - [[ ${CHOST} != *-solaris* ]] && conf+=" -reduce-relocations"
389 -
390 - # this one is needed for all systems with a separate -liconv, apart from
391 - # Darwin, for which the sources already cater for -liconv
392 - if use !elibc_glibc && [[ ${CHOST} != *-darwin* ]]; then
393 - conf+=" -liconv"
394 - fi
395 -
396 - if use_if_iuse glib; then
397 - local glibflags="$(pkg-config --cflags --libs glib-2.0 gthread-2.0)"
398 - # avoid the -pthread argument
399 - conf+=" ${glibflags//-pthread}"
400 - unset glibflags
401 - fi
402 -
403 - if use aqua; then
404 - # On (snow) leopard use the new (frameworked) cocoa code.
405 - if [[ ${CHOST##*-darwin} -ge 9 ]]; then
406 - conf+=" -cocoa -framework"
407 - # We need the source's headers, not the installed ones.
408 - conf+=" -I${S}/include"
409 - # Add hint for the framework location.
410 - conf+=" -F${QTLIBDIR}"
411 -
412 - # We are crazy and build cocoa + qt3support :-)
413 - if use qt3support; then
414 - sed -e "/case \"\$PLATFORM,\$CFG_MAC_COCOA\" in/,/;;/ s|CFG_QT3SUPPORT=\"no\"|CFG_QT3SUPPORT=\"yes\"|" \
415 - -i configure || die
416 - fi
417 - else
418 - conf+=" -no-framework"
419 - fi
420 - else
421 - # freetype2 include dir is non-standard, thus pass it to configure
422 - conf+=" $(pkg-config --cflags-only-I freetype2)"
423 - fi
424 -
425 - conf+=" ${myconf}"
426 - myconf=
427 -
428 - echo ./configure ${conf}
429 - ./configure ${conf} || die "./configure failed"
430 -
431 - prepare_directories ${QT4_TARGET_DIRECTORIES}
432 -}
433 -
434 -# @FUNCTION: qt4-build_src_compile
435 -# @DESCRIPTION:
436 -# Actual compile phase
437 -qt4-build_src_compile() {
438 - setqtenv
439 -
440 - build_directories ${QT4_TARGET_DIRECTORIES}
441 -}
442 -
443 -# @FUNCTION: qt4-build_src_test
444 -# @DESCRIPTION:
445 -# Runs tests only in target directories.
446 -qt4-build_src_test() {
447 - # QtMultimedia does not have any test suite (bug #332299)
448 - [[ ${CATEGORY}/${PN} == dev-qt/qtmultimedia ]] && return
449 -
450 - for dir in ${QT4_TARGET_DIRECTORIES}; do
451 - emake -j1 check -C ${dir}
452 - done
453 -}
454 -
455 -# @FUNCTION: fix_includes
456 -# @DESCRIPTION:
457 -# For MacOS X we need to add some symlinks when frameworks are
458 -# being used, to avoid complications with some more or less stupid packages.
459 -fix_includes() {
460 - if use aqua && [[ ${CHOST##*-darwin} -ge 9 ]]; then
461 - local frw dest f h rdir
462 - # Some packages tend to include <Qt/...>
463 - dodir "${QTHEADERDIR#${EPREFIX}}"/Qt
464 -
465 - # Fake normal headers when frameworks are installed... eases life later
466 - # on, make sure we use relative links though, as some ebuilds assume
467 - # these dirs exist in src_install to add additional files
468 - f=${QTHEADERDIR}
469 - h=${QTLIBDIR}
470 - while [[ -n ${f} && ${f%%/*} == ${h%%/*} ]] ; do
471 - f=${f#*/}
472 - h=${h#*/}
473 - done
474 - rdir=${h}
475 - f="../"
476 - while [[ ${h} == */* ]] ; do
477 - f="${f}../"
478 - h=${h#*/}
479 - done
480 - rdir="${f}${rdir}"
481 -
482 - for frw in "${D}${QTLIBDIR}"/*.framework; do
483 - [[ -e "${frw}"/Headers ]] || continue
484 - f=$(basename ${frw})
485 - dest="${QTHEADERDIR#${EPREFIX}}"/${f%.framework}
486 - dosym "${rdir}"/${f}/Headers "${dest}"
487 -
488 - # Link normal headers as well.
489 - for hdr in "${D}/${QTLIBDIR}/${f}"/Headers/*; do
490 - h=$(basename ${hdr})
491 - dosym "../${rdir}"/${f}/Headers/${h} \
492 - "${QTHEADERDIR#${EPREFIX}}"/Qt/${h}
493 - done
494 - done
495 - fi
496 -}
497 -
498 -# @FUNCTION: qt4-build_src_install
499 -# @DESCRIPTION:
500 -# Perform the actual installation including some library fixes.
501 -qt4-build_src_install() {
502 - setqtenv
503 -
504 - install_directories ${QT4_TARGET_DIRECTORIES}
505 - install_qconfigs
506 - fix_library_files
507 - fix_includes
508 -
509 - # remove .la files since we are building only shared libraries
510 - prune_libtool_files
511 -}
512 -
513 -# @FUNCTION: setqtenv
514 -# @INTERNAL
515 -setqtenv() {
516 - # Set up installation directories
517 - QTPREFIXDIR=${EPREFIX}/usr
518 - QTBINDIR=${QTPREFIXDIR}/bin
519 - QTLIBDIR=${QTPREFIXDIR}/$(get_libdir)/qt4
520 - QTPCDIR=${QTPREFIXDIR}/$(get_libdir)/pkgconfig
521 - QTDOCDIR=${QTPREFIXDIR}/share/doc/qt-${PV}
522 - QTHEADERDIR=${QTPREFIXDIR}/include/qt4
523 - QTPLUGINDIR=${QTLIBDIR}/plugins
524 - QTIMPORTDIR=${QTLIBDIR}/imports
525 - QTDATADIR=${QTPREFIXDIR}/share/qt4
526 - QTTRANSDIR=${QTDATADIR}/translations
527 - QTSYSCONFDIR=${EPREFIX}/etc/qt4
528 - QTEXAMPLESDIR=${QTDATADIR}/examples
529 - QTDEMOSDIR=${QTDATADIR}/demos
530 - QMAKE_LIBDIR_QT=${QTLIBDIR}
531 -
532 - PLATFORM=$(qt_mkspecs_dir)
533 - unset QMAKESPEC
534 -
535 - export XDG_CONFIG_HOME="${T}"
536 -}
537 -
538 -# @FUNCTION: prepare_directories
539 -# @USAGE: < directories >
540 -# @INTERNAL
541 -# @DESCRIPTION:
542 -# Generates Makefiles for the given list of directories.
543 -prepare_directories() {
544 - for x in "$@"; do
545 - pushd "${S}"/${x} >/dev/null || die
546 - einfo "Running qmake in: ${x}"
547 - "${S}"/bin/qmake \
548 - "LIBS+=-L${QTLIBDIR}" \
549 - "CONFIG+=nostrip" \
550 - || die "qmake failed"
551 - popd >/dev/null || die
552 - done
553 -}
554 -
555 -# @FUNCTION: build_directories
556 -# @USAGE: < directories >
557 -# @INTERNAL
558 -# @DESCRIPTION:
559 -# Compiles the code in the given list of directories.
560 -build_directories() {
561 - for x in "$@"; do
562 - pushd "${S}"/${x} >/dev/null || die
563 - emake \
564 - AR="$(tc-getAR) cqs" \
565 - CC="$(tc-getCC)" \
566 - CXX="$(tc-getCXX)" \
567 - LINK="$(tc-getCXX)" \
568 - RANLIB=":" \
569 - STRIP=":"
570 - popd >/dev/null || die
571 - done
572 -}
573 -
574 -# @FUNCTION: install_directories
575 -# @USAGE: < directories >
576 -# @INTERNAL
577 -# @DESCRIPTION:
578 -# Runs emake install in the given directories, which are separated by spaces.
579 -install_directories() {
580 - for x in "$@"; do
581 - pushd "${S}"/${x} >/dev/null || die
582 - emake INSTALL_ROOT="${D}" install
583 - popd >/dev/null || die
584 - done
585 -}
586 -
587 -# @ECLASS-VARIABLE: QCONFIG_ADD
588 -# @DESCRIPTION:
589 -# List options that need to be added to QT_CONFIG in qconfig.pri
590 -: ${QCONFIG_ADD:=}
591 -
592 -# @ECLASS-VARIABLE: QCONFIG_REMOVE
593 -# @DESCRIPTION:
594 -# List options that need to be removed from QT_CONFIG in qconfig.pri
595 -: ${QCONFIG_REMOVE:=}
596 -
597 -# @ECLASS-VARIABLE: QCONFIG_DEFINE
598 -# @DESCRIPTION:
599 -# List variables that should be defined at the top of QtCore/qconfig.h
600 -: ${QCONFIG_DEFINE:=}
601 -
602 -# @FUNCTION: install_qconfigs
603 -# @INTERNAL
604 -# @DESCRIPTION:
605 -# Install gentoo-specific mkspecs configurations.
606 -install_qconfigs() {
607 - local x
608 - if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} ]]; then
609 - for x in QCONFIG_ADD QCONFIG_REMOVE; do
610 - [[ -n ${!x} ]] && echo ${x}=${!x} >> "${T}"/${PN}-qconfig.pri
611 - done
612 - insinto ${QTDATADIR#${EPREFIX}}/mkspecs/gentoo
613 - doins "${T}"/${PN}-qconfig.pri
614 - fi
615 -
616 - if [[ -n ${QCONFIG_DEFINE} ]]; then
617 - for x in ${QCONFIG_DEFINE}; do
618 - echo "#define ${x}" >> "${T}"/gentoo-${PN}-qconfig.h
619 - done
620 - insinto ${QTHEADERDIR#${EPREFIX}}/Gentoo
621 - doins "${T}"/gentoo-${PN}-qconfig.h
622 - fi
623 -}
624 -
625 -# @FUNCTION: generate_qconfigs
626 -# @INTERNAL
627 -# @DESCRIPTION:
628 -# Generates gentoo-specific qconfig.{h,pri}.
629 -generate_qconfigs() {
630 - if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} || -n ${QCONFIG_DEFINE} || ${CATEGORY}/${PN} == dev-qt/qtcore ]]; then
631 - local x qconfig_add qconfig_remove qconfig_new
632 - for x in "${ROOT}${QTDATADIR}"/mkspecs/gentoo/*-qconfig.pri; do
633 - [[ -f ${x} ]] || continue
634 - qconfig_add+=" $(sed -n 's/^QCONFIG_ADD=//p' "${x}")"
635 - qconfig_remove+=" $(sed -n 's/^QCONFIG_REMOVE=//p' "${x}")"
636 - done
637 -
638 - # these error checks do not use die because dying in pkg_post{inst,rm}
639 - # just makes things worse.
640 - if [[ -e "${ROOT}${QTDATADIR}"/mkspecs/gentoo/qconfig.pri ]]; then
641 - # start with the qconfig.pri that qtcore installed
642 - if ! cp "${ROOT}${QTDATADIR}"/mkspecs/gentoo/qconfig.pri \
643 - "${ROOT}${QTDATADIR}"/mkspecs/qconfig.pri; then
644 - eerror "cp qconfig failed."
645 - return 1
646 - fi
647 -
648 - # generate list of QT_CONFIG entries from the existing list
649 - # including qconfig_add and excluding qconfig_remove
650 - for x in $(sed -n 's/^QT_CONFIG +=//p' \
651 - "${ROOT}${QTDATADIR}"/mkspecs/qconfig.pri) ${qconfig_add}; do
652 - has ${x} ${qconfig_remove} || qconfig_new+=" ${x}"
653 - done
654 -
655 - # replace the existing QT_CONFIG list with qconfig_new
656 - if ! sed -i -e "s/QT_CONFIG +=.*/QT_CONFIG += ${qconfig_new}/" \
657 - "${ROOT}${QTDATADIR}"/mkspecs/qconfig.pri; then
658 - eerror "Sed for QT_CONFIG failed"
659 - return 1
660 - fi
661 -
662 - # create Gentoo/qconfig.h
663 - if [[ ! -e ${ROOT}${QTHEADERDIR}/Gentoo ]]; then
664 - if ! mkdir -p "${ROOT}${QTHEADERDIR}"/Gentoo; then
665 - eerror "mkdir ${QTHEADERDIR}/Gentoo failed"
666 - return 1
667 - fi
668 - fi
669 - : > "${ROOT}${QTHEADERDIR}"/Gentoo/gentoo-qconfig.h
670 - for x in "${ROOT}${QTHEADERDIR}"/Gentoo/gentoo-*-qconfig.h; do
671 - [[ -f ${x} ]] || continue
672 - cat "${x}" >> "${ROOT}${QTHEADERDIR}"/Gentoo/gentoo-qconfig.h
673 - done
674 - else
675 - rm -f "${ROOT}${QTDATADIR}"/mkspecs/qconfig.pri
676 - rm -f "${ROOT}${QTHEADERDIR}"/Gentoo/gentoo-qconfig.h
677 - rmdir "${ROOT}${QTDATADIR}"/mkspecs \
678 - "${ROOT}${QTDATADIR}" \
679 - "${ROOT}${QTHEADERDIR}"/Gentoo \
680 - "${ROOT}${QTHEADERDIR}" 2>/dev/null
681 - fi
682 - fi
683 -}
684 -
685 -# @FUNCTION: qt4-build_pkg_postrm
686 -# @DESCRIPTION:
687 -# Regenerate configuration when the package is completely removed.
688 -qt4-build_pkg_postrm() {
689 - generate_qconfigs
690 -}
691 -
692 -# @FUNCTION: qt4-build_pkg_postinst
693 -# @DESCRIPTION:
694 -# Regenerate configuration, plus throw a message about possible
695 -# breakages and proposed solutions.
696 -qt4-build_pkg_postinst() {
697 - generate_qconfigs
698 -}
699 -
700 -# @FUNCTION: skip_qmake_build
701 -# @INTERNAL
702 -# @DESCRIPTION:
703 -# Patches configure to skip qmake compilation, as it's already installed by qtcore.
704 -skip_qmake_build() {
705 - sed -i -e "s:if true:if false:g" "${S}"/configure || die
706 -}
707 -
708 -# @FUNCTION: skip_project_generation
709 -# @INTERNAL
710 -# @DESCRIPTION:
711 -# Exit the script early by throwing in an exit before all of the .pro files are scanned.
712 -skip_project_generation() {
713 - sed -i -e "s:echo \"Finding:exit 0\n\necho \"Finding:g" "${S}"/configure || die
714 -}
715 -
716 -# @FUNCTION: symlink_binaries_to_buildtree
717 -# @INTERNAL
718 -# @DESCRIPTION:
719 -# Symlinks generated binaries to buildtree, so they can be used during compilation time.
720 -symlink_binaries_to_buildtree() {
721 - for bin in qmake moc uic rcc; do
722 - ln -s "${QTBINDIR}"/${bin} "${S}"/bin/ || die "symlinking ${bin} to ${S}/bin failed"
723 - done
724 -}
725 -
726 -# @FUNCTION: fix_library_files
727 -# @INTERNAL
728 -# @DESCRIPTION:
729 -# Fixes the paths in *.la, *.prl, *.pc, as they are wrong due to sandbox and
730 -# moves the *.pc files into the pkgconfig directory.
731 -fix_library_files() {
732 - local libfile
733 - for libfile in "${D}"/${QTLIBDIR}/{*.la,*.prl,pkgconfig/*.pc}; do
734 - if [[ -e ${libfile} ]]; then
735 - sed -i -e "s:${S}/lib:${QTLIBDIR}:g" ${libfile} || die "sed on ${libfile} failed"
736 - fi
737 - done
738 -
739 - # pkgconfig files refer to WORKDIR/bin as the moc and uic locations
740 - for libfile in "${D}"/${QTLIBDIR}/pkgconfig/*.pc; do
741 - if [[ -e ${libfile} ]]; then
742 - sed -i -e "s:${S}/bin:${QTBINDIR}:g" ${libfile} || die "sed on ${libfile} failed"
743 -
744 - # Move .pc files into the pkgconfig directory
745 - dodir ${QTPCDIR#${EPREFIX}}
746 - mv ${libfile} "${D}"/${QTPCDIR}/ || die "moving ${libfile} to ${D}/${QTPCDIR}/ failed"
747 - fi
748 - done
749 -
750 - # Don't install an empty directory
751 - rmdir "${D}"/${QTLIBDIR}/pkgconfig
752 -}
753 -
754 -# @FUNCTION: qt_use
755 -# @USAGE: < flag > [ feature ] [ enableval ]
756 -# @DESCRIPTION:
757 -# This will echo "-${enableval}-${feature}" if <flag> is enabled, or
758 -# "-no-${feature}" if it's disabled. If [feature] is not specified, <flag>
759 -# will be used for that. If [enableval] is not specified, it omits the
760 -# "-${enableval}" part.
761 -qt_use() {
762 - use "$1" && echo "${3:+-$3}-${2:-$1}" || echo "-no-${2:-$1}"
763 -}
764 -
765 -# @FUNCTION: qt_mkspecs_dir
766 -# @RETURN: the specs-directory w/o path
767 -# @DESCRIPTION:
768 -# Allows us to define which mkspecs dir we want to use.
769 -qt_mkspecs_dir() {
770 - local spec=
771 -
772 - case "${CHOST}" in
773 - *-freebsd*|*-dragonfly*)
774 - spec=freebsd ;;
775 - *-openbsd*)
776 - spec=openbsd ;;
777 - *-netbsd*)
778 - spec=netbsd ;;
779 - *-darwin*)
780 - if use aqua; then
781 - # mac with carbon/cocoa
782 - spec=macx
783 - else
784 - # darwin/mac with x11
785 - spec=darwin
786 - fi
787 - ;;
788 - *-solaris*)
789 - spec=solaris ;;
790 - *-linux-*|*-linux)
791 - spec=linux ;;
792 - *)
793 - die "${FUNCNAME}(): Unknown CHOST '${CHOST}'" ;;
794 - esac
795 -
796 - case "$(tc-getCXX)" in
797 - *g++*)
798 - spec+=-g++ ;;
799 - *icpc*)
800 - spec+=-icc ;;
801 - *)
802 - die "${FUNCNAME}(): Unknown compiler '$(tc-getCXX)'" ;;
803 - esac
804 -
805 - # Add -64 for 64bit profiles
806 - if use x64-freebsd ||
807 - use amd64-linux ||
808 - use x64-macos ||
809 - use x64-solaris ||
810 - use sparc64-solaris
811 - then
812 - spec+=-64
813 - fi
814 -
815 - echo "${spec}"
816 -}
817 -
818 -# @FUNCTION: qt_nolibx11
819 -# @INTERNAL
820 -# @DESCRIPTION:
821 -# Skip X11 tests for packages that don't need X libraries installed.
822 -qt_nolibx11() {
823 - sed -i -e '/^if.*PLATFORM_X11.*CFG_GUI/,/^fi$/d' "${S}"/configure || die
824 -}
825 -
826 -EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_install src_test pkg_postrm pkg_postinst