Gentoo Archives: gentoo-commits

From: Michael Palimaka <kensington@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/qt:master commit in: eclass/
Date: Fri, 02 Feb 2018 11:54:16
Message-Id: 1517572437.e553539e7ee050d094da9a4673b2e5ac71aae422.kensington@gentoo
1 commit: e553539e7ee050d094da9a4673b2e5ac71aae422
2 Author: Michael Palimaka <kensington <AT> gentoo <DOT> org>
3 AuthorDate: Fri Jan 26 01:29:27 2018 +0000
4 Commit: Michael Palimaka <kensington <AT> gentoo <DOT> org>
5 CommitDate: Fri Feb 2 11:53:57 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/qt.git/commit/?id=e553539e
7
8 qt5-build.eclass: introduce for QT5_GENTOO_PRIVATE_CONFIG
9
10 This behaves similarly to QT5_GENTOO_CONFIG, but for the new qmodule.pri instead.
11
12 Bug: https://bugs.gentoo.org/634622
13
14 eclass/qt5-build.eclass | 116 +++++++++++++++++++++++++++++++++++++++++++-----
15 1 file changed, 106 insertions(+), 10 deletions(-)
16
17 diff --git a/eclass/qt5-build.eclass b/eclass/qt5-build.eclass
18 index 28d303e2..939a048d 100644
19 --- a/eclass/qt5-build.eclass
20 +++ b/eclass/qt5-build.eclass
21 @@ -42,6 +42,14 @@ esac
22 # definitions, which are then merged together with all other Qt5 packages
23 # installed on the system to obtain the global qconfig.{h,pri} files.
24
25 +# @ECLASS-VARIABLE: QT5_GENTOO_PRIVATE_CONFIG
26 +# @DEFAULT_UNSET
27 +# @DESCRIPTION:
28 +# Array of <useflag:feature> pairs that are evaluated in src_install
29 +# to generate the per-package list of enabled QT.global_private features,
30 +# which are then merged together with all other Qt5 packages installed on the
31 +# system to obtain the global qmodule.pri file.
32 +
33 # @ECLASS-VARIABLE: VIRTUALX_REQUIRED
34 # @DESCRIPTION:
35 # For proper description see virtualx.eclass man page.
36 @@ -319,7 +327,7 @@ qt5-build_src_install() {
37 dosym qt5-"${CHOST}".conf /etc/xdg/qtchooser/qt5.conf
38 fi
39
40 - qt5_install_module_qconfigs
41 + qt5_install_module_config
42 prune_libtool_files
43 }
44
45 @@ -327,7 +335,7 @@ qt5-build_src_install() {
46 # @DESCRIPTION:
47 # Regenerate configuration after installation or upgrade/downgrade.
48 qt5-build_pkg_postinst() {
49 - qt5_regenerate_global_qconfigs
50 + qt5_regenerate_global_configs
51 }
52
53 # @FUNCTION: qt5-build_pkg_postrm
54 @@ -335,7 +343,7 @@ qt5-build_pkg_postinst() {
55 # Regenerate configuration when a module is completely removed.
56 qt5-build_pkg_postrm() {
57 if [[ -z ${REPLACED_BY_VERSION} && ${PN} != qtcore ]]; then
58 - qt5_regenerate_global_qconfigs
59 + qt5_regenerate_global_configs
60 fi
61 }
62
63 @@ -675,6 +683,9 @@ qt5_base_configure() {
64 # do not build with -Werror
65 -no-warnings-are-errors
66
67 + # enable in respective modules to avoid poisoning QT.global_private.enabled_features
68 + $([[ ${QT5_MINOR_VERSION} -ge 9 ]] && echo -no-gui -no-widgets)
69 +
70 # module-specific options
71 "${myconf[@]}"
72 )
73 @@ -762,15 +773,17 @@ qt5_qmake() {
74 || die "qmake failed (${projectdir#${S}/})"
75 }
76
77 -# @FUNCTION: qt5_install_module_qconfigs
78 +# @FUNCTION: qt5_install_module_config
79 # @INTERNAL
80 # @DESCRIPTION:
81 -# Creates and installs gentoo-specific ${PN}-qconfig.{h,pri} files.
82 -qt5_install_module_qconfigs() {
83 - local x qconfig_add= qconfig_remove=
84 +# Creates and installs gentoo-specific ${PN}-qconfig.{h,pri} and
85 +# ${PN}-qmodule.pri files.
86 +qt5_install_module_config() {
87 + local x qconfig_add= qconfig_remove= qprivateconfig_add= qprivateconfig_remove=
88
89 > "${T}"/${PN}-qconfig.h
90 > "${T}"/${PN}-qconfig.pri
91 + [[ ${QT5_MINOR_VERSION} -ge 9 ]] && > "${T}"/${PN}-qmodule.pri
92
93 # generate qconfig_{add,remove} and ${PN}-qconfig.h
94 for x in "${QT5_GENTOO_CONFIG[@]}"; do
95 @@ -804,19 +817,45 @@ qt5_install_module_qconfigs() {
96 doins "${T}"/${PN}-qconfig.pri
97 )
98
99 + if [[ ${QT5_MINOR_VERSION} -ge 9 ]]; then
100 + # generate qprivateconfig
101 + for x in "${QT5_GENTOO_PRIVATE_CONFIG[@]}"; do
102 + local flag=${x%%:*}
103 + x=${x#${flag}:}
104 + local feature=${x%%:*}
105 + x=${x#${feature}:}
106 +
107 + if [[ -z ${flag} ]] || { [[ ${flag} != '!' ]] && use ${flag}; }; then
108 + [[ -n ${feature} ]] && qprivateconfig_add+=" ${feature}"
109 + else
110 + [[ -n ${feature} ]] && qprivateconfig_remove+=" ${feature}"
111 + fi
112 + done
113 +
114 + # generate and install ${PN}-qmodule.pri
115 + [[ -n ${qprivateconfig_add} ]] && echo "QT.global_private.enabled_features = ${qprivateconfig_add}" >> "${T}"/${PN}-qmodule.pri
116 + [[ -n ${qprivateconfig_remove} ]] && echo "QT.global_private.disabled_features = ${qprivateconfig_remove}" >> "${T}"/${PN}-qmodule.pri
117 + [[ -s ${T}/${PN}-qmodule.pri ]] && (
118 + insinto "${QT5_ARCHDATADIR#${EPREFIX}}"/mkspecs/gentoo
119 + doins "${T}"/${PN}-qmodule.pri
120 + )
121 + fi
122 +
123 # install also the original qconfig.pri
124 [[ ${PN} == qtcore && ${QT5_MINOR_VERSION} -ge 9 ]] && (
125 insinto "${QT5_ARCHDATADIR#${EPREFIX}}"/mkspecs/gentoo
126 newins "${D}${QT5_ARCHDATADIR#${EPREFIX}}"/mkspecs/qconfig.pri qconfig-qtcore.pri
127 + newins "${D}${QT5_ARCHDATADIR#${EPREFIX}}"/mkspecs/qmodule.pri qmodule-qtcore.pri
128 )
129 }
130
131 -# @FUNCTION: qt5_regenerate_global_qconfigs
132 +# @FUNCTION: qt5_regenerate_global_configs
133 # @INTERNAL
134 # @DESCRIPTION:
135 -# Generates Gentoo-specific qconfig.{h,pri} according to the build configuration.
136 +# Generates Gentoo-specific qconfig.{h,pri} and qmodule.pri according to the
137 +# build configuration.
138 # Don't call die here because dying in pkg_post{inst,rm} only makes things worse.
139 -qt5_regenerate_global_qconfigs() {
140 +qt5_regenerate_global_configs() {
141 einfo "Regenerating gentoo-qconfig.h"
142
143 find "${ROOT%/}${QT5_HEADERDIR}"/Gentoo \
144 @@ -860,4 +899,61 @@ qt5_regenerate_global_qconfigs() {
145 else
146 ewarn "${qconfig_pri} does not exist or is not a regular file"
147 fi
148 +
149 + if [[ ${QT5_MINOR_VERSION} -ge 9 ]]; then
150 + einfo "Updating QT.global_private in qmodule.pri"
151 +
152 + local qmodule_pri=${ROOT%/}${QT5_ARCHDATADIR}/mkspecs/qmodule.pri
153 + local qmodule_pri_orig=${ROOT%/}${QT5_ARCHDATADIR}/mkspecs/gentoo/qmodule-qtcore.pri
154 + if [[ -f ${qmodule_pri} && -f ${qmodule_pri_orig} ]]; then
155 + local x
156 + local qprivateconfig_enabled= qprivateconfig_disabled=
157 + local qprivateconfig_orig_enabled= qprivateconfig_orig_disabled=
158 + local new_qprivateconfig_enabled= new_qprivateconfig_disabled=
159 +
160 + # generate lists of QT.global_private.{dis,en}abled_features
161 + qprivateconfig_orig_enabled="$(sed -n 's/^QT.global_private.enabled_features\s=\s*//p' "${qmodule_pri_orig}")"
162 + qprivateconfig_orig_disabled="$(sed -n 's/^QT.global_private.disabled_features\s=\s*//p' "${qmodule_pri_orig}")"
163 + eshopts_push -s nullglob
164 + for x in "${ROOT%/}${QT5_ARCHDATADIR}"/mkspecs/gentoo/*-qmodule.pri; do
165 + qprivateconfig_enabled+=" $(sed -n 's/^QT.global_private.enabled_features\s=\s*//p' "${x}")"
166 + qprivateconfig_disabled+=" $(sed -n 's/^QT.global_private.disabled_features\s=\s*//p' "${x}")"
167 + done
168 + eshopts_pop
169 +
170 + # anything enabled is enabled, but anything disabled is
171 + # only disabled if it isn't enabled somewhere else.
172 + # this is because we need to forcibly disable some stuff
173 + # in qtcore to support split qtbase.
174 + new_qprivateconfig_enabled=${qprivateconfig_enabled}
175 + for x in ${qprivateconfig_disabled}; do
176 + if ! has "${x}" ${qprivateconfig_enabled}; then
177 + new_qprivateconfig_disabled+=" ${x}"
178 + fi
179 + done
180 +
181 + # check all items from the original qtcore qmodule.pri,
182 + # and add them to the appropriate list if not overriden
183 + # elsewhere
184 + for x in ${qprivateconfig_orig_enabled}; do
185 + if ! has "${x}" ${new_qprivateconfig_enabled} ${new_qprivateconfig_disabled}; then
186 + new_qprivateconfig_enabled+=" ${x}"
187 + fi
188 + done
189 + for x in ${qprivateconfig_orig_disabled}; do
190 + if ! has "${x}" ${new_qprivateconfig_enabled} ${new_qprivateconfig_disabled}; then
191 + new_qprivateconfig_disabled+=" ${x}"
192 + fi
193 + done
194 +
195 + # now replace the existing QT.global_private.{dis,en}abled_features
196 + # with the generated list
197 + sed \
198 + -e "s/^QT.global_private.enabled_features\s*=.*/QT.global_private.enabled_features =${new_qprivateconfig_enabled}/" \
199 + -e "s/^QT.global_private.disabled_features\s*=.*/QT.global_private.disabled_features =${new_qprivateconfig_disabled}/" \
200 + -i "${qmodule_pri}" || eerror "Failed to sed QT.global_private.enabled_features in ${qmodule_pri}"
201 + else
202 + ewarn "${qmodule_pri} or ${qmodule_pri_orig} does not exist or is not a regular file"
203 + fi
204 + fi
205 }