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 A309C1381F3 for ; Mon, 10 Jun 2013 01:48:47 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8D1A1E0899; Mon, 10 Jun 2013 01:48:46 +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 D78E9E086F for ; Mon, 10 Jun 2013 01:48:45 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7186A33E0CB for ; Mon, 10 Jun 2013 01:48:44 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id 113A7E468F for ; Mon, 10 Jun 2013 01:48:43 +0000 (UTC) From: "Davide Pesavento" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Davide Pesavento" Message-ID: <1370828723.ffba5311dd6567eec1f27502d672d70e24dcf919.pesa@gentoo> Subject: [gentoo-commits] proj/qt:master commit in: eclass/ X-VCS-Repository: proj/qt X-VCS-Files: eclass/qmake-utils.eclass X-VCS-Directories: eclass/ X-VCS-Committer: pesa X-VCS-Committer-Name: Davide Pesavento X-VCS-Revision: ffba5311dd6567eec1f27502d672d70e24dcf919 X-VCS-Branch: master Date: Mon, 10 Jun 2013 01:48:43 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 976b4ccd-45bb-49af-b63c-e8e8708d84a7 X-Archives-Hash: 6101bcfc26132d66eb6b2e161c28b6c6 commit: ffba5311dd6567eec1f27502d672d70e24dcf919 Author: Davide Pesavento gmail com> AuthorDate: Mon Jun 10 01:44:41 2013 +0000 Commit: Davide Pesavento gentoo org> CommitDate: Mon Jun 10 01:45:23 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/qt.git;a=commit;h=ffba5311 [qmake-utils.eclass] Add qmake-utils_find_pro_file(). Sync with portage. --- eclass/qmake-utils.eclass | 76 ++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 66 insertions(+), 10 deletions(-) diff --git a/eclass/qmake-utils.eclass b/eclass/qmake-utils.eclass index 6fa2734..eddff63 100644 --- a/eclass/qmake-utils.eclass +++ b/eclass/qmake-utils.eclass @@ -17,7 +17,50 @@ case ${EAPI} in *) die "qmake-utils.eclass: unsupported EAPI=${EAPI:-0}" ;; esac -inherit multilib toolchain-funcs +inherit eutils multilib toolchain-funcs + +# @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=$(basename "${S}") + + # set nullglob to avoid expanding *.pro to the literal + # string "*.pro" when there are no matching files + eshopts_push -s nullglob + local pro_files=(*.pro) + eshopts_pop + + case ${#pro_files[@]} in + 0) + : ;; + 1) + echo "${pro_files}" + ;; + *) + for pro_file in "${pro_files[@]}"; do + if [[ ${pro_file%.pro} == ${dir_name} || ${pro_file%.pro} == ${PN} ]]; then + echo "${pro_file}" + break + fi + done + ;; + esac +} + +# @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="ignore/me.pro foo/*" # @FUNCTION: eqmake4 # @USAGE: [project_file] [parameters to qmake] @@ -28,8 +71,9 @@ inherit multilib toolchain-funcs # 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 eqmake5 on the top-level project file only, unless you +# 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 directory # specified inside the top-level project file. @@ -46,7 +90,7 @@ eqmake4() { # if not, then search for it local regexp='.*\.pro' if ! [[ ${1} =~ ${regexp} ]]; then - local project_file=$(_find_project_file) + local project_file=$(qmake-utils_find_pro_file) if [[ -z ${project_file} ]]; then echo eerror "No project files found in '${PWD}'!" @@ -65,6 +109,7 @@ eqmake4() { config_add="debug" config_remove="release" fi + local awkscript='BEGIN { printf "### eqmake4 was here ###\n" > file; printf "CONFIG -= debug_and_release %s\n", remove >> file; @@ -87,16 +132,25 @@ eqmake4() { END { print fixed; }' - local file= + + [[ -n ${EQMAKE4_EXCLUDE} ]] && eshopts_push -o noglob + + local file while read file; do + local excl + for excl in ${EQMAKE4_EXCLUDE}; do + [[ ${file} == ${excl} ]] && continue 2 + done grep -q '^### eqmake4 was here ###$' "${file}" && continue + local retval=$({ - rm -f "${file}" || echo FAIL - awk -v file="${file}" \ - -v add=${config_add} \ - -v remove=${config_remove} \ - -- "${awkscript}" || echo FAIL - } < "${file}") + rm -f "${file}" || echo FAIL + awk -v file="${file}" \ + -v add=${config_add} \ + -v remove=${config_remove} \ + -- "${awkscript}" || echo FAIL + } < "${file}") + if [[ ${retval} == 1 ]]; then einfo " - fixed CONFIG in ${file}" elif [[ ${retval} != 0 ]]; then @@ -105,6 +159,8 @@ eqmake4() { fi done < <(find . -type f -name '*.pr[io]' -printf '%P\n' 2>/dev/null) + [[ -n ${EQMAKE4_EXCLUDE} ]] && eshopts_pop + "${EPREFIX}"/usr/bin/qmake \ -makefile \ QTDIR="${EPREFIX}"/usr/$(get_libdir) \