--- /var/portage/repository/qt/eclass/qt5-build.eclass 2013-06-10 11:31:03.015164887 +0200 +++ qt5-build.eclass 2013-09-24 13:40:49.196003286 +0200 @@ -63,18 +63,34 @@ inherit git-2 fi -IUSE="+c++11 debug test" +if [[ "$PN" == "${PN%-doc}" ]]; then + IUSE="+c++11 debug doc test" -DEPEND=" - >=dev-lang/perl-5.14 - virtual/pkgconfig -" -if [[ ${PN} != "qttest" ]]; then - if [[ ${QT5_MODULE} == "qtbase" ]]; then - DEPEND+=" test? ( ~dev-qt/qttest-${PV}[debug=] )" - else - DEPEND+=" test? ( >=dev-qt/qttest-${PV}:5[debug=] )" + DEPEND=" + >=dev-lang/perl-5.14 + virtual/pkgconfig + " + + if [[ ${PN} != "qttest" ]]; then + if [[ ${QT5_MODULE} == "qtbase" ]]; then + DEPEND+=" test? ( ~dev-qt/qttest-${PV}[debug=] )" + else + DEPEND+=" test? ( >=dev-qt/qttest-${PV}:5[debug=] )" + fi fi + + if [[ ${QT5_MODULE} == "qtbase" || ${QT5_MODULE} == "qttools" ]]; then + PDEPEND+=" doc? ( ~dev-qt/${QT5_MODULE}-doc-${PV} )" + else + DEPEND+=" doc? ( ~dev-qt/qhelpgenerator-${PV} + ~dev-qt/qdoc-${PV} )" + PDEPEND=" doc? ( ~dev-qt/assistant-${PV} )" + fi +else + RDEPEND+=" ~dev-qt/assistant-${PV}" + DEPEND+=" ~dev-qt/qhelpgenerator-${PV} + ~dev-qt/qdoc-${PV} + " fi EXPORT_FUNCTIONS pkg_setup src_unpack src_prepare src_configure src_compile src_install src_test pkg_postinst pkg_postrm @@ -246,7 +262,13 @@ # @DESCRIPTION: # Compiles the code in target directories. qt5-build_src_compile() { - qt5_foreach_target_subdir emake + if [[ "$PN" == "${PN%-doc}" ]]; then + qt5_foreach_target_subdir emake + fi + # qtbase and qttools have separate doc packages + if [[ "${QT5_MODULE}" != "qtbase" && "${QT5_MODULE}" != "qttools" ]]; then + use doc && qt5_compile_docs + fi } # @FUNCTION: qt5-build_src_test @@ -276,28 +298,32 @@ # @DESCRIPTION: # Performs the actual installation of target directories. qt5-build_src_install() { - qt5_foreach_target_subdir emake INSTALL_ROOT="${D}" install + if [[ "$PN" == "${PN%-doc}" ]]; then + qt5_foreach_target_subdir emake INSTALL_ROOT="${D}" install - if [[ ${PN} == "qtcore" ]]; then - pushd "${QT5_BUILD_DIR}" > /dev/null || die - einfo "Running emake INSTALL_ROOT=${D} install_{mkspecs,qmake,syncqt}" - emake INSTALL_ROOT="${D}" install_{mkspecs,qmake,syncqt} - popd > /dev/null || die + if [[ ${PN} == "qtcore" ]]; then + pushd "${QT5_BUILD_DIR}" > /dev/null || die + einfo "Running emake INSTALL_ROOT=${D} install_{mkspecs,qmake,syncqt}" + emake INSTALL_ROOT="${D}" install_{mkspecs,qmake,syncqt} + popd > /dev/null || die + + # create an empty Gentoo/gentoo-qconfig.h + dodir "${QT5_HEADERDIR#${EPREFIX}}"/Gentoo + : > "${D}${QT5_HEADERDIR}"/Gentoo/gentoo-qconfig.h + + # include gentoo-qconfig.h at the beginning of QtCore/qconfig.h + sed -i -e '2a#include \n' \ + "${D}${QT5_HEADERDIR}"/QtCore/qconfig.h \ + || die "sed failed (qconfig.h)" + fi - # create an empty Gentoo/gentoo-qconfig.h - dodir "${QT5_HEADERDIR#${EPREFIX}}"/Gentoo - : > "${D}${QT5_HEADERDIR}"/Gentoo/gentoo-qconfig.h + qt5_install_module_qconfigs - # include gentoo-qconfig.h at the beginning of QtCore/qconfig.h - sed -i -e '2a#include \n' \ - "${D}${QT5_HEADERDIR}"/QtCore/qconfig.h \ - || die "sed failed (qconfig.h)" + # remove .la files since we are building only shared libraries + prune_libtool_files fi - qt5_install_module_qconfigs - - # remove .la files since we are building only shared libraries - prune_libtool_files + use doc && qt5_install_docs } # @FUNCTION: qt5-build_pkg_postinst @@ -305,15 +331,19 @@ # Regenerate configuration, plus throw a message about possible # breakages and proposed solutions. qt5-build_pkg_postinst() { - qt5_regenerate_global_qconfigs + if [[ "$PN" == "${PN%-doc}" ]]; then + qt5_regenerate_global_qconfigs + fi } # @FUNCTION: qt5-build_pkg_postrm # @DESCRIPTION: # Regenerate configuration when the package is completely removed. qt5-build_pkg_postrm() { - if [[ -z ${REPLACED_BY_VERSION} && ${PN} != "qtcore" ]]; then - qt5_regenerate_global_qconfigs + if [[ "$PN" == "${PN%-doc}" ]]; then + if [[ -z ${REPLACED_BY_VERSION} && ${PN} != "qtcore" ]]; then + qt5_regenerate_global_qconfigs + fi fi } @@ -365,7 +395,7 @@ mkdir -p "${QT5_BUILD_DIR}"/bin || die local bin - for bin in "${QT5_BINDIR}"/{qmake,moc,rcc,uic,qdoc,qdbuscpp2xml,qdbusxml2cpp}; do + for bin in "${QT5_BINDIR}"/{qmake,moc,rcc,uic,qdoc,qdbuscpp2xml,qdbusxml2cpp,qhelpgenerator}; do if [[ -e ${bin} ]]; then ln -s "${bin}" "${QT5_BUILD_DIR}"/bin/ || die "failed to symlink ${bin}" fi @@ -396,16 +426,9 @@ -examplesdir "${QT5_EXAMPLESDIR}" -testsdir "${QT5_TESTSDIR}" - # debug/release - $(use debug && echo -debug || echo -release) - -no-separate-debug-info - # licensing stuff -opensource -confirm-license - # C++11 support - $(qt_use c++11) - # build shared libraries -shared @@ -426,9 +449,6 @@ -nomake examples -nomake tests - # disable rpath on non-prefix (bugs 380415 and 417169) - $(use prefix || echo -no-rpath) - # verbosity of the configure and build phases -verbose $(${QT5_VERBOSE_BUILD} || echo -silent) @@ -460,6 +480,19 @@ # module-specific options "${myconf[@]}" ) + if [[ "$PN" == "${PN%-doc}" ]]; then + conf+=( + # debug/release + $(use debug && echo -debug || echo -release) + -no-separate-debug-info + + # C++11 support + $(qt_use c++11) + + # disable rpath on non-prefix (bugs 380415 and 417169) + $(use prefix || echo -no-rpath) + ) + fi einfo "Configuring with: ${conf[@]}" "${S}"/configure "${conf[@]}" || die "configure failed" @@ -574,3 +607,21 @@ ewarn "${qconfig_pri} does not exist or is not a regular file" fi } + + +# @FUNCTION: qt5_compile_docs +# @DESCRIPTION: +# Generate QCH docs. +qt5_compile_docs() { +# in some modules "make qch_docs" fails without "make docs" before +# in some modules "make -jx" docs fails + qt5_foreach_target_subdir emake -j1 docs qch_docs +} + +# @FUNCTION: qt5_install_docs +# @DESCRIPTION: +# Install QCH docs. +qt5_install_docs() { + docompress -x "${QT5_DOCDIR}" + qt5_foreach_target_subdir emake INSTALL_ROOT="${D}" install_qch_docs +}