commit a9973ec

hovercats  ·  2024-06-09 09:22:53 +0000 UTC
parent 7168ad8
the_silver_searcher: import from oasis
17 files changed,  +483, -0
+4, -0
1@@ -141,3 +141,7 @@
2 	path = pkg/zstd/src
3 	url = https://github.com/facebook/zstd
4 	ignore = all
5+[submodule "pkg/the_silver_searcher/src"]
6+	path = pkg/the_silver_searcher/src
7+	url = https://github.com/ggreer/the_silver_searcher
8+	ignore = all
+2, -0
 1@@ -39,6 +39,7 @@ subgen 'oksh'
 2 subgen 'openbsd'
 3 subgen 'openntpd'
 4 subgen 'openssh'
 5+subgen 'pcre'
 6 subgen 'pigz'
 7 subgen 'qbe'
 8 subgen 'quark'
 9@@ -50,6 +51,7 @@ subgen 'sbase'
10 subgen 'sdhcp'
11 subgen 'skeleton'
12 subgen 'strace'
13+subgen 'the_silver_searcher'
14 subgen 'tinyalsa'
15 subgen 'transmission'
16 subgen 'tz'
+2, -0
1@@ -0,0 +1,2 @@
2+/pcre-8.45.tar.gz
3+/src
+11, -0
 1@@ -0,0 +1,11 @@
 2+# pcre
 3+
 4+## config.h
 5+Generated with
 6+
 7+	./configure \
 8+		--disable-cpp \
 9+		--disable-shared \
10+		--enable-jit \
11+		--enable-utf8 \
12+		--enable-unicode-properties
+83, -0
 1@@ -0,0 +1,83 @@
 2+/* #undef BSR_ANYCRLF */
 3+/* #undef EBCDIC */
 4+/* #undef EBCDIC_NL25 */
 5+#define HAVE_BCOPY 1
 6+/* #undef HAVE_BITS_TYPE_TRAITS_H */
 7+/* #undef HAVE_BZLIB_H */
 8+#define HAVE_DIRENT_H 1
 9+#define HAVE_DLFCN_H 1
