Skip to content

Commit

Permalink
Use a local repo to allow multiple source targets to be passed.
Browse files Browse the repository at this point in the history
  • Loading branch information
Attila Oláh committed Sep 16, 2020
1 parent fbdf3e1 commit 8fe7113
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 31 deletions.
5 changes: 5 additions & 0 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ workspace(name = "wasm")

load("//:package.bzl", "register_dependencies", "register_repositories")

local_repository(
name = "rules_foreign_cc",
path = "../rules_foreign_cc",
)

register_dependencies()

register_repositories()
Expand Down
19 changes: 4 additions & 15 deletions config/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
config_setting(
name = "wasm32",
constraint_values = [
"@platforms//os:none",
"@platforms//cpu:wasm32",
],
)

config_setting(
name = "wasm64",
constraint_values = [
#"//platforms:wasm64",
"@platforms//os:none",
"@platforms//cpu:wasm64",
],
filegroup(
name = "all",
srcs = ["emscripten_config.py"],
visibility = ["//visibility:public"],
)
1 change: 0 additions & 1 deletion lib/z/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ configure_make(
linkopts = ["-lz"],
make_commands = CONFIGURE_MAKE_COMMANDS,
static_libraries = ["libz.a"],
#target_compatible_with=["//platforms:wasm"],
)

bzl_library(
Expand Down
56 changes: 43 additions & 13 deletions package.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ load("//lib:package.bzl", "download_lib")

def register_dependencies():
"""Set up dependencies of THIS workspace."""
_github_repository(
project = "rules_foreign_cc",
owner = "bazelbuild",
commit = "ed95b95affecaa3ea3bf7bab3e0ab6aa847dfb06",
shallow_since = "1599808059 +0200",
)
#_github_repository(
# project = "rules_foreign_cc",
# owner = "bazelbuild",
# commit = "ed95b95affecaa3ea3bf7bab3e0ab6aa847dfb06",
# shallow_since = "1599808059 +0200",
#)

http_archive(
name = "platforms",
Expand All @@ -20,6 +20,24 @@ def register_dependencies():
strip_prefix = "{name}-{version}",
)

http_archive(
name = "bazel-skylib",
version = "1.0.3",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/{name}/releases/download/{version}/{name}-{version}.tar.gz",
"https://github.com/bazelbuild/{name}/releases/download/{version}/{name}-{version}.tar.gz",
],
sha256 = "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c",
)

http_archive(
name = "binaryen",
version = "96",
urls = ["https://github.com/WebAssembly/{name}/releases/download/version_{version}/{name}-version_{version}-x86_64-linux.tar.gz"],
sha256 = "9f8397a12931df577b244a27c293d7c976bc7e980a12457839f46f8202935aac",
strip_prefix = "{name}-version_{version}",
)

http_archive(
name = "emscripten",
version = "2.0.4",
Expand All @@ -29,13 +47,25 @@ def register_dependencies():
)

http_archive(
name = "bazel-skylib",
version = "1.0.3",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/{name}/releases/download/{version}/{name}-{version}.tar.gz",
"https://github.com/bazelbuild/{name}/releases/download/{version}/{name}-{version}.tar.gz",
],
sha256 = "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c",
name = "llvm",
version = "10.0.1",
urls = ["https://github.com/{name}/{name}-project/releases/download/{name}org-{version}/clang+{name}-{version}-x86_64-linux-gnu-ubuntu-16.04.tar.xz"],
sha256 = "48b83ef827ac2c213d5b64f5ad7ed082c8bcb712b46644e0dc5045c6f462c231",
strip_prefix = "clang+{name}-{version}-x86_64-linux-gnu-ubuntu-16.04"
)

http_archive(
name = "node",
version = "14.11.0",
urls = ["https://nodejs.org/dist/v14.11.0/{name}-v{version}-linux-x64.tar.xz"],
sha256 = "c0dfb8e45aefefc65410dbe3e9a05e346b952b2a19a965f5bea3e77b74fc73d8",
strip_prefix = "{name}-v{version}-linux-x64",
)

native.new_local_repository(
name = "config",
path = "config",
build_file = "//config:BUILD.bazel",
)

def register_repositories():
Expand Down
8 changes: 7 additions & 1 deletion toolchains/make/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ toolchain(
native_tool_toolchain(
name = "emmake",
path = "emmake",
target = "@emscripten//:all",
targets = [
"@emscripten//:all",
"@binaryen//:all",
"@llvm//:all",
"@node//:all",
"//config:all",
],
visibility = ["//visibility:public"],
)

Expand Down
3 changes: 2 additions & 1 deletion toolchains/make/make.bzl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
EMCONFIGURE = [
"echo 'emconfigure $(dirname $0)/configure $@' > emconfigure.sh",
"echo 'export EM_CONFIG=\"${EXT_BUILD_DEPS}/bin/emscripten_config.py\"' > emconfigure.sh",
"echo '\"${EXT_BUILD_DEPS}/bin/emscripten/emconfigure\" $(dirname $0)/configure $@' >> emconfigure.sh",
"chmod +x emconfigure.sh",
]

Expand Down

0 comments on commit 8fe7113

Please sign in to comment.