summaryrefslogtreecommitdiff
path: root/repo/lmdb
diff options
context:
space:
mode:
Diffstat (limited to 'repo/lmdb')
-rw-r--r--repo/lmdb/cacheflush.patch12
-rw-r--r--repo/lmdb/lmdb-make.patch81
-rw-r--r--repo/lmdb/lmdb.pc11
-rw-r--r--repo/lmdb/lmdb.xibuild38
4 files changed, 142 insertions, 0 deletions
diff --git a/repo/lmdb/cacheflush.patch b/repo/lmdb/cacheflush.patch
new file mode 100644
index 0000000..281a031
--- /dev/null
+++ b/repo/lmdb/cacheflush.patch
@@ -0,0 +1,12 @@
+--- a/mdb.c
++++ b/mdb.c
+@@ -77,8 +77,7 @@
+
+ #if defined(__mips) && defined(__linux)
+ /* MIPS has cache coherency issues, requires explicit cache control */
+-#include <asm/cachectl.h>
+-extern int cacheflush(char *addr, int nbytes, int cache);
++#include <sys/cachectl.h>
+ #define CACHEFLUSH(addr, bytes, cache) cacheflush(addr, bytes, cache)
+ #else
+ #define CACHEFLUSH(addr, bytes, cache)
diff --git a/repo/lmdb/lmdb-make.patch b/repo/lmdb/lmdb-make.patch
new file mode 100644
index 0000000..e053b79
--- /dev/null
+++ b/repo/lmdb/lmdb-make.patch
@@ -0,0 +1,81 @@
+diff --git a/Makefile b/Makefile
+index f254511..949d9ae 100644
+--- a/Makefile
++++ b/Makefile
+@@ -26,6 +26,10 @@ OPT = -O2 -g
+ CFLAGS = $(THREADS) $(OPT) $(W) $(XCFLAGS)
+ LDLIBS =
+ SOLIBS =
++SOVER_MAJ = 0
++SOVER_MIN = 0
++SOVER_PATCH = 0
++SOVERSION = $(SOVER_MAJ).$(SOVER_MIN).$(SOVER_PATCH)
+ SOEXT = .so
+ prefix = /usr/local
+ exec_prefix = $(prefix)
+@@ -38,7 +42,7 @@ mandir = $(datarootdir)/man
+ ########################################################################
+
+ IHDRS = lmdb.h
+-ILIBS = liblmdb.a liblmdb$(SOEXT)
++ILIBS = liblmdb$(SOEXT) liblmdb$(SOEXT).$(SOVERSION) liblmdb$(SOEXT).$(SOVER_MAJ)
+ IPROGS = mdb_stat mdb_copy mdb_dump mdb_load
+ IDOCS = mdb_stat.1 mdb_copy.1 mdb_dump.1 mdb_load.1
+ PROGS = $(IPROGS) mtest mtest2 mtest3 mtest4 mtest5
+@@ -49,13 +53,13 @@ install: $(ILIBS) $(IPROGS) $(IHDRS)
+ 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
++ for f in $(IPROGS); do cp -a $$f $(DESTDIR)$(bindir); done
++ for f in $(ILIBS); do cp -a $$f $(DESTDIR)$(libdir); done
++ for f in $(IHDRS); do cp -a $$f $(DESTDIR)$(includedir); done
++ for f in $(IDOCS); do cp -a $$f $(DESTDIR)$(mandir)/man1; done
+
+ clean:
+- rm -rf $(PROGS) *.[ao] *.[ls]o *~ testdb
++ rm -rf $(PROGS) *.[ao] *.[ls]o* *~ testdb
+
+ test: all
+ rm -rf testdb && mkdir testdb
+@@ -64,20 +68,24 @@ test: all
+ liblmdb.a: mdb.o midl.o
+ $(AR) rs $@ mdb.o midl.o
+
+-liblmdb$(SOEXT): mdb.lo midl.lo
++liblmdb$(SOEXT) liblmdb$(SOEXT).$(SOVER_MAJ): liblmdb$(SOEXT).$(SOVERSION)
++ rm -f $@
++ ln -s $< $@
++
++liblmdb$(SOEXT).$(SOVERSION): mdb.lo midl.lo
+ # $(CC) $(LDFLAGS) -pthread -shared -Wl,-Bsymbolic -o $@ mdb.o midl.o $(SOLIBS)
+- $(CC) $(LDFLAGS) -pthread -shared -o $@ mdb.lo midl.lo $(SOLIBS)
+-
+-mdb_stat: mdb_stat.o liblmdb.a
+-mdb_copy: mdb_copy.o liblmdb.a
+-mdb_dump: mdb_dump.o liblmdb.a
+-mdb_load: mdb_load.o liblmdb.a
+-mtest: mtest.o liblmdb.a
+-mtest2: mtest2.o liblmdb.a
+-mtest3: mtest3.o liblmdb.a
+-mtest4: mtest4.o liblmdb.a
+-mtest5: mtest5.o liblmdb.a
+-mtest6: mtest6.o liblmdb.a
++ $(CC) $(LDFLAGS) -pthread -shared -Wl,-soname,liblmdb$(SOEXT).$(SOVER_MAJ) -o $@ mdb.lo midl.lo $(SOLIBS)
++
++mdb_stat: mdb_stat.o liblmdb.so
++mdb_copy: mdb_copy.o liblmdb.so
++mdb_dump: mdb_dump.o liblmdb.so
++mdb_load: mdb_load.o liblmdb.so
++mtest: mtest.o liblmdb.so
++mtest2: mtest2.o liblmdb.so
++mtest3: mtest3.o liblmdb.so
++mtest4: mtest4.o liblmdb.so
++mtest5: mtest5.o liblmdb.so
++mtest6: mtest6.o liblmdb.so
+
+ mdb.o: mdb.c lmdb.h midl.h
+ $(CC) $(CFLAGS) $(CPPFLAGS) -c mdb.c
diff --git a/repo/lmdb/lmdb.pc b/repo/lmdb/lmdb.pc
new file mode 100644
index 0000000..3362f2c
--- /dev/null
+++ b/repo/lmdb/lmdb.pc
@@ -0,0 +1,11 @@
+prefix=/usr
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: liblmdb
+Description: Lightning Memory-mapped key-value database
+URL: http://symas.com/mdb/
+Version: @@VERSION@@
+Libs: -L${libdir} -llmdb
+Cflags: -I${includedir}
diff --git a/repo/lmdb/lmdb.xibuild b/repo/lmdb/lmdb.xibuild
new file mode 100644
index 0000000..222a220
--- /dev/null
+++ b/repo/lmdb/lmdb.xibuild
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+NAME="lmdb"
+DESC="Lightning Memory-Mapped Database"
+
+MAKEDEPS=""
+
+PKG_VER=0.9.29
+SOURCE="https://github.com/LMDB/lmdb/archive/refs/tags/LMDB_$PKG_VER.tar.gz"
+
+ADDITIONAL="
+cacheflush.patch
+lmdb-make.patch
+lmdb.pc
+"
+
+prepare() {
+ cd libraries/liblmdb
+ apply_patches
+ sed -i "s|@@VERSION@@|$PKG_VER|" -i "$BUILD_ROOT"/*.pc
+}
+
+build() {
+ make CFLAGS="$CFLAGS -fPIC"
+}
+
+check() {
+ LD_LIBRARY_PATH="$PWD" make test
+}
+
+package() {
+ make DESTDIR="$PKG_DEST" prefix=/usr install
+
+ cd $BUILD_ROOT
+ for f in *.pc; do
+ install -Dm0644 $f "$PKG_DEST"/usr/lib/pkgconfig/$f
+ done
+}