-
Notifications
You must be signed in to change notification settings - Fork 353
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Fabian Meumertzheim <[email protected]>
- Loading branch information
Showing
7 changed files
with
140 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module( | ||
name = "libmodbus", | ||
version = "3.1.10", | ||
compatibility_level = 1, | ||
) | ||
bazel_dep(name = "bazel_skylib", version = "1.7.1") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
diff --git a/BUILD b/BUILD | ||
new file mode 100644 | ||
index 0000000..315d32e | ||
--- /dev/null | ||
+++ b/BUILD | ||
@@ -0,0 +1,60 @@ | ||
+load("@bazel_skylib//rules:expand_template.bzl", "expand_template") | ||
+ | ||
+cc_library( | ||
+ name = "modbus", | ||
+ srcs = glob(["src/*.c"]) + [ | ||
+ ":generate_config_h", | ||
+ ":generate_modbus_version_h", | ||
+ ], | ||
+ hdrs = glob(["src/*.h"]), | ||
+ copts = ["-DHAVE_CONFIG_H"], | ||
+ includes = ["src"], | ||
+ include_prefix = "libmodbus", | ||
+ visibility = ["//visibility:public"], | ||
+) | ||
+ | ||
+alias( | ||
+ name = "libmodbus", | ||
+ actual = ":modbus", | ||
+) | ||
+ | ||
+cc_shared_library( | ||
+ name = "modbus_shared", | ||
+ additional_linker_inputs = [ | ||
+ ":modbus-versionscript.lds", | ||
+ ], | ||
+ user_link_flags = [ | ||
+ # Linker script to hide non-modbus symbols. | ||
+ "-Wl,--version-script", | ||
+ "$(location modbus-versionscript.lds)", | ||
+ ], | ||
+ visibility = ["//visibility:public"], | ||
+ deps = [ | ||
+ ":modbus", | ||
+ ], | ||
+) | ||
+ | ||
+expand_template( | ||
+ name = "generate_modbus_version_h", | ||
+ out = "src/modbus-version.h", | ||
+ substitutions = { | ||
+ "@LIBMODBUS_VERSION_MAJOR@": "3", | ||
+ "@LIBMODBUS_VERSION_MINOR@": "1", | ||
+ "@LIBMODBUS_VERSION_MICRO@": "10", | ||
+ "@LIBMODBUS_VERSION@": "3.1.10", | ||
+ }, | ||
+ template = "src/modbus-version.h.in", | ||
+) | ||
+ | ||
+genrule( | ||
+ name = "generate_config_h", | ||
+ outs = ["src/config.h"], | ||
+ cmd = """cat > $@ <<EOF | ||
+#define HAVE_DECL_TIOCM_RTS 1 | ||
+#define HAVE_DECL_TIOCSRS485 1 | ||
+#undef HAVE_ACCEPT4 | ||
+#undef HAVE_GAI_STRERROR | ||
+#define HAVE_NETINET_IN_H 1 | ||
+#define HAVE_NETINET_IP_H 1 | ||
+""", | ||
+) |
11 changes: 11 additions & 0 deletions
11
modules/libmodbus/3.1.10/patches/add_modbus_versionscript_dot_lds.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
diff --git a/modbus-versionscript.lds b/modbus-versionscript.lds | ||
new file mode 100644 | ||
index 0000000..ea4858f | ||
--- /dev/null | ||
+++ b/modbus-versionscript.lds | ||
@@ -0,0 +1,5 @@ | ||
+{ | ||
+ global: | ||
+ modbus_*; | ||
+ local: *; | ||
+}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- a/MODULE.bazel | ||
+++ a/MODULE.bazel | ||
@@ -0,0 +1,6 @@ | ||
+module( | ||
+ name = "libmodbus", | ||
+ version = "3.1.10", | ||
+ compatibility_level = 1, | ||
+) | ||
+bazel_dep(name = "bazel_skylib", version = "1.7.1") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
matrix: | ||
platform: | ||
- debian10 | ||
- ubuntu2004 | ||
bazel: | ||
- 8.x | ||
- 7.x | ||
tasks: | ||
verify_targets: | ||
name: Verify build targets | ||
platform: ${{ platform }} | ||
bazel: ${{ bazel }} | ||
build_targets: | ||
- '@libmodbus//:modbus' | ||
- '@libmodbus//:modbus_shared' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"url": "https://github.com/stephane/libmodbus/releases/download/v3.1.10/libmodbus-3.1.10.tar.gz", | ||
"integrity": "sha256-iZvk4lq3/leZ1D+VZ1ENbwY9Lo9WE23XJrb9l2+bIlM=", | ||
"strip_prefix": "libmodbus-3.1.10", | ||
"patches": { | ||
"add_modbus_versionscript_dot_lds.patch": "sha256-O5Luywpd7kYnst/RMovKqi+ze1AGg/VCyFC7RN8HCvY=", | ||
"add_build_file.patch": "sha256-QJ61k+ie5LxcJ2ouQYRW2LDK2HaxFmEi94r5beBitFQ=", | ||
"module_dot_bazel.patch": "sha256-j4xOkLqnL9gHf0SvX4Z+OPIvh+Wywv1QNR0yK2xXkmw=" | ||
}, | ||
"patch_strip": 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"homepage": "www.libmodbus.org", | ||
"maintainers": [ | ||
{ | ||
"email": "[email protected]", | ||
"github": "mbeards", | ||
"name": "Michael Beardsworth" | ||
}, | ||
{ | ||
"email": "[email protected]", | ||
"github": "jimjing", | ||
"name": "Jim Jing" | ||
} | ||
], | ||
"repository": [ | ||
"github:stephane/libmodbus" | ||
], | ||
"versions": [ | ||
"3.1.10" | ||
], | ||
"yanked_versions": {} | ||
} |