Skip to content

Commit

Permalink
Merge pull request #553 from finn-ball/finn/bzl-mod
Browse files Browse the repository at this point in the history
  • Loading branch information
Vertexwahn committed May 25, 2024
2 parents 5d04542 + baed629 commit 9d45a1b
Show file tree
Hide file tree
Showing 22 changed files with 62 additions and 5,604 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/bazel-*
.DS_Store
MODULE.bazel.lock
16 changes: 16 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module(name = "com_github_nelhage_rules_boost")

bazel_dep(name = "bazel_skylib", version = "1.6.1")
bazel_dep(name = "boringssl", version = "0.0.0-20240530-2db0eb3")
bazel_dep(name = "bzip2", version = "1.0.8")
bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "xz", version = "5.4.5.bcr.2")
# bazel_dep(name = "zlib", version = "1.3.1")
bazel_dep(name = "zstd", version = "1.5.6")

non_module_boost_repositories = use_extension("@com_github_nelhage_rules_boost//:boost/repositories.bzl", "non_module_dependencies")
use_repo(
non_module_boost_repositories,
"boost",
"zlib",
)
28 changes: 15 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
# `rules_boost` -- Bazel build rules for [Boost](https://www.boost.org)

Copy this into your Bazel `WORKSPACE` file to add this repo as an external dependency, making sure to update to the [latest commit](https://github.com/nelhage/rules_boost/commits/master) per the instructions below.
Copy this into your Bazel `MODULE.bazel` file to add this repo as an external dependency, making sure to update to the [latest commit](https://github.com/nelhage/rules_boost/commits/master) per the instructions below.

```Starlark
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

# Boost
# Famous C++ library that has given rise to many new additions to the C++ Standard Library
# Makes @boost available for use: For example, add `@boost//:algorithm` to your deps.
# For more, see https://github.com/nelhage/rules_boost and https://www.boost.org
http_archive(
name = "com_github_nelhage_rules_boost",

# Replace the commit hash in both places (below) with the latest, rather than using the stale one here.
# Even better, set up Renovate and let it do the work for you (see "Suggestion: Updates" in the README).
url = "https://github.com/nelhage/rules_boost/archive/96e9b631f104b43a53c21c87b01ac538ad6f3b48.tar.gz",
strip_prefix = "rules_boost-96e9b631f104b43a53c21c87b01ac538ad6f3b48",
# When you first run this tool, it'll recommend a sha256 hash to put here with a message like: "DEBUG: Rule 'com_github_nelhage_rules_boost' indicated that a canonical reproducible form can be obtained by modifying arguments sha256 = ..."
bazel_dep(name = "com_github_nelhage_rules_boost")
archive_override(
module_name = "com_github_nelhage_rules_boost",
urls = "https://github.com/nelhage/rules_boost/archive/refs/heads/master.tar.gz",
strip_prefix = "rules_boost-master",
# It is recommended to edit the above URL and the below sha256 to point to a specific version of this repository.
# integrity = "sha256-...",
)

non_module_boost_repositories = use_extension("@com_github_nelhage_rules_boost//:boost/repositories.bzl", "non_module_dependencies")
use_repo(
non_module_boost_repositories,
"boost",
)
load("@com_github_nelhage_rules_boost//:boost/boost.bzl", "boost_deps")
boost_deps()
```

You can now use libraries in `deps` through the `@boost` repository, for example `@boost//:algorithm`.
Expand Down Expand Up @@ -49,7 +51,7 @@ of `"@boost//:asio"`. ASIO-SSL depends on OpenSSL; By default,
[BoringSSL](https://boringssl.googlesource.com/boringssl/) commit; To
use a different OpenSSL implementation, create a remote named
`openssl` before calling `boost_deps`. This remote must make available
OpenSSL's libssl at `@openssl//:ssl`.
OpenSSL's libssl at `@boringssl//:ssl`.

#### io\_uring support

Expand Down
1 change: 0 additions & 1 deletion WORKSPACE.bazel

This file was deleted.

10 changes: 5 additions & 5 deletions boost.BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ cc_library(
visibility = ["//visibility:public"],
deps = [
":asio",
"@openssl//:ssl",
"@boringssl//:ssl",
],
)

Expand Down Expand Up @@ -999,7 +999,7 @@ boost_library(

boost_library(
name = "python",
exclude_src = ["**/fabscript"],
exclude_src = ["**/fabscript"],
deps = [
"@python",
":config",
Expand Down Expand Up @@ -1149,9 +1149,9 @@ boost_library(
":type",
":type_traits",
":utility",
"@com_github_facebook_zstd//:zstd",
"@org_bzip_bzip2//:bz2lib",
"@org_lzma_lzma//:lzma",
"@bzip2//:bz2",
"@xz//:lzma",
"@zstd",
"@zlib",
],
)
Expand Down
59 changes: 6 additions & 53 deletions boost/boost.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -107,52 +107,6 @@ def boost_so_library(
)

def boost_deps():
maybe(
http_archive,
name = "bazel_skylib",
url = "https://github.com/bazelbuild/bazel-skylib/releases/download/1.6.1/bazel-skylib-1.6.1.tar.gz",
sha256 = "9f38886a40548c6e96c106b752f242130ee11aaa068a56ba7e56f4511f33e4f2",
)

maybe(
http_archive,
name = "zlib",
build_file = "@com_github_nelhage_rules_boost//:zlib.BUILD",
url = "https://github.com/madler/zlib/releases/download/v1.3/zlib-1.3.tar.gz",
sha256 = "ff0ba4c292013dbc27530b3a81e1f9a813cd39de01ca5e0f8bf355702efa593e",
strip_prefix = "zlib-1.3",
)

maybe(
http_archive,
name = "org_bzip_bzip2",
build_file = "@com_github_nelhage_rules_boost//:bzip2.BUILD",
sha256 = "ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269",
strip_prefix = "bzip2-1.0.8",
urls = [
"https://mirror.bazel.build/sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz",
"https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz",
],
)

maybe(
http_archive,
name = "org_lzma_lzma",
build_file = "@com_github_nelhage_rules_boost//:lzma.BUILD",
url = "https://src.fedoraproject.org/lookaside/extras/xz/xz-5.4.6.tar.gz/sha512/b08a61d8d478d3b4675cb1ddacdbbd98dc6941a55bcdd81a28679e54e9367d3a595fa123ac97874a17da571c1b712e2a3e901c2737099a9d268616a1ba3de497/xz-5.4.6.tar.gz",
sha256 = "aeba3e03bf8140ddedf62a0a367158340520f6b384f75ca6045ccc6c0d43fd5c",
strip_prefix = "xz-5.4.6",
)

maybe(
http_archive,
name = "com_github_facebook_zstd",
build_file = "@com_github_nelhage_rules_boost//:zstd.BUILD",
url = "https://github.com/facebook/zstd/releases/download/v1.5.6/zstd-1.5.6.tar.gz",
sha256 = "8c29e06cf42aacc1eafc4077ae2ec6c6fcb96a626157e0593d5e82a34fd403c1",
strip_prefix = "zstd-1.5.6",
)

maybe(
http_archive,
name = "boost",
Expand All @@ -164,11 +118,10 @@ def boost_deps():
strip_prefix = "boost-1.84.0",
)

# We're pointing at hedronvision's mirror of google/boringssl:master-with-bazel to get Renovate auto-update. Otherwise, Renovate will keep moving us back to master, which doesn't support Bazel. See https://github.com/renovatebot/renovate/discussions/24854
maybe(
http_archive,
name = "openssl",
url = "https://github.com/hedronvision/boringssl/archive/0f1a639954dd7ab86f5f4ddd8b4e2edbea492acd.tar.gz",
sha256 = "7ce152bdce1b85344cc36c6b255aab36905d39187c2c2f797a69d5ad220076ee",
strip_prefix = "boringssl-0f1a639954dd7ab86f5f4ddd8b4e2edbea492acd",
http_archive(
name = "zlib",
build_file = "@com_github_nelhage_rules_boost//:zlib.BUILD",
url = "https://github.com/madler/zlib/releases/download/v1.3/zlib-1.3.tar.gz",
sha256 = "ff0ba4c292013dbc27530b3a81e1f9a813cd39de01ca5e0f8bf355702efa593e",
strip_prefix = "zlib-1.3",
)
8 changes: 8 additions & 0 deletions boost/repositories.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
load("@com_github_nelhage_rules_boost//:boost/boost.bzl", "boost_deps")

def _non_module_dependencies_impl(_ctx):
boost_deps()

non_module_dependencies = module_extension(
implementation = _non_module_dependencies_impl,
)
39 changes: 0 additions & 39 deletions bzip2.BUILD

This file was deleted.

Loading

0 comments on commit 9d45a1b

Please sign in to comment.