summaryrefslogtreecommitdiff
path: root/project/config
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-12-14 14:03:13 -0500
committermidipix <writeonce@midipix.org>2018-12-18 20:38:38 -0500
commitf8089b2b4ab3b13077cf2e0e1328622ddc002bb2 (patch)
tree54e8ad9c48d5c685981d77ca6a9f928dfe4af4c0 /project/config
parent5dc983925380bb06a4d6d0d660e2c8b80a71eac4 (diff)
downloadsbpython3-f8089b2b4ab3b13077cf2e0e1328622ddc002bb2.tar.bz2
sbpython3-f8089b2b4ab3b13077cf2e0e1328622ddc002bb2.tar.xz
project: imported the custom config bits from sbpython2.
Diffstat (limited to 'project/config')
-rw-r--r--project/config/cfgdefs.sh105
-rw-r--r--project/config/cfgdefs.usage0
-rw-r--r--project/config/cfghost.sh57
3 files changed, 162 insertions, 0 deletions
diff --git a/project/config/cfgdefs.sh b/project/config/cfgdefs.sh
new file mode 100644
index 0000000..3b6a806
--- /dev/null
+++ b/project/config/cfgdefs.sh
@@ -0,0 +1,105 @@
+# in projects where [ $mb_use_custom_cfgdefs = yes ],
+# cfgdefs.sh is invoked from within ./configure via
+# . $mb_project_dir/project/cfgdefs.sh
+
+# a successful return from cfgdefs.sh will be followed
+# by a second invocation of the config_copy() function,
+# reflecting any changes to common config variables
+# made by cfgdefs.sh.
+
+# finally, cfgdefs.sh may update the contents of the
+# config-time generated cfgdefs.mk.
+
+
+# cfgdefs helper functions
+. "$mb_project_dir/project/config/cfghost.sh"
+
+
+# sofort's config test framework
+. "$mb_project_dir/sofort/cfgtest.sh"
+
+
+for arg ; do
+ case "$arg" in
+ *)
+ error_msg ${arg#}: "unsupported config argument."
+ exit 2
+ esac
+done
+
+
+cfgdefs_set_cfghost_flavors()
+{
+ cfghost_set_target_cfghost
+ cfghost_set_native_cfghost
+}
+
+
+cfgdefs_perform_target_tests()
+{
+ # init
+ cfgtest_target_section
+
+ # headers
+ cfgtest_header_absence 'stropts.h'
+
+ # openssl
+ mb_cfgtest_headers='openssl/x509.h'
+
+ cfgtest_interface_presence 'X509_NAME_ENTRY_set' \
+ && cfgtest_cflags_append '-DOPENSSL_VERSION_1_1'
+
+ # ncurses: python refers to members of typedef struct _win_st WINDOW
+ cfgtest_cflags_append '-DNCURSES_INTERNALS'
+
+ # ncurses libs
+ mb_ncurses_libs='-lpanelw -lncursesw'
+ mb_ncurses_tinfo='-ltinfo'
+
+ cfgtest_library_presence $mb_ncurses_tinfo \
+ && mb_ncurses_libs="$mb_ncurses_libs $mb_ncurses_tinfo"
+
+ mb_cfgtest_makevar='LDFLAGS_NCURSES_LIBS'
+ cfgtest_makevar_append $mb_ncurses_libs
+
+ # pretty cfgdefs.mk
+ cfgtest_newline
+}
+
+
+cfgdefs_perform_native_tests()
+{
+ # init
+ cfgtest_native_section
+
+ # headers
+ cfgtest_header_absence 'stropts.h'
+
+ # ncurses: python refers to members of typedef struct _win_st WINDOW
+ cfgtest_cflags_append '-DNCURSES_INTERNALS'
+
+ # ncurses libs
+ mb_ncurses_libs='-lpanelw -lncursesw'
+ mb_ncurses_tinfo='-ltinfo'
+
+ cfgtest_library_presence $mb_ncurses_tinfo \
+ && mb_ncurses_libs="$mb_ncurses_libs $mb_ncurses_tinfo"
+
+ cfgtest_ldflags_append $mb_ncurses_libs
+
+ # pretty cfgdefs.mk
+ cfgtest_newline
+}
+
+
+# cfghost
+cfgdefs_set_cfghost_flavors
+
+# target-specific tests
+cfgdefs_perform_target_tests
+
+# native system tests
+cfgdefs_perform_native_tests
+
+# all done
+return 0
diff --git a/project/config/cfgdefs.usage b/project/config/cfgdefs.usage
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/project/config/cfgdefs.usage
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
+}