First stab at gen-versions.sh

Signed-off-by: Alexey Neyman <stilor@att.net>
This commit is contained in:
Alexey Neyman 2017-05-07 15:12:08 -07:00
parent 8f8e131d56
commit 0a654319f9
116 changed files with 289 additions and 157 deletions

1
.gitignore vendored
View File

@ -11,6 +11,7 @@ paths.*
!paths.in
config/configure.in
config/gen/
config/versions/
.config
# Temporaries

View File

@ -4,7 +4,10 @@ set -e
printf "Running autoconf...\n"
autoconf -Wall --force
printf "Generating kconfig files...\n"
printf "Generating kconfig component lists...\n"
./maintainer/gen-kconfig.sh
printf "Generating kconfig component versions...\n"
./maintainer/gen-versions.sh
printf "Done. You may now run:\n ./configure\n"

View File

@ -2,167 +2,14 @@
comment "GNU binutils"
config BINUTILS_CUSTOM
bool
prompt "Custom binutils"
depends on EXPERIMENTAL
select BINUTILS_2_26_or_later
help
The choosen binutils version shall be not downloaded. Instead use
a custom location to get the source.
if BINUTILS_CUSTOM
config BINUTILS_CUSTOM_LOCATION
string
prompt "Full path to custom binutils source"
help
Enter the path to the directory or tarball of your source for binutils.
If the path is a tarball, it should extract to: <name>-<version>/
where the name is this component, binutils, and the version is set
below in the custom version string.
config BINUTILS_CUSTOM_VERSION
string
prompt "Binutils Custom Version number"
help
Enter the version number for your custom binutils.
config BINUTILS_VERSION
string
default BINUTILS_CUSTOM_VERSION
endif # BINUTILS_CUSTOM
if ! BINUTILS_CUSTOM
config BINUTILS_SHOW_LINARO
bool
prompt "Show Linaro versions"
help
Linaro is maintaining some advanced/more stable/experimental versions
of binutils, especially for the ARM architecture.
Those versions have not been blessed by the binutils comunity (nor have they
been cursed either!), but they look to be pretty much stable, and even
more stable than the upstream versions. YMMV...
If you do not know what this Linaro stuff is, then simply say 'n' here,
and rest in peace. OTOH, if you know what you are doing, you will be
able to use and enjoy :-) the Linaro versions by saying 'y' here.
Linaro: http://www.linaro.org/
choice
bool
prompt "binutils version"
# Don't remove next line
# CT_INSERT_VERSION_BELOW
config BINUTILS_V_2_28
bool
prompt "2.28"
select BINUTILS_2_27_or_later
config BINUTILS_V_2_27
bool
prompt "2.27"
select BINUTILS_2_27_or_later
config BINUTILS_V_2_26
bool
prompt "2.26"
select BINUTILS_2_26_or_later
config BINUTILS_V_2_25_1
bool
prompt "2.25.1 (OBSOLETE)"
select BINUTILS_2_25_1_or_later
depends on OBSOLETE
config BINUTILS_LINARO_V_2_25
bool
prompt "linaro-2.25.0-2015.01-2 (OBSOLETE)"
select BINUTILS_2_25_or_later
depends on BINUTILS_SHOW_LINARO
depends on OBSOLETE
config BINUTILS_LINARO_V_2_24
bool
prompt "linaro-2.24.0-2014.11-2 (OBSOLETE)"
select BINUTILS_2_24_or_later
depends on BINUTILS_SHOW_LINARO
depends on OBSOLETE
config BINUTILS_V_2_24
bool
prompt "2.24 (OBSOLETE)"
select BINUTILS_2_24_or_later
depends on OBSOLETE
config BINUTILS_LINARO_V_2_23_2
bool
prompt "linaro-2.23.2-2013.10-4 (OBSOLETE)"
select BINUTILS_2_23_2_or_later
depends on BINUTILS_SHOW_LINARO
depends on OBSOLETE
config BINUTILS_V_2_23_2
bool
prompt "2.23.2 (OBSOLETE)"
select BINUTILS_2_23_2_or_later
depends on OBSOLETE
endchoice
config BINUTILS_VERSION
string
# Don't remove next line
# CT_INSERT_VERSION_STRING_BELOW
default "2.28" if BINUTILS_V_2_28
default "2.27" if BINUTILS_V_2_27
default "2.26" if BINUTILS_V_2_26
default "2.25.1" if BINUTILS_V_2_25_1
default "linaro-2.25.0-2015.01-2" if BINUTILS_LINARO_V_2_25
default "linaro-2.24.0-2014.11-2" if BINUTILS_LINARO_V_2_24
default "2.24" if BINUTILS_V_2_24
default "linaro-2.23.2-2013.10-4" if BINUTILS_LINARO_V_2_23_2
default "2.23.2" if BINUTILS_V_2_23_2
endif # ! BINUTILS_CUSTOM
config BINUTILS_2_27_or_later
bool
select BINUTILS_2_26_or_later
config BINUTILS_2_26_or_later
bool
select BINUTILS_2_25_1_or_later
config BINUTILS_2_25_1_or_later
bool
select BINUTILS_2_25_or_later
config BINUTILS_2_25_or_later
bool
select BINUTILS_2_24_or_later
config BINUTILS_2_24_or_later
bool
select BINUTILS_2_23_2_or_later
config BINUTILS_2_23_2_or_later
bool
select BINUTILS_HAS_GOLD
select BINUTILS_HAS_HASH_STYLE
select BINUTILS_HAS_PKGVERSION_BUGURL
select BINUTILS_HAS_PLUGINS
source "config/versions/binutils.in"
config BINUTILS_HAS_HASH_STYLE
default y if BINUTILS_V_2_23_2_or_later
bool
config BINUTILS_HAS_GOLD
default y if BINUTILS_V_2_23_2_or_later
bool
# gold only suports the listed architectures
@ -179,9 +26,11 @@ config BINUTILS_GOLD_SUPPORT
depends on ! STATIC_TOOLCHAIN
config BINUTILS_HAS_PLUGINS
default y if BINUTILS_V_2_23_2_or_later
bool
config BINUTILS_HAS_PKGVERSION_BUGURL
default y if BINUTILS_V_2_23_2_or_later
bool
# Force using the BFD linker if needed. There are two options:

