nixpkgs/pkgs/development/libraries/ldb/default.nix
Alejandro Angulo 4c296f58df
ldb: copy cross fix from tevent
Saw the following while building on an x86_64-linux host for an
armv6l-linux target:

```
Testing pyembed configuration: Could not build a python embedded interpreter
```

I dug into the config log and this seemed to be cause of the issue:

```
['armv6l-unknown-linux-gnueabihf-gcc', '-MMD', '-D_GNU_SOURCE=1', '-D_XOPEN_SOURCE_EXTENDED=1', '-g', '-fwrapv', '-O3',
 '-I/nix/store/0pyymzxf7n0fzpaqnvwv92ab72v3jq8d-python3-3.10.9/include/python3.10', '-I/nix/store/kaiinm7cjirmv4zd3pdqa
r23rsypfqlh-libxcrypt-4.4.33/include', '-DNDEBUG', '../../test.c', '-c', '-o/build/ldb-2.6.1/bin/.conf_check_59d3a0a5b9
6e327858e281d280fec4ed/testbuild/default/test.c.1.o']
err: In file included from /nix/store/0pyymzxf7n0fzpaqnvwv92ab72v3jq8d-python3-3.10.9/include/python3.10/Python.h:8,
                 from ../../test.c:432:
/nix/store/0pyymzxf7n0fzpaqnvwv92ab72v3jq8d-python3-3.10.9/include/python3.10/pyconfig.h:1480: warning: "SIZEOF_LONG" r
edefined
 1480 | #define SIZEOF_LONG 8
      |
../../test.c:154: note: this is the location of the previous definition
  154 | #define SIZEOF_LONG 4
      |
/nix/store/0pyymzxf7n0fzpaqnvwv92ab72v3jq8d-python3-3.10.9/include/python3.10/pyconfig.h:1504: warning: "SIZEOF_SIZE_T"
 redefined
 1504 | #define SIZEOF_SIZE_T 8
      |
../../test.c:156: note: this is the location of the previous definition
  156 | #define SIZEOF_SIZE_T 4
      |
/nix/store/0pyymzxf7n0fzpaqnvwv92ab72v3jq8d-python3-3.10.9/include/python3.10/pyconfig.h:1507: warning: "SIZEOF_TIME_T" redefined
 1507 | #define SIZEOF_TIME_T 8
      |
../../test.c:170: note: this is the location of the previous definition
  170 | #define SIZEOF_TIME_T 4
      |
/nix/store/0pyymzxf7n0fzpaqnvwv92ab72v3jq8d-python3-3.10.9/include/python3.10/pyconfig.h:1513: warning: "SIZEOF_VOID_P" redefined
 1513 | #define SIZEOF_VOID_P 8
      |
../../test.c:166: note: this is the location of the previous definition
  166 | #define SIZEOF_VOID_P 4
      |
In file included from /nix/store/0pyymzxf7n0fzpaqnvwv92ab72v3jq8d-python3-3.10.9/include/python3.10/Python.h:50:
/nix/store/0pyymzxf7n0fzpaqnvwv92ab72v3jq8d-python3-3.10.9/include/python3.10/pyport.h:746:2: error: #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
  746 | #error "LONG_BIT definition appears wrong for platform (bad gcc/glibc config?)."
      |  ^~~~~
```
2023-02-20 09:49:43 -08:00

81 lines
1.5 KiB
Nix

{ lib, stdenv
, fetchurl
, python3
, pkg-config
, readline
, tdb
, talloc
, tevent
, popt
, libxslt
, docbook-xsl-nons
, docbook_xml_dtd_42
, cmocka
, wafHook
, libxcrypt
}:
stdenv.mkDerivation rec {
pname = "ldb";
version = "2.6.1";
src = fetchurl {
url = "mirror://samba/ldb/${pname}-${version}.tar.gz";
sha256 = "sha256-RnQD9334Z4LDlluxdUQLqi7XUan+uVYBlL2MBr8XNsk=";
};
outputs = [ "out" "dev" ];
nativeBuildInputs = [
pkg-config
python3
wafHook
libxslt
docbook-xsl-nons
docbook_xml_dtd_42
tdb
tevent
];
buildInputs = [
python3
readline # required to build python
tdb
talloc
tevent
popt
cmocka
libxcrypt
];
# otherwise the configure script fails with
# PYTHONHASHSEED=1 missing! Don't use waf directly, use ./configure and make!
preConfigure = ''
export PKGCONFIG="$PKG_CONFIG"
export PYTHONHASHSEED=1
'';
wafPath = "buildtools/bin/waf";
wafConfigureFlags = [
"--bundled-libraries=NONE"
"--builtin-libraries=replace"
"--without-ldb-lmdb"
];
# python-config from build Python gives incorrect values when cross-compiling.
# If python-config is not found, the build falls back to using the sysconfig
# module, which works correctly in all cases.
PYTHON_CONFIG = "/invalid";
stripDebugList = [ "bin" "lib" "modules" ];
meta = with lib; {
broken = stdenv.isDarwin;
description = "A LDAP-like embedded database";
homepage = "https://ldb.samba.org/";
license = licenses.lgpl3Plus;
platforms = platforms.all;
};
}