Skip to content

Commit ee39ea3

Browse files
committed
try
1 parent 012b95a commit ee39ea3

File tree

6 files changed

+100
-111
lines changed

6 files changed

+100
-111
lines changed

BUILD.backward-stacktrace.bazel

Lines changed: 0 additions & 13 deletions
This file was deleted.

BUILD.bazel

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ configure_make(
3535
# We need 'binutils' in order to read the debug info if we want to get
3636
# the ultimate stack trace.
3737
configure_make(
38-
name = "binutils",
38+
name = "binutils_bazelified",
3939
args = [
4040
# Without this make argument binutils will not compile.
4141
# https://www.linuxquestions.org/questions/linux-from-scratch-13/problem-compiling-binutils-575412/
@@ -59,9 +59,12 @@ configure_make(
5959
)
6060

6161
cc_library(
62-
name = "backward",
62+
name = "backward-stacktrace",
63+
srcs = [
64+
"backward-stacktrace.cc",
65+
],
6366
hdrs = [
64-
"backward.hpp",
67+
"backward-stacktrace.h",
6568
],
6669
defines = [
6770
# For binutils
@@ -71,7 +74,6 @@ cc_library(
7174
],
7275
linkopts = [
7376
# For binutils
74-
"-ldl",
7577
"-lz",
7678
],
7779
# For now we support this library for macOS and Linux. Maybe in
@@ -84,13 +86,17 @@ cc_library(
8486
visibility = ["//visibility:public"],
8587
deps = select({
8688
"@bazel_tools//src/conditions:darwin": [
87-
":binutils",
89+
":binutils_bazelified",
8890
":lzma",
91+
"@com_github_backward_cpp//:backward",
92+
"@com_github_google_googletest//:gtest",
8993
],
9094
"//conditions:default": [
91-
":binutils",
95+
":binutils_bazelified",
9296
":libunwind",
9397
":lzma",
98+
"@com_github_backward_cpp//:backward",
99+
"@com_github_google_googletest//:gtest",
94100
],
95101
}),
96102
# Link any binary that depends (directly or indirectly) on this C++ library

backward-stacktrace.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ namespace backward_stacktrace {
1616
// (check_line_length skip)
1717
// https://github.com/YOU-i-Labs/googletest/blob/master/googletest/docs/V1_7_AdvancedGuide.md#global-set-up-and-tear-down
1818
class BackwardStackTrace : public ::testing::Environment {
19-
private:
19+
private:
2020
// A simple helper class that registers for you the most
2121
// common signals and other callbacks to segfault,
2222
// hardware exception, un-handled exception etc.

backward_cpp.patch

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
diff --git a/BUILD.bazel b/BUILD.bazel
2+
new file mode 100644
3+
index 0000000..83e888a
4+
--- /dev/null
5+
+++ b/BUILD.bazel
6+
@@ -0,0 +1,5 @@
7+
+cc_library(
8+
+ name = "backward",
9+
+ hdrs = ["backward.hpp"],
10+
+ visibility = ["//visibility:public"],
11+
+)
12+
diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel
13+
new file mode 100644
14+
index 0000000..2a5377b
15+
--- /dev/null
16+
+++ b/WORKSPACE.bazel
17+
@@ -0,0 +1 @@
18+
+workspace(name = "backward_cpp")

bazel/deps.bzl

Lines changed: 0 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,6 @@
11
"""Dependency specific initialization."""
22

3-
load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository")
4-
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
53
load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
6-
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
7-
8-
_ALL_CONTENT = """\
9-
filegroup(
10-
name = "all",
11-
srcs = glob(["**"]),
12-
visibility = ["//visibility:public"],
13-
)
14-
"""
154

165
def deps(repo_mapping = {}):
17-
# Get the latest rules for building C/C++ projects.
186
rules_foreign_cc_dependencies()
19-
20-
# Get the latest texinfo version. 'binutils' doesn't compile
21-
# without this binary.
22-
maybe(
23-
http_archive,
24-
name = "com_github_texinfo",
25-
url = "https://ftp.gnu.org/gnu/texinfo/texinfo-6.8.tar.xz",
26-
build_file_content = _ALL_CONTENT,
27-
sha256 = "8eb753ed28bca21f8f56c1a180362aed789229bd62fff58bf8368e9beb59fec4",
28-
strip_prefix = "texinfo-6.8",
29-
)
30-
31-
# Get the latest binutils version to read the debug info.
32-
maybe(
33-
http_archive,
34-
name = "com_github_binutils",
35-
url = "https://ftp.gnu.org/gnu/binutils/binutils-2.38.tar.gz",
36-
build_file_content = _ALL_CONTENT,
37-
sha256 = "b3f1dc5b17e75328f19bd88250bee2ef9f91fc8cbb7bd48bdb31390338636052",
38-
strip_prefix = "binutils-2.38",
39-
)
40-
41-
# Get the latest libunwind version to unwind the stack. (There is no need
42-
# in this library on macOS, because on macOS clang provides a libunwind API
43-
# compatible library as part of its environment).
44-
maybe(
45-
http_archive,
46-
name = "com_github_libunwind",
47-
url = "https://github.com/libunwind/libunwind/releases/download/v1.6.2/libunwind-1.6.2.tar.gz",
48-
build_file_content = _ALL_CONTENT,
49-
sha256 = "4a6aec666991fb45d0889c44aede8ad6eb108071c3554fcdff671f9c94794976",
50-
strip_prefix = "libunwind-1.6.2",
51-
)
52-
53-
# Get the latest lzma version.
54-
maybe(
55-
new_git_repository,
56-
name = "com_github_lzma",
57-
remote = "https://github.com/kobolabs/liblzma.git",
58-
build_file_content = _ALL_CONTENT,
59-
commit = "87b7682ce4b1c849504e2b3641cebaad62aaef87",
60-
shallow_since = "1385587354 -0500",
61-
)
62-
63-
# Get the latest gtest version.
64-
maybe(
65-
http_archive,
66-
name = "com_github_google_googletest",
67-
url = "https://github.com/google/googletest/archive/refs/tags/release-1.12.1.tar.gz",
68-
sha256 = "81964fe578e9bd7c94dfdb09c8e4d6e6759e19967e397dbea48d1c10e45d0df2",
69-
strip_prefix = "googletest-release-1.12.1",
70-
repo_mapping = repo_mapping,
71-
)
72-
73-
maybe(
74-
http_archive,
75-
name = "com_github_backward_cpp",
76-
url = "https://github.com/bombela/backward-cpp/archive/refs/tags/v1.6.tar.gz",
77-
sha256 = "c654d0923d43f1cea23d086729673498e4741fb2457e806cfaeaea7b20c97c10",
78-
strip_prefix = "backward-cpp-1.6",
79-
repo_mapping = repo_mapping,
80-
build_file = "@com_github_3rdparty_bazel_rules_backward_cpp//:BUILD.bazel",
81-
)

bazel/repos.bzl

Lines changed: 69 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,87 @@
99
# instructions at https://github.com/3rdparty/bazel-rules-backward-cpp.
1010
########################################################################
1111

12-
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository", "new_git_repository")
1312
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
1413
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
14+
load("@bazel_tools//tools/build_defs/repo:git.bzl", "new_git_repository")
1515

16-
def repos(external = True, repo_mapping = {}):
16+
_ALL_CONTENT = """\
17+
filegroup(
18+
name = "all",
19+
srcs = glob(["**"]),
20+
visibility = ["//visibility:public"],
21+
)
22+
"""
23+
24+
def repos(external = True, repo_mapping = {}, workspace_prefix = ""):
1725
maybe(
18-
git_repository,
19-
name = "com_github_3rdparty_bazel_rules_backward_cpp",
20-
remote = "https://github.com/3rdparty/bazel-rules-backward-cpp",
21-
commit = "69449957a41619e9b8b8be2e9bfaca2ac0642760",
22-
shallow_since = "1658132015 +0300",
26+
http_archive,
27+
name = "rules_foreign_cc",
28+
url = "https://github.com/bazelbuild/rules_foreign_cc/archive/refs/tags/0.9.0.tar.gz",
29+
sha256 = "2a4d07cd64b0719b39a7c12218a3e507672b82a97b98c6a89d38565894cf7c51",
30+
strip_prefix = "rules_foreign_cc-0.9.0",
2331
repo_mapping = repo_mapping,
2432
)
2533

34+
# Get version. 'binutils' doesn't compile
35+
# without this binary.
36+
maybe(
37+
http_archive,
38+
name = "com_github_texinfo",
39+
url = "https://ftp.gnu.org/gnu/texinfo/texinfo-6.8.tar.xz",
40+
build_file_content = _ALL_CONTENT,
41+
sha256 = "8eb753ed28bca21f8f56c1a180362aed789229bd62fff58bf8368e9beb59fec4",
42+
strip_prefix = "texinfo-6.8",
43+
)
44+
45+
# Get binutils to read the debug info.
46+
maybe(
47+
http_archive,
48+
name = "com_github_binutils",
49+
url = "https://ftp.gnu.org/gnu/binutils/binutils-2.38.tar.gz",
50+
build_file_content = _ALL_CONTENT,
51+
sha256 = "b3f1dc5b17e75328f19bd88250bee2ef9f91fc8cbb7bd48bdb31390338636052",
52+
strip_prefix = "binutils-2.38",
53+
)
54+
55+
# Get libunwind to unwind the stack. (There is no need
56+
# in this library on macOS, because on macOS clang provides a libunwind API
57+
# compatible library as part of its environment).
58+
maybe(
59+
http_archive,
60+
name = "com_github_libunwind",
61+
url = "https://github.com/libunwind/libunwind/releases/download/v1.6.2/libunwind-1.6.2.tar.gz",
62+
build_file_content = _ALL_CONTENT,
63+
sha256 = "4a6aec666991fb45d0889c44aede8ad6eb108071c3554fcdff671f9c94794976",
64+
strip_prefix = "libunwind-1.6.2",
65+
)
66+
2667
maybe(
2768
new_git_repository,
28-
name = "com_github_3rdparty_bazel_rules_backward_cpp_stacktrace",
29-
remote = "https://github.com/3rdparty/bazel-rules-backward-cpp",
30-
build_file = "@com_github_3rdparty_bazel_rules_backward_cpp//:BUILD.backward-stacktrace.bazel",
31-
commit = "69449957a41619e9b8b8be2e9bfaca2ac0642760",
32-
shallow_since = "1658132015 +0300",
69+
name = "com_github_lzma",
70+
remote = "https://github.com/kobolabs/liblzma.git",
71+
build_file_content = _ALL_CONTENT,
72+
commit = "87b7682ce4b1c849504e2b3641cebaad62aaef87",
73+
shallow_since = "1385587354 -0500",
3374
)
3475

76+
# Get the latest gtest version.
3577
maybe(
3678
http_archive,
37-
name = "rules_foreign_cc",
38-
url = "https://github.com/bazelbuild/rules_foreign_cc/archive/refs/tags/0.9.0.tar.gz",
39-
sha256 = "2a4d07cd64b0719b39a7c12218a3e507672b82a97b98c6a89d38565894cf7c51",
40-
strip_prefix = "rules_foreign_cc-0.9.0",
79+
name = "com_github_google_googletest",
80+
url = "https://github.com/google/googletest/archive/refs/tags/release-1.12.1.tar.gz",
81+
sha256 = "81964fe578e9bd7c94dfdb09c8e4d6e6759e19967e397dbea48d1c10e45d0df2",
82+
strip_prefix = "googletest-release-1.12.1",
83+
repo_mapping = repo_mapping,
84+
)
85+
86+
maybe(
87+
http_archive,
88+
name = "com_github_backward_cpp",
89+
url = "https://github.com/bombela/backward-cpp/archive/refs/tags/v1.6.tar.gz",
90+
sha256 = "c654d0923d43f1cea23d086729673498e4741fb2457e806cfaeaea7b20c97c10",
91+
strip_prefix = "backward-cpp-1.6",
4192
repo_mapping = repo_mapping,
93+
patch_args = ["-p1"],
94+
patches = [workspace_prefix + "//:backward_cpp.patch"],
4295
)

0 commit comments

Comments
 (0)