253
maintainer/gen-versions.sh Executable file
View File

@ -0,0 +1,253 @@
#!/bin/bash
# Where the version configs are generated
config_dir=config/versions
defaults=packages/default.desc
declare -A forks
debug()
{
if [ -n "${DEBUG}" ]; then
echo ":: $@" >&2
fi
}
read_files()
{
local f l
for f in ${defaults} "$@"; do
[ -r "${f}" ] || continue
while read l; do
case "${l}" in
"#*") continue;;
*) echo "[${l%%=*}]=${l#*=}";;
esac
done < "${f}"
done
}
derived_package()
{
info[name]=${p}
info[forks]=${forks[${p}]}
info[master]=${info[master]:-${p}}
# Various kconfig-ized prefixes
tmp=${p^^}
info[pfx]=${tmp//[^0-9A-Z_]/_}
tmp=${info[origin]^^}
info[originpfx]=${tmp//[^0-9A-Z_/_}
tmp=${info[master]^^}
info[masterpfx]=${tmp//[^0-9A-Z_/_}
}
read_package_desc()
{
read_files "packages/${1}/package.desc"
}
read_version_desc()
{
read_files "packages/${1}/package.desc" "packages/${1}/${2}/version.desc"
}
for_each_package()
{
local list="${1}"
local -A info
local p tmp
debug "Entering: for_each_package $@"
shift
for p in ${list}; do
eval "info=( `read_package_desc ${p}` )"
derived_package ${p}
debug "Evaluate for ${p}: $@"
eval "$@"
done
}
for_each_version()
{
local pkg="${1}"
local -A info prev
local -a versions
local v tmp
debug "Entering: for_each_version $@"
shift
versions=( `cd packages/${pkg} && ls */version.desc 2>/dev/null | sed 's,/version.desc$,,' | sort -rV` )
tmp=
for v in "${versions[@]}"; do
if [ -n "${tmp}" ]; then
prev["${tmp}"]=${v}
fi
tmp="${v}"
done
if [ -n "${tmp}" ]; then
prev["${tmp}"]=
fi
for v in "${versions[@]}"; do
eval "info=( `read_version_desc "${pkg}" "${v}"` )"
debug "INFO [[ `read_version_desc "${pkg}" "${v}"` ]]"
derived_package ${pkg}
info[ver]="${v}"
info[kcfg]="${v//[^0-9A-Za-z_]/_}"
info[prev]="${prev[${v}]//[^0-9A-Za-z_]/_}"
debug "Evaluate for ${pkg}/${v}: $@"
eval "$@"
done
}
# Setup: find master-fork relationships between packages
find_forks()
{
[ "${info[master]}" != "${info[name]}" ] && forks[${info[master]}]+=" ${info[name]}"
}
gen_versions()
{
local cond=$1
debug "Entering: gen_versions $@"
if [ -n "${cond}" ]; then
cat <<EOF
if ${cond}
EOF
fi
cat <<EOF
# Versions for ${info[name]}
choice
bool
prompt "Version of ${info[name]}"
# Defined versions first
EOF
for_each_version "${info[name]}" echo \"'
config ${info[pfx]}_V_${info[kcfg]}
bool \"${info[ver]}\"
select ${info[pfx]}_V_${info[kcfg]}_or_later${info[obsolete]:+
depends on OBSOLETE}${info[experimental]:+
depends on EXPERIMENTAL}'\"
# TBD devel (from official repository)
# TBD show changeset/revision/branch selection
# TBD custom (local tarball/directory)
# TBD show custom location selection
cat <<EOF
endchoice
# Text string with the version of ${info[name]}
config ${info[pfx]}_VERSION
string
EOF
for_each_version "${info[name]}" echo \
\"' default \"${info[ver]}\" if ${info[pfx]}_V_${info[kcfg]}'\"
cat <<EOF
default "unknown"
EOF
cat <<EOF
# Flags for all versions indicating "this or later".
# Only produced for master version of the package (which is what
# the build scriptes are tied to); derived versions must
# select the matching master version.
EOF
for_each_version "${info[name]}" echo \"'
config ${info[pfx]}_V_${info[kcfg]}_or_later
bool${info[prev]:+
select ${info[pfx]}_V_${info[prev]}_or_later}'\"
if [ -n "${cond}" ]; then
cat <<EOF
endif
EOF
fi
}
# Generate a menu for selecting a fork for a component
gen_selection()
{
local only_obsolete=yes only_experimental=yes
for_each_version "${info[name]}" '
[ -z "${info[experimental]}" ] && only_experimental=
[ -z "${info[obsolete]}" ] && only_obsolete=
'
debug "${info[name]}: ${only_obsolete:+obsolete} ${only_experimental:+experimental}"
echo "
config ${info[masterpfx]}_USE_${info[originpfx]}
bool \"${info[origin]}\"${only_obsolete:+
depends on OBSOLETE}${only_experimental:+
depends on EXPERIMENTAL}
help" && sed 's/^/\t /' "packages/${info[origin]}.help"
}
# Generate a single configuration file
gen_one_component()
{
local cond
debug "Entering: gen_one_component $@"
# Non-masters forks: skip, will be generated along with their master version
if [ "${info[master]}" != "${info[name]}" ]; then
debug "Skip '${info[name]}': master '${info[master]}'"
return
fi
debug "Generating '${info[name]}.in'${info[forks]:+ (includes ${info[forks]}})"
exec >"${config_dir}/${info[name]}.in"
cat <<EOF
#
# DO NOT EDIT! This file is automatically generated.
#
EOF
# Generate fork selection, if there is more than one fork
if [ -n "${info[forks]}" ]; then
cat <<EOF
choice
bool "Show ${info[name]} versions from"
EOF
for_each_package "${info[name]} ${info[forks]}" gen_selection
cat <<EOF
endchoice
EOF
for_each_package "${info[name]} ${info[forks]}" \
gen_versions '${info[masterpfx]}_USE_${info[originpfx]}'
else
for_each_package "${info[name]}" gen_versions
fi
}
rm -rf "${config_dir}"
mkdir -p "${config_dir}"
all_packages=`cd packages && ls */package.desc 2>/dev/null | sed 's,/package.desc$,,' | xargs echo`
debug "Generating package version descriptions"
debug "Packages: ${all_packages}"
for_each_package "${all_packages}" find_forks
for_each_package "${all_packages}" gen_one_component
debug "Done!"

6
packages/GNU.help Normal file
View File

@ -0,0 +1,6 @@
GNU (which is a recursive acronym for "GNU's Not Unix") provides GNU binutils,
GNU C Compiler (gcc), GNU debugger (gdb) and many other utilities. GNU is
considered the master source for these packages.
You should select "GNU" here unless you definitely know that you need some version
from another source.

4
packages/Linaro.help Normal file
View File

@ -0,0 +1,4 @@
Linaro is maintaining some advanced/more stable/experimental versions
of binutils, gcc, glibc and gdb, especially for the ARM architecture.
These versions contain some changes that are not (yet?) merged into
their respective upstream repositories.

View File

@ -0,0 +1 @@
obsolete="yes"

View File

@ -0,0 +1 @@
obsolete="yes"

View File

@ -0,0 +1 @@
obsolete="yes"

View File

@ -0,0 +1,6 @@
vcs="git"
repository="https://git.linaro.org/toolchain/binutils-gdb.git"
download="https://ftp.gnu.org/gnu/binutils/"
master="binutils"
origin="Linaro"
experimental="yes"

1
packages/binutils/2.23.2/version.desc vendored Normal file
View File

@ -0,0 +1 @@
obsolete="yes"

1
packages/binutils/2.24/version.desc vendored Normal file
View File

@ -0,0 +1 @@
obsolete="yes"

1
packages/binutils/2.25.1/version.desc vendored Normal file
View File

@ -0,0 +1 @@
obsolete="yes"

0
packages/binutils/2.26/version.desc vendored Normal file
View File

Some files were not shown because too many files have changed in this diff Show More