From 5d8f7ae2d3ea618fe88695572b08a43e8195a920 Mon Sep 17 00:00:00 2001 From: midipix Date: Sat, 19 Jun 2021 16:52:38 +0000 Subject: project: pyext: _decimal extension: added refined host configuration. --- project/config/cfgdefs.sh | 30 ++++++++++++++++++++++++++++++ project/pycompile.mk | 3 --- project/variants/3.6.3/pyexts.h | 2 +- project/variants/3.6.3/pyexts.mk | 4 ++-- project/variants/3.7.1/pyexts.h | 2 +- project/variants/3.7.1/pyexts.mk | 4 ++-- 6 files changed, 36 insertions(+), 9 deletions(-) (limited to 'project') diff --git a/project/config/cfgdefs.sh b/project/config/cfgdefs.sh index c04c86d..fc13f41 100644 --- a/project/config/cfgdefs.sh +++ b/project/config/cfgdefs.sh @@ -239,6 +239,11 @@ cfgdefs_perform_common_tests() cfgtest_newline cfgtest_comment 'toolchain' + # math configuration + cfghost_x87_asm= + cfghost_x64_asm= + cfghost_aarch64_types= + # x87 mb_code_snippet='' mb_code_snippet="$mb_code_snippet "'void fn(void)' @@ -247,6 +252,7 @@ cfgdefs_perform_common_tests() if cfgtest_code_snippet_asm "$mb_code_snippet"; then cfgtest_cflags_append '-DHAVE_GCC_ASM_FOR_X87' + cfghost_x87_asm='yes' fi # x64 @@ -256,6 +262,30 @@ cfgdefs_perform_common_tests() if cfgtest_code_snippet_asm "$mb_code_snippet"; then cfgtest_cflags_append '-DHAVE_GCC_ASM_FOR_X64' + cfghost_x64_asm='yes' + fi + + # aarch64 + mb_code_snippet='__uint128_t aarch64_dummy = 0;' + + if cfgtest_code_snippet_asm "$mb_code_snippet"; then + cfgtest_cflags_append '-DHAVE_GCC_UINT128_T' + cfghost_aarch64_types='yes' + fi + + # math configuration selection + if [ $cfghost_aarch64_types = 'yes' ]; then + cfgtest_cflags_append '-DCONFIG_64' + cfgtest_cflags_append '-DANSI' + cfgtest_cflags_append '-DHAVE_UINT128_T' + + elif [ $cfghost_x64_asm = 'yes' ]; then + cfgtest_cflags_append '-DCONFIG_64' + cfgtest_cflags_append '-DASM' + + elif [ $cfghost_x87_asm = 'yes' ]; then + cfgtest_cflags_append '-DCONFIG_32' + cfgtest_cflags_append '-DANSI' fi # IEEE 754: little endian / big endian diff --git a/project/pycompile.mk b/project/pycompile.mk index 314c6d4..074a3ea 100644 --- a/project/pycompile.mk +++ b/project/pycompile.mk @@ -88,9 +88,6 @@ $(PYCOMPILE_DIR)/core/%.o: $(SOURCE_DIR)/%.c $(ALL_HEADERS) $(PYCOMPILE_TAGS) $(PYCOMPILE_DIR)/pyext/obj/%.o: $(SOURCE_DIR)/Modules/%.c $(ALL_HEADERS) $(PYCOMPILE_TAGS) $(NATIVE_CC) -c -o $@ $< $(PYCOMPILE_CFLAGS) -$(PYCOMPILE_DIR)/pyext/obj/_decimal/%.o: NATIVE_CFLAGS += -DUNIVERSAL - - PYCOMPILE_PYEXT_SRCS = \ $(PYEXT_DECIMAL_SRCS) \ $(PYEXT_ELEMENTTREE_SRCS) \ diff --git a/project/variants/3.6.3/pyexts.h b/project/variants/3.6.3/pyexts.h index 0cd5a7e..352bb3d 100644 --- a/project/variants/3.6.3/pyexts.h +++ b/project/variants/3.6.3/pyexts.h @@ -124,7 +124,7 @@ static const struct pyext_meta pyexts[] = { "_curses_panel"), PYEXT_COMMON("_decimal", - "-I$(SOURCE_DIR)/Modules/_decimal/libmpdec -DUNIVERSAL", + "-I$(SOURCE_DIR)/Modules/_decimal/libmpdec", 0, "_decimal/_decimal", "_decimal/libmpdec/basearith", diff --git a/project/variants/3.6.3/pyexts.mk b/project/variants/3.6.3/pyexts.mk index 4cc0eab..753ef69 100644 --- a/project/variants/3.6.3/pyexts.mk +++ b/project/variants/3.6.3/pyexts.mk @@ -1552,8 +1552,8 @@ PYEXT_DECIMAL_SRCS += pyext/obj/_decimal/libmpdec/transpose.c PYEXT_DECIMAL_LOBJS = $(PYEXT_DECIMAL_SRCS:.c=.lo) PYEXT_DECIMAL_OBJS = $(PYEXT_DECIMAL_SRCS:.c=.o) -$(PYEXT_DECIMAL_LOBJS): CFLAGS_CONFIG += -I$(SOURCE_DIR)/Modules/_decimal/libmpdec -DUNIVERSAL -$(PYEXT_DECIMAL_OBJS): CFLAGS_CONFIG += -I$(SOURCE_DIR)/Modules/_decimal/libmpdec -DUNIVERSAL +$(PYEXT_DECIMAL_LOBJS): CFLAGS_CONFIG += -I$(SOURCE_DIR)/Modules/_decimal/libmpdec +$(PYEXT_DECIMAL_OBJS): CFLAGS_CONFIG += -I$(SOURCE_DIR)/Modules/_decimal/libmpdec PYEXT_DECIMAL_SHARED = pyext/_decimal$(PYTHON_SOEXT) PYEXT_DECIMAL_STATIC = pyext/_decimal$(OS_ARCHIVE_EXT) diff --git a/project/variants/3.7.1/pyexts.h b/project/variants/3.7.1/pyexts.h index 40b7aa8..c0e6487 100644 --- a/project/variants/3.7.1/pyexts.h +++ b/project/variants/3.7.1/pyexts.h @@ -130,7 +130,7 @@ static const struct pyext_meta pyexts[] = { "_curses_panel"), PYEXT_COMMON("_decimal", - "-I$(SOURCE_DIR)/Modules/_decimal/libmpdec -DUNIVERSAL", + "-I$(SOURCE_DIR)/Modules/_decimal/libmpdec", 0, "_decimal/_decimal", "_decimal/libmpdec/basearith", diff --git a/project/variants/3.7.1/pyexts.mk b/project/variants/3.7.1/pyexts.mk index 542473b..2cf217d 100644 --- a/project/variants/3.7.1/pyexts.mk +++ b/project/variants/3.7.1/pyexts.mk @@ -1637,8 +1637,8 @@ PYEXT_DECIMAL_SRCS += pyext/obj/_decimal/libmpdec/transpose.c PYEXT_DECIMAL_LOBJS = $(PYEXT_DECIMAL_SRCS:.c=.lo) PYEXT_DECIMAL_OBJS = $(PYEXT_DECIMAL_SRCS:.c=.o) -$(PYEXT_DECIMAL_LOBJS): CFLAGS_CONFIG += -I$(SOURCE_DIR)/Modules/_decimal/libmpdec -DUNIVERSAL -$(PYEXT_DECIMAL_OBJS): CFLAGS_CONFIG += -I$(SOURCE_DIR)/Modules/_decimal/libmpdec -DUNIVERSAL +$(PYEXT_DECIMAL_LOBJS): CFLAGS_CONFIG += -I$(SOURCE_DIR)/Modules/_decimal/libmpdec +$(PYEXT_DECIMAL_OBJS): CFLAGS_CONFIG += -I$(SOURCE_DIR)/Modules/_decimal/libmpdec PYEXT_DECIMAL_SHARED = pyext/_decimal$(PYTHON_SOEXT) PYEXT_DECIMAL_STATIC = pyext/_decimal$(OS_ARCHIVE_EXT) -- cgit v1.2.3