load("@bazel_skylib//rules:write_file.bzl", "write_file") load("@rules_cc//cc:cc_library.bzl", "cc_library") _CONFIG_H = """ #define HAVE_MEMMOVE #define NEWLINE 10 #define POSIX_MALLOC_THRESHOLD 10 #define LINK_SIZE 2 #define PARENS_NEST_LIMIT 250 #define MATCH_LIMIT 10000000 #define MATCH_LIMIT_RECURSION MATCH_LIMIT #define MAX_NAME_SIZE 32 #define MAX_NAME_COUNT 10000 """ write_file( name = "pcre_config_h", out = "config.h", content = [_CONFIG_H], newline = "unix", ) cc_library( name = "pcre_config", hdrs = [":pcre_config_h"], strip_include_prefix = "/deps/pcre", ) cc_library( name = "pcre_hdrs", hdrs = ["pcre.h"], strip_include_prefix = "/deps/pcre", visibility = ["//:__subpackages__"], ) cc_library( name = "pcre", srcs = glob(["*.c"]) + [ "pcre_internal.h", "pcreposix.h", "ucp.h", ], implementation_deps = [":pcre_config"], local_defines = ["HAVE_CONFIG_H"], visibility = ["//:__subpackages__"], deps = [":pcre_hdrs"], )