1load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") 2load("@bazel_skylib//rules:copy_file.bzl", "copy_file") 3 4copy_file( 5 name = "config_h_generic", 6 src = "src/config.h.generic", 7 out = "src/config.h", 8) 9 10copy_file( 11 name = "pcre2_h_generic", 12 src = "src/pcre2.h.generic", 13 out = "src/pcre2.h", 14) 15 16copy_file( 17 name = "pcre2_chartables_c", 18 src = "src/pcre2_chartables.c.dist", 19 out = "src/pcre2_chartables.c", 20) 21 22# Removed src/pcre2_ucptables.c below because it is #included in 23# src/pcre2_tables.c. Also fixed typo: ckdint should be chkdint. 24# PH, 22-March-2023. 25cc_library( 26 name = "pcre2", 27 srcs = [ 28 "src/pcre2_auto_possess.c", 29 "src/pcre2_chkdint.c", 30 "src/pcre2_compile.c", 31 "src/pcre2_config.c", 32 "src/pcre2_context.c", 33 "src/pcre2_convert.c", 34 "src/pcre2_dfa_match.c", 35 "src/pcre2_error.c", 36 "src/pcre2_extuni.c", 37 "src/pcre2_find_bracket.c", 38 "src/pcre2_maketables.c", 39 "src/pcre2_match.c", 40 "src/pcre2_match_data.c", 41 "src/pcre2_newline.c", 42 "src/pcre2_ord2utf.c", 43 "src/pcre2_pattern_info.c", 44 "src/pcre2_script_run.c", 45 "src/pcre2_serialize.c", 46 "src/pcre2_string_utils.c", 47 "src/pcre2_study.c", 48 "src/pcre2_substitute.c", 49 "src/pcre2_substring.c", 50 "src/pcre2_tables.c", 51 "src/pcre2_ucd.c", 52 "src/pcre2_valid_utf.c", 53 "src/pcre2_xclass.c", 54 ":pcre2_chartables_c", 55 ], 56 hdrs = glob(["src/*.h"]) + [ 57 ":config_h_generic", 58 ":pcre2_h_generic", 59 ], 60 defines = [ 61 "HAVE_CONFIG_H", 62 "PCRE2_CODE_UNIT_WIDTH=8", 63 "PCRE2_STATIC", 64 ], 65 includes = ["src"], 66 strip_include_prefix = "src", 67 visibility = ["//visibility:public"], 68) 69 70cc_binary( 71 name = "pcre2demo", 72 srcs = ["src/pcre2demo.c"], 73 visibility = ["//visibility:public"], 74 deps = [":pcre2"], 75) 76