diff options
Diffstat (limited to 'project')
-rw-r--r-- | project/config/cfgdefs.in | 7 | ||||
-rw-r--r-- | project/config/cfgdefs.sh | 47 | ||||
-rw-r--r-- | project/extras.mk | 3 |
3 files changed, 54 insertions, 3 deletions
diff --git a/project/config/cfgdefs.in b/project/config/cfgdefs.in new file mode 100644 index 0000000..7a96696 --- /dev/null +++ b/project/config/cfgdefs.in @@ -0,0 +1,7 @@ +# project-specific configuration +PYTHON_VER = @python_ver@ +PYTHON_MAJOR = @python_major@ +PYTHON_MINOR = @python_minor@ +PYTHON_MICRO = @python_micro@ +PYTHON_SOABI = cpython-$(PYTHON_MAJOR)$(PYTHON_MINOR)-$(CCHOST) + diff --git a/project/config/cfgdefs.sh b/project/config/cfgdefs.sh index 054e536..ad5e9eb 100644 --- a/project/config/cfgdefs.sh +++ b/project/config/cfgdefs.sh @@ -35,6 +35,47 @@ cfgdefs_set_cfghost_flavors() } +cfgdefs_detect_python_version() +{ + mb_internal_verinfo=$(mktemp) + + if [ -z "$mb_internal_verinfo" ]; then + exit 2 + fi + + "$mb_native_cc" -E -dM "$mb_source_dir/Include/patchlevel.h" \ + > "$mb_internal_verinfo" + + python_major=$(grep '#define PY_MAJOR_VERSION ' "$mb_internal_verinfo" | cut -d' ' -f3) + python_minor=$(grep '#define PY_MINOR_VERSION ' "$mb_internal_verinfo" | cut -d' ' -f3) + python_micro=$(grep '#define PY_MICRO_VERSION ' "$mb_internal_verinfo" | cut -d' ' -f3) + + if [ -z "$python_major" ] || [ -z "$python_minor" ] || [ -z "$python_micro" ]; then + error_msg "Could not properly parse Python's patchlevel.h" + exit 2 + fi + + python_ver="$python_major.$python_minor" + + [ -z "$mb_package" ] && mb_package='python'"$python_ver" + [ -z "$mb_nickname" ] && mb_nickname="$mb_package" + [ -z "$mb_pkgname" ] && mb_pkgname="$mb_package" + [ -z "$mb_pkgdesc" ] && mb_pkgdesc="$mb_package" +} + + +cfgdefs_output_custom_defs() +{ + sed \ + -e 's/@python_ver@/'"$python_ver"'/g' \ + -e 's/@python_major@/'"$python_major"'/g' \ + -e 's/@python_minor@/'"$python_minor"'/g' \ + -e 's/@python_micro@/'"$python_micro"'/g' \ + "$mb_project_dir/project/config/cfgdefs.in" \ + >> "$mb_pwd/cfgdefs.mk" +} + + cfgdefs_perform_target_tests() { # init @@ -141,6 +182,12 @@ cfgdefs_perform_native_tests() # cfghost cfgdefs_set_cfghost_flavors +# python version info +cfgdefs_detect_python_version + +# cfgdefs.in --> cfgdefs.mk +cfgdefs_output_custom_defs + # target-specific tests cfgdefs_perform_target_tests diff --git a/project/extras.mk b/project/extras.mk index c120e99..e3a161d 100644 --- a/project/extras.mk +++ b/project/extras.mk @@ -1,7 +1,4 @@ # build info -PYTHON_VER = 2.7 -PYTHON_MAJOR = 2 - CFLAGS_COMMON += -I$(PROJECT_DIR)/profiles CFLAGS_COMMON += -I$(SOURCE_DIR)/Include |