about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/libmodbus
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/libmodbus')
-rw-r--r--nixpkgs/pkgs/development/libraries/libmodbus/default.nix28
1 files changed, 28 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/libmodbus/default.nix b/nixpkgs/pkgs/development/libraries/libmodbus/default.nix
new file mode 100644
index 000000000000..e18de4127a4a
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/libmodbus/default.nix
@@ -0,0 +1,28 @@
+{ stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "libmodbus-3.1.6";
+
+  src = fetchurl {
+    url = "http://libmodbus.org/releases/${name}.tar.gz";
+    sha256 = "05kwz0n5gn9m33cflzv87lz3zp502yp8fpfzbx70knvfl6agmnfp";
+  };
+
+  configureFlags = [
+    # when cross-compiling we assume that the host system will return a valid
+    # pointer for calls to malloc(0) or realloc(0)
+    # https://www.uclibc.org/FAQ.html#gnu_malloc
+    # https://www.gnu.org/software/autoconf/manual/autoconf.html#index-AC_005fFUNC_005fMALLOC-454
+    # the upstream source should be patched to avoid needing this
+    "ac_cv_func_malloc_0_nonnull=yes"
+    "ac_cv_func_realloc_0_nonnull=yes"
+  ];
+
+  meta = with stdenv.lib; {
+    description = "Library to send/receive data according to the Modbus protocol";
+    homepage = https://libmodbus.org/;
+    license = licenses.lgpl21Plus;
+    platforms = platforms.linux;
+    maintainers = [ maintainers.bjornfor ];
+  };
+}