summaryrefslogtreecommitdiff
path: root/project
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2020-01-09 00:32:22 +0000
committermidipix <writeonce@midipix.org>2020-01-24 21:14:09 +0000
commit38a7e34b50e2e38881a1a78bb1a350c19218a56b (patch)
treea73299bb8695799c0731ffac09a7a8f99fc808a1 /project
parent7a17ab0ac27292a336f9e398fbd8542975274d87 (diff)
downloadbautomake-38a7e34b50e2e38881a1a78bb1a350c19218a56b.tar.bz2
bautomake-38a7e34b50e2e38881a1a78bb1a350c19218a56b.tar.xz
project: added custom config step, logic to detect automake's version & year.
Diffstat (limited to 'project')
-rw-r--r--project/config/cfgdefs.in6
-rw-r--r--project/config/cfgdefs.sh65
-rw-r--r--project/config/cfgdefs.usage0
3 files changed, 71 insertions, 0 deletions
diff --git a/project/config/cfgdefs.in b/project/config/cfgdefs.in
new file mode 100644
index 0000000..789a8a7
--- /dev/null
+++ b/project/config/cfgdefs.in
@@ -0,0 +1,6 @@
+# variant
+AUTOMAKE_VER = @automake_ver@
+AUTOMAKE_YEAR = @automake_year@
+AUTOMAKE_MAJOR = @automake_major@
+AUTOMAKE_MINOR = @automake_minor@
+AUTOMAKE_MICRO = @automake_micro@
diff --git a/project/config/cfgdefs.sh b/project/config/cfgdefs.sh
new file mode 100644
index 0000000..ed1d3a0
--- /dev/null
+++ b/project/config/cfgdefs.sh
@@ -0,0 +1,65 @@
+# in projects where [ $mb_use_custom_cfgdefs = yes ],
+# cfgdefs.sh is invoked from within ./configure via
+# . $mb_project_dir/project/cfgdefs.sh
+
+# this file is covered by COPYING.BAUTOMAKE.
+
+# a successful return from cfgdefs.sh will be followed
+# by a second invocation of the config_copy() function,
+# reflecting any changes to common config variables
+# made by cfgdefs.sh.
+
+# finally, cfgdefs.sh may update the contents of the
+# config-time generated cfgdefs.mk.
+
+
+for arg ; do
+ case "$arg" in
+ *)
+ error_msg ${arg#}: "unsupported config argument."
+ exit 2
+ esac
+done
+
+
+cfgdefs_detect_automake_version()
+{
+ automake_ver=$(grep 'VERSION' "$mb_source_dir/doc/version.texi")
+ automake_ver=${automake_ver##* }
+
+ automake_year=$(grep 'UPDATED-MONTH' "$mb_source_dir/doc/version.texi")
+ automake_year=${automake_year##* }
+
+ automake_major=$(printf '%s' "$automake_ver" | cut -d'.' -f1)
+ automake_minor=$(printf '%s' "$automake_ver" | cut -d'.' -f2)
+ automake_micro=$(printf '%s' "$automake_ver" | cut -d'.' -f3)
+
+ if [ -z "$automake_major" ] || [ -z "$automake_minor" ]; then
+ error_msg "Could not properly parse automake's version.texi"
+ exit 2
+ fi
+}
+
+
+cfgdefs_output_custom_defs()
+{
+ sed \
+ -e 's/@automake_ver@/'"$automake_ver"'/g' \
+ -e 's/@automake_year@/'"$automake_year"'/g' \
+ -e 's/@automake_major@/'"$automake_major"'/g' \
+ -e 's/@automake_minor@/'"$automake_minor"'/g' \
+ -e 's/@automake_micro@/'"$automake_micro"'/g' \
+ "$mb_project_dir/project/config/cfgdefs.in" \
+ | sed -e 's/[ \t]*$//g' \
+ >> "$mb_pwd/cfgdefs.mk"
+}
+
+
+# automake version info
+cfgdefs_detect_automake_version
+
+# cfgdefs.in --> cfgdefs.mk
+cfgdefs_output_custom_defs
+
+# all done
+return 0
diff --git a/project/config/cfgdefs.usage b/project/config/cfgdefs.usage
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/project/config/cfgdefs.usage