# Copyright (c) 2019. The YARA Authors. All Rights Reserved. # # Redistribution and use in source and binary forms, with or without modification, # are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, this # list of conditions and the following disclaimer. # # 2. Redistributions in binary form must reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation and/or # other materials provided with the distribution. # # 3. Neither the name of the copyright holder nor the names of its contributors # may be used to endorse or promote products derived from this software without # specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR # ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # Bazel (http://bazel.io/) WORKSPACE file for YARA. load("@com_github_virustotal_yara//:bazel/yara.bzl", "yara_library") # Just YARA's error codes. This is useful for sandboxing as it avoids pulling # in the whole library. cc_library( name = "yara_errors", hdrs = ["libyara/include/yara/error.h"], visibility = ["//visibility:public"], ) # Configuration setting for enabling profiling. Usage: # bazel build ... --define yara_profiling=enabled config_setting( name = "profiling_enabled", values = {"define": "yara_profiling=enabled"}, ) # Configuration setting for using BoringSSL instead of OpenSSL. Notice that # some features related to PE signatures in the "pe" module will be disabled # because of missing functionality in BoringSSL. Usage: # bazel build ... --define yara_crypto_library=boringssl config_setting( name = "crypto_library_boringssl", values = {"define": "yara_crypto_library=boringssl"}, ) yara_library( name = "libyara", crypto_libs = select({ ":crypto_library_boringssl": ["@boringssl//:crypto"], "//conditions:default": ["@openssl//:crypto"], }), defines = select({ ":profiling_enabled": ["YR_PROFILING_ENABLED"], "//conditions:default": [], }) + select({ ":crypto_library_boringssl": ["BORINGSSL"], "//conditions:default": [], }), modules = [ "cuckoo", "dex", "dotnet", "elf", "hash", "macho", "magic", "math", "pe", "tests", "time", "console", "string", ], modules_srcs = [ "libyara/modules/cuckoo/cuckoo.c", "libyara/modules/dex/dex.c", "libyara/modules/dotnet/dotnet.c", "libyara/modules/elf/elf.c", "libyara/modules/hash/hash.c", "libyara/modules/magic/magic.c", "libyara/modules/macho/macho.c", "libyara/modules/math/math.c", "libyara/modules/pe/pe.c", "libyara/modules/pe/pe_utils.c", "libyara/modules/tests/tests.c", "libyara/modules/time/time.c", "libyara/modules/console/console.c", "libyara/modules/string/string.c", ], deps = [ "@jansson", "@magic", ], ) # Code shared by the command-line tools. cc_library( name = "cli_shared", srcs = [ "cli/args.c", "cli/common.c", "cli/threading.c", ], hdrs = [ "cli/args.h", "cli/common.h", "cli/threading.h", "cli/unicode.h", ], deps = [":libyara"], ) # YARA command-line tool cc_binary( name = "yara", srcs = ["cli/yara.c"], visibility = ["//visibility:public"], deps = [ ":cli_shared", ":libyara", ], ) # YARA compiler cc_binary( name = "yarac", srcs = ["cli/yarac.c"], visibility = ["//visibility:public"], deps = [ ":cli_shared", ":libyara", ], )