diff options
author | Dan Armak <danarmak@gentoo.org> | 2002-03-27 18:33:23 +0000 |
---|---|---|
committer | Dan Armak <danarmak@gentoo.org> | 2002-03-27 18:33:23 +0000 |
commit | 4d8f9fdb33fb703e06814cfbe52b9ad9e9d1b062 (patch) | |
tree | 56be8c2e420f2555ed5165e0a5123e8ba4c04b45 /eclass | |
parent | *** empty log message *** (diff) | |
download | gentoo-2-4d8f9fdb33fb703e06814cfbe52b9ad9e9d1b062.tar.gz gentoo-2-4d8f9fdb33fb703e06814cfbe52b9ad9e9d1b062.tar.bz2 gentoo-2-4d8f9fdb33fb703e06814cfbe52b9ad9e9d1b062.zip |
*** empty log message ***
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/debug.eclass | 50 | ||||
-rw-r--r-- | eclass/functions.eclass | 165 |
2 files changed, 215 insertions, 0 deletions
diff --git a/eclass/debug.eclass b/eclass/debug.eclass new file mode 100644 index 000000000000..a4b9aed3ba2c --- /dev/null +++ b/eclass/debug.eclass @@ -0,0 +1,50 @@ +# Copyright 1999-2000 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License, v2 or later +# Author Dan Armak <danarmak@gentoo.org> +# $Header: /var/cvsroot/gentoo-x86/eclass/debug.eclass,v 1.12 2002/03/27 18:33:23 danarmak Exp $ +# This provides functions for verbose output for debugging + +# redirect output, unset to disable. use e.g. /dev/stdout to write into a file/device. +# use special setting "on" to echo the output - unlike above, doesn't violate sandbox. +# the test here is to enable people to export DEBUG_OUTPUT before running ebuild/emerge +# so that they won't have to edit debug.eclass anymore +#[ -n "$ECLASS_DEBUG_OUTPUT" ] || ECLASS_DEBUG_OUTPUT="on" + +# used internally for output +# redirects output wherever's needed +# in the future might use e* from /etc/init.d/functions.sh if i feel like it +debug-print() { + + while [ "$1" ]; do + + # extra user-configurable targets + if [ "$ECLASS_DEBUG_OUTPUT" == "on" ]; then + echo "debug: $1" + elif [ -n "$ECLASS_DEBUG_OUTPUT" ]; then + echo "debug: $1" >> $ECLASS_DEBUG_OUTPUT + fi + + # default target + [ -d "$BUILD_PREFIX/$P/temp" ] && echo $1 >> ${T}/eclass-debug.log + + shift + done + +} + +# std message functions + +debug-print-function() { + + str="$1: entering function" + shift + debug-print "$str, parameters: $*" + +} + +debug-print-section() { + + debug-print "now in section $*" + +} + diff --git a/eclass/functions.eclass b/eclass/functions.eclass new file mode 100644 index 000000000000..b1707ba3ce7e --- /dev/null +++ b/eclass/functions.eclass @@ -0,0 +1,165 @@ +# Copyright 1999-2000 Gentoo Technologies, Inc. +# Distributed under the terms of the GNU General Public License, v2 or later +# Author Dan Armak <danarmak@gentoo.org> +# $Header: /var/cvsroot/gentoo-x86/eclass/functions.eclass,v 1.7 2002/03/27 18:33:23 danarmak Exp $ +# This contains everything except things that modify ebuild variables and functions (e.g. $P, src_compile() etc.) +ECLASS=functions + +# --------------------- +# misc helper functions +# --------------------- + +# adds all parameters to DEPEND and RDEPEND +newdepend() { + + debug-print-function newdepend $* + debug-print "newdepend: DEPEND=$DEPEND RDEPEND=$RDEPEND" + + while [ -n "$1" ]; do + case $1 in + "/autotools") + DEPEND="${DEPEND} sys-devel/autoconf sys-devel/automake sys-devel/make" + ;; + "/c") + DEPEND="${DEPEND} sys-devel/gcc virtual/glibc sys-devel/ld.so" + RDEPEND="${RDEPEND} virtual/glibc sys-devel/ld.so" + ;; + *) + DEPEND="$DEPEND $1" + RDEPEND="$RDEPEND $1" + ;; + esac + shift + done + +} + +# --------------------------------------------------------------- +# kde/qt directory management etc. functions, was kde-dirs.ebuild +# --------------------------------------------------------------- + +need-kde() { + + debug-print-function $FUNCNAME $* + KDEVER="$1" + + #newdepend ">=kde-base/kdelibs-$KDEVER" + min-kde-ver $KDEVER + newdepend ">=kde-base/kdelibs-${selected_version}" + set-kdedir $KDEVER + + qtver-from-kdever $KDEVER + need-qt $selected_version + +} + +set-kdedir() { + + debug-print-function $FUNCNAME $* + + # default settings for older make.globals versions which don't include the default KDE?DIR settings + [ -z "$KDE2DIR" ] && export KDE2DIR="/usr/kde/2" + [ -z "$KDE3DIR" ] && export KDE3DIR="/usr/kde/3" + # not defined at all by default + [ -z "$KDE2LIBSDIR" ] && export KDE2LIBSDIR="$KDE2DIR" + [ -z "$KDE3LIBSDIR" ] && export KDE3LIBSDIR="$KDE3DIR" + + # select 1st element in dot-separated string + IFSBACKUP=$IFS + IFS="." + KDEMAJORVER="" + for x in $1; do + [ -z "$KDEMAJORVER" ] && KDEMAJORVER=$x + done + IFS=$IFSBACKUP + + case $KDEMAJORVER in + 2) export KDEDIR=${KDE2LIBSDIR};; + 3) export KDEDIR=${KDE3LIBSDIR};; + esac + + debug-print "$FUNCNAME: result: KDEDIR=$KDEDIR" + +} + +need-qt() { + + debug-print-function $FUNCNAME $* + QTVER="$1" + #newdepend ">=x11-libs/qt-$QTVER" + min-qt-ver $QTVER + newdepend "=x11-libs/qt-$selected_version*" + set-qtdir $QTVER + +} + +set-qtdir() { + + debug-print-function $FUNCNAME $* + + # select 1st element in dot-separated string + IFSBACKUP=$IFS + IFS="." + QTMAJORVER="" + for x in $1; do + [ -z "$QTMAJORVER" ] && QTMAJORVER=$x + done + IFS=$IFSBACKUP + + export QTDIR="/usr/qt/$QTMAJORVER" + +} + +# returns minimal qt version needed for specified kde version +qtver-from-kdever() { + + debug-print-function $FUNCNAME $* + + local ver + + case $1 in + 2*) ver=2.3.1;; + 3*) ver=3.0.1;; + *) echo "!!! error: $FUNCNAME() called with invalid parameter: \"$1\", please report bug" && exit 1;; + esac + + selected_version="$ver" + +} + +# compat +need-kdelibs() { + echo "WARNING: need-kdelibs() called, where need-kde() is correct. +If this happens at the unmerging of an old ebuild, disregard; otherwise report." + need-kde $* +} + +min-kde-ver() { + + debug-print-function $FUNCNAME $* + + case $1 in + 2*) selected_version="2.2.2-r2";; + 3.0_beta1) selected_version="3.0_beta1";; + 3.0_beta2) selected_version="3.0_beta2";; + 3.0_rc1) selected_version="3.0_rc1";; + 3.0_rc2) selected_version="3.0_rc2";; + 3.0_rc3) selected_version="3.0_rc3";; + 3*) selected_version="3.0";; + *) echo "!!! error: $FUNCNAME() called with invalid parameter: \"$1\", please report bug" && exit 1;; + esac + +} + +min-qt-ver() { + + debug-print-function $FUNCNAME $* + + case $1 in + 2*) selected_version="2.3";; + 3*) selected_version="3";; + *) echo "!!! error: $FUNCNAME() called with invalid parameter: \"$1\", please report bug" && exit 1;; + esac + +} + |