| 1 | # Copyright 1999-2011 Gentoo Foundation |
1 | # Copyright 1999-2011 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.108 2011/12/25 18:49:52 pesa Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/qt4-build.eclass,v 1.109 2011/12/26 00:11:07 pesa Exp $ |
| 4 | |
4 | |
| 5 | # @ECLASS: qt4-build.eclass |
5 | # @ECLASS: qt4-build.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # Qt herd <qt@gentoo.org> |
7 | # Qt herd <qt@gentoo.org> |
| 8 | # @BLURB: Eclass for Qt4 split ebuilds. |
8 | # @BLURB: Eclass for Qt4 split ebuilds. |
| … | |
… | |
| 66 | |
66 | |
| 67 | S=${WORKDIR}/${MY_P} |
67 | S=${WORKDIR}/${MY_P} |
| 68 | |
68 | |
| 69 | # @FUNCTION: qt4-build_pkg_setup |
69 | # @FUNCTION: qt4-build_pkg_setup |
| 70 | # @DESCRIPTION: |
70 | # @DESCRIPTION: |
| 71 | # Sets up S, MY_P, PATH, and LD_LIBRARY_PATH |
71 | # Sets up PATH and LD_LIBRARY_PATH. |
| 72 | qt4-build_pkg_setup() { |
72 | qt4-build_pkg_setup() { |
| 73 | [[ ${EAPI} == 2 ]] && use !prefix && EPREFIX= |
73 | [[ ${EAPI} == 2 ]] && use !prefix && EPREFIX= |
| 74 | |
74 | |
| 75 | # Protect users by not allowing downgrades between releases |
75 | # Protect users by not allowing downgrades between releases |
| 76 | # Downgrading revisions within the same release should be allowed |
76 | # Downgrading revisions within the same release should be allowed |
| … | |
… | |
| 123 | fi |
123 | fi |
| 124 | } |
124 | } |
| 125 | |
125 | |
| 126 | # @ECLASS-VARIABLE: QT4_TARGET_DIRECTORIES |
126 | # @ECLASS-VARIABLE: QT4_TARGET_DIRECTORIES |
| 127 | # @DESCRIPTION: |
127 | # @DESCRIPTION: |
| 128 | # Arguments for build_target_directories. Takes the directories, in which the |
128 | # Arguments for build_target_directories. Takes the directories in which the |
| 129 | # code should be compiled. This is a space-separated list |
129 | # code should be compiled. This is a space-separated list. |
| 130 | |
130 | |
| 131 | # @ECLASS-VARIABLE: QT4_EXTRACT_DIRECTORIES |
131 | # @ECLASS-VARIABLE: QT4_EXTRACT_DIRECTORIES |
| 132 | # @DESCRIPTION: |
132 | # @DESCRIPTION: |
| 133 | # Space separated list including the directories that will be extracted from Qt |
133 | # Space-separated list including the directories that will be extracted from |
| 134 | # tarball |
134 | # Qt tarball. |
| 135 | |
135 | |
| 136 | # @FUNCTION: qt4-build_src_unpack |
136 | # @FUNCTION: qt4-build_src_unpack |
| 137 | # @DESCRIPTION: |
137 | # @DESCRIPTION: |
| 138 | # Unpacks the sources |
138 | # Unpacks the sources. |
| 139 | qt4-build_src_unpack() { |
139 | qt4-build_src_unpack() { |
| 140 | setqtenv |
140 | setqtenv |
| 141 | local unpack_p="${MY_P}" |
|
|
| 142 | case "${PV}" in |
|
|
| 143 | 4.8.0_*) |
|
|
| 144 | unpack_p="qt-everywhere-opensource-src-${PV/_*}" |
|
|
| 145 | ;; |
|
|
| 146 | esac |
|
|
| 147 | local target targets= |
141 | local target targets= |
| 148 | for target in configure LICENSE.GPL3 LICENSE.LGPL projects.pro \ |
142 | for target in configure LICENSE.GPL3 LICENSE.LGPL projects.pro \ |
| 149 | src/{qbase,qt_targets,qt_install}.pri bin config.tests mkspecs qmake \ |
143 | src/{qbase,qt_targets,qt_install}.pri bin config.tests mkspecs qmake \ |
| 150 | ${QT4_EXTRACT_DIRECTORIES}; do |
144 | ${QT4_EXTRACT_DIRECTORIES}; do |
| 151 | targets+=" ${unpack_p}/${target}" |
145 | targets+=" ${MY_P}/${target}" |
| 152 | done |
146 | done |
| 153 | |
147 | |
| 154 | echo tar xzf "${DISTDIR}"/${MY_P}.tar.gz ${targets} |
148 | echo tar xzf "${DISTDIR}"/${MY_P}.tar.gz ${targets} |
| 155 | tar xzf "${DISTDIR}"/${MY_P}.tar.gz ${targets} || die |
149 | tar xzf "${DISTDIR}"/${MY_P}.tar.gz ${targets} || die |
| 156 | case "${PV}" in |
|
|
| 157 | 4.8.0_*) |
|
|
| 158 | mv ${WORKDIR}/qt-everywhere-opensource-src-${PV/_*} \ |
|
|
| 159 | ${WORKDIR}/qt-everywhere-opensource-src-${MY_PV} |
|
|
| 160 | ;; |
|
|
| 161 | esac |
|
|
| 162 | } |
150 | } |
| 163 | |
151 | |
| 164 | # @ECLASS-VARIABLE: PATCHES |
152 | # @ECLASS-VARIABLE: PATCHES |
| 165 | # @DESCRIPTION: |
153 | # @DESCRIPTION: |
| 166 | # In case you have patches to apply, specify them in PATCHES variable. Make sure |
154 | # In case you have patches to apply, specify them in PATCHES variable. Make sure |
| 167 | # to specify the full path. This variable is necessary for src_prepare phase. |
155 | # to specify the full path. This variable is necessary for src_prepare phase. |
| 168 | # example: |
156 | # Example: |
| 169 | # PATCHES="${FILESDIR}"/mypatch.patch |
157 | # PATCHES="${FILESDIR}"/mypatch.patch |
| 170 | # ${FILESDIR}"/mypatch2.patch" |
158 | # ${FILESDIR}"/mypatch2.patch" |
| 171 | # |
159 | # |
| 172 | |
160 | |
| 173 | # @FUNCTION: qt4-build_src_prepare |
161 | # @FUNCTION: qt4-build_src_prepare |
| 174 | # @DESCRIPTION: |
162 | # @DESCRIPTION: |
| 175 | # Prepare the sources before the configure phase. Strip CFLAGS if necessary, and fix |
163 | # Prepare the sources before the configure phase. Strip CFLAGS if necessary, and fix |
| 176 | # source files in order to respect CFLAGS/CXXFLAGS/LDFLAGS specified on /etc/make.conf. |
164 | # the build system in order to respect CFLAGS/CXXFLAGS/LDFLAGS specified in /etc/make.conf. |
| 177 | qt4-build_src_prepare() { |
165 | qt4-build_src_prepare() { |
| 178 | setqtenv |
166 | setqtenv |
| 179 | cd "${S}" |
167 | cd "${S}" |
| 180 | |
168 | |
| 181 | if version_is_at_least "4.7"; then |
169 | if version_is_at_least "4.7"; then |
| … | |
… | |
| 190 | # provide a proper macx-g++-64 |
178 | # provide a proper macx-g++-64 |
| 191 | use x64-macos && ln -s macx-g++ mkspecs/$(qt_mkspecs_dir) |
179 | use x64-macos && ln -s macx-g++ mkspecs/$(qt_mkspecs_dir) |
| 192 | |
180 | |
| 193 | sed -e '/^CONFIG/s:app_bundle::' \ |
181 | sed -e '/^CONFIG/s:app_bundle::' \ |
| 194 | -e '/^CONFIG/s:plugin_no_soname:plugin_with_soname absolute_library_soname:' \ |
182 | -e '/^CONFIG/s:plugin_no_soname:plugin_with_soname absolute_library_soname:' \ |
| 195 | -i mkspecs/$(qt_mkspecs_dir)/qmake.conf || die "sed failed" |
183 | -i mkspecs/$(qt_mkspecs_dir)/qmake.conf || die |
| 196 | fi |
184 | fi |
| 197 | |
185 | |
| 198 | if [[ ${PN} != qt-core ]]; then |
186 | if [[ ${PN} != qt-core ]]; then |
| 199 | skip_qmake_build |
187 | skip_qmake_build |
| 200 | skip_project_generation |
188 | skip_project_generation |
| … | |
… | |
| 225 | if [[ $(gcc-major-version) -lt 4 ]] ; then |
213 | if [[ $(gcc-major-version) -lt 4 ]] ; then |
| 226 | ewarn "Appending -fno-stack-protector to CXXFLAGS" |
214 | ewarn "Appending -fno-stack-protector to CXXFLAGS" |
| 227 | append-cxxflags -fno-stack-protector |
215 | append-cxxflags -fno-stack-protector |
| 228 | # Bug 253127 |
216 | # Bug 253127 |
| 229 | sed -e "/^QMAKE_CFLAGS\t/ s:$: -fno-stack-protector-all:" \ |
217 | sed -e "/^QMAKE_CFLAGS\t/ s:$: -fno-stack-protector-all:" \ |
| 230 | -i "${S}"/mkspecs/common/g++.conf || die "sed ${S}/mkspecs/common/g++.conf failed" |
218 | -i mkspecs/common/g++.conf || die |
| 231 | fi |
219 | fi |
| 232 | |
220 | |
| 233 | # Bug 261632 |
221 | # Bug 261632 |
| 234 | if use ppc64; then |
222 | if use ppc64; then |
| 235 | ewarn "Appending -mminimal-toc to CFLAGS/CXXFLAGS" |
223 | ewarn "Appending -mminimal-toc to CFLAGS/CXXFLAGS" |
| 236 | append-flags -mminimal-toc |
224 | append-flags -mminimal-toc |
| 237 | fi |
225 | fi |
| 238 | |
226 | |
| 239 | # Bug 282984 && Bug 295530 |
227 | # Respect CC, CXX, {C,CXX,LD}FLAGS in .qmake.cache |
| 240 | sed -e "s:\(^SYSTEM_VARIABLES\):CC=\"$(tc-getCC)\"\nCXX=\"$(tc-getCXX)\"\nCFLAGS=\"${CFLAGS}\"\nCXXFLAGS=\"${CXXFLAGS}\"\nLDFLAGS=\"${LDFLAGS}\"\n\1:" \ |
228 | sed -e "/^SYSTEM_VARIABLES=/i \ |
| 241 | -i configure || die "sed qmake compilers failed" |
229 | CC='$(tc-getCC)'\n\ |
|
|
230 | CXX='$(tc-getCXX)'\n\ |
|
|
231 | CFLAGS='${CFLAGS}'\n\ |
|
|
232 | CXXFLAGS='${CXXFLAGS}'\n\ |
|
|
233 | LDFLAGS='${LDFLAGS}'\n" \ |
|
|
234 | -i configure || die "sed SYSTEM_VARIABLES failed" |
| 242 | |
235 | |
| 243 | # Bug 321335 |
236 | # Bug 321335 |
| 244 | if version_is_at_least 4.6; then |
|
|
| 245 | find ./config.tests/unix -name "*.test" -type f -exec grep -lZ \$MAKE '{}' \; | \ |
237 | find config.tests/unix -name '*.test' -type f -exec grep -lZ \$MAKE '{}' \; | xargs -0 \ |
| 246 | xargs -0 \ |
|
|
| 247 | sed -e "s:\(\$MAKE\):\1 CC=\"$(tc-getCC)\" CXX=\"$(tc-getCXX)\" LD=\"$(tc-getCXX)\" LINK=\"$(tc-getCXX)\":g" \ |
238 | sed -e "s:\(\$MAKE\):\1 CC='$(tc-getCC)' CXX='$(tc-getCXX)' LINK='$(tc-getCXX)':g" \ |
| 248 | -i || die "sed test compilers failed" |
239 | -i || die "sed test compilers failed" |
| 249 | fi |
|
|
| 250 | |
240 | |
| 251 | # Bug 172219 |
241 | # Bug 172219 |
| 252 | sed -e "s:X11R6/::" \ |
242 | sed -e "s:X11R6/::" -i mkspecs/$(qt_mkspecs_dir)/qmake.conf || die |
| 253 | -i "${S}"/mkspecs/$(qt_mkspecs_dir)/qmake.conf || die "sed ${S}/mkspecs/$(qt_mkspecs_dir)/qmake.conf failed" |
|
|
| 254 | |
243 | |
| 255 | if [[ ${CHOST} == *-darwin* ]]; then |
244 | if [[ ${CHOST} == *-darwin* ]]; then |
| 256 | # Set FLAGS *and* remove -arch, since our gcc-apple is multilib |
245 | # Set FLAGS *and* remove -arch, since our gcc-apple is multilib |
| 257 | # crippled (by design) :/ |
246 | # crippled (by design) :/ |
| 258 | sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \ |
247 | sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \ |
| … | |
… | |
| 272 | -e "s:-arch \$i::" \ |
261 | -e "s:-arch \$i::" \ |
| 273 | -e "/if \[ ! -z \"\$NATIVE_64_ARCH\" \]; then/,/fi/ d" \ |
262 | -e "/if \[ ! -z \"\$NATIVE_64_ARCH\" \]; then/,/fi/ d" \ |
| 274 | -e "s:CFG_MAC_XARCH=yes:CFG_MAC_XARCH=no:g" \ |
263 | -e "s:CFG_MAC_XARCH=yes:CFG_MAC_XARCH=no:g" \ |
| 275 | -e "s:-Xarch_x86_64::g" \ |
264 | -e "s:-Xarch_x86_64::g" \ |
| 276 | -e "s:-Xarch_ppc64::g" \ |
265 | -e "s:-Xarch_ppc64::g" \ |
| 277 | -i configure mkspecs/common/mac-g++.conf || die "sed configure failed" |
266 | -i configure mkspecs/common/mac-g++.conf || die "sed -arch/-Xarch failed" |
| 278 | |
267 | |
| 279 | # On Snow Leopard don't fall back to 10.5 deployment target. |
268 | # On Snow Leopard don't fall back to 10.5 deployment target. |
| 280 | if [[ ${CHOST} == *-apple-darwin10 ]] ; then |
269 | if [[ ${CHOST} == *-apple-darwin10 ]] ; then |
| 281 | sed -e "s:QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET.*:QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET 10.6:g" \ |
270 | sed -e "s:QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET.*:QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET 10.6:g" \ |
| 282 | -e "s:-mmacosx-version-min=10.[0-9]:-mmacosx-version-min=10.6:g" \ |
271 | -e "s:-mmacosx-version-min=10.[0-9]:-mmacosx-version-min=10.6:g" \ |
| 283 | -i configure mkspecs/common/mac-g++.conf || die "sed configure failed" |
272 | -i configure mkspecs/common/mac-g++.conf || die "sed deployment target failed" |
| 284 | fi |
273 | fi |
| 285 | fi |
274 | fi |
| 286 | |
275 | |
| 287 | # this one is needed for all systems with a separate -liconv, apart from |
276 | # this one is needed for all systems with a separate -liconv, apart from |
| 288 | # Darwin, for which the sources already cater for -liconv |
277 | # Darwin, for which the sources already cater for -liconv |
| … | |
… | |
| 385 | done |
374 | done |
| 386 | } |
375 | } |
| 387 | |
376 | |
| 388 | # @FUNCTION: fix_includes |
377 | # @FUNCTION: fix_includes |
| 389 | # @DESCRIPTION: |
378 | # @DESCRIPTION: |
| 390 | # For MacOSX we need to add some symlinks when frameworks are |
379 | # For MacOS X we need to add some symlinks when frameworks are |
| 391 | # being used, to avoid complications with some more or less stupid packages. |
380 | # being used, to avoid complications with some more or less stupid packages. |
| 392 | fix_includes() { |
381 | fix_includes() { |
| 393 | if use aqua && [[ ${CHOST##*-darwin} -ge 9 ]] ; then |
382 | if use aqua && [[ ${CHOST##*-darwin} -ge 9 ]] ; then |
| 394 | # Some packages tend to include <Qt/...> |
383 | # Some packages tend to include <Qt/...> |
| 395 | dodir "${QTHEADERDIR#${EPREFIX}}"/Qt |
384 | dodir "${QTHEADERDIR#${EPREFIX}}"/Qt |
| … | |
… | |
| 428 | } |
417 | } |
| 429 | |
418 | |
| 430 | # @FUNCTION: setqtenv |
419 | # @FUNCTION: setqtenv |
| 431 | setqtenv() { |
420 | setqtenv() { |
| 432 | # Set up installation directories |
421 | # Set up installation directories |
| 433 | QTBASEDIR=${EPREFIX}/usr/$(get_libdir)/qt4 |
|
|
| 434 | QTPREFIXDIR=${EPREFIX}/usr |
422 | QTPREFIXDIR=${EPREFIX}/usr |
| 435 | QTBINDIR=${EPREFIX}/usr/bin |
423 | QTBINDIR=${EPREFIX}/usr/bin |
| 436 | QTLIBDIR=${EPREFIX}/usr/$(get_libdir)/qt4 |
424 | QTLIBDIR=${EPREFIX}/usr/$(get_libdir)/qt4 |
| 437 | QMAKE_LIBDIR_QT=${QTLIBDIR} |
|
|
| 438 | QTPCDIR=${EPREFIX}/usr/$(get_libdir)/pkgconfig |
425 | QTPCDIR=${EPREFIX}/usr/$(get_libdir)/pkgconfig |
| 439 | QTDATADIR=${EPREFIX}/usr/share/qt4 |
|
|
| 440 | QTDOCDIR=${EPREFIX}/usr/share/doc/qt-${PV} |
426 | QTDOCDIR=${EPREFIX}/usr/share/doc/qt-${PV} |
| 441 | QTHEADERDIR=${EPREFIX}/usr/include/qt4 |
427 | QTHEADERDIR=${EPREFIX}/usr/include/qt4 |
| 442 | QTPLUGINDIR=${QTLIBDIR}/plugins |
428 | QTPLUGINDIR=${QTLIBDIR}/plugins |
| 443 | QTIMPORTDIR=${QTLIBDIR}/imports |
429 | QTIMPORTDIR=${QTLIBDIR}/imports |
|
|
430 | QTDATADIR=${EPREFIX}/usr/share/qt4 |
|
|
431 | QTTRANSDIR=${QTDATADIR}/translations |
| 444 | QTSYSCONFDIR=${EPREFIX}/etc/qt4 |
432 | QTSYSCONFDIR=${EPREFIX}/etc/qt4 |
| 445 | QTTRANSDIR=${QTDATADIR}/translations |
|
|
| 446 | QTEXAMPLESDIR=${QTDATADIR}/examples |
433 | QTEXAMPLESDIR=${QTDATADIR}/examples |
| 447 | QTDEMOSDIR=${QTDATADIR}/demos |
434 | QTDEMOSDIR=${QTDATADIR}/demos |
|
|
435 | QMAKE_LIBDIR_QT=${QTLIBDIR} |
| 448 | QT_INSTALL_PREFIX=${EPREFIX}/usr/$(get_libdir)/qt4 |
436 | QT_INSTALL_PREFIX=${EPREFIX}/usr/$(get_libdir)/qt4 |
|
|
437 | |
| 449 | PLATFORM=$(qt_mkspecs_dir) |
438 | PLATFORM=$(qt_mkspecs_dir) |
| 450 | |
439 | |
| 451 | unset QMAKESPEC |
440 | unset QMAKESPEC |
| 452 | } |
441 | } |
| 453 | |
442 | |
| … | |
… | |
| 511 | } |
500 | } |
| 512 | |
501 | |
| 513 | # @FUNCTION: prepare_directories |
502 | # @FUNCTION: prepare_directories |
| 514 | # @USAGE: < directories > |
503 | # @USAGE: < directories > |
| 515 | # @DESCRIPTION: |
504 | # @DESCRIPTION: |
| 516 | # Generates makefiles for the directories set in $QT4_TARGET_DIRECTORIES |
505 | # Generates Makefiles for the given list of directories. |
| 517 | prepare_directories() { |
506 | prepare_directories() { |
| 518 | for x in "$@"; do |
507 | for x in "$@"; do |
| 519 | pushd "${S}"/${x} >/dev/null |
508 | pushd "${S}"/${x} >/dev/null || die |
| 520 | einfo "Running qmake in: ${x}" |
509 | einfo "Running qmake in: ${x}" |
| 521 | # avoid running over the maximum argument number, bug #299810 |
510 | # avoid running over the maximum argument number, bug #299810 |
| 522 | { |
511 | { |
| 523 | echo "${S}"/mkspecs/common/*.conf |
512 | echo "${S}"/mkspecs/common/*.conf |
| 524 | find "${S}" -name '*.pr[io]' |
513 | find "${S}" -name '*.pr[io]' |
| 525 | } | xargs sed -i \ |
514 | } | xargs sed -i \ |
| 526 | -e "s:\$\$\[QT_INSTALL_LIBS\]:${QTLIBDIR}:g" \ |
515 | -e "s:\$\$\[QT_INSTALL_LIBS\]:${QTLIBDIR}:g" \ |
| 527 | -e "s:\$\$\[QT_INSTALL_PLUGINS\]:${QTPLUGINDIR}:g" \ |
516 | -e "s:\$\$\[QT_INSTALL_PLUGINS\]:${QTPLUGINDIR}:g" \ |
| 528 | || die |
517 | || die |
| 529 | "${S}"/bin/qmake "LIBS+=-L${QTLIBDIR}" "CONFIG+=nostrip" || die "qmake failed" |
518 | "${S}"/bin/qmake "LIBS+=-L${QTLIBDIR}" "CONFIG+=nostrip" || die "qmake failed" |
| 530 | popd >/dev/null |
519 | popd >/dev/null || die |
| 531 | done |
520 | done |
| 532 | } |
521 | } |
| 533 | |
522 | |
| 534 | |
523 | |
| 535 | # @FUNCTION: build_directories |
524 | # @FUNCTION: build_directories |
| 536 | # @USAGE: < directories > |
525 | # @USAGE: < directories > |
| 537 | # @DESCRIPTION: |
526 | # @DESCRIPTION: |
| 538 | # Compiles the code in $QT4_TARGET_DIRECTORIES |
527 | # Compiles the code in the given list of directories. |
| 539 | build_directories() { |
528 | build_directories() { |
| 540 | for x in "$@"; do |
529 | for x in "$@"; do |
| 541 | pushd "${S}"/${x} >/dev/null |
530 | pushd "${S}"/${x} >/dev/null || die |
| 542 | emake CC="$(tc-getCC)" \ |
531 | emake CC="$(tc-getCC)" \ |
| 543 | CXX="$(tc-getCXX)" \ |
532 | CXX="$(tc-getCXX)" \ |
| 544 | LINK="$(tc-getCXX)" || die "emake failed" |
533 | LINK="$(tc-getCXX)" || die "emake failed" |
| 545 | popd >/dev/null |
534 | popd >/dev/null || die |
| 546 | done |
535 | done |
| 547 | } |
536 | } |
| 548 | |
537 | |
| 549 | # @FUNCTION: install_directories |
538 | # @FUNCTION: install_directories |
| 550 | # @USAGE: < directories > |
539 | # @USAGE: < directories > |
| 551 | # @DESCRIPTION: |
540 | # @DESCRIPTION: |
| 552 | # run emake install in the given directories, which are separated by spaces |
541 | # Runs emake install in the given directories, which are separated by spaces. |
| 553 | install_directories() { |
542 | install_directories() { |
| 554 | for x in "$@"; do |
543 | for x in "$@"; do |
| 555 | pushd "${S}"/${x} >/dev/null || die "Can't pushd ${S}/${x}" |
544 | pushd "${S}"/${x} >/dev/null || die |
| 556 | emake INSTALL_ROOT="${D}" install || die "emake install failed" |
545 | emake INSTALL_ROOT="${D}" install || die "emake install failed" |
| 557 | popd >/dev/null || die "Can't popd from ${S}/${x}" |
546 | popd >/dev/null || die |
| 558 | done |
547 | done |
| 559 | } |
548 | } |
| 560 | |
549 | |
| 561 | # @ECLASS-VARIABLE: QCONFIG_ADD |
550 | # @ECLASS-VARIABLE: QCONFIG_ADD |
| 562 | # @DESCRIPTION: |
551 | # @DESCRIPTION: |
| … | |
… | |
| 573 | # List variables that should be defined at the top of QtCore/qconfig.h |
562 | # List variables that should be defined at the top of QtCore/qconfig.h |
| 574 | : ${QCONFIG_DEFINE:=} |
563 | : ${QCONFIG_DEFINE:=} |
| 575 | |
564 | |
| 576 | # @FUNCTION: install_qconfigs |
565 | # @FUNCTION: install_qconfigs |
| 577 | # @DESCRIPTION: |
566 | # @DESCRIPTION: |
| 578 | # Install gentoo-specific mkspecs configurations |
567 | # Install gentoo-specific mkspecs configurations. |
| 579 | install_qconfigs() { |
568 | install_qconfigs() { |
| 580 | local x |
569 | local x |
| 581 | if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} ]]; then |
570 | if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} ]]; then |
| 582 | for x in QCONFIG_ADD QCONFIG_REMOVE; do |
571 | for x in QCONFIG_ADD QCONFIG_REMOVE; do |
| 583 | [[ -n ${!x} ]] && echo ${x}=${!x} >> "${T}"/${PN}-qconfig.pri |
572 | [[ -n ${!x} ]] && echo ${x}=${!x} >> "${T}"/${PN}-qconfig.pri |
| … | |
… | |
| 595 | fi |
584 | fi |
| 596 | } |
585 | } |
| 597 | |
586 | |
| 598 | # @FUNCTION: generate_qconfigs |
587 | # @FUNCTION: generate_qconfigs |
| 599 | # @DESCRIPTION: |
588 | # @DESCRIPTION: |
| 600 | # Generates gentoo-specific configurations |
589 | # Generates gentoo-specific qconfig.{h,pri}. |
| 601 | generate_qconfigs() { |
590 | generate_qconfigs() { |
| 602 | if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} || -n ${QCONFIG_DEFINE} || ${CATEGORY}/${PN} == x11-libs/qt-core ]]; then |
591 | if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} || -n ${QCONFIG_DEFINE} || ${CATEGORY}/${PN} == x11-libs/qt-core ]]; then |
| 603 | local x qconfig_add qconfig_remove qconfig_new |
592 | local x qconfig_add qconfig_remove qconfig_new |
| 604 | for x in "${ROOT}${QTDATADIR}"/mkspecs/gentoo/*-qconfig.pri; do |
593 | for x in "${ROOT}${QTDATADIR}"/mkspecs/gentoo/*-qconfig.pri; do |
| 605 | [[ -f ${x} ]] || continue |
594 | [[ -f ${x} ]] || continue |
| … | |
… | |
| 654 | fi |
643 | fi |
| 655 | } |
644 | } |
| 656 | |
645 | |
| 657 | # @FUNCTION: qt4-build_pkg_postrm |
646 | # @FUNCTION: qt4-build_pkg_postrm |
| 658 | # @DESCRIPTION: |
647 | # @DESCRIPTION: |
| 659 | # Generate configurations when the package is completely removed |
648 | # Regenerate configuration when the package is completely removed. |
| 660 | qt4-build_pkg_postrm() { |
649 | qt4-build_pkg_postrm() { |
| 661 | generate_qconfigs |
650 | generate_qconfigs |
| 662 | } |
651 | } |
| 663 | |
652 | |
| 664 | # @FUNCTION: qt4-build_pkg_postinst |
653 | # @FUNCTION: qt4-build_pkg_postinst |
| 665 | # @DESCRIPTION: |
654 | # @DESCRIPTION: |
| 666 | # Generate configuration, plus throws a message about possible |
655 | # Regenerate configuration, plus throw a message about possible |
| 667 | # breakages and proposed solutions. |
656 | # breakages and proposed solutions. |
| 668 | qt4-build_pkg_postinst() { |
657 | qt4-build_pkg_postinst() { |
| 669 | generate_qconfigs |
658 | generate_qconfigs |
| 670 | } |
659 | } |
| 671 | |
660 | |
| 672 | # @FUNCTION: skip_qmake_build |
661 | # @FUNCTION: skip_qmake_build |
| 673 | # @DESCRIPTION: |
662 | # @DESCRIPTION: |
| 674 | # Don't need to build qmake, as it's already installed from qt-core |
663 | # Patches configure to skip qmake compilation, as it's already installed by qt-core. |
| 675 | skip_qmake_build() { |
664 | skip_qmake_build() { |
| 676 | # Don't need to build qmake, as it's already installed from qt-core |
|
|
| 677 | sed -i -e "s:if true:if false:g" "${S}"/configure || die "sed failed" |
665 | sed -i -e "s:if true:if false:g" "${S}"/configure || die |
| 678 | } |
666 | } |
| 679 | |
667 | |
| 680 | # @FUNCTION: skip_project_generation |
668 | # @FUNCTION: skip_project_generation |
| 681 | # @DESCRIPTION: |
669 | # @DESCRIPTION: |
| 682 | # Exit the script early by throwing in an exit before all of the .pro files are scanned |
670 | # Exit the script early by throwing in an exit before all of the .pro files are scanned. |
| 683 | skip_project_generation() { |
671 | skip_project_generation() { |
| 684 | # Exit the script early by throwing in an exit before all of the .pro files are scanned |
|
|
| 685 | sed -e "s:echo \"Finding:exit 0\n\necho \"Finding:g" \ |
672 | sed -i -e "s:echo \"Finding:exit 0\n\necho \"Finding:g" "${S}"/configure || die |
| 686 | -i "${S}"/configure || die "sed failed" |
|
|
| 687 | } |
673 | } |
| 688 | |
674 | |
| 689 | # @FUNCTION: symlink_binaries_to_buildtree |
675 | # @FUNCTION: symlink_binaries_to_buildtree |
| 690 | # @DESCRIPTION: |
676 | # @DESCRIPTION: |
| 691 | # Symlink generated binaries to buildtree so they can be used during compilation |
677 | # Symlinks generated binaries to buildtree, so they can be used during compilation time. |
| 692 | # time |
|
|
| 693 | symlink_binaries_to_buildtree() { |
678 | symlink_binaries_to_buildtree() { |
| 694 | for bin in qmake moc uic rcc; do |
679 | for bin in qmake moc uic rcc; do |
| 695 | ln -s "${QTBINDIR}"/${bin} "${S}"/bin/ || die "symlinking ${bin} to ${S}/bin failed" |
680 | ln -s "${QTBINDIR}"/${bin} "${S}"/bin/ || die "symlinking ${bin} to ${S}/bin failed" |
| 696 | done |
681 | done |
| 697 | } |
682 | } |
| 698 | |
683 | |
| 699 | # @FUNCTION: fix_library_files |
684 | # @FUNCTION: fix_library_files |
| 700 | # @DESCRIPTION: |
685 | # @DESCRIPTION: |
| 701 | # Fixes the pathes in *.la, *.prl, *.pc, as they are wrong due to sandbox and |
686 | # Fixes the paths in *.la, *.prl, *.pc, as they are wrong due to sandbox and |
| 702 | # moves the *.pc-files into the pkgconfig directory |
687 | # moves the *.pc files into the pkgconfig directory. |
| 703 | fix_library_files() { |
688 | fix_library_files() { |
|
|
689 | local libfile |
| 704 | for libfile in "${D}"/${QTLIBDIR}/{*.la,*.prl,pkgconfig/*.pc}; do |
690 | for libfile in "${D}"/${QTLIBDIR}/{*.la,*.prl,pkgconfig/*.pc}; do |
| 705 | if [[ -e ${libfile} ]]; then |
691 | if [[ -e ${libfile} ]]; then |
| 706 | sed -i -e "s:${S}/lib:${QTLIBDIR}:g" ${libfile} || die "sed on ${libfile} failed" |
692 | sed -i -e "s:${S}/lib:${QTLIBDIR}:g" ${libfile} || die "sed on ${libfile} failed" |
| 707 | fi |
693 | fi |
| 708 | done |
694 | done |
| 709 | |
695 | |
| 710 | # pkgconfig files refer to WORKDIR/bin as the moc and uic locations. Fix: |
696 | # pkgconfig files refer to WORKDIR/bin as the moc and uic locations |
| 711 | for libfile in "${D}"/${QTLIBDIR}/pkgconfig/*.pc; do |
697 | for libfile in "${D}"/${QTLIBDIR}/pkgconfig/*.pc; do |
| 712 | if [[ -e ${libfile} ]]; then |
698 | if [[ -e ${libfile} ]]; then |
| 713 | sed -i -e "s:${S}/bin:${QTBINDIR}:g" ${libfile} || die "sed failed" |
699 | sed -i -e "s:${S}/bin:${QTBINDIR}:g" ${libfile} || die "sed on ${libfile} failed" |
| 714 | |
700 | |
| 715 | # Move .pc files into the pkgconfig directory |
701 | # Move .pc files into the pkgconfig directory |
| 716 | dodir ${QTPCDIR#${EPREFIX}} |
702 | dodir ${QTPCDIR#${EPREFIX}} |
| 717 | mv ${libfile} "${D}"/${QTPCDIR}/ \ |
703 | mv ${libfile} "${D}"/${QTPCDIR}/ || die "moving ${libfile} to ${D}/${QTPCDIR}/ failed" |
| 718 | || die "moving ${libfile} to ${D}/${QTPCDIR}/ failed" |
|
|
| 719 | fi |
704 | fi |
| 720 | done |
705 | done |
| 721 | |
706 | |
| 722 | # Don't install an empty directory |
707 | # Don't install an empty directory |
| 723 | rmdir "${D}"/${QTLIBDIR}/pkgconfig |
708 | rmdir "${D}"/${QTLIBDIR}/pkgconfig |
| … | |
… | |
| 727 | # @USAGE: < flag > [ feature ] [ enableval ] |
712 | # @USAGE: < flag > [ feature ] [ enableval ] |
| 728 | # @DESCRIPTION: |
713 | # @DESCRIPTION: |
| 729 | # This will echo "${enableval}-${feature}" if <flag> is enabled, or |
714 | # This will echo "${enableval}-${feature}" if <flag> is enabled, or |
| 730 | # "-no-${feature} if the flag is disabled. If [feature] is not specified <flag> |
715 | # "-no-${feature} if the flag is disabled. If [feature] is not specified <flag> |
| 731 | # will be used for that. If [enableval] is not specified, it omits the |
716 | # will be used for that. If [enableval] is not specified, it omits the |
| 732 | # assignment-part |
717 | # assignment part. |
| 733 | qt_use() { |
718 | qt_use() { |
| 734 | local flag=$1 |
719 | local flag=$1 |
| 735 | local feature=$1 |
720 | local feature=$1 |
| 736 | local enableval= |
721 | local enableval= |
| 737 | |
722 | |
| … | |
… | |
| 748 | # @FUNCTION: qt_mkspecs_dir |
733 | # @FUNCTION: qt_mkspecs_dir |
| 749 | # @RETURN: the specs-directory w/o path |
734 | # @RETURN: the specs-directory w/o path |
| 750 | # @DESCRIPTION: |
735 | # @DESCRIPTION: |
| 751 | # Allows us to define which mkspecs dir we want to use. |
736 | # Allows us to define which mkspecs dir we want to use. |
| 752 | qt_mkspecs_dir() { |
737 | qt_mkspecs_dir() { |
| 753 | # Allows us to define which mkspecs dir we want to use. |
|
|
| 754 | local spec |
738 | local spec= |
| 755 | |
|
|
| 756 | case ${CHOST} in |
739 | case ${CHOST} in |
| 757 | *-freebsd*|*-dragonfly*) |
740 | *-freebsd*|*-dragonfly*) |
| 758 | spec=freebsd ;; |
741 | spec=freebsd ;; |
| 759 | *-openbsd*) |
742 | *-openbsd*) |
| 760 | spec=openbsd ;; |
743 | spec=openbsd ;; |
| … | |
… | |
| 801 | |
784 | |
| 802 | echo "${spec}" |
785 | echo "${spec}" |
| 803 | } |
786 | } |
| 804 | |
787 | |
| 805 | # @FUNCTION: qt_assistant_cleanup |
788 | # @FUNCTION: qt_assistant_cleanup |
| 806 | # @RETURN: nothing |
|
|
| 807 | # @DESCRIPTION: |
789 | # @DESCRIPTION: |
| 808 | # Tries to clean up tools.pro for qt-assistant ebuilds. |
790 | # Tries to clean up tools.pro for qt-assistant ebuilds. |
| 809 | # Meant to be called in src_prepare(). |
791 | # Meant to be called in src_prepare(). |
| 810 | # Since Qt 4.7.4 this function is a no-op. |
792 | # Since Qt 4.7.4 this function is a no-op. |
| 811 | qt_assistant_cleanup() { |
793 | qt_assistant_cleanup() { |
| … | |
… | |
| 831 | ;; |
813 | ;; |
| 832 | esac |
814 | esac |
| 833 | } |
815 | } |
| 834 | |
816 | |
| 835 | # @FUNCTION: qt_nolibx11 |
817 | # @FUNCTION: qt_nolibx11 |
| 836 | # @RETURN: nothing |
|
|
| 837 | # @DESCRIPTION: |
818 | # @DESCRIPTION: |
| 838 | # Ignore X11 tests for packages that don't need X libraries installed |
819 | # Ignore X11 tests for packages that don't need X libraries installed. |
| 839 | qt_nolibx11() { |
820 | qt_nolibx11() { |
| 840 | einfo "Removing X11 check to allow X-less compilation" |
|
|
| 841 | sed -i "/unixtests\/compile.test.*config.tests\/x11\/xlib/,/fi$/d" "${S}"/configure || |
821 | sed -i "/unixtests\/compile.test.*config.tests\/x11\/xlib/,/fi$/d" "${S}"/configure || |
| 842 | die "x11 check sed failed" |
822 | die "x11 check sed failed" |
| 843 | } |
823 | } |
| 844 | |
824 | |
| 845 | EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_install src_test pkg_postrm pkg_postinst |
825 | EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_install src_test pkg_postrm pkg_postinst |