From d5eade76f6d6624d0e0095a6bb5890066799d18e Mon Sep 17 00:00:00 2001 From: jimjing Date: Fri, 20 Dec 2024 07:39:38 +0000 Subject: [PATCH] Address comments --- .../3.1.10/patches/add_build_file.patch | 76 +++++++++++++++++++ modules/libmodbus/3.1.10/source.json | 2 +- 2 files changed, 77 insertions(+), 1 deletion(-) diff --git a/modules/libmodbus/3.1.10/patches/add_build_file.patch b/modules/libmodbus/3.1.10/patches/add_build_file.patch index 172f2469a4e..2c1d614fb7a 100644 --- a/modules/libmodbus/3.1.10/patches/add_build_file.patch +++ b/modules/libmodbus/3.1.10/patches/add_build_file.patch @@ -308,3 +308,79 @@ index 0000000..d914402 +#define HAVE_NETINET_IP_H 1 +""", +) +diff --git a/BUILD b/BUILD +new file mode 100644 +index 0000000..d914402 +--- /dev/null ++++ b/BUILD +@@ -0,0 +1,70 @@ ++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", ++ hdrs = [ ++ "src/config.h", ++ "src/modbus.h", ++ "src/modbus-rtu.h", ++ "src/modbus-tcp.h", ++ "src/modbus-version.h", ++ ], ++ additional_linker_inputs = [ ++ ":modbus-versionscript.lds", ++ ], ++ include_prefix = "libmodbus", ++ includes = ["src"], ++ user_link_flags = [ ++ # Linker script to hide non-modbus symbols. ++ "-Wl,--version-script", ++ "$(location modbus-versionscript.lds)", ++ ], ++ visibility = ["//visibility:public"], ++ deps = [ ++ ":modbus", ++ ":modbus-versionscript.lds", ++ ], ++) ++ ++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 > $@ <