summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--rules/post/ptxd_make_world_common.make1
-rw-r--r--rules/post/ptxd_make_world_kconfig.make15
-rw-r--r--scripts/lib/ptxd_make_world_kconfig.sh59
3 files changed, 69 insertions, 6 deletions
diff --git a/rules/post/ptxd_make_world_common.make b/rules/post/ptxd_make_world_common.make
index 2b40ecb96..d5a9f6ebb 100644
--- a/rules/post/ptxd_make_world_common.make
+++ b/rules/post/ptxd_make_world_common.make
@@ -77,6 +77,7 @@ world/env/impl = \
pkg_pkg="$(call ptx/escape,$($(1)))" \
pkg_version="$(call ptx/escape,$($(1)_VERSION))" \
pkg_config="$(call ptx/escape,$($(1)_CONFIG))" \
+ pkg_ref_config="$(call ptx/escape,$($(1)_REF_CONFIG))" \
pkg_path="$(call ptx/escape,$($(1)_PATH))" \
pkg_src="$(call ptx/escape,$($(1)_SOURCE))" \
pkg_srcs="$(call ptx/escape,$($(1)_SOURCES))" \
diff --git a/rules/post/ptxd_make_world_kconfig.make b/rules/post/ptxd_make_world_kconfig.make
index 7d1861836..382e6bd9c 100644
--- a/rules/post/ptxd_make_world_kconfig.make
+++ b/rules/post/ptxd_make_world_kconfig.make
@@ -16,4 +16,19 @@ world/kconfig = \
ptx_config_target=$(strip $(2)) \
ptxd_make_world_kconfig
+#
+# provide the .config file for kconfig
+#
+world/kconfig-setup = \
+ $(call world/env, $(1)) \
+ ptx_config_mode=$(strip $(2)) \
+ ptxd_make_world_kconfig_setup
+
+#
+# update the package config file from .config
+#
+world/kconfig-sync = \
+ $(call world/env, $(1)) \
+ ptxd_make_world_kconfig_sync
+
# vim: syntax=make
diff --git a/scripts/lib/ptxd_make_world_kconfig.sh b/scripts/lib/ptxd_make_world_kconfig.sh
index 719947de7..6d1e8b45e 100644
--- a/scripts/lib/ptxd_make_world_kconfig.sh
+++ b/scripts/lib/ptxd_make_world_kconfig.sh
@@ -8,23 +8,70 @@
# see the README file.
#
+ptxd_make_kconfig_setup() {
+ if [ -n "${ref_file_dotconfig}" ]; then
+ file_dotconfig="${ref_file_dotconfig}" ptxd_normalize_config &&
+ relative_ref_file_dotconfig="${relative_file_dotconfig}"
+ fi &&
+ ptxd_normalize_config &&
+ ptxd_kconfig_setup_config "${ptx_config_mode}" "${pkg_build_dir}/.config" \
+ "${relative_file_dotconfig}" "${file_dotconfig}" "${relative_ref_file_dotconfig}"
+}
+export -f ptxd_make_kconfig_setup
+
+ptxd_make_world_kconfig_setup() {
+ ptxd_make_world_init || return
+
+ if [ -z "${ptx_config_mode}" ]; then
+ case "${pkg_stage}" in
+ *config) ptx_config_mode=update ;;
+ *) ptx_config_mode=run ;;
+ esac
+ fi
+
+ local file_dotconfig="${pkg_config}"
+ local ref_file_dotconfig="${pkg_ref_config}"
+ ptxd_make_kconfig_setup
+}
+export -f ptxd_make_world_kconfig_setup
+
+ptxd_make_kconfig_sync() {
+ if [ -n "${ref_file_dotconfig}" ]; then
+ file_dotconfig="${ref_file_dotconfig}" ptxd_normalize_config &&
+ relative_ref_file_dotconfig="${relative_file_dotconfig}"
+ fi &&
+ ptxd_normalize_config &&
+ ptxd_kconfig_sync_config update "${pkg_build_dir}/.config" \
+ "${relative_file_dotconfig}" "${relative_ref_file_dotconfig}"
+}
+export -f ptxd_make_kconfig_sync
+
+ptxd_make_world_kconfig_sync() {
+ ptxd_make_world_init || return
+
+ local file_dotconfig="${pkg_config}"
+ local ref_file_dotconfig="${pkg_ref_config}"
+ ptxd_make_kconfig_sync
+}
+export -f ptxd_make_world_kconfig_sync
+
#
# run kconfig and update the config file
# @$1: the kconfig target (e.g. menuconfig, oldconfig, ...)
#
ptxd_make_kconfig() {
- if [ -e "${pkg_config}" ]; then
- cp "${pkg_config}" .config
- fi &&
+ local file_dotconfig="${pkg_config}"
+ local ref_file_dotconfig="${pkg_ref_config}"
+ local ptx_config_mode=run
+
+ ptxd_make_kconfig_setup &&
ptxd_eval \
"${pkg_path}" \
"${pkg_env}" \
"${pkg_conf_env}" \
make "${1}" \
"${pkg_conf_opt}" &&
- if ! diff -q -I "# [^C]" .config "${pkg_config}" > /dev/null 2>&1; then
- cp .config "${pkg_config}"
- fi
+ ptxd_make_kconfig_sync
}
export -f ptxd_make_kconfig