Skip to content

Commit

Permalink
Add linux arm64 toolchain (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
laramiel authored Jul 22, 2022
1 parent 43d2db0 commit 71efd8d
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 18 deletions.
29 changes: 21 additions & 8 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,39 @@ toolchain_type(
# toolchain_impl gathers information about the Perl toolchain.
# See the PerlToolchain provider.
perl_toolchain(
name = "{os}_toolchain_impl".format(os = os),
runtime = ["@perl_{os}_amd64//:runtime".format(os = os)],
name = "{os}_{cpu}_toolchain_impl".format(
cpu = cpu,
os = os,
),
runtime = ["@perl_{os}_{cpu}//:runtime".format(
cpu = cpu,
os = os,
)],
),

# toolchain is a Bazel toolchain that expresses execution and target
# constraints for toolchain_impl. This target should be registered by
# calling register_toolchains in a WORKSPACE file.
toolchain(
name = "{os}_toolchain".format(os = os),
name = "{os}_{cpu}_toolchain".format(
cpu = cpu,
os = os,
),
exec_compatible_with = [
"@platforms//os:{os}".format(os = os),
"@platforms//cpu:x86_64",
"@platforms//cpu:{cpu}".format(cpu = cpu),
],
toolchain = ":{os}_toolchain_impl".format(os = os),
toolchain = ":{os}_{cpu}_toolchain_impl".format(
cpu = cpu,
os = os,
),
toolchain_type = ":toolchain_type",
),
)
for os in [
"linux",
"windows",
for os, cpu in [
("linux", "arm64"),
("linux", "x86_64"),
("windows", "x86_64"),
]
]

Expand Down
5 changes: 3 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ perl_register_toolchains()
# doesn't seem to work unless called from a workspace other than rules_perl
register_toolchains(
"@rules_perl//:darwin_toolchain",
"@rules_perl//:linux_toolchain",
"@rules_perl//:windows_toolchain",
"@rules_perl//:linux_arm64_toolchain",
"@rules_perl//:linux_x86_64_toolchain",
"@rules_perl//:windows_x86_64_toolchain",
)

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
Expand Down
27 changes: 19 additions & 8 deletions perl/deps.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,36 @@ perl_download = _perl_download

# buildifier: disable=unnamed-macro
def perl_register_toolchains():
"""Register the relocatable perl toolchains."""
perl_download(
name = "perl_linux_amd64",
name = "perl_linux_arm64",
strip_prefix = "perl-aarch64-linux",
sha256 = "01af07bc84fc9c162b09eda880f5868b67ccb440071f8088e5278e1ae394aefd",
urls = [
"https://github.com/skaji/relocatable-perl/releases/download/5.36.0.0/perl-aarch64-linux.tar.xz",
],
)

perl_download(
name = "perl_linux_x86_64",
strip_prefix = "perl-x86_64-linux",
sha256 = "2cea6d78bf29c96450a70729e94ae2ef877dbc590fdaf3ef8dad74f7fae0d7de",
sha256 = "77ee5dfec156bd8135be3c2e9b295a393c7f7a0c7999b8932ff83ed938f65d02",
urls = [
"https://github.com/skaji/relocatable-perl/releases/download/5.30.1.1/perl-x86_64-linux.tar.xz",
"https://github.com/skaji/relocatable-perl/releases/download/5.36.0.0/perl-x86_64-linux.tar.xz",
],
)

perl_download(
name = "perl_darwin_2level",
strip_prefix = "perl-darwin-2level",
sha256 = "9ede6e5200d2b69524ed8074edbcddf8c4c3e8f67a756edce133cabaa4ad2347",
sha256 = "7c2e739c9da246f22e94a394cdc9d6817eba2c15c3db7aaca60b3c8cd5fe6611",
urls = [
"https://github.com/skaji/relocatable-perl/releases/download/5.30.1.1/perl-darwin-2level.tar.xz",
"https://github.com/skaji/relocatable-perl/releases/download/5.36.0.0/perl-darwin-2level.tar.xz",
],
)

perl_download(
name = "perl_windows_amd64",
name = "perl_windows_x86_64",
strip_prefix = "",
sha256 = "aeb973da474f14210d3e1a1f942dcf779e2ae7e71e4c535e6c53ebabe632cc98",
urls = [
Expand All @@ -37,8 +47,9 @@ def perl_register_toolchains():

native.register_toolchains(
"@rules_perl//:darwin_toolchain",
"@rules_perl//:linux_toolchain",
"@rules_perl//:windows_toolchain",
"@rules_perl//:linux_arm64_toolchain",
"@rules_perl//:linux_x86_64_toolchain",
"@rules_perl//:windows_x86_64_toolchain",
)

def perl_rules_dependencies():
Expand Down

0 comments on commit 71efd8d

Please sign in to comment.