diff -ru sdb-0e133f1739191c7a9f06bf930e974edd712e034f.orig/bindings/vala/types/Makefile sdb-0e133f1739191c7a9f06bf930e974edd712e034f.new/bindings/vala/types/Makefile
--- sdb-0e133f1739191c7a9f06bf930e974edd712e034f.orig/bindings/vala/types/Makefile	2015-10-11 22:22:05.456429687 +0200
+++ sdb-0e133f1739191c7a9f06bf930e974edd712e034f.new/bindings/vala/types/Makefile	2015-10-11 22:48:11.390407953 +0200
@@ -5,7 +5,7 @@
 INSTALL_DATA?=install -m 644
 
 VALAC?=valac
-VFILES+=hash.vala 
+VFILES+=hash.vala
 VFILES+=stack.vala stackiterator.vala
 VFILES+=array.vala arrayiterator.vala
 VFILES+=list.vala listiterator.vala 
@@ -13,7 +13,7 @@
 OFILES=$(subst vala,o,${VFILES})
 CFILES=$(subst vala,c,${VFILES})
 VFLAGS+=-X -I../../../src
-VFLAGS+=../sdb.vapi 
+VFLAGS+=../sdb.vapi
 CFLAGS+=-I../../../src
 LDFLAGS+=../../../src/libsdb.a
 CFLAGS+=$(shell pkg-config --cflags gobject-2.0)
@@ -52,27 +52,27 @@
 	${CC} -o test ${OFILES} ${LDFLAGS} main.o
 
 install-dirs:
-	mkdir -p ${PFX}/include
-	mkdir -p ${PFX}/lib/pkgconfig
-	mkdir -p ${PFX}/share/vala/vapi
+	mkdir -p ${DESTDIR}${INCDIR}
+	mkdir -p ${DESTDIR}${LIBDIR}/pkgconfig
+	mkdir -p ${DESTDIR}${DATADIR}/vala/vapi
 
 install: install-dirs
-	$(INSTALL_DATA) sdbtypes.h ${PFX}/include
-	$(INSTALL_DATA) libsdbtypes.a ${PFX}/lib
-	$(INSTALL_DATA) sdbtypes.pc ${PFX}/lib/pkgconfig
-	$(INSTALL_DATA) sdbtypes.vapi ${PFX}/share/vala/vapi
+	$(INSTALL_DATA) sdbtypes.h ${DESTDIR}${INCDIR}
+	$(INSTALL_DATA) libsdbtypes.a ${DESTDIR}${LIBDIR}
+	$(INSTALL_DATA) sdbtypes.pc ${DESTDIR}${LIBDIR}/pkgconfig
+	$(INSTALL_DATA) sdbtypes.vapi ${DESTDIR}${DATADIR}/vala/vapi
 
 symstall: install-dirs
-	ln -fs ${PWD}/sdbtypes.h ${PFX}/include/sdbtypes.h
-	ln -fs ${PWD}/libsdbtypes.a ${PFX}/lib/libsdbtypes.a
-	ln -fs ${PWD}/sdbtypes.pc ${PFX}/lib/pkgconfig/sdbtypes.pc
-	ln -fs ${PWD}/sdbtypes.vapi ${PFX}/share/vala/vapi/sdbtypes.vapi
+	ln -fs ${PWD}/sdbtypes.h ${DESTDIR}${INCDIR}/sdbtypes.h
+	ln -fs ${PWD}/libsdbtypes.a ${DESTDIR}${LIBDIR}/libsdbtypes.a
+	ln -fs ${PWD}/sdbtypes.pc ${DESTDIR}${LIBDIR}/pkgconfig/sdbtypes.pc
+	ln -fs ${PWD}/sdbtypes.vapi ${DESTDIR}${DATADIR}/vala/vapi/sdbtypes.vapi
 
 uninstall deinstall:
-	rm -f ${PFX}/include/sdbtypes.h
-	rm -f ${PFX}/lib/libsdbtypes.a
-	rm -f ${PFX}/lib/pkgconfig/sdbtypes.pc
-	rm -f ${PFX}/share/vala/vapi/sdbtypes.vapi
+	rm -f ${DESTDIR}${INCDIR}/sdbtypes.h
+	rm -f ${DESTDIR}${LIBDIR}/libsdbtypes.a
+	rm -f ${DESTDIR}${LIBDIR}/pkgconfig/sdbtypes.pc
+	rm -f ${DESTDIR}${DATADIR}/vala/vapi/sdbtypes.vapi
 
 clean:
 	rm -f *.c *.o sdbtypes.vapi sdbtypes.h
