/[gentoo-x86]/eclass/toolchain-funcs.eclass
Gentoo

Diff of /eclass/toolchain-funcs.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.101 Revision 1.102
1# Copyright 1999-2007 Gentoo Foundation 1# Copyright 1999-2007 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/toolchain-funcs.eclass,v 1.101 2010/08/20 15:04:11 dberkholz Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/toolchain-funcs.eclass,v 1.102 2010/09/11 17:12:20 vapier Exp $
4 4
5# @ECLASS: toolchain-funcs.eclass 5# @ECLASS: toolchain-funcs.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# Toolchain Ninjas <toolchain@gentoo.org> 7# Toolchain Ninjas <toolchain@gentoo.org>
8# @BLURB: functions to query common info about the toolchain 8# @BLURB: functions to query common info about the toolchain
358 x86_64*) echo little;; 358 x86_64*) echo little;;
359 *) echo wtf;; 359 *) echo wtf;;
360 esac 360 esac
361} 361}
362 362
363# Internal func. The first argument is the version info to expand.
364# Query the preprocessor to improve compatibility across different
365# compilers rather than maintaining a --version flag matrix. #335943
366_gcc_fullversion() {
367 local ver="$1"; shift
368 set -- `$(tc-getCPP "$@") -E -P - <<<"__GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__"`
369 eval echo "$ver"
370}
371
363# @FUNCTION: gcc-fullversion 372# @FUNCTION: gcc-fullversion
364# @RETURN: compiler version (major.minor.micro: [3.4.6]) 373# @RETURN: compiler version (major.minor.micro: [3.4.6])
365gcc-fullversion() { 374gcc-fullversion() {
366 $(tc-getCC "$@") -dumpversion 375 _gcc_fullversion '$1.$2.$3' "$@"
367} 376}
368# @FUNCTION: gcc-version 377# @FUNCTION: gcc-version
369# @RETURN: compiler version (major.minor: [3.4].6) 378# @RETURN: compiler version (major.minor: [3.4].6)
370gcc-version() { 379gcc-version() {
371 gcc-fullversion "$@" | cut -f1,2 -d. 380 _gcc_fullversion '$1.$2' "$@"
372} 381}
373# @FUNCTION: gcc-major-version 382# @FUNCTION: gcc-major-version
374# @RETURN: major compiler version (major: [3].4.6) 383# @RETURN: major compiler version (major: [3].4.6)
375gcc-major-version() { 384gcc-major-version() {
376 gcc-version "$@" | cut -f1 -d. 385 _gcc_fullversion '$1' "$@"
377} 386}
378# @FUNCTION: gcc-minor-version 387# @FUNCTION: gcc-minor-version
379# @RETURN: minor compiler version (minor: 3.[4].6) 388# @RETURN: minor compiler version (minor: 3.[4].6)
380gcc-minor-version() { 389gcc-minor-version() {
381 gcc-version "$@" | cut -f2 -d. 390 _gcc_fullversion '$2' "$@"
382} 391}
383# @FUNCTION: gcc-micro-version 392# @FUNCTION: gcc-micro-version
384# @RETURN: micro compiler version (micro: 3.4.[6]) 393# @RETURN: micro compiler version (micro: 3.4.[6])
385gcc-micro-version() { 394gcc-micro-version() {
386 gcc-fullversion "$@" | cut -f3 -d. | cut -f1 -d- 395 _gcc_fullversion '$3' "$@"
387} 396}
388 397
389# Returns the installation directory - internal toolchain 398# Returns the installation directory - internal toolchain
390# function for use by _gcc-specs-exists (for flag-o-matic). 399# function for use by _gcc-specs-exists (for flag-o-matic).
391_gcc-install-dir() { 400_gcc-install-dir() {

Legend:
Removed from v.1.101  
changed lines
  Added in v.1.102

  ViewVC Help
Powered by ViewVC 1.1.20