summaryrefslogtreecommitdiff
path: root/project/config
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-12-13 03:09:46 -0500
committermidipix <writeonce@midipix.org>2018-12-13 06:40:14 -0500
commit04aa65dc7c08631136f69217e04b407dfd274c8e (patch)
tree8ff713b34b0e4edf06e3983252ca9970a2f98aeb /project/config
parent8e63a67cf02b6f320179726d4953d93a6e06bc7b (diff)
downloadsbpython2-04aa65dc7c08631136f69217e04b407dfd274c8e.tar.bz2
sbpython2-04aa65dc7c08631136f69217e04b407dfd274c8e.tar.xz
project: added and integrated cfghost.sh, refactored cfgdefs.sh accordingly.
Diffstat (limited to 'project/config')
-rw-r--r--project/config/cfgdefs.in2
-rw-r--r--project/config/cfgdefs.sh38
-rw-r--r--project/config/cfghost.sh57
3 files changed, 67 insertions, 30 deletions
diff --git a/project/config/cfgdefs.in b/project/config/cfgdefs.in
deleted file mode 100644
index e771972..0000000
--- a/project/config/cfgdefs.in
+++ /dev/null
@@ -1,2 +0,0 @@
-# pycompile
-PYCOMPILE_CFGHOST = @pycompile_cfghost@
diff --git a/project/config/cfgdefs.sh b/project/config/cfgdefs.sh
index c993def..81a9912 100644
--- a/project/config/cfgdefs.sh
+++ b/project/config/cfgdefs.sh
@@ -10,6 +10,9 @@
# finally, cfgdefs.sh may update the contents of the
# build-time-generated cfgdefs.mk.
+# cfgdefs helper functions
+. "$mb_project_dir/project/config/cfghost.sh"
+
# no custom switches yet
for arg ; do
@@ -21,35 +24,14 @@ for arg ; do
done
-# cfghost: target
-if [ -z "$mb_cfghost" ]; then
- case "$mb_cchost" in
- x86_64-*-linux | x86_64-*-linux-* | x86_64-linux-* )
- mb_cfghost=x86_64-linux ;;
-
- x86_64-*-midipix | x86_64-*-midipix-* | x86_64-midipix-* )
- mb_cfghost=x86_64-midipix ;;
- esac
-fi
-
-
-# cfghost: (native) pycompile
-mb_pycompile_cfghost=$($mb_native_cc -dumpmachine)
-
-case "$mb_pycompile_cfghost" in
- x86_64-*-linux | x86_64-*-linux-* | x86_64-linux-* )
- mb_pycompile_cfghost=x86_64-linux ;;
-
- x86_64-*-midipix | x86_64-*-midipix-* | x86_64-midipix-* )
- mb_pycompile_cfghost=x86_64-midipix ;;
-esac
-
-
-# update cfgdefs.mk
-sed -e 's^@pycompile_cfghost@^'"$mb_pycompile_cfghost"'^g' \
- $mb_project_dir/project/config/cfgdefs.in \
- > $mb_pwd/cfgdefs.mk || exit 2
+cfgdefs_set_cfghost_flavors()
+{
+ cfghost_set_target_cfghost
+ cfghost_set_native_cfghost
+}
+# cfghost
+cfgdefs_set_cfghost_flavors
# system tests: target
mb_cfgdefs_cc=$(make -s -f Makefile.tmp .display-cc)
diff --git a/project/config/cfghost.sh b/project/config/cfghost.sh
new file mode 100644
index 0000000..8e9561e
--- /dev/null
+++ b/project/config/cfghost.sh
@@ -0,0 +1,57 @@
+# cfghost.sh: map the target or native hosts, as reported by
+# the -dumpmachine mechanism of their respective compilers,
+# to project-specific hosts.
+
+# internal variables of interest:
+# mb_internal_cchost: the host reported by -dumpmachine
+# mb_internal_cfghost: the unified, project-specific host name
+# mb_internal_cfgtype: the type of host being test (target/native)
+
+cfghost_internal_test()
+{
+ if [ -z "$mb_internal_cchost" ]; then
+ error_msg 'cfghost_internal_test(): $mb_internal_cchost is empty.'
+ exit 2
+ fi
+
+ if [ -d "$mb_project_dir/config/$mb_internal_cchost" ]; then
+ mb_internal_cfghost=$mb_internal_cchost
+ fi
+
+ if [ -z $mb_internal_cfghost ]; then
+ case $mb_internal_cchost in
+ x86_64-*-linux | x86_64-*-linux-* | x86_64-linux-* )
+ mb_internal_cfghost=x86_64-linux ;;
+
+ x86_64-*-midipix | x86_64-*-midipix-* | x86_64-midipix-* )
+ mb_internal_cfghost=x86_64-midipix ;;
+
+ * )
+ mb_internal_cfghost='any-host' ;;
+ esac
+ fi
+
+ if [ $mb_internal_cfgtype = 'target' ]; then
+ mb_cfghost="$mb_internal_cfghost"
+ else
+ mb_native_cc_cfghost="$mb_internal_cfghost"
+ fi
+}
+
+cfghost_set_target_cfghost()
+{
+ mb_internal_cchost="$mb_cchost"
+ mb_internal_cfghost="$mb_cfghost"
+ mb_internal_cfgtype='target'
+
+ cfghost_internal_test
+}
+
+cfghost_set_native_cfghost()
+{
+ mb_internal_cchost="$mb_native_cc_host"
+ mb_internal_cfghost="$mb_native_cc_cfghost"
+ mb_internal_cfgtype='native'
+
+ cfghost_internal_test
+}