From e7c427461d3b12ac3feff3e6eb1c7bb92194b63d Mon Sep 17 00:00:00 2001 From: midipix Date: Wed, 3 Apr 2024 04:38:22 +0000 Subject: project: custom cfgdefs.sh: added --with-default-sys-path support. --- project/config/cfgdefs.in | 10 ++++++++++ project/config/cfgdefs.sh | 24 +++++++++++++++++++++++- 2 files changed, 33 insertions(+), 1 deletion(-) (limited to 'project/config') diff --git a/project/config/cfgdefs.in b/project/config/cfgdefs.in index e69de29..c63687f 100644 --- a/project/config/cfgdefs.in +++ b/project/config/cfgdefs.in @@ -0,0 +1,10 @@ +# cfgdefs.mk: build project definitions and variable assignments, +# generated by the project-specific cfgdefs.sh. + +# changes made to this file will be gone the next time +# you run ./configure. + +# for persistent post-configure, ad-hoc changes to the +# build project, use usrdefs.mk instead. + +CFLAGS_CONFIG += -D_PATH_DEFSYSPATH=\"@cfgdefs_default_sys_path@\" diff --git a/project/config/cfgdefs.sh b/project/config/cfgdefs.sh index 2ff7631..a4e859f 100644 --- a/project/config/cfgdefs.sh +++ b/project/config/cfgdefs.sh @@ -17,10 +17,27 @@ for arg ; do case "$arg" in + --with-default-sys-path=*) + cfgdefs_default_sys_path=${arg##*=} + ;; *) error_msg ${arg#}: "unsupported config argument." exit 2 esac + + case "${cfgdefs_default_sys_path:-empty}" in + /*) + ;; + + empty) + error_msg "$mb_script: --with-default-sys-path: empty paths are not allowed." + exit 2 + ;; + + *) + error_msg "$mb_script: --with-default-sys-path: relative paths are not allowed." + exit 2 + esac done @@ -121,7 +138,12 @@ cfgdefs_bootstrap() cfgdefs_output_custom_defs() { - cat "$mb_project_dir/project/config/cfgdefs.in" > cfgdefs.mk + cfgdefs_default_sys_path="${cfgdefs_default_sys_path:-/usr/share/mk}" + + sed \ + -e 's#@cfgdefs_default_sys_path@#'"$cfgdefs_default_sys_path"'#g' \ + "$mb_project_dir/project/config/cfgdefs.in" \ + > cfgdefs.mk } -- cgit v1.2.3