commit 7850eb4

hovercats  ·  2024-05-14 11:48:55 +0000 UTC
parent c3159c7
zstd: import from oasis
8 files changed,  +124, -0
+4, -0
1@@ -136,3 +136,7 @@
2 [submodule "pkg/quark/src"]
3 	path = pkg/quark/src
4 	url = git://git.suckless.org/quark
5+[submodule "pkg/zstd/src"]
6+	path = pkg/zstd/src
7+	url = https://github.com/facebook/zstd
8+	ignore = all
+1, -0
1@@ -59,3 +59,4 @@ subgen 'vis'
2 subgen 'wpa_supplicant'
3 subgen 'xz'
4 subgen 'zlib'
5+subgen 'zstd'
+8, -0
1@@ -0,0 +1,8 @@
2+#define ZSTD_NO_UNUSED_FUNCTIONS
3+#define ZSTD_MULTITHREAD
4+#define XXH_NAMESPACE ZSTD_
5+#define ZSTD_NOBENCH
6+#define ZSTD_NODICT
7+#define ZSTD_NOTRACE
8+#define ZSTD_DISABLE_DEPRECATE_WARNINGS
9+#define ZDICT_DISABLE_DEPRECATE_WARNINGS
+58, -0
 1@@ -0,0 +1,58 @@
 2+cflags{
 3+	'-Wall', '-Wextra', '-Wpedantic',
 4+	'-include $dir/config.h',
 5+}
 6+
 7+pkg.hdrs = {
 8+	copy('$outdir/include', '$srcdir/lib', {'zstd.h', 'zdict.h', 'zstd_errors.h'}),
 9+}
10+pkg.deps = {
11+	'$gendir/headers',
12+	'$dir/config.h',
13+}
14+
15+lib('libzstd.a', [[lib/(
16+	common/(
17+		debug.c
18+		entropy_common.c
19+		error_private.c
20+		fse_decompress.c
21+		pool.c
22+		threading.c
23+		xxhash.c
24+		zstd_common.c
25+	)
26+	compress/(
27+		fse_compress.c
28+		hist.c
29+		huf_compress.c
30+		zstd_compress.c
31+		zstd_compress_literals.c
32+		zstd_compress_sequences.c
33+		zstd_compress_superblock.c
34+		zstd_double_fast.c
35+		zstd_fast.c
36+		zstd_lazy.c
37+		zstd_ldm.c
38+		zstd_opt.c
39+		zstdmt_compress.c
40+	)
41+	decompress/(
42+		huf_decompress.c
43+		zstd_ddict.c
44+		zstd_decompress.c
45+		zstd_decompress_block.c
46+	)
47+)]])
48+
49+exe('zstd', [[
50+	programs/(zstdcli.c util.c timefn.c fileio.c)
51+	libzstd.a
52+]])
53+file('bin/zstd', '755', '$outdir/zstd')
54+sym('bin/unzstd', 'zstd')
55+sym('bin/zstdcat', 'zstd')
56+
57+man{'programs/zstd.1'}
58+
59+fetch 'git'
+25, -0
 1@@ -0,0 +1,25 @@
 2+From 7bc019c4c96b4eae8fe05dd31c4ea781441d437c Mon Sep 17 00:00:00 2001
 3+From: Michael Forney <mforney@mforney.org>
 4+Date: Mon, 10 Jun 2019 01:47:01 -0700
 5+Subject: [PATCH] Only use __asm__ on GNU-compatible compilers
 6+
 7+---
 8+ lib/common/cpu.h | 2 +-
 9+ 1 file changed, 1 insertion(+), 1 deletion(-)
10+
11+diff --git a/lib/common/cpu.h b/lib/common/cpu.h
12+index cb210593..3c43f816 100644
13+--- a/lib/common/cpu.h
14++++ b/lib/common/cpu.h
15+@@ -82,7 +82,7 @@ MEM_STATIC ZSTD_cpuid_t ZSTD_cpuid(void) {
16+           : "a"(7), "c"(0)
17+           : "edx");
18+     }
19+-#elif defined(__x86_64__) || defined(_M_X64) || defined(__i386__)
20++#elif (defined(__x86_64__) || defined(_M_X64) || defined(__i386__)) && defined(__GNUC__)
21+     U32 n;
22+     __asm__("cpuid" : "=a"(n) : "a"(0) : "ebx", "ecx", "edx");
23+     if (n >= 1) {
24+-- 
25+2.29.2
26+
+26, -0
 1@@ -0,0 +1,26 @@
 2+From 0f2837d010dce1f0a384c3ba6f54a86f39c607d5 Mon Sep 17 00:00:00 2001
 3+From: Dan Nelson <dnelson_1901@yahoo.com>
 4+Date: Sat, 15 May 2021 10:20:37 -0500
 5+Subject: [PATCH] ZSTD_VecMask_next: fix incorrect variable name in fallback
 6+ code path
 7+
 8+---
 9+ lib/compress/zstd_lazy.c | 2 +-
10+ 1 file changed, 1 insertion(+), 1 deletion(-)
11+
12+diff --git a/lib/compress/zstd_lazy.c b/lib/compress/zstd_lazy.c
13+index 3d523e84..9e13f37c 100644
14+--- a/lib/compress/zstd_lazy.c
15++++ b/lib/compress/zstd_lazy.c
16+@@ -1081,7 +1081,7 @@ static U32 ZSTD_VecMask_next(ZSTD_VecMask val) {
17+         0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8,
18+ 		31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9
19+     };
20+-	return multiplyDeBruijnBitPosition[((U32)((v & -(int)v) * 0x077CB531U)) >> 27];
21++	return multiplyDeBruijnBitPosition[((U32)((val & -(int)val) * 0x077CB531U)) >> 27];
22+ #   endif
23+ }
24+ 
25+-- 
26+2.31.1
27+
+1, -0
1@@ -0,0 +1 @@
2+Subproject commit a488ba114ec17ea1054b9057c26a046fc122b3b6
+1, -0
1@@ -0,0 +1 @@
2+1.5.0 r0