10+/* #undef HAVE_EDITLINE_READLINE_H */
11+/* #undef HAVE_EDIT_READLINE_READLINE_H */
12+#define HAVE_INTTYPES_H 1
13+#define HAVE_LIMITS_H 1
14+/* #undef HAVE_LONG_LONG */
15+#define HAVE_MEMMOVE 1
16+#define HAVE_PTHREAD 1
17+#define HAVE_PTHREAD_PRIO_INHERIT 1
18+/* #undef HAVE_READLINE_HISTORY_H */
19+/* #undef HAVE_READLINE_READLINE_H */
20+#define HAVE_STDINT_H 1
21+#define HAVE_STDIO_H 1
22+#define HAVE_STDLIB_H 1
23+#define HAVE_STRERROR 1
24+/* #undef HAVE_STRING */
25+#define HAVE_STRINGS_H 1
26+#define HAVE_STRING_H 1
27+/* #undef HAVE_STRTOIMAX */
28+/* #undef HAVE_STRTOLL */
29+/* #undef HAVE_STRTOQ */
30+#define HAVE_SYS_STAT_H 1
31+#define HAVE_SYS_TYPES_H 1
32+/* #undef HAVE_TYPE_TRAITS_H */
33+#define HAVE_UNISTD_H 1
34+/* #undef HAVE_UNSIGNED_LONG_LONG */
35+#define HAVE_VISIBILITY 1
36+/* #undef HAVE_WINDOWS_H */
37+/* #undef HAVE_ZLIB_H */
38+/* #undef HAVE__STRTOI64 */
39+#define LINK_SIZE 2
40+#define LT_OBJDIR ".libs/"
41+#define MATCH_LIMIT 10000000
42+#define MATCH_LIMIT_RECURSION MATCH_LIMIT
43+#define MAX_NAME_COUNT 10000
44+#define MAX_NAME_SIZE 32
45+#define NEWLINE 10
46+/* #undef NO_RECURSE */
47+#define PACKAGE "pcre"
48+#define PACKAGE_BUGREPORT ""
49+#define PACKAGE_NAME "PCRE"
50+#define PACKAGE_STRING "PCRE 8.45"
51+#define PACKAGE_TARNAME "pcre"
52+#define PACKAGE_URL ""
53+#define PACKAGE_VERSION "8.45"
54+#define PARENS_NEST_LIMIT 250
55+#define PCRECPP_EXP_DECL extern __attribute__ ((visibility ("default")))
56+#define PCRECPP_EXP_DEFN __attribute__ ((visibility ("default")))
57+#define PCREGREP_BUFSIZE 20480
58+#define PCREPOSIX_EXP_DECL extern __attribute__ ((visibility ("default")))
59+#define PCREPOSIX_EXP_DEFN extern __attribute__ ((visibility ("default")))
60+#define PCRE_EXP_DATA_DEFN __attribute__ ((visibility ("default")))
61+#define PCRE_EXP_DECL extern __attribute__ ((visibility ("default")))
62+#define PCRE_EXP_DEFN __attribute__ ((visibility ("default")))
63+#define PCRE_STATIC 1
64+#define POSIX_MALLOC_THRESHOLD 10
65+/* #undef PTHREAD_CREATE_JOINABLE */
66+#define STDC_HEADERS 1
67+#ifdef __GNUC__
68+#define SUPPORT_JIT /**/
69+#endif
70+/* #undef SUPPORT_LIBBZ2 */
71+/* #undef SUPPORT_LIBEDIT */
72+/* #undef SUPPORT_LIBREADLINE */
73+/* #undef SUPPORT_LIBZ */
74+/* #undef SUPPORT_PCRE16 */
75+/* #undef SUPPORT_PCRE32 */
76+#define SUPPORT_PCRE8 /**/
77+#define SUPPORT_PCREGREP_JIT /**/
78+#define SUPPORT_UCP /**/
79+#define SUPPORT_UTF /**/
80+/* #undef SUPPORT_VALGRIND */
81+#define VERSION "8.45"
82+/* #undef const */
83+/* #undef int64_t */
84+/* #undef size_t */
+43, -0
 1@@ -0,0 +1,43 @@
 2+cflags{
 3+	'-D HAVE_CONFIG_H',
 4+	'-I $dir',
 5+	'-I $srcdir',
 6+	'-I $outdir/include',
 7+}
 8+
 9+build('sed', '$outdir/include/pcre.h', '$srcdir/pcre.h.in', {
10+	expr={
11+		'-e s,@PCRE_MAJOR@,8,',
12+		'-e s,@PCRE_MINOR@,43,',
13+		'-e s,@PCRE_PRERELEASE@,,',
14+		'-e s,@PCRE_DATE@,2019-02-23,',
15+	},
16+})
17+pkg.hdrs = {'$outdir/include/pcre.h'}
18+
19+build('copy', '$outdir/pcre_chartables.c', '$srcdir/pcre_chartables.c.dist')
20+lib('libpcre.a', {
21+	'pcre_byte_order.c',
22+	'pcre_compile.c',
23+	'pcre_config.c',
24+	'pcre_dfa_exec.c',
25+	'pcre_exec.c',
26+	'pcre_fullinfo.c',
27+	'pcre_get.c',
28+	'pcre_globals.c',
29+	'pcre_jit_compile.c',
30+	'pcre_maketables.c',
31+	'pcre_newline.c',
32+	'pcre_ord2utf8.c',
33+	'pcre_refcount.c',
34+	'pcre_string_utils.c',
35+	'pcre_study.c',
36+	'pcre_tables.c',
37+	'pcre_ucd.c',
38+	'pcre_valid_utf8.c',
39+	'pcre_version.c',
40+	'pcre_xclass.c',
41+	'$outdir/pcre_chartables.c',
42+}, {'$gendir/headers'})
43+
44+fetch 'curl'
+1, -0
1@@ -0,0 +1 @@
2+4e6ce03e0336e8b4a3d6c2b70b1c5e18590a5673a98186da90d4f33c23defc09  pcre-8.45.tar.gz
+1, -0
1@@ -0,0 +1 @@
2+url = "https://sourceforge.net/projects/pcre/files/pcre/8.45/pcre-8.45.tar.gz"
+1, -0
1@@ -0,0 +1 @@
2+8.45 r0
+39, -0
 1@@ -0,0 +1,39 @@
 2+/* #undef HAVE_DIRENT_DNAMLEN */
 3+#define HAVE_DIRENT_DTYPE /**/
 4+#define HAVE_ERR_H 1
 5+#define HAVE_FGETLN 1
 6+/* #undef HAVE_FOPENCOOKIE */
 7+#define HAVE_GETLINE 1
 8+#define HAVE_INTTYPES_H 1
 9+/* #undef HAVE_LIBSHLWAPI */
