File tree 7 files changed +40
-19
lines changed
7 files changed +40
-19
lines changed Original file line number Diff line number Diff line change @@ -11,9 +11,10 @@ SRC = btree_c.c btree_py.py
11
11
ARCH = x64
12
12
13
13
BTREE_DIR = $(MPY_DIR ) /lib/berkeley-db-1.xx
14
- BTREE_DEFS = -D__DBINTERFACE_PRIVATE=1 -Dmpool_error="(void)" -Dabort=abort_ "-Dvirt_fd_t=void*" $(BTREE_DEFS_EXTRA )
15
- CFLAGS += -I$(BTREE_DIR ) /PORT/include
16
- CFLAGS += -Wno-old-style-definition -Wno-sign-compare -Wno-unused-parameter $(BTREE_DEFS )
14
+ BERKELEY_DB_CONFIG_FILE ?= \"extmod/berkeley-db/berkeley_db_config_port.h\"
15
+ CFLAGS += -I$(BTREE_DIR ) /include
16
+ CFLAGS += -DBERKELEY_DB_CONFIG_FILE=$(BERKELEY_DB_CONFIG_FILE )
17
+ CFLAGS += -Wno-old-style-definition -Wno-sign-compare -Wno-unused-parameter
17
18
18
19
SRC += $(addprefix $(realpath $(BTREE_DIR ) ) /,\
19
20
btree/bt_close.c \
Original file line number Diff line number Diff line change @@ -39,6 +39,10 @@ void abort_(void) {
39
39
nlr_raise (mp_obj_new_exception (mp_load_global (MP_QSTR_RuntimeError )));
40
40
}
41
41
42
+ int puts (const char * s ) {
43
+ return mp_printf (& mp_plat_print , "%s\n" , s );
44
+ }
45
+
42
46
int native_errno ;
43
47
#if defined(__linux__ )
44
48
int * __errno_location (void )
Original file line number Diff line number Diff line change
1
+ // Berkeley-db configuration.
2
+
3
+ #define __DBINTERFACE_PRIVATE 1
4
+ #define mpool_error printf
5
+ #define abort abort_
6
+ #define virt_fd_t void*
7
+
8
+ #ifdef MICROPY_BERKELEY_DB_DEFPSIZE
9
+ #define DEFPSIZE MICROPY_BERKELEY_DB_DEFPSIZE
10
+ #endif
11
+
12
+ #ifdef MICROPY_BERKELEY_DB_MINCACHE
13
+ #define MINCACHE MICROPY_BERKELEY_DB_MINCACHE
14
+ #endif
15
+
16
+ __attribute__((noreturn )) void abort_ (void );
Original file line number Diff line number Diff line change @@ -132,27 +132,27 @@ if(MICROPY_PY_BTREE)
132
132
)
133
133
134
134
target_include_directories (micropy_extmod_btree PRIVATE
135
- ${MICROPY_LIB_BERKELEY_DIR} /PORT/ include
135
+ ${MICROPY_LIB_BERKELEY_DIR} /include
136
136
)
137
137
138
+ if (NOT BERKELEY_DB_CONFIG_FILE)
139
+ set (BERKELEY_DB_CONFIG_FILE "${MICROPY_DIR} /extmod/berkeley-db/berkeley_db_config_port.h" )
140
+ endif ()
141
+
138
142
target_compile_definitions (micropy_extmod_btree PRIVATE
139
- __DBINTERFACE_PRIVATE=1
140
- mpool_error=printf
141
- abort=abort_
142
- "virt_fd_t=void*"
143
+ BERKELEY_DB_CONFIG_FILE="${BERKELEY_DB_CONFIG_FILE} "
143
144
)
144
145
145
146
# The include directories and compile definitions below are needed to build
146
147
# modbtree.c and should be added to the main MicroPython target.
147
148
148
149
list (APPEND MICROPY_INC_CORE
149
- "${MICROPY_LIB_BERKELEY_DIR} /PORT/ include"
150
+ "${MICROPY_LIB_BERKELEY_DIR} /include"
150
151
)
151
152
152
153
list (APPEND MICROPY_DEF_CORE
153
154
MICROPY_PY_BTREE=1
154
- __DBINTERFACE_PRIVATE=1
155
- "virt_fd_t=void*"
155
+ BERKELEY_DB_CONFIG_FILE="${BERKELEY_DB_CONFIG_FILE} "
156
156
)
157
157
158
158
list (APPEND MICROPY_SOURCE_EXTMOD
Original file line number Diff line number Diff line change @@ -381,8 +381,10 @@ endif
381
381
382
382
ifeq ($(MICROPY_PY_BTREE ) ,1)
383
383
BTREE_DIR = lib/berkeley-db-1.xx
384
- BTREE_DEFS = -D__DBINTERFACE_PRIVATE=1 -Dmpool_error=printf -Dabort=abort_ "-Dvirt_fd_t=void*" $(BTREE_DEFS_EXTRA )
385
- INC += -I$(TOP ) /$(BTREE_DIR ) /PORT/include
384
+ BERKELEY_DB_CONFIG_FILE ?= \"extmod/berkeley-db/berkeley_db_config_port.h\"
385
+ CFLAGS_EXTMOD += -DBERKELEY_DB_CONFIG_FILE=$(BERKELEY_DB_CONFIG_FILE )
386
+ CFLAGS_EXTMOD += $(BTREE_DEFS_EXTRA )
387
+ INC += -I$(TOP ) /$(BTREE_DIR ) /include
386
388
SRC_THIRDPARTY_C += $(addprefix $(BTREE_DIR ) /,\
387
389
btree/bt_close.c \
388
390
btree/bt_conv.c \
@@ -401,9 +403,7 @@ SRC_THIRDPARTY_C += $(addprefix $(BTREE_DIR)/,\
401
403
)
402
404
CFLAGS_EXTMOD += -DMICROPY_PY_BTREE=1
403
405
# we need to suppress certain warnings to get berkeley-db to compile cleanly
404
- # and we have separate BTREE_DEFS so the definitions don't interfere with other source code
405
- $(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 )
406
- $(BUILD ) /extmod/modbtree.o : CFLAGS += $(BTREE_DEFS )
406
+ $(BUILD ) /$(BTREE_DIR ) /% .o : CFLAGS += -Wno-old-style-definition -Wno-sign-compare -Wno-unused-parameter -Wno-deprecated-non-prototype -Wno-unknown-warning-option
407
407
endif
408
408
409
409
# ###############################################################################
Original file line number Diff line number Diff line change 57
57
#undef CIRCLEQ_INSERT_TAIL
58
58
#undef CIRCLEQ_REMOVE
59
59
60
- #include <db.h>
61
- #include <../../ btree/btree.h>
60
+ #include "berkeley-db/db.h"
61
+ #include "berkeley-db/ btree.h"
62
62
63
63
typedef struct _mp_obj_btree_t {
64
64
mp_obj_base_t base ;
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ MICROPY_ROM_TEXT_COMPRESSION ?= 1
38
38
MICROPY_PY_SSL = 1
39
39
MICROPY_SSL_AXTLS = 1
40
40
AXTLS_DEFS_EXTRA = -Dabort=abort_ -DRT_MAX_PLAIN_LENGTH=1024 -DRT_EXTRA=4096
41
- BTREE_DEFS_EXTRA = -DDEFPSIZE =1024 -DMINCACHE =3
41
+ BTREE_DEFS_EXTRA = -DMICROPY_BERKELEY_DB_DEFPSIZE =1024 -DMICROPY_BERKELEY_DB_MINCACHE =3
42
42
43
43
FROZEN_MANIFEST ?= boards/manifest.py
44
44
You can’t perform that action at this time.
0 commit comments