Skip to content

Commit

Permalink
Add pregenerated config.h for lzma
Browse files Browse the repository at this point in the history
This has two advantages:
- quicker and doesn't spam command-line output
- doesn't depend on bash on Windows
  • Loading branch information
drigz committed Sep 25, 2019
1 parent 4594514 commit da285b9
Show file tree
Hide file tree
Showing 6 changed files with 1,546 additions and 14 deletions.
5 changes: 5 additions & 0 deletions BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
exports_files([
"config.lzma-linux.h",
"config.lzma-osx.h",
"config.lzma-windows.h",
])
39 changes: 25 additions & 14 deletions BUILD.lzma
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,31 @@
# lzma is a general purpose data compression library https://tukaani.org/xz/
# Public Domain

# Generate config.h
genrule(
name = "configure_lzma",
outs = [
"config.h",
],
cmd = "cd external/org_lzma_lzma && ./configure > /dev/null && cp config.h ../../$(location config.h)",
tools = [
"configure",
"src/liblzma/common/common.h",
] + glob([
"build-aux/*",
"**/*.in",
]),
load("@bazel_skylib//rules:copy_file.bzl", "copy_file")

config_setting(
name = "linux",
constraint_values = ["@bazel_tools//platforms:linux"],
)

config_setting(
name = "osx",
constraint_values = ["@bazel_tools//platforms:osx"],
)

config_setting(
name = "windows",
constraint_values = ["@bazel_tools//platforms:windows"],
)

copy_file(
name = "copy_config",
src = select({
":linux": "@com_github_nelhage_rules_boost//:config.lzma-linux.h",
":osx": "@com_github_nelhage_rules_boost//:config.lzma-osx.h",
":windows": "@com_github_nelhage_rules_boost//:config.lzma-windows.h",
}),
out = "config.h",
)

cc_library(
Expand Down
10 changes: 10 additions & 0 deletions boost/boost.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,16 @@ def boost_library(
)

def boost_deps():
if "bazel_skylib" not in native.existing_rules():
http_archive(
name = "bazel_skylib",
sha256 = "1dde365491125a3db70731e25658dfdd3bc5dbdfd11b840b3e987ecf043c7ca0",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/0.9.0/bazel_skylib-0.9.0.tar.gz",
"https://github.com/bazelbuild/bazel-skylib/releases/download/0.9.0/bazel_skylib-0.9.0.tar.gz",
],
)

if "net_zlib_zlib" not in native.existing_rules():
http_archive(
name = "net_zlib_zlib",
Expand Down
Loading

0 comments on commit da285b9

Please sign in to comment.