diff --git a/modules/libmodbus/3.1.10/MODULE.bazel b/modules/libmodbus/3.1.10/MODULE.bazel new file mode 100644 index 00000000000..1b6b6e907e1 --- /dev/null +++ b/modules/libmodbus/3.1.10/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") diff --git a/modules/libmodbus/3.1.10/patches/add_build_file.patch b/modules/libmodbus/3.1.10/patches/add_build_file.patch new file mode 100644 index 00000000000..754ad379968 --- /dev/null +++ b/modules/libmodbus/3.1.10/patches/add_build_file.patch @@ -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 > $@ <