nixpkgs/pkgs/development/libraries/db/generic.nix
Reno Dakota f8f44e1610
Revert "db4: fix configure with llvm"
the configure program fails to compile due to using exit without a
function prototype. the fix should be to patch the configure script.

This reverts commit 227afde6d8.
2024-07-04 03:43:02 +00:00

96 lines
2.5 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{ lib, stdenv, fetchurl, autoreconfHook
, cxxSupport ? true
, compat185 ? true
, dbmSupport ? false
# Options from inherited versions
, version, sha256
, extraPatches ? [ ]
, license ? lib.licenses.sleepycat
, drvArgs ? {}
}:
stdenv.mkDerivation (rec {
pname = "db";
inherit version;
src = fetchurl {
url = "https://download.oracle.com/berkeley-db/${pname}-${version}.tar.gz";
sha256 = sha256;
};
# The provided configure script features `main` returning implicit `int`, which causes
# configure checks to work incorrectly with clang 16.
nativeBuildInputs = [ autoreconfHook ];
patches = extraPatches;
outputs = [ "bin" "out" "dev" ];
# Required when regenerated the configure script to make sure the vendored macros are found.
autoreconfFlags = [ "-fi" "-Iaclocal" "-Iaclocal_java" ];
preAutoreconf = ''
pushd dist
# Upstreams `dist/s_config` cats everything into `aclocal.m4`, but that doesnt work with
# autoreconfHook, so cat `config.m4` to another file. Otherwise, it wont be found by `aclocal`.
cat aclocal/config.m4 >> aclocal/options.m4
'';
# This isnt 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`.
postAutoreconf = ''
(
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
'';
configureFlags =
[
(if cxxSupport then "--enable-cxx" else "--disable-cxx")
(if compat185 then "--enable-compat185" else "--disable-compat185")
]
++ lib.optional dbmSupport "--enable-dbm"
++ lib.optional stdenv.isFreeBSD "--with-pic";
preConfigure = ''
cd build_unix
configureScript=../dist/configure
'';
postInstall = ''
rm -rf $out/docs
'';
enableParallelBuilding = true;
doCheck = true;
checkPhase = ''
make examples_c examples_cxx
'';
meta = with lib; {
homepage = "https://www.oracle.com/database/technologies/related/berkeleydb.html";
description = "Berkeley DB";
license = license;
platforms = platforms.unix;
};
} // drvArgs)