| 1 |
ingmar |
1.7 |
# Copyright 2007-2008 Gentoo Foundation
|
| 2 |
caleb |
1.1 |
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
ingmar |
1.8 |
# $Header: /var/cvsroot/gentoo-x86/eclass/qt4-build.eclass,v 1.7 2008/03/05 23:06:26 ingmar Exp $
|
| 4 |
caleb |
1.1 |
|
| 5 |
|
|
# @ECLASS: qt4-build.eclass
|
| 6 |
|
|
# @MAINTAINER:
|
| 7 |
|
|
# Caleb Tennis <caleb@gentoo.org>
|
| 8 |
ingmar |
1.8 |
# @BLURB: Eclass for Qt4 split ebuilds.
|
| 9 |
caleb |
1.1 |
# @DESCRIPTION:
|
| 10 |
|
|
# This eclass contains various functions that are used when building Qt4
|
| 11 |
|
|
|
| 12 |
|
|
inherit eutils multilib toolchain-funcs flag-o-matic
|
| 13 |
|
|
|
| 14 |
|
|
IUSE="${IUSE} debug"
|
| 15 |
|
|
|
| 16 |
ingmar |
1.7 |
case "${PV}" in
|
| 17 |
|
|
4.4.0_beta*)
|
| 18 |
|
|
SRCTYPE="${SRCTYPE:-opensource-src}"
|
| 19 |
|
|
MY_PV="${PV/_beta/-beta}"
|
| 20 |
|
|
;;
|
| 21 |
|
|
*)
|
| 22 |
|
|
SRCTYPE="${SRCTYPE:-opensource-src}"
|
| 23 |
|
|
MY_PV="${PV}"
|
| 24 |
|
|
;;
|
| 25 |
|
|
esac
|
| 26 |
|
|
S=${WORKDIR}/qt-x11-${SRCTYPE}-${MY_PV}
|
| 27 |
|
|
|
| 28 |
|
|
SRC_URI="ftp://ftp.trolltech.com/qt/source/qt-x11-${SRCTYPE}-${MY_PV}.tar.bz2"
|
| 29 |
|
|
|
| 30 |
caleb |
1.1 |
qt4-build_pkg_setup() {
|
| 31 |
ingmar |
1.7 |
# Check USE requirements
|
| 32 |
|
|
qt4-build_check_use
|
| 33 |
|
|
|
| 34 |
caleb |
1.1 |
# Set up installation directories
|
| 35 |
caleb |
1.5 |
QTBASEDIR=/usr/$(get_libdir)/qt4
|
| 36 |
|
|
QTPREFIXDIR=/usr
|
| 37 |
|
|
QTBINDIR=/usr/bin
|
| 38 |
|
|
QTLIBDIR=/usr/$(get_libdir)/qt4
|
| 39 |
|
|
QTPCDIR=/usr/$(get_libdir)/pkgconfig
|
| 40 |
|
|
QTDATADIR=/usr/share/qt4
|
| 41 |
caleb |
1.6 |
QTDOCDIR=/usr/share/doc/qt-${PV}
|
| 42 |
caleb |
1.5 |
QTHEADERDIR=/usr/include/qt4
|
| 43 |
|
|
QTPLUGINDIR=${QTLIBDIR}/plugins
|
| 44 |
|
|
QTSYSCONFDIR=/etc/qt4
|
| 45 |
|
|
QTTRANSDIR=${QTDATADIR}/translations
|
| 46 |
|
|
QTEXAMPLESDIR=${QTDATADIR}/examples
|
| 47 |
|
|
QTDEMOSDIR=${QTDATADIR}/demos
|
| 48 |
caleb |
1.1 |
|
| 49 |
caleb |
1.5 |
PLATFORM=$(qt_mkspecs_dir)
|
| 50 |
caleb |
1.1 |
|
| 51 |
|
|
PATH="${S}/bin:${PATH}"
|
| 52 |
|
|
LD_LIBRARY_PATH="${S}/lib:${LD_LIBRARY_PATH}"
|
| 53 |
|
|
}
|
| 54 |
|
|
|
| 55 |
|
|
qt4-build_src_unpack() {
|
| 56 |
ingmar |
1.7 |
# TODO: partial unpacks, cfr split KDE ebuilds.
|
| 57 |
caleb |
1.1 |
unpack ${A}
|
| 58 |
|
|
cd "${S}"
|
| 59 |
|
|
|
| 60 |
ingmar |
1.7 |
if [[ ${PN} != qt-core ]]; then
|
| 61 |
|
|
skip_qmake_build_patch
|
| 62 |
|
|
skip_project_generation_patch
|
| 63 |
|
|
symlink_binaries_to_buildtree
|
| 64 |
|
|
fi
|
| 65 |
|
|
|
| 66 |
|
|
sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \
|
| 67 |
|
|
-e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \
|
| 68 |
|
|
-e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
|
| 69 |
|
|
-e "s:X11R6/::" \
|
| 70 |
|
|
-i "${S}"/mkspecs/$(qt_mkspecs_dir)/qmake.conf || die "sed ${S}/mkspecs/$(qt_mkspecs_dir)/qmake.conf failed"
|
| 71 |
|
|
|
| 72 |
|
|
sed -e "s:QMAKE_CFLAGS_RELEASE.*=.*:QMAKE_CFLAGS_RELEASE=${CFLAGS}:" \
|
| 73 |
|
|
-e "s:QMAKE_CXXFLAGS_RELEASE.*=.*:QMAKE_CXXFLAGS_RELEASE=${CXXFLAGS}:" \
|
| 74 |
|
|
-e "s:QMAKE_LFLAGS_RELEASE.*=.*:QMAKE_LFLAGS_RELEASE=${LDFLAGS}:" \
|
| 75 |
|
|
-i "${S}"/mkspecs/common/g++.conf || die "sed ${S}/mkspecs/common/g++.conf failed"
|
| 76 |
|
|
}
|
| 77 |
|
|
|
| 78 |
|
|
qt4-build_src_compile() {
|
| 79 |
caleb |
1.1 |
# Don't let the user go too overboard with flags. If you really want to, uncomment
|
| 80 |
|
|
# out the line below and give 'er a whirl.
|
| 81 |
|
|
strip-flags
|
| 82 |
|
|
replace-flags -O3 -O2
|
| 83 |
|
|
|
| 84 |
ingmar |
1.7 |
if [[ $(gcc-fullversion) == "3.4.6" && gcc-specs-ssp ]] ; then
|
| 85 |
caleb |
1.1 |
ewarn "Appending -fno-stack-protector to CFLAGS/CXXFLAGS"
|
| 86 |
|
|
append-flags -fno-stack-protector
|
| 87 |
|
|
fi
|
| 88 |
ingmar |
1.7 |
|
| 89 |
|
|
myconf="$(standard_configure_options) ${myconf}"
|
| 90 |
|
|
|
| 91 |
|
|
echo ./configure ${myconf}
|
| 92 |
|
|
./configure ${myconf} || die "./configure failed"
|
| 93 |
|
|
|
| 94 |
|
|
build_target_directories
|
| 95 |
caleb |
1.1 |
}
|
| 96 |
|
|
|
| 97 |
caleb |
1.4 |
qt4-build_src_install() {
|
| 98 |
|
|
install_directories "${QT4_TARGET_DIRECTORIES}"
|
| 99 |
ingmar |
1.7 |
install_qconfigs
|
| 100 |
caleb |
1.4 |
fix_library_files
|
| 101 |
|
|
}
|
| 102 |
|
|
|
| 103 |
caleb |
1.1 |
standard_configure_options() {
|
| 104 |
|
|
local myconf=""
|
| 105 |
|
|
|
| 106 |
ingmar |
1.7 |
[[ $(get_libdir) != "lib" ]] && myconf="${myconf} -L/usr/$(get_libdir)"
|
| 107 |
caleb |
1.1 |
|
| 108 |
|
|
# Disable visibility explicitly if gcc version isn't 4
|
| 109 |
ingmar |
1.7 |
if [[ "$(gcc-major-version)" -lt "4" ]]; then
|
| 110 |
caleb |
1.1 |
myconf="${myconf} -no-reduce-exports"
|
| 111 |
|
|
fi
|
| 112 |
|
|
|
| 113 |
ingmar |
1.7 |
if use debug; then
|
| 114 |
|
|
myconf="${myconf} -debug -no-separate-debug-info"
|
| 115 |
|
|
else
|
| 116 |
|
|
myconf="${myconf} -release -no-separate-debug-info"
|
| 117 |
|
|
fi
|
| 118 |
caleb |
1.1 |
|
| 119 |
ingmar |
1.7 |
myconf="${myconf} -stl -verbose -largefile -confirm-license -no-rpath
|
| 120 |
|
|
-prefix ${QTPREFIXDIR} -bindir ${QTBINDIR} -libdir ${QTLIBDIR}
|
| 121 |
|
|
-datadir ${QTDATADIR} -docdir ${QTDOCDIR} -headerdir ${QTHEADERDIR}
|
| 122 |
|
|
-plugindir ${QTPLUGINDIR} -sysconfdir ${QTSYSCONFDIR}
|
| 123 |
|
|
-translationdir ${QTTRANSDIR} -examplesdir ${QTEXAMPLESDIR}
|
| 124 |
|
|
-demosdir ${QTDEMOSDIR} -silent -fast -reduce-relocations
|
| 125 |
|
|
-nomake examples -nomake demos"
|
| 126 |
caleb |
1.1 |
|
| 127 |
|
|
echo "${myconf}"
|
| 128 |
|
|
}
|
| 129 |
|
|
|
| 130 |
caleb |
1.4 |
build_target_directories() {
|
| 131 |
|
|
build_directories "${QT4_TARGET_DIRECTORIES}"
|
| 132 |
|
|
}
|
| 133 |
|
|
|
| 134 |
caleb |
1.1 |
build_directories() {
|
| 135 |
|
|
local dirs="$@"
|
| 136 |
|
|
for x in ${dirs}; do
|
| 137 |
|
|
cd "${S}"/${x}
|
| 138 |
ingmar |
1.7 |
"${S}"/bin/qmake "LIBS+=-L${QTLIBDIR}" "CONFIG+=nostrip" || die "qmake failed"
|
| 139 |
|
|
emake || die "emake failed"
|
| 140 |
caleb |
1.1 |
done
|
| 141 |
|
|
}
|
| 142 |
|
|
|
| 143 |
|
|
install_directories() {
|
| 144 |
|
|
local dirs="$@"
|
| 145 |
|
|
for x in ${dirs}; do
|
| 146 |
ingmar |
1.7 |
pushd "${S}"/${x} >/dev/null || die "Can't pushd ${S}/${x}"
|
| 147 |
|
|
emake INSTALL_ROOT="${D}" install || die "emake install failed"
|
| 148 |
|
|
popd >/dev/null || die "Can't popd from ${S}/${x}"
|
| 149 |
caleb |
1.1 |
done
|
| 150 |
|
|
}
|
| 151 |
|
|
|
| 152 |
ingmar |
1.7 |
# @ECLASS-VARIABLE: QCONFIG_ADD
|
| 153 |
|
|
# @DESCRIPTION:
|
| 154 |
|
|
# List options that need to be added to QT_CONFIG in qconfig.pri
|
| 155 |
|
|
QCONFIG_ADD="${QCONFIG_ADD:-}"
|
| 156 |
|
|
|
| 157 |
|
|
# @ECLASS-VARIABLE: QCONFIG_REMOVE
|
| 158 |
|
|
# @DESCRIPTION:
|
| 159 |
|
|
# List options that need to be removed from QT_CONFIG in qconfig.pri
|
| 160 |
|
|
QCONFIG_REMOVE="${QCONFIG_REMOVE:-}"
|
| 161 |
|
|
|
| 162 |
|
|
# @ECLASS-VARIABLE: QCONFIG_DEFINE
|
| 163 |
|
|
# @DESCRIPTION:
|
| 164 |
|
|
# List variables that should be defined at the top of QtCore/qconfig.h
|
| 165 |
|
|
QCONFIG_DEFINE="${QCONFIG_DEFINE:-}"
|
| 166 |
|
|
|
| 167 |
|
|
install_qconfigs() {
|
| 168 |
|
|
if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} || -n ${QCONFIG_DEFINE} ]]; then
|
| 169 |
|
|
local x
|
| 170 |
|
|
for x in QCONFIG_ADD QCONFIG_REMOVE; do
|
| 171 |
|
|
[[ -n ${!x} ]] && echo ${x}=${!x} >> "${T}"/${PN}-qconfig.pri
|
| 172 |
|
|
done
|
| 173 |
|
|
insinto ${QTDATADIR}/mkspecs/gentoo
|
| 174 |
|
|
doins "${T}"/${PN}-qconfig.pri || die "installing ${PN}-qconfig.pri failed"
|
| 175 |
|
|
|
| 176 |
|
|
for x in ${QCONFIG_DEFINE}; do
|
| 177 |
|
|
echo "#define ${x}" >> "${T}"/gentoo-${PN}-qconfig.h
|
| 178 |
|
|
done
|
| 179 |
|
|
insinto ${QTHEADERDIR}/Gentoo
|
| 180 |
|
|
doins "${T}"/gentoo-${PN}-qconfig.h || die "installing ${PN}-qconfig.h failed"
|
| 181 |
|
|
fi
|
| 182 |
|
|
}
|
| 183 |
|
|
|
| 184 |
|
|
# Stubs for functions used by the Qt 4.4.0_technical_preview_1.
|
| 185 |
|
|
qconfig_add_option() { : ; }
|
| 186 |
|
|
qconfig_remove_option() { : ; }
|
| 187 |
|
|
|
| 188 |
|
|
generate_qconfigs() {
|
| 189 |
|
|
if [[ -n ${QCONFIG_ADD} || -n ${QCONFIG_REMOVE} || -n ${QCONFIG_DEFINE} || ${CATEGORY}/${PN} == x11-libs/qt-core ]]; then
|
| 190 |
|
|
local x qconfig_add qconfig_remove qconfig_new
|
| 191 |
|
|
for x in "${ROOT}${QTDATADIR}"/mkspecs/gentoo/*-qconfig.pri; do
|
| 192 |
|
|
[[ -f ${x} ]] || continue
|
| 193 |
|
|
qconfig_add="${qconfig_add} $(sed -n 's/^QCONFIG_ADD=//p' "${x}")"
|
| 194 |
|
|
qconfig_remove="${qconfig_remove} $(sed -n 's/^QCONFIG_REMOVE=//p' "${x}")"
|
| 195 |
|
|
done
|
| 196 |
|
|
|
| 197 |
|
|
# these error checks do not use die because dying in pkg_post{inst,rm}
|
| 198 |
|
|
# just makes things worse.
|
| 199 |
|
|
if [[ -e "${ROOT}${QTDATADIR}"/mkspecs/gentoo/qconfig.pri ]]; then
|
| 200 |
|
|
# start with the qconfig.pri that qt-core installed
|
| 201 |
|
|
if ! cp "${ROOT}${QTDATADIR}"/mkspecs/gentoo/qconfig.pri \
|
| 202 |
|
|
"${ROOT}${QTDATADIR}"/mkspecs/qconfig.pri; then
|
| 203 |
|
|
eerror "cp qconfig failed."
|
| 204 |
|
|
return 1
|
| 205 |
|
|
fi
|
| 206 |
|
|
|
| 207 |
|
|
# generate list of QT_CONFIG entries from the existing list
|
| 208 |
|
|
# including qconfig_add and excluding qconfig_remove
|
| 209 |
|
|
for x in $(sed -n 's/^QT_CONFIG +=//p' \
|
| 210 |
|
|
"${ROOT}${QTDATADIR}"/mkspecs/qconfig.pri) ${qconfig_add}; do
|
| 211 |
|
|
hasq ${x} ${qconfig_remove} || qconfig_new="${qconfig_new} ${x}"
|
| 212 |
|
|
done
|
| 213 |
|
|
|
| 214 |
|
|
# replace the existing QT_CONFIG list with qconfig_new
|
| 215 |
|
|
if ! sed -i -e "s/QT_CONFIG +=.*/QT_CONFIG += ${qconfig_new}/" \
|
| 216 |
|
|
"${ROOT}${QTDATADIR}"/mkspecs/qconfig.pri; then
|
| 217 |
|
|
eerror "Sed for QT_CONFIG failed"
|
| 218 |
|
|
return 1
|
| 219 |
|
|
fi
|
| 220 |
|
|
|
| 221 |
|
|
# create Gentoo/qconfig.h
|
| 222 |
|
|
if [[ ! -e ${ROOT}${QTHEADERDIR}/Gentoo ]]; then
|
| 223 |
|
|
if ! mkdir -p "${ROOT}${QTHEADERDIR}"/Gentoo; then
|
| 224 |
|
|
eerror "mkdir ${QTHEADERDIR}/Gentoo failed"
|
| 225 |
|
|
return 1
|
| 226 |
|
|
fi
|
| 227 |
|
|
fi
|
| 228 |
|
|
: > "${ROOT}${QTHEADERDIR}"/Gentoo/gentoo-qconfig.h
|
| 229 |
|
|
for x in "${ROOT}${QTHEADERDIR}"/Gentoo/gentoo-*-qconfig.h; do
|
| 230 |
|
|
[[ -f ${x} ]] || continue
|
| 231 |
|
|
cat "${x}" >> "${ROOT}${QTHEADERDIR}"/Gentoo/gentoo-qconfig.h
|
| 232 |
|
|
done
|
| 233 |
|
|
else
|
| 234 |
|
|
rm -f "${ROOT}${QTDATADIR}"/mkspecs/qconfig.pri
|
| 235 |
|
|
rm -f "${ROOT}${QTHEADERDIR}"/Gentoo/gentoo-qconfig.h
|
| 236 |
|
|
rmdir "${ROOT}${QTDATADIR}"/mkspecs \
|
| 237 |
|
|
"${ROOT}${QTDATADIR}" \
|
| 238 |
|
|
"${ROOT}${QTHEADERDIR}"/Gentoo \
|
| 239 |
|
|
"${ROOT}${QTHEADERDIR}" 2>/dev/null
|
| 240 |
|
|
fi
|
| 241 |
|
|
fi
|
| 242 |
|
|
}
|
| 243 |
|
|
|
| 244 |
|
|
qt4-build_pkg_postrm() {
|
| 245 |
|
|
generate_qconfigs
|
| 246 |
caleb |
1.1 |
}
|
| 247 |
|
|
|
| 248 |
ingmar |
1.7 |
qt4-build_pkg_postinst() {
|
| 249 |
|
|
generate_qconfigs
|
| 250 |
caleb |
1.1 |
}
|
| 251 |
|
|
|
| 252 |
|
|
skip_qmake_build_patch() {
|
| 253 |
ingmar |
1.7 |
# Don't need to build qmake, as it's already installed from qt-core
|
| 254 |
|
|
sed -i -e "s:if true:if false:g" "${S}"/configure || die "Sed failed"
|
| 255 |
caleb |
1.1 |
}
|
| 256 |
|
|
|
| 257 |
|
|
skip_project_generation_patch() {
|
| 258 |
|
|
# Exit the script early by throwing in an exit before all of the .pro files are scanned
|
| 259 |
ingmar |
1.7 |
sed -e "s:echo \"Finding:exit 0\n\necho \"Finding:g" \
|
| 260 |
|
|
-i "${S}"/configure || die "Sed failed"
|
| 261 |
caleb |
1.1 |
}
|
| 262 |
|
|
|
| 263 |
ingmar |
1.7 |
symlink_binaries_to_buildtree() {
|
| 264 |
|
|
for bin in qmake moc uic rcc; do
|
| 265 |
|
|
ln -s ${QTBINDIR}/${bin} "${S}"/bin/ || die "Symlinking ${bin} to ${S}/bin failed."
|
| 266 |
|
|
done
|
| 267 |
caleb |
1.1 |
}
|
| 268 |
|
|
|
| 269 |
|
|
fix_library_files() {
|
| 270 |
ingmar |
1.7 |
for libfile in "${D}"/${QTLIBDIR}/{*.la,*.prl,pkgconfig/*.pc}; do
|
| 271 |
|
|
if [[ -e ${libfile} ]]; then
|
| 272 |
|
|
sed -i -e "s:${S}/lib:${QTLIBDIR}:g" ${libfile} || die "Sed on ${libfile} failed."
|
| 273 |
|
|
fi
|
| 274 |
|
|
done
|
| 275 |
caleb |
1.1 |
|
| 276 |
|
|
# pkgconfig files refer to WORKDIR/bin as the moc and uic locations. Fix:
|
| 277 |
ingmar |
1.7 |
for libfile in "${D}"/${QTLIBDIR}/pkgconfig/*.pc; do
|
| 278 |
|
|
if [[ -e ${libfile} ]]; then
|
| 279 |
|
|
sed -i -e "s:${S}/bin:${QTBINDIR}:g" ${libfile} || die "Sed failed"
|
| 280 |
caleb |
1.1 |
|
| 281 |
|
|
# Move .pc files into the pkgconfig directory
|
| 282 |
ingmar |
1.7 |
|
| 283 |
|
|
dodir ${QTPCDIR}
|
| 284 |
|
|
mv ${libfile} "${D}"/${QTPCDIR}/ \
|
| 285 |
|
|
|| die "Moving ${libfile} to ${D}/${QTPCDIR}/ failed."
|
| 286 |
|
|
fi
|
| 287 |
|
|
done
|
| 288 |
|
|
|
| 289 |
|
|
# Don't install an empty directory
|
| 290 |
|
|
rmdir "${D}"/${QTLIBDIR}/pkgconfig
|
| 291 |
caleb |
1.1 |
}
|
| 292 |
|
|
|
| 293 |
|
|
qt_use() {
|
| 294 |
ingmar |
1.7 |
local flag="${1}"
|
| 295 |
|
|
local feature="${1}"
|
| 296 |
caleb |
1.5 |
local enableval=
|
| 297 |
caleb |
1.1 |
|
| 298 |
ingmar |
1.7 |
[[ -n ${2} ]] && feature=${2}
|
| 299 |
|
|
[[ -n ${3} ]] && enableval="-${3}"
|
| 300 |
|
|
|
| 301 |
|
|
if use ${flag}; then
|
| 302 |
|
|
echo "${enableval}-${feature}"
|
| 303 |
|
|
else
|
| 304 |
|
|
echo "-no-${feature}"
|
| 305 |
|
|
fi
|
| 306 |
|
|
}
|
| 307 |
|
|
|
| 308 |
|
|
# @ECLASS-VARIABLE: QT4_BUILT_WITH_USE_CHECK
|
| 309 |
|
|
# @DESCRIPTION:
|
| 310 |
|
|
# The contents of $QT4_BUILT_WITH_USE_CHECK gets fed to built_with_use
|
| 311 |
|
|
# (eutils.eclass), line per line.
|
| 312 |
|
|
#
|
| 313 |
|
|
# Example:
|
| 314 |
|
|
# @CODE
|
| 315 |
|
|
# pkg_setup() {
|
| 316 |
|
|
# use qt3support && QT4_BUILT_WITH_USE_CHECK="${QT4_BUILT_WITH_USE_CHECK}
|
| 317 |
|
|
# ~x11-libs/qt-gui-${PV} qt3support"
|
| 318 |
|
|
# qt4-build_check_use
|
| 319 |
|
|
# }
|
| 320 |
|
|
# @CODE
|
| 321 |
|
|
|
| 322 |
|
|
# Run built_with_use on each flag and print appropriate error messages if any
|
| 323 |
|
|
# flags are missing
|
| 324 |
|
|
_qt_built_with_use() {
|
| 325 |
|
|
local missing opt pkg flag flags
|
| 326 |
caleb |
1.1 |
|
| 327 |
ingmar |
1.7 |
if [[ ${1} = "--missing" ]]; then
|
| 328 |
|
|
missing="${1} ${2}" && shift 2
|
| 329 |
|
|
fi
|
| 330 |
|
|
if [[ ${1:0:1} = "-" ]]; then
|
| 331 |
|
|
opt=${1} && shift
|
| 332 |
|
|
fi
|
| 333 |
|
|
|
| 334 |
|
|
pkg=${1} && shift
|
| 335 |
|
|
|
| 336 |
|
|
for flag in "${@}"; do
|
| 337 |
|
|
flags="${flags} ${flag}"
|
| 338 |
|
|
if ! built_with_use ${missing} ${opt} ${pkg} ${flag}; then
|
| 339 |
|
|
flags="${flags}*"
|
| 340 |
|
|
else
|
| 341 |
|
|
[[ ${opt} = "-o" ]] && return 0
|
| 342 |
|
|
fi
|
| 343 |
|
|
done
|
| 344 |
|
|
if [[ "${flags# }" = "${@}" ]]; then
|
| 345 |
|
|
return 0
|
| 346 |
|
|
fi
|
| 347 |
|
|
if [[ ${opt} = "-o" ]]; then
|
| 348 |
|
|
eerror "This package requires '${pkg}' to be built with any of the following USE flags: '$*'."
|
| 349 |
|
|
else
|
| 350 |
|
|
eerror "This package requires '${pkg}' to be built with the following USE flags: '${flags# }'."
|
| 351 |
|
|
fi
|
| 352 |
|
|
return 1
|
| 353 |
|
|
}
|
| 354 |
|
|
|
| 355 |
|
|
# @FUNCTION: qt4-build_check_use
|
| 356 |
|
|
# @DESCRIPTION:
|
| 357 |
|
|
# Check if the listed packages in $QT4_BUILT_WITH_USE_CHECK are built with the
|
| 358 |
|
|
# USE flags listed.
|
| 359 |
|
|
#
|
| 360 |
|
|
# If any of the required USE flags are missing, an eerror will be printed for
|
| 361 |
|
|
# each package with missing USE flags.
|
| 362 |
|
|
qt4-build_check_use() {
|
| 363 |
|
|
local line missing
|
| 364 |
|
|
while read line; do
|
| 365 |
|
|
[[ -z ${line} ]] && continue
|
| 366 |
|
|
if ! _qt_built_with_use ${line}; then
|
| 367 |
|
|
missing=true
|
| 368 |
|
|
fi
|
| 369 |
|
|
done <<< "${QT4_BUILT_WITH_USE_CHECK}"
|
| 370 |
|
|
if [[ -n ${missing} ]]; then
|
| 371 |
|
|
echo
|
| 372 |
|
|
eerror "Flags marked with an * are missing."
|
| 373 |
|
|
die "Missing USE flags found"
|
| 374 |
|
|
fi
|
| 375 |
caleb |
1.1 |
}
|
| 376 |
|
|
|
| 377 |
|
|
qt_mkspecs_dir() {
|
| 378 |
caleb |
1.5 |
# Allows us to define which mkspecs dir we want to use.
|
| 379 |
|
|
local spec
|
| 380 |
caleb |
1.1 |
|
| 381 |
caleb |
1.5 |
case ${CHOST} in
|
| 382 |
|
|
*-freebsd*|*-dragonfly*)
|
| 383 |
|
|
spec="freebsd" ;;
|
| 384 |
|
|
*-openbsd*)
|
| 385 |
|
|
spec="openbsd" ;;
|
| 386 |
|
|
*-netbsd*)
|
| 387 |
|
|
spec="netbsd" ;;
|
| 388 |
ingmar |
1.7 |
*-darwin*)
|
| 389 |
caleb |
1.5 |
spec="darwin" ;;
|
| 390 |
|
|
*-linux-*|*-linux)
|
| 391 |
|
|
spec="linux" ;;
|
| 392 |
|
|
*)
|
| 393 |
ingmar |
1.7 |
die "Unknown CHOST, no platform choosen."
|
| 394 |
caleb |
1.5 |
esac
|
| 395 |
|
|
|
| 396 |
|
|
CXX=$(tc-getCXX)
|
| 397 |
|
|
if [[ ${CXX/g++/} != ${CXX} ]]; then
|
| 398 |
|
|
spec="${spec}-g++"
|
| 399 |
|
|
elif [[ ${CXX/icpc/} != ${CXX} ]]; then
|
| 400 |
|
|
spec="${spec}-icc"
|
| 401 |
|
|
else
|
| 402 |
|
|
die "Unknown compiler ${CXX}."
|
| 403 |
|
|
fi
|
| 404 |
caleb |
1.1 |
|
| 405 |
caleb |
1.5 |
echo "${spec}"
|
| 406 |
caleb |
1.1 |
}
|
| 407 |
|
|
|
| 408 |
ingmar |
1.7 |
EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_postrm pkg_postinst
|