summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDamien George <damien@micropython.org>2024-03-08 22:43:52 +1100
committerDamien George <damien@micropython.org>2024-03-16 12:19:12 +1100
commitcd8eea2ae99542257a33b29c9dfdc02b63fc1bd6 (patch)
treeae413d9d6f48dc7589bb197879c465ecbf1ff075 /examples
parent305707b281bc64aacb154e0165bd0a9ca3fedfe8 (diff)
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>
Diffstat (limited to 'examples')
-rw-r--r--examples/natmod/btree/Makefile7
-rw-r--r--examples/natmod/btree/btree_c.c4
2 files changed, 8 insertions, 3 deletions
diff --git a/examples/natmod/btree/Makefile b/examples/natmod/btree/Makefile
index d795102b4..218ec15a2 100644
--- a/examples/natmod/btree/Makefile
+++ b/examples/natmod/btree/Makefile
@@ -11,9 +11,10 @@ SRC = btree_c.c btree_py.py
ARCH = x64
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)
-CFLAGS += -I$(BTREE_DIR)/PORT/include
-CFLAGS += -Wno-old-style-definition -Wno-sign-compare -Wno-unused-parameter $(BTREE_DEFS)
+BERKELEY_DB_CONFIG_FILE ?= \"extmod/berkeley-db/berkeley_db_config_port.h\"
+CFLAGS += -I$(BTREE_DIR)/include
+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))/,\
btree/bt_close.c \
diff --git a/examples/natmod/btree/btree_c.c b/examples/natmod/btree/btree_c.c
index 3c60e41b2..bbf51c731 100644
--- a/examples/natmod/btree/btree_c.c
+++ b/examples/natmod/btree/btree_c.c
@@ -39,6 +39,10 @@ void abort_(void) {
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;
#if defined(__linux__)
int *__errno_location (void)