diff -ru sdb-0e133f1739191c7a9f06bf930e974edd712e034f.orig/config.mk sdb-0e133f1739191c7a9f06bf930e974edd712e034f.new/config.mk
--- sdb-0e133f1739191c7a9f06bf930e974edd712e034f.orig/config.mk	2015-10-11 22:22:05.459429643 +0200
+++ sdb-0e133f1739191c7a9f06bf930e974edd712e034f.new/config.mk	2015-10-11 23:15:44.157908758 +0200
@@ -1,5 +1,11 @@
-DESTDIR?=
 PREFIX?=/usr
+BINDIR=${PREFIX}/bin
+LIBDIR=${PREFIX}/lib
+DATADIR=${PREFIX}/share
+INCDIR=${PREFIX}/include
+VAPIDIR=${DATADIR}/vala/vapi/
+MANDIR=${DATADIR}/man/man1
+
 
 SDBVER=0.9.8
 
diff -ru sdb-0e133f1739191c7a9f06bf930e974edd712e034f.orig/Makefile sdb-0e133f1739191c7a9f06bf930e974edd712e034f.new/Makefile
--- sdb-0e133f1739191c7a9f06bf930e974edd712e034f.orig/Makefile	2015-10-11 22:22:05.456429687 +0200
+++ sdb-0e133f1739191c7a9f06bf930e974edd712e034f.new/Makefile	2015-10-12 01:25:30.705812752 +0200
@@ -4,8 +4,6 @@
 PWD=$(shell pwd)
 PFX=${DESTDIR}${PREFIX}
 HGFILES=`find sdb-${SDBVER} -type f | grep -v hg | grep -v swp`
-VAPIDIR=$(PFX)/share/vala/vapi/
-MANDIR=${PFX}/share/man/man1
 MKDIR=mkdir
 
 all: pkgconfig src/sdb_version.h
@@ -66,78 +64,79 @@
 	rm -rf sdb-${SDBVER}
 
 install-dirs:
-	$(INSTALL_DIR) ${MANDIR} ${PFX}/lib/pkgconfig ${PFX}/bin 
-	$(INSTALL_DIR) ${PFX}/share/vala/vapi ${PFX}/include/sdb
+	$(INSTALL_DIR) ${DESTDIR}${MANDIR} ${DESTDIR}${LIBDIR}/pkgconfig ${DESTDIR}${BINDIR} 
+	$(INSTALL_DIR) ${DESTDIR}${DATADIR}/vala/vapi ${DESTDIR}${INCDIR}/sdb
 
 INCFILES=src/sdb.h src/sdb_version.h src/cdb.h src/ht.h src/types.h
 INCFILES+=src/ls.h src/cdb_make.h src/buffer.h src/config.h
 
 install: pkgconfig install-dirs
-	$(INSTALL_MAN) src/sdb.1 ${MANDIR}
-	$(INSTALL_LIB) src/libsdb.${EXT_SO} ${PFX}/lib
-	$(INSTALL_DATA) src/libsdb.a ${PFX}/lib
+	$(INSTALL_MAN) src/sdb.1 ${DESTDIR}${MANDIR}
+	$(INSTALL_LIB) src/libsdb.${EXT_SO} ${DESTDIR}${LIBDIR}
+	$(INSTALL_DATA) src/libsdb.a ${DESTDIR}${LIBDIR}
 	-if [ "$(EXT_SO)" != "$(SOVER)" ]; then \
-	  cd $(PFX)/lib ; \
+	  cd ${DESTDIR}${LIBDIR} ; \
 	  mv libsdb.$(EXT_SO) libsdb.$(SOVER) ; \
 	  ln -s libsdb.$(SOVER) libsdb.$(EXT_SO) ; \
+	  ln -s libsdb.$(SOVER) libsdb.$(EXT_SO).$(SOVERSION) ; \
 	fi