10+/* #undef HAVE_LZMA_H */
11+#define HAVE_MADVISE 1
12+#define HAVE_MEMORY_H 1
13+/* #undef HAVE_PLEDGE */
14+#define HAVE_POSIX_FADVISE 1
15+#define HAVE_PTHREAD_H 1
16+#define HAVE_PTHREAD_PRIO_INHERIT 1
17+#define HAVE_PTHREAD_SETAFFINITY_NP 1
18+#define HAVE_REALPATH 1
19+#define HAVE_STDINT_H 1
20+#define HAVE_STDLIB_H 1
21+#define HAVE_STRINGS_H 1
22+#define HAVE_STRING_H 1
23+#define HAVE_STRLCPY 1
24+#define HAVE_STRNDUP 1
25+/* #undef HAVE_SYS_CPUSET_H */
26+#define HAVE_SYS_STAT_H 1
27+#define HAVE_SYS_TYPES_H 1
28+#define HAVE_UNISTD_H 1
29+#define HAVE_VASPRINTF 1
30+#define HAVE_ZLIB_H 1
31+#define PACKAGE_BUGREPORT "https://github.com/ggreer/the_silver_searcher/issues"
32+#define PACKAGE_NAME "the_silver_searcher"
33+#define PACKAGE_STRING "the_silver_searcher 2.2.0"
34+#define PACKAGE_TARNAME "the_silver_searcher"
35+#define PACKAGE_URL "https://github.com/ggreer/the_silver_searcher"
36+#define PACKAGE_VERSION "2.2.0"
37+/* #undef PTHREAD_CREATE_JOINABLE */
38+#define STDC_HEADERS 1
39+#define USE_CPU_SET /**/
40+#define USE_PCRE_JIT /**/
+24, -0
 1@@ -0,0 +1,24 @@
 2+cflags{
 3+	'-D _GNU_SOURCE',
 4+	'-I $dir',
 5+	'-isystem $builddir/pkg/pcre/include',
 6+	'-isystem $builddir/pkg/zlib/include',
 7+}
 8+
 9+pkg.deps = {
10+	'pkg/pcre/headers',
11+	'pkg/zlib/headers',
12+}
13+
14+exe('ag', [[
15+	src/(
16+	        ignore.c log.c options.c print.c print_w32.c scandir.c search.c lang.c
17+	        util.c decompress.c main.c
18+	)
19+	$builddir/pkg/pcre/libpcre.a
20+	$builddir/pkg/zlib/libz.a
21+]])
22+file('bin/ag', '755', '$outdir/ag')
23+man{'doc/ag.1'}
24+
25+fetch 'git'
+26, -0
 1@@ -0,0 +1,26 @@
 2+From 76adb32c89184406278fd51a3fe138314b134a12 Mon Sep 17 00:00:00 2001
 3+From: Michael Forney <mforney@mforney.org>
 4+Date: Sat, 15 Jun 2019 20:58:00 -0700
 5+Subject: [PATCH] Remove `;` after function definition
 6+Upstream: https://github.com/ggreer/the_silver_searcher/pull/1324
 7+
 8+---
 9+ src/ignore.c | 2 +-
