nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib, stdenv, fetchurl }:
2
3stdenv.mkDerivation rec {
4 name = "libmodbus-3.1.6";
5
6 src = fetchurl {
7 url = "http://libmodbus.org/releases/${name}.tar.gz";
8 sha256 = "05kwz0n5gn9m33cflzv87lz3zp502yp8fpfzbx70knvfl6agmnfp";
9 };
10
11 configureFlags = [
12 # when cross-compiling we assume that the host system will return a valid
13 # pointer for calls to malloc(0) or realloc(0)
14 # https://www.uclibc.org/FAQ.html#gnu_malloc
15 # https://www.gnu.org/software/autoconf/manual/autoconf.html#index-AC_005fFUNC_005fMALLOC-454
16 # the upstream source should be patched to avoid needing this
17 "ac_cv_func_malloc_0_nonnull=yes"
18 "ac_cv_func_realloc_0_nonnull=yes"
19 ];
20
21 meta = with lib; {
22 description = "Library to send/receive data according to the Modbus protocol";
23 homepage = "https://libmodbus.org/";
24 license = licenses.lgpl21Plus;
25 platforms = platforms.linux;
26 maintainers = [ maintainers.bjornfor ];
27 };
28}