[PATCH 1 of 2] kconfig: add version helpers
Yann E. MORIN
yann.morin.1998@anciens.enib.fr
Wed May 25 17:42:00 GMT 2011
Benoit, All,
On Tuesday 24 May 2011 15:06:00 Benoît THÉBAUDEAU wrote:
> # HG changeset patch
> # User "Benoît THÉBAUDEAU" <benoit.thebaudeau@advansee.com>
> # Date 1306241064 -7200
> # Node ID 185015975b8850bbba70b60047c31085d84a6fee
> # Parent 230d50dd23230a2b09fb390d771f5628a1c7342f
> kconfig: add version helpers
>
> This script adds several helpers to handle configured tool versions.
script --> patch. ;-)
> Signed-off-by: "Benoît THÉBAUDEAU" <benoit.thebaudeau@advansee.com>
>
> diff --git a/config/binutils/binutils.in b/config/binutils/binutils.in
> --- a/config/binutils/binutils.in
> +++ b/config/binutils/binutils.in
> @@ -17,22 +17,27 @@
> config BINUTILS_V_2_20_1
> bool
> prompt "2.20.1"
> + select BINUTILS_2_20_or_later
[--SNIP--]
> @@ -61,9 +66,25 @@
>
> config BINUTILS_2_21_or_later
> bool
> + default n
'default n' is unneeded, it is the default.
> + select BINUTILS_2_20_or_later
This scheme does not work when a newer version ceases to support a feature
of older versions. The way I've been going with gcc is to have a kind of
'version familly' that selects the supported features, plus the _or_later
stuff.
Eg.:
config BINUTILS_HAS_PKG_VERSION_BUGURL
bool
config BINUTILS_2_20_or_later
bool
default n
select BINUTILS_HAS_PKG_VERSION_BUGURL
And then in the script:
if [ "${CT_BINUTILS_HAS_PKG_VERSION_BUGURL}" = "y" ]; then
foo bar
fi
This is more explicit, I think.
[--SNIP--]
> diff --git a/config/libc/eglibc.in b/config/libc/eglibc.in
> --- a/config/libc/eglibc.in
> +++ b/config/libc/eglibc.in
And what about glibc?
[--SNIP--]
> diff --git a/scripts/addToolVersion.sh b/scripts/addToolVersion.sh
> --- a/scripts/addToolVersion.sh
> +++ b/scripts/addToolVersion.sh
> @@ -114,6 +114,36 @@
> SedExpr1="${SedExpr1}\n select CC_GCC_4_2"
> fi
> ;;
> + binutils)
> + # Extract 'M'ajor and 'm'inor from version string
> + ver_M=$(echo "${version}...." |cut -d . -f 1)
> + ver_m=$(echo "${version}...." |cut -d . -f 2)
Code duplication, please make it a function that does the split...
> + if [ \( ${ver_M} -eq 2 -a ${ver_m} -eq 21 \) ]; then
> + SedExpr1="${SedExpr1}\n select BINUTILS_2_21_or_later"
> + elif [ \( ${ver_M} -eq 2 -a ${ver_m} -eq 20 \) ]; then
> + SedExpr1="${SedExpr1}\n select BINUTILS_2_20_or_later"
> + elif [ \( ${ver_M} -eq 2 -a ${ver_m} -eq 19 \) ]; then
> + SedExpr1="${SedExpr1}\n select BINUTILS_2_19_or_later"
> + elif [ \( ${ver_M} -eq 2 -a ${ver_m} -eq 18 \) ]; then
> + SedExpr1="${SedExpr1}\n select BINUTILS_2_18_or_later"
> + fi
> + ;;
> + eglibc)
> + # Extract 'M'ajor and 'm'inor from version string
> + ver_M=$(echo "${version}...." |cut -d . -f 1)
> + ver_m=$(echo "${version}...." |cut -d . -f 2)
... and use it here and everywhere we need to split ${version}...
> + if [ \( ${ver_M} -eq 2 -a ${ver_m} -eq 13 \) ]; then
> + SedExpr1="${SedExpr1}\n select LIBC_EGLIBC_2_13_or_later"
> + elif [ \( ${ver_M} -eq 2 -a ${ver_m} -eq 12 \) ]; then
> + SedExpr1="${SedExpr1}\n select LIBC_EGLIBC_2_12_or_later"
> + elif [ \( ${ver_M} -eq 2 -a ${ver_m} -eq 11 \) ]; then
> + SedExpr1="${SedExpr1}\n select LIBC_EGLIBC_2_11_or_later"
> + elif [ \( ${ver_M} -eq 2 -a ${ver_m} -eq 10 \) ]; then
> + SedExpr1="${SedExpr1}\n select LIBC_EGLIBC_2_10_or_later"
> + elif [ \( ${ver_M} -eq 2 -a ${ver_m} -eq 9 \) ]; then
> + SedExpr1="${SedExpr1}\n select LIBC_EGLIBC_2_9_or_later"
> + fi
> + ;;
> uClibc)
> # uClibc-0.9.30 and above need some love
> ver_M=$(echo "${version}...." |cut -d . -f 1)
... here for example.
Regards,
Yann E. MORIN.
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
--
For unsubscribe information see http://sourceware.org/lists.html#faq
More information about the crossgcc
mailing list