From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 8DE90138247 for ; Mon, 2 Dec 2013 09:44:29 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id EFA24E08BD; Mon, 2 Dec 2013 09:44:20 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id F1EFDE086F for ; Mon, 2 Dec 2013 09:44:19 +0000 (UTC) Received: from [91.220.220.251] (pinkbyte.micronet-rostov.ru [91.220.220.251]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: pinkbyte) by smtp.gentoo.org (Postfix) with ESMTPSA id 6274B33F152; Mon, 2 Dec 2013 09:44:18 +0000 (UTC) Message-ID: <529C5669.5080100@gentoo.org> Date: Mon, 02 Dec 2013 13:44:09 +0400 From: Sergey Popov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131113 Thunderbird/17.0.9 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 To: gentoo-dev@lists.gentoo.org CC: Davide Pesavento Subject: Re: [gentoo-dev] qmake-utils.eclass: new eclass with eqmake4/eqmake5 functions References: <5280F8A6.6040503@gentoo.org> In-Reply-To: <5280F8A6.6040503@gentoo.org> X-Enigmail-Version: 1.5.2 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="xpxSxG0wXVHSIo2aXs5upunb1S1dVafEQ" X-Archives-Salt: bf770f77-857e-4f8b-918a-bd1149fc379f X-Archives-Hash: 67dfa5eb592d948b266e25992acb502f This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --xpxSxG0wXVHSIo2aXs5upunb1S1dVafEQ Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 11.11.2013 19:32, Sergey Popov =D0=BF=D0=B8=D1=88=D0=B5=D1=82: > Some work on splitting these helper functions was done earlier, and the= n > we have got request(bug #479744), so, with ACK from pesa, i would like > to propose this new eclass here and some times after - another proposal= > with making qt4-r2 eclass depends on this one to prevent code duplicati= on. >=20 > So, here it is(directly from qt overlay): >=20 >=20 >=20 > # Copyright 1999-2013 Gentoo Foundation > # Distributed under the terms of the GNU General Public License v2 > # $Header: $ >=20 > # @ECLASS: qmake-utils.eclass > # @MAINTAINER: > # Qt herd > # @AUTHOR: > # Davide Pesavento > # @BLURB: Common functions for qmake-based packages. > # @DESCRIPTION: > # Utility eclass providing wrapper functions for Qt4 and Qt5 qmake. >=20 > if [[ ${___ECLASS_ONCE_QMAKE_UTILS} !=3D "recur -_+^+_- spank" ]]; then= > ___ECLASS_ONCE_QMAKE_UTILS=3D"recur -_+^+_- spank" >=20 > inherit eutils multilib toolchain-funcs >=20 > # @FUNCTION: qmake-utils_find_pro_file > # @RETURN: zero or one qmake .pro file names > # @INTERNAL > # @DESCRIPTION: > # Outputs a project file name that can be passed to eqmake. > # 0 *.pro files found --> outputs null string; > # 1 *.pro file found --> outputs its name; > # 2 or more *.pro files found --> if "${PN}.pro" or > # "$(basename ${S}).pro" are there, outputs one of them. > qmake-utils_find_pro_file() { > local dir_name=3D$(basename "${S}") >=20 > # set nullglob to avoid expanding *.pro to the literal > # string "*.pro" when there are no matching files > eshopts_push -s nullglob > local pro_files=3D(*.pro) > eshopts_pop >=20 > case ${#pro_files[@]} in > 0) > : ;; > 1) > echo "${pro_files}" > ;; > *) > for pro_file in "${pro_files[@]}"; do > if [[ ${pro_file%.pro} =3D=3D ${dir_name} || ${pro_file%.pro} =3D=3D= ${PN} > ]]; then > echo "${pro_file}" > break > fi > done > ;; > esac > } >=20 > # @VARIABLE: EQMAKE4_EXCLUDE > # @DEFAULT_UNSET > # @DESCRIPTION: > # List of files to be excluded from eqmake4 CONFIG processing. > # Paths are relative to the current working directory (usually ${S}). > # > # Example: EQMAKE4_EXCLUDE=3D"ignore/me.pro foo/*" >=20 > # @FUNCTION: eqmake4 > # @USAGE: [project_file] [parameters to qmake] > # @DESCRIPTION: > # Wrapper for Qt4's qmake. If project_file isn't specified, eqmake4 wil= l > # look for it in the current directory (${S}, non-recursively). If more= > # than one project file are found, then ${PN}.pro is processed, provide= d > # that it exists. Otherwise eqmake4 fails. > # > # All other arguments are appended unmodified to qmake command line. > # > # For recursive build systems, i.e. those based on the subdirs template= , > # you should run eqmake4 on the top-level project file only, unless you= > # have a valid reason to do otherwise. During the building, qmake will > # be automatically re-invoked with the right arguments on every directo= ry > # specified inside the top-level project file. > eqmake4() { > debug-print-function ${FUNCNAME} "$@" >=20 > has "${EAPI:-0}" 0 1 2 && use !prefix && EPREFIX=3D >=20 > ebegin "Running qmake" >=20 > local qmake_args=3D("$@") >=20 > # check if project file was passed as a first argument > # if not, then search for it > local regexp=3D'.*\.pro' > if ! [[ ${1} =3D~ ${regexp} ]]; then > local project_file=3D$(qmake-utils_find_pro_file) > if [[ -z ${project_file} ]]; then > echo > eerror "No project files found in '${PWD}'!" > eerror "This shouldn't happen - please send a bug report to > https://bugs.gentoo.org/" > echo > die "eqmake4 failed" > fi > qmake_args+=3D("${project_file}") > fi >=20 > # make sure CONFIG variable is correctly set > # for both release and debug builds > local config_add=3D"release" > local config_remove=3D"debug" > if has debug ${IUSE} && use debug; then > config_add=3D"debug" > config_remove=3D"release" > fi >=20 > local awkscript=3D'BEGIN { > printf "### eqmake4 was here ###\n" > file; > printf "CONFIG -=3D debug_and_release %s\n", remove >> file; > printf "CONFIG +=3D %s\n\n", add >> file; > fixed=3D0; > } > /^[[:blank:]]*CONFIG[[:blank:]]*[\+\*]?=3D/ { > if (gsub("\\<((" remove ")|(debug_and_release))\\>", "") > 0) { > fixed=3D1; > } > } > /^[[:blank:]]*CONFIG[[:blank:]]*-=3D/ { > if (gsub("\\<" add "\\>", "") > 0) { > fixed=3D1; > } > } > { > print >> file; > } > END { > print fixed; > }' >=20 > [[ -n ${EQMAKE4_EXCLUDE} ]] && eshopts_push -o noglob >=20 > local file > while read file; do > local excl > for excl in ${EQMAKE4_EXCLUDE}; do > [[ ${file} =3D=3D ${excl} ]] && continue 2 > done > grep -q '^### eqmake4 was here ###$' "${file}" && continue >=20 > local retval=3D$({ > rm -f "${file}" || echo FAIL > awk -v file=3D"${file}" \ > -v add=3D${config_add} \ > -v remove=3D${config_remove} \ > -- "${awkscript}" || echo FAIL > } < "${file}") >=20 > if [[ ${retval} =3D=3D 1 ]]; then > einfo " - fixed CONFIG in ${file}" > elif [[ ${retval} !=3D 0 ]]; then > eerror " - error while processing ${file}" > die "eqmake4 failed to process ${file}" > fi > done < <(find . -type f -name '*.pr[io]' -printf '%P\n' 2>/dev/null) >=20 > [[ -n ${EQMAKE4_EXCLUDE} ]] && eshopts_pop >=20 > "${EPREFIX}"/usr/bin/qmake \ > -makefile \ > QTDIR=3D"${EPREFIX}"/usr/$(get_libdir) \ > QMAKE=3D"${EPREFIX}"/usr/bin/qmake \ > QMAKE_AR=3D"$(tc-getAR) cqs" \ > QMAKE_CC=3D"$(tc-getCC)" \ > QMAKE_CXX=3D"$(tc-getCXX)" \ > QMAKE_LINK=3D"$(tc-getCXX)" \ > QMAKE_LINK_C=3D"$(tc-getCC)" \ > QMAKE_OBJCOPY=3D"$(tc-getOBJCOPY)" \ > QMAKE_RANLIB=3D \ > QMAKE_STRIP=3D \ > QMAKE_CFLAGS=3D"${CFLAGS}" \ > QMAKE_CFLAGS_RELEASE=3D \ > QMAKE_CFLAGS_DEBUG=3D \ > QMAKE_CXXFLAGS=3D"${CXXFLAGS}" \ > QMAKE_CXXFLAGS_RELEASE=3D \ > QMAKE_CXXFLAGS_DEBUG=3D \ > QMAKE_LFLAGS=3D"${LDFLAGS}" \ > QMAKE_LFLAGS_RELEASE=3D \ > QMAKE_LFLAGS_DEBUG=3D \ > QMAKE_LIBDIR_QT=3D"${EPREFIX}"/usr/$(get_libdir)/qt4 \ > QMAKE_LIBDIR_X11=3D"${EPREFIX}"/usr/$(get_libdir) \ > QMAKE_LIBDIR_OPENGL=3D"${EPREFIX}"/usr/$(get_libdir) \ > "${qmake_args[@]}" >=20 > # was qmake successful? > if ! eend $? ; then > echo > eerror "Running qmake has failed! (see above for details)" > eerror "This shouldn't happen - please send a bug report to > https://bugs.gentoo.org/" > echo > die "eqmake4 failed" > fi > } >=20 > # @FUNCTION: eqmake5 > # @USAGE: [arguments for qmake] > # @DESCRIPTION: > # Wrapper for Qt5's qmake. All arguments are passed to qmake. > # > # For recursive build systems, i.e. those based on the subdirs template= , > # you should run eqmake5 on the top-level project file only, unless you= > # have a valid reason to do otherwise. During the building, qmake will > # be automatically re-invoked with the right arguments on every directo= ry > # specified inside the top-level project file. > eqmake5() { > debug-print-function ${FUNCNAME} "$@" >=20 > has "${EAPI:-0}" 0 1 2 && use !prefix && EPREFIX=3D >=20 > ebegin "Running qmake" >=20 > "${EPREFIX}"/usr/$(get_libdir)/qt5/bin/qmake \ > -makefile \ > QMAKE_AR=3D"$(tc-getAR) cqs" \ > QMAKE_CC=3D"$(tc-getCC)" \ > QMAKE_CXX=3D"$(tc-getCXX)" \ > QMAKE_LINK=3D"$(tc-getCXX)" \ > QMAKE_LINK_C=3D"$(tc-getCC)" \ > QMAKE_OBJCOPY=3D"$(tc-getOBJCOPY)" \ > QMAKE_RANLIB=3D \ > QMAKE_STRIP=3D \ > QMAKE_CFLAGS=3D"${CFLAGS}" \ > QMAKE_CFLAGS_RELEASE=3D \ > QMAKE_CFLAGS_DEBUG=3D \ > QMAKE_CXXFLAGS=3D"${CXXFLAGS}" \ > QMAKE_CXXFLAGS_RELEASE=3D \ > QMAKE_CXXFLAGS_DEBUG=3D \ > QMAKE_LFLAGS=3D"${LDFLAGS}" \ > QMAKE_LFLAGS_RELEASE=3D \ > QMAKE_LFLAGS_DEBUG=3D \ > "$@" >=20 > # was qmake successful? > if ! eend $? ; then > echo > eerror "Running qmake has failed! (see above for details)" > eerror "This shouldn't happen - please send a bug report to > https://bugs.gentoo.org/" > echo > die "eqmake5 failed" > fi > } >=20 > fi >=20 >=20 Ok, no objections/comments for more than 3 weeks. I committed it. Later i will post diff for qt4-r2 eclass. --=20 Best regards, Sergey Popov Gentoo developer Gentoo Desktop Effects project lead Gentoo Qt project lead Gentoo Proxy maintainers project lead --xpxSxG0wXVHSIo2aXs5upunb1S1dVafEQ Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBAgAGBQJSnFZpAAoJECo/aRed9267Mx0H/38IqDXceefRj1CSMr0lZTn3 +I6Z3fao6NBU0axeAzeER/84H80AUXCh8usbWS8JjiABzPpkFh0OBm4t6fbBxxif BChbda+LsitqajPdfAvH/fkzfcZvYOf2UaUar9UP04mYisxaNV8rCrzkURSLKJNT YylBPlTHHRXyGgMDZyAUIfVu8p3gdpi2zAQtzv31J67kKTPksLEwNsLQi/9TIJgt O8e8wm3WfEG9+9KG7Mn7PiOS2NzrBEU+ZvRUICjziDyBP7ndWVEX1mQhKu6ySdQD /YFc55X4PiI63jimcIP4oMuRi771lvPLnxlBArU60IU++u3Qx8CKqOI8SXInF5o= =i6kw -----END PGP SIGNATURE----- --xpxSxG0wXVHSIo2aXs5upunb1S1dVafEQ--