qt5-build.eclass 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031
  1. # Copyright 1999-2026 Gentoo Authors
  2. # Distributed under the terms of the GNU General Public License v2
  3. # @ECLASS: qt5-build.eclass
  4. # @MAINTAINER:
  5. # qt@gentoo.org
  6. # @AUTHOR:
  7. # Davide Pesavento <pesa@gentoo.org>
  8. # @SUPPORTED_EAPIS: 8
  9. # @BLURB: Eclass for Qt5 split ebuilds.
  10. # @DEAD
  11. # @DESCRIPTION:
  12. # This eclass contains various functions that are used when building Qt5.
  13. case ${EAPI} in
  14. 8) ;;
  15. *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
  16. esac
  17. if [[ -z ${_QT5_BUILD_ECLASS} ]]; then
  18. _QT5_BUILD_ECLASS=1
  19. [[ ${CATEGORY} != dev-qt ]] &&
  20. die "${ECLASS} is only to be used for building Qt 5"
  21. # @ECLASS_VARIABLE: QT5_BUILD_TYPE
  22. # @DESCRIPTION:
  23. # Default value is "release".
  24. # If PV matches "*9999*", this is automatically set to "live".
  25. QT5_BUILD_TYPE=release
  26. if [[ ${PV} == *9999* ]]; then
  27. QT5_BUILD_TYPE=live
  28. fi
  29. readonly QT5_BUILD_TYPE
  30. # @ECLASS_VARIABLE: QT5_KDEPATCHSET_REV
  31. # @DEFAULT_UNSET
  32. # @PRE_INHERIT
  33. # @DESCRIPTION:
  34. # Downstream generated patchset revision pulled from KDE's Qt5PatchCollection,
  35. # with the patchset having been generated in the following way from upstream's
  36. # qt module git repository:
  37. # @CODE
  38. # git format-patch v${PV}-lts-lgpl..origin/gentoo-kde/${PV} \
  39. # -o ${QT5_MODULE}-${PV}-gentoo-kde-${QT5_KDEPATCHSET_REV}
  40. # @CODE
  41. # Used for SRC_URI and applied in src_prepare.
  42. # Must be set before inheriting the eclass.
  43. # @ECLASS_VARIABLE: QT5_MODULE
  44. # @PRE_INHERIT
  45. # @DESCRIPTION:
  46. # The upstream name of the module this package belongs to. Used for
  47. # SRC_URI and EGIT_REPO_URI. Must be set before inheriting the eclass.
  48. : "${QT5_MODULE:=${PN}}"
  49. # @ECLASS_VARIABLE: QT5_PV
  50. # @DESCRIPTION:
  51. # 3-component version for use in dependency declarations on other dev-qt/ pkgs.
  52. QT5_PV=$(ver_cut 1-3)
  53. readonly QT5_PV
  54. # @ECLASS_VARIABLE: _QT5_P
  55. # @INTERNAL
  56. # @DESCRIPTION:
  57. # The upstream package name of the module this package belongs to.
  58. # Used for SRC_URI and S.
  59. # @ECLASS_VARIABLE: _QT5_GENTOOPATCHSET_REV
  60. # @DEFAULT_UNSET
  61. # @INTERNAL
  62. # @DESCRIPTION:
  63. # Gentoo downstream patchset version applied over qtbase. Used for SRC_URI and
  64. # applied in src_prepare.
  65. # @ECLASS_VARIABLE: QT5_TARGET_SUBDIRS
  66. # @DEFAULT_UNSET
  67. # @DESCRIPTION:
  68. # Array variable containing the source directories that should be built.
  69. # All paths must be relative to ${S}.
  70. # @ECLASS_VARIABLE: QT5_GENTOO_CONFIG
  71. # @DEFAULT_UNSET
  72. # @DESCRIPTION:
  73. # Array of <useflag:feature:macro> triplets that are evaluated in src_install
  74. # to generate the per-package list of enabled QT_CONFIG features and macro
  75. # definitions, which are then merged together with all other Qt5 packages
  76. # installed on the system to obtain the global qconfig.{h,pri} files.
  77. # @ECLASS_VARIABLE: QT5_GENTOO_PRIVATE_CONFIG
  78. # @DEFAULT_UNSET
  79. # @DESCRIPTION:
  80. # Array of <useflag:feature> pairs that are evaluated in src_install
  81. # to generate the per-package list of enabled QT.global_private features,
  82. # which are then merged together with all other Qt5 packages installed on the
  83. # system to obtain the global qmodule.pri file.
  84. # @ECLASS_VARIABLE: VIRTUALX_REQUIRED
  85. # @PRE_INHERIT
  86. # @DESCRIPTION:
  87. # For proper description see virtualx.eclass man page.
  88. # Here we redefine default value to be manual, if your package needs virtualx
  89. # for tests you should proceed with setting VIRTUALX_REQUIRED=test.
  90. : "${VIRTUALX_REQUIRED:=manual}"
  91. inherit estack flag-o-matic toolchain-funcs virtualx
  92. if [[ ${PN} != qtwebengine ]]; then
  93. case ${PV} in
  94. *9999)
  95. inherit kde.org # kde/5.15 branch
  96. ;;
  97. 5.15.??*)
  98. # official stable release
  99. _QT5_P=${QT5_MODULE}-everywhere-opensource-src-${PV}
  100. HOMEPAGE="https://www.qt.io/"
  101. case ${PV} in
  102. 5.15.17)
  103. SRC_URI="https://download.qt.io/official_releases/qt/${PV%.*}/${PV}/submodules/${_QT5_P}.tar.xz"
  104. ;;
  105. *)
  106. SRC_URI="https://download.qt.io/archive/qt/${PV%.*}/${PV}/submodules/${_QT5_P}.tar.xz"
  107. ;;
  108. esac
  109. # KDE Qt5PatchCollection on top of tag v${PV}-lts-lgpl
  110. if [[ -n ${QT5_KDEPATCHSET_REV} ]]; then
  111. HOMEPAGE+=" https://invent.kde.org/qt/qt/${QT5_MODULE} https://community.kde.org/Qt5PatchCollection"
  112. SRC_URI+=" https://dev.gentoo.org/~asturm/distfiles/${QT5_MODULE}-${PV}-gentoo-kde-${QT5_KDEPATCHSET_REV}.tar.xz"
  113. fi
  114. S="${WORKDIR}"/${_QT5_P/opensource-}
  115. ;;
  116. esac
  117. fi
  118. if [[ ${QT5_MODULE} == qtbase ]]; then
  119. _QT5_GENTOOPATCHSET_REV=6
  120. SRC_URI+=" https://dev.gentoo.org/~asturm/distfiles/qtbase-5.15-gentoo-patchset-${_QT5_GENTOOPATCHSET_REV}.tar.xz"
  121. fi
  122. # @ECLASS_VARIABLE: QT5_BUILD_DIR
  123. # @OUTPUT_VARIABLE
  124. # @DESCRIPTION:
  125. # Build directory for out-of-source builds.
  126. : "${QT5_BUILD_DIR:=${S}_build}"
  127. LICENSE="|| ( GPL-2 GPL-3 LGPL-3 ) FDL-1.3"
  128. case ${PN} in
  129. assistant|linguist|qdbus|qdbusviewer|pixeltool)
  130. SLOT=0 ;;
  131. linguist-tools|qdoc|qtdiag|qtgraphicaleffects|qtimageformats| \
  132. qtpaths|qtplugininfo|qtquickcontrols|qtquicktimeline| \
  133. qttranslations|qtwaylandscanner|qtxmlpatterns)
  134. SLOT=5 ;;
  135. *)
  136. SLOT=5/$(ver_cut 1-2) ;;
  137. esac
  138. IUSE="debug test"
  139. if [[ ${QT5_BUILD_TYPE} == release ]]; then
  140. RESTRICT="test" # bug 457182
  141. else
  142. RESTRICT="!test? ( test )"
  143. fi
  144. BDEPEND="
  145. dev-lang/perl
  146. virtual/pkgconfig
  147. "
  148. if [[ ${PN} != qttest ]]; then
  149. DEPEND+=" test? ( =dev-qt/qttest-${QT5_PV}* )"
  150. fi
  151. ###### Phase functions ######
  152. # @FUNCTION: qt5-build_src_prepare
  153. # @DESCRIPTION:
  154. # Prepares the environment and patches the sources if necessary.
  155. qt5-build_src_prepare() {
  156. qt5_prepare_env
  157. # Workaround for bug #915203
  158. # Upstream: https://bugreports.qt.io/browse/QTBUG-111514
  159. if [[ ${PN} != qtcore ]]; then
  160. append-ldflags $(test-flags-CCLD -Wl,--undefined-version)
  161. fi
  162. # many bugs, no one to fix
  163. filter-lto
  164. if [[ ${QT5_BUILD_TYPE} == live ]] || [[ -n ${KDE_ORG_COMMIT} ]]; then
  165. if [[ -n ${KDE_ORG_COMMIT} ]]; then
  166. einfo "Preparing KDE Qt5PatchCollection snapshot at ${KDE_ORG_COMMIT}"
  167. mkdir -p .git || die # need to fake a git repository for configure
  168. fi
  169. fi
  170. if [[ ${QT5_MODULE} == qtbase ]]; then
  171. qt5_symlink_tools_to_build_dir
  172. # Avoid unnecessary qmake recompilations
  173. sed -i -e "/Creating qmake/i if [ '!' -e \"\$outpath/bin/qmake\" ]; then" \
  174. -e '/echo "Done."/a fi' configure || die "sed failed (skip qmake bootstrap)"
  175. # Respect CXX in bsymbolic_functions, fvisibility, precomp, and a few other tests
  176. sed -i -e "/^QMAKE_CONF_COMPILER=/ s:=.*:=\"$(tc-getCXX)\":" \
  177. configure || die "sed failed (QMAKE_CONF_COMPILER)"
  178. # Respect build variables in configure tests (bug #639494)
  179. sed -i -e "s|\"\$outpath/bin/qmake\" \"\$relpathMangled\" -- \"\$@\"|& $(qt5_qmake_args) |" configure || die
  180. fi
  181. [[ -n ${QT5_KDEPATCHSET_REV} ]] && eapply "${WORKDIR}/${QT5_MODULE}-${PV}-gentoo-kde-${QT5_KDEPATCHSET_REV}"
  182. if [[ ${QT5_MODULE} == qtbase ]]; then
  183. [[ -n ${_QT5_GENTOOPATCHSET_REV} ]] && eapply "${WORKDIR}/qtbase-5.15-gentoo-patchset-${_QT5_GENTOOPATCHSET_REV}"
  184. # Respect CC, CXX, *FLAGS, MAKEOPTS and EXTRA_EMAKE when bootstrapping qmake
  185. sed -i -e "/outpath\/qmake\".*\"*\$MAKE\"*)/ s|)| \
  186. ${MAKEOPTS} ${EXTRA_EMAKE} 'CC=$(tc-getCC)' 'CXX=$(tc-getCXX)' \
  187. 'QMAKE_CFLAGS=${CFLAGS}' 'QMAKE_CXXFLAGS=${CXXFLAGS}' 'QMAKE_LFLAGS=${LDFLAGS}'&|" \
  188. -e 's/\(setBootstrapVariable\s\+\|EXTRA_C\(XX\)\?FLAGS=.*\)QMAKE_C\(XX\)\?FLAGS_\(DEBUG\|RELEASE\).*/:/' \
  189. configure || die "sed failed (respect env for qmake build)"
  190. sed -i -e '/^CPPFLAGS\s*=/ s/-g //' \
  191. qmake/Makefile.unix || die "sed failed (CPPFLAGS for qmake build)"
  192. fi
  193. default
  194. }
  195. # @FUNCTION: qt5-build_src_configure
  196. # @DESCRIPTION:
  197. # Runs qmake in the target directories. For packages
  198. # in qtbase, ./configure is also run before qmake.
  199. qt5-build_src_configure() {
  200. if [[ ${QT5_MODULE} == qtbase ]]; then
  201. qt5_base_configure
  202. fi
  203. if [[ ${QT5_MODULE} == qttools ]]; then
  204. qt5_tools_configure
  205. fi
  206. qt5_foreach_target_subdir qt5_qmake
  207. }
  208. # @FUNCTION: qt5-build_src_compile
  209. # @DESCRIPTION:
  210. # Runs emake in the target directories.
  211. qt5-build_src_compile() {
  212. qt5_foreach_target_subdir emake
  213. }
  214. # @FUNCTION: qt5-build_src_test
  215. # @DESCRIPTION:
  216. # Runs tests in the target directories.
  217. qt5-build_src_test() {
  218. # disable broken cmake tests (bug 474004)
  219. local myqmakeargs=("${myqmakeargs[@]}" -after SUBDIRS-=cmake SUBDIRS-=installed_cmake)
  220. qt5_foreach_target_subdir qt5_qmake
  221. qt5_foreach_target_subdir emake
  222. # create a custom testrunner script that correctly sets
  223. # LD_LIBRARY_PATH before executing the given test
  224. local testrunner=${QT5_BUILD_DIR}/gentoo-testrunner
  225. cat > "${testrunner}" <<-_EOF_ || die
  226. #!/bin/sh
  227. export LD_LIBRARY_PATH="${QT5_BUILD_DIR}/lib:${QT5_LIBDIR}"
  228. "\$@"
  229. _EOF_
  230. chmod +x "${testrunner}"
  231. set -- qt5_foreach_target_subdir emake TESTRUNNER="'${testrunner}'" check
  232. if [[ ${VIRTUALX_REQUIRED} == test ]]; then
  233. virtx "$@"
  234. else
  235. "$@"
  236. fi
  237. }
  238. # @FUNCTION: qt5-build_src_install
  239. # @DESCRIPTION:
  240. # Runs emake install in the target directories.
  241. qt5-build_src_install() {
  242. qt5_foreach_target_subdir emake INSTALL_ROOT="${D}" install
  243. if [[ ${PN} == qtcore ]]; then
  244. pushd "${QT5_BUILD_DIR}" >/dev/null || die
  245. set -- emake INSTALL_ROOT="${D}" \
  246. sub-qmake-qmake-aux-pro-install_subtargets \
  247. install_{syncqt,mkspecs}
  248. einfo "Running $*"
  249. "$@"
  250. popd >/dev/null || die
  251. # install an empty Gentoo/gentoo-qconfig.h in ${D}
  252. # so that it's placed under package manager control
  253. > "${T}"/gentoo-qconfig.h
  254. (
  255. insinto "${QT5_HEADERDIR#"${EPREFIX}"}"/Gentoo
  256. doins "${T}"/gentoo-qconfig.h
  257. )
  258. # include gentoo-qconfig.h at the beginning of QtCore/qconfig.h
  259. sed -i -e '1i #include <Gentoo/gentoo-qconfig.h>\n' \
  260. "${D}${QT5_HEADERDIR}"/QtCore/qconfig.h \
  261. || die "sed failed (qconfig.h)"
  262. fi
  263. qt5_install_module_config
  264. # prune libtool files
  265. find "${D}" -name '*.la' -type f -delete || die
  266. }
  267. # @FUNCTION: qt5-build_pkg_postinst
  268. # @DESCRIPTION:
  269. # Regenerate configuration after installation or upgrade/downgrade.
  270. qt5-build_pkg_postinst() {
  271. qt5_regenerate_global_configs
  272. }
  273. # @FUNCTION: qt5-build_pkg_postrm
  274. # @DESCRIPTION:
  275. # Regenerate configuration when a module is completely removed.
  276. qt5-build_pkg_postrm() {
  277. if [[ -z ${REPLACED_BY_VERSION} && ${PN} != qtcore ]]; then
  278. qt5_regenerate_global_configs
  279. fi
  280. }
  281. ###### Public helpers ######
  282. # @FUNCTION: qt5_configure_oos_quirk
  283. # @USAGE: <file> or <file> <path>
  284. # @DESCRIPTION:
  285. # Quirk for out-of-source builds. Runs qmake in root directory, copies
  286. # generated pri <file> from source <path> to build dir <path>.
  287. # If no <path> is given, <file> is copied to ${QT5_BUILD_DIR}.
  288. qt5_configure_oos_quirk() {
  289. if [[ "$#" == 2 ]]; then
  290. local source="${2}/${1}"
  291. local dest="${QT5_BUILD_DIR}/${2}"
  292. elif [[ "$#" == 1 ]]; then
  293. local source="${1}"
  294. local dest="${QT5_BUILD_DIR}"
  295. else
  296. die "${FUNCNAME[0]} must be passed either one or two arguments"
  297. fi
  298. mkdir -p "${dest}" || die
  299. qt5_qmake "${QT5_BUILD_DIR}"
  300. cp "${source}" "${dest}" || die
  301. }
  302. # @FUNCTION: qt5_syncqt_version
  303. # @DESCRIPTION:
  304. # Wrapper for Qt5 syncqt.pl to sync header files for ${PV} (required to run if
  305. # headers are added/removed by patching)
  306. qt5_syncqt_version() {
  307. if [[ ${PV} == *9999* ]]; then
  308. return
  309. fi
  310. local syncqt
  311. if [[ ${PN} == qtcore ]]; then
  312. syncqt=bin/syncqt.pl
  313. else
  314. syncqt=${QT5_BINDIR}/syncqt.pl
  315. fi
  316. perl ${syncqt} -version ${PV} || die
  317. }
  318. # @FUNCTION: qt5_symlink_binary_to_path
  319. # @USAGE: <target binary name> [suffix]
  320. # @DESCRIPTION:
  321. # Symlink a given binary from QT5_BINDIR to QT5_PREFIX/bin, with optional suffix
  322. qt5_symlink_binary_to_path() {
  323. [[ $# -ge 1 ]] || die "${FUNCNAME}() requires at least one argument"
  324. dosym -r "${QT5_BINDIR}"/${1} /usr/bin/${1}${2}
  325. }
  326. # @FUNCTION: qt_use
  327. # @USAGE: <flag> [feature] [enableval]
  328. # @DESCRIPTION:
  329. # <flag> is the name of a flag in IUSE.
  330. #
  331. # Outputs "-${enableval}-${feature}" if <flag> is enabled, "-no-${feature}"
  332. # otherwise. If [feature] is not specified, <flag> is used in its place.
  333. # If [enableval] is not specified, the "-${enableval}" prefix is omitted.
  334. qt_use() {
  335. [[ $# -ge 1 ]] || die "${FUNCNAME}() requires at least one argument"
  336. usex "$1" "${3:+-$3}-${2:-$1}" "-no-${2:-$1}"
  337. }
  338. # @FUNCTION: qt_use_compile_test
  339. # @USAGE: <flag> [config]
  340. # @DESCRIPTION:
  341. # <flag> is the name of a flag in IUSE.
  342. # [config] is the argument of qtCompileTest, defaults to <flag>.
  343. #
  344. # This function is useful to disable optional dependencies that are checked
  345. # at qmake-time using the qtCompileTest() function. If <flag> is disabled,
  346. # the compile test is skipped and the dependency is assumed to be unavailable,
  347. # i.e. the corresponding feature will be disabled. Note that all invocations
  348. # of this function must happen before calling qt5-build_src_configure.
  349. qt_use_compile_test() {
  350. [[ $# -ge 1 ]] || die "${FUNCNAME}() requires at least one argument"
  351. if ! use "$1"; then
  352. mkdir -p "${QT5_BUILD_DIR}" || die
  353. echo "CONFIG += done_config_${2:-$1}" >> "${QT5_BUILD_DIR}"/.qmake.cache || die
  354. fi
  355. }
  356. # @FUNCTION: qt_use_disable_config
  357. # @USAGE: <flag> <config> <files...>
  358. # @DESCRIPTION:
  359. # <flag> is the name of a flag in IUSE.
  360. # <config> is the (lowercase) name of a Qt5 config entry.
  361. # <files...> is a list of one or more qmake project files.
  362. #
  363. # This function patches <files> to treat <config> as disabled
  364. # when <flag> is disabled, otherwise it does nothing.
  365. # This can be useful to avoid an automagic dependency when the config entry
  366. # is enabled on the system but the corresponding USE flag is disabled.
  367. qt_use_disable_config() {
  368. [[ $# -ge 3 ]] || die "${FUNCNAME}() requires at least three arguments"
  369. local flag=$1
  370. local config=$2
  371. shift 2
  372. if ! use "${flag}"; then
  373. echo "$@" | xargs sed -i -e "s/qtConfig(${config})/false/g" || die
  374. fi
  375. }
  376. # @FUNCTION: qt_use_disable_mod
  377. # @USAGE: <flag> <module> <files...>
  378. # @DESCRIPTION:
  379. # <flag> is the name of a flag in IUSE.
  380. # <module> is the (lowercase) name of a Qt5 module.
  381. # <files...> is a list of one or more qmake project files.
  382. #
  383. # This function patches <files> to treat <module> as not installed
  384. # when <flag> is disabled, otherwise it does nothing.
  385. # This can be useful to avoid an automagic dependency when the module
  386. # is present on the system but the corresponding USE flag is disabled.
  387. qt_use_disable_mod() {
  388. [[ $# -ge 3 ]] || die "${FUNCNAME}() requires at least three arguments"
  389. local flag=$1
  390. local module=$2
  391. shift 2
  392. if ! use "${flag}"; then
  393. echo "$@" | xargs sed -i -e "s/qtHaveModule(${module})/false/g" || die
  394. fi
  395. }
  396. ###### Internal functions ######
  397. # @FUNCTION: qt5_prepare_env
  398. # @INTERNAL
  399. # @DESCRIPTION:
  400. # Prepares the environment for building Qt.
  401. qt5_prepare_env() {
  402. # setup installation directories
  403. # note: keep paths in sync with qmake-utils.eclass
  404. QT5_PREFIX=${EPREFIX}/usr
  405. QT5_HEADERDIR=${QT5_PREFIX}/include/qt5
  406. QT5_LIBDIR=${QT5_PREFIX}/$(get_libdir)
  407. QT5_ARCHDATADIR=${QT5_PREFIX}/$(get_libdir)/qt5
  408. QT5_BINDIR=${QT5_ARCHDATADIR}/bin
  409. QT5_PLUGINDIR=${QT5_ARCHDATADIR}/plugins
  410. QT5_LIBEXECDIR=${QT5_ARCHDATADIR}/libexec
  411. QT5_IMPORTDIR=${QT5_ARCHDATADIR}/imports
  412. QT5_QMLDIR=${QT5_ARCHDATADIR}/qml
  413. QT5_DATADIR=${QT5_PREFIX}/share/qt5
  414. QT5_DOCDIR=${QT5_PREFIX}/share/qt5-doc
  415. QT5_TRANSLATIONDIR=${QT5_DATADIR}/translations
  416. QT5_EXAMPLESDIR=${QT5_DATADIR}/examples
  417. QT5_TESTSDIR=${QT5_DATADIR}/tests
  418. QT5_SYSCONFDIR=${EPREFIX}/etc/xdg
  419. readonly QT5_PREFIX QT5_HEADERDIR QT5_LIBDIR QT5_ARCHDATADIR \
  420. QT5_BINDIR QT5_PLUGINDIR QT5_LIBEXECDIR QT5_IMPORTDIR \
  421. QT5_QMLDIR QT5_DATADIR QT5_DOCDIR QT5_TRANSLATIONDIR \
  422. QT5_EXAMPLESDIR QT5_TESTSDIR QT5_SYSCONFDIR
  423. if [[ ${QT5_MODULE} == qtbase ]]; then
  424. # see mkspecs/features/qt_config.prf
  425. export QMAKEMODULES="${QT5_BUILD_DIR}/mkspecs/modules:${S}/mkspecs/modules:${QT5_ARCHDATADIR}/mkspecs/modules"
  426. fi
  427. }
  428. # @FUNCTION: qt5_foreach_target_subdir
  429. # @INTERNAL
  430. # @DESCRIPTION:
  431. # Executes the command given as argument from inside each directory
  432. # listed in QT5_TARGET_SUBDIRS. Handles autotests subdirs automatically.
  433. qt5_foreach_target_subdir() {
  434. [[ -z ${QT5_TARGET_SUBDIRS[@]} ]] && QT5_TARGET_SUBDIRS=("")
  435. local subdir=
  436. for subdir in "${QT5_TARGET_SUBDIRS[@]}"; do
  437. if [[ ${EBUILD_PHASE} == test ]]; then
  438. subdir=tests/auto${subdir#src}
  439. [[ -d ${S}/${subdir} ]] || continue
  440. fi
  441. local msg="Running $* ${subdir:+in ${subdir}}"
  442. einfo "${msg}"
  443. mkdir -p "${QT5_BUILD_DIR}/${subdir}" || die -n || return $?
  444. pushd "${QT5_BUILD_DIR}/${subdir}" >/dev/null || die -n || return $?
  445. "$@" || die -n "${msg} failed" || return $?
  446. popd >/dev/null || die -n || return $?
  447. done
  448. }
  449. # @FUNCTION: qt5_symlink_tools_to_build_dir
  450. # @INTERNAL
  451. # @DESCRIPTION:
  452. # Symlinks qmake and a few other tools to QT5_BUILD_DIR,
  453. # so that they can be used when building other modules.
  454. qt5_symlink_tools_to_build_dir() {
  455. local tool= tools=()
  456. if [[ ${PN} != qtcore ]]; then
  457. tools+=(qmake moc rcc qlalr)
  458. [[ ${PN} != qtdbus ]] && tools+=(qdbuscpp2xml qdbusxml2cpp)
  459. [[ ${PN} != qtwidgets ]] && tools+=(uic)
  460. fi
  461. mkdir -p "${QT5_BUILD_DIR}"/bin || die
  462. pushd "${QT5_BUILD_DIR}"/bin >/dev/null || die
  463. for tool in "${tools[@]}"; do
  464. [[ -e ${QT5_BINDIR}/${tool} ]] || continue
  465. ln -s "${QT5_BINDIR}/${tool}" . || die "failed to symlink ${tool}"
  466. done
  467. popd >/dev/null || die
  468. }
  469. # @FUNCTION: qt5_base_configure
  470. # @INTERNAL
  471. # @DESCRIPTION:
  472. # Runs ./configure for modules belonging to qtbase.
  473. qt5_base_configure() {
  474. # setup toolchain variables used by configure
  475. tc-export AR CC CXX OBJDUMP RANLIB STRIP
  476. export LD="$(tc-getCXX)"
  477. # bug 633838
  478. unset QMAKESPEC XQMAKESPEC QMAKEPATH QMAKEFEATURES
  479. # configure arguments
  480. local conf=(
  481. # installation paths
  482. -prefix "${QT5_PREFIX}"
  483. -bindir "${QT5_BINDIR}"
  484. -headerdir "${QT5_HEADERDIR}"
  485. -libdir "${QT5_LIBDIR}"
  486. -archdatadir "${QT5_ARCHDATADIR}"
  487. -plugindir "${QT5_PLUGINDIR}"
  488. -libexecdir "${QT5_LIBEXECDIR}"
  489. -importdir "${QT5_IMPORTDIR}"
  490. -qmldir "${QT5_QMLDIR}"
  491. -datadir "${QT5_DATADIR}"
  492. -docdir "${QT5_DOCDIR}"
  493. -translationdir "${QT5_TRANSLATIONDIR}"
  494. -sysconfdir "${QT5_SYSCONFDIR}"
  495. -examplesdir "${QT5_EXAMPLESDIR}"
  496. -testsdir "${QT5_TESTSDIR}"
  497. # force appropriate compiler
  498. $(if use kernel_linux; then
  499. if tc-is-gcc; then
  500. echo -platform linux-g++
  501. elif tc-is-clang; then
  502. echo -platform linux-clang
  503. fi
  504. fi)
  505. # configure in release mode by default,
  506. # override via the CONFIG qmake variable
  507. -release
  508. -no-separate-debug-info
  509. # no need to forcefully build host tools in optimized mode,
  510. # just follow the overall debug/release build type
  511. -no-optimized-tools
  512. # licensing stuff
  513. -opensource -confirm-license
  514. # autodetect the highest supported version of the C++ standard
  515. #-c++std <c++11|c++14|c++1z>
  516. # build shared libraries
  517. -shared
  518. # disabling accessibility is not recommended by upstream, as
  519. # it will break QStyle and may break other internal parts of Qt
  520. -accessibility
  521. # disable all SQL drivers by default, override in qtsql
  522. -no-sql-db2 -no-sql-ibase -no-sql-mysql -no-sql-oci -no-sql-odbc
  523. -no-sql-psql -no-sql-sqlite -no-sql-sqlite2 -no-sql-tds
  524. # MIPS DSP instruction set extensions
  525. $(is-flagq -mno-dsp && echo -no-mips_dsp)
  526. $(is-flagq -mno-dspr2 && echo -no-mips_dspr2)
  527. # bug #773199 and friends
  528. $(tc-cpp-is-true "defined(__SSE2__)" ${CFLAGS} ${CXXFLAGS} || echo -no-feature-sse2)
  529. # use pkg-config to detect include and library paths
  530. -pkg-config
  531. # prefer system libraries (only common hard deps here)
  532. -system-zlib
  533. -system-pcre
  534. -system-doubleconversion
  535. # disable everything to prevent automagic deps (part 1)
  536. -no-mtdev
  537. -no-journald -no-syslog
  538. -no-libpng -no-libjpeg
  539. -no-freetype -no-harfbuzz
  540. -no-openssl -no-libproxy
  541. -no-feature-gssapi
  542. -no-xcb-xlib
  543. # bug 672340
  544. -no-xkbcommon
  545. -no-bundled-xcb-xinput
  546. # cannot use -no-gif because there is no way to override it later
  547. #-no-gif
  548. # always enable glib event loop support
  549. -glib
  550. # disable everything to prevent automagic deps (part 2)
  551. -no-gtk
  552. # exclude examples and tests from default build
  553. -nomake examples
  554. -nomake tests
  555. -no-compile-examples
  556. # disable rpath on non-prefix (bugs 380415 and 417169)
  557. $(usex prefix '' -no-rpath)
  558. # print verbose information about each configure test
  559. -verbose
  560. # disable everything to prevent automagic deps (part 3)
  561. -no-cups -no-evdev -no-tslib -no-icu -no-fontconfig -no-dbus
  562. # let portage handle stripping
  563. -no-strip
  564. # precompiled headers can cause problems on hardened, so turn them off
  565. -no-pch
  566. # link-time code generation is not something we want to enable by default
  567. -no-ltcg
  568. # Qt 5 doesn't support -mno-direct-extern-access, so uses
  569. # -Bsymbolic, which causes issues for consumers if not linking
  570. # corectly (bug #754021).
  571. -no-reduce-relocations
  572. # use the system linker (gold will be selected automagically otherwise)
  573. $(tc-ld-is-gold && echo -use-gold-linker || echo -no-use-gold-linker)
  574. # disable all platform plugins by default, override in qtgui
  575. -no-xcb -no-eglfs -no-kms -no-gbm -no-directfb -no-linuxfb
  576. # always enable session management support: it doesn't need extra deps
  577. # at configure time and turning it off is dangerous, see bug 518262
  578. -sm
  579. # typedef qreal to double (warning: changing this flag breaks the ABI)
  580. -qreal double
  581. # disable OpenGL and EGL support by default, override in qtgui,
  582. # qtopengl, qtprintsupport and qtwidgets
  583. -no-opengl -no-egl
  584. # disable libinput-based generic plugin by default, override in qtgui
  585. -no-libinput
  586. # respect system proxies by default: it's the most natural
  587. # setting, and it'll become the new upstream default in 5.8
  588. -system-proxies
  589. # do not build with -Werror
  590. -no-warnings-are-errors
  591. # enable in respective modules to avoid poisoning QT.global_private.enabled_features
  592. -no-gui -no-widgets
  593. # QTBUG-76521, default will change to zstd in Qt6
  594. -no-zstd
  595. # module-specific options
  596. "${myconf[@]}"
  597. )
  598. pushd "${QT5_BUILD_DIR}" >/dev/null || die
  599. einfo "Configuring with: ${conf[@]}"
  600. "${S}"/configure "${conf[@]}" || die "configure failed"
  601. # a forwarding header is no longer created since 5.8, causing the system
  602. # config to always be used. bug 599636
  603. # ${S}/include does not exist in live sources or kde.org snapshots
  604. local basedir="${S}/"
  605. if [[ ${QT5_BUILD_TYPE} == live ]] || [[ -n ${KDE_ORG_COMMIT} ]]; then
  606. basedir=""
  607. fi
  608. cp src/corelib/global/qconfig.h "${basedir}"include/QtCore/ || die
  609. popd >/dev/null || die
  610. }
  611. # @FUNCTION: qt5_tools_configure
  612. # @INTERNAL
  613. # @DESCRIPTION:
  614. # Most of qttools require files that are only generated when qmake is
  615. # run in the root directory. Related bugs: 676948, 716514.
  616. # Runs qt5_qmake in root directory to create qttools-config.pri and copy to
  617. # ${QT5_BUILD_DIR}, disabling modules other than ${PN} belonging to qttools.
  618. qt5_tools_configure() {
  619. # configure arguments
  620. local qmakeargs=(
  621. --
  622. # not packaged in Gentoo
  623. -no-feature-distancefieldgenerator
  624. -no-feature-kmap2qmap
  625. -no-feature-macdeployqt
  626. -no-feature-makeqpf
  627. -no-feature-qev
  628. -no-feature-qtattributionsscanner
  629. -no-feature-windeployqt
  630. -no-feature-winrtrunner
  631. )
  632. local i module=${PN}
  633. case ${PN} in
  634. linguist-tools) module=linguist ;;
  635. *) ;;
  636. esac
  637. for i in assistant designer linguist pixeltool qdbus qdoc qtdiag qtpaths qtplugininfo; do
  638. [[ ${module} != ${i} ]] && qmakeargs+=( -no-feature-${i} )
  639. done
  640. # allow the ebuild to override what we set here
  641. myqmakeargs=( "${qmakeargs[@]}" "${myqmakeargs[@]}" )
  642. qt5_configure_oos_quirk qttools-config.pri
  643. }
  644. # @FUNCTION: qt5_qmake_args
  645. # @INTERNAL
  646. # @DESCRIPTION:
  647. # Helper function to get the various toolchain-related variables.
  648. qt5_qmake_args() {
  649. echo \
  650. QMAKE_AR=\"$(tc-getAR)\" \
  651. QMAKE_CC=\"$(tc-getCC)\" \
  652. QMAKE_LINK_C=\"$(tc-getCC)\" \
  653. QMAKE_LINK_C_SHLIB=\"$(tc-getCC)\" \
  654. QMAKE_CXX=\"$(tc-getCXX)\" \
  655. QMAKE_LINK=\"$(tc-getCXX)\" \
  656. QMAKE_LINK_SHLIB=\"$(tc-getCXX)\" \
  657. QMAKE_OBJCOPY=\"$(tc-getOBJCOPY)\" \
  658. QMAKE_RANLIB= \
  659. QMAKE_STRIP=\"$(tc-getSTRIP)\" \
  660. QMAKE_CFLAGS=\"${CFLAGS}\" \
  661. QMAKE_CFLAGS_RELEASE= \
  662. QMAKE_CFLAGS_DEBUG= \
  663. QMAKE_CXXFLAGS=\"${CXXFLAGS}\" \
  664. QMAKE_CXXFLAGS_RELEASE= \
  665. QMAKE_CXXFLAGS_DEBUG= \
  666. QMAKE_LFLAGS=\"${LDFLAGS}\" \
  667. QMAKE_LFLAGS_RELEASE= \
  668. QMAKE_LFLAGS_DEBUG=
  669. }
  670. # @FUNCTION: qt5_qmake
  671. # @INTERNAL
  672. # @DESCRIPTION:
  673. # Helper function that runs qmake in the current target subdir.
  674. # Intended to be called by qt5_foreach_target_subdir().
  675. qt5_qmake() {
  676. local projectdir=${PWD/#${QT5_BUILD_DIR}/${S}}
  677. local qmakepath=
  678. if [[ ${QT5_MODULE} == qtbase ]]; then
  679. qmakepath=${QT5_BUILD_DIR}/bin
  680. else
  681. qmakepath=${QT5_BINDIR}
  682. fi
  683. "${qmakepath}"/qmake \
  684. "${projectdir}" \
  685. CONFIG+=$(usex debug debug release) \
  686. CONFIG-=$(usex debug release debug) \
  687. QMAKE_AR="$(tc-getAR) cqs" \
  688. QMAKE_CC="$(tc-getCC)" \
  689. QMAKE_LINK_C="$(tc-getCC)" \
  690. QMAKE_LINK_C_SHLIB="$(tc-getCC)" \
  691. QMAKE_CXX="$(tc-getCXX)" \
  692. QMAKE_LINK="$(tc-getCXX)" \
  693. QMAKE_LINK_SHLIB="$(tc-getCXX)" \
  694. QMAKE_OBJCOPY="$(tc-getOBJCOPY)" \
  695. QMAKE_RANLIB= \
  696. QMAKE_STRIP="$(tc-getSTRIP)" \
  697. QMAKE_CFLAGS="${CFLAGS}" \
  698. QMAKE_CFLAGS_RELEASE= \
  699. QMAKE_CFLAGS_DEBUG= \
  700. QMAKE_CXXFLAGS="${CXXFLAGS}" \
  701. QMAKE_CXXFLAGS_RELEASE= \
  702. QMAKE_CXXFLAGS_DEBUG= \
  703. QMAKE_LFLAGS="${LDFLAGS}" \
  704. QMAKE_LFLAGS_RELEASE= \
  705. QMAKE_LFLAGS_DEBUG= \
  706. "${myqmakeargs[@]}" \
  707. || die "qmake failed (${projectdir#${S}/})"
  708. }
  709. # @FUNCTION: qt5_install_module_config
  710. # @INTERNAL
  711. # @DESCRIPTION:
  712. # Creates and installs gentoo-specific ${PN}-qconfig.{h,pri} and
  713. # ${PN}-qmodule.pri files.
  714. qt5_install_module_config() {
  715. local x qconfig_add= qconfig_remove= qprivateconfig_add= qprivateconfig_remove=
  716. > "${T}"/${PN}-qconfig.h
  717. > "${T}"/${PN}-qconfig.pri
  718. > "${T}"/${PN}-qmodule.pri
  719. # generate qconfig_{add,remove} and ${PN}-qconfig.h
  720. for x in "${QT5_GENTOO_CONFIG[@]}"; do
  721. local flag=${x%%:*}
  722. x=${x#${flag}:}
  723. local feature=${x%%:*}
  724. x=${x#${feature}:}
  725. local macro=${x}
  726. macro=$(tr 'a-z-' 'A-Z_' <<< "${macro}")
  727. if [[ -z ${flag} ]] || { [[ ${flag} != '!' ]] && use ${flag}; }; then
  728. [[ -n ${feature} ]] && qconfig_add+=" ${feature}"
  729. [[ -n ${macro} ]] && echo "#define QT_${macro}" >> "${T}"/${PN}-qconfig.h
  730. else
  731. [[ -n ${feature} ]] && qconfig_remove+=" ${feature}"
  732. [[ -n ${macro} ]] && echo "#define QT_NO_${macro}" >> "${T}"/${PN}-qconfig.h
  733. fi
  734. done
  735. # install ${PN}-qconfig.h
  736. [[ -s ${T}/${PN}-qconfig.h ]] && (
  737. insinto "${QT5_HEADERDIR#"${EPREFIX}"}"/Gentoo
  738. doins "${T}"/${PN}-qconfig.h
  739. )
  740. # generate and install ${PN}-qconfig.pri
  741. [[ -n ${qconfig_add} ]] && echo "QCONFIG_ADD=${qconfig_add}" >> "${T}"/${PN}-qconfig.pri
  742. [[ -n ${qconfig_remove} ]] && echo "QCONFIG_REMOVE=${qconfig_remove}" >> "${T}"/${PN}-qconfig.pri
  743. [[ -s ${T}/${PN}-qconfig.pri ]] && (
  744. insinto "${QT5_ARCHDATADIR#"${EPREFIX}"}"/mkspecs/gentoo
  745. doins "${T}"/${PN}-qconfig.pri
  746. )
  747. # generate qprivateconfig
  748. for x in "${QT5_GENTOO_PRIVATE_CONFIG[@]}"; do
  749. local flag=${x%%:*}
  750. x=${x#${flag}:}
  751. local feature=${x%%:*}
  752. x=${x#${feature}:}
  753. if [[ -z ${flag} ]] || { [[ ${flag} != '!' ]] && use ${flag}; }; then
  754. [[ -n ${feature} ]] && qprivateconfig_add+=" ${feature}"
  755. else
  756. [[ -n ${feature} ]] && qprivateconfig_remove+=" ${feature}"
  757. fi
  758. done
  759. # generate and install ${PN}-qmodule.pri
  760. [[ -n ${qprivateconfig_add} ]] && echo "QT.global_private.enabled_features = ${qprivateconfig_add}" >> "${T}"/${PN}-qmodule.pri
  761. [[ -n ${qprivateconfig_remove} ]] && echo "QT.global_private.disabled_features = ${qprivateconfig_remove}" >> "${T}"/${PN}-qmodule.pri
  762. [[ -s ${T}/${PN}-qmodule.pri ]] && (
  763. insinto "${QT5_ARCHDATADIR#"${EPREFIX}"}"/mkspecs/gentoo
  764. doins "${T}"/${PN}-qmodule.pri
  765. )
  766. # install the original {qconfig,qmodule}.pri from qtcore
  767. [[ ${PN} == qtcore ]] && (
  768. insinto "${QT5_ARCHDATADIR#"${EPREFIX}"}"/mkspecs/gentoo
  769. newins "${D}${QT5_ARCHDATADIR}"/mkspecs/qconfig.pri qconfig-qtcore.pri
  770. newins "${D}${QT5_ARCHDATADIR}"/mkspecs/qmodule.pri qmodule-qtcore.pri
  771. )
  772. }
  773. # @FUNCTION: qt5_regenerate_global_configs
  774. # @INTERNAL
  775. # @DESCRIPTION:
  776. # Generates Gentoo-specific qconfig.{h,pri} and qmodule.pri according to the
  777. # build configuration.
  778. # Don't call die here because dying in pkg_post{inst,rm} only makes things worse.
  779. qt5_regenerate_global_configs() {
  780. einfo "Regenerating gentoo-qconfig.h"
  781. find "${ROOT}${QT5_HEADERDIR}"/Gentoo \
  782. -name '*-qconfig.h' -a \! -name 'gentoo-qconfig.h' -type f \
  783. -execdir cat '{}' + | sort -u > "${T}"/gentoo-qconfig.h
  784. [[ -s ${T}/gentoo-qconfig.h ]] || ewarn "Generated gentoo-qconfig.h is empty"
  785. cp "${T}"/gentoo-qconfig.h "${ROOT}${QT5_HEADERDIR}"/Gentoo/gentoo-qconfig.h \
  786. || eerror "Failed to install new gentoo-qconfig.h"
  787. einfo "Updating QT_CONFIG in qconfig.pri"
  788. local qconfig_pri=${ROOT}${QT5_ARCHDATADIR}/mkspecs/qconfig.pri
  789. local qconfig_pri_orig=${ROOT}${QT5_ARCHDATADIR}/mkspecs/gentoo/qconfig-qtcore.pri
  790. if [[ -f ${qconfig_pri} ]]; then
  791. local x qconfig_add= qconfig_remove=
  792. local qt_config new_qt_config=
  793. if [[ -f ${qconfig_pri_orig} ]]; then
  794. qt_config=$(sed -n 's/^QT_CONFIG\s*+=\s*//p' "${qconfig_pri_orig}")
  795. else
  796. qt_config=$(sed -n 's/^QT_CONFIG\s*+=\s*//p' "${qconfig_pri}")
  797. fi
  798. # generate list of QT_CONFIG entries from the existing list,
  799. # appending QCONFIG_ADD and excluding QCONFIG_REMOVE
  800. eshopts_push -s nullglob
  801. for x in "${ROOT}${QT5_ARCHDATADIR}"/mkspecs/gentoo/*-qconfig.pri; do
  802. qconfig_add+=" $(sed -n 's/^QCONFIG_ADD=\s*//p' "${x}")"
  803. qconfig_remove+=" $(sed -n 's/^QCONFIG_REMOVE=\s*//p' "${x}")"
  804. done
  805. eshopts_pop
  806. for x in ${qt_config} ${qconfig_add}; do
  807. if ! has "${x}" ${new_qt_config} ${qconfig_remove}; then
  808. new_qt_config+=" ${x}"
  809. fi
  810. done
  811. # now replace the existing QT_CONFIG with the generated list
  812. sed -i -e "s/^QT_CONFIG\s*+=.*/QT_CONFIG +=${new_qt_config}/" \
  813. "${qconfig_pri}" || eerror "Failed to sed QT_CONFIG in ${qconfig_pri}"
  814. else
  815. ewarn "${qconfig_pri} does not exist or is not a regular file"
  816. fi
  817. einfo "Updating QT.global_private in qmodule.pri"
  818. local qmodule_pri=${ROOT}${QT5_ARCHDATADIR}/mkspecs/qmodule.pri
  819. local qmodule_pri_orig=${ROOT}${QT5_ARCHDATADIR}/mkspecs/gentoo/qmodule-qtcore.pri
  820. if [[ -f ${qmodule_pri} && -f ${qmodule_pri_orig} ]]; then
  821. local x
  822. local qprivateconfig_enabled= qprivateconfig_disabled=
  823. local qprivateconfig_orig_enabled= qprivateconfig_orig_disabled=
  824. local new_qprivateconfig_enabled= new_qprivateconfig_disabled=
  825. # generate lists of QT.global_private.{dis,en}abled_features
  826. qprivateconfig_orig_enabled="$(sed -n 's/^QT.global_private.enabled_features\s=\s*//p' "${qmodule_pri_orig}")"
  827. qprivateconfig_orig_disabled="$(sed -n 's/^QT.global_private.disabled_features\s=\s*//p' "${qmodule_pri_orig}")"
  828. eshopts_push -s nullglob
  829. for x in "${ROOT}${QT5_ARCHDATADIR}"/mkspecs/gentoo/*-qmodule.pri; do
  830. qprivateconfig_enabled+=" $(sed -n 's/^QT.global_private.enabled_features\s=\s*//p' "${x}")"
  831. qprivateconfig_disabled+=" $(sed -n 's/^QT.global_private.disabled_features\s=\s*//p' "${x}")"
  832. done
  833. eshopts_pop
  834. # anything enabled is enabled, but anything disabled is
  835. # only disabled if it isn't enabled somewhere else.
  836. # this is because we need to forcibly disable some stuff
  837. # in qtcore to support split qtbase.
  838. new_qprivateconfig_enabled=${qprivateconfig_enabled}
  839. for x in ${qprivateconfig_disabled}; do
  840. if ! has "${x}" ${qprivateconfig_enabled}; then
  841. new_qprivateconfig_disabled+=" ${x}"
  842. fi
  843. done
  844. # check all items from the original qtcore qmodule.pri,
  845. # and add them to the appropriate list if not overridden
  846. # elsewhere
  847. for x in ${qprivateconfig_orig_enabled}; do
  848. if ! has "${x}" ${new_qprivateconfig_enabled} ${new_qprivateconfig_disabled}; then
  849. new_qprivateconfig_enabled+=" ${x}"
  850. fi
  851. done
  852. for x in ${qprivateconfig_orig_disabled}; do
  853. if ! has "${x}" ${new_qprivateconfig_enabled} ${new_qprivateconfig_disabled}; then
  854. new_qprivateconfig_disabled+=" ${x}"
  855. fi
  856. done
  857. # now replace the existing QT.global_private.{dis,en}abled_features
  858. # with the generated list
  859. sed \
  860. -e "s/^QT.global_private.enabled_features\s*=.*/QT.global_private.enabled_features =${new_qprivateconfig_enabled}/" \
  861. -e "s/^QT.global_private.disabled_features\s*=.*/QT.global_private.disabled_features =${new_qprivateconfig_disabled}/" \
  862. -i "${qmodule_pri}" || eerror "Failed to sed QT.global_private.enabled_features in ${qmodule_pri}"
  863. else
  864. ewarn "${qmodule_pri} or ${qmodule_pri_orig} does not exist or is not a regular file"
  865. fi
  866. }
  867. fi
  868. EXPORT_FUNCTIONS src_prepare src_configure src_compile src_install src_test pkg_postinst pkg_postrm