Skip to content

Commit 337111b

Browse files
committed
py: Support to build berkeley db 1.85 and "btree" module.
1 parent 06b783c commit 337111b

3 files changed

Lines changed: 29 additions & 0 deletions

File tree

py/builtin.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ extern const mp_obj_module_t mp_module_lwip;
113113
extern const mp_obj_module_t mp_module_websocket;
114114
extern const mp_obj_module_t mp_module_webrepl;
115115
extern const mp_obj_module_t mp_module_framebuf;
116+
extern const mp_obj_module_t mp_module_btree;
116117

117118
// extmod functions
118119
MP_DECLARE_CONST_FUN_OBJ(pyb_mount_obj);

py/objmodule.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,9 @@ STATIC const mp_rom_map_elem_t mp_builtin_module_table[] = {
205205
#if MICROPY_PY_FRAMEBUF
206206
{ MP_ROM_QSTR(MP_QSTR_framebuf), MP_ROM_PTR(&mp_module_framebuf) },
207207
#endif
208+
#if MICROPY_PY_BTREE
209+
{ MP_ROM_QSTR(MP_QSTR_btree), MP_ROM_PTR(&mp_module_btree) },
210+
#endif
208211

209212
// extra builtin modules as defined by a port
210213
MICROPY_PORT_BUILTIN_MODULES

py/py.mk

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ endif
1616
# some code is performance bottleneck and compiled with other optimization options
1717
CSUPEROPT = -O3
1818

19+
INC += -I../lib
1920
INC += -I../lib/netutils
2021

2122
ifeq ($(MICROPY_PY_USSL),1)
@@ -63,6 +64,30 @@ SRC_MOD += $(LWIP_DIR)/netif/slipif.c
6364
endif
6465
endif
6566

67+
ifeq ($(MICROPY_PY_BTREE),1)
68+
BTREE_DIR = lib/berkeley-db-1.xx
69+
CFLAGS_MOD += -D__DBINTERFACE_PRIVATE=1
70+
INC += -I../$(BTREE_DIR)/PORT/include
71+
SRC_MOD += extmod/modbtree.c
72+
SRC_MOD += $(addprefix $(BTREE_DIR)/,\
73+
btree/bt_close.c \
74+
btree/bt_conv.c \
75+
btree/bt_debug.c \
76+
btree/bt_delete.c \
77+
btree/bt_get.c \
78+
btree/bt_open.c \
79+
btree/bt_overflow.c \
80+
btree/bt_page.c \
81+
btree/bt_put.c \
82+
btree/bt_search.c \
83+
btree/bt_seq.c \
84+
btree/bt_split.c \
85+
btree/bt_utils.c \
86+
mpool/mpool.c \
87+
)
88+
CFLAGS_MOD += -DMICROPY_PY_BTREE=1
89+
endif
90+
6691
# py object files
6792
PY_O_BASENAME = \
6893
mpstate.o \

0 commit comments

Comments
 (0)