10+ 1 file changed, 1 insertion(+), 1 deletion(-)
11+
12+diff --git a/src/ignore.c b/src/ignore.c
13+index fa41889..bdb03b4 100644
14+--- a/src/ignore.c
15++++ b/src/ignore.c
16+@@ -39,7 +39,7 @@ const char *ignore_pattern_files[] = {
17+ 
18+ int is_empty(ignores *ig) {
19+     return (ig->extensions_len + ig->names_len + ig->slash_names_len + ig->regexes_len + ig->slash_regexes_len == 0);
20+-};
21++}
22+ 
23+ ignores *init_ignore(ignores *parent, const char *dirname, const size_t dirname_len) {
24+     ignores *ig = ag_malloc(sizeof(ignores));
25+-- 
26+2.20.1
27+
+33, -0
 1@@ -0,0 +1,33 @@
 2+From dc1be161f9155e92367714b38f6a45d05d4f90cd Mon Sep 17 00:00:00 2001
 3+From: Michael Forney <mforney@mforney.org>
 4+Date: Sat, 15 Jun 2019 20:58:46 -0700
 5+Subject: [PATCH] Use inline function for min instead of statement expression
 6+Upstream: https://github.com/ggreer/the_silver_searcher/pull/1324
 7+
 8+---
 9+ src/zfile.c | 9 +++++----
10+ 1 file changed, 5 insertions(+), 4 deletions(-)
11+
12+diff --git a/src/zfile.c b/src/zfile.c
13+index e4b7566..29fbb07 100644
14+--- a/src/zfile.c
15++++ b/src/zfile.c
16+@@ -33,10 +33,11 @@ typedef _off64_t off64_t;
17+ 
18+ #if HAVE_FOPENCOOKIE
19+ 
20+-#define min(a, b) ({				\
21+-	__typeof (a) _a = (a);			\
22+-	__typeof (b) _b = (b);			\
23+-	_a < _b ? _a : _b; })
24++static inline size_t
25++min(size_t a, size_t b)
26++{
27++	return a < b ? a : b;
28++}
29+ 
30+ static cookie_read_function_t zfile_read;
31+ static cookie_seek_function_t zfile_seek;
32+-- 
33+2.20.1
34+
+210, -0
  1@@ -0,0 +1,210 @@
  2+From 159e026212ba551981dc522690901b9291b8e235 Mon Sep 17 00:00:00 2001
  3+From: Michael Forney <mforney@mforney.org>
  4+Date: Sun, 16 Jun 2019 01:49:32 -0700
  5+Subject: [PATCH] Prevent duplicate definitions of global variables
  6+Upstream: https://github.com/ggreer/the_silver_searcher/pull/1324
  7+
  8+Multiple external definitions of an object is invalid in ISO C[0].
  9+
 10+These are visible when linking with -Wl,--warn-common.
 11+
 12+[0] http://port70.net/~nsz/c/c11/n1570.html#6.9p5
 13+---
 14+ src/ignore.c  |  2 ++
 15+ src/ignore.h  |  2 +-
 16+ src/log.c     |  2 ++
 17+ src/log.h     |  2 +-
 18+ src/options.c |  2 ++
 19+ src/options.h |  2 +-
 20+ src/search.c  | 13 +++++++++++++
 21+ src/search.h  | 20 ++++++++++----------
 22+ src/util.c    |  3 +++
 23+ src/util.h    |  4 ++--
 24+ 10 files changed, 37 insertions(+), 15 deletions(-)
 25+
 26+diff --git a/src/ignore.c b/src/ignore.c
 27+index bdb03b4..56c102a 100644
 28+--- a/src/ignore.c
 29++++ b/src/ignore.c
 30+@@ -22,6 +22,8 @@ const int fnmatch_flags = FNM_PATHNAME;
 31+ 
 32+ /* TODO: build a huge-ass list of files we want to ignore by default (build cache stuff, pyc files, etc) */
 33+ 
 34++ignores *root_ignores;
 35++
 36+ const char *evil_hardcoded_ignore_files[] = {
 37+     ".",
 38+     "..",
 39+diff --git a/src/ignore.h b/src/ignore.h
 40+index 20d5a6a..8db0f37 100644
 41+--- a/src/ignore.h
 42++++ b/src/ignore.h
 43+@@ -29,7 +29,7 @@ struct ignores {
 44+ };
 45+ typedef struct ignores ignores;
 46+ 
 47+-ignores *root_ignores;
 48++extern ignores *root_ignores;
 49+ 
 50+ extern const char *evil_hardcoded_ignore_files[];
 51+ extern const char *ignore_pattern_files[];
 52+diff --git a/src/log.c b/src/log.c
 53+index 1481b6d..aef0b54 100644
 54+--- a/src/log.c
 55++++ b/src/log.c
 56+@@ -4,6 +4,8 @@
 57+ #include "log.h"
 58+ #include "util.h"
 59+ 
 60++pthread_mutex_t print_mtx;
 61++
 62+ static enum log_level log_threshold = LOG_LEVEL_ERR;
 63+ 
 64+ void set_log_level(enum log_level threshold) {
 65+diff --git a/src/log.h b/src/log.h
 66+index 85847ee..318622c 100644
 67+--- a/src/log.h
 68++++ b/src/log.h
 69+@@ -9,7 +9,7 @@
 70+ #include <pthread.h>
 71+ #endif
 72+ 
 73+-pthread_mutex_t print_mtx;
 74++extern pthread_mutex_t print_mtx;
 75+ 
 76+ enum log_level {
 77+     LOG_LEVEL_DEBUG = 10,
 78+diff --git a/src/options.c b/src/options.c
 79+index e63985e..70ef448 100644
 80+--- a/src/options.c
 81++++ b/src/options.c
 82+@@ -16,6 +16,8 @@
 83+ #include "print.h"
 84+ #include "util.h"
 85+ 
 86++cli_options opts;
 87++
 88+ const char *color_line_number = "\033[1;33m"; /* bold yellow */
 89+ const char *color_match = "\033[30;43m";      /* black with yellow background */
 90+ const char *color_path = "\033[1;32m";        /* bold green */
 91+diff --git a/src/options.h b/src/options.h
 92+index db3e896..fd7d1f0 100644
 93+--- a/src/options.h
 94++++ b/src/options.h
 95+@@ -91,7 +91,7 @@ typedef struct {
 96+ } cli_options;
 97+ 
 98+ /* global options. parse_options gives it sane values, everything else reads from it */
 99+-cli_options opts;
100++extern cli_options opts;
101+ 
102+ typedef struct option option_t;
103+ 
104+diff --git a/src/search.c b/src/search.c
105+index ff5e386..2245818 100644
106+--- a/src/search.c
107++++ b/src/search.c
108+@@ -2,6 +2,19 @@
109+ #include "print.h"
110+ #include "scandir.h"
111+ 
112++size_t alpha_skip_lookup[256];
113++size_t *find_skip_lookup;
114++uint8_t h_table[H_SIZE] __attribute__((aligned(64)));
115++
116++work_queue_t *work_queue;
117++work_queue_t *work_queue_tail;
118++int done_adding_files;
119++pthread_cond_t files_ready;
120++pthread_mutex_t stats_mtx;
121++pthread_mutex_t work_queue_mtx;
122++
123++symdir_t *symhash;
124++
125+ void search_buf(const char *buf, const size_t buf_len,
126+                 const char *dir_full_path) {
127+     int binary = -1; /* 1 = yes, 0 = no, -1 = don't know */
128+diff --git a/src/search.h b/src/search.h
129+index 1071114..a1bc5d7 100644
130+--- a/src/search.h
131++++ b/src/search.h
132+@@ -31,9 +31,9 @@
133+ #include "uthash.h"
134+ #include "util.h"
135+ 
136+-size_t alpha_skip_lookup[256];
137+-size_t *find_skip_lookup;
138+-uint8_t h_table[H_SIZE] __attribute__((aligned(64)));
139++extern size_t alpha_skip_lookup[256];
140++extern size_t *find_skip_lookup;
141++extern uint8_t h_table[H_SIZE] __attribute__((aligned(64)));
142+ 
143+ struct work_queue_t {
144+     char *path;
145+@@ -41,12 +41,12 @@ struct work_queue_t {
146+ };
147+ typedef struct work_queue_t work_queue_t;
148+ 
149+-work_queue_t *work_queue;
150+-work_queue_t *work_queue_tail;
151+-int done_adding_files;
152+-pthread_cond_t files_ready;
153+-pthread_mutex_t stats_mtx;
154+-pthread_mutex_t work_queue_mtx;
155++extern work_queue_t *work_queue;
156++extern work_queue_t *work_queue_tail;
157++extern int done_adding_files;
158++extern pthread_cond_t files_ready;
159++extern pthread_mutex_t stats_mtx;
160++extern pthread_mutex_t work_queue_mtx;
161+ 
162+ 
163+ /* For symlink loop detection */
164+@@ -64,7 +64,7 @@ typedef struct {
165+     UT_hash_handle hh;
166+ } symdir_t;
167+ 
168+-symdir_t *symhash;
169++extern symdir_t *symhash;
170+ 
171+ void search_buf(const char *buf, const size_t buf_len,
172+                 const char *dir_full_path);
173+diff --git a/src/util.c b/src/util.c
174+index cb23914..103be46 100644
175+--- a/src/util.c
176++++ b/src/util.c
177+@@ -21,6 +21,9 @@
178+     }                                     \
179+     return ptr;
180+ 
181++FILE *out_fd;
182++ag_stats stats;
183++
184+ void *ag_malloc(size_t size) {
185+     void *ptr = malloc(size);
186+     CHECK_AND_RETURN(ptr)
187+diff --git a/src/util.h b/src/util.h
188+index 0c9b9b1..338b05f 100644
189+--- a/src/util.h
190++++ b/src/util.h
191+@@ -12,7 +12,7 @@
192+ #include "log.h"
193+ #include "options.h"
194+ 
195+-FILE *out_fd;
196++extern FILE *out_fd;
197+ 
198+ #ifndef TRUE
199+ #define TRUE 1
200+@@ -51,7 +51,7 @@ typedef struct {
201+ } ag_stats;
202+ 
203+ 
204+-ag_stats stats;
205++extern ag_stats stats;
206+ 
207+ /* Union to translate between chars and words without violating strict aliasing */
208+ typedef union {
209+-- 
210+2.20.1
211+
+1, -0
1@@ -0,0 +1 @@
2+Subproject commit 520ff29c528503668020c8cbedb5b03bccf4c7e0
+1, -0
1@@ -0,0 +1 @@
2+2.2.0 r0
+1, -0
1@@ -45,6 +45,7 @@ return {
2 		'nasm', 
3 		'qbe',
4 		'strace',
5+		'the_silver_searcher',
6 	},
7 	net={
8 		'catgirl',