summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2024-04-03 04:38:22 +0000
committermidipix <writeonce@midipix.org>2024-04-03 04:54:32 +0000
commite7c427461d3b12ac3feff3e6eb1c7bb92194b63d (patch)
tree8fa74c8b6f05e4d098e9cd4d1e18afa5cfe9694b
parentbf57369b2ce86e9ce327e57a599c5dfcd02d8d06 (diff)
downloadsbmake-e7c427461d3b12ac3feff3e6eb1c7bb92194b63d.tar.bz2
sbmake-e7c427461d3b12ac3feff3e6eb1c7bb92194b63d.tar.xz
project: custom cfgdefs.sh: added --with-default-sys-path support.
-rw-r--r--project/config/cfgdefs.in10
-rw-r--r--project/config/cfgdefs.sh24
-rw-r--r--project/extras.mk3
3 files changed, 34 insertions, 3 deletions
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
}
diff --git a/project/extras.mk b/project/extras.mk
index a5357a0..79b0dd2 100644
--- a/project/extras.mk
+++ b/project/extras.mk
@@ -1,5 +1,4 @@
-SYS_MK_DIR = $(DATADIR)/mk
-CFLAGS_CONFIG += -D_PATH_DEFSYSPATH=\"$(SYS_MK_DIR)\"
+SYS_MK_DIR = $(DATADIR)/mk
MK_FILES = \
$(SOURCE_DIR)/mk/ChangeLog \