-	$(INSTALL_DATA) $(INCFILES) ${PFX}/include/sdb
-	$(INSTALL_PROGRAM) src/sdb ${PFX}/bin
+	$(INSTALL_DATA) $(INCFILES) ${DESTDIR}${INCDIR}/sdb
+	$(INSTALL_PROGRAM) src/sdb ${DESTDIR}${BINDIR}
 ifeq ($(BUILD_MEMCACHE),1)
-	$(INSTALL_DATA) memcache/libmcsdb.a ${PFX}/lib
-	$(INSTALL_DATA) memcache/mcsdb.h ${PFX}/include/sdb
-	$(INSTALL_PROGRAM) memcache/mcsdbd ${PFX}/bin
-	$(INSTALL_PROGRAM) memcache/mcsdbc ${PFX}/bin
-	$(INSTALL_DATA) pkgconfig/mcsdb.pc ${PFX}/lib/pkgconfig
+	$(INSTALL_DATA) memcache/libmcsdb.a ${DESTDIR}${LIBDIR}
+	$(INSTALL_DATA) memcache/mcsdb.h ${DESTDIR}${INCDIR}/sdb
+	$(INSTALL_PROGRAM) memcache/mcsdbd ${DESTDIR}${BINDIR}
+	$(INSTALL_PROGRAM) memcache/mcsdbc ${DESTDIR}${BINDIR}
+	$(INSTALL_DATA) pkgconfig/mcsdb.pc ${DESTDIR}${LIBDIR}/pkgconfig
 endif
-	$(INSTALL_DATA) pkgconfig/sdb.pc ${PFX}/lib/pkgconfig
+	$(INSTALL_DATA) pkgconfig/sdb.pc ${DESTDIR}${LIBDIR}/pkgconfig
 ifneq (${HAVE_VALA},)
-	$(INSTALL_DATA) ${VALADIR}/sdb.vapi ${PFX}/share/vala/vapi
-	cd ${VALADIR}/types && ${MAKE} install PFX=${PFX}
+	$(INSTALL_DATA) ${VALADIR}/sdb.vapi ${DESTDIR}${DATADIR}/vala/vapi
+	cd ${VALADIR}/types && ${MAKE} install DESTDIR=${DESTDIR} PREFIX=${PREFIX}
 ifeq ($(BUILD_MEMCACHE),1)
-	$(INSTALL_DATA) ${VALADIR}/mcsdb.vapi ${PFX}/share/vala/vapi
+	$(INSTALL_DATA) ${VALADIR}/mcsdb.vapi ${DESTDIR}${DATADIR}/vala/vapi
 endif
 endif
 
 deinstall uninstall:
-	rm -rf ${PFX}/include/sdb
-	rm -f ${PFX}/bin/sdb
-	rm -f ${PFX}/bin/mcsdbc
-	rm -f ${PFX}/bin/mcsdbd
-	rm -f ${PFX}/lib/libsdb.*
-	rm -f ${PFX}/lib/libmcsdb.a
-	rm -f ${PFX}/lib/pkgconfig/sdb.pc
-	rm -f ${PFX}/lib/pkgconfig/mcsdb.pc
-	rm -f ${MANDIR}/sdb.1
+	rm -rf ${DESTDIR}${INCDIR}/sdb
+	rm -f ${DESTDIR}${BINDIR}/sdb
+	rm -f ${DESTDIR}${BINDIR}/mcsdbc
+	rm -f ${DESTDIR}${BINDIR}/mcsdbd
+	rm -f ${DESTDIR}${LIBDIR}/libsdb.*
+	rm -f ${DESTDIR}${LIBDIR}/libmcsdb.a
+	rm -f ${DESTDIR}${LIBDIR}/pkgconfig/sdb.pc
+	rm -f ${DESTDIR}${LIBDIR}/pkgconfig/mcsdb.pc
+	rm -f ${DESTDIR}${MANDIR}/sdb.1
 ifneq (${HAVE_VALA},)
-	rm -f ${PFX}/share/vala/vapi/sdb.vapi 
-	rm -f ${PFX}/share/vala/vapi/mcsdb.vapi 
-	cd ${VALADIR}/types && ${MAKE} uninstall PFX=${PFX}
+	rm -f ${DESTDIR}${DATADIR}/vala/vapi/sdb.vapi
+	rm -f ${DESTDIR}${DATADIR}/vala/vapi/mcsdb.vapi
+	cd ${VALADIR}/types && ${MAKE} uninstall DESTDIR=${DESTDIR} PREFIX=${PREFIX}
 endif
 
 symstall: install-dirs
 	cd src ; for a in libsdb.* ; do \
