1{ lib, stdenv, fetchurl
2, cxxSupport ? true
3, compat185 ? true
4, dbmSupport ? false
5
6# Options from inherited versions
7, version, sha256
8, extraPatches ? [ ]
9, license ? lib.licenses.sleepycat
10, drvArgs ? {}
11}:
12
13stdenv.mkDerivation (rec {
14 pname = "db";
15 inherit version;
16
17 src = fetchurl {
18 url = "https://download.oracle.com/berkeley-db/${pname}-${version}.tar.gz";
19 sha256 = sha256;
20 };
21
22 patches = extraPatches;
23
24 outputs = [ "bin" "out" "dev" ];
25
26 configureFlags =
27 [
28 (if cxxSupport then "--enable-cxx" else "--disable-cxx")
29 (if compat185 then "--enable-compat185" else "--disable-compat185")
30 ]
31 ++ lib.optional dbmSupport "--enable-dbm"
32 ++ lib.optional stdenv.isFreeBSD "--with-pic";
33
34 preConfigure = ''
35 cd build_unix
36 configureScript=../dist/configure
37 '';
38
39 postInstall = ''
40 rm -rf $out/docs
41 '';
42
43 enableParallelBuilding = true;
44
45 doCheck = true;
46
47 checkPhase = ''
48 make examples_c examples_cxx
49 '';
50
51 meta = with lib; {
52 homepage = "https://www.oracle.com/database/technologies/related/berkeleydb.html";
53 description = "Berkeley DB";
54 license = license;
55 platforms = platforms.unix;
56 };
57} // drvArgs)