| load("@bazel_skylib//rules:copy_file.bzl", "copy_file") |
| load("@bazel_skylib//rules:native_binary.bzl", "native_test") |
| load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library") |
|
|
| copy_file( |
| name = "config_h_generic", |
| src = "src/config.h.generic", |
| out = "src/config.h", |
| ) |
|
|
| copy_file( |
| name = "pcre2_h_generic", |
| src = "src/pcre2.h.generic", |
| out = "src/pcre2.h", |
| ) |
|
|
| copy_file( |
| name = "pcre2_chartables_c", |
| src = "src/pcre2_chartables.c.dist", |
| out = "src/pcre2_chartables.c", |
| ) |
|
|
| LOCAL_DEFINES = [ |
| "HAVE_CONFIG_H", |
| "SUPPORT_PCRE2_8", |
| "SUPPORT_UNICODE", |
| ] + select({ |
| "@platforms//os:windows": [], |
| "//conditions:default": ["HAVE_UNISTD_H"], |
| }) |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| cc_library( |
| name = "pcre2_internal_headers", |
| hdrs = [ |
| "src/pcre2_compile.h", |
| "src/pcre2_internal.h", |
| "src/pcre2_intmodedep.h", |
| "src/pcre2_jit_match_inc.h", |
| "src/pcre2_jit_misc_inc.h", |
| "src/pcre2_printint_inc.h", |
| "src/pcre2_ucp.h", |
| "src/pcre2_ucptables_inc.h", |
| "src/pcre2_util.h", |
| "src/pcre2test_inc.h", |
| ":config_h_generic", |
| ], |
| strip_include_prefix = "src", |
| visibility = ["//visibility:private"], |
| ) |
|
|
| cc_library( |
| name = "pcre2", |
| srcs = [ |
| "src/pcre2_auto_possess.c", |
| "src/pcre2_chkdint.c", |
| "src/pcre2_compile.c", |
| "src/pcre2_compile_cgroup.c", |
| "src/pcre2_compile_class.c", |
| "src/pcre2_config.c", |
| "src/pcre2_context.c", |
| "src/pcre2_convert.c", |
| "src/pcre2_dfa_match.c", |
| "src/pcre2_error.c", |
| "src/pcre2_extuni.c", |
| "src/pcre2_find_bracket.c", |
| "src/pcre2_jit_compile.c", |
| "src/pcre2_maketables.c", |
| "src/pcre2_match.c", |
| "src/pcre2_match_data.c", |
| "src/pcre2_match_next.c", |
| "src/pcre2_newline.c", |
| "src/pcre2_ord2utf.c", |
| "src/pcre2_pattern_info.c", |
| "src/pcre2_script_run.c", |
| "src/pcre2_serialize.c", |
| "src/pcre2_string_utils.c", |
| "src/pcre2_study.c", |
| "src/pcre2_substitute.c", |
| "src/pcre2_substring.c", |
| "src/pcre2_tables.c", |
| "src/pcre2_ucd.c", |
| "src/pcre2_valid_utf.c", |
| "src/pcre2_xclass.c", |
| ":pcre2_chartables_c", |
| ], |
| hdrs = [":pcre2_h_generic"], |
| implementation_deps = [":pcre2_internal_headers"], |
| defines = [ |
| "PCRE2_STATIC", |
| ], |
| local_defines = LOCAL_DEFINES + [ |
| "PCRE2_CODE_UNIT_WIDTH=8", |
| ], |
| strip_include_prefix = "src", |
| linkstatic = True, |
| visibility = ["//visibility:public"], |
| ) |
|
|
| |
| |
| |
| cc_library( |
| name = "pcre2posix_dotc_headers", |
| hdrs = [ |
| "src/pcre2_tables.c", |
| ], |
| strip_include_prefix = "src", |
| visibility = ["//visibility:private"], |
| ) |
|
|
| cc_library( |
| name = "pcre2-posix", |
| srcs = ["src/pcre2posix.c"], |
| hdrs = ["src/pcre2posix.h"], |
| implementation_deps = [ |
| ":pcre2_internal_headers", |
| ":pcre2posix_dotc_headers", |
| ], |
| local_defines = LOCAL_DEFINES + [ |
| "PCRE2_CODE_UNIT_WIDTH=8", |
| ], |
| strip_include_prefix = "src", |
| linkstatic = True, |
| visibility = ["//visibility:public"], |
| deps = [ |
| ":pcre2", |
| ], |
| ) |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| cc_library( |
| name = "pcre2test_dotc_headers", |
| hdrs = [ |
| "src/pcre2_chkdint.c", |
| "src/pcre2_tables.c", |
| "src/pcre2_ucd.c", |
| "src/pcre2_valid_utf.c", |
| ], |
| strip_include_prefix = "src", |
| visibility = ["//visibility:private"], |
| ) |
|
|
| cc_binary( |
| name = "pcre2test", |
| srcs = ["src/pcre2test.c"], |
| linkopts = select({ |
| "@platforms//os:windows": ["-STACK:2500000"], |
| "//conditions:default": [], |
| }), |
| local_defines = LOCAL_DEFINES, |
| visibility = ["//visibility:public"], |
| deps = [ |
| ":pcre2", |
| ":pcre2-posix", |
| ":pcre2_internal_headers", |
| ":pcre2test_dotc_headers", |
| ], |
| ) |
|
|
| filegroup( |
| name = "testdata", |
| srcs = glob(["testdata/*"]), |
| ) |
|
|
| native_test( |
| name = "pcre2_test", |
| size = "small", |
| src = select({ |
| "@platforms//os:windows": "RunTest.bat", |
| "//conditions:default": "RunTest", |
| }), |
| out = select({ |
| "@platforms//os:windows": "RunTest.bat", |
| "//conditions:default": "RunTest", |
| }), |
| data = [ |
| ":pcre2test", |
| ":testdata", |
| ], |
| ) |
|
|