diff --git a/textproc/the_silver_searcher/Makefile b/textproc/the_silver_searcher/Makefile index c09e9388bcf..676871919c0 100644 --- a/textproc/the_silver_searcher/Makefile +++ b/textproc/the_silver_searcher/Makefile @@ -1,10 +1,10 @@ -# $OpenBSD: Makefile,v 1.33 2019/07/12 20:50:16 sthen Exp $ +# $OpenBSD: Makefile,v 1.34 2021/01/29 16:38:00 semarie Exp $ COMMENT = code searching tool, with a focus on speed (ag) DISTNAME = the_silver_searcher-2.2.0 CATEGORIES = textproc -REVISION = 0 +REVISION = 1 HOMEPAGE = https://geoff.greer.fm/ag/ # Apache 2.0 diff --git a/textproc/the_silver_searcher/patches/patch-src_ignore_c b/textproc/the_silver_searcher/patches/patch-src_ignore_c new file mode 100644 index 00000000000..33344c6f38e --- /dev/null +++ b/textproc/the_silver_searcher/patches/patch-src_ignore_c @@ -0,0 +1,16 @@ +$OpenBSD: patch-src_ignore_c,v 1.3 2021/01/29 16:38:00 semarie Exp $ +Compile with -fno-common +https://github.com/ggreer/the_silver_searcher/commit/21eaa1c4160b868b0c5bbf59da17974429f30055 + +Index: src/ignore.c +--- src/ignore.c.orig ++++ src/ignore.c +@@ -20,6 +20,8 @@ + const int fnmatch_flags = FNM_PATHNAME; + #endif + ++ignores *root_ignores; ++ + /* TODO: build a huge-ass list of files we want to ignore by default (build cache stuff, pyc files, etc) */ + + const char *evil_hardcoded_ignore_files[] = { diff --git a/textproc/the_silver_searcher/patches/patch-src_ignore_h b/textproc/the_silver_searcher/patches/patch-src_ignore_h new file mode 100644 index 00000000000..d0693e4014a --- /dev/null +++ b/textproc/the_silver_searcher/patches/patch-src_ignore_h @@ -0,0 +1,16 @@ +$OpenBSD: patch-src_ignore_h,v 1.1 2021/01/29 16:38:00 semarie Exp $ +Compile with -fno-common +https://github.com/ggreer/the_silver_searcher/commit/21eaa1c4160b868b0c5bbf59da17974429f30055 + +Index: src/ignore.h +--- src/ignore.h.orig ++++ src/ignore.h +@@ -29,7 +29,7 @@ struct ignores { + }; + typedef struct ignores ignores; + +-ignores *root_ignores; ++extern ignores *root_ignores; + + extern const char *evil_hardcoded_ignore_files[]; + extern const char *ignore_pattern_files[]; diff --git a/textproc/the_silver_searcher/patches/patch-src_log_c b/textproc/the_silver_searcher/patches/patch-src_log_c new file mode 100644 index 00000000000..82dd7e3d22c --- /dev/null +++ b/textproc/the_silver_searcher/patches/patch-src_log_c @@ -0,0 +1,15 @@ +$OpenBSD: patch-src_log_c,v 1.1 2021/01/29 16:38:00 semarie Exp $ +Compile with -fno-common +https://github.com/ggreer/the_silver_searcher/commit/21eaa1c4160b868b0c5bbf59da17974429f30055 + +Index: src/log.c +--- src/log.c.orig ++++ src/log.c +@@ -4,6 +4,7 @@ + #include "log.h" + #include "util.h" + ++pthread_mutex_t print_mtx = PTHREAD_MUTEX_INITIALIZER; + static enum log_level log_threshold = LOG_LEVEL_ERR; + + void set_log_level(enum log_level threshold) { diff --git a/textproc/the_silver_searcher/patches/patch-src_log_h b/textproc/the_silver_searcher/patches/patch-src_log_h new file mode 100644 index 00000000000..d3509b54fcb --- /dev/null +++ b/textproc/the_silver_searcher/patches/patch-src_log_h @@ -0,0 +1,16 @@ +$OpenBSD: patch-src_log_h,v 1.1 2021/01/29 16:38:00 semarie Exp $ +Compile with -fno-common +https://github.com/ggreer/the_silver_searcher/commit/21eaa1c4160b868b0c5bbf59da17974429f30055 + +Index: src/log.h +--- src/log.h.orig ++++ src/log.h +@@ -9,7 +9,7 @@ + #include + #endif + +-pthread_mutex_t print_mtx; ++extern pthread_mutex_t print_mtx; + + enum log_level { + LOG_LEVEL_DEBUG = 10, diff --git a/textproc/the_silver_searcher/patches/patch-src_options_c b/textproc/the_silver_searcher/patches/patch-src_options_c new file mode 100644 index 00000000000..7bc83c14339 --- /dev/null +++ b/textproc/the_silver_searcher/patches/patch-src_options_c @@ -0,0 +1,16 @@ +$OpenBSD: patch-src_options_c,v 1.3 2021/01/29 16:38:00 semarie Exp $ +Compile with -fno-common +https://github.com/ggreer/the_silver_searcher/commit/21eaa1c4160b868b0c5bbf59da17974429f30055 + +Index: src/options.c +--- src/options.c.orig ++++ src/options.c +@@ -20,6 +20,8 @@ const char *color_line_number = "\033[1;33m"; /* bold + const char *color_match = "\033[30;43m"; /* black with yellow background */ + const char *color_path = "\033[1;32m"; /* bold green */ + ++cli_options opts; ++ + /* TODO: try to obey out_fd? */ + void usage(void) { + printf("\n"); diff --git a/textproc/the_silver_searcher/patches/patch-src_options_h b/textproc/the_silver_searcher/patches/patch-src_options_h new file mode 100644 index 00000000000..2888f5e271a --- /dev/null +++ b/textproc/the_silver_searcher/patches/patch-src_options_h @@ -0,0 +1,16 @@ +$OpenBSD: patch-src_options_h,v 1.1 2021/01/29 16:38:00 semarie Exp $ +Compile with -fno-common +https://github.com/ggreer/the_silver_searcher/commit/21eaa1c4160b868b0c5bbf59da17974429f30055 + +Index: src/options.h +--- src/options.h.orig ++++ src/options.h +@@ -91,7 +91,7 @@ typedef struct { + } cli_options; + + /* global options. parse_options gives it sane values, everything else reads from it */ +-cli_options opts; ++extern cli_options opts; + + typedef struct option option_t; + diff --git a/textproc/the_silver_searcher/patches/patch-src_search_c b/textproc/the_silver_searcher/patches/patch-src_search_c new file mode 100644 index 00000000000..288015ea119 --- /dev/null +++ b/textproc/the_silver_searcher/patches/patch-src_search_c @@ -0,0 +1,27 @@ +$OpenBSD: patch-src_search_c,v 1.3 2021/01/29 16:38:00 semarie Exp $ +Compile with -fno-common +https://github.com/ggreer/the_silver_searcher/commit/21eaa1c4160b868b0c5bbf59da17974429f30055 + +Index: src/search.c +--- src/search.c.orig ++++ src/search.c +@@ -2,6 +2,19 @@ + #include "print.h" + #include "scandir.h" + ++size_t alpha_skip_lookup[256]; ++size_t *find_skip_lookup; ++uint8_t h_table[H_SIZE] __attribute__((aligned(64))); ++ ++work_queue_t *work_queue = NULL; ++work_queue_t *work_queue_tail = NULL; ++int done_adding_files = 0; ++pthread_cond_t files_ready = PTHREAD_COND_INITIALIZER; ++pthread_mutex_t stats_mtx = PTHREAD_MUTEX_INITIALIZER; ++pthread_mutex_t work_queue_mtx = PTHREAD_MUTEX_INITIALIZER; ++ ++symdir_t *symhash = NULL; ++ + void search_buf(const char *buf, const size_t buf_len, + const char *dir_full_path) { + int binary = -1; /* 1 = yes, 0 = no, -1 = don't know */ diff --git a/textproc/the_silver_searcher/patches/patch-src_search_h b/textproc/the_silver_searcher/patches/patch-src_search_h new file mode 100644 index 00000000000..f2045647ae2 --- /dev/null +++ b/textproc/the_silver_searcher/patches/patch-src_search_h @@ -0,0 +1,48 @@ +$OpenBSD: patch-src_search_h,v 1.1 2021/01/29 16:38:00 semarie Exp $ +Compile with -fno-common +https://github.com/ggreer/the_silver_searcher/commit/21eaa1c4160b868b0c5bbf59da17974429f30055 + +Index: src/search.h +--- src/search.h.orig ++++ src/search.h +@@ -31,9 +31,9 @@ + #include "uthash.h" + #include "util.h" + +-size_t alpha_skip_lookup[256]; +-size_t *find_skip_lookup; +-uint8_t h_table[H_SIZE] __attribute__((aligned(64))); ++extern size_t alpha_skip_lookup[256]; ++extern size_t *find_skip_lookup; ++extern uint8_t h_table[H_SIZE] __attribute__((aligned(64))); + + struct work_queue_t { + char *path; +@@ -41,12 +41,12 @@ struct work_queue_t { + }; + typedef struct work_queue_t work_queue_t; + +-work_queue_t *work_queue; +-work_queue_t *work_queue_tail; +-int done_adding_files; +-pthread_cond_t files_ready; +-pthread_mutex_t stats_mtx; +-pthread_mutex_t work_queue_mtx; ++extern work_queue_t *work_queue; ++extern work_queue_t *work_queue_tail; ++extern int done_adding_files; ++extern pthread_cond_t files_ready; ++extern pthread_mutex_t stats_mtx; ++extern pthread_mutex_t work_queue_mtx; + + + /* For symlink loop detection */ +@@ -64,7 +64,7 @@ typedef struct { + UT_hash_handle hh; + } symdir_t; + +-symdir_t *symhash; ++extern symdir_t *symhash; + + void search_buf(const char *buf, const size_t buf_len, + const char *dir_full_path); diff --git a/textproc/the_silver_searcher/patches/patch-src_util_c b/textproc/the_silver_searcher/patches/patch-src_util_c new file mode 100644 index 00000000000..b0986667425 --- /dev/null +++ b/textproc/the_silver_searcher/patches/patch-src_util_c @@ -0,0 +1,16 @@ +$OpenBSD: patch-src_util_c,v 1.1 2021/01/29 16:38:00 semarie Exp $ +Compile with -fno-common +https://github.com/ggreer/the_silver_searcher/commit/21eaa1c4160b868b0c5bbf59da17974429f30055 + +Index: src/util.c +--- src/util.c.orig ++++ src/util.c +@@ -21,6 +21,8 @@ + } \ + return ptr; + ++FILE *out_fd = NULL; ++ag_stats stats; + void *ag_malloc(size_t size) { + void *ptr = malloc(size); + CHECK_AND_RETURN(ptr) diff --git a/textproc/the_silver_searcher/patches/patch-src_util_h b/textproc/the_silver_searcher/patches/patch-src_util_h new file mode 100644 index 00000000000..055c3468d0c --- /dev/null +++ b/textproc/the_silver_searcher/patches/patch-src_util_h @@ -0,0 +1,25 @@ +$OpenBSD: patch-src_util_h,v 1.1 2021/01/29 16:38:00 semarie Exp $ +Compile with -fno-common +https://github.com/ggreer/the_silver_searcher/commit/21eaa1c4160b868b0c5bbf59da17974429f30055 + +Index: src/util.h +--- src/util.h.orig ++++ src/util.h +@@ -12,7 +12,7 @@ + #include "log.h" + #include "options.h" + +-FILE *out_fd; ++extern FILE *out_fd; + + #ifndef TRUE + #define TRUE 1 +@@ -51,7 +51,7 @@ typedef struct { + } ag_stats; + + +-ag_stats stats; ++extern ag_stats stats; + + /* Union to translate between chars and words without violating strict aliasing */ + typedef union {