summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2004-10-13 14:14:07 +0000
committerMike Frysinger <vapier@gentoo.org>2004-10-13 14:14:07 +0000
commitc40809223c365f4e591d6aa886f9dacdc5533e9d (patch)
tree41cfbf9847e7de4a1535f3e03a35aa065164c9e0 /eclass
parentno longer used; toolchain eclasses now (diff)
downloadgentoo-2-c40809223c365f4e591d6aa886f9dacdc5533e9d.tar.gz
gentoo-2-c40809223c365f4e591d6aa886f9dacdc5533e9d.tar.bz2
gentoo-2-c40809223c365f4e591d6aa886f9dacdc5533e9d.zip
generic gcc successor
Diffstat (limited to 'eclass')
-rw-r--r--eclass/toolchain-funcs.eclass79
1 files changed, 79 insertions, 0 deletions
diff --git a/eclass/toolchain-funcs.eclass b/eclass/toolchain-funcs.eclass
new file mode 100644
index 000000000000..dfaef5dd4ced
--- /dev/null
+++ b/eclass/toolchain-funcs.eclass
@@ -0,0 +1,79 @@
+# Copyright 1999-2004 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain-funcs.eclass,v 1.1 2004/10/13 14:14:07 vapier Exp $
+#
+# Author: Toolchain Ninjas <ninjas@gentoo.org>
+#
+# This eclass contains (or should) functions to get common info
+# about the toolchain (libc/compiler/binutils/etc...)
+
+inherit eutils
+
+ECLASS=toolfuncs
+INHERITED="$INHERITED $ECLASS"
+
+DESCRIPTION="Based on the ${ECLASS} eclass"
+
+tc-getPROG() {
+ local var="$1"
+ local prog="$2"
+ local search=""
+
+ if [ -n "${!var}" ] ; then
+ echo "${!var}"
+ return 0
+ fi
+
+ # how should we handle the host/target/build ?
+ if [ -n "${CHOST}" ] ; then
+ search="$(type -p "${CHOST}-${prog}")"
+ else
+ if [ -n "${CTARGET}" ] ; then
+ search="$(type -p "${CTARGET}-${prog}")"
+ fi
+ fi
+
+ if [ -z "${search}" ] ; then
+ prog="${search##*/}"
+ fi
+ export ${var}="${prog}"
+ echo "${!var}"
+}
+
+# Returns the name of the archiver
+tc-getAR() { tc-getPROG AR ar; }
+# Returns the name of the assembler
+tc-getAS() { tc-getPROG AS as; }
+# Returns the name of the C compiler
+tc-getCC() { tc-getPROG CC gcc; }
+# Returns the name of the C++ compiler
+tc-getCXX() { tc-getPROG CXX g++; }
+# Returns the name of the linker
+tc-getLD() { tc-getPROG LD ld; }
+# Returns the name of the symbol/object thingy
+tc-getNM() { tc-getPROG NM nm; }
+# Returns the name of the archiver indexer
+tc-getRANLIB() { tc-getPROG RANLIB ranlib; }
+
+
+
+# Returns the version as by `$CC -dumpversion`
+gcc-fullversion() {
+ echo "$($(tc-getCC) -dumpversion)"
+}
+# Returns the version, but only the <major>.<minor>
+gcc-version() {
+ echo "$(cc-fullversion | cut -f1,2 -d.)"
+}
+# Returns the Major version
+gcc-major-version() {
+ echo "$(cc-version | cut -f1 -d.)"
+}
+# Returns the Minor version
+gcc-minor-version() {
+ echo "$(cc-version | cut -f2 -d.)"
+}
+# Returns the Micro version
+gcc-micro-version() {
+ echo "$(cc-fullversion | cut -f3 -d.)"
+}