eclass/flag-o-matic: Support EAPI 0 and 4

This commit is contained in:
Krzesimir Nowak 2021-12-21 09:22:19 +01:00
parent 7514aa2a2a
commit 8ea3271af0

View File

@ -1,18 +1,20 @@
# Copyright 1999-2021 Gentoo Authors # Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2 # Distributed under the terms of the GNU General Public License v2
# Flatcar: Support EAPI 0 and 4.
# @ECLASS: flag-o-matic.eclass # @ECLASS: flag-o-matic.eclass
# @MAINTAINER: # @MAINTAINER:
# toolchain@gentoo.org # toolchain@gentoo.org
# @SUPPORTED_EAPIS: 5 6 7 8 # @SUPPORTED_EAPIS: 0 4 5 6 7 8
# @BLURB: common functions to manipulate and query toolchain flags # @BLURB: common functions to manipulate and query toolchain flags
# @DESCRIPTION: # @DESCRIPTION:
# This eclass contains a suite of functions to help developers sanely # This eclass contains a suite of functions to help developers sanely
# and safely manage toolchain flags in their builds. # and safely manage toolchain flags in their builds.
case ${EAPI:-0} in case ${EAPI:-0} in
0|1|2|3|4) die "flag-o-matic.eclass: EAPI ${EAPI} is too old." ;; 1|2|3) die "flag-o-matic.eclass: EAPI ${EAPI} is too old." ;;
5|6|7|8) ;; 0|4|5|6|7|8) ;;
*) die "EAPI ${EAPI} is not supported by flag-o-matic.eclass." ;; *) die "EAPI ${EAPI} is not supported by flag-o-matic.eclass." ;;
esac esac
@ -21,7 +23,7 @@ _FLAG_O_MATIC_ECLASS=1
inherit toolchain-funcs inherit toolchain-funcs
[[ ${EAPI} == [567] ]] && inherit eutils [[ ${EAPI:-0} == [04567] ]] && inherit eutils
# @FUNCTION: all-flag-vars # @FUNCTION: all-flag-vars
# @DESCRIPTION: # @DESCRIPTION:
@ -36,8 +38,8 @@ all-flag-vars() {
# {C,CPP,CXX,CCAS,F,FC,LD}FLAGS that we allow in strip-flags # {C,CPP,CXX,CCAS,F,FC,LD}FLAGS that we allow in strip-flags
# Note: shell globs and character lists are allowed # Note: shell globs and character lists are allowed
setup-allowed-flags() { setup-allowed-flags() {
[[ ${EAPI} == [567] ]] || [[ ${EAPI:-0} == [04567] ]] ||
die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}." die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI:-0}."
_setup-allowed-flags "$@" _setup-allowed-flags "$@"
} }
@ -484,8 +486,8 @@ strip-flags() {
# Returns shell true if <flag> is supported by given <compiler>, # Returns shell true if <flag> is supported by given <compiler>,
# else returns shell false. # else returns shell false.
test-flag-PROG() { test-flag-PROG() {
[[ ${EAPI} == [567] ]] || [[ ${EAPI:-0} == [04567] ]] ||
die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}." die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI:-0}."
_test-flag-PROG "$@" _test-flag-PROG "$@"
} }
@ -623,8 +625,8 @@ test-flag-CCLD() { _test-flag-PROG CC c+ld "$@"; }
# Returns shell true if <flags> are supported by given <compiler>, # Returns shell true if <flags> are supported by given <compiler>,
# else returns shell false. # else returns shell false.
test-flags-PROG() { test-flags-PROG() {
[[ ${EAPI} == [567] ]] || [[ ${EAPI:-0} == [04567] ]] ||
die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI}." die "Internal function ${FUNCNAME} is not available in EAPI ${EAPI:-0}."
_test-flags-PROG "$@" _test-flags-PROG "$@"
} }