| 1 |
# Copyright 2005 Gentoo Foundation |
| 2 |
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
# $Header: /var/cvsroot/gentoo-x86/eclass/qt4.eclass,v 1.23 2007/08/02 20:04:40 carlo Exp $ |
| 4 |
# |
| 5 |
# Author Caleb Tennis <caleb@gentoo.org> |
| 6 |
# |
| 7 |
# This eclass is simple. Inherit it, and in your depend, do something like this: |
| 8 |
# |
| 9 |
# DEPEND="$(qt4_min_version 4)" |
| 10 |
# |
| 11 |
# and it handles the rest for you |
| 12 |
# |
| 13 |
# 08.16.06 - Renamed qt_min_* to qt4_min_* to avoid conflicts with the qt3 eclass. |
| 14 |
# - Caleb Tennis <caleb@gentoo.org> |
| 15 |
|
| 16 |
inherit eutils multilib toolchain-funcs versionator |
| 17 |
|
| 18 |
IUSE="${IUSE}" |
| 19 |
|
| 20 |
QTPKG="x11-libs/qt-" |
| 21 |
QT4MAJORVERSIONS="4.3 4.2 4.1 4.0" |
| 22 |
QT4VERSIONS="4.3.0-r2 4.3.0-r1 4.3.0 4.3.0_rc1 4.3.0_beta1 4.2.3-r1 4.2.3 4.2.2 4.2.1 4.2.0-r2 4.2.0-r1 4.2.0 4.1.4-r2 4.1.4-r1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.0.1 4.0.0" |
| 23 |
|
| 24 |
qt4_min_version() { |
| 25 |
echo "|| (" |
| 26 |
qt4_min_version_list "$@" |
| 27 |
echo ")" |
| 28 |
} |
| 29 |
|
| 30 |
qt4_min_version_list() { |
| 31 |
local MINVER="$1" |
| 32 |
local VERSIONS="" |
| 33 |
|
| 34 |
case "${MINVER}" in |
| 35 |
4|4.0|4.0.0) VERSIONS="=${QTPKG}4*";; |
| 36 |
4.1|4.1.0|4.2|4.2.0) |
| 37 |
for x in ${QT4MAJORVERSIONS}; do |
| 38 |
if $(version_is_at_least "${MINVER}" "${x}"); then |
| 39 |
VERSIONS="${VERSIONS} =${QTPKG}${x}*" |
| 40 |
fi |
| 41 |
done |
| 42 |
;; |
| 43 |
4*) |
| 44 |
for x in ${QT4VERSIONS}; do |
| 45 |
if $(version_is_at_least "${MINVER}" "${x}"); then |
| 46 |
VERSIONS="${VERSIONS} =${QTPKG}${x}" |
| 47 |
fi |
| 48 |
done |
| 49 |
;; |
| 50 |
*) VERSIONS="=${QTPKG}4*";; |
| 51 |
esac |
| 52 |
|
| 53 |
echo "${VERSIONS}" |
| 54 |
} |
| 55 |
|
| 56 |
qt4_pkg_setup() { |
| 57 |
for x in ${QT4_BUILT_WITH_USE_CHECK}; do |
| 58 |
if ! built_with_use =x11-libs/qt-4* $x; then |
| 59 |
die "This package requires Qt4 to be built with the '${x}' use flag." |
| 60 |
fi |
| 61 |
done |
| 62 |
} |
| 63 |
|
| 64 |
eqmake4() { |
| 65 |
local LOGFILE="${T}/qmake-$$.out" |
| 66 |
local projprofile="${1}" |
| 67 |
[ -z ${projprofile} ] && projprofile="${PN}.pro" |
| 68 |
shift 1 |
| 69 |
|
| 70 |
ebegin "Processing qmake ${projprofile}" |
| 71 |
|
| 72 |
# file exists? |
| 73 |
if [ ! -f ${projprofile} ]; then |
| 74 |
echo |
| 75 |
eerror "Project .pro file \"${projprofile}\" does not exists" |
| 76 |
eerror "qmake cannot handle non-existing .pro files" |
| 77 |
echo |
| 78 |
eerror "This shouldn't happen - please send a bug report to bugs.gentoo.org" |
| 79 |
echo |
| 80 |
die "Project file not found in ${PN} sources" |
| 81 |
fi |
| 82 |
|
| 83 |
echo >> ${LOGFILE} |
| 84 |
echo "****** qmake ${projprofile} ******" >> ${LOGFILE} |
| 85 |
echo >> ${LOGFILE} |
| 86 |
|
| 87 |
# as a workaround for broken qmake, put everything into file |
| 88 |
if has debug ${IUSE} && use debug; then |
| 89 |
echo -e "$CONFIG -= release\nCONFIG += no_fixpath debug" >> ${projprofile} |
| 90 |
else |
| 91 |
echo -e "$CONFIG -= debug\nCONFIG += no_fixpath release" >> ${projprofile} |
| 92 |
fi |
| 93 |
|
| 94 |
/usr/bin/qmake ${projprofile} \ |
| 95 |
QTDIR=/usr/$(get_libdir) \ |
| 96 |
QMAKE=/usr/bin/qmake \ |
| 97 |
QMAKE_CC=$(tc-getCC) \ |
| 98 |
QMAKE_CXX=$(tc-getCXX) \ |
| 99 |
QMAKE_LINK=$(tc-getCXX) \ |
| 100 |
QMAKE_CFLAGS_RELEASE="${CFLAGS}" \ |
| 101 |
QMAKE_CFLAGS_DEBUG="${CFLAGS}" \ |
| 102 |
QMAKE_CXXFLAGS_RELEASE="${CXXFLAGS}" \ |
| 103 |
QMAKE_CXXFLAGS_DEBUG="${CXXFLAGS}" \ |
| 104 |
QMAKE_LFLAGS_RELEASE="${LDFLAGS}" \ |
| 105 |
QMAKE_LFLAGS_DEBUG="${LDFLAGS}" \ |
| 106 |
QMAKE_RPATH= \ |
| 107 |
${@} >> ${LOGFILE} 2>&1 |
| 108 |
|
| 109 |
local result=$? |
| 110 |
eend ${result} |
| 111 |
|
| 112 |
# was qmake successful? |
| 113 |
if [ ${result} -ne 0 ]; then |
| 114 |
echo |
| 115 |
eerror "Running qmake on \"${projprofile}\" has failed" |
| 116 |
echo |
| 117 |
eerror "This shouldn't happen - please send a bug report to bugs.gentoo.org" |
| 118 |
echo |
| 119 |
die "qmake failed on ${projprofile}" |
| 120 |
fi |
| 121 |
|
| 122 |
return ${result} |
| 123 |
} |
| 124 |
|
| 125 |
EXPORT_FUNCTIONS pkg_setup |