diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/lmdb')
3 files changed, 115 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/lmdb/bin-ext.patch b/nixpkgs/pkgs/development/libraries/lmdb/bin-ext.patch new file mode 100644 index 000000000000..2d5af99772c0 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/lmdb/bin-ext.patch @@ -0,0 +1,21 @@ +diff --git a/libraries/liblmdb/Makefile b/libraries/liblmdb/Makefile +index 612484e..2e6b562 100644 +--- a/libraries/liblmdb/Makefile ++++ b/libraries/liblmdb/Makefile +@@ -27,6 +27,7 @@ CFLAGS = $(THREADS) $(OPT) $(W) $(XCFLAGS) + LDLIBS = + SOLIBS = + SOEXT = .so ++BINEXT = + prefix = /usr/local + exec_prefix = $(prefix) + bindir = $(exec_prefix)/bin +@@ -49,7 +50,7 @@ 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 $(IPROGS); do cp $$f$(BINEXT) $(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 diff --git a/nixpkgs/pkgs/development/libraries/lmdb/default.nix b/nixpkgs/pkgs/development/libraries/lmdb/default.nix new file mode 100644 index 000000000000..a186f2993a46 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/lmdb/default.nix @@ -0,0 +1,68 @@ +{ lib, stdenv, fetchFromGitLab, windows }: + +stdenv.mkDerivation rec { + pname = "lmdb"; + version = "0.9.30"; + + src = fetchFromGitLab { + domain = "git.openldap.org"; + owner = "openldap"; + repo = "openldap"; + rev = "LMDB_${version}"; + sha256 = "sha256-zLa9BtSPzujHAIZKDl69lTo72cI3m/GZejFw5v8bFsg="; + }; + + postUnpack = "sourceRoot=\${sourceRoot}/libraries/liblmdb"; + + patches = [ ./hardcoded-compiler.patch ./bin-ext.patch ]; + patchFlags = [ "-p3" ]; + + outputs = [ "bin" "out" "dev" ]; + + buildInputs = lib.optional stdenv.hostPlatform.isWindows windows.pthreads; + + makeFlags = [ + "prefix=$(out)" + "CC=${stdenv.cc.targetPrefix}cc" + "AR=${stdenv.cc.targetPrefix}ar" + ] + ++ lib.optional stdenv.isDarwin "LDFLAGS=-Wl,-install_name,$(out)/lib/liblmdb.so" + ++ lib.optionals stdenv.hostPlatform.isWindows [ "SOEXT=.dll" "BINEXT=.exe" ]; + + doCheck = true; + checkTarget = "test"; + + postInstall = '' + moveToOutput bin "$bin" + '' + # add lmdb.pc (dynamic only) + + '' + mkdir -p "$dev/lib/pkgconfig" + cat > "$dev/lib/pkgconfig/lmdb.pc" <<EOF + Name: lmdb + Description: ${meta.description} + Version: ${version} + + Cflags: -I$dev/include + Libs: -L$out/lib -llmdb + EOF + + # Expected by Rust libraries. + ln -s lmdb.pc "$dev/lib/pkgconfig/liblmdb.pc" + ''; + + meta = with lib; { + description = "Lightning memory-mapped database"; + longDescription = '' + LMDB is an ultra-fast, ultra-compact key-value embedded data store + developed by Symas for the OpenLDAP Project. It uses memory-mapped files, + so it has the read performance of a pure in-memory database while still + offering the persistence of standard disk-based databases, and is only + limited to the size of the virtual address space. + ''; + homepage = "https://symas.com/lmdb/"; + maintainers = with maintainers; [ jb55 vcunat ]; + license = licenses.openldap; + platforms = platforms.all; + }; +} diff --git a/nixpkgs/pkgs/development/libraries/lmdb/hardcoded-compiler.patch b/nixpkgs/pkgs/development/libraries/lmdb/hardcoded-compiler.patch new file mode 100644 index 000000000000..ddb247b7f113 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/lmdb/hardcoded-compiler.patch @@ -0,0 +1,26 @@ +commit 029031a68873bc3784a8561bd8e049efbd34f9d0 (HEAD) +Author: Vladimír Čunát <vcunat@gmail.com> +Date: Sun Apr 1 11:05:31 2018 +0200 + + make: gcc -> $(CC) + +diff --git a/libraries/liblmdb/Makefile b/libraries/liblmdb/Makefile +index f254511..612484e 100644 +--- a/libraries/liblmdb/Makefile ++++ b/libraries/liblmdb/Makefile +@@ -102,13 +102,13 @@ COV_OBJS=xmdb.o xmidl.o + + coverage: xmtest + for i in mtest*.c [0-9]*.c; do j=`basename \$$i .c`; $(MAKE) $$j.o; \ +- gcc -o x$$j $$j.o $(COV_OBJS) -pthread $(COV_FLAGS); \ ++ $(CC) -o x$$j $$j.o $(COV_OBJS) -pthread $(COV_FLAGS); \ + rm -rf testdb; mkdir testdb; ./x$$j; done + gcov xmdb.c + gcov xmidl.c + + xmtest: mtest.o xmdb.o xmidl.o +- gcc -o xmtest mtest.o xmdb.o xmidl.o -pthread $(COV_FLAGS) ++ $(CC) -o xmtest mtest.o xmdb.o xmidl.o -pthread $(COV_FLAGS) + + xmdb.o: mdb.c lmdb.h midl.h + $(CC) $(CFLAGS) -fPIC $(CPPFLAGS) -O0 $(COV_FLAGS) -c mdb.c -o $@ |