-		ln -fs ${PWD}/src/$$a ${PFX}/lib/$$a ; done
-	ln -fs ${PWD}/src/sdb.1 ${MANDIR}/sdb.1
-	ln -fs ${PWD}/src/sdb ${PFX}/bin
-	ln -fs ${PWD}/src/sdb.h ${PFX}/include/sdb
-	ln -fs ${PWD}/src/sdb_version.h ${PFX}/include/sdb
-	ln -fs ${PWD}/src/cdb.h ${PFX}/include/sdb
-	ln -fs ${PWD}/src/ht.h ${PFX}/include/sdb
-	ln -fs ${PWD}/src/types.h ${PFX}/include/sdb
-	ln -fs ${PWD}/src/ls.h ${PFX}/include/sdb
-	ln -fs ${PWD}/src/cdb_make.h ${PFX}/include/sdb
-	ln -fs ${PWD}/src/buffer.h ${PFX}/include/sdb
-	ln -fs ${PWD}/src/config.h ${PFX}/include/sdb
-	ln -fs ${PWD}/bindings/vala/sdb.pc ${PFX}/lib/pkgconfig
-	ln -fs ${PWD}/bindings/vala/mcsdb.pc ${PFX}/lib/pkgconfig
+		ln -fs ${PWD}/src/$$a ${DESTDIR}${LIBDIR}/$$a ; done
+	ln -fs ${PWD}/src/sdb.1 ${DESTDIR}${MANDIR}/sdb.1
+	ln -fs ${PWD}/src/sdb ${DESTDIR}${BINDIR}
+	ln -fs ${PWD}/src/sdb.h ${DESTDIR}${INCDIR}/sdb
+	ln -fs ${PWD}/src/sdb_version.h ${DESTDIR}${INCDIR}/sdb
+	ln -fs ${PWD}/src/cdb.h ${DESTDIR}${INCDIR}/sdb
+	ln -fs ${PWD}/src/ht.h ${DESTDIR}${INCDIR}/sdb
+	ln -fs ${PWD}/src/types.h ${DESTDIR}${INCDIR}/sdb
+	ln -fs ${PWD}/src/ls.h ${DESTDIR}${INCDIR}/sdb
+	ln -fs ${PWD}/src/cdb_make.h ${DESTDIR}${INCDIR}/sdb
+	ln -fs ${PWD}/src/buffer.h ${DESTDIR}${INCDIR}/sdb
+	ln -fs ${PWD}/src/config.h ${DESTDIR}${INCDIR}/sdb
+	ln -fs ${PWD}/bindings/vala/sdb.pc ${DESTDIR}${LIBDIR}/pkgconfig
+	ln -fs ${PWD}/bindings/vala/mcsdb.pc ${DESTDIR}${LIBDIR}/pkgconfig
 ifneq (${HAVE_VALA},)
-	$(MKDIR) -p $(VAPIDIR)
-	ln -fs ${PWD}/bindings/vala/sdb.vapi $(VAPIDIR)
-	ln -fs ${PWD}/bindings/vala/mcsdb.vapi $(VAPIDIR)
-	ln -fs ${PWD}/bindings/vala/sdb.vapi $(VAPIDIR)
-	ln -fs ${PWD}/bindings/vala/mcsdb.vapi $(VAPIDIR)
-	cd ${VALADIR}/types && ${MAKE} symstall PFX=${PFX}
+	$(MKDIR) -p ${DESTDIR}$(VAPIDIR)
+	ln -fs ${PWD}/bindings/vala/sdb.vapi ${DESTDIR}$(VAPIDIR)
+	ln -fs ${PWD}/bindings/vala/mcsdb.vapi ${DESTDIR}$(VAPIDIR)
+	ln -fs ${PWD}/bindings/vala/sdb.vapi ${DESTDIR}$(VAPIDIR)
+	ln -fs ${PWD}/bindings/vala/mcsdb.vapi ${DESTDIR}$(VAPIDIR)
+	cd ${VALADIR}/types && ${MAKE} symstall DESTDIR=${DESTDIR} PREFIX=${PREFIX}
 endif
 
 # windows compiler prefix
