2022-05-18 14:49:53 +00:00
|
|
|
{ lib, stdenv, fetchFromGitLab, windows }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "lmdb";
|
2024-06-05 15:53:02 +00:00
|
|
|
version = "0.9.33";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-05-03 20:48:10 +00:00
|
|
|
src = fetchFromGitLab {
|
|
|
|
domain = "git.openldap.org";
|
|
|
|
owner = "openldap";
|
|
|
|
repo = "openldap";
|
2020-04-24 23:36:52 +00:00
|
|
|
rev = "LMDB_${version}";
|
2024-06-05 15:53:02 +00:00
|
|
|
sha256 = "sha256-5IBoJ3jaNXao5zVzb0LDM8RGid4s8DGQpjVqrVPLpXQ=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
postUnpack = "sourceRoot=\${sourceRoot}/libraries/liblmdb";
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
patches = [ ./hardcoded-compiler.patch ./bin-ext.patch ];
|
2020-04-24 23:36:52 +00:00
|
|
|
patchFlags = [ "-p3" ];
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
# Don't attempt the .so if static, as it would fail.
|
|
|
|
postPatch = lib.optionalString stdenv.hostPlatform.isStatic ''
|
|
|
|
sed 's/^ILIBS\>.*/ILIBS = liblmdb.a/' -i Makefile
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
outputs = [ "bin" "out" "dev" ];
|
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
buildInputs = lib.optional stdenv.hostPlatform.isWindows windows.pthreads;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
makeFlags = [
|
|
|
|
"prefix=$(out)"
|
|
|
|
"CC=${stdenv.cc.targetPrefix}cc"
|
|
|
|
"AR=${stdenv.cc.targetPrefix}ar"
|
|
|
|
]
|
2024-09-26 11:04:55 +00:00
|
|
|
++ lib.optional stdenv.hostPlatform.isDarwin "LDFLAGS=-Wl,-install_name,$(out)/lib/liblmdb.so"
|
2022-05-18 14:49:53 +00:00
|
|
|
++ lib.optionals stdenv.hostPlatform.isWindows [ "SOEXT=.dll" "BINEXT=.exe" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
doCheck = true;
|
2021-05-28 09:39:13 +00:00
|
|
|
checkTarget = "test";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
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
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
# Expected by Rust libraries.
|
|
|
|
ln -s lmdb.pc "$dev/lib/pkgconfig/liblmdb.pc"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
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.
|
|
|
|
'';
|
2021-05-03 20:48:10 +00:00
|
|
|
homepage = "https://symas.com/lmdb/";
|
2024-02-29 20:09:43 +00:00
|
|
|
changelog = "https://git.openldap.org/openldap/openldap/-/blob/LMDB_${version}/libraries/liblmdb/CHANGES";
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = with maintainers; [ jb55 vcunat ];
|
|
|
|
license = licenses.openldap;
|
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|