--- libraries/liblmdb/Makefile.orig	2017-01-02 10:53:29.945926753 +0000
+++ libraries/liblmdb/Makefile	2017-01-02 10:55:01.005931451 +0000
@@ -26,6 +26,8 @@
 CFLAGS	= $(THREADS) $(OPT) $(W) $(XCFLAGS)
 LDLIBS	=
 SOLIBS	=
+MAJOR = 0
+MINOR = 9
 SOEXT	= .so
 prefix	= /usr/local
 exec_prefix = $(prefix)
@@ -50,12 +52,15 @@
 	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
+	cp liblmdb.a $(DESTDIR)$(libdir)
+	cp liblmdb.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir) 
+	ln -s liblmdb.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)/liblmdb.so.$(MAJOR)
+	ln -s liblmdb.so.$(MAJOR).$(MINOR) $(DESTDIR)$(libdir)/liblmdb.so
 	for f in $(IHDRS); do cp $$f $(DESTDIR)$(includedir); done
 	for f in $(IDOCS); do cp $$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
@@ -66,7 +71,7 @@
 
 liblmdb$(SOEXT):	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)
+	$(CC) $(LDFLAGS) -pthread -shared -Wl,-soname=$@.$(MAJOR) -o $@.$(MAJOR).$(MINOR) mdb.lo midl.lo $(SOLIBS)
 
 mdb_stat: mdb_stat.o liblmdb.a
 mdb_copy: mdb_copy.o liblmdb.a
