Skip to content

Commit

Permalink
Add "cppzmq" 4.10.0 and a header only target for "libzmq" 4.3.5.bcr.1. (
Browse files Browse the repository at this point in the history
#2425)

The reasons why cppzmq does not depend on the full target of libzmq are:
1. cppzmq is a header-only library, thus it should depend on headers
only. Users of cppzmq should provide a libzmq independently, which may
be another (locally patched) version.
2. The current libzmq on Bazel registry does not build on Mac M1 (ARM).
  • Loading branch information
BYVoid committed Jul 15, 2024
1 parent a8e2cbe commit 1140d84
Show file tree
Hide file tree
Showing 12 changed files with 159 additions and 1 deletion.
9 changes: 9 additions & 0 deletions modules/cppzmq/4.10.0/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
"""cppzmq is a C++ binding for libzmq."""

module(
name = "cppzmq",
version = "4.10.0",
compatibility_level = 4,
)

bazel_dep(name = "libzmq", version = "4.3.5.bcr.1")
10 changes: 10 additions & 0 deletions modules/cppzmq/4.10.0/patches/add_build_file.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--- /dev/null
+++ BUILD.bazel
@@ -0,0 +1,7 @@
+""" Builds cppzmq."""
+cc_library(
+ name = "cppzmq",
+ hdrs = glob(["*.hpp"]),
+ visibility = ["//visibility:public"],
+ deps = ["@libzmq//:libzmq_headers_only"],
+)
12 changes: 12 additions & 0 deletions modules/cppzmq/4.10.0/patches/module_dot_bazel.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--- /dev/null
+++ MODULE.bazel
@@ -0,0 +1,9 @@
+"""cppzmq is a C++ binding for libzmq."""
+
+module(
+ name = "cppzmq",
+ version = "4.10.0",
+ compatibility_level = 4,
+)
+
+bazel_dep(name = "libzmq", version = "4.3.5.bcr.1")
17 changes: 17 additions & 0 deletions modules/cppzmq/4.10.0/presubmit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
matrix:
platform:
- debian10
- ubuntu2004
- macos
- macos_arm64
- windows
bazel:
- 7.x
- 6.x
tasks:
verify_targets:
name: Verify build targets
platform: ${{ platform }}
bazel: ${{ bazel }}
build_targets:
- '@cppzmq'
10 changes: 10 additions & 0 deletions modules/cppzmq/4.10.0/source.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"url": "https://github.com/zeromq/cppzmq/archive/refs/tags/v4.10.0.tar.gz",
"integrity": "sha256-yByBu6inZEyEkyIl8Bi1CIdDoimZxtgqK19c0eaUK3Q=",
"strip_prefix": "cppzmq-4.10.0",
"patch_strip": 0,
"patches": {
"add_build_file.patch": "sha256-ZzJqhqtYIENHu1c9cGtT7LAG7kq4dBTsb6OI12vvYyY=",
"module_dot_bazel.patch": "sha256-vHfFQXdCxh98DPj9OOBemKICfd+NSzNs+b+NF237WG8="
}
}
16 changes: 16 additions & 0 deletions modules/cppzmq/metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"homepage": "https://www.zeromq.org/",
"maintainers": [
{
"email": "[email protected]",
"name": "No Maintainer Specified"
}
],
"repository": [
"github:zeromq/cppzmq"
],
"versions": [
"4.10.0"
],
"yanked_versions": {}
}
13 changes: 13 additions & 0 deletions modules/libzmq/4.3.5.bcr.1/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"""
The ZeroMQ lightweight messaging kernel is a library which extends the
standard socket interfaces with features traditionally provided by
specialised messaging middleware products.
"""

module(
name = "libzmq",
version = "4.3.5.bcr.1",
compatibility_level = 4,
)

bazel_dep(name = "rules_foreign_cc", version = "0.10.1")
27 changes: 27 additions & 0 deletions modules/libzmq/4.3.5.bcr.1/patches/add_build_file.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
--- /dev/null
+++ BUILD.bazel
@@ -0,0 +1,24 @@
+""" Builds libzmq.
+"""
+load("@rules_foreign_cc//foreign_cc:defs.bzl", "cmake")
+
+filegroup(
+ name = "srcs",
+ srcs = glob(["**"]),
+)
+
+cmake(
+ name = "libzmq",
+ env = {"CMAKE_BUILD_TYPE": "Release"},
+ lib_source = ":srcs",
+ out_include_dir = "include",
+ out_static_libs = ["libzmq.a"],
+ visibility = ["//visibility:public"],
+)
+
+cc_library(
+ name = "libzmq_headers_only",
+ hdrs = glob(["include/*.h"]),
+ strip_include_prefix = "include",
+ visibility = ["//visibility:public"],
+)
16 changes: 16 additions & 0 deletions modules/libzmq/4.3.5.bcr.1/patches/module_dot_bazel.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
--- /dev/null
+++ MODULE.bazel
@@ -0,0 +1,13 @@
+"""
+The ZeroMQ lightweight messaging kernel is a library which extends the
+standard socket interfaces with features traditionally provided by
+specialised messaging middleware products.
+"""
+
+module(
+ name = "libzmq",
+ version = "4.3.5.bcr.1",
+ compatibility_level = 4,
+)
+
+bazel_dep(name = "rules_foreign_cc", version = "0.10.1")
17 changes: 17 additions & 0 deletions modules/libzmq/4.3.5.bcr.1/presubmit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
matrix:
platform:
- debian10
- ubuntu2004
- macos
# - macos_arm64
# - windows
bazel:
- 7.x
- 6.x
tasks:
verify_targets:
name: Verify build targets
platform: ${{ platform }}
bazel: ${{ bazel }}
build_targets:
- '@libzmq'
10 changes: 10 additions & 0 deletions modules/libzmq/4.3.5.bcr.1/source.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"url": "https://github.com/zeromq/libzmq/releases/download/v4.3.5/zeromq-4.3.5.tar.gz",
"integrity": "sha256-ZlPvWRDxeVSGH+cjMuaLA8puTZxxYOs6jeWlqRO/q0M=",
"strip_prefix": "zeromq-4.3.5",
"patch_strip": 0,
"patches": {
"add_build_file.patch": "sha256-YpAn1nkWTR2mna+Cgx9TtHG6Y7mMum3nAVa73RJhFbQ=",
"module_dot_bazel.patch": "sha256-qBWgWwH10wWBjANRdTK8/Z9HoDTiFS87qoios+T7dO8="
}
}
3 changes: 2 additions & 1 deletion modules/libzmq/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"github:zeromq/libzmq"
],
"versions": [
"4.3.5"
"4.3.5",
"4.3.5.bcr.1"
],
"yanked_versions": {}
}

0 comments on commit 1140d84

Please sign in to comment.