aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Palimaka <kensington@gentoo.org>2018-01-26 12:29:27 +1100
committerMichael Palimaka <kensington@gentoo.org>2018-02-02 22:53:57 +1100
commite553539e7ee050d094da9a4673b2e5ac71aae422 (patch)
treedcad10c601d48f404c152fdf606385132a1a6635
parentdev-qt/qtnetwork: add QT5_GENTOO_PRIVATE_CONFIG (diff)
downloadqt-e553539e7ee050d094da9a4673b2e5ac71aae422.tar.gz
qt-e553539e7ee050d094da9a4673b2e5ac71aae422.tar.bz2
qt-e553539e7ee050d094da9a4673b2e5ac71aae422.zip
qt5-build.eclass: introduce for QT5_GENTOO_PRIVATE_CONFIG
This behaves similarly to QT5_GENTOO_CONFIG, but for the new qmodule.pri instead. Bug: https://bugs.gentoo.org/634622
-rw-r--r--eclass/qt5-build.eclass116
1 files changed, 106 insertions, 10 deletions
diff --git a/eclass/qt5-build.eclass b/eclass/qt5-build.eclass
index 28d303e2..939a048d 100644
--- a/eclass/qt5-build.eclass
+++ b/eclass/qt5-build.eclass
@@ -42,6 +42,14 @@ esac
# definitions, which are then merged together with all other Qt5 packages
# installed on the system to obtain the global qconfig.{h,pri} files.
+# @ECLASS-VARIABLE: QT5_GENTOO_PRIVATE_CONFIG
+# @DEFAULT_UNSET
+# @DESCRIPTION:
+# Array of <useflag:feature> pairs that are evaluated in src_install
+# to generate the per-package list of enabled QT.global_private features,
+# which are then merged together with all other Qt5 packages installed on the
+# system to obtain the global qmodule.pri file.
+
# @ECLASS-VARIABLE: VIRTUALX_REQUIRED
# @DESCRIPTION:
# For proper description see virtualx.eclass man page.
@@ -319,7 +327,7 @@ qt5-build_src_install() {
dosym qt5-"${CHOST}".conf /etc/xdg/qtchooser/qt5.conf
fi
- qt5_install_module_qconfigs
+ qt5_install_module_config
prune_libtool_files
}
@@ -327,7 +335,7 @@ qt5-build_src_install() {
# @DESCRIPTION:
# Regenerate configuration after installation or upgrade/downgrade.
qt5-build_pkg_postinst() {
- qt5_regenerate_global_qconfigs
+ qt5_regenerate_global_configs
}
# @FUNCTION: qt5-build_pkg_postrm
@@ -335,7 +343,7 @@ qt5-build_pkg_postinst() {
# Regenerate configuration when a module is completely removed.
qt5-build_pkg_postrm() {
if [[ -z ${REPLACED_BY_VERSION} && ${PN} != qtcore ]]; then
- qt5_regenerate_global_qconfigs
+ qt5_regenerate_global_configs
fi
}
@@ -675,6 +683,9 @@ qt5_base_configure() {
# do not build with -Werror
-no-warnings-are-errors
+ # enable in respective modules to avoid poisoning QT.global_private.enabled_features
+ $([[ ${QT5_MINOR_VERSION} -ge 9 ]] && echo -no-gui -no-widgets)
+
# module-specific options
"${myconf[@]}"
)
@@ -762,15 +773,17 @@ qt5_qmake() {
|| die "qmake failed (${projectdir#${S}/})"
}
-# @FUNCTION: qt5_install_module_qconfigs
+# @FUNCTION: qt5_install_module_config
# @INTERNAL
# @DESCRIPTION:
-# Creates and installs gentoo-specific ${PN}-qconfig.{h,pri} files.
-qt5_install_module_qconfigs() {
- local x qconfig_add= qconfig_remove=
+# Creates and installs gentoo-specific ${PN}-qconfig.{h,pri} and
+# ${PN}-qmodule.pri files.
+qt5_install_module_config() {
+ local x qconfig_add= qconfig_remove= qprivateconfig_add= qprivateconfig_remove=
> "${T}"/${PN}-qconfig.h
> "${T}"/${PN}-qconfig.pri
+ [[ ${QT5_MINOR_VERSION} -ge 9 ]] && > "${T}"/${PN}-qmodule.pri
# generate qconfig_{add,remove} and ${PN}-qconfig.h
for x in "${QT5_GENTOO_CONFIG[@]}"; do
@@ -804,19 +817,45 @@ qt5_install_module_qconfigs() {
doins "${T}"/${PN}-qconfig.pri
)
+ if [[ ${QT5_MINOR_VERSION} -ge 9 ]]; then
+ # generate qprivateconfig
+ for x in "${QT5_GENTOO_PRIVATE_CONFIG[@]}"; do
+ local flag=${x%%:*}
+ x=${x#${flag}:}
+ local feature=${x%%:*}
+ x=${x#${feature}:}
+
+ if [[ -z ${flag} ]] || { [[ ${flag} != '!' ]] && use ${flag}; }; then
+ [[ -n ${feature} ]] && qprivateconfig_add+=" ${feature}"
+ else
+ [[ -n ${feature} ]] && qprivateconfig_remove+=" ${feature}"
+ fi
+ done
+
+ # generate and install ${PN}-qmodule.pri
+ [[ -n ${qprivateconfig_add} ]] && echo "QT.global_private.enabled_features = ${qprivateconfig_add}" >> "${T}"/${PN}-qmodule.pri
+ [[ -n ${qprivateconfig_remove} ]] && echo "QT.global_private.disabled_features = ${qprivateconfig_remove}" >> "${T}"/${PN}-qmodule.pri
+ [[ -s ${T}/${PN}-qmodule.pri ]] && (
+ insinto "${QT5_ARCHDATADIR#${EPREFIX}}"/mkspecs/gentoo
+ doins "${T}"/${PN}-qmodule.pri
+ )
+ fi
+
# install also the original qconfig.pri
[[ ${PN} == qtcore && ${QT5_MINOR_VERSION} -ge 9 ]] && (
insinto "${QT5_ARCHDATADIR#${EPREFIX}}"/mkspecs/gentoo
newins "${D}${QT5_ARCHDATADIR#${EPREFIX}}"/mkspecs/qconfig.pri qconfig-qtcore.pri
+ newins "${D}${QT5_ARCHDATADIR#${EPREFIX}}"/mkspecs/qmodule.pri qmodule-qtcore.pri
)
}
-# @FUNCTION: qt5_regenerate_global_qconfigs
+# @FUNCTION: qt5_regenerate_global_configs
# @INTERNAL
# @DESCRIPTION:
-# Generates Gentoo-specific qconfig.{h,pri} according to the build configuration.
+# Generates Gentoo-specific qconfig.{h,pri} and qmodule.pri according to the
+# build configuration.
# Don't call die here because dying in pkg_post{inst,rm} only makes things worse.
-qt5_regenerate_global_qconfigs() {
+qt5_regenerate_global_configs() {
einfo "Regenerating gentoo-qconfig.h"
find "${ROOT%/}${QT5_HEADERDIR}"/Gentoo \
@@ -860,4 +899,61 @@ qt5_regenerate_global_qconfigs() {
else
ewarn "${qconfig_pri} does not exist or is not a regular file"
fi
+
+ if [[ ${QT5_MINOR_VERSION} -ge 9 ]]; then
+ einfo "Updating QT.global_private in qmodule.pri"
+
+ local qmodule_pri=${ROOT%/}${QT5_ARCHDATADIR}/mkspecs/qmodule.pri
+ local qmodule_pri_orig=${ROOT%/}${QT5_ARCHDATADIR}/mkspecs/gentoo/qmodule-qtcore.pri
+ if [[ -f ${qmodule_pri} && -f ${qmodule_pri_orig} ]]; then
+ local x
+ local qprivateconfig_enabled= qprivateconfig_disabled=
+ local qprivateconfig_orig_enabled= qprivateconfig_orig_disabled=
+ local new_qprivateconfig_enabled= new_qprivateconfig_disabled=
+
+ # generate lists of QT.global_private.{dis,en}abled_features
+ qprivateconfig_orig_enabled="$(sed -n 's/^QT.global_private.enabled_features\s=\s*//p' "${qmodule_pri_orig}")"
+ qprivateconfig_orig_disabled="$(sed -n 's/^QT.global_private.disabled_features\s=\s*//p' "${qmodule_pri_orig}")"
+ eshopts_push -s nullglob
+ for x in "${ROOT%/}${QT5_ARCHDATADIR}"/mkspecs/gentoo/*-qmodule.pri; do
+ qprivateconfig_enabled+=" $(sed -n 's/^QT.global_private.enabled_features\s=\s*//p' "${x}")"
+ qprivateconfig_disabled+=" $(sed -n 's/^QT.global_private.disabled_features\s=\s*//p' "${x}")"
+ done
+ eshopts_pop
+
+ # anything enabled is enabled, but anything disabled is
+ # only disabled if it isn't enabled somewhere else.
+ # this is because we need to forcibly disable some stuff
+ # in qtcore to support split qtbase.
+ new_qprivateconfig_enabled=${qprivateconfig_enabled}
+ for x in ${qprivateconfig_disabled}; do
+ if ! has "${x}" ${qprivateconfig_enabled}; then
+ new_qprivateconfig_disabled+=" ${x}"
+ fi
+ done
+
+ # check all items from the original qtcore qmodule.pri,
+ # and add them to the appropriate list if not overriden
+ # elsewhere
+ for x in ${qprivateconfig_orig_enabled}; do
+ if ! has "${x}" ${new_qprivateconfig_enabled} ${new_qprivateconfig_disabled}; then
+ new_qprivateconfig_enabled+=" ${x}"
+ fi
+ done
+ for x in ${qprivateconfig_orig_disabled}; do
+ if ! has "${x}" ${new_qprivateconfig_enabled} ${new_qprivateconfig_disabled}; then
+ new_qprivateconfig_disabled+=" ${x}"
+ fi
+ done
+
+ # now replace the existing QT.global_private.{dis,en}abled_features
+ # with the generated list
+ sed \
+ -e "s/^QT.global_private.enabled_features\s*=.*/QT.global_private.enabled_features =${new_qprivateconfig_enabled}/" \
+ -e "s/^QT.global_private.disabled_features\s*=.*/QT.global_private.disabled_features =${new_qprivateconfig_disabled}/" \
+ -i "${qmodule_pri}" || eerror "Failed to sed QT.global_private.enabled_features in ${qmodule_pri}"
+ else
+ ewarn "${qmodule_pri} or ${qmodule_pri_orig} does not exist or is not a regular file"
+ fi
+ fi
}