| 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.23 2012/10/04 03:52:35 pesa Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/qt4-r2.eclass,v 1.24 2012/11/08 09:42:51 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. |
| … | |
… | |
| 39 | # @DEFAULT_UNSET |
39 | # @DEFAULT_UNSET |
| 40 | # @DESCRIPTION: |
40 | # @DESCRIPTION: |
| 41 | # In case your Qt4 application provides various translations, use this variable |
41 | # In case your Qt4 application provides various translations, use this variable |
| 42 | # to specify them in order to populate "linguas_*" IUSE automatically. Make sure |
42 | # to specify them in order to populate "linguas_*" IUSE automatically. Make sure |
| 43 | # that you set this variable before inheriting qt4-r2 eclass. |
43 | # that you set this variable before inheriting qt4-r2 eclass. |
| 44 | # Example: |
44 | # |
| 45 | # @CODE |
45 | # Example: LANGS="de el it ja" |
| 46 | # LANGS="en el de" |
|
|
| 47 | # @CODE |
|
|
| 48 | for x in ${LANGS}; do |
46 | for x in ${LANGS}; do |
| 49 | IUSE+=" linguas_${x}" |
47 | IUSE+=" linguas_${x}" |
| 50 | done |
48 | done |
| 51 | |
49 | |
| 52 | # @ECLASS-VARIABLE: LANGSLONG |
50 | # @ECLASS-VARIABLE: LANGSLONG |
| 53 | # @DEFAULT_UNSET |
51 | # @DEFAULT_UNSET |
| 54 | # @DESCRIPTION: |
52 | # @DESCRIPTION: |
| 55 | # Same as above, but this variable is for LINGUAS that must be in long format. |
53 | # Same as LANGS, but this variable is for LINGUAS that must be in long format. |
| 56 | # Remember to set this variable before inheriting qt4-r2 eclass. |
54 | # Remember to set this variable before inheriting qt4-r2 eclass. |
| 57 | # Look at ${PORTDIR}/profiles/desc/linguas.desc for details. |
55 | # Look at ${PORTDIR}/profiles/desc/linguas.desc for details. |
|
|
56 | # |
|
|
57 | # Example: LANGSLONG="en_GB ru_RU" |
| 58 | for x in ${LANGSLONG}; do |
58 | for x in ${LANGSLONG}; do |
| 59 | IUSE+=" linguas_${x%_*}" |
59 | IUSE+=" linguas_${x%_*}" |
| 60 | done |
60 | done |
| 61 | unset x |
61 | unset x |
| 62 | |
62 | |
| … | |
… | |
| 124 | base_src_compile "$@" |
124 | base_src_compile "$@" |
| 125 | } |
125 | } |
| 126 | |
126 | |
| 127 | # @FUNCTION: qt4-r2_src_install |
127 | # @FUNCTION: qt4-r2_src_install |
| 128 | # @DESCRIPTION: |
128 | # @DESCRIPTION: |
| 129 | # Default src_install function for qt4-based packages. Installs compiled code |
129 | # Default src_install function for qt4-based packages. Installs compiled code, |
| 130 | # documentation (via DOCS and HTML_DOCS variables). |
130 | # documentation (via DOCS and HTML_DOCS variables). |
| 131 | |
131 | |
| 132 | qt4-r2_src_install() { |
132 | qt4-r2_src_install() { |
| 133 | debug-print-function $FUNCNAME "$@" |
133 | debug-print-function $FUNCNAME "$@" |
| 134 | |
134 | |
| … | |
… | |
| 139 | dodoc ${DOCS} || die "dodoc failed" |
139 | dodoc ${DOCS} || die "dodoc failed" |
| 140 | fi |
140 | fi |
| 141 | if [[ -n ${HTML_DOCS} ]] && [[ "$(declare -p HTML_DOCS 2>/dev/null 2>&1)" != "declare -a"* ]]; then |
141 | if [[ -n ${HTML_DOCS} ]] && [[ "$(declare -p HTML_DOCS 2>/dev/null 2>&1)" != "declare -a"* ]]; then |
| 142 | dohtml -r ${HTML_DOCS} || die "dohtml failed" |
142 | dohtml -r ${HTML_DOCS} || die "dohtml failed" |
| 143 | fi |
143 | fi |
| 144 | } |
|
|
| 145 | |
|
|
| 146 | # Internal function, used by eqmake4 and qt4-r2_src_configure |
|
|
| 147 | # Look for project files: |
|
|
| 148 | # 0 *.pro files found - output null string |
|
|
| 149 | # 1 *.pro file found - output its name |
|
|
| 150 | # 2 or more *.pro files found - if ${PN}.pro or $(basename ${S}).pro |
|
|
| 151 | # are there, output any of them |
|
|
| 152 | # Outputs a project file argument used by eqmake4. Sets nullglob locally |
|
|
| 153 | # to avoid expanding *.pro as "*.pro" when there are no matching files. |
|
|
| 154 | _find_project_file() { |
|
|
| 155 | local dir_name=$(basename "${S}") |
|
|
| 156 | |
|
|
| 157 | eshopts_push -s nullglob |
|
|
| 158 | local pro_files=(*.pro) |
|
|
| 159 | eshopts_pop |
|
|
| 160 | |
|
|
| 161 | case ${#pro_files[@]} in |
|
|
| 162 | 1) |
|
|
| 163 | echo "${pro_files[0]}" |
|
|
| 164 | ;; |
|
|
| 165 | *) |
|
|
| 166 | for pro_file in "${pro_files[@]}"; do |
|
|
| 167 | if [[ ${pro_file} == "${dir_name}.pro" || ${pro_file} == "${PN}.pro" ]]; then |
|
|
| 168 | echo "${pro_file}" |
|
|
| 169 | break |
|
|
| 170 | fi |
|
|
| 171 | done |
|
|
| 172 | ;; |
|
|
| 173 | esac |
|
|
| 174 | } |
144 | } |
| 175 | |
145 | |
| 176 | # @FUNCTION: eqmake4 |
146 | # @FUNCTION: eqmake4 |
| 177 | # @USAGE: [project_file] [parameters to qmake] |
147 | # @USAGE: [project_file] [parameters to qmake] |
| 178 | # @DESCRIPTION: |
148 | # @DESCRIPTION: |
| … | |
… | |
| 259 | |
229 | |
| 260 | "${EPREFIX}"/usr/bin/qmake \ |
230 | "${EPREFIX}"/usr/bin/qmake \ |
| 261 | -makefile \ |
231 | -makefile \ |
| 262 | QTDIR="${EPREFIX}"/usr/$(get_libdir) \ |
232 | QTDIR="${EPREFIX}"/usr/$(get_libdir) \ |
| 263 | QMAKE="${EPREFIX}"/usr/bin/qmake \ |
233 | QMAKE="${EPREFIX}"/usr/bin/qmake \ |
|
|
234 | QMAKE_AR="$(tc-getAR) cqs" \ |
| 264 | QMAKE_CC="$(tc-getCC)" \ |
235 | QMAKE_CC="$(tc-getCC)" \ |
| 265 | QMAKE_CXX="$(tc-getCXX)" \ |
236 | QMAKE_CXX="$(tc-getCXX)" \ |
| 266 | QMAKE_LINK="$(tc-getCXX)" \ |
237 | QMAKE_LINK="$(tc-getCXX)" \ |
|
|
238 | QMAKE_OBJCOPY="$(tc-getOBJCOPY)" \ |
|
|
239 | QMAKE_RANLIB= \ |
|
|
240 | QMAKE_STRIP= \ |
| 267 | QMAKE_CFLAGS="${CFLAGS}" \ |
241 | QMAKE_CFLAGS="${CFLAGS}" \ |
| 268 | QMAKE_CFLAGS_RELEASE= \ |
242 | QMAKE_CFLAGS_RELEASE= \ |
| 269 | QMAKE_CFLAGS_DEBUG= \ |
243 | QMAKE_CFLAGS_DEBUG= \ |
| 270 | QMAKE_CXXFLAGS="${CXXFLAGS}" \ |
244 | QMAKE_CXXFLAGS="${CXXFLAGS}" \ |
| 271 | QMAKE_CXXFLAGS_RELEASE= \ |
245 | QMAKE_CXXFLAGS_RELEASE= \ |
| … | |
… | |
| 274 | QMAKE_LFLAGS_RELEASE= \ |
248 | QMAKE_LFLAGS_RELEASE= \ |
| 275 | QMAKE_LFLAGS_DEBUG= \ |
249 | QMAKE_LFLAGS_DEBUG= \ |
| 276 | QMAKE_LIBDIR_QT="${EPREFIX}"/usr/$(get_libdir)/qt4 \ |
250 | QMAKE_LIBDIR_QT="${EPREFIX}"/usr/$(get_libdir)/qt4 \ |
| 277 | QMAKE_LIBDIR_X11="${EPREFIX}"/usr/$(get_libdir) \ |
251 | QMAKE_LIBDIR_X11="${EPREFIX}"/usr/$(get_libdir) \ |
| 278 | QMAKE_LIBDIR_OPENGL="${EPREFIX}"/usr/$(get_libdir) \ |
252 | QMAKE_LIBDIR_OPENGL="${EPREFIX}"/usr/$(get_libdir) \ |
| 279 | QMAKE_STRIP= \ |
|
|
| 280 | "${qmake_args[@]}" |
253 | "${qmake_args[@]}" |
| 281 | |
254 | |
| 282 | # was qmake successful? |
255 | # was qmake successful? |
| 283 | if ! eend $? ; then |
256 | if ! eend $? ; then |
| 284 | echo |
257 | echo |
| … | |
… | |
| 289 | fi |
262 | fi |
| 290 | |
263 | |
| 291 | return 0 |
264 | return 0 |
| 292 | } |
265 | } |
| 293 | |
266 | |
|
|
267 | # Internal function, used by eqmake4 and qt4-r2_src_configure. |
|
|
268 | # Outputs a project file name that can be passed to eqmake4. Sets nullglob |
|
|
269 | # locally to avoid expanding *.pro as "*.pro" when there are no matching files. |
|
|
270 | # 0 *.pro files found --> outputs null string |
|
|
271 | # 1 *.pro file found --> outputs its name |
|
|
272 | # 2 or more *.pro files found --> if ${PN}.pro or $(basename ${S}).pro |
|
|
273 | # are there, outputs any of them |
|
|
274 | _find_project_file() { |
|
|
275 | local dir_name=$(basename "${S}") |
|
|
276 | |
|
|
277 | eshopts_push -s nullglob |
|
|
278 | local pro_files=(*.pro) |
|
|
279 | eshopts_pop |
|
|
280 | |
|
|
281 | case ${#pro_files[@]} in |
|
|
282 | 1) |
|
|
283 | echo "${pro_files[0]}" |
|
|
284 | ;; |
|
|
285 | *) |
|
|
286 | for pro_file in "${pro_files[@]}"; do |
|
|
287 | if [[ ${pro_file} == "${dir_name}.pro" || ${pro_file} == "${PN}.pro" ]]; then |
|
|
288 | echo "${pro_file}" |
|
|
289 | break |
|
|
290 | fi |
|
|
291 | done |
|
|
292 | ;; |
|
|
293 | esac |
|
|
294 | } |
|
|
295 | |
| 294 | EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install |
296 | EXPORT_FUNCTIONS src_unpack src_prepare src_configure src_compile src_install |