Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, fetchFromGitHub, autoreconfHook }:
2
3stdenv.mkDerivation rec {
4 pname = "libmodbus";
5 version = "3.1.10";
6
7 src = fetchFromGitHub {
8 owner = "stephane";
9 repo = "libmodbus";
10 rev = "v${version}";
11 hash = "sha256-e2lB5D41a5MOmz9M90ZXfIltSOxNDOrQUpRNU2yYd1k=";
12 };
13
14 nativeBuildInputs = [ autoreconfHook ];
15
16 configureFlags = [
17 # when cross-compiling we assume that the host system will return a valid
18 # pointer for calls to malloc(0) or realloc(0)
19 # https://www.uclibc.org/FAQ.html#gnu_malloc
20 # https://www.gnu.org/software/autoconf/manual/autoconf.html#index-AC_005fFUNC_005fMALLOC-454
21 # the upstream source should be patched to avoid needing this
22 "ac_cv_func_malloc_0_nonnull=yes"
23 "ac_cv_func_realloc_0_nonnull=yes"
24 ];
25
26 meta = with lib; {
27 description = "Library to send/receive data according to the Modbus protocol";
28 homepage = "https://libmodbus.org/";
29 license = licenses.lgpl21Plus;
30 platforms = platforms.unix;
31 maintainers = [ maintainers.bjornfor ];
32 };
33}