]> git.sur5r.net Git - kconfig-frontends/commitdiff
frontends: add the meta-frontend kconfig v4.7.0.0
authorYann E. MORIN <yann.morin.1998@free.fr>
Wed, 3 Aug 2016 20:11:42 +0000 (22:11 +0200)
committerYann E. MORIN <yann.morin.1998@free.fr>
Sun, 21 Aug 2016 19:31:50 +0000 (21:31 +0200)
Install 'kconfig', the meta-frontend that can be used to as a frontend
to all kconfig tools.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
.gitignore
configure.ac
frontends/Makefile.am
frontends/kconfig.in [new file with mode: 0644]

index da028f8b68bfc1e5053d47c9b0714e900ce7be6f..95fc7fc1c653b1b413228aa6f15aa45e42840059 100644 (file)
@@ -8,6 +8,7 @@
 
 .libs/
 
+/frontends/kconfig
 /frontends/conf/kconfig-conf
 /frontends/gconf/kconfig-gconf
 /frontends/mconf/kconfig-mconf
index e44b44292ea851672a680c72e67c0125be96fad7..31eef710bbffadb1fdad36d39b7b34723e48c453 100644 (file)
@@ -122,6 +122,13 @@ AC_SUBST([enable_L10n], [${enable_L10n:-yes}])
 #----------------------------------------
 # Options to selectively enable/disable frontends
 # All are selected by default
+AC_ARG_ENABLE(
+    [kconfig],
+    [AS_HELP_STRING(
+        [--disable-kconfig],
+        [kconfig, the meta-frontend to all kconfig tools (default=yes)])])
+AC_SUBST([enable_kconfig], [${enable_kconfig:-yes}])
+
 AC_ARG_ENABLE(
     [conf],
     [AS_HELP_STRING(
@@ -426,6 +433,9 @@ AS_IF(
 
 #----------------------------------------
 # Setup automake conditional build
+AM_CONDITIONAL(
+    [COND_kconfig],
+    [test "$enable_kconfig" = "yes"])
 AM_CONDITIONAL(
     [COND_conf],
     [test "$enable_conf" = "yes"])
@@ -469,6 +479,11 @@ AS_IF([test "$enable_mconf" = "yes"], [fe_list="$fe_list mconf"])
 AS_IF([test "$enable_nconf" = "yes"], [fe_list="$fe_list nconf"])
 AS_IF([test "$enable_qconf" = "yes"], [fe_list="$fe_list qconf"])
 
+[kcfg_list="$fe_list"]
+AS_IF([test "$enable_utils" = "yes"], [kcfg_list="$kcfg_list diff merge tweak"])
+AS_IF([test "$has_gettext" = "yes"],  [kcfg_list="$kcfg_list gettext"])
+AC_SUBST([kcfg_list], [${kcfg_list}])
+
 [lib_list=]
 AS_IF(
     [test "$enable_shared" = "yes"],
index 0badbc8c6d95a4b43c2dedd8d235a33955465e75..6e77564dea9ce700ae89618e637ba9467b9b4d03 100644 (file)
@@ -1,3 +1,6 @@
+if COND_kconfig
+    MAYBE_kconfig = kconfig
+endif
 if COND_conf
     MAYBE_conf = conf
 endif
@@ -14,3 +17,12 @@ if COND_qconf
     MAYBE_qconf = qconf
 endif
 SUBDIRS = $(MAYBE_conf) $(MAYBE_mconf) $(MAYBE_nconf) $(MAYBE_gconf) $(MAYBE_qconf)
+
+EXTRA_DIST = kconfig.in
+
+bin_SCRIPTS = $(MAYBE_kconfig)
+
+kconfig: kconfig.in
+       $(AM_V_GEN)$(SED) -e 's/@KCFG_LIST@/$(kcfg_list)/g'      \
+                         $< >$@
+       @chmod +x $@
diff --git a/frontends/kconfig.in b/frontends/kconfig.in
new file mode 100644 (file)
index 0000000..110204c
--- /dev/null
@@ -0,0 +1,48 @@
+#!/usr/bin/env bash
+
+LIST="@KCFG_LIST@"
+
+main() {
+    local kcfg="${1}"; shift
+    local k
+
+    case "${kcfg}" in
+    "")         error "what should I do (see -h)?\n";;
+    -h|--help)  help; exit 0;;
+    -*)         error "no such option '%s'\n" "${kcfg}";;
+    esac
+
+    for k in ${LIST}; do
+        if [ "${kcfg}" = "${k}" ]; then
+            exec kconfig-${kcfg} "${@}"
+            error "cannot execute tool '%s'\n" "${kcfg}"
+        fi
+    done
+    error "no such tool '%s'\n" "${kcfg}"
+}
+
+help() {
+    cat <<-_EOF_
+NAME
+    kconfig - meta-frontend to kconfig tools
+
+SYNOPSIS
+    kconfig -h|--help
+    kconfig <kconfig-tool> [option ...]
+
+DESCRIPTION
+    kconfig is the meta-frontend to all other kconfig tools:
+        ${LIST}
+
+    The acceptable options depend on what tool is being called.
+_EOF_
+}
+
+error() {
+    local fmt="${1}"; shift
+
+    printf "kconfig: ${fmt}" "${@}" >&2
+    exit 1
+}
+
+main "${@}"