/[gentoo-x86]/eclass/qt4-r2.eclass
Gentoo

Diff of /eclass/qt4-r2.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.18 Revision 1.19
1# Copyright 1999-2012 Gentoo Foundation 1# Copyright 1999-2012 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/qt4-r2.eclass,v 1.18 2012/02/13 00:53:28 pesa Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/qt4-r2.eclass,v 1.19 2012/02/13 01:31:50 pesa Exp $
4 4
5# @ECLASS: qt4-r2.eclass 5# @ECLASS: qt4-r2.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Qt herd <qt@gentoo.org> 7# Qt herd <qt@gentoo.org>
8# @BLURB: Eclass for Qt4-based packages, second edition. 8# @BLURB: Eclass for Qt4-based packages, second edition.
28# Example: 28# Example:
29# @CODE 29# @CODE
30# LANGS="en el de" 30# LANGS="en el de"
31# @CODE 31# @CODE
32for x in ${LANGS}; do 32for x in ${LANGS}; do
33 IUSE="${IUSE} linguas_${x}" 33 IUSE+=" linguas_${x}"
34done 34done
35 35
36# @ECLASS-VARIABLE: LANGSLONG 36# @ECLASS-VARIABLE: LANGSLONG
37# @DEFAULT_UNSET 37# @DEFAULT_UNSET
38# @DESCRIPTION: 38# @DESCRIPTION:
39# Same as above, but this variable is for LINGUAS that must be in long format. 39# Same as above, but this variable is for LINGUAS that must be in long format.
40# Remember to set this variable before inheriting qt4-r2 eclass. 40# Remember to set this variable before inheriting qt4-r2 eclass.
41# Look at ${PORTDIR}/profiles/desc/linguas.desc for details. 41# Look at ${PORTDIR}/profiles/desc/linguas.desc for details.
42for x in ${LANGSLONG}; do 42for x in ${LANGSLONG}; do
43 IUSE="${IUSE} linguas_${x%_*}" 43 IUSE+=" linguas_${x%_*}"
44done 44done
45unset x
45 46
46# @FUNCTION: qt4-r2_src_unpack 47# @FUNCTION: qt4-r2_src_unpack
47# @DESCRIPTION: 48# @DESCRIPTION:
48# Default src_unpack function for packages that depend on qt4. If you have to 49# Default src_unpack function for packages that depend on qt4. If you have to
49# override src_unpack in your ebuild (probably you don't need to), call 50# override src_unpack in your ebuild (probably you don't need to), call
81# Default src_configure function for packages that depend on qt4. If you have to 82# Default src_configure function for packages that depend on qt4. If you have to
82# override src_configure in your ebuild, call qt4-r2_src_configure in it. 83# override src_configure in your ebuild, call qt4-r2_src_configure in it.
83qt4-r2_src_configure() { 84qt4-r2_src_configure() {
84 debug-print-function $FUNCNAME "$@" 85 debug-print-function $FUNCNAME "$@"
85 86
86 local project_file="$(_find_project_file)" 87 local project_file=$(_find_project_file)
87 88
88 if [[ -n ${project_file} ]]; then 89 if [[ -n ${project_file} ]]; then
89 eqmake4 ${project_file} 90 eqmake4 "${project_file}"
90 else 91 else
91 base_src_configure "$@" 92 base_src_configure "$@"
92 fi 93 fi
93} 94}
94 95
124 debug-print-function $FUNCNAME "$@" 125 debug-print-function $FUNCNAME "$@"
125 126
126 emake INSTALL_ROOT="${D}" DESTDIR="${D}" install || die "emake install failed" 127 emake INSTALL_ROOT="${D}" DESTDIR="${D}" install || die "emake install failed"
127 128
128 # install documentation 129 # install documentation
129 local doc dir="${DOCSDIR:-${S}}" 130 local doc= dir=${DOCSDIR:-${S}}
130 for doc in ${DOCS}; do 131 for doc in ${DOCS}; do
131 dodoc "${dir}/${doc}" || die "dodoc failed" 132 dodoc "${dir}/${doc}" || die "dodoc failed"
132 done 133 done
133} 134}
134 135
139# 2 or more *.pro files found - if ${PN}.pro or $(basename ${S}).pro 140# 2 or more *.pro files found - if ${PN}.pro or $(basename ${S}).pro
140# are there, output any of them 141# are there, output any of them
141# Outputs a project file argument used by eqmake4. Sets nullglob locally 142# Outputs a project file argument used by eqmake4. Sets nullglob locally
142# to avoid expanding *.pro as "*.pro" when there are no matching files. 143# to avoid expanding *.pro as "*.pro" when there are no matching files.
143_find_project_file() { 144_find_project_file() {
145 local dir_name=$(basename "${S}")
146
144 shopt -s nullglob 147 eshopts_push -s nullglob
145 local pro_files=(*.pro) 148 local pro_files=(*.pro)
146 shopt -u nullglob 149 eshopts_pop
147 local dir_name="$(basename ${S})"
148 150
149 case ${#pro_files[@]} in 151 case ${#pro_files[@]} in
150 1) 152 1)
151 echo "${pro_files[0]}" 153 echo "${pro_files[0]}"
152 ;; 154 ;;
153 *) 155 *)
154 for pro_file in "${pro_files[@]}"; do 156 for pro_file in "${pro_files[@]}"; do
155 if [[ ${pro_file} == "${dir_name}" || ${pro_file} == "${PN}.pro" ]]; then 157 if [[ ${pro_file} == "${dir_name}.pro" || ${pro_file} == "${PN}.pro" ]]; then
156 echo "${pro_file}" 158 echo "${pro_file}"
157 break 159 break
158 fi 160 fi
159 done 161 done
160 ;; 162 ;;
174# should run eqmake4 on the top-level project file only, unless you have 176# should run eqmake4 on the top-level project file only, unless you have
175# strong reasons to do things differently. During the building, qmake 177# strong reasons to do things differently. During the building, qmake
176# will be automatically re-invoked with the right arguments on every 178# will be automatically re-invoked with the right arguments on every
177# directory specified inside the top-level project file. 179# directory specified inside the top-level project file.
178eqmake4() { 180eqmake4() {
181 [[ ${EAPI} == 2 ]] && use !prefix && EPREFIX=
182
179 ebegin "Running qmake" 183 ebegin "Running qmake"
180 184
181 local qmake_args=("$@") 185 local qmake_args=("$@")
182 186
183 # check if project file was passed as a first argument 187 # check if project file was passed as a first argument
184 # if not, then search for it 188 # if not, then search for it
185 local regexp='.*\.pro' 189 local regexp='.*\.pro'
186 if ! [[ ${1} =~ ${regexp} ]]; then 190 if ! [[ ${1} =~ ${regexp} ]]; then
187 local project_file="$(_find_project_file)" 191 local project_file=$(_find_project_file)
188 if [[ -z ${project_file} ]]; then 192 if [[ -z ${project_file} ]]; then
189 echo 193 echo
190 eerror "No project file found in ${S}!" 194 eerror "No project files found in '${PWD}'!"
191 eerror "This shouldn't happen - please send a bug report to http://bugs.gentoo.org/" 195 eerror "This shouldn't happen - please send a bug report to http://bugs.gentoo.org/"
192 echo 196 echo
193 die "eqmake4 failed" 197 die "eqmake4 failed"
194 fi 198 fi
195 qmake_args+=("${project_file}") 199 qmake_args+=("${project_file}")
196 fi 200 fi
197 201
198 # make sure CONFIG variable is correctly set 202 # make sure CONFIG variable is correctly set
199 # for both release and debug builds 203 # for both release and debug builds
200 local CONFIG_ADD="release" 204 local config_add="release"
201 local CONFIG_REMOVE="debug" 205 local config_remove="debug"
202 if has debug ${IUSE} && use debug; then 206 if has debug ${IUSE} && use debug; then
203 CONFIG_ADD="debug" 207 config_add="debug"
204 CONFIG_REMOVE="release" 208 config_remove="release"
205 fi 209 fi
206 local awkscript='BEGIN { 210 local awkscript='BEGIN {
207 printf "### eqmake4 was here ###\n" > file; 211 printf "### eqmake4 was here ###\n" > file;
208 printf "CONFIG -= debug_and_release %s\n", remove >> file; 212 printf "CONFIG -= debug_and_release %s\n", remove >> file;
209 printf "CONFIG += %s\n\n", add >> file; 213 printf "CONFIG += %s\n\n", add >> file;
229 while read file; do 233 while read file; do
230 grep -q '^### eqmake4 was here ###$' "${file}" && continue 234 grep -q '^### eqmake4 was here ###$' "${file}" && continue
231 local retval=$({ 235 local retval=$({
232 rm -f "${file}" || echo FAIL 236 rm -f "${file}" || echo FAIL
233 awk -v file="${file}" \ 237 awk -v file="${file}" \
234 -v add=${CONFIG_ADD} \ 238 -v add=${config_add} \
235 -v remove=${CONFIG_REMOVE} \ 239 -v remove=${config_remove} \
236 -- "${awkscript}" || echo FAIL 240 -- "${awkscript}" || echo FAIL
237 } < "${file}") 241 } < "${file}")
238 if [[ ${retval} == 1 ]]; then 242 if [[ ${retval} == 1 ]]; then
239 einfo " - fixed CONFIG in ${file}" 243 einfo " - fixed CONFIG in ${file}"
240 elif [[ ${retval} != 0 ]]; then 244 elif [[ ${retval} != 0 ]]; then
241 eerror "An error occurred while processing ${file}" 245 eerror " - error while processing ${file}"
242 die "eqmake4 failed to process '${file}'" 246 die "eqmake4 failed to process ${file}"
243 fi 247 fi
244 done < <(find . -type f -name "*.pr[io]" -printf '%P\n' 2>/dev/null) 248 done < <(find . -type f -name '*.pr[io]' -printf '%P\n' 2>/dev/null)
245
246 [[ ${EAPI} == 2 ]] && use !prefix && EPREFIX=
247 249
248 "${EPREFIX}"/usr/bin/qmake \ 250 "${EPREFIX}"/usr/bin/qmake \
249 -makefile \ 251 -makefile \
250 QTDIR="${EPREFIX}"/usr/$(get_libdir) \ 252 QTDIR="${EPREFIX}"/usr/$(get_libdir) \
251 QMAKE="${EPREFIX}"/usr/bin/qmake \ 253 QMAKE="${EPREFIX}"/usr/bin/qmake \

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19

  ViewVC Help
Powered by ViewVC 1.1.20