mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-01-13 16:39:29 -05:00
bdba9d8ba6
* build: correct toolchain order * build: gazelle-update-repos * build: use pregenerated proto for dependencies * update bazeldnf * deps: tpm simulator * Update Google trillian module * cli: add stamping as alternative build info source * bazel: add go_test wrappers, mark special tests and select testing deps * deps: add libvirt deps * deps: go-libvirt patches * deps: cloudflare circl patches * bazel: add go_test wrappers, mark special tests and select testing deps * bazel: keep gazelle overrides * bazel: cleanup bazelrc * bazel: switch CMakeLists.txt to use bazel * bazel: fix injection of version information via stamping * bazel: commit all build files * dev-docs: document bazel usage * deps: upgrade zig-cc for go 1.20 * bazel: update Perl for macOS arm64 & Linux arm64 support * bazel: use static perl toolchain for OpenSSL * bazel: use static protobuf (protoc) toolchain * deps: add git and go to nix deps Co-authored-by: Paul Meyer <49727155+katexochen@users.noreply.github.com>
126 lines
3.3 KiB
Plaintext
126 lines
3.3 KiB
Plaintext
"""An openssl build file based on a snippet found in the github issue:
|
|
https://github.com/bazelbuild/rules_foreign_cc/issues/337
|
|
|
|
Note that the $(PERL) "make variable" (https://docs.bazel.build/versions/main/be/make-variables.html)
|
|
is populated by the perl toolchain provided by rules_perl.
|
|
"""
|
|
|
|
load("@rules_foreign_cc//foreign_cc:defs.bzl", "configure_make", "configure_make_variant")
|
|
|
|
# Read https://wiki.openssl.org/index.php/Compilation_and_Installation
|
|
|
|
filegroup(
|
|
name = "all_srcs",
|
|
srcs = glob(
|
|
include = ["**"],
|
|
exclude = ["*.bazel"],
|
|
),
|
|
)
|
|
|
|
CONFIGURE_OPTIONS = [
|
|
"no-comp",
|
|
"no-idea",
|
|
"no-weak-ssl-ciphers",
|
|
"no-tests",
|
|
]
|
|
|
|
LIB_NAME = "openssl"
|
|
|
|
MAKE_TARGETS = [
|
|
"build_programs",
|
|
"install_sw",
|
|
]
|
|
|
|
config_setting(
|
|
name = "msvc_compiler",
|
|
flag_values = {
|
|
"@bazel_tools//tools/cpp:compiler": "msvc-cl",
|
|
},
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
alias(
|
|
name = "openssl",
|
|
actual = select({
|
|
":msvc_compiler": "openssl_msvc",
|
|
"//conditions:default": "openssl_default",
|
|
}),
|
|
visibility = ["//visibility:public"],
|
|
)
|
|
|
|
configure_make_variant(
|
|
name = "openssl_msvc",
|
|
build_data = [
|
|
"@nasm//:nasm",
|
|
],
|
|
configure_command = "Configure",
|
|
configure_in_place = True,
|
|
configure_options = CONFIGURE_OPTIONS + [
|
|
"VC-WIN64A",
|
|
# Unset Microsoft Assembler (MASM) flags set by built-in MSVC toolchain,
|
|
# as NASM is unsed to build OpenSSL rather than MASM
|
|
"ASFLAGS=\" \"",
|
|
],
|
|
configure_prefix = "$$PERL",
|
|
env = {
|
|
# The Zi flag must be set otherwise OpenSSL fails to build due to missing .pdb files
|
|
"CFLAGS": "-Zi",
|
|
"PATH": "$$(dirname $(execpath @nasm//:nasm))",
|
|
"PERL": "$$EXT_BUILD_ROOT$$/$(PERL)",
|
|
},
|
|
lib_name = LIB_NAME,
|
|
lib_source = ":all_srcs",
|
|
out_binaries = ["openssl.exe"],
|
|
out_interface_libs = [
|
|
"libssl.lib",
|
|
"libcrypto.lib",
|
|
],
|
|
out_shared_libs = [
|
|
"libssl-1_1-x64.dll",
|
|
"libcrypto-1_1-x64.dll",
|
|
],
|
|
targets = MAKE_TARGETS,
|
|
toolchain = "@rules_foreign_cc//toolchains:preinstalled_nmake_toolchain",
|
|
toolchains = ["@rules_perl//:current_toolchain"],
|
|
)
|
|
|
|
configure_make(
|
|
name = "openssl_default",
|
|
configure_command = "config",
|
|
configure_in_place = True,
|
|
configure_options = CONFIGURE_OPTIONS,
|
|
env = select({
|
|
"@platforms//os:macos": {
|
|
"AR": "",
|
|
"PERL": "$$EXT_BUILD_ROOT$$/$(PERL)",
|
|
},
|
|
"//conditions:default": {
|
|
"PERL": "$$EXT_BUILD_ROOT$$/$(PERL)",
|
|
},
|
|
}),
|
|
lib_name = LIB_NAME,
|
|
lib_source = ":all_srcs",
|
|
out_binaries = ["openssl"],
|
|
# Note that for Linux builds, libssl must come before libcrypto on the linker command-line.
|
|
# As such, libssl must be listed before libcrypto
|
|
out_shared_libs = select({
|
|
"@platforms//os:macos": [
|
|
"libssl.1.1.dylib",
|
|
"libcrypto.1.1.dylib",
|
|
],
|
|
"//conditions:default": [
|
|
"libssl.so.1.1",
|
|
"libcrypto.so.1.1",
|
|
],
|
|
}),
|
|
targets = MAKE_TARGETS,
|
|
toolchains = ["@rules_perl//:current_toolchain"],
|
|
)
|
|
|
|
filegroup(
|
|
name = "gen_dir",
|
|
srcs = [":openssl"],
|
|
output_group = "gen_dir",
|
|
visibility = ["//visibility:public"],
|
|
)
|