2018-02-26 14:04:36 +00:00
|
|
|
package(
|
|
|
|
default_visibility = ["//visibility:public"],
|
|
|
|
)
|
|
|
|
|
|
|
|
cc_library(
|
|
|
|
name = "libdivsufsort",
|
|
|
|
srcs = [
|
|
|
|
"lib/divsufsort.c",
|
|
|
|
"lib/sssort.c",
|
|
|
|
"lib/trsort.c",
|
|
|
|
"lib/utils.c",
|
|
|
|
],
|
|
|
|
hdrs = [
|
|
|
|
"include/config.h",
|
|
|
|
"include/divsufsort.h",
|
|
|
|
"include/divsufsort_private.h",
|
|
|
|
],
|
|
|
|
copts = [
|
|
|
|
"-DHAVE_CONFIG_H=1",
|
|
|
|
],
|
|
|
|
includes = ["include"],
|
2021-08-18 17:15:07 +00:00
|
|
|
include_prefix = "third_party/libdivsufsort",
|
2018-02-26 14:04:36 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
commom_awk_replaces = (
|
|
|
|
"gsub(/#cmakedefine/, \"#define\"); " +
|
|
|
|
"gsub(/@DIVSUFSORT_EXPORT@/, \"\"); " +
|
|
|
|
"gsub(/@DIVSUFSORT_IMPORT@/, \"\"); " +
|
|
|
|
"gsub(/@INLINE@/, \"inline\"); " +
|
|
|
|
"gsub(/@INCFILE@/, \"#include <inttypes.h>\"); " +
|
|
|
|
"gsub(/@SAUCHAR_TYPE@/, \"uint8_t\"); " +
|
|
|
|
"gsub(/@SAINT32_TYPE@/, \"int32_t\"); " +
|
|
|
|
"gsub(/@SAINT_PRId@/, \"PRId32\"); "
|
|
|
|
)
|
|
|
|
|
|
|
|
genrule(
|
|
|
|
name = "config_h",
|
|
|
|
srcs = ["include/config.h.cmake"],
|
|
|
|
outs = ["include/config.h"],
|
|
|
|
cmd = ("awk '{ " +
|
2021-08-31 12:07:17 +00:00
|
|
|
"gsub(/HAVE_IO_H 1/, \"HAVE_IO_H 0\"); " +
|
|
|
|
"gsub(/HAVE_STRINGS_H 1/, \"HAVE_STRINGS_H 0\"); " +
|
2018-02-26 14:04:36 +00:00
|
|
|
commom_awk_replaces +
|
|
|
|
"print; }' $(<) > $(@)"),
|
|
|
|
)
|
|
|
|
|
|
|
|
genrule(
|
|
|
|
name = "divsufsort_h",
|
|
|
|
srcs = ["include/divsufsort.h.cmake"],
|
|
|
|
outs = ["include/divsufsort.h"],
|
|
|
|
cmd = ("awk '{ " +
|
|
|
|
"gsub(/@W64BIT@/, \"\"); " +
|
|
|
|
"gsub(/@SAINDEX_TYPE@/, \"int32_t\"); " +
|
|
|
|
"gsub(/@SAINDEX_PRId@/, \"PRId32\"); " +
|
|
|
|
commom_awk_replaces +
|
|
|
|
"print; }' $(<) > $(@)"),
|
|
|
|
)
|