Skip to content

Commit 8c2556f

Browse files
libmodbus: add version 3.1.11 (#28501)
1 parent 1ed36cb commit 8c2556f

File tree

7 files changed

+121
-52
lines changed

7 files changed

+121
-52
lines changed

recipes/libmodbus/all/conandata.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
sources:
2+
"3.1.11":
3+
url: "https://github.com/stephane/libmodbus/archive/refs/tags/v3.1.11.tar.gz"
4+
sha256: "8a750452ef86a53de6cec6fbca67bd5be08d0a1e87278a422fbce3003fd42d99"
25
"3.1.10":
36
url: "https://github.com/stephane/libmodbus/releases/download/v3.1.10/libmodbus-3.1.10.tar.gz"
47
sha256: "899be4e25ab7fe5799d43f9567510d6f063d2e8f56136dd726b6fd976f9b2253"
@@ -9,6 +12,8 @@ sources:
912
url: "https://libmodbus.org/releases/libmodbus-3.1.6.tar.gz"
1013
sha256: "d7d9fa94a16edb094e5fdf5d87ae17a0dc3f3e3d687fead81835d9572cf87c16"
1114
patches:
15+
"3.1.11":
16+
- patch_file: "patches/3.1.11-0001-msvc-fixes.patch"
1217
"3.1.10":
1318
- patch_file: "patches/3.1.10-0001-msvc-fixes.patch"
1419
"3.1.8":

recipes/libmodbus/all/conanfile.py

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
from conan import ConanFile
22
from conan.tools.apple import fix_apple_shared_install_name
3-
from conan.tools.env import VirtualBuildEnv
43
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, replace_in_file, rm, rmdir
54
from conan.tools.gnu import Autotools, AutotoolsToolchain
65
from conan.tools.layout import basic_layout
7-
from conan.tools.microsoft import check_min_vs, is_msvc, unix_path
6+
from conan.tools.microsoft import check_min_vs, is_msvc
87
from conan.tools.scm import Version
98
import os
109

@@ -51,8 +50,11 @@ def layout(self):
5150
basic_layout(self, src_folder="src")
5251

5352
def build_requirements(self):
53+
self.tool_requires("libtool/2.4.7")
54+
5455
if is_msvc(self):
5556
self.tool_requires("automake/1.16.5")
57+
5658
if self._settings_build.os == "Windows":
5759
self.win_bash = True
5860
if not self.conf.get("tools.microsoft.bash:path", check_type=str):
@@ -62,38 +64,25 @@ def source(self):
6264
get(self, **self.conan_data["sources"][self.version], strip_root=True)
6365

6466
def generate(self):
65-
env = VirtualBuildEnv(self)
66-
env.generate()
67-
6867
tc = AutotoolsToolchain(self)
6968
if Version(self.version) < "3.1.8":
7069
tc.configure_args.append("--without-documentation")
7170
tc.configure_args.append("--disable-tests")
7271
if is_msvc(self) and check_min_vs(self, "180", raise_invalid=False):
7372
tc.extra_cflags.append("-FS")
74-
env = tc.environment()
75-
if is_msvc(self):
76-
compile_wrapper = unix_path(self, os.path.join(self.source_folder, "build-aux", "compile"))
77-
ar_wrapper = unix_path(self, self.conf.get("user.automake:lib-wrapper", check_type=str))
78-
env.define("CC", f"{compile_wrapper} cl -nologo")
79-
env.define("CXX", f"{compile_wrapper} cl -nologo")
80-
env.define("LD", "link -nologo")
81-
env.define("AR", f"{ar_wrapper} \"lib -nologo\"")
82-
env.define("NM", "dumpbin -symbols")
83-
env.define("OBJDUMP", ":")
84-
env.define("RANLIB", ":")
85-
env.define("STRIP", ":")
86-
tc.generate(env)
73+
if self.options.shared:
74+
tc.extra_defines.append("DLLBUILD")
75+
tc.generate()
8776

8877
def _patch_sources(self):
8978
apply_conandata_patches(self)
9079
if not self.options.shared:
9180
for decl in ("__declspec(dllexport)", "__declspec(dllimport)"):
9281
replace_in_file(self, os.path.join(self.source_folder, "src", "modbus.h"), decl, "")
93-
9482
def build(self):
9583
self._patch_sources()
9684
autotools = Autotools(self)
85+
autotools.autoreconf()
9786
autotools.configure()
9887
autotools.make()
9988

recipes/libmodbus/all/patches/3.1.10-0001-msvc-fixes.patch

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
1-
--- src/Makefile.in
2-
+++ src/Makefile.in
3-
@@ -326,7 +326,7 @@
4-
localstatedir = @localstatedir@
5-
mandir = @mandir@
6-
mkdir_p = @mkdir_p@
7-
-my_CFLAGS = @my_CFLAGS@
8-
+my_CFLAGS =
9-
oldincludedir = @oldincludedir@
10-
pdfdir = @pdfdir@
11-
prefix = @prefix@
1+
--- configure.ac
2+
+++ configure.ac
3+
@@ -137,15 +137,6 @@ AC_CHECK_DECLS([TIOCSRS485], [], [], [[#include <sys/ioctl.h>]])
4+
# Check for RTS flags
5+
AC_CHECK_DECLS([TIOCM_RTS], [], [], [[#include <sys/ioctl.h>]])
6+
7+
-# Wtype-limits is not supported by gcc 4.2 (default on recent Mac OS X)
8+
-my_CFLAGS="-Wall \
9+
--Wmissing-declarations -Wmissing-prototypes \
10+
--Wnested-externs -Wpointer-arith \
11+
--Wpointer-arith -Wsign-compare -Wchar-subscripts \
12+
--Wstrict-prototypes -Wshadow \
13+
--Wformat-security"
14+
-AC_SUBST([my_CFLAGS])
15+
-
16+
# Build options
17+
AC_ARG_ENABLE(tests,
18+
AS_HELP_STRING([--disable-tests],
1219
--- src/modbus-private.h
1320
+++ src/modbus-private.h
1421
@@ -14,5 +14,5 @@
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
--- configure.ac
2+
+++ configure.ac
3+
@@ -147,14 +147,6 @@ AC_CHECK_DECLS([TIOCSRS485], [], [], [[#include <sys/ioctl.h>]])
4+
# Check for RTS flags
5+
AC_CHECK_DECLS([TIOCM_RTS], [], [], [[#include <sys/ioctl.h>]])
6+
7+
-WARNING_CFLAGS="-Wall \
8+
--Wmissing-declarations -Wmissing-prototypes \
9+
--Wnested-externs -Wpointer-arith \
10+
--Wsign-compare -Wchar-subscripts \
11+
--Wstrict-prototypes -Wshadow \
12+
--Wformat-security"
13+
-AC_SUBST([WARNING_CFLAGS])
14+
-
15+
# Build options
16+
AC_ARG_ENABLE(tests,
17+
AS_HELP_STRING([--disable-tests],
18+
@@ -178,14 +170,6 @@ AC_ARG_ENABLE([debug],
19+
[enable_debug=$enableval],
20+
[enable_debug=no])
21+
22+
-AS_IF([test "x$enable_debug" = "xyes"], [
23+
- CFLAGS="-g -O0"
24+
- CXXFLAGS="-g -O0"
25+
-], [
26+
- CFLAGS="-O2"
27+
- CXXFLAGS="-O2"
28+
-])
29+
-
30+
AC_OUTPUT
31+
AC_MSG_RESULT([
32+
$PACKAGE $VERSION
33+
@@ -197,7 +181,7 @@ AC_MSG_RESULT([
34+
includedir: ${includedir}
35+
36+
compiler: ${CC}
37+
- cflags: ${CFLAGS} ${WARNING_CFLAGS}
38+
+ cflags: ${CFLAGS}
39+
ldflags: ${LDFLAGS}
40+
41+
tests: ${enable_tests}
42+
--- src/modbus-private.h
43+
+++ src/modbus-private.h
44+
@@ -14,7 +14,7 @@
45+
#else
46+
# include "stdint.h"
47+
# include <time.h>
48+
-typedef int ssize_t;
49+
+// typedef int ssize_t;
50+
#endif
51+
// clang-format on
52+
#include <config.h>

recipes/libmodbus/all/patches/3.1.6-0001-msvc-fixes.patch

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
1-
--- src/Makefile.in
2-
+++ src/Makefile.in
3-
@@ -327,7 +327,7 @@
4-
localstatedir = @localstatedir@
5-
mandir = @mandir@
6-
mkdir_p = @mkdir_p@
7-
-my_CFLAGS = @my_CFLAGS@
8-
+my_CFLAGS =
9-
oldincludedir = @oldincludedir@
10-
pdfdir = @pdfdir@
11-
prefix = @prefix@
1+
--- configure.ac
2+
+++ configure.ac
3+
@@ -135,15 +135,6 @@ AC_CHECK_DECLS([TIOCSRS485], [], [], [[#include <sys/ioctl.h>]])
4+
# Check for RTS flags
5+
AC_CHECK_DECLS([TIOCM_RTS], [], [], [[#include <sys/ioctl.h>]])
6+
7+
-# Wtype-limits is not supported by gcc 4.2 (default on recent Mac OS X)
8+
-my_CFLAGS="-Wall \
9+
--Wmissing-declarations -Wmissing-prototypes \
10+
--Wnested-externs -Wpointer-arith \
11+
--Wpointer-arith -Wsign-compare -Wchar-subscripts \
12+
--Wstrict-prototypes -Wshadow \
13+
--Wformat-security"
14+
-AC_SUBST([my_CFLAGS])
15+
-
16+
# Build options
17+
AC_ARG_ENABLE(tests,
18+
AS_HELP_STRING([--disable-tests],
1219
--- src/modbus-private.h
1320
+++ src/modbus-private.h
1421
@@ -13,7 +13,7 @@

recipes/libmodbus/all/patches/3.1.8-0001-msvc-fixes.patch

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
1-
--- src/Makefile.in
2-
+++ src/Makefile.in
3-
@@ -326,7 +326,7 @@
4-
localstatedir = @localstatedir@
5-
mandir = @mandir@
6-
mkdir_p = @mkdir_p@
7-
-my_CFLAGS = @my_CFLAGS@
8-
+my_CFLAGS =
9-
oldincludedir = @oldincludedir@
10-
pdfdir = @pdfdir@
11-
prefix = @prefix@
1+
--- configure.ac
2+
+++ configure.ac
3+
@@ -135,15 +135,6 @@ AC_CHECK_DECLS([TIOCSRS485], [], [], [[#include <sys/ioctl.h>]])
4+
# Check for RTS flags
5+
AC_CHECK_DECLS([TIOCM_RTS], [], [], [[#include <sys/ioctl.h>]])
6+
7+
-# Wtype-limits is not supported by gcc 4.2 (default on recent Mac OS X)
8+
-my_CFLAGS="-Wall \
9+
--Wmissing-declarations -Wmissing-prototypes \
10+
--Wnested-externs -Wpointer-arith \
11+
--Wpointer-arith -Wsign-compare -Wchar-subscripts \
12+
--Wstrict-prototypes -Wshadow \
13+
--Wformat-security"
14+
-AC_SUBST([my_CFLAGS])
15+
-
16+
# Build options
17+
AC_ARG_ENABLE(tests,
18+
AS_HELP_STRING([--disable-tests],
1219
--- src/modbus-private.h
1320
+++ src/modbus-private.h
1421
@@ -13,7 +13,7 @@

recipes/libmodbus/config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
versions:
2+
"3.1.11":
3+
folder: all
24
"3.1.10":
35
folder: all
46
"3.1.8":

0 commit comments

Comments
 (0)