2023-07-01 17:55:49 +00:00
|
|
|
|
{ lib, stdenv, fetchurl, autoreconfHook
|
2014-01-31 09:25:49 +00:00
|
|
|
|
, cxxSupport ? true
|
|
|
|
|
, compat185 ? true
|
2016-11-16 21:22:10 +00:00
|
|
|
|
, dbmSupport ? false
|
2014-01-31 09:25:49 +00:00
|
|
|
|
|
|
|
|
|
# Options from inherited versions
|
|
|
|
|
, version, sha256
|
2018-07-21 00:44:44 +00:00
|
|
|
|
, extraPatches ? [ ]
|
2021-01-21 17:00:13 +00:00
|
|
|
|
, license ? lib.licenses.sleepycat
|
2016-02-07 16:20:07 +00:00
|
|
|
|
, drvArgs ? {}
|
2014-01-31 09:25:49 +00:00
|
|
|
|
}:
|
|
|
|
|
|
2016-02-07 16:20:07 +00:00
|
|
|
|
stdenv.mkDerivation (rec {
|
2021-12-25 05:22:05 +00:00
|
|
|
|
pname = "db";
|
|
|
|
|
inherit version;
|
2014-01-31 09:25:49 +00:00
|
|
|
|
|
|
|
|
|
src = fetchurl {
|
2021-12-25 05:22:05 +00:00
|
|
|
|
url = "https://download.oracle.com/berkeley-db/${pname}-${version}.tar.gz";
|
2014-01-31 09:25:49 +00:00
|
|
|
|
sha256 = sha256;
|
|
|
|
|
};
|
2014-03-25 01:01:24 +00:00
|
|
|
|
|
2023-07-01 17:55:49 +00:00
|
|
|
|
# The provided configure script features `main` returning implicit `int`, which causes
|
|
|
|
|
# configure checks to work incorrectly with clang 16.
|
2023-07-06 22:45:12 +00:00
|
|
|
|
nativeBuildInputs = [ autoreconfHook ];
|
2023-07-01 17:55:49 +00:00
|
|
|
|
|
2014-01-31 09:25:49 +00:00
|
|
|
|
patches = extraPatches;
|
|
|
|
|
|
2018-05-22 13:47:28 +00:00
|
|
|
|
outputs = [ "bin" "out" "dev" ];
|
2018-04-16 12:10:42 +00:00
|
|
|
|
|
2023-07-01 17:55:49 +00:00
|
|
|
|
# Required when regenerated the configure script to make sure the vendored macros are found.
|
2023-07-06 22:45:12 +00:00
|
|
|
|
autoreconfFlags = [ "-fi" "-Iaclocal" "-Iaclocal_java" ];
|
2023-07-01 17:55:49 +00:00
|
|
|
|
|
2023-07-06 22:45:12 +00:00
|
|
|
|
preAutoreconf = ''
|
2023-07-01 17:55:49 +00:00
|
|
|
|
pushd dist
|
|
|
|
|
# Upstream’s `dist/s_config` cats everything into `aclocal.m4`, but that doesn’t work with
|
|
|
|
|
# autoreconfHook, so cat `config.m4` to another file. Otherwise, it won’t be found by `aclocal`.
|
|
|
|
|
cat aclocal/config.m4 >> aclocal/options.m4
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
# This isn’t pretty. The version information is kept separate from the configure script.
|
|
|
|
|
# After the configure script is regenerated, the version information has to be replaced with the
|
|
|
|
|
# contents of `dist/RELEASE`.
|
2023-07-06 22:45:12 +00:00
|
|
|
|
postAutoreconf = ''
|
2023-07-01 17:55:49 +00:00
|
|
|
|
(
|
|
|
|
|
declare -a vars=(
|
|
|
|
|
"DB_VERSION_FAMILY"
|
|
|
|
|
"DB_VERSION_RELEASE"
|
|
|
|
|
"DB_VERSION_MAJOR"
|
|
|
|
|
"DB_VERSION_MINOR"
|
|
|
|
|
"DB_VERSION_PATCH"
|
|
|
|
|
"DB_VERSION_STRING"
|
|
|
|
|
"DB_VERSION_FULL_STRING"
|
|
|
|
|
"DB_VERSION_UNIQUE_NAME"
|
|
|
|
|
"DB_VERSION"
|
|
|
|
|
)
|
|
|
|
|
source RELEASE
|
|
|
|
|
for var in "''${vars[@]}"; do
|
|
|
|
|
sed -e "s/__EDIT_''${var}__/''${!var}/g" -i configure
|
|
|
|
|
done
|
|
|
|
|
)
|
|
|
|
|
popd
|
|
|
|
|
'';
|
|
|
|
|
|
2016-11-16 21:22:10 +00:00
|
|
|
|
configureFlags =
|
|
|
|
|
[
|
|
|
|
|
(if cxxSupport then "--enable-cxx" else "--disable-cxx")
|
|
|
|
|
(if compat185 then "--enable-compat185" else "--disable-compat185")
|
|
|
|
|
]
|
2021-01-21 17:00:13 +00:00
|
|
|
|
++ lib.optional dbmSupport "--enable-dbm"
|
2024-07-04 03:35:35 +00:00
|
|
|
|
++ lib.optional stdenv.isFreeBSD "--with-pic";
|
2014-01-31 09:25:49 +00:00
|
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
|
cd build_unix
|
|
|
|
|
configureScript=../dist/configure
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
|
rm -rf $out/docs
|
|
|
|
|
'';
|
|
|
|
|
|
2019-03-11 20:11:12 +00:00
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
|
|
2016-11-13 21:48:52 +00:00
|
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
|
|
checkPhase = ''
|
|
|
|
|
make examples_c examples_cxx
|
|
|
|
|
'';
|
|
|
|
|
|
2021-01-21 17:00:13 +00:00
|
|
|
|
meta = with lib; {
|
2022-10-15 01:37:04 +00:00
|
|
|
|
homepage = "https://www.oracle.com/database/technologies/related/berkeleydb.html";
|
2014-01-31 09:25:49 +00:00
|
|
|
|
description = "Berkeley DB";
|
|
|
|
|
license = license;
|
|
|
|
|
platforms = platforms.unix;
|
|
|
|
|
};
|
2024-07-04 03:35:35 +00:00
|
|
|
|
} // drvArgs)
|