Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Adds `config.h` for macOS (Intel and Apple Silicon).
This was tested on both Intel and Apple Silicon Macs.

This will allow building `@openssh//:sshd` on macOS after this and #3149
have been merged.
  • Loading branch information
malt3 authored Nov 11, 2024
1 parent da51074 commit e5f617a
Show file tree
Hide file tree
Showing 21 changed files with 1,984 additions and 1 deletion.
16 changes: 16 additions & 0 deletions modules/libxcrypt/4.4.36.bcr.1/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
module(
name = "libxcrypt",
version = "4.4.36.bcr.1",
bazel_compatibility = [
">=7.1.0",
],
compatibility_level = 4,
)

bazel_dep(name = "rules_cc", version = "0.0.10")
bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "rules_coreutils", version = "1.0.0-beta.6")
bazel_dep(name = "bazel_skylib", version = "1.4.0")
bazel_dep(name = "toolchain_utils", version = "1.0.0-beta.16")

bazel_dep(name = "rules_python", version = "0.37.1", dev_dependency = True)
52 changes: 52 additions & 0 deletions modules/libxcrypt/4.4.36.bcr.1/overlay/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
load("@bazel_skylib//rules:expand_template.bzl", "expand_template")

expand_template(
name = "header",
out = "crypt.h",
substitutions = {
"@BEGIN_DECLS@": "__BEGIN_DECLS",
"@DEFAULT_PREFIX_ENABLED@": "1",
"@XCRYPT_VERSION_MAJOR@": "4",
"@XCRYPT_VERSION_MINOR@": "4",
"@XCRYPT_VERSION_STR@": "4.4",
"@END_DECLS@": "__END_DECLS",
},
template = "//lib:crypt.h.in",
visibility = ["//lib:__pkg__"],
)

genrule(
name = "cfg",
srcs = ["//config"],
outs = ["config.h"],
cmd = "$(CP) $< $@",
cmd_bat = "$(CP) $< $@",
toolchains = ["@rules_coreutils//coreutils/toolchain/cp:resolved"],
visibility = ["//lib:__pkg__"],
)

genrule(
name = "hashes",
srcs = ["//crypt-hashes"],
outs = ["crypt-hashes.h"],
cmd = "$(CP) $< $@",
cmd_bat = "$(CP) $< $@",
toolchains = ["@rules_coreutils//coreutils/toolchain/cp:resolved"],
visibility = ["//lib:__pkg__"],
)

genrule(
name = "symbol-vers",
srcs = ["//crypt-symbol-vers"],
outs = ["crypt-symbol-vers.h"],
cmd = "$(CP) $< $@",
cmd_bat = "$(CP) $< $@",
toolchains = ["@rules_coreutils//coreutils/toolchain/cp:resolved"],
visibility = ["//lib:__pkg__"],
)

alias(
name = "libxcrypt",
actual = "//lib",
visibility = ["//visibility:public"],
)
1 change: 1 addition & 0 deletions modules/libxcrypt/4.4.36.bcr.1/overlay/MODULE.bazel
Empty file.
45 changes: 45 additions & 0 deletions modules/libxcrypt/4.4.36.bcr.1/overlay/config/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
config_setting(
name = "amd64-linux",
constraint_values = [
"@platforms//cpu:x86_64",
"@platforms//os:linux",
],
)

config_setting(
name = "arm64-linux",
constraint_values = [
"@platforms//cpu:aarch64",
"@platforms//os:linux",
],
)

config_setting(
name = "amd64-macos",
constraint_values = [
"@platforms//cpu:x86_64",
"@platforms//os:macos",
],
)

config_setting(
name = "arm64-macos",
constraint_values = [
"@platforms//cpu:aarch64",
"@platforms//os:macos",
],
)

alias(
name = "config",
actual = select(
{
":amd64-linux": "amd64-linux.h",
":arm64-linux": "arm64-linux.h",
":amd64-macos": "amd64-macos.h",
":arm64-macos": "arm64-macos.h",
},
no_match_error = "No `config.h` available for target platform",
),
visibility = ["//:__pkg__"],
)
Loading

0 comments on commit e5f617a

Please sign in to comment.