From ba16785bd30e652a5d606d7059336e6d6eb7a0c2 Mon Sep 17 00:00:00 2001 From: midipix Date: Sat, 5 Jan 2019 19:06:36 -0500 Subject: project: custom config: added cfgdefs_detect_libc_version(). --- project/config/cfgdefs.in | 6 ++++++ project/config/cfgdefs.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 project/config/cfgdefs.in diff --git a/project/config/cfgdefs.in b/project/config/cfgdefs.in new file mode 100644 index 0000000..4299d59 --- /dev/null +++ b/project/config/cfgdefs.in @@ -0,0 +1,6 @@ +# libc +LIBC_VER = @libc_ver@ +LIBC_MAJOR = @libc_major@ +LIBC_MINOR = @libc_minor@ +LIBC_MICRO = @libc_micro@ + diff --git a/project/config/cfgdefs.sh b/project/config/cfgdefs.sh index eb04350..20daffc 100644 --- a/project/config/cfgdefs.sh +++ b/project/config/cfgdefs.sh @@ -39,8 +39,48 @@ cfgdefs_set_arch() fi } + +cfgdefs_detect_libc_version() +{ + mb_libc_verinfo=$(cat "$mb_source_dir/VERSION") + + case "$mb_libc_verinfo" in + *.*.* ) + libc_ver=${mb_libc_verinfo} + libc_major=${mb_libc_verinfo%.*.*} + libc_micro=${mb_libc_verinfo#*.*.} + + libc_minor=${libc_ver#*.} + libc_minor=${libc_minor%.*} + ;; + * ) + error_msg "Could not properly parse $mb_source_dir/VERSION" + exit 2 + esac +} + + +cfgdefs_output_custom_defs() +{ + sed \ + -e 's/@libc_ver@/'"$libc_ver"'/g' \ + -e 's/@libc_major@/'"$libc_major"'/g' \ + -e 's/@libc_minor@/'"$libc_minor"'/g' \ + -e 's/@libc_micro@/'"$libc_micro"'/g' \ + "$mb_project_dir/project/config/cfgdefs.in" \ + | sed -e 's/[ \t]*$//g' \ + >> "$mb_pwd/cfgdefs.mk" +} + + # arch cfgdefs_set_arch +# libc version info +cfgdefs_detect_libc_version + +# cfgdefs.in --> cfgdefs.mk +cfgdefs_output_custom_defs + # all done return 0 -- cgit v1.2.3