Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 143684 Details for
Bug 210394
Patch for flag-o-matic.eclass to make it ready for eclass-manpages
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
flag-o-matic.eclass.patch
flag-o-matic.eclass.patch (text/plain), 11.93 KB, created by
mren
on 2008-02-16 19:17:25 UTC
(
hide
)
Description:
flag-o-matic.eclass.patch
Filename:
MIME Type:
Creator:
mren
Created:
2008-02-16 19:17:25 UTC
Size:
11.93 KB
patch
obsolete
>--- flag-o-matic.eclass.orig 2008-02-16 15:05:29.000000000 +0100 >+++ flag-o-matic.eclass 2008-02-16 19:44:19.000000000 +0100 >@@ -1,67 +1,20 @@ >-# Copyright 1999-2007 Gentoo Foundation >+# Copyright 1999-2008 Gentoo Foundation > # Distributed under the terms of the GNU General Public License v2 >-# $Header: /var/cvsroot/gentoo-x86/eclass/flag-o-matic.eclass,v 1.120 2007/07/22 08:21:09 dberkholz Exp $ >-# >-# Maintainer: toolchain@gentoo.org >+# $Header: $ > >-# need access to emktemp() >-inherit eutils toolchain-funcs multilib >+# @ECLASS: flag-o-matic.eclass >+# @MAINTAINER: >+# toolchain@gentoo.org >+# @BLURB: An eclass to manipulate and query flags >+# @DESCRIPTION: >+# This eclass implements functions to manipulate an query flags (CFLAGS, >+# CXXFLAGS, LDFLAGS) >+# >+# Need access to emktemp() >+# >+# It inherits eutils toolchain-funcs, and mutlilib > >-# >-#### filter-flags <flags> #### >-# Remove particular flags from C[XX]FLAGS >-# Matches only complete flags >-# >-#### append-flags <flags> #### >-# Add extra flags to your current C[XX]FLAGS >-# >-#### replace-flags <orig.flag> <new.flag> ### >-# Replace a flag by another one >-# >-#### replace-cpu-flags <old.cpus> <new.cpu> ### >-# Replace march/mcpu flags that specify <old.cpus> >-# with flags that specify <new.cpu> >-# >-#### is-flag[q] <flag> #### >-# Returns "true" if flag is set in C[XX]FLAGS >-# Matches only complete a flag >-# q version sets return code but doesn't echo >-# >-#### is-ldflag[q] <flag> #### >-# Returns "true" if flag is set in LDFLAGS >-# Matches only complete a flag >-# q version sets return code but doesn't echo >-# >-#### strip-flags #### >-# Strip C[XX]FLAGS of everything except known >-# good options. >-# >-#### strip-unsupported-flags #### >-# Strip C[XX]FLAGS of any flags not supported by >-# installed version of gcc >-# >-#### get-flag <flag> #### >-# Find and echo the value for a particular flag >-# >-#### replace-sparc64-flags #### >-# Sets mcpu to v8 and uses the original value >-# as mtune if none specified. >-# >-#### filter-mfpmath <math types> #### >-# Remove specified math types from the fpmath specification >-# If the user has -mfpmath=sse,386, running `filter-mfpmath sse` >-# will leave the user with -mfpmath=386 >-# >-#### append-ldflags #### >-# Add extra flags to your current LDFLAGS >-# >-#### filter-ldflags <flags> #### >-# Remove particular flags from LDFLAGS >-# Matches only complete flags >-# >-#### bindnow-flags #### >-# Returns the flags to enable "now" binding in the current selected linker. >-# >+inherit eutils toolchain-funcs multilib > ################ DEPRECATED functions ################ > # The following are still present to avoid breaking existing > # code more than necessary; however they are deprecated. Please >@@ -69,27 +22,12 @@ > # need to know which hardened techs are active in the compiler. > # See bug #100974 > # >-#### has_hardened #### >-# Returns true if the compiler has 'Hardened' in its version string, >-# (note; switched-spec vanilla compilers satisfy this condition) or >-# the specs file name contains 'hardened'. >-# >-#### has_pie #### >-# Returns true if the compiler by default or with current CFLAGS >-# builds position-independent code. >-# >-#### has_pic #### >-# Returns true if the compiler by default or with current CFLAGS >-# builds position-independent code. >-# >-#### has_ssp_all #### >-# Returns true if the compiler by default or with current CFLAGS >-# generates stack smash protections for all functions >-# >-#### has_ssp #### >-# Returns true if the compiler by default or with current CFLAGS >-# generates stack smash protections for most vulnerable functions >-# >+# has_hardened >+# has_pie >+# has_pic >+# has_ssp_all >+# has_ssp >+ > > # C[XX]FLAGS that we allow in strip-flags > # Note: shell globs and character lists are allowed >@@ -166,6 +104,10 @@ > eval export ${VAR}=\${new\[*]} > } > >+# @FUNCTION: filter-flags >+# @USAGE: < flags > >+# @DESCRIPTION: >+# Remove particular flags from C[XX]FLAGS. Matches only complete flags > filter-flags() { > _filter-hardened "$@" > _filter-var CFLAGS "$@" >@@ -174,22 +116,36 @@ > return 0 > } > >+# @FUNCTION: filter-lfs-flags >+# @DESCRIPTION: >+# Remove flags that enable Large File Support. > filter-lfs-flags() { > [[ -n $@ ]] && die "filter-lfs-flags takes no arguments" > filter-flags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE > } > >+# @FUNCTION: append-cppflags >+# @USAGE: < flags > >+# @DESCRIPTION: >+# Add extra flags to the current CPPFLAGS. > append-cppflags() { > [[ -z $* ]] && return 0 > export CPPFLAGS="${CPPFLAGS} $*" > return 0 > } > >+# @FUNCTION: append-lfs-flags >+# @DESCRIPTION: >+# Add flags that enable Large File Support. > append-lfs-flags() { > [[ -n $@ ]] && die "append-lfs-flags takes no arguments" > append-cppflags -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE > } > >+# @FUNCTION: append-flags >+# @USAGE: < flags > >+# @DESCRIPTION: >+# Add extra flags to your current C[XX]FLAGS > append-flags() { > [[ -z $* ]] && return 0 > export CFLAGS="${CFLAGS} $*" >@@ -197,6 +153,10 @@ > return 0 > } > >+# @FUNCTION: replace-flags >+# @USAGE: < old > < new > >+# @DESCRIPTION: >+# Replace a flag by another one > replace-flags() { > [[ $# != 2 ]] \ > && echo && eerror "Usage: replace-flags <old flag> <new flag>" \ >@@ -221,6 +181,11 @@ > return 0 > } > >+# @FUNCTION: replace-cpu-flags >+# @USAGE: < old > < new > >+# @DESCRIPTION: >+# Replace march/mcpu flags that specify <old> >+# with flags that specify <new> > replace-cpu-flags() { > local newcpu="$#" ; newcpu="${!newcpu}" > while [ $# -gt 1 ] ; do >@@ -242,24 +207,49 @@ > return 1 > } > >+# @FUNCTION: is-flagq >+# @USAGE: < flag > >+# @DESCRIPTION: >+# Sets return code 0 if flag is set in C[XX]FLAGS, else return code 1. >+# Matches only complete a flag. > is-flagq() { > [[ -n $2 ]] && die "Usage: is-flag <flag>" > _is_flagq CFLAGS $1 || _is_flagq CXXFLAGS $1 > } > >+# @FUNCTION: is-flag >+# @USAGE: < flag > >+# @DESCRIPTION: >+# Returns "true" if flag is set in C[XX]FLAGS. >+# Matches only complete a flag > is-flag() { > is-flagq "$@" && echo true > } > >+# @FUNCTION: is-ldflagq >+# @USAGE: < flag > >+# @DESCRIPTION: >+# Sets return code 0 if flag is set in LDFLAGS, else return code 1 > is-ldflagq() { > [[ -n $2 ]] && die "Usage: is-ldflag <flag>" > _is_flagq LDFLAGS $1 > } > >+# @FUNCTION: is-ldflag >+# @USAGE: < flag > >+# @DESCRIPTION: >+# Returns "true" if flag is set in LDFLAGS. >+# Matches only complete a flag > is-ldflag() { > is-ldflagq "$@" && echo true > } > >+# @FUNCTION: filter-mfpmath >+# @USAGE: < math types > >+# @DESCRIPTION: >+# Remove specified math types from the fpmath specification. >+# If the user has -mfpmath=sse,386, running `filter-mfpmath sse` >+# will leave the user with -mfpmath=386 > filter-mfpmath() { > local orig_mfpmath new_math prune_math > >@@ -288,6 +278,9 @@ > return 0 > } > >+# @FUNCTION: strip-flags >+# @DESCRIPTION: >+# Strip C[XX]FLAGS of everything except known good options. > strip-flags() { > local x y flag NEW_CFLAGS NEW_CXXFLAGS > >@@ -350,10 +343,14 @@ > > /dev/null 2>&1 > } > >-# Returns true if C compiler support given flag >+# @FUNCTION: test-flag-CC >+# @USAGE: < flag > >+# @RETURN: Returns true if C compiler support given flag > test-flag-CC() { test-flag-PROG "CC" "$1"; } > >-# Returns true if C++ compiler support given flag >+# @FUNCTION: test-flag-CXX >+# @USAGE: < flag > >+# @RETURN: Returns true if C++ compiler support given flag > test-flag-CXX() { test-flag-PROG "CXX" "$1"; } > > test-flags-PROG() { >@@ -376,23 +373,35 @@ > [[ -n ${flags} ]] > } > >-# Returns (echo's) the given flags supported by the C compiler >+# @FUNCTION: test-flags-CC >+# @USAGE: < flags > >+# @RETURN: Returns (echo's) the given flags supported by the C compiler > test-flags-CC() { test-flags-PROG "CC" "$@"; } > >-# Returns (echo's) the given flags supported by the C++ compiler >+# @FUNCTION: test-flags-CXX >+# @USAGE: < flags > >+# @RETURN: Returns (echo's) the given flags supported by the C++ compiler > test-flags-CXX() { test-flags-PROG "CXX" "$@"; } > >+# @FUNCTION: test-flags >+# @USAGE: < flags > >+# @DESCRIPTION: > # Short-hand that should hopefully work for both C and C++ compiler, but > # its really only present due to the append-flags() abomination. > test-flags() { test-flags-CC "$@"; } > >-# Depriciated, use test-flags() >+# @FUNCTION: test_flag >+# @DESCRIPTION: >+# DEPRICIATED, use test-flags() > test_flag() { > ewarn "test_flag: deprecated, please use test-flags()!" >&2 > > test-flags-CC "$@" > } > >+# @FUNCTION: test_version_info >+# @USAGE: < version > >+# @RETURN: Return code 0 if CC matches <version>, else return code 1 > test_version_info() { > if [[ $($(tc-getCC) --version 2>&1) == *$1* ]]; then > return 0 >@@ -401,11 +410,18 @@ > fi > } > >+# @FUNCTION: strip-unsupported-flags >+# @DESCRIPTION: >+# Strip C[XX]FLAGS of any flags not supported by installed version of gcc > strip-unsupported-flags() { > export CFLAGS=$(test-flags-CC ${CFLAGS}) > export CXXFLAGS=$(test-flags-CXX ${CXXFLAGS}) > } > >+# @FUNCTION: get-flag >+# @USAGE: < flag > >+# @DESCRIPTION: >+# Find and echo the value for a particular flag > get-flag() { > local f findflag="$1" > >@@ -423,6 +439,8 @@ > return 1 > } > >+# @FUNCTION: has_hardened >+# @DESCRIPTION: > # DEPRECATED - use gcc-specs-relro or gcc-specs-now from toolchain-funcs > has_hardened() { > ewarn "has_hardened: deprecated, please use gcc-specs-{relro,now}()!" >&2 >@@ -432,6 +450,8 @@ > [[ -f ${GCC_SPECS} && ${GCC_SPECS} != ${GCC_SPECS/hardened/} ]] > } > >+# @FUNCTION: has_pic >+# @DESCRIPTION: > # DEPRECATED - use gcc-specs-pie from toolchain-funcs > # indicate whether PIC is set > has_pic() { >@@ -442,6 +462,8 @@ > gcc-specs-pie > } > >+# @FUNCTION: has_pie >+# @DESCRIPTION: > # DEPRECATED - use gcc-specs-pie from toolchain-funcs > # indicate whether PIE is set > has_pie() { >@@ -452,6 +474,8 @@ > gcc-specs-pie > } > >+# @FUNCTION: has_ssp_all >+# @DESCRIPTION: > # DEPRECATED - use gcc-specs-ssp from toolchain-funcs > # indicate whether code for SSP is being generated for all functions > has_ssp_all() { >@@ -463,6 +487,8 @@ > gcc-specs-ssp-all > } > >+# @FUNCTION: has_ssp >+# @DESCRIPTION: > # DEPRECATED - use gcc-specs-ssp from toolchain-funcs > # indicate whether code for SSP is being generated > has_ssp() { >@@ -474,6 +500,11 @@ > gcc-specs-ssp > } > >+# @FUNCTION: has_m64 >+# @DESCRIPTION: >+# This doesn't test if the flag is accepted, it tests if the flag actually >+# WORKS. Non-multilib gcc will take both -m32 and -m64. If the flag works >+# return code is 0, else the return code is 1. > has_m64() { > # this doesnt test if the flag is accepted, it tests if the flag > # actually -WORKS-. non-multilib gcc will take both -m32 and -m64! >@@ -490,6 +521,11 @@ > return 1 > } > >+# @FUNCTION: has_m32 >+# @DESCRIPTION: >+# This doesn't test if the flag is accepted, it tests if the flag actually >+# WORKS. Non-mulilib gcc will take both -m32 and -64. If the flag works return >+# code is 0, else return code is 1. > has_m32() { > # this doesnt test if the flag is accepted, it tests if the flag > # actually -WORKS-. non-multilib gcc will take both -m32 and -m64! >@@ -508,6 +544,10 @@ > return 1 > } > >+# @FUNCTION: replace-sparc64-flags >+# @DESCRIPTION: >+# Sets mcpu to v8 and uses the original value >+# as mtune if none specified. > replace-sparc64-flags() { > local SPARC64_CPUS="ultrasparc3 ultrasparc v9" > >@@ -534,12 +574,19 @@ > export CFLAGS CXXFLAGS > } > >+# @FUNCTION: append-ldflags >+# @USAGE: < flags > >+# @DESCRIPTION: >+# Add extra flags to your current LDFLAGS > append-ldflags() { > [[ -z $* ]] && return 0 > export LDFLAGS="${LDFLAGS} $*" > return 0 > } > >+# @FUNCTION: filter-ldflags >+# @USAGE: < flags > >+# @DESCRIPTION: > # Remove flags from LDFLAGS - it's up to the ebuild to filter > # CFLAGS and CXXFLAGS via filter-flags if they need to. > filter-ldflags() { >@@ -547,6 +594,9 @@ > return 0 > } > >+# @FUNCTION: raw-ldflags >+# @USAGE: < flags > >+# @DESCRIPTION: > # Turn C style ldflags (-Wl,-foo) into straight ldflags - the results > # are suitable for passing directly to 'ld'; note LDFLAGS is usually passed > # to gcc where it needs the '-Wl,'. >@@ -561,6 +611,9 @@ > echo "$@" > } > >+# @FUNCTION: bindnow-flags >+# @RETURN: Returns the flags to enable "now" binding in the current selected linker. >+# @DESCRIPTION: > # Gets the flags needed for "NOW" binding > bindnow-flags() { > case $($(tc-getLD) -v 2>&1 </dev/null) in
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 210394
: 143684