kopia lustrzana https://github.com/micropython/micropython
all: Update extmod, ports, examples to build with new berkeley-db lib.
This provides a MicroPython-specific berkeley-db configuration in extmod/berkeley-db/berkeley_db_config_port.h, and cleans up the include path for this library. Fixes issue #13092. Signed-off-by: Damien George <damien@micropython.org>pull/14099/head
rodzic
305707b281
commit
cd8eea2ae9
|
@ -11,9 +11,10 @@ SRC = btree_c.c btree_py.py
|
||||||
ARCH = x64
|
ARCH = x64
|
||||||
|
|
||||||
BTREE_DIR = $(MPY_DIR)/lib/berkeley-db-1.xx
|
BTREE_DIR = $(MPY_DIR)/lib/berkeley-db-1.xx
|
||||||
BTREE_DEFS = -D__DBINTERFACE_PRIVATE=1 -Dmpool_error="(void)" -Dabort=abort_ "-Dvirt_fd_t=void*" $(BTREE_DEFS_EXTRA)
|
BERKELEY_DB_CONFIG_FILE ?= \"extmod/berkeley-db/berkeley_db_config_port.h\"
|
||||||
CFLAGS += -I$(BTREE_DIR)/PORT/include
|
CFLAGS += -I$(BTREE_DIR)/include
|
||||||
CFLAGS += -Wno-old-style-definition -Wno-sign-compare -Wno-unused-parameter $(BTREE_DEFS)
|
CFLAGS += -DBERKELEY_DB_CONFIG_FILE=$(BERKELEY_DB_CONFIG_FILE)
|
||||||
|
CFLAGS += -Wno-old-style-definition -Wno-sign-compare -Wno-unused-parameter
|
||||||
|
|
||||||
SRC += $(addprefix $(realpath $(BTREE_DIR))/,\
|
SRC += $(addprefix $(realpath $(BTREE_DIR))/,\
|
||||||
btree/bt_close.c \
|
btree/bt_close.c \
|
||||||
|
|
|
@ -39,6 +39,10 @@ void abort_(void) {
|
||||||
nlr_raise(mp_obj_new_exception(mp_load_global(MP_QSTR_RuntimeError)));
|
nlr_raise(mp_obj_new_exception(mp_load_global(MP_QSTR_RuntimeError)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int puts(const char *s) {
|
||||||
|
return mp_printf(&mp_plat_print, "%s\n", s);
|
||||||
|
}
|
||||||
|
|
||||||
int native_errno;
|
int native_errno;
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
int *__errno_location (void)
|
int *__errno_location (void)
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
// Berkeley-db configuration.
|
||||||
|
|
||||||
|
#define __DBINTERFACE_PRIVATE 1
|
||||||
|
#define mpool_error printf
|
||||||
|
#define abort abort_
|
||||||
|
#define virt_fd_t void*
|
||||||
|
|
||||||
|
#ifdef MICROPY_BERKELEY_DB_DEFPSIZE
|
||||||
|
#define DEFPSIZE MICROPY_BERKELEY_DB_DEFPSIZE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MICROPY_BERKELEY_DB_MINCACHE
|
||||||
|
#define MINCACHE MICROPY_BERKELEY_DB_MINCACHE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
__attribute__((noreturn)) void abort_(void);
|
|
@ -132,27 +132,27 @@ if(MICROPY_PY_BTREE)
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(micropy_extmod_btree PRIVATE
|
target_include_directories(micropy_extmod_btree PRIVATE
|
||||||
${MICROPY_LIB_BERKELEY_DIR}/PORT/include
|
${MICROPY_LIB_BERKELEY_DIR}/include
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if(NOT BERKELEY_DB_CONFIG_FILE)
|
||||||
|
set(BERKELEY_DB_CONFIG_FILE "${MICROPY_DIR}/extmod/berkeley-db/berkeley_db_config_port.h")
|
||||||
|
endif()
|
||||||
|
|
||||||
target_compile_definitions(micropy_extmod_btree PRIVATE
|
target_compile_definitions(micropy_extmod_btree PRIVATE
|
||||||
__DBINTERFACE_PRIVATE=1
|
BERKELEY_DB_CONFIG_FILE="${BERKELEY_DB_CONFIG_FILE}"
|
||||||
mpool_error=printf
|
|
||||||
abort=abort_
|
|
||||||
"virt_fd_t=void*"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# The include directories and compile definitions below are needed to build
|
# The include directories and compile definitions below are needed to build
|
||||||
# modbtree.c and should be added to the main MicroPython target.
|
# modbtree.c and should be added to the main MicroPython target.
|
||||||
|
|
||||||
list(APPEND MICROPY_INC_CORE
|
list(APPEND MICROPY_INC_CORE
|
||||||
"${MICROPY_LIB_BERKELEY_DIR}/PORT/include"
|
"${MICROPY_LIB_BERKELEY_DIR}/include"
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND MICROPY_DEF_CORE
|
list(APPEND MICROPY_DEF_CORE
|
||||||
MICROPY_PY_BTREE=1
|
MICROPY_PY_BTREE=1
|
||||||
__DBINTERFACE_PRIVATE=1
|
BERKELEY_DB_CONFIG_FILE="${BERKELEY_DB_CONFIG_FILE}"
|
||||||
"virt_fd_t=void*"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
list(APPEND MICROPY_SOURCE_EXTMOD
|
list(APPEND MICROPY_SOURCE_EXTMOD
|
||||||
|
|
|
@ -381,8 +381,10 @@ endif
|
||||||
|
|
||||||
ifeq ($(MICROPY_PY_BTREE),1)
|
ifeq ($(MICROPY_PY_BTREE),1)
|
||||||
BTREE_DIR = lib/berkeley-db-1.xx
|
BTREE_DIR = lib/berkeley-db-1.xx
|
||||||
BTREE_DEFS = -D__DBINTERFACE_PRIVATE=1 -Dmpool_error=printf -Dabort=abort_ "-Dvirt_fd_t=void*" $(BTREE_DEFS_EXTRA)
|
BERKELEY_DB_CONFIG_FILE ?= \"extmod/berkeley-db/berkeley_db_config_port.h\"
|
||||||
INC += -I$(TOP)/$(BTREE_DIR)/PORT/include
|
CFLAGS_EXTMOD += -DBERKELEY_DB_CONFIG_FILE=$(BERKELEY_DB_CONFIG_FILE)
|
||||||
|
CFLAGS_EXTMOD += $(BTREE_DEFS_EXTRA)
|
||||||
|
INC += -I$(TOP)/$(BTREE_DIR)/include
|
||||||
SRC_THIRDPARTY_C += $(addprefix $(BTREE_DIR)/,\
|
SRC_THIRDPARTY_C += $(addprefix $(BTREE_DIR)/,\
|
||||||
btree/bt_close.c \
|
btree/bt_close.c \
|
||||||
btree/bt_conv.c \
|
btree/bt_conv.c \
|
||||||
|
@ -401,9 +403,7 @@ SRC_THIRDPARTY_C += $(addprefix $(BTREE_DIR)/,\
|
||||||
)
|
)
|
||||||
CFLAGS_EXTMOD += -DMICROPY_PY_BTREE=1
|
CFLAGS_EXTMOD += -DMICROPY_PY_BTREE=1
|
||||||
# we need to suppress certain warnings to get berkeley-db to compile cleanly
|
# we need to suppress certain warnings to get berkeley-db to compile cleanly
|
||||||
# and we have separate BTREE_DEFS so the definitions don't interfere with other source code
|
$(BUILD)/$(BTREE_DIR)/%.o: CFLAGS += -Wno-old-style-definition -Wno-sign-compare -Wno-unused-parameter -Wno-deprecated-non-prototype -Wno-unknown-warning-option
|
||||||
$(BUILD)/$(BTREE_DIR)/%.o: CFLAGS += -Wno-old-style-definition -Wno-sign-compare -Wno-unused-parameter -Wno-deprecated-non-prototype -Wno-unknown-warning-option $(BTREE_DEFS)
|
|
||||||
$(BUILD)/extmod/modbtree.o: CFLAGS += $(BTREE_DEFS)
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
|
@ -57,8 +57,8 @@
|
||||||
#undef CIRCLEQ_INSERT_TAIL
|
#undef CIRCLEQ_INSERT_TAIL
|
||||||
#undef CIRCLEQ_REMOVE
|
#undef CIRCLEQ_REMOVE
|
||||||
|
|
||||||
#include <db.h>
|
#include "berkeley-db/db.h"
|
||||||
#include <../../btree/btree.h>
|
#include "berkeley-db/btree.h"
|
||||||
|
|
||||||
typedef struct _mp_obj_btree_t {
|
typedef struct _mp_obj_btree_t {
|
||||||
mp_obj_base_t base;
|
mp_obj_base_t base;
|
||||||
|
|
|
@ -38,7 +38,7 @@ MICROPY_ROM_TEXT_COMPRESSION ?= 1
|
||||||
MICROPY_PY_SSL = 1
|
MICROPY_PY_SSL = 1
|
||||||
MICROPY_SSL_AXTLS = 1
|
MICROPY_SSL_AXTLS = 1
|
||||||
AXTLS_DEFS_EXTRA = -Dabort=abort_ -DRT_MAX_PLAIN_LENGTH=1024 -DRT_EXTRA=4096
|
AXTLS_DEFS_EXTRA = -Dabort=abort_ -DRT_MAX_PLAIN_LENGTH=1024 -DRT_EXTRA=4096
|
||||||
BTREE_DEFS_EXTRA = -DDEFPSIZE=1024 -DMINCACHE=3
|
BTREE_DEFS_EXTRA = -DMICROPY_BERKELEY_DB_DEFPSIZE=1024 -DMICROPY_BERKELEY_DB_MINCACHE=3
|
||||||
|
|
||||||
FROZEN_MANIFEST ?= boards/manifest.py
|
FROZEN_MANIFEST ?= boards/manifest.py
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue