The update to lmdb-1.0.0 introduces a major incompatibility. The old and the new formats are not compatible and the new code can't read old databases. So the update below also builds and packages the old mdb_dump-0.9 code so that people can dump their old databases to a textual representation that can then be fed to the new mdb_load(1) program.
All consumers still build on arm64. I have cc'd the maintainers of the consumers of the lmdb port, even though I'm not sure which ports will need manual dump/loads. Make sure you have proper backups in case the migration process breaks and you need to go back to the previous code. I'd really love some input from anyone going who went from through the migration, whatever amount of actions you needed. Thanks Stuart for the heads-up and the links: https://marc.info/?l=postfix-users&m=178300663467720&w=2 (https://marc.info/?l=postfix-users&m=178300663467720&q=p5) https://github.com/LMDB/lmdb/commit/b7c68db29c33a26d92f6c0cdae7550211350b5fe Index: Makefile =================================================================== RCS file: /home/cvs/ports/databases/lmdb/Makefile,v diff -u -p -r1.18 Makefile --- Makefile 14 Sep 2025 16:27:47 -0000 1.18 +++ Makefile 3 Jul 2026 12:55:21 -0000 @@ -1,11 +1,13 @@ COMMENT = Symas Lightning Memory-Mapped Database -VERSION = 0.9.33 +VERSION = 1.0.0 +OVERSION = 0.9.35 DISTNAME = openldap-LMDB_${VERSION} PKGNAME = lmdb-${VERSION} +DISTFILES.old = openldap-LMDB_${OVERSION}${EXTRACT_SUFX} -SHARED_LIBS += lmdb 0.0 # 0.0 +SHARED_LIBS += lmdb 1.0 CATEGORIES = databases @@ -19,23 +21,43 @@ PERMIT_PACKAGE = Yes WANTLIB += c pthread SITES = https://git.openldap.org/openldap/openldap/-/archive/LMDB_${VERSION}/ +SITES.old = https://git.openldap.org/openldap/openldap/-/archive/LMDB_${OVERSION}/ +PORTROACH= site:https://github.com/LMDB/lmdb/archive/ DEBUG_PACKAGES = ${BUILD_PACKAGES} USE_GMAKE = Yes -MAKE_FLAGS = CC="${CC}" XCFLAGS="${CFLAGS}" \ - SHARED_VERSION_MAJOR=${LIBlmdb_VERSION:R} \ - SHARED_VERSION_MINOR=${LIBlmdb_VERSION:E} +MAKE_FLAGS = CC="${CC}" OPT="${CFLAGS}" LDL="" \ + LIBVER=${LIBlmdb_VERSION:R} \ + ABIVER=${LIBlmdb_VERSION:E} \ + mandir=${PREFIX}/man WRKDIST = ${WRKDIR}/openldap-LMDB_${VERSION}/libraries/liblmdb +OWRKDIST = ${WRKDIST}/lmdb-0.9 SUBST_VARS += VERSION -# lmdb.pc: https://bugs.openldap.org/show_bug.cgi?id=10203 +post-extract: + mv ${WRKDIR}/openldap-LMDB_${OVERSION}/libraries/liblmdb ${OWRKDIST} + +post-build: + cd ${OWRKDIST}; \ + ${SETENV} ${MAKE_ENV} ${MAKE_PROGRAM} ${MAKE_FLAGS} \ + -f ${MAKE_FILE} mdb_dump mtest + +post-test: + cd ${OWRKDIST}; \ + mkdir -p testdb testrestore; \ + ./mtest; \ + ./mdb_dump testdb | ${WRKBUILD}/mdb_load testrestore + post-install: - ! test -e ${PREFIX}/lib/pkgconfig/lmdb.pc # fail if shipped upstream + ${INSTALL_DATA} ${WRKBUILD}/lmdb.pc ${PREFIX}/lib/pkgconfig/lmdb.pc + ${INSTALL_PROGRAM} ${OWRKDIST}/mdb_dump ${PREFIX}/bin/mdb_dump-0.9 + ${INSTALL_DATA} ${OWRKDIST}/mdb_dump.1 ${PREFIX}/man/man1/mdb_dump-0.9.1 ${SUBST_CMD} -c -o ${SHAREOWN} -g ${SHAREGRP} -m ${SHAREMODE} \ ${FILESDIR}/lmdb.pc.in ${PREFIX}/lib/pkgconfig/lmdb.pc + -diff -u ${WRKBUILD}/lmdb.pc ${PREFIX}/lib/pkgconfig/lmdb.pc .include <bsd.port.mk> Index: distinfo =================================================================== RCS file: /home/cvs/ports/databases/lmdb/distinfo,v diff -u -p -r1.7 distinfo --- distinfo 14 Sep 2025 16:27:47 -0000 1.7 +++ distinfo 3 Jul 2026 12:55:21 -0000 @@ -1,2 +1,4 @@ -SHA256 (openldap-LMDB_0.9.33.tar.gz) = R2gB9SOciMfeYcM5BQKl0Tll7O3vgBBbX7D8uDc9HlM= -SIZE (openldap-LMDB_0.9.33.tar.gz) = 149281 +SHA256 (openldap-LMDB_0.9.35.tar.gz) = DQkManyFpPMaKrDXNFVMIQl/JHUjk6GQsOUZlrCPSMQ= +SHA256 (openldap-LMDB_1.0.0.tar.gz) = ph3tEr2cZwA4t3SD3aE7UGhKk6ER5TQh37l5Ykrp9y4= +SIZE (openldap-LMDB_0.9.35.tar.gz) = 149788 +SIZE (openldap-LMDB_1.0.0.tar.gz) = 178085 Index: files/lmdb.pc.in =================================================================== RCS file: /home/cvs/ports/databases/lmdb/files/lmdb.pc.in,v diff -u -p -r1.2 lmdb.pc.in --- files/lmdb.pc.in 14 Jul 2025 11:29:55 -0000 1.2 +++ files/lmdb.pc.in 3 Jul 2026 12:55:21 -0000 @@ -1,12 +1,12 @@ prefix=${TRUEPREFIX} -exec_prefix=${prefix} -libdir=${prefix}/lib -includedir=${prefix}/include +exec_prefix=${TRUEPREFIX} +includedir=${TRUEPREFIX}/include +libdir=${TRUEPREFIX}/lib -Name: lmdb -Description: Lightning memory-mapped database: key-value data store -URL: https://www.symas.com/symas-embedded-database-lmdb +Name: lmdb (OpenLDAP) +Description: OpenLDAP Lightning Memory Mapped Database library +URL: https://www.openldap.org Version: ${VERSION} +Cflags: -pthread -I${includedir} Libs: -L${libdir} -llmdb Libs.private: -lpthread -Cflags: -I${includedir} Index: patches/patch-Makefile =================================================================== RCS file: /home/cvs/ports/databases/lmdb/patches/patch-Makefile,v diff -u -p -r1.2 patch-Makefile --- patches/patch-Makefile 10 Mar 2022 00:04:05 -0000 1.2 +++ patches/patch-Makefile 3 Jul 2026 12:55:21 -0000 @@ -1,7 +1,7 @@ Index: Makefile --- Makefile.orig +++ Makefile -@@ -18,21 +18,22 @@ +@@ -18,11 +18,10 @@ # There may be other macros in mdb.c of interest. You should # read mdb.c before changing any of them. # @@ -12,43 +12,18 @@ Index: Makefile THREADS = -pthread -OPT = -O2 -g CFLAGS = $(THREADS) $(OPT) $(W) $(XCFLAGS) - LDLIBS = - SOLIBS = --SOEXT = .so --prefix = /usr/local -+SHARED_VERSION_MAJOR ?= 0 -+SHARED_VERSION_MINOR ?= 0 -+SOEXT = .so.$(SHARED_VERSION_MAJOR).$(SHARED_VERSION_MINOR) -+prefix = ${LOCALBASE}/ - exec_prefix = $(prefix) - bindir = $(exec_prefix)/bin - libdir = $(exec_prefix)/lib - includedir = $(prefix)/include --datarootdir = $(prefix)/share -+datarootdir = $(prefix) - mandir = $(datarootdir)/man + LDFLAGS = $(THREADS) + LDLIBS = +@@ -69,11 +68,7 @@ install: $(ILIBS) $(IPROGS) $(IHDRS) + mkdir -p $(DESTDIR)$(mandir)/man1 + for f in $(IPROGS); do cp $$f $(DESTDIR)$(bindir); done + for f in $(ILIBS); do cp $$f $(DESTDIR)$(libdir); done +- for f in $(ILIBS2); do cp $$f $(DESTDIR)$(libdir); \ +- i=`basename -s .$(ABIVER) $$f`; rm -f $(DESTDIR)$(libdir)/$$i; \ +- ln -s $$f $(DESTDIR)$(libdir)/$$i; \ +- i=`basename -s .$(LIBVER) $$i`; rm -f $(DESTDIR)$(libdir)/$$i; \ +- ln -s $$f $(DESTDIR)$(libdir)/$$i; done ++ for f in $(ILIBS2); do cp $$f $(DESTDIR)$(libdir); done + for f in $(IHDRS); do cp $$f $(DESTDIR)$(includedir); done + for f in $(IDOCS); do cp $$f $(DESTDIR)$(mandir)/man1; done - ######################################################################## -@@ -45,14 +46,14 @@ PROGS = $(IPROGS) mtest mtest2 mtest3 mtest4 mtest5 - all: $(ILIBS) $(PROGS) - - install: $(ILIBS) $(IPROGS) $(IHDRS) -- mkdir -p $(DESTDIR)$(bindir) -- mkdir -p $(DESTDIR)$(libdir) -- mkdir -p $(DESTDIR)$(includedir) -- mkdir -p $(DESTDIR)$(mandir)/man1 -- for f in $(IPROGS); do cp $$f $(DESTDIR)$(bindir); done -- for f in $(ILIBS); do cp $$f $(DESTDIR)$(libdir); done -- for f in $(IHDRS); do cp $$f $(DESTDIR)$(includedir); done -- for f in $(IDOCS); do cp $$f $(DESTDIR)$(mandir)/man1; done -+ ${BSD_INSTALL_DATA_DIR} $(DESTDIR)$(bindir) -+ ${BSD_INSTALL_DATA_DIR} $(DESTDIR)$(libdir) -+ ${BSD_INSTALL_DATA_DIR} $(DESTDIR)$(includedir) -+ ${BSD_INSTALL_DATA_DIR} $(DESTDIR)$(mandir)/man1 -+ for f in $(IPROGS); do ${BSD_INSTALL_PROGRAM} $$f $(DESTDIR)$(bindir); done -+ for f in $(ILIBS); do ${BSD_INSTALL_DATA} $$f $(DESTDIR)$(libdir); done -+ for f in $(IHDRS); do ${BSD_INSTALL_DATA} $$f $(DESTDIR)$(includedir); done -+ for f in $(IDOCS); do ${BSD_INSTALL_MAN} $$f $(DESTDIR)$(mandir)/man1; done - - clean: - rm -rf $(PROGS) *.[ao] *.[ls]o *~ testdb Index: patches/patch-lmdb-0_9_mdb_c =================================================================== RCS file: patches/patch-lmdb-0_9_mdb_c diff -N patches/patch-lmdb-0_9_mdb_c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-lmdb-0_9_mdb_c 3 Jul 2026 12:55:21 -0000 @@ -0,0 +1,11 @@ +Index: lmdb-0.9/mdb.c +--- lmdb-0.9/mdb.c.orig ++++ lmdb-0.9/mdb.c +@@ -5069,6 +5069,7 @@ mdb_env_open(MDB_env *env, const char *path, unsigned + /* silently ignore WRITEMAP when we're only getting read access */ + flags &= ~MDB_WRITEMAP; + } else { ++ flags |= MDB_WRITEMAP; + if (!((env->me_free_pgs = mdb_midl_alloc(MDB_IDL_UM_MAX)) && + (env->me_dirty_list = calloc(MDB_IDL_UM_SIZE, sizeof(MDB_ID2))))) + rc = ENOMEM; Index: patches/patch-mdb_c =================================================================== RCS file: /home/cvs/ports/databases/lmdb/patches/patch-mdb_c,v diff -u -p -r1.11 patch-mdb_c --- patches/patch-mdb_c 14 Sep 2025 16:27:47 -0000 1.11 +++ patches/patch-mdb_c 3 Jul 2026 12:55:21 -0000 @@ -3,11 +3,19 @@ enforce MDB_WRITEMAP, because we have no Index: mdb.c --- mdb.c.orig +++ mdb.c -@@ -5055,6 +5055,7 @@ mdb_env_open(MDB_env *env, const char *path, unsigned +@@ -2331,6 +2331,7 @@ mdb_dlist_free(MDB_txn *txn) + #if MDB_RPAGE_CACHE + #if defined(MDB_VL32) || ((MDB_RPAGE_CACHE) & 2) /* Always remap */ + #define MDB_REMAPPING(flags) 1 ++#error "MDB_REMAPPING is incompatible with MDB_WRITEMAP" + #else + #define MDB_REMAPPING(flags) ((flags) & MDB_REMAP_CHUNKS) + #endif +@@ -6288,6 +6289,7 @@ mdb_env_open(MDB_env *env, const char *path, unsigned /* silently ignore WRITEMAP when we're only getting read access */ flags &= ~MDB_WRITEMAP; } else { + flags |= MDB_WRITEMAP; + /* WRITEMAP has a dummy element to match dirty_room = 1 */ + size_t dl_size = (flags & MDB_WRITEMAP) ? 2 : MDB_IDL_UM_SIZE; if (!((env->me_free_pgs = mdb_midl_alloc(MDB_IDL_UM_MAX)) && - (env->me_dirty_list = calloc(MDB_IDL_UM_SIZE, sizeof(MDB_ID2))))) - rc = ENOMEM; Index: pkg/MESSAGE =================================================================== RCS file: pkg/MESSAGE diff -N pkg/MESSAGE --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ pkg/MESSAGE 3 Jul 2026 12:55:21 -0000 @@ -0,0 +1,3 @@ +LMDB 1.0 is an incompatible update from LMDB 0.9. Existing databases +have to be converted from the old to the new format using the +mdb_dump-0.9(1) and mdb_load(1) commands provided in this package. Index: pkg/PLIST =================================================================== RCS file: /home/cvs/ports/databases/lmdb/pkg/PLIST,v diff -u -p -r1.4 PLIST --- pkg/PLIST 22 Apr 2024 17:50:04 -0000 1.4 +++ pkg/PLIST 3 Jul 2026 12:55:21 -0000 @@ -1,5 +1,7 @@ @bin bin/mdb_copy +@bin bin/mdb_drop @bin bin/mdb_dump +@bin bin/mdb_dump-0.9 @bin bin/mdb_load @bin bin/mdb_stat include/lmdb.h @@ -7,6 +9,8 @@ include/lmdb.h @lib lib/liblmdb.so.${LIBlmdb_VERSION} lib/pkgconfig/lmdb.pc @man man/man1/mdb_copy.1 +@man man/man1/mdb_drop.1 +@man man/man1/mdb_dump-0.9.1 @man man/man1/mdb_dump.1 @man man/man1/mdb_load.1 @man man/man1/mdb_stat.1 -- jca
