fork/rules_rust
git clone https://git.julia.blue/fork/rules_rust
e21071ab
cleanup
1# The code here was picked up from the `rules_foreign_cc` openssl example 2# https://github.com/bazelbuild/rules_foreign_cc/tree/0.5.1/examples/third_party/openssl 3 4load ( "@rules_foreign_cc//foreign_cc:defs.bzl" , "configure_make" , "configure_make_variant" ) 5 6# Read https://wiki.openssl.org/index.php/Compilation_and_Installation 7 8filegroup ( 9name = "all_srcs" , 10srcs = glob ([ "**" ]), 11) 12 13CONFIGURE_OPTIONS = [ 14"no-comp" , 15"no-idea" , 16"no-weak-ssl-ciphers" , 17"no-shared" , 18] 19 20LIB_NAME = "openssl" 21 22MAKE_TARGETS = [ 23"build_libs" , 24"install_dev" , 25] 26 27config_setting ( 28name = "msvc_compiler" , 29flag_values = { 30"@bazel_tools//tools/cpp:compiler" : "msvc-cl" , 31}, 32visibility = [ "//visibility:public" ], 33) 34 35alias ( 36name = "openssl" , 37actual = select ({ 38":msvc_compiler" : "openssl_msvc" , 39"//conditions:default" : "openssl_default" , 40}), 41visibility = [ "//visibility:public" ], 42) 43 44configure_make_variant ( 45name = "openssl_msvc" , 46build_data = [ 47"@nasm_windows//:nasm" , 48"@perl_windows//:perl" , 49], 50configure_command = "Configure" , 51configure_in_place = True , 52configure_options = CONFIGURE_OPTIONS + [ 53"VC-WIN64A" , 54# Unset Microsoft Assembler (MASM) flags set by built-in MSVC toolchain, 55# as NASM is unsed to build OpenSSL rather than MASM 56 "ASFLAGS=\" \"" , 57], 58configure_prefix = "$PERL" , 59env = { 60# The Zi flag must be set otherwise OpenSSL fails to build due to missing .pdb files 61"CFLAGS" : "-Zi" , 62"PATH" : "$(dirname $(execpath @nasm_windows//:nasm)):$PATH" , 63"PERL" : "$(execpath @perl_windows//:perl)" , 64}, 65lib_name = LIB_NAME , 66lib_source = ":all_srcs" , 67out_static_libs = [ 68"libssl.lib" , 69"libcrypto.lib" , 70], 71targets = MAKE_TARGETS , 72toolchain = "@rules_foreign_cc//toolchains:preinstalled_nmake_toolchain" , 73) 74 75configure_make ( 76name = "openssl_default" , 77configure_command = "config" , 78configure_in_place = True , 79configure_options = CONFIGURE_OPTIONS , 80env = select ({ 81"@platforms//os:macos" : { "AR" : "" }, 82"//conditions:default" : {}, 83}), 84lib_name = LIB_NAME , 85lib_source = ":all_srcs" , 86# Note that for Linux builds, libssl must come before libcrypto on the linker command-line. 87# As such, libssl must be listed before libcrypto 88out_static_libs = [ 89"libssl.a" , 90"libcrypto.a" , 91], 92targets = MAKE_TARGETS , 93) 94 95filegroup ( 96name = "gen_dir" , 97srcs = [ ":openssl" ], 98output_group = "gen_dir" , 99visibility = [ "//visibility:public" ], 100)